mobility-toolbox-js 1.3.9 → 1.3.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.js CHANGED
@@ -1,2 +1,2 @@
1
- !function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define("mobility-toolbox-js",[],e):"object"==typeof exports?exports["mobility-toolbox-js"]=e():t["mobility-toolbox-js"]=e()}(window,(function(){return function(t){var e={};function r(n){if(e[n])return e[n].exports;var o=e[n]={i:n,l:!1,exports:{}};return t[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}return r.m=t,r.c=e,r.d=function(t,e,n){r.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(t,e){if(1&e&&(t=r(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)r.d(n,o,function(e){return t[e]}.bind(null,o));return n},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="",r(r.s=24)}([function(t,e){t.exports=require("ol/proj")},function(t,e){t.exports=require("ol/style")},function(t,e){t.exports=require("ol/Observable")},function(t,e){t.exports=require("ol/geom")},function(t,e){t.exports=require("ol/extent")},function(t,e){t.exports=require("query-string")},function(t,e){t.exports=require("ol/layer")},function(t,e){t.exports=require("ol/format/GeoJSON")},function(t,e){t.exports=require("ol/Feature")},function(t,e){t.exports=require("ol/Object")},function(t,e){t.exports=require("ol/layer/Layer")},function(t,e){t.exports=require("mapbox-gl")},function(t,e){t.exports=require("ol/source/Source")},function(t,e){t.exports=require("ol/source")},function(t,e){t.exports=require("ol/geom/GeometryType")},function(t,e){t.exports=require("ol")},function(t,e){t.exports=require("ol/format")},function(t,e){t.exports=require("ol/Map")},function(t,e){t.exports=require("ol/control")},function(t,e){t.exports=require("ol/layer/Group")},function(t,e){t.exports=require("uuid")},function(t,e){t.exports=require("ol/geom/Point")},function(t,e){t.exports=require("ol/interaction")},function(t,e){t.exports=require("ol/events/condition")},function(t,e,r){t.exports=r(25)},function(t,e,r){"use strict";r.r(e);var n=r(17),o=r.n(n),i=r(18),c=r(2),a=r.n(c),u=r(19),s=r.n(u),l=r(20);function f(t){return(f="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function p(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function y(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?p(Object(r),!0).forEach((function(e){h(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):p(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function h(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function b(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function v(t,e){return(v=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function d(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=g(t);if(e){var o=g(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return m(this,r)}}function m(t,e){return!e||"object"!==f(e)&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}function g(t){return(g=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var O=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&v(t,e)}(i,t);var e,r,n,o=d(i);function i(t){var e;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,i),(e=o.call(this)).defineProperties(y({isQueryable:!0},t)),t.copyrights&&(e.copyrights=t.copyrights);var r=t.onClick;return r&&e.onClick(r),e}return e=i,(r=[{key:"defineProperties",value:function(t){var e=this,r=t.name,n=t.key,o=t.children,i=t.visible,c=t.properties,a=t.isBaseLayer,u=t.isQueryable,s=Object(l.v4)(),f=r||s;Object.defineProperties(this,{options:{value:t},name:{value:f},key:{value:n||f.toLowerCase()},isBaseLayer:{value:!!a},isQueryable:{value:!!u},isReactSpatialLayer:{value:!0},children:{value:o||[],writable:!0},copyrights:{get:function(){return e.get("copyrights")},set:function(t){var r=Array.isArray(t)?t:[t];return e.set("copyrights",r)}},visible:{value:void 0===i||i,writable:!0},properties:{value:y({},c||{})},map:{writable:!0},clickCallbacks:{value:[]}})}},{key:"init",value:function(t){this.terminate(),this.map=t}},{key:"terminate",value:function(){}},{key:"get",value:function(t){return this.properties[t]}},{key:"set",value:function(t,e){this.properties[t]=e,this.dispatchEvent({type:"change:".concat(t),target:this})}},{key:"setVisible",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=arguments.length>2&&void 0!==arguments[2]&&arguments[2],n=arguments.length>3&&void 0!==arguments[3]&&arguments[3];t!==this.visible&&(this.visible=t,this.dispatchEvent({type:"change:visible",target:this,stopPropagationDown:e,stopPropagationUp:r,stopPropagationSiblings:n}))}},{key:"getVisibleChildren",value:function(){return this.children.filter((function(t){return t.visible}))}},{key:"hasVisibleChildren",value:function(){return!!this.hasChildren(!0)}},{key:"hasChildren",value:function(t){return!!this.children.find((function(e){return e.visible===t}))}},{key:"addChild",value:function(t){this.children.unshift(t),this.dispatchEvent({type:"change:children",target:this})}},{key:"removeChild",value:function(t){for(var e=0;e<this.children.length;e+=1)if(this.children[e].name===t)return void this.children.splice(e,1);this.dispatchEvent({type:"change:children",target:this})}},{key:"getFeatureInfoAtCoordinate",value:function(){return Promise.resolve({layer:this,features:[],coordinate:null})}},{key:"onClick",value:function(t){if("function"!=typeof t)throw new Error("callback must be of type function.");this.clickCallbacks.includes(t)||this.clickCallbacks.push(t)}},{key:"unClick",value:function(t){if("function"==typeof t){var e=this.clickCallbacks.indexOf(t);e>=-1&&this.clickCallbacks.splice(e,1)}}}])&&b(e.prototype,r),n&&b(e,n),i}(a.a);function j(t){return(j="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function w(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function P(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?w(Object(r),!0).forEach((function(e){S(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):w(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function S(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function k(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function T(t,e,r){return(T="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(t,e,r){var n=function(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=_(t)););return t}(t,e);if(n){var o=Object.getOwnPropertyDescriptor(n,e);return o.get?o.get.call(r):o.value}})(t,e,r||t)}function C(t,e){return(C=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function R(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=_(t);if(e){var o=_(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return D(this,r)}}function D(t,e){return!e||"object"!==j(e)&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}function _(t){return(_=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var E=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&C(t,e)}(i,t);var e,r,n,o=R(i);function i(t){var e;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,i),(e=o.call(this,t)).olLayer&&e.olLayer.setVisible(e.visible),e}return e=i,(r=[{key:"defineProperties",value:function(t){T(_(i.prototype),"defineProperties",this).call(this,t),Object.defineProperties(this,{olLayer:{value:t.olLayer,writable:!0},olListenersKeys:{value:[]}})}},{key:"init",value:function(t){var e=this;if(T(_(i.prototype),"init",this).call(this,t),this.map&&this.olLayer&&(this.olListenersKeys.push(this.map.getLayers().on("remove",(function(t){t.element===e.olLayer&&e.terminate()}))),this.copyrights)){var r=this.copyrights||[];this.olLayer instanceof s.a?this.olLayer.getLayers().getArray().forEach((function(t){t.getSource().setAttributions(r)})):this.olLayer.getSource().setAttributions(r)}}},{key:"terminate",value:function(){Object(c.unByKey)(this.olListenersKeys),T(_(i.prototype),"terminate",this).call(this)}},{key:"setVisible",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=arguments.length>2&&void 0!==arguments[2]&&arguments[2],n=arguments.length>3&&void 0!==arguments[3]&&arguments[3];t!==this.visible&&(T(_(i.prototype),"setVisible",this).call(this,t,e,r,n),this.olLayer&&this.olLayer.setVisible(this.visible))}},{key:"clone",value:function(t){return new i(P(P({},this.options),t))}}])&&k(e.prototype,r),n&&k(e,n),i}(O),x=r(9),I=r.n(x);function M(t){return(M="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function A(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function L(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?A(Object(r),!0).forEach((function(e){V(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):A(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function V(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function U(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function F(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function q(t,e){return(q=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function N(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=B(t);if(e){var o=B(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return z(this,r)}}function z(t,e){return!e||"object"!==M(e)&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}function B(t){return(B=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var K=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&q(t,e)}(i,t);var e,r,n,o=N(i);function i(){var t,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};U(this,i),(t=o.call(this,e)).defineProperties(e);var r=L({active:!1!==e.active},e),n=r.active;return t.active=n,t}return e=i,(r=[{key:"defineProperties",value:function(t){var e=this,r=L({},t),n=r.target,o=r.element,i=r.render;Object.defineProperties(this,{active:{get:function(){return e.get("active")},set:function(t){e.set("active",t),t?e.activate():e.deactivate(),e.render()}},map:{get:function(){return e.get("map")},set:function(t){if(e.map&&e.element&&e.element.parentNode&&e.element.parentNode.removeChild(e.element),e.deactivate(),e.set("map",t),e.map){var r=e.target||e.map.getContainer();e.element||e.createDefaultElement(),e.element&&r.appendChild(e.element),e.active&&e.activate()}e.render()}},target:{value:n},element:{value:o,writable:!0},render:{value:i||this.render,writable:!0}})}},{key:"activate",value:function(){this.deactivate()}},{key:"deactivate",value:function(){}},{key:"render",value:function(){}},{key:"createDefaultElement",value:function(){}}])&&F(e.prototype,r),n&&F(e,n),i}(I.a);function G(t){return(G="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function Z(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function H(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?Z(Object(r),!0).forEach((function(e){W(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Z(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function W(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function $(t,e,r){return($="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(t,e,r){var n=function(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=X(t)););return t}(t,e);if(n){var o=Object.getOwnPropertyDescriptor(n,e);return o.get?o.get.call(r):o.value}})(t,e,r||t)}function J(t,e){return(J=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function Q(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=X(t);if(e){var o=X(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return Y(this,r)}}function Y(t,e){return!e||"object"!==G(e)&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}function X(t){return(X=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function tt(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function et(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function rt(t,e,r){return e&&et(t.prototype,e),r&&et(t,r),t}var nt=function(t){return function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&J(t,e)}(r,t);var e=Q(r);function r(){var t,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return tt(this,r),(t=e.call(this,H(H({},n),{},{layers:[],controls:[]}))).mobilityLayers=[],t.mobilityControls=[],(n.controls||[]).forEach((function(e){t.addControl(e)})),(n.layers||[]).forEach((function(e){t.addLayer(e)})),t}return rt(r,[{key:"getMobilityLayers",value:function(){return this.mobilityLayers}},{key:"getMobilityControls",value:function(){return this.mobilityControls}},{key:"addMobilityControl",value:function(t){this.mobilityControls.push(t),t.map=this}},{key:"removeMobilityControl",value:function(t){t.map=null,this.mobilityControls=this.mobilityControls.filter((function(e){return e!==t}))}},{key:"addControl",value:function(t,e){t instanceof K?this.addMobilityControl(t):$(X(r.prototype),"addControl",this).call(this,t,e)}},{key:"removeControl",value:function(t){t instanceof K?this.removeMobilityControl(t):$(X(r.prototype),"removeControl",this).call(this,t)}}]),r}(t)},ot=r(10),it=r.n(ot);function ct(t){return(ct="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function at(t,e){return(at=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function ut(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=lt(t);if(e){var o=lt(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return st(this,r)}}function st(t,e){return!e||"object"!==ct(e)&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}function lt(t){return(lt=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function ft(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function pt(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function yt(t,e,r){return e&&pt(t.prototype,e),r&&pt(t,r),t}var ht=function(t){return function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&at(t,e)}(r,t);var e=ut(r);function r(){return ft(this,r),e.apply(this,arguments)}return yt(r,[{key:"render",value:function(){this.element&&(this.element.innerHTML=this.active?this.getCopyrights().join(" | "):"")}},{key:"createDefaultElement",value:function(){this.element=document.createElement("div"),this.element.id="mbt-copyright",Object.assign(this.element.style,{position:"absolute",bottom:0,right:0,fontSize:".8rem",padding:"0 10px"})}}]),r}(t)};function bt(t){return function(t){if(Array.isArray(t))return vt(t)}(t)||function(t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(t))return Array.from(t)}(t)||function(t,e){if(!t)return;if("string"==typeof t)return vt(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return vt(t,e)}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function vt(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}var dt=function(t){var e=t.filter((function(t){return null!=t&&t.trim&&t.trim()})),r=e.map((function(t){return t.toLowerCase()}));return bt(new Set(r)).map((function(t){return e.find((function(e){return e.toLowerCase()===t}))}))};function mt(t){return(mt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function gt(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function Ot(t,e,r){return(Ot="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(t,e,r){var n=function(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=kt(t)););return t}(t,e);if(n){var o=Object.getOwnPropertyDescriptor(n,e);return o.get?o.get.call(r):o.value}})(t,e,r||t)}function jt(t,e){return(jt=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function wt(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=kt(t);if(e){var o=kt(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return Pt(this,r)}}function Pt(t,e){return!e||"object"!==mt(e)&&"function"!=typeof e?St(t):e}function St(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function kt(t){return(kt=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var Tt=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&jt(t,e)}(i,t);var e,r,n,o=wt(i);function i(t){var e;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,i),(e=o.call(this,t)).onPostRender=e.onPostRender.bind(St(e)),e}return e=i,(r=[{key:"getCopyrights",value:function(){var t=this;if(!this.frameState)return[];var e=[];return this.frameState.layerStatesArray.forEach((function(r){var n=r.layer;Object(ot.inView)(r,t.frameState.viewState)&&n&&n.getSource&&n.getSource()&&n.getSource().getAttributions()&&(e=e.concat(n.getSource().getAttributions()(t.frameState)))})),dt(e)}},{key:"activate",value:function(){Ot(kt(i.prototype),"activate",this).call(this),this.map&&this.map.on("postrender",this.onPostRender)}},{key:"deactivate",value:function(){this.map&&this.map.un("postrender",this.onPostRender),Ot(kt(i.prototype),"deactivate",this).call(this)}},{key:"onPostRender",value:function(t){this.map&&this.element&&(this.frameState=t.frameState,this.render())}}])&&gt(e.prototype,r),n&&gt(e,n),i}(ht(K));function Ct(t){return(Ct="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function Rt(t){return function(t){if(Array.isArray(t))return Dt(t)}(t)||function(t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(t))return Array.from(t)}(t)||function(t,e){if(!t)return;if("string"==typeof t)return Dt(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Dt(t,e)}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Dt(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function _t(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function Et(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?_t(Object(r),!0).forEach((function(e){xt(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):_t(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function xt(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function It(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Mt(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function At(t,e,r){return(At="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(t,e,r){var n=function(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=Ft(t)););return t}(t,e);if(n){var o=Object.getOwnPropertyDescriptor(n,e);return o.get?o.get.call(r):o.value}})(t,e,r||t)}function Lt(t,e){return(Lt=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function Vt(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=Ft(t);if(e){var o=Ft(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return Ut(this,r)}}function Ut(t,e){return!e||"object"!==Ct(e)&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}function Ft(t){return(Ft=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var qt=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&Lt(t,e)}(c,t);var e,r,n,o=Vt(c);function c(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return It(this,c),o.call(this,Et({controls:[].concat(Rt(Object(i.defaults)({attribution:!1}).getArray()),[new Tt])},t))}return e=c,(r=[{key:"getContainer",value:function(){return this.getTargetElement()}},{key:"addLayer",value:function(t){t instanceof E?(t.init(this),this.mobilityLayers.push(t),t.olLayer&&At(Ft(c.prototype),"addLayer",this).call(this,t.olLayer),this.dispatchEvent({type:"change:mobilityLayers",target:this})):At(Ft(c.prototype),"addLayer",this).call(this,t)}},{key:"removeLayer",value:function(t){t instanceof E?(t.terminate(),this.mobilityLayers=this.mobilityLayers.filter((function(e){return e!==t})),t.olLayer&&At(Ft(c.prototype),"removeLayer",this).call(this,t)):At(Ft(c.prototype),"removeLayer",this).call(this,t)}},{key:"addControl",value:function(t){At(Ft(c.prototype),"addControl",this).call(this,t)}},{key:"removeControl",value:function(t){At(Ft(c.prototype),"removeControl",this).call(this,t)}}])&&Mt(e.prototype,r),n&&Mt(e,n),c}(nt(o.a)),Nt=r(0),zt=r(11),Bt=r.n(zt),Kt=r(12),Gt=r.n(Kt),Zt=r(7),Ht=r.n(Zt),Wt=function(t){if(!t||!t.style)return[];var e=t.style.sourceCaches,r=[];return Object.values(e).forEach((function(t){if(t.used){var e=t.getSource(),n=e.attribution||e.options&&e.options.attribution;n&&(r=r.concat(n.replace(/&copy;/g,"©").split(/(<a.*?<\/a>)/)))}})),dt(r)},$t=r(5),Jt=r.n($t);function Qt(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function Yt(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?Qt(Object(r),!0).forEach((function(e){Xt(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Qt(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function Xt(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var te=function(t,e,r){if(!1===t)return r;var n=Jt.a.parseUrl(r);return!t&&n.query[e]?r:t?Jt.a.stringifyUrl(Yt(Yt({},n),{},{query:Yt(Yt({},n.query),{},Xt({},e,t))})):(console.warn("No apiKey is defined for request to ".concat(r)),null)};function ee(t){return(ee="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function re(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(t)))return;var r=[],n=!0,o=!1,i=void 0;try{for(var c,a=t[Symbol.iterator]();!(n=(c=a.next()).done)&&(r.push(c.value),!e||r.length!==e);n=!0);}catch(t){o=!0,i=t}finally{try{n||null==a.return||a.return()}finally{if(o)throw i}}return r}(t,e)||function(t,e){if(!t)return;if("string"==typeof t)return ne(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return ne(t,e)}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function ne(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function oe(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function ie(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?oe(Object(r),!0).forEach((function(e){ce(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):oe(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function ce(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function ae(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function ue(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function se(t,e,r){return(se="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(t,e,r){var n=function(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=he(t)););return t}(t,e);if(n){var o=Object.getOwnPropertyDescriptor(n,e);return o.get?o.get.call(r):o.value}})(t,e,r||t)}function le(t,e){return(le=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function fe(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=he(t);if(e){var o=he(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return pe(this,r)}}function pe(t,e){return!e||"object"!==ee(e)&&"function"!=typeof e?ye(t):e}function ye(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function he(t){return(he=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var be=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&le(t,e)}(i,t);var e,r,n,o=fe(i);function i(){var t,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};ae(this,i);var r=new it.a({source:new Gt.a({}),render:function(e){if(!t.mbMap)return console.warn("Mapbox map doesn't exist."),null;var r=!1,n=t.mbMap.getCanvas(),o=e.viewState,i=t.olLayer.getVisible();t.renderState.visible!==i&&(n.style.display=i?"block":"none",t.renderState.visible=i,n.style.position="absolute");var c=t.olLayer.getOpacity();t.renderState.opacity!==c&&(n.style.opacity=c,t.renderState.opacity=c);var a=o.rotation;t.renderState.rotation!==a&&(t.mbMap.rotateTo(180*-(a||0)/Math.PI,{animate:!1}),r=!0,t.renderState.rotation=a),t.renderState.zoom===o.zoom&&t.renderState.center[0]===o.center[0]&&t.renderState.center[1]===o.center[1]||(t.mbMap.jumpTo({center:Object(Nt.toLonLat)(o.center),zoom:o.zoom-1,animate:!1}),r=!0,t.renderState.zoom=o.zoom,t.renderState.center=o.center);var u=t.map.getSize();if(t.renderState.size[0]===u[0]&&t.renderState.size[1]===u[1]||(r=!0,t.renderState.size=u),t.mbMap&&t.mbMap.style&&t.mbMap.isStyleLoaded()&&r)try{t.mbMap._frame&&(t.mbMap._frame.cancel(),t.mbMap._frame=null),t.mbMap._render()}catch(t){console.warn(t)}return n}});return(t=o.call(this,ie(ie({},e),{},{olLayer:r}))).styleUrl=e.url,t.apiKey=e.apiKey,t.apiKeyName=e.apiKeyName||"key",t.updateAttribution=t.updateAttribution.bind(ye(t)),t}return e=i,(r=[{key:"init",value:function(t){var e=this;se(he(i.prototype),"init",this).call(this,t),this.map&&!this.mbMap&&(this.format=new Ht.a({featureProjection:this.map.getView().getProjection()}),this.loadMbMap(),this.olListenersKeys.push(this.map.on("change:size",(function(){try{e.mbMap&&e.mbMap.resize()}catch(t){console.warn(t)}}))))}},{key:"createStyleUrl",value:function(){return te(this.apiKey,this.apiKeyName,this.styleUrl)}},{key:"loadMbMap",value:function(){var t=this;if(this.olListenersKeys.push(this.map.on("change:target",(function(){t.loadMbMap()}))),this.map.getTargetElement())if(this.visible){var e=re(this.map.getView().getCenter(),2),r=e[0],n=e[1];r&&n||(r=0,n=0);var o=this.createStyleUrl();try{this.mbMap=new Bt.a.Map({style:o,attributionControl:!1,boxZoom:!1,center:Object(Nt.toLonLat)([r,n]),container:this.map.getTargetElement(),interactive:!1,fadeDuration:"fadeDuration"in this.options?this.options.fadeDuration:300,preserveDrawingBuffer:this.options.preserveDrawingBuffer||!1})}catch(t){console.warn("Failed creating mapbox map: ",t)}this.renderState={center:[r,n],zoom:null,rotation:null,visible:null,opacity:null,size:[0,0]},this.mbMap.once("load",(function(){t.loaded=!0,t.copyrights=t.copyrights||Wt(t.mbMap)||[],t.olLayer.getSource().setAttributions(t.copyrights),t.dispatchEvent({type:"load",target:t})}));var i=this.mbMap.getCanvas();i&&(this.options.tabIndex?i.setAttribute("tabindex",this.options.tabIndex):i.removeAttribute("tabindex")),this.mbMap.on("idle",this.updateAttribution)}else this.olListenersKeys.push(this.once("change:visible",(function(){t.loadMbMap()})))}},{key:"updateAttribution",value:function(t){var e=this.copyrights||Wt(t.target)||[];this.copyrights.toString()!==e.toString()&&this.olLayer.getSource().setAttributions(e)}},{key:"getFeatureInfoAtCoordinate",value:function(t,e){var r=this;if(!(e&&this.format&&this.mbMap&&this.mbMap.isStyleLoaded()))return Promise.resolve({coordinate:t,features:[],layer:this});var n=t&&this.mbMap.project(Object(Nt.toLonLat)(t)),o=this.mbMap.queryRenderedFeatures(n,e).map((function(t){var e=r.format.readFeature(t);return e&&e.set("mapboxFeature",t),e}));return Promise.resolve({layer:this,features:o,coordinate:t})}},{key:"terminate",value:function(){this.mbMap&&(this.mbMap.off("idle",this.updateAttribution),this.mbMap.triggerRepaint=function(){},this.mbMap.remove(),this.mbMap=null),this.loaded=!1,se(he(i.prototype),"terminate",this).call(this)}},{key:"clone",value:function(t){return new i(ie(ie({},this.options),t))}}])&&ue(e.prototype,r),n&&ue(e,n),i}(E);var ve=r(1),de=r(13),me=r(6);var ge=r(4),Oe=r(14),je=r.n(Oe);function we(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(t)))return;var r=[],n=!0,o=!1,i=void 0;try{for(var c,a=t[Symbol.iterator]();!(n=(c=a.next()).done)&&(r.push(c.value),!e||r.length!==e);n=!0);}catch(t){o=!0,i=t}finally{try{n||null==a.return||a.return()}finally{if(o)throw i}}return r}(t,e)||function(t,e){if(!t)return;if("string"==typeof t)return Pe(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Pe(t,e)}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Pe(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function Se(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function ke(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Te(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}var Ce=function(){function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t);var r=function(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?Se(Object(r),!0).forEach((function(e){ke(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Se(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}({interpolate:!0},e);this.trajectories=[],this.renderedTrajectories=[],this.interpolate=!!r.interpolate,this.getPixelFromCoordinate=r.getPixelFromCoordinate,this.hoverVehicleId=null,this.selectedVehicleId=null,this.iconScale=r.iconScale,this.canvas=r.canvas||document.createElement("canvas"),this.canvas.width=r.width,this.canvas.height=r.height,this.canvas.setAttribute("style",["position: absolute","top: 0","bottom: 0","width: 100%","height: 100%","pointer-events: none","visibility: visible","margin-top: inherit"].join(";")),this.canvasContext=this.canvas.getContext("2d")}var e,r,n;return e=t,(r=[{key:"setVisible",value:function(t){this.canvas&&(this.canvas.style.visibility=t?"visible":"hidden")}},{key:"setTrajectories",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];this.sort&&t.sort(this.sort),this.trajectories=t}},{key:"getTrajectories",value:function(){return this.trajectories||[]}},{key:"getRenderedTrajectories",value:function(){return this.renderedTrajectories}},{key:"clear",value:function(){this.canvasContext&&this.canvasContext.clearRect(0,0,this.canvas.width,this.canvas.height)}},{key:"setFilter",value:function(t){this.filter=t}},{key:"setSort",value:function(t){this.sort=t}},{key:"setHoverVehicleId",value:function(t){t!==this.hoverVehicleId&&(this.hoverVehicleId=t)}},{key:"setSelectedVehicleId",value:function(t){t!==this.selectedVehicleId&&(this.selectedVehicleId=t)}},{key:"setIconScale",value:function(t){this.iconScale=t}},{key:"setStyle",value:function(t){this.style=t}},{key:"moveCanvas",value:function(t,e){var r=parseFloat(this.canvas.style.left),n=parseFloat(this.canvas.style.top);this.canvas.style.left="".concat(r-t,"px"),this.canvas.style.top="".concat(n-e,"px")}},{key:"renderTrajectories",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Date.now(),e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],r=arguments.length>2?arguments[2]:void 0,n=arguments.length>3&&void 0!==arguments[3]&&arguments[3];this.clear(),this.canvas.style.left="0px",this.canvas.style.top="0px";var o,i,c,a,u,s,l,f,p=we(e,2),y=p[0],h=p[1];if(y&&h&&(this.canvas.width!==y||this.canvas.height!==h)){var b=[y,h];this.canvas.width=b[0],this.canvas.height=b[1]}this.currResolution=r||this.currResolution,this.renderedTrajectories=[];for(var v=(this.trajectories||[]).length-1;v>=0;v-=1){var d=this.trajectories[v],m=d.geometry,g=d.timeIntervals,O=d.timeOffset;if(!this.filter||this.filter(d,v,this.trajectories)){var j=null,w=void 0;if(!d.coordinate||!n&&this.interpolate){if(g&&g.length>1){for(var P=t-(O||0),S=void 0,k=void 0,T=void 0,C=void 0,R=void 0,D=0;D<g.length-1;D+=1){var _=we(g[D],3);S=_[0],T=_[1],w=_[2];var E=we(g[D+1],2);if(k=E[0],C=E[1],S<=P&&P<=k)break;S=null,k=null}if(m.getType()===je.a.POINT)j=m.getCoordinates();else if(m.getType()===je.a.LINE_STRING){if(S&&k){R=this.interpolate?Math.min((P-S)/(k-S),1):0;var x=this.interpolate?R*(C-T)+T:0;j=m.getCoordinateAt(x),this.trajectories[v].rotation=w,this.trajectories[v].endFraction=R}else if(P<g[0][0]){var I=we(g,1),M=we(I[0],3);w=M[2],R=0,j=m.getFirstCoordinate()}else if(P>g[g.length-1][0]){var A=we(g[g.length-1],3);w=A[2],R=1,j=m.getLastCoordinate()}}else console.error("This geometry type is not supported. Only Point or LineString are. Current geometry: ",m);this.trajectories[v].rotation=w,this.trajectories[v].endFraction=R||0}}else j=d.coordinate;if(j){this.trajectories[v].coordinate=j;var L=this.getPixelFromCoordinate(j);if(!L)continue;this.trajectories[v].rendered=!0,this.renderedTrajectories.push(this.trajectories[v]);var V=this.style(d,this.currResolution);if(!V)continue;var U=V.width,F=V.height;this.iconScale&&(F=Math.floor(F*this.iconScale),U=Math.floor(U*this.iconScale)),this.hoverVehicleId!==d.id&&this.selectedVehicleId!==d.id&&this.canvasContext.drawImage(V,L[0]-U/2,L[1]-F/2,U,F),this.hoverVehicleId===d.id&&(o=V,i=L,c=U,a=F),this.selectedVehicleId===d.id&&(u=V,s=L,l=U,f=F)}}}u&&this.canvasContext.drawImage(u,s[0]-l/2,s[1]-f/2,l,f),o&&this.canvasContext.drawImage(o,i[0]-c/2,i[1]-a/2,c,a)}},{key:"destroy",value:function(){Object(c.unByKey)(this.olEventsKeys),this.renderedTrajectories=[],this.clear()}}])&&Te(e.prototype,r),n&&Te(e,n),t}(),Re={0:[0,0,0,0,0,7,7,7,7,7,7,7,7,7,7,7,7],1:[0,0,0,0,0,7,7,7,7,7,7,7,7,7,7,7,7],2:[0,0,0,0,0,2,2,3,7,7,7,12,15,15,15,15,15],3:[0,0,0,0,0,7,7,7,7,7,7,7,7,7,7,7,7],4:[0,0,0,0,0,7,7,7,7,7,7,7,7,7,7,7,7],5:[0,0,0,0,0,7,7,7,7,7,7,7,7,7,7,7,7],6:[0,0,0,0,0,7,7,7,7,7,7,7,7,7,7,7,7],7:[0,0,0,0,0,7,7,7,7,7,7,7,7,7,7,7,7],8:[0,0,0,0,0,7,7,7,7,7,7,7,7,7,7,7,7],9:[0,0,0,0,0,2,2,3,7,7,7,12,15,15,15,15,15]},De=["Tram","Subway / Metro / S-Bahn","Train","Bus","Ferry","Cable Car","Gondola","Funicular","Long distance bus","Rail"],_e=["#ffb400","#ff5400","#ff8080","#ea0000","#3000ff","#ffb400","#41a27b","#00d237","#b5b5b5","#ff8080"],Ee=["#000000","#ffffff","#000000","#ffffff","#ffffff","#000000","#ffffff","#000000","#000000","#000000"],xe=[1e5,5e4,4e4,3e4,2e4,15e3,1e4,5e3,2e3,1e3,400,300,250,180,90,60,50,50,50,50,50],Ie=function(t){if("string"==typeof t){var e=De.find((function(e){return new RegExp(t).test(e)}));return De.indexOf(e)}return t},Me=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;try{var e=Ie(t);return _e[e]}catch(t){return 1}},Ae=function(t,e,r){return e?r?"#ff0000":"#a0a0a0":t>=36e5?"#ed004c":t>=5e5?"#e80000":t>=3e5?"#ff4a00":t>=18e4?"#f7bf00":null===t?"#a0a0a0":"#00a00c"};function Le(t){return(Le="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function Ve(t){return function(t){if(Array.isArray(t))return Ue(t)}(t)||function(t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(t))return Array.from(t)}(t)||function(t,e){if(!t)return;if("string"==typeof t)return Ue(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Ue(t,e)}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Ue(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function Fe(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function qe(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Ne(t,e,r){return(Ne="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(t,e,r){var n=function(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=Ge(t)););return t}(t,e);if(n){var o=Object.getOwnPropertyDescriptor(n,e);return o.get?o.get.call(r):o.value}})(t,e,r||t)}function ze(t,e){return(ze=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function Be(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=Ge(t);if(e){var o=Ge(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return Ke(this,r)}}function Ke(t,e){return!e||"object"!==Le(e)&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}function Ge(t){return(Ge=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function Ze(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function He(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function We(t,e,r){return e&&He(t.prototype,e),r&&He(t,r),t}var $e=function(t){return function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&ze(t,e)}(r,t);var e=Be(r);function r(){return Ze(this,r),e.apply(this,arguments)}return We(r,[{key:"defineProperties",value:function(t){var e=this,n=function(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?Fe(Object(r),!0).forEach((function(e){qe(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Fe(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}({isHoverActive:!0},t),o=n.isHoverActive,i=n.style,c=n.speed||1;Ne(Ge(r.prototype),"defineProperties",this).call(this,t),Object.defineProperties(this,{isTrackerLayer:{value:!0},isHoverActive:{value:!!o,writable:!0},style:{value:i||this.defaultStyle},speed:{get:function(){return c},set:function(t){c=t,e.start()}},filter:{get:function(){return e.tracker.filter},set:function(t){e.tracker&&e.tracker.setFilter(t)}},sort:{get:function(){return e.tracker.sort},set:function(t){e.sort&&e.tracker.setSort(t)}},tracker:{value:null,writable:!0},styleCache:{value:{}},currTime:{value:new Date,writable:!0},lastUpdateTime:{value:new Date,writable:!0},renderedTrajectories:{get:function(){return e.tracker.renderedTrajectories}},hoverVehicleId:{get:function(){return e.tracker.hoverVehicleId},set:function(t){e.tracker.hoverVehicleId=t}},selectedVehicleId:{get:function(){return e.tracker.selectedVehicleId},set:function(t){e.tracker.selectedVehicleId=t}},useRequestAnimationFrame:{default:!1,writable:!0}})}},{key:"init",value:function(t,e){var n=this;Ne(Ge(r.prototype),"init",this).call(this,t),this.tracker=new Ce(e),this.tracker.setStyle((function(t,e){return n.style(t,e)})),this.visible&&this.start(),this.visibilityRef=this.on("change:visible",(function(t){t.target.visible?n.start():n.stop()}))}},{key:"terminate",value:function(){this.stop(),Object(c.unByKey)(this.visibilityRef),this.tracker&&(this.tracker.destroy(),this.tracker=null),Ne(Ge(r.prototype),"terminate",this).call(this)}},{key:"start",value:function(t,e,r){this.stop(),this.tracker.setVisible(!0),this.renderTrajectories(this.currTime,t,r),this.startUpdateTime(e)}},{key:"startUpdateTime",value:function(t){var e=this;this.stopUpdateTime(),this.updateTimeInterval=setInterval((function(){var t=e.currTime.getTime()+(new Date-e.lastUpdateTime)*e.speed;e.setCurrTime(t)}),this.getRefreshTimeInMs(t))}},{key:"stop",value:function(){this.stopUpdateTime(),this.tracker&&(this.tracker.setVisible(!1),this.tracker.clear())}},{key:"stopUpdateTime",value:function(){this.updateTimeInterval&&clearInterval(this.updateTimeInterval)}},{key:"renderTrajectories",value:function(t,e,r){var n=this;this.requestId&&cancelAnimationFrame(this.requestId),this.useRequestAnimationFrame?this.requestId=requestAnimationFrame((function(){n.tracker.renderTrajectories(t,e,r)})):this.tracker.renderTrajectories(t,e,r)}},{key:"setCurrTime",value:function(t,e,r){var n=!(arguments.length>3&&void 0!==arguments[3])||arguments[3],o=new Date(t);this.currTime=o,this.lastUpdateTime=new Date,n&&this.renderTrajectories(this.currTime,e,r)}},{key:"getVehicle",value:function(t){return this.tracker.getTrajectories().filter(t)}},{key:"getVehiclesAtCoordinate",value:function(t){for(var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1/0,n=Object(ge.buffer)([].concat(Ve(t),Ve(t)),10*e),o=this.tracker.getTrajectories(),i=[],c=0;c<o.length&&(o[c].coordinate&&Object(ge.containsCoordinate)(n,o[c].coordinate)&&i.push(o[c]),i.length!==r);c+=1);return i}},{key:"getRefreshTimeInMs",value:function(t){var e=Math.round(t),r=xe[e]||25;return Math.max(25,r/this.speed)}},{key:"defaultStyle",value:function(t){var e=t.id;if(this.styleCache[e])return this.styleCache[e];var r=document.createElement("canvas");r.width=200,r.height=15;var n=r.getContext("2d");return n.arc(8,8,5,0,2*Math.PI,!1),n.fillStyle="#8ED6FF",n.fill(),n.lineWidth=3,n.strokeStyle="black",n.stroke(),n.font="bold 12px arial",n.strokeStyle="white",n.lineWidth=3,n.strokeText(e,20,10),n.fillStyle="black",n.fillText(e,20,10),this.styleCache[e]=r,this.styleCache[e]}}]),r}(t)};function Je(t){return(Je="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function Qe(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(t)))return;var r=[],n=!0,o=!1,i=void 0;try{for(var c,a=t[Symbol.iterator]();!(n=(c=a.next()).done)&&(r.push(c.value),!e||r.length!==e);n=!0);}catch(t){o=!0,i=t}finally{try{n||null==a.return||a.return()}finally{if(o)throw i}}return r}(t,e)||function(t,e){if(!t)return;if("string"==typeof t)return Ye(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Ye(t,e)}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Ye(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function Xe(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function tr(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?Xe(Object(r),!0).forEach((function(e){er(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Xe(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function er(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function rr(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function nr(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function or(t,e,r){return(or="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(t,e,r){var n=function(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=ur(t)););return t}(t,e);if(n){var o=Object.getOwnPropertyDescriptor(n,e);return o.get?o.get.call(r):o.value}})(t,e,r||t)}function ir(t,e){return(ir=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function cr(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=ur(t);if(e){var o=ur(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return ar(this,r)}}function ar(t,e){return!e||"object"!==Je(e)&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}function ur(t){return(ur=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var sr=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&ir(t,e)}(i,t);var e,r,n,o=cr(i);function i(){var t,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return rr(this,i),(t=o.call(this,tr({},e))).renderWhenZooming=e.renderWhenZooming||function(){return!0},t.olLayer=e.olLayer||new me.Group({layers:[new me.Layer({source:new Gt.a({}),render:function(e){if(!t.tracker||!t.tracker.canvas)return null;var r=e.viewState,n=r.zoom,o=r.center,i=r.resolution;if(n!==t.renderState.zoom){if(t.renderState.zoom=n,t.renderState.center=o,!t.renderWhenZooming(n))return t.tracker.clear(),t.tracker.canvas;t.renderTrajectories(t.currTime,e.size,i,!0)}else if(t.renderState.center[0]!==o[0]||t.renderState.center[1]!==o[1]){var c=t.map.getPixelFromCoordinate(o),a=t.map.getPixelFromCoordinate(t.renderState.center);t.tracker.moveCanvas(c[0]-a[0],c[1]-a[1]),t.renderState.center=o}return t.tracker.canvas}})]}),t.renderState={center:[0,0],zoom:null},t.olEventsKeys=[],t}return e=i,(r=[{key:"init",value:function(t){t&&or(ur(i.prototype),"init",this).call(this,t,{getPixelFromCoordinate:t.getPixelFromCoordinate.bind(t)})}},{key:"setCurrTime",value:function(t){var e=this.map.getView();or(ur(i.prototype),"setCurrTime",this).call(this,t,this.map.getSize(),e.getResolution(),!this.map.getView().getAnimating()&&!this.map.getView().getInteracting())}},{key:"start",value:function(){var t=this;or(ur(i.prototype),"start",this).call(this,this.map.getSize(),this.currentZoom||this.map.getView().getZoom(),this.map.getView().getResolution()),this.olEventsKeys=[this.map.on("moveend",(function(){var e=t.map.getView().getZoom();e!==t.currentZoom&&(t.currentZoom=e,t.startUpdateTime(e))})),this.map.on("pointermove",(function(e){if(!t.map.getView().getInteracting()&&!t.map.getView().getAnimating()&&t.isHoverActive){var r=Qe(t.getVehiclesAtCoordinate(e.coordinate,1),1)[0],n=r&&r.id;t.hoverVehicleId!==n&&(t.map.getTargetElement().style.cursor=r?"pointer":"auto",t.hoverVehicleId=n,t.renderTrajectories(t.currTime))}}))]}},{key:"stop",value:function(){or(ur(i.prototype),"stop",this).call(this),Object(c.unByKey)(this.olEventsKeys),this.olEventsKeys=[]}},{key:"getVehiclesAtCoordinate",value:function(t,e){var r=this.map.getView().getResolution();return or(ur(i.prototype),"getVehiclesAtCoordinate",this).call(this,t,r,e)}},{key:"clone",value:function(t){return new i(tr(tr({},this.options),t))}}])&&nr(e.prototype,r),n&&nr(e,n),i}($e(E)),lr=r(8),fr=r.n(lr),pr=r(3),yr=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new Date,e=(t.getUTCMonth()+1).toString();e=1===e.length?"0".concat(e):e;var r=t.getUTCDate().toString();return r=1===r.length?"0".concat(r):r,[t.getUTCFullYear(),e,r].join("")},hr=function(t){return[t.getUTCHours(),t.getUTCMinutes(),"".concat(t.getUTCSeconds(),".").concat(t.getUTCMilliseconds())].join(":")};function br(t){return(br="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function vr(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function dr(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?vr(Object(r),!0).forEach((function(e){mr(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):vr(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function mr(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function gr(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Or(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function jr(t,e){return(jr=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function wr(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=Sr(t);if(e){var o=Sr(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return Pr(this,r)}}function Pr(t,e){return!e||"object"!==br(e)&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}function Sr(t){return(Sr=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var kr=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&jr(t,e)}(i,t);var e,r,n,o=wr(i);function i(){var t,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return gr(this,i),(t=o.call(this)).url=e.url,t.apiKey=e.apiKey,t}return e=i,(r=[{key:"fetch",value:function(t){function e(){return t.apply(this,arguments)}return e.toString=function(){return t.toString()},e}((function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>2?arguments[2]:void 0,n=dr(dr({},e),{},{key:this.apiKey}),o=dr({},n);return Object.keys(n).forEach((function(t){return(void 0===o[t]||null===o[t])&&delete o[t]})),this.apiKey?fetch("".concat(this.url).concat(t,"?").concat(Jt.a.stringify(o)),r).then((function(t){try{return t.json().then((function(t){if(t.error)throw new Error(t.error);return t}))}catch(t){return Promise.reject(new Error(t))}})):Promise.reject(new Error("No apiKey defined for request to ".concat(this.url)))}))}])&&Or(e.prototype,r),n&&Or(e,n),i}(I.a);function Tr(t){return(Tr="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function Cr(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function Rr(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?Cr(Object(r),!0).forEach((function(e){Dr(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Cr(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function Dr(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function _r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Er(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function xr(t,e){return(xr=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function Ir(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=Ar(t);if(e){var o=Ar(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return Mr(this,r)}}function Mr(t,e){return!e||"object"!==Tr(e)&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}function Ar(t){return(Ar=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var Lr=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&xr(t,e)}(i,t);var e,r,n,o=Ir(i);function i(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return _r(this,i),o.call(this,Rr({url:"https://api.geops.io/stops/v1/"},t))}return e=i,(r=[{key:"search",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this.fetch("",t,{signal:e.signal}).then((function(t){return t.features}))}}])&&Er(e.prototype,r),n&&Er(e,n),i}(kr);function Vr(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function Ur(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var Fr=function(){for(var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=[],r=0;r<t.length;r+=1){var n=t[r],o=n.d,i=n.m,c=n.y;e.push({day:o,month:i,year:c})}return e},qr=function(t){var e=function(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?Vr(Object(r),!0).forEach((function(e){Ur(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Vr(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}({},t);["a","f","tt"].forEach((function(t){e[t]||(e[t]={})}));for(var r=e.id,n=e.hs,o=e.t,i=e.ln,c=e.sn,a=e.wa,u=e.ba,s=e.rt,l=e.fid,f=e.rid,p=e.c,y=e.tc,h=e.a,b=h.n,v=h.u,d=h.tz,m=e.f,g=m.n,O=m.u,j=m.tz,w=e.tt,P=w.n,S=w.p,k=w.t,T=e.sts,C=Fr(P),R=Fr(S),D=p&&"#".concat(p),_=y&&"#".concat(y),E=[],x=0;x<(T||[]).length;x+=1){var I=T[x],M=I.sid,A=I.n,L=I.p,V=I.at,U=I.dt,F=I.ap,q=I.dp,N=I.ad,z=I.dd,B=I.dot,K=I.put,G=I.c,Z=I.wa;E.push({stationId:M,stationName:A,coordinates:L,arrivalTime:-1!==V?1e3*F:null,departureTime:-1!==U?1e3*q:null,arrivalDelay:N,departureDelay:z,noDropOff:!!B,noPickUp:!!K,cancelled:!!G,wheelchairAccessible:!!Z})}return{id:r,destination:n,backgroundColor:D,color:_,vehicleType:o,routeIdentifier:f,longName:i,shortName:c,stations:E,wheelchairAccessible:!!a,bicyclesAllowed:!!u,realTime:s,feedsId:l,operatingInformations:{operatingPeriod:k,notOperatingDays:C,additionalOperatingDays:R},operator:b,operatorUrl:v,operatorTimeZone:d,publisher:g,publisherUrl:O,publisherTimeZone:j}},Nr=function(){for(var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=[],r=0;r<t.length;r+=1){var n=t[r],o=new pr.LineString(n.geometry.coordinates),i=n.properties,c=i.ID,a=i.ProductIdentifier,u=i.PublishedLineName,s=i.RouteIdentifier,l=i.DirectionText,f=i.Operator,p=i.OperatorURL,y=i.Publisher,h=i.PublisherURL,b=i.License,v=i.LicenseUrl,d=i.LicenseNote,m=i.Color,g=i.JourneyIdentifier,O=i.RealtimeAvailable,j=i.OperatorProvidesRealtime,w=i.DayOfOperation,P=i.Delay,S=i.TimeIntervals,k=i.TextColor,T=i.Cancelled;e.push({id:c,type:a,name:u,routeIdentifier:s,directionText:l,operator:f,operatorUrl:p,publisher:y,publisherUrl:h,license:b,licenseUrl:v,licenseNote:d,journeyIdentifier:g,realtimeAvailable:O,operatorProvidesRealtime:j,dayOfOperation:w,delay:P,timeIntervals:S,color:m&&"#".concat(m),textColor:k&&"#".concat(k),geometry:o,cancelled:T})}return e};function zr(t){return(zr="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function Br(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function Kr(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?Br(Object(r),!0).forEach((function(e){Gr(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Br(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function Gr(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Zr(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Hr(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function Wr(t,e){return(Wr=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function $r(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=Qr(t);if(e){var o=Qr(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return Jr(this,r)}}function Jr(t,e){return!e||"object"!==zr(e)&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}function Qr(t){return(Qr=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var Yr=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&Wr(t,e)}(i,t);var e,r,n,o=$r(i);function i(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return Zr(this,i),o.call(this,Kr({url:"https://api.geops.io/tracker/v1"},t))}return e=i,(r=[{key:"fetchTrajectoryById",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this.fetch("/trajectorybyid",t,{signal:e.signal})}},{key:"fetchTrajectories",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this.fetch("/trajectory_collection",t,{signal:e.signal}).then((function(t){return Nr(t.features)}))}},{key:"fetchTrajectoryStations",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this.fetch("/trajstations",t,{signal:e.signal}).then((function(t){return qr(t)}))}}])&&Hr(e.prototype,r),n&&Hr(e,n),i}(kr);function Xr(t){return function(t){if(Array.isArray(t))return tn(t)}(t)||function(t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(t))return Array.from(t)}(t)||function(t,e){if(!t)return;if("string"==typeof t)return tn(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return tn(t,e)}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function tn(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function en(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}var rn=function(){function t(e){var r=this;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.subscriptions=[],this.connect(e),setInterval((function(){r.send("PING")}),1e4),this.subscribed={}}var e,r,n;return e=t,n=[{key:"getRequestString",value:function(t,e){var r="".concat(t," ").concat(e.channel);return r+=e.args?" ".concat(e.args):"",(r+=e.id?" ".concat(e.id):"").trim()}}],(r=[{key:"connect",value:function(t){var e=this;this.websocket&&this.websocket.readyState!==this.websocket.CLOSED&&this.websocket.close(),this.websocket=new WebSocket(t),this.currentProj&&this.setProjection(this.currentProj),this.currentBbox&&this.setBbox(this.currentBbox),Xr(this.subscriptions).forEach((function(t){e.subscribe(t.params,t.cb,t.errorCb,!0)})),this.websocket.onclose=function(){window.clearTimeout(e.reconnectTimeout),e.reconnectTimeout=window.setTimeout((function(){return e.connect(t)}),100)}}},{key:"get",value:function(e,r,n){var o=t.getRequestString("GET",e);this.send(o),this.listen(e,r,n)}},{key:"send",value:function(t){var e=this,r=function(){e.websocket.send(t)};this.websocket.readyState===WebSocket.CONNECTING?this.websocket.addEventListener("open",r):r()}},{key:"setProjection",value:function(t){this.currentProj=t,this.send("PROJECTION ".concat(t))}},{key:"setBbox",value:function(t){var e=this;this.currentBbox=t,this.send("BBOX ".concat(t.join(" "))),this.subscriptions.forEach((function(t){e.get(t.params,t.cb,t.errorCb)}))}},{key:"listen",value:function(t,e,r){var n=function(r){var n=JSON.parse(r.data),o=t.channel;o+=t.args?" ".concat(t.args):"",n.source!==o||t.id&&t.id!==n.client_reference||e(n)};return this.websocket.addEventListener("message",n),r&&(this.websocket.addEventListener("error",r),this.websocket.addEventListener("close",r)),{onMessageCb:n,onErrorCb:r}}},{key:"subscribe",value:function(e,r,n,o){var i=this.listen(e,r,n),c=i.onMessageCb,a=i.onErrorCb,u=t.getRequestString("",e);o||this.subscriptions.push({params:e,cb:r,errorCb:n,onMessageCb:c,onErrorCb:a}),this.subscribed[u]||(this.send("GET ".concat(u)),this.send("SUB ".concat(u)),this.subscribed[u]=!0)}},{key:"unsubscribe",value:function(t,e){var r=this;this.subscriptions.filter((function(r){return r.params.channel===t&&(!e||r.cb===e)})).forEach((function(t){var e=t.onMessageCb,n=t.onErrorCb;r.websocket.removeEventListener("message",e),n&&(r.websocket.removeEventListener("error",n),r.websocket.removeEventListener("close",n))})),this.subscriptions=this.subscriptions.filter((function(r){return r.params.channel!==t||e&&r.cb!==e})),t&&this.subscribed[t]&&!this.subscriptions.find((function(e){return e.params.channel===t}))&&(this.send("DEL ".concat(t)),this.subscribed[t]=!1)}}])&&en(e.prototype,r),n&&en(e,n),t}(),nn=function(t,e){return t===e.SCHEMATIC?"_schematic":""},on=function(t,e){var r=arguments.length>2&&void 0!==arguments[2]&&arguments[2],n=["HIDDEN","LEAVING","BOARDING"],o=t.has_fzo&&n.indexOf(t.state)>-1,i=e.has_fzo&&n.indexOf(e.state)>-1;if(o||i){if(o!==i)return o?-1:1;if(t.state!==e.state)return n.indexOf(t.state)-n.indexOf(e.state)}var c=null,a=null,u=Date.now();return r?(c=new Date(t.min_arrival_time||t.time).getTime()-u,a=new Date(e.min_arrival_time||e.time).getTime()-u):(c=new Date(t.time).getTime()-u,a=new Date(e.time).getTime()-u),c-a},cn=function(t){if(t)return t.stations.forEach((function(t){t.arrivalTimeWithDelay=t.arrivalTime,t.departureTime&&(t.departureTimeWithDelay=t.departureTime),t.arrivalDelay&&(t.arrivalTime-=t.arrivalDelay,t.departureTime&&(t.departureTime-=t.arrivalDelay))})),t};function an(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function un(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}var sn={RAW:"raw",TOPOGRAPHIC:"topographic",SCHEMATIC:"schematic"},ln=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};an(this,t);var r=null;r="string"==typeof e?e:e.url,e.apiKey&&(r="".concat(r,"?key=").concat(e.apiKey)),this.subscribedStationUic=null,this.departureUpdateTimeout=null,this.maxDepartureAge=30,this.extraGeoms={},this.prefix=e.prefix||"",this.conn=new rn(r),this.conn.setProjection(e.projection||"epsg:3857"),e.bbox&&this.conn.setBbox(e.bbox)}var e,r,n;return e=t,(r=[{key:"subscribe",value:function(t,e,r){var n=arguments.length>3&&void 0!==arguments[3]&&arguments[3];this.conn.subscribe({channel:t},e,r,n)}},{key:"unsubscribe",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",r=arguments.length>2?arguments[2]:void 0;this.conn.unsubscribe("".concat(t).concat(nn(sn.SCHEMATIC,sn)).concat(e),r),this.conn.unsubscribe("".concat(t).concat(nn(sn.TOPOGRAPHIC,sn)).concat(e),r)}},{key:"filterDepartures",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=Object.keys(t).map((function(e){return t[e]}));r.sort((function(t,r){return on(t,r,e)}));var n=new Date;n.setMinutes(n.getMinutes()+this.maxDepartureAge),n=n.getTime();var o=new Date;o.setMinutes(o.getMinutes()-this.maxDepartureAge),o=o.getTime();for(var i=[],c=[],a=null,u=r.length-1;u>=0;u-=1){var s=r[u],l=new Date(s.time).getTime();l>o&&l<n&&("BOARDING"===s.state&&(-1===c.indexOf(s.platform)?c.push(s.platform):s.state="HIDDEN"),a&&s.to[0]===a.to[0]&&Math.abs(l-a.time)<1e3&&s.line.name===a.line.name&&(s.state="HIDDEN"),/(STOP_CANCELLED|JOURNEY_CANCELLED)/.test(s.state)&&(s.cancelled=!0),(a=s).time=l,i.unshift(s))}return i}},{key:"subscribeDepartures",value:function(t){var e=this,r=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=arguments.length>2?arguments[2]:void 0;window.clearTimeout(this.departureUpdateTimeout),this.unsubscribeDepartures(),this.subscribedStationUic=t;var o=t?"timetable_".concat(t):null,i={};this.subscribe(o,(function(t){if(t.source===o){var c=t.content||{},a=new Date(c.timestamp).getTime()-Date.now();c.timediff=a,i[c.call_id]=c,window.clearTimeout(e.departureUpdateTimeout),e.departureUpdateTimeout=window.setTimeout((function(){var t=e.filterDepartures(i,r);n(t)}),100)}}),(function(){n([])}))}},{key:"unsubscribeDepartures",value:function(t){this.subscribedStationUic&&(this.unsubscribe("timetable_".concat(this.subscribedStationUic),"",t),this.subscribedStationUic=null)}},{key:"subscribeDisruptions",value:function(t){this.subscribe("".concat(this.prefix,"newsticker"),(function(e){t(e.content)}))}},{key:"unsubscribeDisruptions",value:function(t){this.unsubscribe("".concat(this.prefix,"newsticker"),"",t)}},{key:"getStation",value:function(t,e){var r=this,n={channel:"station".concat(nn(e,sn)),args:t};return new Promise((function(t,e){r.conn.get(n,(function(r){r.content?t(r.content):e()}))}))}},{key:"getStations",value:function(t,e){var r=this,n=[];e&&this.conn.setBbox(e);var o={channel:"station".concat(nn(t,sn))};return window.clearTimeout(this.stationUpdateTimeout),new Promise((function(t,e){r.conn.get(o,(function(o){o.content?(n.push(o.content),window.clearTimeout(r.stationUpdateTimeout),r.stationUpdateTimeout=window.setTimeout((function(){t(n)}),50)):e(o.content)}))}))}},{key:"subscribeStations",value:function(t,e,r){this.unsubscribeStations(),e&&this.conn.setBbox(e),this.subscribe("station".concat(nn(t,sn)),(function(t){t.content&&r(t.content)}))}},{key:"unsubscribeStations",value:function(t){window.clearTimeout(this.stationUpdateTimeout),this.unsubscribe("station","",t)}},{key:"subscribeExtraGeoms",value:function(t){var e=this;this.subscribe("extra_geoms",(function(r){var n=r.content;if(n){var o=n.properties.ref;"Feature"===n.type?e.extraGeoms[o]=n:delete e.extraGeoms[o],t(Object.keys(e.extraGeoms).map((function(t){return e.extraGeoms[t]})))}}))}},{key:"unsubscribeExtraGeoms",value:function(t){this.unsubscribe("extra_geoms","",t)}},{key:"subscribeTrajectory",value:function(t,e){this.unsubscribeTrajectory(e),this.subscribe("trajectory".concat(nn(t,sn)),e)}},{key:"unsubscribeTrajectory",value:function(t){this.unsubscribe("trajectory","",t)}},{key:"subscribeDeletedVehicles",value:function(t,e){this.unsubscribeDeletedVehicles(),this.subscribe("deleted_vehicles".concat(nn(t,sn)),e)}},{key:"unsubscribeDeletedVehicles",value:function(t){this.unsubscribe("deleted_vehicles","",t)}},{key:"getFullTrajectory",value:function(t,e){var r=this,n={channel:"full_trajectory".concat(nn(e,sn),"_").concat(t)};return new Promise((function(t){r.conn.get(n,(function(e){e.content&&t(e.content)}))}))}},{key:"getFullTrajectories",value:function(t,e){var r=this,n=t.map((function(t){return r.getFullTrajectory(t,e)}));return Promise.all(n)}},{key:"subscribeFullTrajectory",value:function(t,e){this.unsubscribeFullTrajectory(t),this.subscribe("full_trajectory".concat(nn(e,sn),"_").concat(t),(function(t){console.log("subscribe full_trajectory",t)}),(function(t){console.log("subscribe full_trajectory error",t)}))}},{key:"unsubscribeFullTrajectory",value:function(t,e){this.unsubscribe("full_trajectory","_".concat(t),e)}},{key:"getStopSequence",value:function(t){var e=this,r={channel:"stopsequence_".concat(t)};return new Promise((function(t,n){e.conn.get(r,(function(e){t(cn(e.content&&e.content[0]))}),(function(t){n(t)}))}))}},{key:"getStopSequences",value:function(t){var e=this,r=t.map((function(t){return e.getStopSequence(t)}));return Promise.all(r)}},{key:"subscribeStopSequence",value:function(t,e){window.clearTimeout(this.fullTrajectoryUpdateTimeout),this.unsubscribeStopSequence(t),this.subscribe("stopsequence_".concat(t),(function(t){e(cn(t.content&&t.content[0]))}),(function(t){console.log("subscribe stopsequence error",t)}))}},{key:"unsubscribeStopSequence",value:function(t,e){this.unsubscribe("stopsequence","_".concat(t),e)}},{key:"subscribeHealthCheck",value:function(t){this.unsubscribeHealthCheck(),this.subscribe("healthcheck",t)}},{key:"unsubscribeHealthCheck",value:function(){this.unsubscribe("healthcheck")}}])&&un(e.prototype,r),n&&un(e,n),t}();function fn(t){return(fn="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function pn(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function yn(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?pn(Object(r),!0).forEach((function(e){hn(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):pn(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function hn(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function bn(t,e,r){return(bn="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(t,e,r){var n=function(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=gn(t)););return t}(t,e);if(n){var o=Object.getOwnPropertyDescriptor(n,e);return o.get?o.get.call(r):o.value}})(t,e,r||t)}function vn(t,e){return(vn=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function dn(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=gn(t);if(e){var o=gn(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return mn(this,r)}}function mn(t,e){return!e||"object"!==fn(e)&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}function gn(t){return(gn=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function On(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function jn(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function wn(t,e,r){return e&&jn(t.prototype,e),r&&jn(t,r),t}var Pn=function(t){return function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&vn(t,e)}(r,t);var e=dn(r);function r(){return On(this,r),e.apply(this,arguments)}return wn(r,[{key:"defineProperties",value:function(t){var e=this;bn(gn(r.prototype),"defineProperties",this).call(this,t);var n,o=t.regexPublishedLineName,i=t.publishedLineName,c=t.tripNumber,a=t.operator,u=3;if(!t.api){var s={};t.url&&(s.url=t.url),t.apiKey&&(s.apiKey=t.apiKey),n=new Yr(s)}Object.defineProperties(this,{showVehicleTraj:{value:void 0===t.showVehicleTraj||t.showVehicleTraj,writable:!0},delayDisplay:{value:t.delayDisplay||3e5,writable:!0},delayOutlineColor:{value:t.delayOutlineColor||"#000000",writable:!0},useDelayStyle:{value:t.useDelayStyle||!1,writable:!0},requestIntervalSeconds:{get:function(){return u},set:function(t){t!==u&&(u=t,e.visible&&e.start())}},publishedLineName:{get:function(){return i},set:function(t){i=t,e.updateFilters()}},tripNumber:{get:function(){return c},set:function(t){c=t,e.updateFilters()}},operator:{get:function(){return a},set:function(t){a=t,e.updateFilters()}},regexPublishedLineName:{get:function(){return o},set:function(t){o=t,e.updateFilters()}},api:{value:t.api||n}})}},{key:"init",value:function(t){bn(gn(r.prototype),"init",this).call(this,t),this.sortFc?this.sort=this.sortFc:this.useDelayStyle&&(this.sort=function(t,e){return null===t.delay||t.delay<e.delay?1:-1})}},{key:"start",value:function(){this.updateFilters(),bn(gn(r.prototype),"start",this).call(this),this.startUpdateTrajectories()}},{key:"stop",value:function(){this.journeyId=null,this.stopUpdateTrajectories(),this.abortFetchTrajectories(),bn(gn(r.prototype),"stop",this).call(this)}},{key:"updateFilters",value:function(){var t=Jt.a.parse(window.location.search.toLowerCase());this.filter=function(t,e,r,n){var o=[];if(!(t||e||r||n))return null;if(n){var i="string"==typeof n?[n]:n;o.push((function(t){return i.some((function(e){return new RegExp(e,"i").test(t.name)}))}))}if(t){var c=("string"==typeof t?t.split(","):t).map((function(t){return t.replace(/\s+/g,"").toUpperCase()}));o.push((function(t){return c.some((function(e){return e===t.name.toUpperCase()}))}))}if(e){var a=("string"==typeof e?e.split(","):e).map((function(t){return parseInt(t,10)}));o.push((function(t){var e=parseInt(t.routeIdentifier.split(".")[0],10);return a.some((function(t){return t===e}))}))}if(r){var u="string"==typeof r?[r]:r;o.push((function(t){return u.some((function(e){return new RegExp(e,"i").test(t.operator)}))}))}return o.length?function(t){for(var e=0;e<o.length;e+=1)if(!o[e](t))return!1;return!0}:null}(this.publishedLineName||t.publishedlinename,this.tripNumber||t.tripnumber,this.operator||t.operator,this.regexPublishedLineName)}},{key:"abortFetchTrajectories",value:function(){this.abortController&&this.abortController.abort()}},{key:"updateTrajectoryStations",value:function(t){var e=this.getParams({id:t,time:hr(new Date)});return this.api.fetchTrajectoryStations(e)}},{key:"getParams",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=1e3*(this.requestIntervalSeconds+5),r=this.speed*e,n=this.currTime,o=!0;if(this.later&&n.getTime()>this.later.getTime()-1e3*this.requestIntervalSeconds&&(o=!1),!this.later||!o||this.later.getTime()-n.getTime()>r){var i=new Date(n.getTime()+r);this.later=i}var c=yn(yn({},t),{},{btime:hr(n),etime:hr(this.later),date:yr(n),rid:1,a:1,cd:1,nm:1,fl:1});return c}},{key:"startUpdateTrajectories",value:function(){var t=this;this.stopUpdateTrajectories(),this.updateTrajectories(),this.updateInterval=window.setInterval((function(){t.updateTrajectories()}),1e3*this.requestIntervalSeconds)}},{key:"stopUpdateTrajectories",value:function(){clearInterval(this.updateInterval)}},{key:"updateTrajectories",value:function(){var t=this;this.abortFetchTrajectories(),this.abortController=new AbortController,this.api.fetchTrajectories(this.getParams({attr_det:1}),this.abortController).catch((function(t){if("AbortError"!==t.name)throw t})).then((function(e){e&&(t.tracker.setTrajectories(e),t.renderTrajectories())}))}},{key:"defaultStyle",value:function(t,e){var r=t.type,n=t.name,o=t.id,i=t.color,c=t.textColor,a=t.delay,u=t.cancelled,s=t.operatorProvidesRealtime,l=Math.min(Math.floor(e||1),16),f=this.hoverVehicleId===o,p=this.selectedVehicleId===o,y="".concat(l).concat(r).concat(n).concat(s).concat(a).concat(f).concat(p).concat(u);if(!this.styleCache[y]){var h=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1?arguments[1]:void 0;try{var r=Ie(t);return Re[r][e]}catch(t){return 1}}(r,l),b=h>=7;if(0===h)return this.styleCache[y]=null,null;(f||p)&&(h=b?h+5:14);var v=h+2,d=2*h,m=document.createElement("canvas");m.width=2*v+2+100,m.height=2*v+2+100;var g,O=m.getContext("2d"),j=m.width/2;if(b&&null!==a&&(O.save(),O.beginPath(),O.arc(j,j,v,0,2*Math.PI,!1),O.fillStyle=Ae(a,u),O.filter="blur(1px)",O.fill(),O.restore()),b&&(f||a>=this.delayDisplay||u)){O.save(),O.textAlign="left",O.textBaseline="middle",O.font="bold ".concat(Math.max(u?19:14,Math.min(u?19:17,1.2*h)),"px arial, sans-serif"),O.fillStyle=Ae(a,u,!0),O.strokeStyle=this.delayOutlineColor,O.lineWidth=1.5;var w=function(t,e){if(e)return String.fromCodePoint(215);if(t>36e5){var r=Math.round(t/36e5);return"+".concat(r,"h")}if(t>59e3){var n=Math.round(t/6e4);return"+".concat(n,"m")}return t>0?"+".concat(t,"s"):""}(a,u);O.strokeText(w,j+v+1,j),O.fillText(w,j+v+1,j),O.restore()}if(g=this.useDelayStyle?Ae(a,u):i||Me(r),O.save(),(b||f||p)&&(O.lineWidth=1,O.strokeStyle="#000000"),O.fillStyle=g,O.beginPath(),O.arc(j,j,h,0,2*Math.PI,!1),O.fill(),b&&this.useDelayStyle&&null===a&&"yes"===s&&O.setLineDash([5,3]),(b||f||p)&&O.stroke(),O.restore(),h>10){var P=function(t,e,r,n){t.font="bold ".concat(n,"px Arial");for(var o=t.measureText(r),i=0;o.width>e-6&&i<25;)n-=.5,t.font="bold ".concat(n,"px arial, sans-serif"),o=t.measureText(r),i+=1;return n}(O,d,n,Math.max(h,10));this.useDelayStyle&&null===a&&"yes"===s&&(O.save(),O.textBaseline="middle",O.textAlign="center",O.font="bold ".concat(P+2,"px Arial"),O.strokeStyle=g,O.strokeText(n,j,j),O.restore()),O.save(),O.textBaseline="middle",O.textAlign="center",O.fillStyle=this.useDelayStyle?"#000000":c||function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;try{var e=Ie(t);return Ee[e]}catch(t){return 1}}(r),O.font="bold ".concat(P,"px Arial"),O.strokeStyle=g,O.strokeText(n,j,j),O.fillText(n,j,j),O.restore()}this.styleCache[y]=m}return this.styleCache[y]}}]),r}(t)};function Sn(t){return(Sn="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function kn(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(t)))return;var r=[],n=!0,o=!1,i=void 0;try{for(var c,a=t[Symbol.iterator]();!(n=(c=a.next()).done)&&(r.push(c.value),!e||r.length!==e);n=!0);}catch(t){o=!0,i=t}finally{try{n||null==a.return||a.return()}finally{if(o)throw i}}return r}(t,e)||Cn(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Tn(t){return function(t){if(Array.isArray(t))return Rn(t)}(t)||function(t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(t))return Array.from(t)}(t)||Cn(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Cn(t,e){if(t){if("string"==typeof t)return Rn(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?Rn(t,e):void 0}}function Rn(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function Dn(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function _n(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?Dn(Object(r),!0).forEach((function(e){En(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Dn(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function En(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function xn(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function In(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function Mn(t,e,r){return(Mn="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(t,e,r){var n=function(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=Un(t)););return t}(t,e);if(n){var o=Object.getOwnPropertyDescriptor(n,e);return o.get?o.get.call(r):o.value}})(t,e,r||t)}function An(t,e){return(An=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function Ln(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=Un(t);if(e){var o=Un(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return Vn(this,r)}}function Vn(t,e){return!e||"object"!==Sn(e)&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}function Un(t){return(Un=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var Fn=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&An(t,e)}(i,t);var e,r,n,o=Ln(i);function i(){var t,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return xn(this,i),(t=o.call(this,_n({},e))).vectorLayer=new me.Vector({source:new de.Vector({features:[]})}),t.olLayer.getLayers().insertAt(0,t.vectorLayer),t}return e=i,(r=[{key:"init",value:function(t){t&&(t.addLayer(this.vectorLayer),Mn(Un(i.prototype),"init",this).call(this,t))}},{key:"terminate",value:function(){this.map&&this.map.removeLayer(this.vectorLayer),Mn(Un(i.prototype),"terminate",this).call(this)}},{key:"start",value:function(){this.map&&(Mn(Un(i.prototype),"start",this).call(this),this.olEventsKeys=[].concat(Tn(this.olEventsKeys),[this.map.on("singleclick",this.onMapClick.bind(this)),this.map.on("moveend",this.onMoveEnd.bind(this))]))}},{key:"onMoveEnd",value:function(){this.updateTrajectories(),this.selectedVehicleId&&this.journeyId&&this.highlightTrajectory()}},{key:"onMapClick",value:function(t){var e=this;if(this.clickCallbacks.length){var r=kn(this.getVehiclesAtCoordinate(t.coordinate,1),1)[0],n=[];if(r){var o=r.coordinate?new pr.Point(r.coordinate):null;n.push(new fr.a(_n({geometry:o},r))),n.length&&(this.selectedVehicleId=n[0].get("id"),this.journeyId=n[0].get("journeyIdentifier"),this.updateTrajectoryStations(this.selectedVehicleId).then((function(n){e.clickCallbacks.forEach((function(o){return o(_n(_n({},r),n),e,t)}))})))}else this.selectedVehicleId=null,this.vectorLayer.getSource().clear(),this.clickCallbacks.forEach((function(r){return r(null,e,t)}))}}},{key:"drawFullTrajectory",value:function(t,e,r){var n=/#ffffff/i.test(r)?"#ff0000":r,o=this.vectorLayer.getSource();if(o.clear(),t){var i=new pr.MultiPoint(t),c=new fr.a(i);c.setStyle(new ve.Style({zIndex:1,image:new ve.Circle({radius:5,fill:new ve.Fill({color:"#000000"})})}));var a=new fr.a(i);a.setStyle(new ve.Style({zIndex:4,image:new ve.Circle({radius:4,fill:new ve.Fill({color:this.useDelayStyle?"#a0a0a0":n})})})),o.addFeatures([c,a])}var u=new fr.a({geometry:e});u.setStyle([new ve.Style({zIndex:2,stroke:new ve.Stroke({color:"#000000",width:6})}),new ve.Style({zIndex:3,stroke:new ve.Stroke({color:this.useDelayStyle?"#a0a0a0":n,width:4})})]),o.addFeature(u)}},{key:"updateTrajectoryStations",value:function(t){var e=this;return Mn(Un(i.prototype),"updateTrajectoryStations",this).call(this,t).then((function(t){return e.stationsCoords=[],t.stations.forEach((function(t){e.stationsCoords.push(Object(Nt.transform)(t.coordinates,"EPSG:4326","EPSG:3857"))})),e.highlightTrajectory(),t}))}},{key:"highlightTrajectory",value:function(){var t=this;this.api.fetchTrajectoryById(this.getParams({id:this.journeyId,time:hr(new Date)})).then((function(e){var r=e.p,n=e.t,o=e.c,i=[];r.forEach((function(t){t.forEach((function(t){i.push([t.x,t.y])}))})),t.drawFullTrajectory(t.stationsCoords,new pr.LineString(i),o?"#".concat(o):Me(n))})).catch((function(){t.vectorLayer.getSource().clear()}))}},{key:"getParams",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=this.map.getView().calculateExtent(),r=Object(ge.buffer)(e,Object(ge.getWidth)(e)/10).join(","),n=this.map.getView().getZoom();return Mn(Un(i.prototype),"getParams",this).call(this,_n(_n({},t),{},{bbox:r,s:n<10?1:0,z:n}))}},{key:"defaultStyle",value:function(t){var e=this.map.getView().getZoom();return Mn(Un(i.prototype),"defaultStyle",this).call(this,t,e)}},{key:"clone",value:function(t){return new i(_n(_n({},this.options),t))}}])&&In(e.prototype,r),n&&In(e,n),i}(Pn(sr)),qn=r(21),Nn=r.n(qn);function zn(t){return(zn="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function Bn(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function Kn(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?Bn(Object(r),!0).forEach((function(e){Gn(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Bn(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function Gn(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Zn(t,e,r){return(Zn="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(t,e,r){var n=function(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=Qn(t)););return t}(t,e);if(n){var o=Object.getOwnPropertyDescriptor(n,e);return o.get?o.get.call(r):o.value}})(t,e,r||t)}function Hn(t,e){return(Hn=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function Wn(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=Qn(t);if(e){var o=Qn(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return $n(this,r)}}function $n(t,e){return!e||"object"!==zn(e)&&"function"!=typeof e?Jn(t):e}function Jn(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function Qn(t){return(Qn=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function Yn(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Xn(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function to(t,e,r){return e&&Xn(t.prototype,e),r&&Xn(t,r),t}var eo=function(t){return function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&Hn(t,e)}(r,t);var e=Wn(r);function r(){var t,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return Yn(this,r),(t=e.call(this,Kn({},n))).debug=n.debug,t.mode=n.mode||sn.TOPOGRAPHIC,t.trajectories=[],t.refreshTimeInMs=1e3/30,t.onMessage=t.onMessage.bind(Jn(t)),t.onDeleteMessage=t.onDeleteMessage.bind(Jn(t)),t.api=n.api||new ln(n),t.format=new Ht.a,t.dfltIconScale=n.dfltIconScale||.6,t.dfltIconHighlightScale=n.dfltIconHighlightScale||.8,t.minIconScale=.75*t.dfltIconScale,t}return to(r,[{key:"init",value:function(t){Zn(Qn(r.prototype),"init",this).call(this,t),this.api.subscribeTrajectory(this.mode,this.onMessage),this.api.subscribeDeletedVehicles(this.mode,this.onDeleteMessage)}},{key:"terminate",value:function(){this.api.unsubscribeTrajectory(this.onMessage),this.api.unsubscribeDeletedVehicles(this.onDeleteMessage),Zn(Qn(r.prototype),"terminate",this).call(this)}},{key:"setMode",value:function(t){this.mode!==t&&(this.mode=t,this.api.subscribeTrajectory(this.mode,this.onMessage),this.api.subscribeDeletedVehicles(this.mode,this.onDeleteMessage))}},{key:"onMessage",value:function(t){if(t.content){var e=this.format.readFeature(t.content);if(e.set("timeOffset",Date.now()-t.timestamp),e.get("time_since_update")>=0){if(this.debug&&this.mode===sn.TOPOGRAPHIC&&e.get("raw_coordinates")){var r=new Nn.a(e.get("raw_coordinates"));r.transform("EPSG:4326",this.map.getView().getProjection()),e.setGeometry(r)}this.addTrajectory(e.get("train_id"),e.getProperties(),!e.get("line"))}}}},{key:"onDeleteMessage",value:function(t){t.content&&this.removeTrajectoryByAttribute("train_id",t.content)}},{key:"addTrajectory",value:function(t,e,r){var n=this.trajectories.findIndex((function(e){return e.train_id===t})),o=e.time_intervals,i=Kn(Kn({},e),{},{id:t,timeIntervals:o});r?(this.trajectories.unshift(i),-1!==n&&this.tracker.trajectories.splice(n+1,1)):(this.trajectories.push(i),-1!==n&&this.tracker.trajectories.splice(n,1)),this.updateTrajectories()}},{key:"removeTrajectory",value:function(t){for(var e=0,r=this.trajectories.length;e<r;e+=1)if(this.trajectories[e].id===t){this.trajectories.splice(e,1);break}}},{key:"removeTrajectoryByAttribute",value:function(t,e){for(var r=0,n=this.trajectories.length;r<n;r+=1)if(this.trajectories[r][t]===e){this.removeTrajectory(this.trajectories[r].id);break}}},{key:"updateTrajectories",value:function(){this.tracker.setTrajectories(this.trajectories),this.renderTrajectories()}},{key:"getRefreshTimeInMs",value:function(){return this.refreshTimeInMs}}]),r}(t)};function ro(t){return(ro="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function no(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function oo(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?no(Object(r),!0).forEach((function(e){io(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):no(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function io(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function co(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function ao(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function uo(t,e){return(uo=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function so(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=fo(t);if(e){var o=fo(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return lo(this,r)}}function lo(t,e){return!e||"object"!==ro(e)&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}function fo(t){return(fo=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var po=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&uo(t,e)}(i,t);var e,r,n,o=so(i);function i(){return co(this,i),o.apply(this,arguments)}return e=i,(r=[{key:"clone",value:function(t){return new i(oo(oo({},this.options),t))}}])&&ao(e.prototype,r),n&&ao(e,n),i}(eo(sr));function yo(t){return(yo="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function ho(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function bo(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?ho(Object(r),!0).forEach((function(e){vo(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):ho(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function vo(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function mo(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function go(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function Oo(t,e,r){return(Oo="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(t,e,r){var n=function(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=So(t)););return t}(t,e);if(n){var o=Object.getOwnPropertyDescriptor(n,e);return o.get?o.get.call(r):o.value}})(t,e,r||t)}function jo(t,e){return(jo=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function wo(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=So(t);if(e){var o=So(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return Po(this,r)}}function Po(t,e){return!e||"object"!==yo(e)&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}function So(t){return(So=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var ko=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&jo(t,e)}(i,t);var e,r,n,o=wo(i);function i(){var t,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return mo(this,i),(t=o.call(this,e)).hitTolerance=e.hitTolerance||5,t}return e=i,(r=[{key:"getFeatureInfoAtCoordinate",value:function(t){var e=this,r=[];if(this.map){var n=this.map.getPixelFromCoordinate(t);r=this.map.getFeaturesAtPixel(n,{layerFilter:function(t){return t===e.olLayer},hitTolerance:this.hitTolerance})}return Promise.resolve({features:r,layer:this,coordinate:t})}},{key:"init",value:function(t){var e=this;Oo(So(i.prototype),"init",this).call(this,t),this.map&&(this.singleClickRef=this.map.on("singleclick",(function(t){e.clickCallbacks.length&&e.getFeatureInfoAtCoordinate(t.coordinate).then((function(t){return e.callClickCallbacks(t.features,t.layer,t.coordinate)})).catch((function(){return e.callClickCallbacks([],e,t.coordinate)}))})))}},{key:"callClickCallbacks",value:function(t,e,r){this.clickCallbacks.forEach((function(n){return n(t,e,r)}))}},{key:"terminate",value:function(){Oo(So(i.prototype),"terminate",this).call(this),this.singleClickRef&&Object(c.unByKey)(this.singleClickRef)}},{key:"clone",value:function(t){return new i(bo(bo({},this.options),t))}}])&&go(e.prototype,r),n&&go(e,n),i}(E);function To(t){return(To="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function Co(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function Ro(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?Co(Object(r),!0).forEach((function(e){Do(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Co(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function Do(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function _o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Eo(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function xo(t,e,r){return(xo="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(t,e,r){var n=function(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=Lo(t)););return t}(t,e);if(n){var o=Object.getOwnPropertyDescriptor(n,e);return o.get?o.get.call(r):o.value}})(t,e,r||t)}function Io(t,e){return(Io=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function Mo(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=Lo(t);if(e){var o=Lo(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return Ao(this,r)}}function Ao(t,e){return!e||"object"!==To(e)&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}function Lo(t){return(Lo=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var Vo=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&Io(t,e)}(i,t);var e,r,n,o=Mo(i);function i(){var t,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return _o(this,i),(t=o.call(this,e)).abortController=new AbortController,t.format=new Ht.a,t}return e=i,(r=[{key:"getFeatureInfoUrl",value:function(t){var e=this.map.getView().getProjection(),r=this.map.getView().getResolution();return!!this.olLayer.getSource().getFeatureInfoUrl&&this.olLayer.getSource().getFeatureInfoUrl(t,r,e,{info_format:"application/json",query_layers:this.olLayer.getSource().getParams().layers})}},{key:"getFeatureInfoAtCoordinate",value:function(t){var e=this;this.abortController.abort(),this.abortController=new AbortController;var r=this.abortController.signal;return fetch(this.getFeatureInfoUrl(t),{signal:r}).then((function(t){return t.json()})).then((function(t){return t.features})).then((function(r){return{layer:e,coordinate:t,features:r.map((function(t){return e.format.readFeature(t)}))}})).catch((function(){return Promise.resolve({features:[],coordinate:t,layer:e})}))}},{key:"init",value:function(t){var e=this;xo(Lo(i.prototype),"init",this).call(this,t),this.map&&(this.singleClickRef=this.map.on("singleclick",(function(t){e.clickCallbacks.length&&e.getFeatureInfoAtCoordinate(t.coordinate).then((function(t){return e.callClickCallbacks(t.features,t.layer,t.coordinate)}))})))}},{key:"callClickCallbacks",value:function(t,e,r){this.clickCallbacks.forEach((function(n){return n(t,e,r)}))}},{key:"terminate",value:function(){xo(Lo(i.prototype),"terminate",this).call(this),this.singleClickRef&&Object(c.unByKey)(this.singleClickRef)}},{key:"clone",value:function(t){return new i(Ro(Ro({},this.options),t))}}])&&Eo(e.prototype,r),n&&Eo(e,n),i}(E);r(15),r(22),r(23),r(16);function Uo(t){return("function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function Fo(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),r.push.apply(r,n)}return r}function qo(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?Fo(Object(r),!0).forEach((function(e){No(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Fo(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function No(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function zo(t,e){return(Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function Bo(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=Go(t);if(e){var o=Go(this).constructor;Reflect.construct(n,arguments,o)}else n.apply(this,arguments);return Ko(this,r)}}function Ko(t,e){return!e||"object"!==Uo(e)&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}function Go(t){return(Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function Zo(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Ho(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function Wo(t,e,r){return e&&Ho(t.prototype,e),r&&Ho(t,r),t}function $o(t){return("function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function Jo(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Qo(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function Yo(t,e){return(Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function Xo(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=ei(t);if(e){var o=ei(this).constructor;Reflect.construct(n,arguments,o)}else n.apply(this,arguments);return ti(this,r)}}function ti(t,e){return!e||"object"!==$o(e)&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}function ei(t){return(Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}ri=K;var ri;function ni(t){return(ni="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function oi(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function ii(t,e,r){return(ii="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(t,e,r){var n=function(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=li(t)););return t}(t,e);if(n){var o=Object.getOwnPropertyDescriptor(n,e);return o.get?o.get.call(r):o.value}})(t,e,r||t)}function ci(t,e){return(ci=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function ai(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=li(t);if(e){var o=li(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return ui(this,r)}}function ui(t,e){return!e||"object"!==ni(e)&&"function"!=typeof e?si(t):e}function si(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function li(t){return(li=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var fi=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&ci(t,e)}(i,t);var e,r,n,o=ai(i);function i(t){var e;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,i),(e=o.call(this,t)).render=e.render.bind(si(e)),e}return e=i,(r=[{key:"activate",value:function(){ii(li(i.prototype),"activate",this).call(this),this.map&&(this.map.on("sourcedata",this.render),this.map.on("styledata",this.render),this.map.on("idle",this.render))}},{key:"deactivate",value:function(){this.map&&(this.map.off("sourcedata",this.render),this.map.off("styledata",this.render),this.map.off("idle",this.render)),ii(li(i.prototype),"deactivate",this).call(this)}},{key:"getCopyrights",value:function(){return Wt(this.map)}}])&&oi(e.prototype,r),n&&oi(e,n),i}(ht(K));function pi(t){return("function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function yi(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),r.push.apply(r,n)}return r}function hi(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?yi(Object(r),!0).forEach((function(e){bi(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):yi(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function bi(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function vi(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function di(t,e,r){return("undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(t,e,r){var n=function(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==ji(t););return t}(t,e);if(n){var o=Object.getOwnPropertyDescriptor(n,e);return o.get?o.get.call(r):o.value}})(t,e,r||t)}function mi(t,e){return(Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function gi(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=ji(t);if(e){var o=ji(this).constructor;Reflect.construct(n,arguments,o)}else n.apply(this,arguments);return Oi(this,r)}}function Oi(t,e){return!e||"object"!==pi(e)&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}function ji(t){return(Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}nt(zt.Map);function wi(t){return function(t){if(Array.isArray(t))return Pi(t)}(t)||function(t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(t))return Array.from(t)}(t)||function(t,e){if(!t)return;if("string"==typeof t)return Pi(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Pi(t,e)}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Pi(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}var Si=function(t){var e=t.getBounds().toArray(),r=[].concat(wi(Object(Nt.fromLonLat)(e[0])),wi(Object(Nt.fromLonLat)(e[1]))),n=t.getCanvas(),o=n.width,i=n.height,c=Object(ge.getWidth)(r)/o,a=Object(ge.getHeight)(r)/i;return Math.max(c,a)},ki=function(t){var e=t.getBounds().toArray();return[[e[0][0],e[1][1]],wi(e[1]),[e[1][0],e[0][1]],wi(e[0])]};function Ti(t){return(Ti="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function Ci(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(t)))return;var r=[],n=!0,o=!1,i=void 0;try{for(var c,a=t[Symbol.iterator]();!(n=(c=a.next()).done)&&(r.push(c.value),!e||r.length!==e);n=!0);}catch(t){o=!0,i=t}finally{try{n||null==a.return||a.return()}finally{if(o)throw i}}return r}(t,e)||function(t,e){if(!t)return;if("string"==typeof t)return Ri(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Ri(t,e)}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Ri(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function Di(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function _i(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?Di(Object(r),!0).forEach((function(e){Ei(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Di(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function Ei(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function xi(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Ii(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function Mi(t,e,r){return(Mi="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(t,e,r){var n=function(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=Fi(t)););return t}(t,e);if(n){var o=Object.getOwnPropertyDescriptor(n,e);return o.get?o.get.call(r):o.value}})(t,e,r||t)}function Ai(t,e){return(Ai=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function Li(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=Fi(t);if(e){var o=Fi(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return Vi(this,r)}}function Vi(t,e){return!e||"object"!==Ti(e)&&"function"!=typeof e?Ui(t):e}function Ui(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function Fi(t){return(Fi=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var qi=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&Ai(t,e)}(i,t);var e,r,n,o=Li(i);function i(){var t,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return xi(this,i),(t=o.call(this,_i({},e))).onMapZoomEnd=t.onMapZoomEnd.bind(Ui(t)),t.onMapMouseMove=t.onMapMouseMove.bind(Ui(t)),t}return e=i,(r=[{key:"updateIconScale",value:function(t){this.tracker.setIconScale(t.width/t.clientWidth)}},{key:"init",value:function(t){var e=this;if(t){var r=t.getCanvas(),n=r.width/r.clientWidth;t.on("resize",this.updateIconScale.bind(this,r)),Mi(Fi(i.prototype),"init",this).call(this,t,{width:r.width,height:r.height,iconScale:n,getPixelFromCoordinate:function(t){var r=window.devicePixelRatio||1,n=Ci(Object(Nt.toLonLat)(t),2),o=n[0],i=n[1],c=e.map.project({lng:o,lat:i});return[c.x*r,c.y*r]}})}}},{key:"terminate",value:function(){return this.map&&this.map.off("resize",this.updateIconScale),Mi(Fi(i.prototype),"terminate",this).call(this)}},{key:"setCurrTime",value:function(t){var e=this.map.getCanvas();Mi(Fi(i.prototype),"setCurrTime",this).call(this,t,[e.width,e.height],Si(this.map),!this.map.isMoving()&&!this.map.isRotating()&&!this.map.isZooming())}},{key:"start",value:function(){var t=this.map.getCanvas();Mi(Fi(i.prototype),"start",this).call(this,[t.width,t.height],this.map.getZoom(),Si(this.map)),this.map.on("zoomend",this.onMapZoomEnd),this.isHoverActive&&this.map.on("mousemove",this.onMapMouseMove)}},{key:"stop",value:function(){Mi(Fi(i.prototype),"stop",this).call(this),this.map&&(this.map.off("zoomend",this.onMapZoomEnd),this.map.off("mousemove",this.onMapMouseMove))}},{key:"getVehiclesAtCoordinate",value:function(t,e){var r=Si(this.map);return Mi(Fi(i.prototype),"getVehiclesAtCoordinate",this).call(this,t,r,e)}},{key:"onMapZoomEnd",value:function(){this.startUpdateTime(this.map.getZoom())}},{key:"onMapMouseMove",value:function(t){if(this.map.isMoving()||this.map.isRotating()||this.map.isZooming()||!this.isHoverActive)this.map.getContainer().style.cursor="auto";else{var e=Ci(this.getVehiclesAtCoordinate(Object(Nt.fromLonLat)([t.lngLat.lng,t.lngLat.lat]),1),1)[0],r=e&&e.id;this.hoverVehicleId!==r&&(this.map.getContainer().style.cursor=e?"pointer":"auto",this.hoverVehicleId=r,this.renderTrajectories(this.currTime))}}}])&&Ii(e.prototype,r),n&&Ii(e,n),i}($e(O));function Ni(t){return(Ni="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function zi(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function Bi(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?zi(Object(r),!0).forEach((function(e){Ki(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):zi(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function Ki(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Gi(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Zi(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function Hi(t,e,r){return(Hi="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(t,e,r){var n=function(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=Yi(t)););return t}(t,e);if(n){var o=Object.getOwnPropertyDescriptor(n,e);return o.get?o.get.call(r):o.value}})(t,e,r||t)}function Wi(t,e){return(Wi=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function $i(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=Yi(t);if(e){var o=Yi(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return Ji(this,r)}}function Ji(t,e){return!e||"object"!==Ni(e)&&"function"!=typeof e?Qi(t):e}function Qi(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function Yi(t){return(Yi=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var Xi=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&Wi(t,e)}(i,t);var e,r,n,o=$i(i);function i(){var t,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return Gi(this,i),(t=o.call(this,Bi({},e))).onMove=t.onMove.bind(Qi(t)),t.onMoveEnd=t.onMoveEnd.bind(Qi(t)),t}return e=i,(r=[{key:"init",value:function(t,e){if(Hi(Yi(i.prototype),"init",this).call(this,t),this.map){this.map.on("zoomend",this.onZoomEnd),this.map.on("move",this.onMove),this.map.on("moveend",this.onMoveEnd);var r=this.map.getCanvas(),n=r.width,o=r.height;this.tracker.canvas.width=n,this.tracker.canvas.height=o,this.map.addSource("canvas-source",{type:"canvas",canvas:this.tracker.canvas,coordinates:ki(this.map),animate:!0}),this.map.addLayer({id:"canvas-layer",type:"raster",source:"canvas-source",paint:{"raster-opacity":1,"raster-fade-duration":0}},e)}}},{key:"terminate",value:function(){this.map&&(this.map.off("zoomend",this.onZoomEnd),this.map.off("move",this.onMove),this.map.off("moveend",this.onMoveEnd)),Hi(Yi(i.prototype),"terminate",this).call(this)}},{key:"onMove",value:function(){this.map.getSource("canvas-source").setCoordinates(ki(this.map));var t=this.map.getCanvas(),e=t.width,r=t.height;this.renderTrajectories(this.currTime,[e,r],Si(this.map))}},{key:"onMoveEnd",value:function(){this.updateTrajectories()}}])&&Zi(e.prototype,r),n&&Zi(e,n),i}(eo(qi));function tc(t){return(tc="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function ec(t){return function(t){if(Array.isArray(t))return oc(t)}(t)||function(t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(t))return Array.from(t)}(t)||nc(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function rc(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(t)))return;var r=[],n=!0,o=!1,i=void 0;try{for(var c,a=t[Symbol.iterator]();!(n=(c=a.next()).done)&&(r.push(c.value),!e||r.length!==e);n=!0);}catch(t){o=!0,i=t}finally{try{n||null==a.return||a.return()}finally{if(o)throw i}}return r}(t,e)||nc(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function nc(t,e){if(t){if("string"==typeof t)return oc(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?oc(t,e):void 0}}function oc(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function ic(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function cc(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?ic(Object(r),!0).forEach((function(e){ac(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):ic(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function ac(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function uc(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function sc(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function lc(t,e,r){return(lc="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(t,e,r){var n=function(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=bc(t)););return t}(t,e);if(n){var o=Object.getOwnPropertyDescriptor(n,e);return o.get?o.get.call(r):o.value}})(t,e,r||t)}function fc(t,e){return(fc=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function pc(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=bc(t);if(e){var o=bc(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return yc(this,r)}}function yc(t,e){return!e||"object"!==tc(e)&&"function"!=typeof e?hc(t):e}function hc(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function bc(t){return(bc=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var vc={mapbox:{TrajservLayer:function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&fc(t,e)}(i,t);var e,r,n,o=pc(i);function i(){var t,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return uc(this,i),(t=o.call(this,cc({},e))).onMapClick=t.onMapClick.bind(hc(t)),t.onMove=t.onMove.bind(hc(t)),t.onMoveEnd=t.onMoveEnd.bind(hc(t)),t.onVisibilityChange=t.onVisibilityChange.bind(hc(t)),t}return e=i,(r=[{key:"init",value:function(t,e){if(t){lc(bc(i.prototype),"init",this).call(this,t);var r=t.getCanvas(),n=r.width,o=r.height;this.tracker.canvas.width=n,this.tracker.canvas.height=o;var c={type:"canvas",canvas:this.tracker.canvas,coordinates:ki(t),animate:!0,attribution:this.copyrights};this.beforeId=e,this.layer={id:this.key,type:"raster",source:this.key,layout:{visibility:this.visible?"visible":"none"},paint:{"raster-opacity":1,"raster-fade-duration":0,"raster-resampling":"nearest"}},t.addSource(this.key,c),t.addLayer(this.layer,this.beforeId),this.listeners=[this.on("change:visible",this.onVisibilityChange)]}}},{key:"terminate",value:function(){this.map&&(this.listeners.forEach((function(t){Object(c.unByKey)(t)})),this.map.removeLayer(this.key),this.map.removeSource(this.key)),lc(bc(i.prototype),"terminate",this).call(this)}},{key:"start",value:function(){this.map&&(lc(bc(i.prototype),"start",this).call(this),this.map.on("click",this.onMapClick),this.map.on("move",this.onMove),this.map.on("moveend",this.onMoveEnd))}},{key:"stop",value:function(){this.map&&(this.map.off("click",this.onClick),this.map.off("move",this.onMove),this.map.off("moveend",this.onMoveEnd)),lc(bc(i.prototype),"stop",this).call(this)}},{key:"onVisibilityChange",value:function(){this.visible&&!this.map.getLayer(this.key)?this.map.addLayer(this.layer,this.beforeId):this.map.getLayer(this.key)&&this.map.removeLayer(this.key)}},{key:"onMove",value:function(){this.map.getSource(this.key).setCoordinates(ki(this.map));var t=this.map.getCanvas(),e=t.width,r=t.height;this.renderTrajectories(this.currTime,[e,r],Si(this.map))}},{key:"onMoveEnd",value:function(){this.updateTrajectories(),this.selectedVehicleId&&this.journeyId&&this.highlightTrajectory()}},{key:"onMapClick",value:function(t){var e=this;if(this.clickCallbacks.length){var r=rc(this.getVehiclesAtCoordinate(Object(Nt.fromLonLat)([t.lngLat.lng,t.lngLat.lat]),1),1)[0];r?(this.selectedVehicleId=r.id,this.journeyId=r.journeyIdentifier,this.updateTrajectoryStations(this.selectedVehicleId).then((function(n){e.stationsCoords=[],n.stations.forEach((function(t){e.stationsCoords.push(Object(Nt.fromLonLat)(t.coordinates))})),e.clickCallbacks.forEach((function(o){return o(cc(cc({},r),n),e,t)}))}))):(this.selectedVehicleId=null,this.clickCallbacks.forEach((function(r){return r(null,e,t)})))}}},{key:"getParams",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=this.map.getBounds().toArray(),r=Object(Nt.fromLonLat)(e[0]),n=Object(Nt.fromLonLat)(e[1]),o=[].concat(ec(r),ec(n)),c=Object(ge.buffer)(o,Object(ge.getWidth)(o)/10).join(","),a=this.map.getZoom();return lc(bc(i.prototype),"getParams",this).call(this,cc(cc({},t),{},{bbox:c,s:a<10?1:0,z:a}))}},{key:"defaultStyle",value:function(t){var e=this.map.getZoom();return lc(bc(i.prototype),"defaultStyle",this).call(this,t,e)}},{key:"drawFullTrajectory",value:function(t,e,r){console.log("to be implemented")}},{key:"highlightTrajectory",value:function(t){var e=this;this.api.fetchTrajectoryById({id:t,time:hr(new Date)}).catch((function(){e.map.getLayer("highlight-trajectory")&&e.map.removeLayer("highlight-trajectory")}))}}])&&sc(e.prototype,r),n&&sc(e,n),i}(Pn(qi)),TralisLayer:Xi},ol:{Map:qt,Layer:E,WMSLayer:Vo,MapboxLayer:be,TrajservLayer:Fn,TralisLayer:po,VectorLayer:ko}};e.default=vc}])}));
1
+ !function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define("mobility-toolbox-js",[],e):"object"==typeof exports?exports["mobility-toolbox-js"]=e():t["mobility-toolbox-js"]=e()}(window,(function(){return function(t){var e={};function r(n){if(e[n])return e[n].exports;var o=e[n]={i:n,l:!1,exports:{}};return t[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}return r.m=t,r.c=e,r.d=function(t,e,n){r.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(t,e){if(1&e&&(t=r(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)r.d(n,o,function(e){return t[e]}.bind(null,o));return n},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="",r(r.s=24)}([function(t,e){t.exports=require("ol/proj")},function(t,e){t.exports=require("ol/style")},function(t,e){t.exports=require("ol/Observable")},function(t,e){t.exports=require("ol/geom")},function(t,e){t.exports=require("ol/extent")},function(t,e){t.exports=require("query-string")},function(t,e){t.exports=require("ol/layer")},function(t,e){t.exports=require("ol/format/GeoJSON")},function(t,e){t.exports=require("ol/Feature")},function(t,e){t.exports=require("ol/Object")},function(t,e){t.exports=require("ol/layer/Layer")},function(t,e){t.exports=require("mapbox-gl")},function(t,e){t.exports=require("ol/source/Source")},function(t,e){t.exports=require("ol/source")},function(t,e){t.exports=require("ol")},function(t,e){t.exports=require("ol/geom/GeometryType")},function(t,e){t.exports=require("ol/format")},function(t,e){t.exports=require("ol/Map")},function(t,e){t.exports=require("ol/control")},function(t,e){t.exports=require("ol/layer/Group")},function(t,e){t.exports=require("uuid")},function(t,e){t.exports=require("ol/geom/Point")},function(t,e){t.exports=require("ol/interaction")},function(t,e){t.exports=require("ol/events/condition")},function(t,e,r){t.exports=r(25)},function(t,e,r){"use strict";r.r(e);var n=r(17),o=r.n(n),i=r(18),c=r(2),a=r.n(c),u=r(19),s=r.n(u),l=r(20);function f(t){return(f="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function p(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function y(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?p(Object(r),!0).forEach((function(e){h(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):p(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function h(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function b(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function v(t,e){return(v=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function d(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=g(t);if(e){var o=g(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return m(this,r)}}function m(t,e){return!e||"object"!==f(e)&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}function g(t){return(g=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var O=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&v(t,e)}(i,t);var e,r,n,o=d(i);function i(t){var e;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,i),(e=o.call(this)).defineProperties(y({isQueryable:!0},t)),t.copyrights&&(e.copyrights=t.copyrights);var r=t.onClick;return r&&e.onClick(r),e}return e=i,(r=[{key:"defineProperties",value:function(t){var e=this,r=t.name,n=t.key,o=t.children,i=t.visible,c=t.properties,a=t.isBaseLayer,u=t.isQueryable,s=Object(l.v4)(),f=r||s;Object.defineProperties(this,{options:{value:t},name:{value:f},key:{value:n||f.toLowerCase()},isBaseLayer:{value:!!a},isQueryable:{value:!!u},isReactSpatialLayer:{value:!0},children:{value:o||[],writable:!0},copyrights:{get:function(){return e.get("copyrights")},set:function(t){var r=Array.isArray(t)?t:[t];return e.set("copyrights",r)}},visible:{value:void 0===i||i,writable:!0},properties:{value:y({},c||{})},map:{writable:!0},clickCallbacks:{value:[]}})}},{key:"init",value:function(t){this.terminate(),this.map=t}},{key:"terminate",value:function(){}},{key:"get",value:function(t){return this.properties[t]}},{key:"set",value:function(t,e){this.properties[t]=e,this.dispatchEvent({type:"change:".concat(t),target:this})}},{key:"setVisible",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=arguments.length>2&&void 0!==arguments[2]&&arguments[2],n=arguments.length>3&&void 0!==arguments[3]&&arguments[3];t!==this.visible&&(this.visible=t,this.dispatchEvent({type:"change:visible",target:this,stopPropagationDown:e,stopPropagationUp:r,stopPropagationSiblings:n}))}},{key:"getVisibleChildren",value:function(){return this.children.filter((function(t){return t.visible}))}},{key:"hasVisibleChildren",value:function(){return!!this.hasChildren(!0)}},{key:"hasChildren",value:function(t){return!!this.children.find((function(e){return e.visible===t}))}},{key:"addChild",value:function(t){this.children.unshift(t),this.dispatchEvent({type:"change:children",target:this})}},{key:"removeChild",value:function(t){for(var e=0;e<this.children.length;e+=1)if(this.children[e].name===t)return void this.children.splice(e,1);this.dispatchEvent({type:"change:children",target:this})}},{key:"getFeatureInfoAtCoordinate",value:function(){return Promise.resolve({layer:this,features:[],coordinate:null})}},{key:"onClick",value:function(t){if("function"!=typeof t)throw new Error("callback must be of type function.");this.clickCallbacks.includes(t)||this.clickCallbacks.push(t)}},{key:"unClick",value:function(t){if("function"==typeof t){var e=this.clickCallbacks.indexOf(t);e>=-1&&this.clickCallbacks.splice(e,1)}}}])&&b(e.prototype,r),n&&b(e,n),i}(a.a);function j(t){return(j="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function w(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function P(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?w(Object(r),!0).forEach((function(e){S(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):w(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function S(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function k(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function T(t,e,r){return(T="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(t,e,r){var n=function(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=_(t)););return t}(t,e);if(n){var o=Object.getOwnPropertyDescriptor(n,e);return o.get?o.get.call(r):o.value}})(t,e,r||t)}function C(t,e){return(C=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function R(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=_(t);if(e){var o=_(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return D(this,r)}}function D(t,e){return!e||"object"!==j(e)&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}function _(t){return(_=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var E=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&C(t,e)}(i,t);var e,r,n,o=R(i);function i(t){var e;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,i),(e=o.call(this,t)).olLayer&&e.olLayer.setVisible(e.visible),e}return e=i,(r=[{key:"defineProperties",value:function(t){T(_(i.prototype),"defineProperties",this).call(this,t),Object.defineProperties(this,{olLayer:{value:t.olLayer,writable:!0},olListenersKeys:{value:[]}})}},{key:"init",value:function(t){var e=this;if(T(_(i.prototype),"init",this).call(this,t),this.map&&this.olLayer&&(this.olListenersKeys.push(this.map.getLayers().on("remove",(function(t){t.element===e.olLayer&&e.terminate()}))),this.copyrights)){var r=this.copyrights||[];this.olLayer instanceof s.a?this.olLayer.getLayers().getArray().forEach((function(t){t.getSource().setAttributions(r)})):this.olLayer.getSource().setAttributions(r)}}},{key:"terminate",value:function(){Object(c.unByKey)(this.olListenersKeys),T(_(i.prototype),"terminate",this).call(this)}},{key:"setVisible",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=arguments.length>2&&void 0!==arguments[2]&&arguments[2],n=arguments.length>3&&void 0!==arguments[3]&&arguments[3];t!==this.visible&&(T(_(i.prototype),"setVisible",this).call(this,t,e,r,n),this.olLayer&&this.olLayer.setVisible(this.visible))}},{key:"clone",value:function(t){return new i(P(P({},this.options),t))}}])&&k(e.prototype,r),n&&k(e,n),i}(O),x=r(9),I=r.n(x);function M(t){return(M="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function A(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function L(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?A(Object(r),!0).forEach((function(e){V(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):A(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function V(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function U(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function F(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function q(t,e){return(q=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function N(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=B(t);if(e){var o=B(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return z(this,r)}}function z(t,e){return!e||"object"!==M(e)&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}function B(t){return(B=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var K=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&q(t,e)}(i,t);var e,r,n,o=N(i);function i(){var t,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};U(this,i),(t=o.call(this,e)).defineProperties(e);var r=L({active:!1!==e.active},e),n=r.active;return t.active=n,t}return e=i,(r=[{key:"defineProperties",value:function(t){var e=this,r=L({},t),n=r.target,o=r.element,i=r.render;Object.defineProperties(this,{active:{get:function(){return e.get("active")},set:function(t){e.set("active",t),t?e.activate():e.deactivate(),e.render()}},map:{get:function(){return e.get("map")},set:function(t){if(e.map&&e.element&&e.element.parentNode&&e.element.parentNode.removeChild(e.element),e.deactivate(),e.set("map",t),e.map){var r=e.target||e.map.getContainer();e.element||e.createDefaultElement(),e.element&&r.appendChild(e.element),e.active&&e.activate()}e.render()}},target:{value:n},element:{value:o,writable:!0},render:{value:i||this.render,writable:!0}})}},{key:"activate",value:function(){this.deactivate()}},{key:"deactivate",value:function(){}},{key:"render",value:function(){}},{key:"createDefaultElement",value:function(){}}])&&F(e.prototype,r),n&&F(e,n),i}(I.a);function G(t){return(G="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function Z(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function H(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?Z(Object(r),!0).forEach((function(e){W(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Z(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function W(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function $(t,e,r){return($="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(t,e,r){var n=function(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=X(t)););return t}(t,e);if(n){var o=Object.getOwnPropertyDescriptor(n,e);return o.get?o.get.call(r):o.value}})(t,e,r||t)}function J(t,e){return(J=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function Q(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=X(t);if(e){var o=X(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return Y(this,r)}}function Y(t,e){return!e||"object"!==G(e)&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}function X(t){return(X=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function tt(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function et(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function rt(t,e,r){return e&&et(t.prototype,e),r&&et(t,r),t}var nt=function(t){return function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&J(t,e)}(r,t);var e=Q(r);function r(){var t,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return tt(this,r),(t=e.call(this,H(H({},n),{},{layers:[],controls:[]}))).mobilityLayers=[],t.mobilityControls=[],(n.controls||[]).forEach((function(e){t.addControl(e)})),(n.layers||[]).forEach((function(e){t.addLayer(e)})),t}return rt(r,[{key:"getMobilityLayers",value:function(){return this.mobilityLayers}},{key:"getMobilityControls",value:function(){return this.mobilityControls}},{key:"addMobilityControl",value:function(t){this.mobilityControls.push(t),t.map=this}},{key:"removeMobilityControl",value:function(t){t.map=null,this.mobilityControls=this.mobilityControls.filter((function(e){return e!==t}))}},{key:"addControl",value:function(t,e){t instanceof K?this.addMobilityControl(t):$(X(r.prototype),"addControl",this).call(this,t,e)}},{key:"removeControl",value:function(t){t instanceof K?this.removeMobilityControl(t):$(X(r.prototype),"removeControl",this).call(this,t)}}]),r}(t)},ot=r(10),it=r.n(ot);function ct(t){return(ct="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function at(t,e){return(at=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function ut(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=lt(t);if(e){var o=lt(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return st(this,r)}}function st(t,e){return!e||"object"!==ct(e)&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}function lt(t){return(lt=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function ft(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function pt(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function yt(t,e,r){return e&&pt(t.prototype,e),r&&pt(t,r),t}var ht=function(t){return function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&at(t,e)}(r,t);var e=ut(r);function r(){return ft(this,r),e.apply(this,arguments)}return yt(r,[{key:"render",value:function(){this.element&&(this.element.innerHTML=this.active?this.getCopyrights().join(" | "):"")}},{key:"createDefaultElement",value:function(){this.element=document.createElement("div"),this.element.id="mbt-copyright",Object.assign(this.element.style,{position:"absolute",bottom:0,right:0,fontSize:".8rem",padding:"0 10px"})}}]),r}(t)};function bt(t){return function(t){if(Array.isArray(t))return vt(t)}(t)||function(t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(t))return Array.from(t)}(t)||function(t,e){if(!t)return;if("string"==typeof t)return vt(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return vt(t,e)}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function vt(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}var dt=function(t){var e=t.filter((function(t){return null!=t&&t.trim&&t.trim()})),r=e.map((function(t){return t.toLowerCase()}));return bt(new Set(r)).map((function(t){return e.find((function(e){return e.toLowerCase()===t}))}))};function mt(t){return(mt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function gt(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function Ot(t,e,r){return(Ot="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(t,e,r){var n=function(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=kt(t)););return t}(t,e);if(n){var o=Object.getOwnPropertyDescriptor(n,e);return o.get?o.get.call(r):o.value}})(t,e,r||t)}function jt(t,e){return(jt=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function wt(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=kt(t);if(e){var o=kt(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return Pt(this,r)}}function Pt(t,e){return!e||"object"!==mt(e)&&"function"!=typeof e?St(t):e}function St(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function kt(t){return(kt=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var Tt=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&jt(t,e)}(i,t);var e,r,n,o=wt(i);function i(t){var e;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,i),(e=o.call(this,t)).onPostRender=e.onPostRender.bind(St(e)),e}return e=i,(r=[{key:"getCopyrights",value:function(){var t=this;if(!this.frameState)return[];var e=[];return this.frameState.layerStatesArray.forEach((function(r){var n=r.layer;Object(ot.inView)(r,t.frameState.viewState)&&n&&n.getSource&&n.getSource()&&n.getSource().getAttributions()&&(e=e.concat(n.getSource().getAttributions()(t.frameState)))})),dt(e)}},{key:"activate",value:function(){Ot(kt(i.prototype),"activate",this).call(this),this.map&&this.map.on("postrender",this.onPostRender)}},{key:"deactivate",value:function(){this.map&&this.map.un("postrender",this.onPostRender),Ot(kt(i.prototype),"deactivate",this).call(this)}},{key:"onPostRender",value:function(t){this.map&&this.element&&(this.frameState=t.frameState,this.render())}}])&&gt(e.prototype,r),n&&gt(e,n),i}(ht(K));function Ct(t){return(Ct="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function Rt(t){return function(t){if(Array.isArray(t))return Dt(t)}(t)||function(t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(t))return Array.from(t)}(t)||function(t,e){if(!t)return;if("string"==typeof t)return Dt(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Dt(t,e)}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Dt(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function _t(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function Et(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?_t(Object(r),!0).forEach((function(e){xt(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):_t(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function xt(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function It(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Mt(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function At(t,e,r){return(At="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(t,e,r){var n=function(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=Ft(t)););return t}(t,e);if(n){var o=Object.getOwnPropertyDescriptor(n,e);return o.get?o.get.call(r):o.value}})(t,e,r||t)}function Lt(t,e){return(Lt=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function Vt(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=Ft(t);if(e){var o=Ft(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return Ut(this,r)}}function Ut(t,e){return!e||"object"!==Ct(e)&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}function Ft(t){return(Ft=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var qt=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&Lt(t,e)}(c,t);var e,r,n,o=Vt(c);function c(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return It(this,c),o.call(this,Et({controls:[].concat(Rt(Object(i.defaults)({attribution:!1}).getArray()),[new Tt])},t))}return e=c,(r=[{key:"getContainer",value:function(){return this.getTargetElement()}},{key:"addLayer",value:function(t){t instanceof E?(t.init(this),this.mobilityLayers.push(t),t.olLayer&&At(Ft(c.prototype),"addLayer",this).call(this,t.olLayer),this.dispatchEvent({type:"change:mobilityLayers",target:this})):At(Ft(c.prototype),"addLayer",this).call(this,t)}},{key:"removeLayer",value:function(t){t instanceof E?(t.terminate(),this.mobilityLayers=this.mobilityLayers.filter((function(e){return e!==t})),t.olLayer&&At(Ft(c.prototype),"removeLayer",this).call(this,t)):At(Ft(c.prototype),"removeLayer",this).call(this,t)}},{key:"addControl",value:function(t){At(Ft(c.prototype),"addControl",this).call(this,t)}},{key:"removeControl",value:function(t){At(Ft(c.prototype),"removeControl",this).call(this,t)}}])&&Mt(e.prototype,r),n&&Mt(e,n),c}(nt(o.a)),Nt=r(0),zt=r(11),Bt=r.n(zt),Kt=r(12),Gt=r.n(Kt),Zt=r(7),Ht=r.n(Zt),Wt=r(5),$t=r.n(Wt);function Jt(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function Qt(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?Jt(Object(r),!0).forEach((function(e){Yt(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Jt(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function Yt(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var Xt=function(t,e,r){if(!1===t)return r;var n=$t.a.parseUrl(r);return!t&&n.query[e]?r:t?$t.a.stringifyUrl(Qt(Qt({},n),{},{query:Qt(Qt({},n.query),{},Yt({},e,t))})):(console.warn("No apiKey is defined for request to ".concat(r)),null)},te=function(t){if(!t||!t.style)return[];var e=t.style.sourceCaches,r=[];return Object.values(e).forEach((function(t){if(t.used){var e=t.getSource(),n=e.attribution||e.options&&e.options.attribution;n&&(r=r.concat(n.replace(/&copy;/g,"©").split(/(<a.*?<\/a>)/)))}})),dt(r)};function ee(t){return(ee="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function re(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(t)))return;var r=[],n=!0,o=!1,i=void 0;try{for(var c,a=t[Symbol.iterator]();!(n=(c=a.next()).done)&&(r.push(c.value),!e||r.length!==e);n=!0);}catch(t){o=!0,i=t}finally{try{n||null==a.return||a.return()}finally{if(o)throw i}}return r}(t,e)||function(t,e){if(!t)return;if("string"==typeof t)return ne(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return ne(t,e)}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function ne(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function oe(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function ie(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?oe(Object(r),!0).forEach((function(e){ce(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):oe(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function ce(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function ae(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function ue(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function se(t,e,r){return(se="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(t,e,r){var n=function(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=he(t)););return t}(t,e);if(n){var o=Object.getOwnPropertyDescriptor(n,e);return o.get?o.get.call(r):o.value}})(t,e,r||t)}function le(t,e){return(le=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function fe(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=he(t);if(e){var o=he(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return pe(this,r)}}function pe(t,e){return!e||"object"!==ee(e)&&"function"!=typeof e?ye(t):e}function ye(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function he(t){return(he=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var be=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&le(t,e)}(i,t);var e,r,n,o=fe(i);function i(){var t,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};ae(this,i);var r=new it.a({source:new Gt.a({}),render:function(e){if(!t.mbMap)return console.warn("Mapbox map doesn't exist."),null;var r=!1,n=t.mbMap.getCanvas(),o=e.viewState,i=t.olLayer.getVisible();t.renderState.visible!==i&&(n.style.display=i?"block":"none",t.renderState.visible=i,n.style.position="absolute");var c=t.olLayer.getOpacity();t.renderState.opacity!==c&&(n.style.opacity=c,t.renderState.opacity=c);var a=o.rotation;t.renderState.rotation!==a&&(t.mbMap.rotateTo(180*-(a||0)/Math.PI,{animate:!1}),r=!0,t.renderState.rotation=a),t.renderState.zoom===o.zoom&&t.renderState.center[0]===o.center[0]&&t.renderState.center[1]===o.center[1]||(t.mbMap.jumpTo({center:Object(Nt.toLonLat)(o.center),zoom:o.zoom-1,animate:!1}),r=!0,t.renderState.zoom=o.zoom,t.renderState.center=o.center);var u=t.map.getSize();if(t.renderState.size[0]===u[0]&&t.renderState.size[1]===u[1]||(r=!0,t.renderState.size=u),t.mbMap&&t.mbMap.style&&t.mbMap.isStyleLoaded()&&r)try{t.mbMap._frame&&(t.mbMap._frame.cancel(),t.mbMap._frame=null),t.mbMap._render()}catch(t){console.warn(t)}return n}});return(t=o.call(this,ie(ie({},e),{},{olLayer:r}))).styleUrl=e.url,t.apiKey=e.apiKey,t.apiKeyName=e.apiKeyName||"key",t.updateAttribution=t.updateAttribution.bind(ye(t)),t}return e=i,(r=[{key:"init",value:function(t){var e=this;se(he(i.prototype),"init",this).call(this,t),this.map&&!this.mbMap&&(this.format=new Ht.a({featureProjection:this.map.getView().getProjection()}),this.loadMbMap(),this.olListenersKeys.push(this.map.on("change:size",(function(){try{e.mbMap&&e.mbMap.resize()}catch(t){console.warn(t)}}))))}},{key:"createStyleUrl",value:function(){return Xt(this.apiKey,this.apiKeyName,this.styleUrl)}},{key:"loadMbMap",value:function(){var t=this;if(this.olListenersKeys.push(this.map.on("change:target",(function(){t.loadMbMap()}))),this.map.getTargetElement())if(this.visible){var e=re(this.map.getView().getCenter(),2),r=e[0],n=e[1];r&&n||(r=0,n=0);var o=this.createStyleUrl();try{this.mbMap=new Bt.a.Map({style:o,attributionControl:!1,boxZoom:!1,center:Object(Nt.toLonLat)([r,n]),container:this.map.getTargetElement(),interactive:!1,fadeDuration:"fadeDuration"in this.options?this.options.fadeDuration:300,preserveDrawingBuffer:this.options.preserveDrawingBuffer||!1})}catch(t){console.warn("Failed creating mapbox map: ",t)}this.renderState={center:[r,n],zoom:null,rotation:null,visible:null,opacity:null,size:[0,0]},this.mbMap.once("load",(function(){t.loaded=!0,t.copyrights=t.copyrights||te(t.mbMap)||[],t.olLayer.getSource().setAttributions(t.copyrights),t.dispatchEvent({type:"load",target:t})}));var i=this.mbMap.getCanvas();i&&(this.options.tabIndex?i.setAttribute("tabindex",this.options.tabIndex):i.removeAttribute("tabindex")),this.mbMap.on("idle",this.updateAttribution)}else this.olListenersKeys.push(this.once("change:visible",(function(){t.loadMbMap()})))}},{key:"updateAttribution",value:function(t){var e=this.copyrights||te(t.target)||[];this.copyrights.toString()!==e.toString()&&this.olLayer.getSource().setAttributions(e)}},{key:"getFeatureInfoAtCoordinate",value:function(t,e){var r=this;if(!(e&&this.format&&this.mbMap&&this.mbMap.isStyleLoaded()))return Promise.resolve({coordinate:t,features:[],layer:this});var n=t&&this.mbMap.project(Object(Nt.toLonLat)(t)),o=this.mbMap.queryRenderedFeatures(n,e).map((function(t){var e=r.format.readFeature(t);return e&&e.set("mapboxFeature",t),e}));return Promise.resolve({layer:this,features:o,coordinate:t})}},{key:"terminate",value:function(){this.mbMap&&(this.mbMap.off("idle",this.updateAttribution),this.mbMap.triggerRepaint=function(){},this.mbMap.remove(),this.mbMap=null),this.loaded=!1,se(he(i.prototype),"terminate",this).call(this)}},{key:"clone",value:function(t){return new i(ie(ie({},this.options),t))}}])&&ue(e.prototype,r),n&&ue(e,n),i}(E);var ve=r(1),de=r(13),me=r(6);var ge=r(4),Oe=r(15),je=r.n(Oe);function we(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(t)))return;var r=[],n=!0,o=!1,i=void 0;try{for(var c,a=t[Symbol.iterator]();!(n=(c=a.next()).done)&&(r.push(c.value),!e||r.length!==e);n=!0);}catch(t){o=!0,i=t}finally{try{n||null==a.return||a.return()}finally{if(o)throw i}}return r}(t,e)||function(t,e){if(!t)return;if("string"==typeof t)return Pe(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Pe(t,e)}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Pe(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function Se(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function ke(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Te(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}var Ce=function(){function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t);var r=function(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?Se(Object(r),!0).forEach((function(e){ke(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Se(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}({interpolate:!0},e);this.trajectories=[],this.renderedTrajectories=[],this.interpolate=!!r.interpolate,this.getPixelFromCoordinate=r.getPixelFromCoordinate,this.hoverVehicleId=null,this.selectedVehicleId=null,this.iconScale=r.iconScale,this.canvas=r.canvas||document.createElement("canvas"),this.canvas.width=r.width,this.canvas.height=r.height,this.canvas.setAttribute("style",["position: absolute","top: 0","bottom: 0","width: 100%","height: 100%","pointer-events: none","visibility: visible","margin-top: inherit"].join(";")),this.canvasContext=this.canvas.getContext("2d")}var e,r,n;return e=t,(r=[{key:"setVisible",value:function(t){this.canvas&&(this.canvas.style.visibility=t?"visible":"hidden")}},{key:"setTrajectories",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];this.sort&&t.sort(this.sort),this.trajectories=t}},{key:"getTrajectories",value:function(){return this.trajectories||[]}},{key:"getRenderedTrajectories",value:function(){return this.renderedTrajectories}},{key:"clear",value:function(){this.canvasContext&&this.canvasContext.clearRect(0,0,this.canvas.width,this.canvas.height)}},{key:"setFilter",value:function(t){this.filter=t}},{key:"setSort",value:function(t){this.sort=t}},{key:"setHoverVehicleId",value:function(t){t!==this.hoverVehicleId&&(this.hoverVehicleId=t)}},{key:"setSelectedVehicleId",value:function(t){t!==this.selectedVehicleId&&(this.selectedVehicleId=t)}},{key:"setIconScale",value:function(t){this.iconScale=t}},{key:"setStyle",value:function(t){this.style=t}},{key:"moveCanvas",value:function(t,e){var r=parseFloat(this.canvas.style.left),n=parseFloat(this.canvas.style.top);this.canvas.style.left="".concat(r-t,"px"),this.canvas.style.top="".concat(n-e,"px")}},{key:"renderTrajectories",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Date.now(),e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],r=arguments.length>2?arguments[2]:void 0,n=arguments.length>3&&void 0!==arguments[3]&&arguments[3];this.clear(),this.canvas.style.left="0px",this.canvas.style.top="0px";var o,i,c,a,u,s,l,f,p=we(e,2),y=p[0],h=p[1];if(y&&h&&(this.canvas.width!==y||this.canvas.height!==h)){var b=[y,h];this.canvas.width=b[0],this.canvas.height=b[1]}this.currResolution=r||this.currResolution,this.renderedTrajectories=[];for(var v=(this.trajectories||[]).length-1;v>=0;v-=1){var d=this.trajectories[v],m=d.geometry,g=d.timeIntervals,O=d.timeOffset;if(!this.filter||this.filter(d,v,this.trajectories)){var j=null,w=void 0;if(!d.coordinate||!n&&this.interpolate){if(g&&g.length>1){for(var P=t-(O||0),S=void 0,k=void 0,T=void 0,C=void 0,R=void 0,D=0;D<g.length-1;D+=1){var _=we(g[D],3);S=_[0],T=_[1],w=_[2];var E=we(g[D+1],2);if(k=E[0],C=E[1],S<=P&&P<=k)break;S=null,k=null}if(m.getType()===je.a.POINT)j=m.getCoordinates();else if(m.getType()===je.a.LINE_STRING){if(S&&k){R=this.interpolate?Math.min((P-S)/(k-S),1):0;var x=this.interpolate?R*(C-T)+T:0;j=m.getCoordinateAt(x),this.trajectories[v].rotation=w,this.trajectories[v].endFraction=R}else if(P<g[0][0]){var I=we(g,1),M=we(I[0],3);w=M[2],R=0,j=m.getFirstCoordinate()}else if(P>g[g.length-1][0]){var A=we(g[g.length-1],3);w=A[2],R=1,j=m.getLastCoordinate()}}else console.error("This geometry type is not supported. Only Point or LineString are. Current geometry: ",m);this.trajectories[v].rotation=w,this.trajectories[v].endFraction=R||0}}else j=d.coordinate;if(j){this.trajectories[v].coordinate=j;var L=this.getPixelFromCoordinate(j);if(!L)continue;this.trajectories[v].rendered=!0,this.renderedTrajectories.push(this.trajectories[v]);var V=this.style(d,this.currResolution);if(!V)continue;var U=V.width,F=V.height;this.iconScale&&(F=Math.floor(F*this.iconScale),U=Math.floor(U*this.iconScale)),this.hoverVehicleId!==d.id&&this.selectedVehicleId!==d.id&&this.canvasContext.drawImage(V,L[0]-U/2,L[1]-F/2,U,F),this.hoverVehicleId===d.id&&(o=V,i=L,c=U,a=F),this.selectedVehicleId===d.id&&(u=V,s=L,l=U,f=F)}}}u&&this.canvasContext.drawImage(u,s[0]-l/2,s[1]-f/2,l,f),o&&this.canvasContext.drawImage(o,i[0]-c/2,i[1]-a/2,c,a)}},{key:"destroy",value:function(){Object(c.unByKey)(this.olEventsKeys),this.renderedTrajectories=[],this.clear()}}])&&Te(e.prototype,r),n&&Te(e,n),t}(),Re={0:[0,0,0,0,0,7,7,7,7,7,7,7,7,7,7,7,7],1:[0,0,0,0,0,7,7,7,7,7,7,7,7,7,7,7,7],2:[0,0,0,0,0,2,2,3,7,7,7,12,15,15,15,15,15],3:[0,0,0,0,0,7,7,7,7,7,7,7,7,7,7,7,7],4:[0,0,0,0,0,7,7,7,7,7,7,7,7,7,7,7,7],5:[0,0,0,0,0,7,7,7,7,7,7,7,7,7,7,7,7],6:[0,0,0,0,0,7,7,7,7,7,7,7,7,7,7,7,7],7:[0,0,0,0,0,7,7,7,7,7,7,7,7,7,7,7,7],8:[0,0,0,0,0,7,7,7,7,7,7,7,7,7,7,7,7],9:[0,0,0,0,0,2,2,3,7,7,7,12,15,15,15,15,15]},De=["Tram","Subway / Metro / S-Bahn","Train","Bus","Ferry","Cable Car","Gondola","Funicular","Long distance bus","Rail"],_e=["#ffb400","#ff5400","#ff8080","#ea0000","#3000ff","#ffb400","#41a27b","#00d237","#b5b5b5","#ff8080"],Ee=["#000000","#ffffff","#000000","#ffffff","#ffffff","#000000","#ffffff","#000000","#000000","#000000"],xe=[1e5,5e4,4e4,3e4,2e4,15e3,1e4,5e3,2e3,1e3,400,300,250,180,90,60,50,50,50,50,50],Ie=function(t){if("string"==typeof t){var e=De.find((function(e){return new RegExp(t).test(e)}));return De.indexOf(e)}return t},Me=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;try{var e=Ie(t);return _e[e]}catch(t){return 1}},Ae=function(t,e,r){return e?r?"#ff0000":"#a0a0a0":t>=36e5?"#ed004c":t>=5e5?"#e80000":t>=3e5?"#ff4a00":t>=18e4?"#f7bf00":null===t?"#a0a0a0":"#00a00c"};function Le(t){return(Le="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function Ve(t){return function(t){if(Array.isArray(t))return Ue(t)}(t)||function(t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(t))return Array.from(t)}(t)||function(t,e){if(!t)return;if("string"==typeof t)return Ue(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Ue(t,e)}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Ue(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function Fe(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function qe(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Ne(t,e,r){return(Ne="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(t,e,r){var n=function(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=Ge(t)););return t}(t,e);if(n){var o=Object.getOwnPropertyDescriptor(n,e);return o.get?o.get.call(r):o.value}})(t,e,r||t)}function ze(t,e){return(ze=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function Be(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=Ge(t);if(e){var o=Ge(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return Ke(this,r)}}function Ke(t,e){return!e||"object"!==Le(e)&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}function Ge(t){return(Ge=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function Ze(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function He(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function We(t,e,r){return e&&He(t.prototype,e),r&&He(t,r),t}var $e=function(t){return function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&ze(t,e)}(r,t);var e=Be(r);function r(){return Ze(this,r),e.apply(this,arguments)}return We(r,[{key:"defineProperties",value:function(t){var e=this,n=function(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?Fe(Object(r),!0).forEach((function(e){qe(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Fe(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}({isHoverActive:!0},t),o=n.isHoverActive,i=n.style,c=n.speed||1;Ne(Ge(r.prototype),"defineProperties",this).call(this,t),Object.defineProperties(this,{isTrackerLayer:{value:!0},isHoverActive:{value:!!o,writable:!0},style:{value:i||this.defaultStyle},speed:{get:function(){return c},set:function(t){c=t,e.start()}},filter:{get:function(){return e.tracker.filter},set:function(t){e.tracker&&e.tracker.setFilter(t)}},sort:{get:function(){return e.tracker.sort},set:function(t){e.sort&&e.tracker.setSort(t)}},tracker:{value:null,writable:!0},styleCache:{value:{}},currTime:{value:new Date,writable:!0},lastUpdateTime:{value:new Date,writable:!0},renderedTrajectories:{get:function(){return e.tracker.renderedTrajectories}},hoverVehicleId:{get:function(){return e.tracker.hoverVehicleId},set:function(t){e.tracker.hoverVehicleId=t}},selectedVehicleId:{get:function(){return e.tracker.selectedVehicleId},set:function(t){e.tracker.selectedVehicleId=t}},useRequestAnimationFrame:{default:!1,writable:!0}})}},{key:"init",value:function(t,e){var n=this;Ne(Ge(r.prototype),"init",this).call(this,t),this.tracker=new Ce(e),this.tracker.setStyle((function(t,e){return n.style(t,e)})),this.visible&&this.start(),this.visibilityRef=this.on("change:visible",(function(t){t.target.visible?n.start():n.stop()}))}},{key:"terminate",value:function(){this.stop(),Object(c.unByKey)(this.visibilityRef),this.tracker&&(this.tracker.destroy(),this.tracker=null),Ne(Ge(r.prototype),"terminate",this).call(this)}},{key:"start",value:function(t,e,r){this.stop(),this.tracker.setVisible(!0),this.renderTrajectories(this.currTime,t,r),this.startUpdateTime(e)}},{key:"startUpdateTime",value:function(t){var e=this;this.stopUpdateTime(),this.updateTimeInterval=setInterval((function(){var t=e.currTime.getTime()+(new Date-e.lastUpdateTime)*e.speed;e.setCurrTime(t)}),this.getRefreshTimeInMs(t))}},{key:"stop",value:function(){this.stopUpdateTime(),this.tracker&&(this.tracker.setVisible(!1),this.tracker.clear())}},{key:"stopUpdateTime",value:function(){this.updateTimeInterval&&clearInterval(this.updateTimeInterval)}},{key:"renderTrajectories",value:function(t,e,r){var n=this;this.requestId&&cancelAnimationFrame(this.requestId),this.useRequestAnimationFrame?this.requestId=requestAnimationFrame((function(){n.tracker.renderTrajectories(t,e,r)})):this.tracker.renderTrajectories(t,e,r)}},{key:"setCurrTime",value:function(t,e,r){var n=!(arguments.length>3&&void 0!==arguments[3])||arguments[3],o=new Date(t);this.currTime=o,this.lastUpdateTime=new Date,n&&this.renderTrajectories(this.currTime,e,r)}},{key:"getVehicle",value:function(t){return this.tracker.getTrajectories().filter(t)}},{key:"getVehiclesAtCoordinate",value:function(t){for(var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1/0,n=Object(ge.buffer)([].concat(Ve(t),Ve(t)),10*e),o=this.tracker.getTrajectories(),i=[],c=0;c<o.length&&(o[c].coordinate&&Object(ge.containsCoordinate)(n,o[c].coordinate)&&i.push(o[c]),i.length!==r);c+=1);return i}},{key:"getRefreshTimeInMs",value:function(t){var e=Math.round(t),r=xe[e]||25;return Math.max(25,r/this.speed)}},{key:"defaultStyle",value:function(t){var e=t.id;if(this.styleCache[e])return this.styleCache[e];var r=document.createElement("canvas");r.width=200,r.height=15;var n=r.getContext("2d");return n.arc(8,8,5,0,2*Math.PI,!1),n.fillStyle="#8ED6FF",n.fill(),n.lineWidth=3,n.strokeStyle="black",n.stroke(),n.font="bold 12px arial",n.strokeStyle="white",n.lineWidth=3,n.strokeText(e,20,10),n.fillStyle="black",n.fillText(e,20,10),this.styleCache[e]=r,this.styleCache[e]}}]),r}(t)};function Je(t){return(Je="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function Qe(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(t)))return;var r=[],n=!0,o=!1,i=void 0;try{for(var c,a=t[Symbol.iterator]();!(n=(c=a.next()).done)&&(r.push(c.value),!e||r.length!==e);n=!0);}catch(t){o=!0,i=t}finally{try{n||null==a.return||a.return()}finally{if(o)throw i}}return r}(t,e)||function(t,e){if(!t)return;if("string"==typeof t)return Ye(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Ye(t,e)}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Ye(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function Xe(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function tr(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?Xe(Object(r),!0).forEach((function(e){er(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Xe(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function er(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function rr(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function nr(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function or(t,e,r){return(or="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(t,e,r){var n=function(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=ur(t)););return t}(t,e);if(n){var o=Object.getOwnPropertyDescriptor(n,e);return o.get?o.get.call(r):o.value}})(t,e,r||t)}function ir(t,e){return(ir=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function cr(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=ur(t);if(e){var o=ur(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return ar(this,r)}}function ar(t,e){return!e||"object"!==Je(e)&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}function ur(t){return(ur=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var sr=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&ir(t,e)}(i,t);var e,r,n,o=cr(i);function i(){var t,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return rr(this,i),(t=o.call(this,tr({},e))).renderWhenZooming=e.renderWhenZooming||function(){return!0},t.olLayer=e.olLayer||new me.Group({layers:[new me.Layer({source:new Gt.a({}),render:function(e){if(!t.tracker||!t.tracker.canvas)return null;var r=e.viewState,n=r.zoom,o=r.center,i=r.resolution;if(n!==t.renderState.zoom){if(t.renderState.zoom=n,t.renderState.center=o,!t.renderWhenZooming(n))return t.tracker.clear(),t.tracker.canvas;t.renderTrajectories(t.currTime,e.size,i,!0)}else if(t.renderState.center[0]!==o[0]||t.renderState.center[1]!==o[1]){var c=t.map.getPixelFromCoordinate(o),a=t.map.getPixelFromCoordinate(t.renderState.center);t.tracker.moveCanvas(c[0]-a[0],c[1]-a[1]),t.renderState.center=o}return t.tracker.canvas}})]}),t.renderState={center:[0,0],zoom:null},t.olEventsKeys=[],t}return e=i,(r=[{key:"init",value:function(t){t&&or(ur(i.prototype),"init",this).call(this,t,{getPixelFromCoordinate:t.getPixelFromCoordinate.bind(t)})}},{key:"setCurrTime",value:function(t){var e=this.map.getView();or(ur(i.prototype),"setCurrTime",this).call(this,t,this.map.getSize(),e.getResolution(),!this.map.getView().getAnimating()&&!this.map.getView().getInteracting())}},{key:"start",value:function(){var t=this;or(ur(i.prototype),"start",this).call(this,this.map.getSize(),this.currentZoom||this.map.getView().getZoom(),this.map.getView().getResolution()),this.olEventsKeys=[this.map.on("moveend",(function(){var e=t.map.getView().getZoom();e!==t.currentZoom&&(t.currentZoom=e,t.startUpdateTime(e))})),this.map.on("pointermove",(function(e){if(!t.map.getView().getInteracting()&&!t.map.getView().getAnimating()&&t.isHoverActive){var r=Qe(t.getVehiclesAtCoordinate(e.coordinate,1),1)[0],n=r&&r.id;t.hoverVehicleId!==n&&(t.map.getTargetElement().style.cursor=r?"pointer":"auto",t.hoverVehicleId=n,t.renderTrajectories(t.currTime))}}))]}},{key:"stop",value:function(){or(ur(i.prototype),"stop",this).call(this),Object(c.unByKey)(this.olEventsKeys),this.olEventsKeys=[]}},{key:"getVehiclesAtCoordinate",value:function(t,e){var r=this.map.getView().getResolution();return or(ur(i.prototype),"getVehiclesAtCoordinate",this).call(this,t,r,e)}},{key:"clone",value:function(t){return new i(tr(tr({},this.options),t))}}])&&nr(e.prototype,r),n&&nr(e,n),i}($e(E)),lr=r(8),fr=r.n(lr),pr=r(3),yr=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new Date,e=(t.getUTCMonth()+1).toString();e=1===e.length?"0".concat(e):e;var r=t.getUTCDate().toString();return r=1===r.length?"0".concat(r):r,[t.getUTCFullYear(),e,r].join("")},hr=function(t){return[t.getUTCHours(),t.getUTCMinutes(),"".concat(t.getUTCSeconds(),".").concat(t.getUTCMilliseconds())].join(":")};function br(t){return(br="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function vr(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function dr(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?vr(Object(r),!0).forEach((function(e){mr(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):vr(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function mr(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function gr(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Or(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function jr(t,e){return(jr=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function wr(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=Sr(t);if(e){var o=Sr(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return Pr(this,r)}}function Pr(t,e){return!e||"object"!==br(e)&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}function Sr(t){return(Sr=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var kr=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&jr(t,e)}(i,t);var e,r,n,o=wr(i);function i(){var t,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return gr(this,i),(t=o.call(this)).url=e.url,t.apiKey=e.apiKey,t}return e=i,(r=[{key:"fetch",value:function(t){function e(){return t.apply(this,arguments)}return e.toString=function(){return t.toString()},e}((function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>2?arguments[2]:void 0,n=dr(dr({},e),{},{key:this.apiKey}),o=dr({},n);return Object.keys(n).forEach((function(t){return(void 0===o[t]||null===o[t])&&delete o[t]})),this.apiKey?fetch("".concat(this.url).concat(t,"?").concat($t.a.stringify(o)),r).then((function(t){try{return t.json().then((function(t){if(t.error)throw new Error(t.error);return t}))}catch(t){return Promise.reject(new Error(t))}})):Promise.reject(new Error("No apiKey defined for request to ".concat(this.url)))}))}])&&Or(e.prototype,r),n&&Or(e,n),i}(I.a);function Tr(t){return(Tr="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function Cr(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function Rr(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?Cr(Object(r),!0).forEach((function(e){Dr(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Cr(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function Dr(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function _r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Er(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function xr(t,e){return(xr=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function Ir(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=Ar(t);if(e){var o=Ar(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return Mr(this,r)}}function Mr(t,e){return!e||"object"!==Tr(e)&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}function Ar(t){return(Ar=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var Lr=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&xr(t,e)}(i,t);var e,r,n,o=Ir(i);function i(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return _r(this,i),o.call(this,Rr({url:"https://api.geops.io/stops/v1/"},t))}return e=i,(r=[{key:"search",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this.fetch("",t,{signal:e.signal}).then((function(t){return t.features}))}}])&&Er(e.prototype,r),n&&Er(e,n),i}(kr);function Vr(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function Ur(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var Fr=function(){for(var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=[],r=0;r<t.length;r+=1){var n=t[r],o=n.d,i=n.m,c=n.y;e.push({day:o,month:i,year:c})}return e},qr=function(t){var e=function(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?Vr(Object(r),!0).forEach((function(e){Ur(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Vr(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}({},t);["a","f","tt"].forEach((function(t){e[t]||(e[t]={})}));for(var r=e.id,n=e.hs,o=e.t,i=e.ln,c=e.sn,a=e.wa,u=e.ba,s=e.rt,l=e.fid,f=e.rid,p=e.c,y=e.tc,h=e.a,b=h.n,v=h.u,d=h.tz,m=e.f,g=m.n,O=m.u,j=m.tz,w=e.tt,P=w.n,S=w.p,k=w.t,T=e.sts,C=Fr(P),R=Fr(S),D=p&&"#".concat(p),_=y&&"#".concat(y),E=[],x=0;x<(T||[]).length;x+=1){var I=T[x],M=I.sid,A=I.n,L=I.p,V=I.at,U=I.dt,F=I.ap,q=I.dp,N=I.ad,z=I.dd,B=I.dot,K=I.put,G=I.c,Z=I.wa;E.push({stationId:M,stationName:A,coordinates:L,arrivalTime:-1!==V?1e3*F:null,departureTime:-1!==U?1e3*q:null,arrivalDelay:N,departureDelay:z,noDropOff:!!B,noPickUp:!!K,cancelled:!!G,wheelchairAccessible:!!Z})}return{id:r,destination:n,backgroundColor:D,color:_,vehicleType:o,routeIdentifier:f,longName:i,shortName:c,stations:E,wheelchairAccessible:!!a,bicyclesAllowed:!!u,realTime:s,feedsId:l,operatingInformations:{operatingPeriod:k,notOperatingDays:C,additionalOperatingDays:R},operator:b,operatorUrl:v,operatorTimeZone:d,publisher:g,publisherUrl:O,publisherTimeZone:j}},Nr=function(){for(var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=[],r=0;r<t.length;r+=1){var n=t[r],o=new pr.LineString(n.geometry.coordinates),i=n.properties,c=i.ID,a=i.ProductIdentifier,u=i.PublishedLineName,s=i.RouteIdentifier,l=i.DirectionText,f=i.Operator,p=i.OperatorURL,y=i.Publisher,h=i.PublisherURL,b=i.License,v=i.LicenseUrl,d=i.LicenseNote,m=i.Color,g=i.JourneyIdentifier,O=i.RealtimeAvailable,j=i.OperatorProvidesRealtime,w=i.DayOfOperation,P=i.Delay,S=i.TimeIntervals,k=i.TextColor,T=i.Cancelled;e.push({id:c,type:a,name:u,routeIdentifier:s,directionText:l,operator:f,operatorUrl:p,publisher:y,publisherUrl:h,license:b,licenseUrl:v,licenseNote:d,journeyIdentifier:g,realtimeAvailable:O,operatorProvidesRealtime:j,dayOfOperation:w,delay:P,timeIntervals:S,color:m&&"#".concat(m),textColor:k&&"#".concat(k),geometry:o,cancelled:T})}return e};function zr(t){return(zr="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function Br(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function Kr(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?Br(Object(r),!0).forEach((function(e){Gr(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Br(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function Gr(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Zr(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Hr(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function Wr(t,e){return(Wr=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function $r(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=Qr(t);if(e){var o=Qr(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return Jr(this,r)}}function Jr(t,e){return!e||"object"!==zr(e)&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}function Qr(t){return(Qr=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var Yr=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&Wr(t,e)}(i,t);var e,r,n,o=$r(i);function i(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return Zr(this,i),o.call(this,Kr({url:"https://api.geops.io/tracker/v1"},t))}return e=i,(r=[{key:"fetchTrajectoryById",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this.fetch("/trajectorybyid",t,{signal:e.signal})}},{key:"fetchTrajectories",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this.fetch("/trajectory_collection",t,{signal:e.signal}).then((function(t){return Nr(t.features)}))}},{key:"fetchTrajectoryStations",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this.fetch("/trajstations",t,{signal:e.signal}).then((function(t){return qr(t)}))}}])&&Hr(e.prototype,r),n&&Hr(e,n),i}(kr);function Xr(t){return function(t){if(Array.isArray(t))return tn(t)}(t)||function(t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(t))return Array.from(t)}(t)||function(t,e){if(!t)return;if("string"==typeof t)return tn(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return tn(t,e)}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function tn(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function en(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}var rn=function(){function t(e){var r=this;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.subscriptions=[],this.connect(e),setInterval((function(){r.send("PING")}),1e4),this.subscribed={}}var e,r,n;return e=t,n=[{key:"getRequestString",value:function(t,e){var r="".concat(t," ").concat(e.channel);return r+=e.args?" ".concat(e.args):"",(r+=e.id?" ".concat(e.id):"").trim()}}],(r=[{key:"connect",value:function(t){var e=this;this.websocket&&this.websocket.readyState!==this.websocket.CLOSED&&this.websocket.close(),this.websocket=new WebSocket(t),this.currentProj&&this.setProjection(this.currentProj),this.currentBbox&&this.setBbox(this.currentBbox),Xr(this.subscriptions).forEach((function(t){e.subscribe(t.params,t.cb,t.errorCb,!0)})),this.websocket.onclose=function(){window.clearTimeout(e.reconnectTimeout),e.reconnectTimeout=window.setTimeout((function(){return e.connect(t)}),100)}}},{key:"get",value:function(e,r,n){var o=t.getRequestString("GET",e);this.send(o),this.listen(e,r,n)}},{key:"send",value:function(t){var e=this,r=function(){e.websocket.send(t)};this.websocket.readyState===WebSocket.CONNECTING?this.websocket.addEventListener("open",r):r()}},{key:"setProjection",value:function(t){this.currentProj=t,this.send("PROJECTION ".concat(t))}},{key:"setBbox",value:function(t){var e=this;this.currentBbox=t,this.send("BBOX ".concat(t.join(" "))),this.subscriptions.forEach((function(t){e.get(t.params,t.cb,t.errorCb)}))}},{key:"listen",value:function(t,e,r){var n=function(r){var n=JSON.parse(r.data),o=t.channel;o+=t.args?" ".concat(t.args):"",n.source!==o||t.id&&t.id!==n.client_reference||e(n)};return this.websocket.addEventListener("message",n),r&&(this.websocket.addEventListener("error",r),this.websocket.addEventListener("close",r)),{onMessageCb:n,onErrorCb:r}}},{key:"subscribe",value:function(e,r,n,o){var i=this.listen(e,r,n),c=i.onMessageCb,a=i.onErrorCb,u=t.getRequestString("",e);o||this.subscriptions.push({params:e,cb:r,errorCb:n,onMessageCb:c,onErrorCb:a}),this.subscribed[u]||(this.send("GET ".concat(u)),this.send("SUB ".concat(u)),this.subscribed[u]=!0)}},{key:"unsubscribe",value:function(t,e){var r=this;this.subscriptions.filter((function(r){return r.params.channel===t&&(!e||r.cb===e)})).forEach((function(t){var e=t.onMessageCb,n=t.onErrorCb;r.websocket.removeEventListener("message",e),n&&(r.websocket.removeEventListener("error",n),r.websocket.removeEventListener("close",n))})),this.subscriptions=this.subscriptions.filter((function(r){return r.params.channel!==t||e&&r.cb!==e})),t&&this.subscribed[t]&&!this.subscriptions.find((function(e){return e.params.channel===t}))&&(this.send("DEL ".concat(t)),this.subscribed[t]=!1)}}])&&en(e.prototype,r),n&&en(e,n),t}(),nn=function(t,e){return t===e.SCHEMATIC?"_schematic":""},on=function(t,e){var r=arguments.length>2&&void 0!==arguments[2]&&arguments[2],n=["HIDDEN","LEAVING","BOARDING"],o=t.has_fzo&&n.indexOf(t.state)>-1,i=e.has_fzo&&n.indexOf(e.state)>-1;if(o||i){if(o!==i)return o?-1:1;if(t.state!==e.state)return n.indexOf(t.state)-n.indexOf(e.state)}var c=null,a=null,u=Date.now();return r?(c=new Date(t.min_arrival_time||t.time).getTime()-u,a=new Date(e.min_arrival_time||e.time).getTime()-u):(c=new Date(t.time).getTime()-u,a=new Date(e.time).getTime()-u),c-a},cn=function(t){if(t)return t.stations.forEach((function(t){t.arrivalTimeWithDelay=t.arrivalTime,t.departureTime&&(t.departureTimeWithDelay=t.departureTime),t.arrivalDelay&&(t.arrivalTime-=t.arrivalDelay,t.departureTime&&(t.departureTime-=t.arrivalDelay))})),t};function an(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function un(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}var sn={RAW:"raw",TOPOGRAPHIC:"topographic",SCHEMATIC:"schematic"},ln=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};an(this,t);var r=null;r="string"==typeof e?e:e.url,e.apiKey&&(r="".concat(r,"?key=").concat(e.apiKey)),this.subscribedStationUic=null,this.departureUpdateTimeout=null,this.maxDepartureAge=30,this.extraGeoms={},this.prefix=e.prefix||"",this.conn=new rn(r),this.conn.setProjection(e.projection||"epsg:3857"),e.bbox&&this.conn.setBbox(e.bbox)}var e,r,n;return e=t,(r=[{key:"subscribe",value:function(t,e,r){var n=arguments.length>3&&void 0!==arguments[3]&&arguments[3];this.conn.subscribe({channel:t},e,r,n)}},{key:"unsubscribe",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",r=arguments.length>2?arguments[2]:void 0;this.conn.unsubscribe("".concat(t).concat(nn(sn.SCHEMATIC,sn)).concat(e),r),this.conn.unsubscribe("".concat(t).concat(nn(sn.TOPOGRAPHIC,sn)).concat(e),r)}},{key:"filterDepartures",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=Object.keys(t).map((function(e){return t[e]}));r.sort((function(t,r){return on(t,r,e)}));var n=new Date;n.setMinutes(n.getMinutes()+this.maxDepartureAge),n=n.getTime();var o=new Date;o.setMinutes(o.getMinutes()-this.maxDepartureAge),o=o.getTime();for(var i=[],c=[],a=null,u=r.length-1;u>=0;u-=1){var s=r[u],l=new Date(s.time).getTime();l>o&&l<n&&("BOARDING"===s.state&&(-1===c.indexOf(s.platform)?c.push(s.platform):s.state="HIDDEN"),a&&s.to[0]===a.to[0]&&Math.abs(l-a.time)<1e3&&s.line.name===a.line.name&&(s.state="HIDDEN"),/(STOP_CANCELLED|JOURNEY_CANCELLED)/.test(s.state)&&(s.cancelled=!0),(a=s).time=l,i.unshift(s))}return i}},{key:"subscribeDepartures",value:function(t){var e=this,r=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=arguments.length>2?arguments[2]:void 0;window.clearTimeout(this.departureUpdateTimeout),this.unsubscribeDepartures(),this.subscribedStationUic=t;var o=t?"timetable_".concat(t):null,i={};this.subscribe(o,(function(t){if(t.source===o){var c=t.content||{},a=new Date(c.timestamp).getTime()-Date.now();c.timediff=a,i[c.call_id]=c,window.clearTimeout(e.departureUpdateTimeout),e.departureUpdateTimeout=window.setTimeout((function(){var t=e.filterDepartures(i,r);n(t)}),100)}}),(function(){n([])}))}},{key:"unsubscribeDepartures",value:function(t){this.subscribedStationUic&&(this.unsubscribe("timetable_".concat(this.subscribedStationUic),"",t),this.subscribedStationUic=null)}},{key:"subscribeDisruptions",value:function(t){this.subscribe("".concat(this.prefix,"newsticker"),(function(e){t(e.content)}))}},{key:"unsubscribeDisruptions",value:function(t){this.unsubscribe("".concat(this.prefix,"newsticker"),"",t)}},{key:"getStation",value:function(t,e){var r=this,n={channel:"station".concat(nn(e,sn)),args:t};return new Promise((function(t,e){r.conn.get(n,(function(r){r.content?t(r.content):e()}))}))}},{key:"getStations",value:function(t,e){var r=this,n=[];e&&this.conn.setBbox(e);var o={channel:"station".concat(nn(t,sn))};return window.clearTimeout(this.stationUpdateTimeout),new Promise((function(t,e){r.conn.get(o,(function(o){o.content?(n.push(o.content),window.clearTimeout(r.stationUpdateTimeout),r.stationUpdateTimeout=window.setTimeout((function(){t(n)}),50)):e(o.content)}))}))}},{key:"subscribeStations",value:function(t,e,r){this.unsubscribeStations(),e&&this.conn.setBbox(e),this.subscribe("station".concat(nn(t,sn)),(function(t){t.content&&r(t.content)}))}},{key:"unsubscribeStations",value:function(t){window.clearTimeout(this.stationUpdateTimeout),this.unsubscribe("station","",t)}},{key:"subscribeExtraGeoms",value:function(t){var e=this;this.subscribe("extra_geoms",(function(r){var n=r.content;if(n){var o=n.properties.ref;"Feature"===n.type?e.extraGeoms[o]=n:delete e.extraGeoms[o],t(Object.keys(e.extraGeoms).map((function(t){return e.extraGeoms[t]})))}}))}},{key:"unsubscribeExtraGeoms",value:function(t){this.unsubscribe("extra_geoms","",t)}},{key:"subscribeTrajectory",value:function(t,e){this.unsubscribeTrajectory(e),this.subscribe("trajectory".concat(nn(t,sn)),e)}},{key:"unsubscribeTrajectory",value:function(t){this.unsubscribe("trajectory","",t)}},{key:"subscribeDeletedVehicles",value:function(t,e){this.unsubscribeDeletedVehicles(),this.subscribe("deleted_vehicles".concat(nn(t,sn)),e)}},{key:"unsubscribeDeletedVehicles",value:function(t){this.unsubscribe("deleted_vehicles","",t)}},{key:"getFullTrajectory",value:function(t,e){var r=this,n={channel:"full_trajectory".concat(nn(e,sn),"_").concat(t)};return new Promise((function(t){r.conn.get(n,(function(e){e.content&&t(e.content)}))}))}},{key:"getFullTrajectories",value:function(t,e){var r=this,n=t.map((function(t){return r.getFullTrajectory(t,e)}));return Promise.all(n)}},{key:"subscribeFullTrajectory",value:function(t,e){this.unsubscribeFullTrajectory(t),this.subscribe("full_trajectory".concat(nn(e,sn),"_").concat(t),(function(t){console.log("subscribe full_trajectory",t)}),(function(t){console.log("subscribe full_trajectory error",t)}))}},{key:"unsubscribeFullTrajectory",value:function(t,e){this.unsubscribe("full_trajectory","_".concat(t),e)}},{key:"getStopSequence",value:function(t){var e=this,r={channel:"stopsequence_".concat(t)};return new Promise((function(t,n){e.conn.get(r,(function(e){t(cn(e.content&&e.content[0]))}),(function(t){n(t)}))}))}},{key:"getStopSequences",value:function(t){var e=this,r=t.map((function(t){return e.getStopSequence(t)}));return Promise.all(r)}},{key:"subscribeStopSequence",value:function(t,e){window.clearTimeout(this.fullTrajectoryUpdateTimeout),this.unsubscribeStopSequence(t),this.subscribe("stopsequence_".concat(t),(function(t){e(cn(t.content&&t.content[0]))}),(function(t){console.log("subscribe stopsequence error",t)}))}},{key:"unsubscribeStopSequence",value:function(t,e){this.unsubscribe("stopsequence","_".concat(t),e)}},{key:"subscribeHealthCheck",value:function(t){this.unsubscribeHealthCheck(),this.subscribe("healthcheck",t)}},{key:"unsubscribeHealthCheck",value:function(){this.unsubscribe("healthcheck")}}])&&un(e.prototype,r),n&&un(e,n),t}();function fn(t){return(fn="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function pn(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function yn(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?pn(Object(r),!0).forEach((function(e){hn(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):pn(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function hn(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function bn(t,e,r){return(bn="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(t,e,r){var n=function(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=gn(t)););return t}(t,e);if(n){var o=Object.getOwnPropertyDescriptor(n,e);return o.get?o.get.call(r):o.value}})(t,e,r||t)}function vn(t,e){return(vn=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function dn(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=gn(t);if(e){var o=gn(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return mn(this,r)}}function mn(t,e){return!e||"object"!==fn(e)&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}function gn(t){return(gn=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function On(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function jn(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function wn(t,e,r){return e&&jn(t.prototype,e),r&&jn(t,r),t}var Pn=function(t){return function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&vn(t,e)}(r,t);var e=dn(r);function r(){return On(this,r),e.apply(this,arguments)}return wn(r,[{key:"defineProperties",value:function(t){var e=this;bn(gn(r.prototype),"defineProperties",this).call(this,t);var n,o=t.regexPublishedLineName,i=t.publishedLineName,c=t.tripNumber,a=t.operator,u=3;if(!t.api){var s={};t.url&&(s.url=t.url),t.apiKey&&(s.apiKey=t.apiKey),n=new Yr(s)}Object.defineProperties(this,{showVehicleTraj:{value:void 0===t.showVehicleTraj||t.showVehicleTraj,writable:!0},delayDisplay:{value:t.delayDisplay||3e5,writable:!0},delayOutlineColor:{value:t.delayOutlineColor||"#000000",writable:!0},useDelayStyle:{value:t.useDelayStyle||!1,writable:!0},requestIntervalSeconds:{get:function(){return u},set:function(t){t!==u&&(u=t,e.visible&&e.start())}},publishedLineName:{get:function(){return i},set:function(t){i=t,e.updateFilters()}},tripNumber:{get:function(){return c},set:function(t){c=t,e.updateFilters()}},operator:{get:function(){return a},set:function(t){a=t,e.updateFilters()}},regexPublishedLineName:{get:function(){return o},set:function(t){o=t,e.updateFilters()}},api:{value:t.api||n}})}},{key:"init",value:function(t){bn(gn(r.prototype),"init",this).call(this,t),this.sortFc?this.sort=this.sortFc:this.useDelayStyle&&(this.sort=function(t,e){return null===t.delay||t.delay<e.delay?1:-1})}},{key:"start",value:function(){this.updateFilters(),bn(gn(r.prototype),"start",this).call(this),this.startUpdateTrajectories()}},{key:"stop",value:function(){this.journeyId=null,this.stopUpdateTrajectories(),this.abortFetchTrajectories(),bn(gn(r.prototype),"stop",this).call(this)}},{key:"updateFilters",value:function(){var t=$t.a.parse(window.location.search.toLowerCase());this.filter=function(t,e,r,n){var o=[];if(!(t||e||r||n))return null;if(n){var i="string"==typeof n?[n]:n;o.push((function(t){return i.some((function(e){return new RegExp(e,"i").test(t.name)}))}))}if(t){var c=("string"==typeof t?t.split(","):t).map((function(t){return t.replace(/\s+/g,"").toUpperCase()}));o.push((function(t){return c.some((function(e){return e===t.name.toUpperCase()}))}))}if(e){var a=("string"==typeof e?e.split(","):e).map((function(t){return parseInt(t,10)}));o.push((function(t){var e=parseInt(t.routeIdentifier.split(".")[0],10);return a.some((function(t){return t===e}))}))}if(r){var u="string"==typeof r?[r]:r;o.push((function(t){return u.some((function(e){return new RegExp(e,"i").test(t.operator)}))}))}return o.length?function(t){for(var e=0;e<o.length;e+=1)if(!o[e](t))return!1;return!0}:null}(this.publishedLineName||t.publishedlinename,this.tripNumber||t.tripnumber,this.operator||t.operator,this.regexPublishedLineName)}},{key:"abortFetchTrajectories",value:function(){this.abortController&&this.abortController.abort()}},{key:"updateTrajectoryStations",value:function(t){var e=this.getParams({id:t,time:hr(new Date)});return this.api.fetchTrajectoryStations(e)}},{key:"getParams",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=1e3*(this.requestIntervalSeconds+5),r=this.speed*e,n=this.currTime,o=!0;if(this.later&&n.getTime()>this.later.getTime()-1e3*this.requestIntervalSeconds&&(o=!1),!this.later||!o||this.later.getTime()-n.getTime()>r){var i=new Date(n.getTime()+r);this.later=i}var c=yn(yn({},t),{},{btime:hr(n),etime:hr(this.later),date:yr(n),rid:1,a:1,cd:1,nm:1,fl:1});return c}},{key:"startUpdateTrajectories",value:function(){var t=this;this.stopUpdateTrajectories(),this.updateTrajectories(),this.updateInterval=window.setInterval((function(){t.updateTrajectories()}),1e3*this.requestIntervalSeconds)}},{key:"stopUpdateTrajectories",value:function(){clearInterval(this.updateInterval)}},{key:"updateTrajectories",value:function(){var t=this;this.abortFetchTrajectories(),this.abortController=new AbortController,this.api.fetchTrajectories(this.getParams({attr_det:1}),this.abortController).catch((function(t){if("AbortError"!==t.name)throw t})).then((function(e){e&&(t.tracker.setTrajectories(e),t.renderTrajectories())}))}},{key:"defaultStyle",value:function(t,e){var r=t.type,n=t.name,o=t.id,i=t.color,c=t.textColor,a=t.delay,u=t.cancelled,s=t.operatorProvidesRealtime,l=Math.min(Math.floor(e||1),16),f=this.hoverVehicleId===o,p=this.selectedVehicleId===o,y="".concat(l).concat(r).concat(n).concat(s).concat(a).concat(f).concat(p).concat(u);if(!this.styleCache[y]){var h=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1?arguments[1]:void 0;try{var r=Ie(t);return Re[r][e]}catch(t){return 1}}(r,l),b=h>=7;if(0===h)return this.styleCache[y]=null,null;(f||p)&&(h=b?h+5:14);var v=h+2,d=2*h,m=document.createElement("canvas");m.width=2*v+2+100,m.height=2*v+2+100;var g,O=m.getContext("2d"),j=m.width/2;if(b&&null!==a&&(O.save(),O.beginPath(),O.arc(j,j,v,0,2*Math.PI,!1),O.fillStyle=Ae(a,u),O.filter="blur(1px)",O.fill(),O.restore()),b&&(f||a>=this.delayDisplay||u)){O.save(),O.textAlign="left",O.textBaseline="middle",O.font="bold ".concat(Math.max(u?19:14,Math.min(u?19:17,1.2*h)),"px arial, sans-serif"),O.fillStyle=Ae(a,u,!0),O.strokeStyle=this.delayOutlineColor,O.lineWidth=1.5;var w=function(t,e){if(e)return String.fromCodePoint(215);if(t>36e5){var r=Math.round(t/36e5);return"+".concat(r,"h")}if(t>59e3){var n=Math.round(t/6e4);return"+".concat(n,"m")}return t>0?"+".concat(t,"s"):""}(a,u);O.strokeText(w,j+v+1,j),O.fillText(w,j+v+1,j),O.restore()}if(g=this.useDelayStyle?Ae(a,u):i||Me(r),O.save(),(b||f||p)&&(O.lineWidth=1,O.strokeStyle="#000000"),O.fillStyle=g,O.beginPath(),O.arc(j,j,h,0,2*Math.PI,!1),O.fill(),b&&this.useDelayStyle&&null===a&&"yes"===s&&O.setLineDash([5,3]),(b||f||p)&&O.stroke(),O.restore(),h>10){var P=function(t,e,r,n){t.font="bold ".concat(n,"px Arial");for(var o=t.measureText(r),i=0;o.width>e-6&&i<25;)n-=.5,t.font="bold ".concat(n,"px arial, sans-serif"),o=t.measureText(r),i+=1;return n}(O,d,n,Math.max(h,10));this.useDelayStyle&&null===a&&"yes"===s&&(O.save(),O.textBaseline="middle",O.textAlign="center",O.font="bold ".concat(P+2,"px Arial"),O.strokeStyle=g,O.strokeText(n,j,j),O.restore()),O.save(),O.textBaseline="middle",O.textAlign="center",O.fillStyle=this.useDelayStyle?"#000000":c||function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;try{var e=Ie(t);return Ee[e]}catch(t){return 1}}(r),O.font="bold ".concat(P,"px Arial"),O.strokeStyle=g,O.strokeText(n,j,j),O.fillText(n,j,j),O.restore()}this.styleCache[y]=m}return this.styleCache[y]}}]),r}(t)};function Sn(t){return(Sn="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function kn(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(t)))return;var r=[],n=!0,o=!1,i=void 0;try{for(var c,a=t[Symbol.iterator]();!(n=(c=a.next()).done)&&(r.push(c.value),!e||r.length!==e);n=!0);}catch(t){o=!0,i=t}finally{try{n||null==a.return||a.return()}finally{if(o)throw i}}return r}(t,e)||Cn(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Tn(t){return function(t){if(Array.isArray(t))return Rn(t)}(t)||function(t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(t))return Array.from(t)}(t)||Cn(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Cn(t,e){if(t){if("string"==typeof t)return Rn(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?Rn(t,e):void 0}}function Rn(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function Dn(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function _n(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?Dn(Object(r),!0).forEach((function(e){En(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Dn(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function En(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function xn(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function In(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function Mn(t,e,r){return(Mn="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(t,e,r){var n=function(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=Un(t)););return t}(t,e);if(n){var o=Object.getOwnPropertyDescriptor(n,e);return o.get?o.get.call(r):o.value}})(t,e,r||t)}function An(t,e){return(An=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function Ln(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=Un(t);if(e){var o=Un(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return Vn(this,r)}}function Vn(t,e){return!e||"object"!==Sn(e)&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}function Un(t){return(Un=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var Fn=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&An(t,e)}(i,t);var e,r,n,o=Ln(i);function i(){var t,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return xn(this,i),(t=o.call(this,_n({},e))).vectorLayer=new me.Vector({source:new de.Vector({features:[]})}),t.olLayer.getLayers().insertAt(0,t.vectorLayer),t}return e=i,(r=[{key:"init",value:function(t){t&&(t.addLayer(this.vectorLayer),Mn(Un(i.prototype),"init",this).call(this,t))}},{key:"terminate",value:function(){this.map&&this.map.removeLayer(this.vectorLayer),Mn(Un(i.prototype),"terminate",this).call(this)}},{key:"start",value:function(){this.map&&(Mn(Un(i.prototype),"start",this).call(this),this.olEventsKeys=[].concat(Tn(this.olEventsKeys),[this.map.on("singleclick",this.onMapClick.bind(this)),this.map.on("moveend",this.onMoveEnd.bind(this))]))}},{key:"onMoveEnd",value:function(){this.updateTrajectories(),this.selectedVehicleId&&this.journeyId&&this.highlightTrajectory()}},{key:"onMapClick",value:function(t){var e=this;if(this.clickCallbacks.length){var r=kn(this.getVehiclesAtCoordinate(t.coordinate,1),1)[0],n=[];if(r){var o=r.coordinate?new pr.Point(r.coordinate):null;n.push(new fr.a(_n({geometry:o},r))),n.length&&(this.selectedVehicleId=n[0].get("id"),this.journeyId=n[0].get("journeyIdentifier"),this.updateTrajectoryStations(this.selectedVehicleId).then((function(n){e.clickCallbacks.forEach((function(o){return o(_n(_n({},r),n),e,t)}))})))}else this.selectedVehicleId=null,this.vectorLayer.getSource().clear(),this.clickCallbacks.forEach((function(r){return r(null,e,t)}))}}},{key:"drawFullTrajectory",value:function(t,e,r){var n=/#ffffff/i.test(r)?"#ff0000":r,o=this.vectorLayer.getSource();if(o.clear(),t){var i=new pr.MultiPoint(t),c=new fr.a(i);c.setStyle(new ve.Style({zIndex:1,image:new ve.Circle({radius:5,fill:new ve.Fill({color:"#000000"})})}));var a=new fr.a(i);a.setStyle(new ve.Style({zIndex:4,image:new ve.Circle({radius:4,fill:new ve.Fill({color:this.useDelayStyle?"#a0a0a0":n})})})),o.addFeatures([c,a])}var u=new fr.a({geometry:e});u.setStyle([new ve.Style({zIndex:2,stroke:new ve.Stroke({color:"#000000",width:6})}),new ve.Style({zIndex:3,stroke:new ve.Stroke({color:this.useDelayStyle?"#a0a0a0":n,width:4})})]),o.addFeature(u)}},{key:"updateTrajectoryStations",value:function(t){var e=this;return Mn(Un(i.prototype),"updateTrajectoryStations",this).call(this,t).then((function(t){return e.stationsCoords=[],t.stations.forEach((function(t){e.stationsCoords.push(Object(Nt.transform)(t.coordinates,"EPSG:4326","EPSG:3857"))})),e.highlightTrajectory(),t}))}},{key:"highlightTrajectory",value:function(){var t=this;this.api.fetchTrajectoryById(this.getParams({id:this.journeyId,time:hr(new Date)})).then((function(e){var r=e.p,n=e.t,o=e.c,i=[];r.forEach((function(t){t.forEach((function(t){i.push([t.x,t.y])}))})),t.drawFullTrajectory(t.stationsCoords,new pr.LineString(i),o?"#".concat(o):Me(n))})).catch((function(){t.vectorLayer.getSource().clear()}))}},{key:"getParams",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=this.map.getView().calculateExtent(),r=Object(ge.buffer)(e,Object(ge.getWidth)(e)/10).join(","),n=this.map.getView().getZoom();return Mn(Un(i.prototype),"getParams",this).call(this,_n(_n({},t),{},{bbox:r,s:n<10?1:0,z:n}))}},{key:"defaultStyle",value:function(t){var e=this.map.getView().getZoom();return Mn(Un(i.prototype),"defaultStyle",this).call(this,t,e)}},{key:"clone",value:function(t){return new i(_n(_n({},this.options),t))}}])&&In(e.prototype,r),n&&In(e,n),i}(Pn(sr)),qn=r(21),Nn=r.n(qn);function zn(t){return(zn="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function Bn(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function Kn(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?Bn(Object(r),!0).forEach((function(e){Gn(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Bn(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function Gn(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Zn(t,e,r){return(Zn="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(t,e,r){var n=function(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=Qn(t)););return t}(t,e);if(n){var o=Object.getOwnPropertyDescriptor(n,e);return o.get?o.get.call(r):o.value}})(t,e,r||t)}function Hn(t,e){return(Hn=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function Wn(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=Qn(t);if(e){var o=Qn(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return $n(this,r)}}function $n(t,e){return!e||"object"!==zn(e)&&"function"!=typeof e?Jn(t):e}function Jn(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function Qn(t){return(Qn=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function Yn(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Xn(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function to(t,e,r){return e&&Xn(t.prototype,e),r&&Xn(t,r),t}var eo=function(t){return function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&Hn(t,e)}(r,t);var e=Wn(r);function r(){var t,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return Yn(this,r),(t=e.call(this,Kn({},n))).debug=n.debug,t.mode=n.mode||sn.TOPOGRAPHIC,t.trajectories=[],t.refreshTimeInMs=1e3/30,t.onMessage=t.onMessage.bind(Jn(t)),t.onDeleteMessage=t.onDeleteMessage.bind(Jn(t)),t.api=n.api||new ln(n),t.format=new Ht.a,t.dfltIconScale=n.dfltIconScale||.6,t.dfltIconHighlightScale=n.dfltIconHighlightScale||.8,t.minIconScale=.75*t.dfltIconScale,t}return to(r,[{key:"init",value:function(t){Zn(Qn(r.prototype),"init",this).call(this,t),this.api.subscribeTrajectory(this.mode,this.onMessage),this.api.subscribeDeletedVehicles(this.mode,this.onDeleteMessage)}},{key:"terminate",value:function(){this.api.unsubscribeTrajectory(this.onMessage),this.api.unsubscribeDeletedVehicles(this.onDeleteMessage),Zn(Qn(r.prototype),"terminate",this).call(this)}},{key:"setMode",value:function(t){this.mode!==t&&(this.mode=t,this.api.subscribeTrajectory(this.mode,this.onMessage),this.api.subscribeDeletedVehicles(this.mode,this.onDeleteMessage))}},{key:"onMessage",value:function(t){if(t.content){var e=this.format.readFeature(t.content);if(e.set("timeOffset",Date.now()-t.timestamp),e.get("time_since_update")>=0){if(this.debug&&this.mode===sn.TOPOGRAPHIC&&e.get("raw_coordinates")){var r=new Nn.a(e.get("raw_coordinates"));r.transform("EPSG:4326",this.map.getView().getProjection()),e.setGeometry(r)}this.addTrajectory(e.get("train_id"),e.getProperties(),!e.get("line"))}}}},{key:"onDeleteMessage",value:function(t){t.content&&this.removeTrajectoryByAttribute("train_id",t.content)}},{key:"addTrajectory",value:function(t,e,r){var n=this.trajectories.findIndex((function(e){return e.train_id===t})),o=e.time_intervals,i=Kn(Kn({},e),{},{id:t,timeIntervals:o});r?(this.trajectories.unshift(i),-1!==n&&this.tracker.trajectories.splice(n+1,1)):(this.trajectories.push(i),-1!==n&&this.tracker.trajectories.splice(n,1)),this.updateTrajectories()}},{key:"removeTrajectory",value:function(t){for(var e=0,r=this.trajectories.length;e<r;e+=1)if(this.trajectories[e].id===t){this.trajectories.splice(e,1);break}}},{key:"removeTrajectoryByAttribute",value:function(t,e){for(var r=0,n=this.trajectories.length;r<n;r+=1)if(this.trajectories[r][t]===e){this.removeTrajectory(this.trajectories[r].id);break}}},{key:"updateTrajectories",value:function(){this.tracker.setTrajectories(this.trajectories),this.renderTrajectories()}},{key:"getRefreshTimeInMs",value:function(){return this.refreshTimeInMs}}]),r}(t)};function ro(t){return(ro="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function no(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function oo(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?no(Object(r),!0).forEach((function(e){io(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):no(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function io(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function co(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function ao(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function uo(t,e){return(uo=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function so(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=fo(t);if(e){var o=fo(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return lo(this,r)}}function lo(t,e){return!e||"object"!==ro(e)&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}function fo(t){return(fo=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var po=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&uo(t,e)}(i,t);var e,r,n,o=so(i);function i(){return co(this,i),o.apply(this,arguments)}return e=i,(r=[{key:"clone",value:function(t){return new i(oo(oo({},this.options),t))}}])&&ao(e.prototype,r),n&&ao(e,n),i}(eo(sr));function yo(t){return(yo="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function ho(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function bo(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?ho(Object(r),!0).forEach((function(e){vo(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):ho(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function vo(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function mo(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function go(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function Oo(t,e,r){return(Oo="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(t,e,r){var n=function(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=So(t)););return t}(t,e);if(n){var o=Object.getOwnPropertyDescriptor(n,e);return o.get?o.get.call(r):o.value}})(t,e,r||t)}function jo(t,e){return(jo=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function wo(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=So(t);if(e){var o=So(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return Po(this,r)}}function Po(t,e){return!e||"object"!==yo(e)&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}function So(t){return(So=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var ko=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&jo(t,e)}(i,t);var e,r,n,o=wo(i);function i(){var t,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return mo(this,i),(t=o.call(this,e)).hitTolerance=e.hitTolerance||5,t}return e=i,(r=[{key:"getFeatureInfoAtCoordinate",value:function(t){var e=this,r=[];if(this.map){var n=this.map.getPixelFromCoordinate(t);r=this.map.getFeaturesAtPixel(n,{layerFilter:function(t){return t===e.olLayer},hitTolerance:this.hitTolerance})}return Promise.resolve({features:r,layer:this,coordinate:t})}},{key:"init",value:function(t){var e=this;Oo(So(i.prototype),"init",this).call(this,t),this.map&&(this.singleClickRef=this.map.on("singleclick",(function(t){e.clickCallbacks.length&&e.getFeatureInfoAtCoordinate(t.coordinate).then((function(t){return e.callClickCallbacks(t.features,t.layer,t.coordinate)})).catch((function(){return e.callClickCallbacks([],e,t.coordinate)}))})))}},{key:"callClickCallbacks",value:function(t,e,r){this.clickCallbacks.forEach((function(n){return n(t,e,r)}))}},{key:"terminate",value:function(){Oo(So(i.prototype),"terminate",this).call(this),this.singleClickRef&&Object(c.unByKey)(this.singleClickRef)}},{key:"clone",value:function(t){return new i(bo(bo({},this.options),t))}}])&&go(e.prototype,r),n&&go(e,n),i}(E);function To(t){return(To="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function Co(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function Ro(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?Co(Object(r),!0).forEach((function(e){Do(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Co(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function Do(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function _o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Eo(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function xo(t,e,r){return(xo="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(t,e,r){var n=function(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=Lo(t)););return t}(t,e);if(n){var o=Object.getOwnPropertyDescriptor(n,e);return o.get?o.get.call(r):o.value}})(t,e,r||t)}function Io(t,e){return(Io=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function Mo(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=Lo(t);if(e){var o=Lo(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return Ao(this,r)}}function Ao(t,e){return!e||"object"!==To(e)&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}function Lo(t){return(Lo=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var Vo=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&Io(t,e)}(i,t);var e,r,n,o=Mo(i);function i(){var t,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return _o(this,i),(t=o.call(this,e)).abortController=new AbortController,t.format=new Ht.a,t}return e=i,(r=[{key:"getFeatureInfoUrl",value:function(t){var e=this.map.getView().getProjection(),r=this.map.getView().getResolution();return!!this.olLayer.getSource().getFeatureInfoUrl&&this.olLayer.getSource().getFeatureInfoUrl(t,r,e,{info_format:"application/json",query_layers:this.olLayer.getSource().getParams().layers})}},{key:"getFeatureInfoAtCoordinate",value:function(t){var e=this;this.abortController.abort(),this.abortController=new AbortController;var r=this.abortController.signal;return fetch(this.getFeatureInfoUrl(t),{signal:r}).then((function(t){return t.json()})).then((function(t){return t.features})).then((function(r){return{layer:e,coordinate:t,features:r.map((function(t){return e.format.readFeature(t)}))}})).catch((function(){return Promise.resolve({features:[],coordinate:t,layer:e})}))}},{key:"init",value:function(t){var e=this;xo(Lo(i.prototype),"init",this).call(this,t),this.map&&(this.singleClickRef=this.map.on("singleclick",(function(t){e.clickCallbacks.length&&e.getFeatureInfoAtCoordinate(t.coordinate).then((function(t){return e.callClickCallbacks(t.features,t.layer,t.coordinate)}))})))}},{key:"callClickCallbacks",value:function(t,e,r){this.clickCallbacks.forEach((function(n){return n(t,e,r)}))}},{key:"terminate",value:function(){xo(Lo(i.prototype),"terminate",this).call(this),this.singleClickRef&&Object(c.unByKey)(this.singleClickRef)}},{key:"clone",value:function(t){return new i(Ro(Ro({},this.options),t))}}])&&Eo(e.prototype,r),n&&Eo(e,n),i}(E);r(14),r(22),r(23),r(16);function Uo(t){return("function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function Fo(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),r.push.apply(r,n)}return r}function qo(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?Fo(Object(r),!0).forEach((function(e){No(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Fo(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function No(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function zo(t,e){return(Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function Bo(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=Go(t);if(e){var o=Go(this).constructor;Reflect.construct(n,arguments,o)}else n.apply(this,arguments);return Ko(this,r)}}function Ko(t,e){return!e||"object"!==Uo(e)&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}function Go(t){return(Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function Zo(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Ho(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function Wo(t,e,r){return e&&Ho(t.prototype,e),r&&Ho(t,r),t}function $o(t){return("function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function Jo(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Qo(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function Yo(t,e){return(Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function Xo(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=ei(t);if(e){var o=ei(this).constructor;Reflect.construct(n,arguments,o)}else n.apply(this,arguments);return ti(this,r)}}function ti(t,e){return!e||"object"!==$o(e)&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}function ei(t){return(Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}ri=K;var ri;function ni(t){return(ni="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function oi(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function ii(t,e,r){return(ii="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(t,e,r){var n=function(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=li(t)););return t}(t,e);if(n){var o=Object.getOwnPropertyDescriptor(n,e);return o.get?o.get.call(r):o.value}})(t,e,r||t)}function ci(t,e){return(ci=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function ai(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=li(t);if(e){var o=li(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return ui(this,r)}}function ui(t,e){return!e||"object"!==ni(e)&&"function"!=typeof e?si(t):e}function si(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function li(t){return(li=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var fi=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&ci(t,e)}(i,t);var e,r,n,o=ai(i);function i(t){var e;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,i),(e=o.call(this,t)).render=e.render.bind(si(e)),e}return e=i,(r=[{key:"activate",value:function(){ii(li(i.prototype),"activate",this).call(this),this.map&&(this.map.on("sourcedata",this.render),this.map.on("styledata",this.render),this.map.on("idle",this.render))}},{key:"deactivate",value:function(){this.map&&(this.map.off("sourcedata",this.render),this.map.off("styledata",this.render),this.map.off("idle",this.render)),ii(li(i.prototype),"deactivate",this).call(this)}},{key:"getCopyrights",value:function(){return te(this.map)}}])&&oi(e.prototype,r),n&&oi(e,n),i}(ht(K));function pi(t){return("function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function yi(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),r.push.apply(r,n)}return r}function hi(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?yi(Object(r),!0).forEach((function(e){bi(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):yi(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function bi(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function vi(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function di(t,e,r){return("undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(t,e,r){var n=function(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==ji(t););return t}(t,e);if(n){var o=Object.getOwnPropertyDescriptor(n,e);return o.get?o.get.call(r):o.value}})(t,e,r||t)}function mi(t,e){return(Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function gi(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=ji(t);if(e){var o=ji(this).constructor;Reflect.construct(n,arguments,o)}else n.apply(this,arguments);return Oi(this,r)}}function Oi(t,e){return!e||"object"!==pi(e)&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}function ji(t){return(Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}nt(zt.Map);function wi(t){return function(t){if(Array.isArray(t))return Pi(t)}(t)||function(t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(t))return Array.from(t)}(t)||function(t,e){if(!t)return;if("string"==typeof t)return Pi(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Pi(t,e)}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Pi(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}var Si=function(t){var e=t.getBounds().toArray(),r=[].concat(wi(Object(Nt.fromLonLat)(e[0])),wi(Object(Nt.fromLonLat)(e[1]))),n=t.getCanvas(),o=n.width,i=n.height,c=Object(ge.getWidth)(r)/o,a=Object(ge.getHeight)(r)/i;return Math.max(c,a)},ki=function(t){var e=t.getBounds().toArray();return[[e[0][0],e[1][1]],wi(e[1]),[e[1][0],e[0][1]],wi(e[0])]};function Ti(t){return(Ti="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function Ci(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(t)))return;var r=[],n=!0,o=!1,i=void 0;try{for(var c,a=t[Symbol.iterator]();!(n=(c=a.next()).done)&&(r.push(c.value),!e||r.length!==e);n=!0);}catch(t){o=!0,i=t}finally{try{n||null==a.return||a.return()}finally{if(o)throw i}}return r}(t,e)||function(t,e){if(!t)return;if("string"==typeof t)return Ri(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Ri(t,e)}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Ri(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function Di(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function _i(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?Di(Object(r),!0).forEach((function(e){Ei(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Di(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function Ei(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function xi(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Ii(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function Mi(t,e,r){return(Mi="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(t,e,r){var n=function(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=Fi(t)););return t}(t,e);if(n){var o=Object.getOwnPropertyDescriptor(n,e);return o.get?o.get.call(r):o.value}})(t,e,r||t)}function Ai(t,e){return(Ai=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function Li(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=Fi(t);if(e){var o=Fi(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return Vi(this,r)}}function Vi(t,e){return!e||"object"!==Ti(e)&&"function"!=typeof e?Ui(t):e}function Ui(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function Fi(t){return(Fi=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var qi=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&Ai(t,e)}(i,t);var e,r,n,o=Li(i);function i(){var t,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return xi(this,i),(t=o.call(this,_i({},e))).onMapZoomEnd=t.onMapZoomEnd.bind(Ui(t)),t.onMapMouseMove=t.onMapMouseMove.bind(Ui(t)),t}return e=i,(r=[{key:"updateIconScale",value:function(t){this.tracker.setIconScale(t.width/t.clientWidth)}},{key:"init",value:function(t){var e=this;if(t){var r=t.getCanvas(),n=r.width/r.clientWidth;t.on("resize",this.updateIconScale.bind(this,r)),Mi(Fi(i.prototype),"init",this).call(this,t,{width:r.width,height:r.height,iconScale:n,getPixelFromCoordinate:function(t){var r=window.devicePixelRatio||1,n=Ci(Object(Nt.toLonLat)(t),2),o=n[0],i=n[1],c=e.map.project({lng:o,lat:i});return[c.x*r,c.y*r]}})}}},{key:"terminate",value:function(){return this.map&&this.map.off("resize",this.updateIconScale),Mi(Fi(i.prototype),"terminate",this).call(this)}},{key:"setCurrTime",value:function(t){var e=this.map.getCanvas();Mi(Fi(i.prototype),"setCurrTime",this).call(this,t,[e.width,e.height],Si(this.map),!this.map.isMoving()&&!this.map.isRotating()&&!this.map.isZooming())}},{key:"start",value:function(){var t=this.map.getCanvas();Mi(Fi(i.prototype),"start",this).call(this,[t.width,t.height],this.map.getZoom(),Si(this.map)),this.map.on("zoomend",this.onMapZoomEnd),this.isHoverActive&&this.map.on("mousemove",this.onMapMouseMove)}},{key:"stop",value:function(){Mi(Fi(i.prototype),"stop",this).call(this),this.map&&(this.map.off("zoomend",this.onMapZoomEnd),this.map.off("mousemove",this.onMapMouseMove))}},{key:"getVehiclesAtCoordinate",value:function(t,e){var r=Si(this.map);return Mi(Fi(i.prototype),"getVehiclesAtCoordinate",this).call(this,t,r,e)}},{key:"onMapZoomEnd",value:function(){this.startUpdateTime(this.map.getZoom())}},{key:"onMapMouseMove",value:function(t){if(this.map.isMoving()||this.map.isRotating()||this.map.isZooming()||!this.isHoverActive)this.map.getContainer().style.cursor="auto";else{var e=Ci(this.getVehiclesAtCoordinate(Object(Nt.fromLonLat)([t.lngLat.lng,t.lngLat.lat]),1),1)[0],r=e&&e.id;this.hoverVehicleId!==r&&(this.map.getContainer().style.cursor=e?"pointer":"auto",this.hoverVehicleId=r,this.renderTrajectories(this.currTime))}}}])&&Ii(e.prototype,r),n&&Ii(e,n),i}($e(O));function Ni(t){return(Ni="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function zi(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function Bi(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?zi(Object(r),!0).forEach((function(e){Ki(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):zi(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function Ki(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Gi(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Zi(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function Hi(t,e,r){return(Hi="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(t,e,r){var n=function(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=Yi(t)););return t}(t,e);if(n){var o=Object.getOwnPropertyDescriptor(n,e);return o.get?o.get.call(r):o.value}})(t,e,r||t)}function Wi(t,e){return(Wi=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function $i(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=Yi(t);if(e){var o=Yi(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return Ji(this,r)}}function Ji(t,e){return!e||"object"!==Ni(e)&&"function"!=typeof e?Qi(t):e}function Qi(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function Yi(t){return(Yi=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var Xi=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&Wi(t,e)}(i,t);var e,r,n,o=$i(i);function i(){var t,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return Gi(this,i),(t=o.call(this,Bi({},e))).onMove=t.onMove.bind(Qi(t)),t.onMoveEnd=t.onMoveEnd.bind(Qi(t)),t}return e=i,(r=[{key:"init",value:function(t,e){if(Hi(Yi(i.prototype),"init",this).call(this,t),this.map){this.map.on("zoomend",this.onZoomEnd),this.map.on("move",this.onMove),this.map.on("moveend",this.onMoveEnd);var r=this.map.getCanvas(),n=r.width,o=r.height;this.tracker.canvas.width=n,this.tracker.canvas.height=o,this.map.addSource("canvas-source",{type:"canvas",canvas:this.tracker.canvas,coordinates:ki(this.map),animate:!0}),this.map.addLayer({id:"canvas-layer",type:"raster",source:"canvas-source",paint:{"raster-opacity":1,"raster-fade-duration":0}},e)}}},{key:"terminate",value:function(){this.map&&(this.map.off("zoomend",this.onZoomEnd),this.map.off("move",this.onMove),this.map.off("moveend",this.onMoveEnd)),Hi(Yi(i.prototype),"terminate",this).call(this)}},{key:"onMove",value:function(){this.map.getSource("canvas-source").setCoordinates(ki(this.map));var t=this.map.getCanvas(),e=t.width,r=t.height;this.renderTrajectories(this.currTime,[e,r],Si(this.map))}},{key:"onMoveEnd",value:function(){this.updateTrajectories()}}])&&Zi(e.prototype,r),n&&Zi(e,n),i}(eo(qi));function tc(t){return(tc="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function ec(t){return function(t){if(Array.isArray(t))return oc(t)}(t)||function(t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(t))return Array.from(t)}(t)||nc(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function rc(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(t)))return;var r=[],n=!0,o=!1,i=void 0;try{for(var c,a=t[Symbol.iterator]();!(n=(c=a.next()).done)&&(r.push(c.value),!e||r.length!==e);n=!0);}catch(t){o=!0,i=t}finally{try{n||null==a.return||a.return()}finally{if(o)throw i}}return r}(t,e)||nc(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function nc(t,e){if(t){if("string"==typeof t)return oc(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?oc(t,e):void 0}}function oc(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function ic(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function cc(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?ic(Object(r),!0).forEach((function(e){ac(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):ic(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function ac(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function uc(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function sc(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function lc(t,e,r){return(lc="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(t,e,r){var n=function(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=bc(t)););return t}(t,e);if(n){var o=Object.getOwnPropertyDescriptor(n,e);return o.get?o.get.call(r):o.value}})(t,e,r||t)}function fc(t,e){return(fc=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function pc(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=bc(t);if(e){var o=bc(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return yc(this,r)}}function yc(t,e){return!e||"object"!==tc(e)&&"function"!=typeof e?hc(t):e}function hc(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function bc(t){return(bc=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var vc={mapbox:{TrajservLayer:function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&fc(t,e)}(i,t);var e,r,n,o=pc(i);function i(){var t,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return uc(this,i),(t=o.call(this,cc({},e))).onMapClick=t.onMapClick.bind(hc(t)),t.onMove=t.onMove.bind(hc(t)),t.onMoveEnd=t.onMoveEnd.bind(hc(t)),t.onVisibilityChange=t.onVisibilityChange.bind(hc(t)),t}return e=i,(r=[{key:"init",value:function(t,e){if(t){lc(bc(i.prototype),"init",this).call(this,t);var r=t.getCanvas(),n=r.width,o=r.height;this.tracker.canvas.width=n,this.tracker.canvas.height=o;var c={type:"canvas",canvas:this.tracker.canvas,coordinates:ki(t),animate:!0,attribution:this.copyrights};this.beforeId=e,this.layer={id:this.key,type:"raster",source:this.key,layout:{visibility:this.visible?"visible":"none"},paint:{"raster-opacity":1,"raster-fade-duration":0,"raster-resampling":"nearest"}},t.addSource(this.key,c),t.addLayer(this.layer,this.beforeId),this.listeners=[this.on("change:visible",this.onVisibilityChange)]}}},{key:"terminate",value:function(){this.map&&(this.listeners.forEach((function(t){Object(c.unByKey)(t)})),this.map.removeLayer(this.key),this.map.removeSource(this.key)),lc(bc(i.prototype),"terminate",this).call(this)}},{key:"start",value:function(){this.map&&(lc(bc(i.prototype),"start",this).call(this),this.map.on("click",this.onMapClick),this.map.on("move",this.onMove),this.map.on("moveend",this.onMoveEnd))}},{key:"stop",value:function(){this.map&&(this.map.off("click",this.onClick),this.map.off("move",this.onMove),this.map.off("moveend",this.onMoveEnd)),lc(bc(i.prototype),"stop",this).call(this)}},{key:"onVisibilityChange",value:function(){this.visible&&!this.map.getLayer(this.key)?this.map.addLayer(this.layer,this.beforeId):this.map.getLayer(this.key)&&this.map.removeLayer(this.key)}},{key:"onMove",value:function(){this.map.getSource(this.key).setCoordinates(ki(this.map));var t=this.map.getCanvas(),e=t.width,r=t.height;this.renderTrajectories(this.currTime,[e,r],Si(this.map))}},{key:"onMoveEnd",value:function(){this.updateTrajectories(),this.selectedVehicleId&&this.journeyId&&this.highlightTrajectory()}},{key:"onMapClick",value:function(t){var e=this;if(this.clickCallbacks.length){var r=rc(this.getVehiclesAtCoordinate(Object(Nt.fromLonLat)([t.lngLat.lng,t.lngLat.lat]),1),1)[0];r?(this.selectedVehicleId=r.id,this.journeyId=r.journeyIdentifier,this.updateTrajectoryStations(this.selectedVehicleId).then((function(n){e.stationsCoords=[],n.stations.forEach((function(t){e.stationsCoords.push(Object(Nt.fromLonLat)(t.coordinates))})),e.clickCallbacks.forEach((function(o){return o(cc(cc({},r),n),e,t)}))}))):(this.selectedVehicleId=null,this.clickCallbacks.forEach((function(r){return r(null,e,t)})))}}},{key:"getParams",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=this.map.getBounds().toArray(),r=Object(Nt.fromLonLat)(e[0]),n=Object(Nt.fromLonLat)(e[1]),o=[].concat(ec(r),ec(n)),c=Object(ge.buffer)(o,Object(ge.getWidth)(o)/10).join(","),a=this.map.getZoom();return lc(bc(i.prototype),"getParams",this).call(this,cc(cc({},t),{},{bbox:c,s:a<10?1:0,z:a}))}},{key:"defaultStyle",value:function(t){var e=this.map.getZoom();return lc(bc(i.prototype),"defaultStyle",this).call(this,t,e)}},{key:"drawFullTrajectory",value:function(t,e,r){console.log("to be implemented")}},{key:"highlightTrajectory",value:function(t){var e=this;this.api.fetchTrajectoryById({id:t,time:hr(new Date)}).catch((function(){e.map.getLayer("highlight-trajectory")&&e.map.removeLayer("highlight-trajectory")}))}}])&&sc(e.prototype,r),n&&sc(e,n),i}(Pn(qi)),TralisLayer:Xi},ol:{Map:qt,Layer:E,WMSLayer:Vo,MapboxLayer:be,TrajservLayer:Fn,TralisLayer:po,VectorLayer:ko}};e.default=vc}])}));
2
2
  //# sourceMappingURL=index.js.map