ulogger-server/js/bundle.js
2019-10-09 18:10:43 +02:00

1 line
70 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

!function(t){function e(i){if(n[i])return n[i].exports;var o=n[i]={i:i,l:!1,exports:{}};return t[i].call(o.exports,o,o.exports,e),o.l=!0,o.exports}var n={};e.m=t,e.c=n,e.d=function(t,n,i){e.o(t,n)||Object.defineProperty(t,n,{enumerable:!0,get:i})},e.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},e.t=function(t,n){if(1&n&&(t=e(t)),8&n)return t;if(4&n&&"object"==typeof t&&t&&t.__esModule)return t;var i=Object.create(null);if(e.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:t}),2&n&&"string"!=typeof t)for(var o in t)e.d(i,o,function(e){return t[e]}.bind(null,o));return i},e.n=function(t){var n=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(n,"a",n),n},e.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},e.p="",e(e.s=0)}([function(t,e,n){"use strict";function i(t,e){for(var n,i=0;i<e.length;i++)(n=e[i]).enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}function o(t,e){for(var n,i=0;i<e.length;i++)(n=e[i]).enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}function r(t,e){for(var n,i=0;i<e.length;i++)(n=e[i]).enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}function a(t,e,n,i,o,r,a){try{var s=t[r](a),c=s.value}catch(t){return void n(t)}s.done?e(c):Promise.resolve(c).then(i,o)}function s(t,e){for(var n,i=0;i<e.length;i++)(n=e[i]).enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}function c(t,e){for(var n,i=0;i<e.length;i++)(n=e[i]).enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}function l(t,e){for(var n,i=0;i<e.length;i++)(n=e[i]).enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}function u(t,e){for(var n,i=0;i<e.length;i++)(n=e[i]).enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}function d(t,e){for(var n,i=0;i<e.length;i++)(n=e[i]).enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}function h(t){return(h="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 f(t,e){for(var n,i=0;i<e.length;i++)(n=e[i]).enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}function p(t,e){return!e||"object"!==h(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 m(t){return(m=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function g(t,e){return(g=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function y(t,e){for(var n,i=0;i<e.length;i++)(n=e[i]).enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}function v(t,e){for(var n,i=0;i<e.length;i++)(n=e[i]).enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}function k(t,e){for(var n,i=0;i<e.length;i++)(n=e[i]).enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}function b(t,e){for(var n,i=0;i<e.length;i++)(n=e[i]).enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}function w(t){return(w="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 E(t,e){for(var n,i=0;i<e.length;i++)(n=e[i]).enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}function _(t,e){return!e||"object"!==w(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 S(t){return(S=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function L(t,e){return(L=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function A(t){return(A="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 C(t,e){for(var n,i=0;i<e.length;i++)(n=e[i]).enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}function T(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function O(t,e,n){return(O="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(t,e,n){var i=function(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=I(t)););return t}(t,e);if(i){var o=Object.getOwnPropertyDescriptor(i,e);return o.get?o.get.call(n):o.value}})(t,e,n||t)}function I(t){return(I=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function R(t,e){return(R=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function x(t){return(x="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){for(var n,i=0;i<e.length;i++)(n=e[i]).enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}function M(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function N(t,e){return(N=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function D(t,e,n,i){return(D="undefined"!=typeof Reflect&&Reflect.set?Reflect.set:function(t,e,n,i){var o,r=function(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=B(t)););return t}(t,e);if(r){if((o=Object.getOwnPropertyDescriptor(r,e)).set)return o.set.call(i,n),!0;if(!o.writable)return!1}if(o=Object.getOwnPropertyDescriptor(i,e)){if(!o.writable)return!1;o.value=n,Object.defineProperty(i,e,o)}else!function(t,e,n){e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n}(i,e,n);return!0})(t,e,n,i)}function j(t,e,n,i,o){if(!D(t,e,n,i||t)&&o)throw new Error("failed to set property");return n}function B(t){return(B=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function H(t){return(H="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 F(t,e){for(var n,i=0;i<e.length;i++)(n=e[i]).enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}function U(t,e){for(var n,i=0;i<e.length;i++)(n=e[i]).enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}function V(t,e){for(var n,i=0;i<e.length;i++)(n=e[i]).enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}function K(t,e){Ht=t;var n="//maps.googleapis.com/maps/api/js?"+(null==At.gkey?"":"key="+At.gkey+"&")+"callback=gm_loaded";if(yt.addScript(n,"mapapi_gmaps"),!Xt)throw new Error("Google Maps API not ready");!function(t){Wt?window.gm_authFailure():(google.maps.visualRefresh=!0,Gt={strokeColor:At.strokeColor,strokeOpacity:At.strokeOpacity,strokeWeight:At.strokeWeight},qt={center:new google.maps.LatLng(At.init_latitude,At.init_longitude),zoom:8,mapTypeId:google.maps.MapTypeId.ROADMAP,scaleControl:!0},Bt=new google.maps.Map(t,qt))}(e)}function G(){Ft.length=0,Ut.length=0,Vt.length=0,Gt=null,qt=null,Kt=null,Bt&&Bt.getDiv()&&(Bt.getDiv().innerHTML=""),Bt=null}function q(t,e){if(t){var n=new google.maps.Polyline(Gt);n.setMap(Bt);var i=n.getPath(),o=new google.maps.LatLngBounds,r=0,a=!0,s=!1,c=void 0;try{for(var l,u,d=t.positions[Symbol.iterator]();!(a=(l=d.next()).done);a=!0){u=l.value,X(r++,t);var h=new google.maps.LatLng(u.latitude,u.longitude);t.continuous&&i.push(h),o.extend(h)}}catch(t){s=!0,c=t}finally{try{a||null==d.return||d.return()}finally{if(s)throw c}}if(e&&(Bt.fitBounds(o),1==r)){var f=google.maps.event.addListenerOnce(Bt,"bounds_changed",function(){this.getZoom()&&this.setZoom(15)});setTimeout(function(){google.maps.event.removeListener(f)},2e3)}Ft.push(n)}}function z(){for(var t=0;t<Ft.length;t++)Ft[t].setMap(null);for(var e=0;e<Ut.length;e++)google.maps.event.clearInstanceListeners(Vt[e]),Vt[e].setMap(null),Ut[e].setMap(null);Ut.length=0,Ft.length=0,Vt.length=0}function Y(t,e,n){return{anchor:new google.maps.Point(15,35),url:jt.getSvgSrc(t,e,n)}}function X(t,e){var n=e.positions[t],i=e.length,o=new google.maps.Marker({position:new google.maps.LatLng(n.latitude,n.longitude),title:new Date(1e3*n.timestamp).toLocaleString(),map:Bt}),r=n.hasComment()||n.hasImage(),a=Y(r?At.colorExtra:At.colorNormal,!1,r);t===i-1?a=Y(At.colorStop,!0,r):0==t&&(a=Y(At.colorStart,!0,r)),o.setIcon(a);var s=new google.maps.InfoWindow;o.addListener("click",function(t){return function(){s.setContent(jt.getPopupHtml(t)),s.open(Bt,o),Ht.dispatchEvent(kt.MARKER_SELECT,t),Kt=s,s.addListener("closeclick",function(){Ht.dispatchEvent(kt.MARKER_SELECT),google.maps.event.clearListeners(s,"closeclick"),Kt=null})}}(t)),o.addListener("mouseover",function(t){return function(){Ht.dispatchEvent(kt.MARKER_OVER,t)}}(t)),o.addListener("mouseout",function(){Ht.dispatchEvent(kt.MARKER_OVER)}),Ut.push(o),Vt.push(s)}function W(t){Kt&&(Kt.close(),clearTimeout(zt));var e=Ut[t].getIcon();Ut[t].setIcon(Y(At.colorHilite,!1,!1)),Ut[t].setAnimation(google.maps.Animation.BOUNCE),zt=setTimeout(function(){Ut[t].setIcon(e),Ut[t].setAnimation(null)},2e3)}function Z(){var t=Bt.getBounds(),e=t.getSouthWest().lat(),n=t.getSouthWest().lng(),i=t.getNorthEast().lat();return[n,e,t.getNorthEast().lng(),i]}function J(){for(var t,e=new google.maps.LatLngBounds,n=0;n<Ut.length;n++)t=new google.maps.LatLng(Ut[n].position.lat(),Ut[n].position.lng()),e.extend(t);Bt.fitBounds(e)}function Q(t){var e=new google.maps.LatLng(t[1],t[0]),n=new google.maps.LatLng(t[3],t[2]),i=new google.maps.LatLngBounds(e,n);Bt.fitBounds(i)}function $(){}function tt(t,e){Jt=t,yt.addScript("//cdn.polyfill.io/v2/polyfill.min.js?features=requestAnimationFrame,Element.prototype.classList","mapapi_openlayers_polyfill"),yt.addScript("js/lib/ol.js","mapapi_openlayers"),yt.addCss("css/ol.css","ol_css");var n=[new ol.control.Zoom,new ol.control.Rotate,new ol.control.ScaleLine,new ol.control.ZoomToExtent({label:ut()})],i=new ol.View({center:ol.proj.fromLonLat([At.init_longitude,At.init_latitude]),zoom:8});(Zt=new ol.Map({target:e,controls:n,view:i})).on("pointermove",function(t){var e=Zt.forEachFeatureAtPixel(t.pixel,function(t,e){return"Markers"===e.get("name")?t:null}),n=e?e.getId():null;n!==ie&&(Jt.dispatchEvent(kt.MARKER_OVER),ie=n,n&&Jt.dispatchEvent(kt.MARKER_OVER,n)),Zt.getTargetElement().style.cursor=e?"pointer":""}),function(){var t=new ol.layer.Tile({name:"OpenStreetMap",visible:!0,source:new ol.source.OSM});for(var e in Zt.addLayer(t),te=t,At.ol_layers)if(At.ol_layers.hasOwnProperty(e)){var n=At.ol_layers[e],i=new ol.layer.Tile({name:e,visible:!1,source:new ol.source.XYZ({url:n})});Zt.addLayer(i)}var o=new ol.style.Style({stroke:new ol.style.Stroke({color:yt.hexToRGBA(At.strokeColor,At.strokeOpacity),width:At.strokeWeight})});Qt=new ol.layer.Vector({name:"Track",type:"data",source:new ol.source.Vector,style:o}),$t=new ol.layer.Vector({name:"Markers",type:"data",source:new ol.source.Vector}),Zt.addLayer(Qt),Zt.addLayer($t),function(){function t(){var t=this.value;Zt.getLayers().forEach(function(e){e.get("name")===t&&("data"===e.get("type")?e.getVisible()?e.setVisible(!1):e.setVisible(!0):(te.setVisible(!1),te=e,e.setVisible(!0)))})}var e=document.createElement("div");e.id="switcher",e.className="ol-control",document.body.appendChild(e);var n=document.createElement("div");n.id="switcher-content",n.className="ol-layerswitcher",e.appendChild(n),Zt.getLayers().forEach(function(e){var i=document.createElement("label");i.innerHTML=e.get("name"),n.appendChild(i);var o=document.createElement("input");"data"===e.get("type")?(o.type="checkbox",i.className="ol-datalayer"):o.type="radio",o.name="layer",o.value=e.get("name"),o.onclick=t,e.getVisible()&&(o.checked=!0),i.insertBefore(o,i.childNodes[0])});var i=document.createElement("button"),o=document.createElement("img");o.src="images/layers.svg",o.style.width="60%",i.appendChild(o);var r=function(){var t=document.getElementById("switcher");t.style.display="block"===t.style.display?"none":"block"};i.addEventListener("click",r,!1),i.addEventListener("touchstart",r,!1);var a=document.createElement("div");a.className="ol-switcher-button ol-unselectable ol-control",a.appendChild(i);var s=new ol.control.Control({element:a});Zt.addControl(s)}()}(),function(){ee={};var t=new ol.style.Icon({anchor:[.5,1],src:jt.getSvgSrc(At.colorStart,!0)}),e=new ol.style.Icon({anchor:[.5,1],src:jt.getSvgSrc(At.colorStop,!0)}),n=new ol.style.Icon({anchor:[.5,1],src:jt.getSvgSrc(At.colorStart,!0,!0)}),i=new ol.style.Icon({anchor:[.5,1],src:jt.getSvgSrc(At.colorStop,!0,!0)}),o=new ol.style.Icon({anchor:[.5,1],opacity:.7,src:jt.getSvgSrc(At.colorNormal,!1)}),r=new ol.style.Icon({anchor:[.5,1],src:jt.getSvgSrc(At.colorExtra,!1,!0)}),a=new ol.style.Icon({anchor:[.5,1],src:jt.getSvgSrc(At.colorHilite,!1)});ee.start=new ol.style.Style({image:t}),ee.stop=new ol.style.Style({image:e}),ee.startExtra=new ol.style.Style({image:n}),ee.stopExtra=new ol.style.Style({image:i}),ee.normal=new ol.style.Style({image:o}),ee.extra=new ol.style.Style({image:r}),ee.hilite=new ol.style.Style({image:a})}(),function(){var t=document.createElement("div");t.id="popup",t.className="ol-popup",document.body.appendChild(t);var e=document.createElement("a");e.id="popup-closer",e.className="ol-popup-closer",e.href="#",t.appendChild(e);var n=document.createElement("div");n.id="popup-content",t.appendChild(n);var i=new ol.Overlay({element:t,autoPan:!0,autoPanAnimation:{duration:250}});e.onclick=function(){return i.setPosition(void 0),e.blur(),!1},Zt.on("click",function(t){var e=t.coordinate,o=Zt.forEachFeatureAtPixel(t.pixel,function(t,e){return"Markers"===e.get("name")?t:null});o?(i.setPosition(e),n.innerHTML=jt.getPopupHtml(o.getId()),Zt.addOverlay(i),Jt.dispatchEvent(kt.MARKER_SELECT,o.getId())):(i.setPosition(void 0),Jt.dispatchEvent(kt.MARKER_SELECT))})}()}function et(){Qt=null,$t=null,te=null,ee=null,jt.removeElementById("popup"),jt.removeElementById("switcher"),Zt&&Zt.getTargetElement()&&(Zt.getTargetElement().innerHTML=""),Zt=null}function nt(t,e){if(t){var n=0,i=new ol.geom.LineString([]),o=!0,r=!1,a=void 0;try{for(var s,c,l=t.positions[Symbol.iterator]();!(o=(s=l.next()).done);o=!0)c=s.value,ot(n++,t),t.continuous&&i.appendCoordinate(ol.proj.fromLonLat([c.longitude,c.latitude]))}catch(t){r=!0,a=t}finally{try{o||null==l.return||l.return()}finally{if(r)throw a}}if(0<i.getLength()){var u=new ol.Feature({geometry:i});Qt.getSource().addFeature(u)}var d=$t.getSource().getExtent();if(Zt.getControls().forEach(function(t){t instanceof ol.control.ZoomToExtent&&Zt.removeControl(t)}),e)Zt.getView().fit(d),20<Zt.getView().getZoom()&&(Zt.getView().setZoom(20),d=Zt.getView().calculateExtent(Zt.getSize()));var h=new ol.control.ZoomToExtent({extent:d,label:ut()});Zt.addControl(h)}}function it(){Qt&&Qt.getSource().clear(),$t&&$t.getSource().clear()}function ot(t,e){var n=e.positions[t],i=e.positions.length,o=new ol.Feature({geometry:new ol.geom.Point(ol.proj.fromLonLat([n.longitude,n.latitude]))}),r=function(t,e,n){var i=ee.normal;return t.hasComment()||t.hasImage()?i=e===n-1?ee.stopExtra:0===e?ee.startExtra:ee.extra:e===n-1?i=ee.stop:0==e&&(i=ee.start),i}(n,t,i);o.setStyle(r),o.setId(t),$t.getSource().addFeature(o)}function rt(t){var e=$t.getSource().getFeatureById(t),n=e.getStyle(),i=ee.hilite;e.setStyle(i),setTimeout(function(){return e.setStyle(n)},2e3)}function at(){var t=Zt.getView().calculateExtent(Zt.getSize()),e=ol.proj.transformExtent(t,"EPSG:900913","EPSG:4326");return[e[0],e[1],e[2],e[3]]}function st(){Zt.getView().fit($t.getSource().getExtent())}function ct(t){var e=ol.proj.transformExtent(t,"EPSG:4326","EPSG:900913");Zt.getView().fit(e)}function lt(){Zt.updateSize()}function ut(){var t=document.createElement("img");return t.src="images/extent.svg",t.style.width="60%",t}function dt(t,e){for(var n,i=0;i<e.length;i++)(n=e[i]).enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}var ht=Math.round,ft=Number.prototype;n.r(e);var pt={};n.r(pt),n.d(pt,"name",function(){return Yt}),n.d(pt,"init",function(){return K}),n.d(pt,"cleanup",function(){return G}),n.d(pt,"displayTrack",function(){return q}),n.d(pt,"clearMap",function(){return z}),n.d(pt,"animateMarker",function(){return W}),n.d(pt,"getBounds",function(){return Z}),n.d(pt,"zoomToExtent",function(){return J}),n.d(pt,"zoomToBounds",function(){return Q}),n.d(pt,"updateSize",function(){return $});var mt={};n.r(mt),n.d(mt,"name",function(){return ne}),n.d(mt,"init",function(){return tt}),n.d(mt,"cleanup",function(){return et}),n.d(mt,"displayTrack",function(){return nt}),n.d(mt,"clearMap",function(){return it}),n.d(mt,"animateMarker",function(){return rt}),n.d(mt,"getBounds",function(){return at}),n.d(mt,"zoomToExtent",function(){return st}),n.d(mt,"zoomToBounds",function(){return ct}),n.d(mt,"updateSize",function(){return lt});var gt=function(){function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t);var n=document.createElement("div");n.setAttribute("id","modal");var i=document.createElement("div");i.setAttribute("id","modal-header");var o=document.createElement("button");o.setAttribute("id","modal-close"),o.setAttribute("type","button"),o.setAttribute("class","button-reject");var r=document.createElement("img");r.setAttribute("src","images/close.svg"),r.setAttribute("alt",Ct.strings.close),o.append(r),i.append(o),n.append(i);var a=document.createElement("div");if(a.setAttribute("id","modal-body"),"string"==typeof e)a.innerHTML=e;else if(e instanceof NodeList||e instanceof Array){var s=!0,c=!1,l=void 0;try{for(var u,d,h=e[Symbol.iterator]();!(s=(u=h.next()).done);s=!0)d=u.value,a.append(d)}catch(t){c=!0,l=t}finally{try{s||null==h.return||h.return()}finally{if(c)throw l}}}else a.append(e);n.append(a),this._modal=n,this.visible=!1}return function(t,e,n){e&&i(t.prototype,e),n&&i(t,n)}(t,[{key:"show",value:function(){var t=this;return new Promise(function(e){t.addListeners(e),t.visible||document.body.append(t._modal)})}},{key:"addListeners",value:function(e){this._modal.querySelectorAll(".button-resolve").forEach(function(n){n.addEventListener("click",function(){t.onClick(n,e,{cancelled:!1,action:n.getAttribute("data-action")})})}),this._modal.querySelectorAll(".button-reject").forEach(function(n){n.addEventListener("click",function(){t.onClick(n,e,{cancelled:!0})})})}},{key:"hide",value:function(){document.body.removeChild(this._modal),this.visible=!1}},{key:"modal",get:function(){return this._modal}}],[{key:"onClick",value:function(t,e,n){var i=t.getAttribute("data-confirm"),o=!0;i&&(o=this.isConfirmed(i)),o&&e(n)}},{key:"isConfirmed",value:function(t){return confirm(t)}}]),t}(),yt=function(){function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t)}return function(t,e,n){e&&o(t.prototype,e),n&&o(t,n)}(t,null,[{key:"setCookie",value:function(t,e,n){var i="";if(n){var o=new Date;o.setTime(o.getTime()+24*n*60*60*1e3),i="; expires=".concat(o.toUTCString())}document.cookie="ulogger_".concat(t,"=").concat(e).concat(i,"; path=/")}},{key:"sprintf",value:function(){var t=Array.prototype.slice.call(arguments),e=t.shift(),n=0;return e.replace(/%%|%s|%d/g,function(e){return"%%"===e?"%":void 0===t[n]?e:t[n++]})}},{key:"addScript",value:function(t,e,n){if(!e||!document.getElementById(e)){var i=document.createElement("script");i.type="text/javascript",i.src=t,e&&(i.id=e),i.async=!0,n instanceof Function&&(i.onload=n),document.getElementsByTagName("head")[0].appendChild(i)}}},{key:"htmlEncode",value:function(t){return t.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#39;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}},{key:"hexToRGBA",value:function(t,e){return"rgba("+(t=t.replace("#","")).match(new RegExp("(.{"+t.length/3+"})","g")).map(function(e){return parseInt(t.length%2?e+e:e,16)}).concat(e||1).join(",")+")"}},{key:"addCss",value:function(t,e){if(!e||!document.getElementById(e)){var n=document.createElement("link");n.type="text/css",n.rel="stylesheet",n.href=t,e&&(n.id=e),document.getElementsByTagName("head")[0].appendChild(n)}}},{key:"nodeFromHtml",value:function(t){var e=document.createElement("template");return e.innerHTML=t,e.content.firstChild}},{key:"nodesFromHtml",value:function(t){var e=document.createElement("template");return e.innerHTML=t,e.content.childNodes}},{key:"querySelectorInList",value:function(t,e){var n=!0,i=!1,o=void 0;try{for(var r,a,s=t[Symbol.iterator]();!(n=(r=s.next()).done);n=!0)if((a=r.value)instanceof HTMLElement){var c=a.querySelector(e);if(c)return c}}catch(t){i=!0,o=t}finally{try{n||null==s.return||s.return()}finally{if(i)throw o}}return null}},{key:"getNode",value:function(t,e){var n=t.getElementsByTagName(e);if(n.length){var i=n[0].childNodes;if(i.length)return i[0].nodeValue}return null}},{key:"getNodeAsFloat",value:function(e,n){var i=t.getNode(e,n);return null==i?null:parseFloat(i)}},{key:"getNodeAsInt",value:function(e,n){var i=t.getNode(e,n);return null==i?null:parseInt(i)}},{key:"getNodesArray",value:function(t,e){var n=t.getElementsByTagName(e);if(n.length){var i={},o=n[0].childNodes,r=!0,a=!1,s=void 0;try{for(var c,l,u=o[Symbol.iterator]();!(r=(c=u.next()).done);r=!0)(l=c.value).nodeType===Node.ELEMENT_NODE&&(i[l.nodeName]=l.firstChild?l.firstChild.nodeValue:"")}catch(t){a=!0,s=t}finally{try{r||null==u.return||u.return()}finally{if(a)throw s}}return i}return null}},{key:"getAttributeAsInt",value:function(t,e){var n=t.getAttribute(e);return null==n?null:parseInt(n)}},{key:"getTimeString",value:function(t){var e="";return{date:"".concat(t.getFullYear(),"-").concat("0".concat(t.getMonth()+1).slice(-2),"-").concat("0".concat(t.getDate()).slice(-2)),time:t.toTimeString().replace(/^\s*([^ ]+)([^(]*)(\([^)]*\))*/,function(t,n,i,o){return i&&(e=i.replace(/(0(?=[1-9]00))|(00\b)/g,""),o&&/[A-Z]/.test(o)&&(e+=o.match(/\b[A-Z]+/g).join(""))),n}),zone:e}}}]),t}();ft.toHMS=function(){var t=Math.floor,e=this,n=t(e/86400),i=t(e%86400/3600),o=t(e%86400%3600/60);return e=e%86400%3600%60,(0<n?n+" d ":"")+("00"+i).slice(-2)+":"+("00"+o).slice(-2)+":"+("00"+e).slice(-2)},ft.toKm=function(){return ht(this/10)/100},ft.toKmH=function(){return ht(3600*this/10)/100};var vt=function(){function t(e,n){(function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")})(this,t),this.type=e,this.user=n,this.dialog=new gt(this.getHtml()),this.form=this.dialog.modal.querySelector("#userForm"),this.form.onsubmit=function(){return!1}}return function(t,e,n){e&&r(t.prototype,e),n&&r(t,n)}(t,[{key:"getHtml",value:function(){var t,e,n="",i="";switch(this.type){case"add":t="add",i="<label><b>".concat(Ct.strings.username,'</b></label>\n <input type="text" placeholder="').concat(Ct.strings.usernameenter,'" name="login" required>'),e="<label><b>".concat(Ct.strings.password,'</b></label>\n <input type="password" placeholder="').concat(Ct.strings.passwordenter,'" name="pass" required>\n <label><b>').concat(Ct.strings.passwordrepeat,'</b></label>\n <input type="password" placeholder="').concat(Ct.strings.passwordenter,'" name="pass2" required>');break;case"edit":t="update",n='<div style="float:left">'.concat(yt.sprintf(Ct.strings.editinguser,"<b>".concat(yt.htmlEncode(this.user.login),"</b>")),'</div>\n <div class="red-button button-resolve" data-action="delete" data-confirm="').concat(yt.sprintf(Ct.strings.userdelwarn,yt.htmlEncode(this.user.login)),'"><b><a>').concat(Ct.strings.deluser,'</a></b></div>\n <div style="clear: both; padding-bottom: 1em;"></div>'),e="<label><b>".concat(Ct.strings.password,'</b></label>\n <input type="password" placeholder="').concat(Ct.strings.passwordenter,'" name="pass" required>\n <label><b>').concat(Ct.strings.passwordrepeat,'</b></label>\n <input type="password" placeholder="').concat(Ct.strings.passwordenter,'" name="pass2" required>');break;case"pass":t="update",e="<label><b>".concat(Ct.strings.oldpassword,'</b></label>\n <input type="password" placeholder="').concat(Ct.strings.passwordenter,'" name="oldpass" required>\n <label><b>').concat(Ct.strings.newpassword,'</b></label>\n <input type="password" placeholder="').concat(Ct.strings.passwordenter,'" name="pass" required>\n <label><b>').concat(Ct.strings.newpasswordrepeat,'</b></label>\n <input type="password" placeholder="').concat(Ct.strings.passwordenter,'" name="pass2" required>');break;default:throw new Error("Unknown dialog type: ".concat(this.type))}return"".concat(n,'\n <form id="userForm">\n ').concat(i,"\n ").concat(e,'\n <div class="buttons">\n <button class="button-reject" type="button">').concat(Ct.strings.cancel,'</button>\n <button class="button-resolve" type="submit" data-action="').concat(t,'">').concat(Ct.strings.submit,"</button>\n </div>\n </form>")}},{key:"show",value:function(){var t=this;return new Promise(function(e){t.resolveModal(e)})}},{key:"resolveModal",value:function(t){var e=this;this.dialog.show().then(function(n){if(n.cancelled)return e.hide();if("update"===n.action||"add"===n.action){if(!e.validate())return e.resolveModal(t);n.data=e.getData()}return t(n)})}},{key:"hide",value:function(){this.dialog.hide()}},{key:"getData",value:function(){var t="add"===this.type?this.form.elements.login.value.trim():this.user.login,e=null;return"pass"===this.type&&(e=this.form.elements.oldpass.value.trim()),{login:t,password:this.form.elements.pass.value.trim(),oldPassword:e}}},{key:"validate",value:function(){if("add"===this.type){if(!this.form.elements.login.value.trim())return alert(Ct.strings.allrequired),!1}else if("pass"===this.type){if(!this.form.elements.oldpass.value.trim())return alert(Ct.strings.allrequired),!1}var t=this.form.elements.pass.value.trim(),e=this.form.elements.pass2.value.trim();return t&&e?t===e?!!At.pass_regex.test(t)||(alert(Ct.strings.passlenmin+"\n"+Ct.strings.passrules),!1):(alert(Ct.strings.passnotmatch),!1):(alert(Ct.strings.allrequired),!1)}}]),t}(),kt=function(){function t(e){(function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")})(this,t),this.type=e,this.listeners=new Set}return function(t,e,n){e&&s(t.prototype,e),n&&s(t,n)}(t,[{key:"addListener",value:function(t){this.listeners.add(t)}},{key:"removeListener",value:function(t){this.listeners.delete(t)}},{key:"dispatch",value:function(t){var e=this,n=!0,i=!1,o=void 0;try{for(var r,s=function(){var n=r.value;!function(t){return function(){var e=this,n=arguments;return new Promise(function(i,o){function r(t){a(c,i,o,r,s,"next",t)}function s(t){a(c,i,o,r,s,"throw",t)}var c=t.apply(e,n);r(void 0)})}}(regeneratorRuntime.mark(function i(){return regeneratorRuntime.wrap(function(i){for(;;)switch(i.prev=i.next){case 0:return console.log("".concat(e.type,": ").concat(t?t.constructor.name:"")),i.next=3,n(e,t);case 3:case"end":return i.stop()}},i)}))()},c=this.listeners[Symbol.iterator]();!(n=(r=c.next()).done);n=!0)s()}catch(t){i=!0,o=t}finally{try{n||null==c.return||c.return()}finally{if(i)throw o}}}}],[{key:"ADD",get:function(){return"µAdd"}},{key:"API_CHANGE",get:function(){return"µApiChange"}},{key:"CHART_CLICKED",get:function(){return"µChartClicked"}},{key:"CONFIG",get:function(){return"µConfig"}},{key:"CHANGE",get:function(){return"µChange"}},{key:"CHART_READY",get:function(){return"µChartReady"}},{key:"EDIT",get:function(){return"µEdit"}},{key:"EXPORT",get:function(){return"µExport"}},{key:"IMPORT",get:function(){return"µImport"}},{key:"LOADER",get:function(){return"µLoader"}},{key:"MARKER_OVER",get:function(){return"µMarkerOver"}},{key:"MARKER_SELECT",get:function(){return"µMarkerSelect"}},{key:"OPEN_URL",get:function(){return"µOpen"}},{key:"PASSWORD",get:function(){return"µPassword"}},{key:"TRACK_READY",get:function(){return"µTrackReady"}},{key:"UI_READY",get:function(){return"µUiReady"}}]),t}(),bt=function(){function t(){(function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")})(this,t),this._isAdmin=!1,this._isAuthenticated=!1,this._user=null}return function(t,e,n){e&&c(t.prototype,e),n&&c(t,n)}(t,[{key:"handleEvent",value:function(t){t.type===kt.PASSWORD&&this.isAuthenticated&&this.changePassword()}},{key:"changePassword",value:function(t){var e=this,n=t||new vt("pass",this.user);n.show().then(function(t){return e.user.changePass(t.data.password,t.data.oldPassword)}).then(function(){alert(Ct.strings.actionsuccess),n.hide()}).catch(function(t){alert("".concat(Ct.strings.actionfailure,"\n").concat(t)),e.changePassword(n)})}},{key:"user",set:function(t){this._user=t,this._isAuthenticated=!0},get:function(){return this._user}},{key:"isAdmin",set:function(){this._isAdmin=!0},get:function(){return this._isAdmin}},{key:"isAuthenticated",get:function(){return this._isAuthenticated}}]),t}(),wt=function(){function t(){(function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")})(this,t),this.inititialize()}return function(t,e,n){e&&l(t.prototype,e),n&&l(t,n)}(t,[{key:"inititialize",value:function(){this.interval=10,this.units="metric",this.mapapi="openlayers",this.gkey=null,this.ol_layers={},this.init_latitude=52.23,this.init_longitude=21.01,this.pass_regex=/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.{12,})/,this.strokeWeight=2,this.strokeColor="#ff0000",this.strokeOpacity=1,this.showLatest=!1,this.colorNormal="#fff",this.colorStart="#55b500",this.colorStop="#ff6a00",this.colorExtra="#ccc",this.colorHilite="#feff6a"}},{key:"notify",value:function(t){this._binder&&this._binder.dispatchEvent(kt.CONFIG,t)}},{key:"binder",set:function(t){this._binder=t}},{key:"interval",get:function(){return this._interval},set:function(t){this._interval=t}},{key:"units",get:function(){return this._units},set:function(t){this._units=t,"imperial"===this._units?(this._factor_kmh=.62,this._unit_kmh="mph",this._factor_m=3.28,this._unit_m="ft",this._factor_km=.62,this._unit_km="mi"):"nautical"===this._units?(this._factor_kmh=.54,this._unit_kmh="kt",this._factor_m=1,this._unit_m="m",this._factor_km=.54,this._unit_km="nm"):(this._factor_kmh=1,this._unit_kmh="km/h",this._factor_m=1,this._unit_m="m",this._factor_km=1,this._unit_km="km")}},{key:"mapapi",get:function(){return this._mapapi},set:function(t){this._mapapi=t}},{key:"gkey",get:function(){return this._gkey},set:function(t){this._gkey=t}},{key:"ol_layers",get:function(){return this._ol_layers},set:function(t){this._ol_layers=t}},{key:"init_latitude",get:function(){return this._init_latitude},set:function(t){this._init_latitude=t}},{key:"init_longitude",get:function(){return this._init_longitude},set:function(t){this._init_longitude=t}},{key:"pass_regex",get:function(){return this._pass_regex},set:function(t){this._pass_regex=t}},{key:"strokeWeight",get:function(){return this._strokeWeight},set:function(t){this._strokeWeight=t}},{key:"strokeColor",get:function(){return this._strokeColor},set:function(t){this._strokeColor=t}},{key:"strokeOpacity",get:function(){return this._strokeOpacity},set:function(t){this._strokeOpacity=t}},{key:"factor_kmh",get:function(){return this._factor_kmh}},{key:"unit_kmh",get:function(){return this._unit_kmh}},{key:"factor_m",get:function(){return this._factor_m}},{key:"unit_m",get:function(){return this._unit_m}},{key:"factor_km",get:function(){return this._factor_km}},{key:"unit_km",get:function(){return this._unit_km}},{key:"showLatest",get:function(){return this._showLatest},set:function(t){this._showLatest!==t&&(this._showLatest=t,this.notify("showLatest"))}},{key:"colorNormal",get:function(){return this._colorNormal},set:function(t){this._colorNormal=t}},{key:"colorStart",get:function(){return this._colorStart},set:function(t){this._colorStart=t}},{key:"colorStop",get:function(){return this._colorStop},set:function(t){this._colorStop=t}},{key:"colorExtra",get:function(){return this._colorExtra},set:function(t){this._colorExtra=t}},{key:"colorHilite",get:function(){return this._colorHilite},set:function(t){this._colorHilite=t}}]),t}(),Et=function(){function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t)}return function(t,e,n){e&&u(t.prototype,e),n&&u(t,n)}(t,null,[{key:"post",value:function(t,e,n){var i=n||{};return i.method="POST",this.ajax(t,e,i)}},{key:"get",value:function(t,e,n){var i=n||{};return i.method="GET",this.ajax(t,e,i)}},{key:"ajax",value:function(t,e,n){var i=[];e=e||{};var o=(n=n||{}).method||"GET",r=new XMLHttpRequest;return new Promise(function(n,a){r.onreadystatechange=function(){if(4===r.readyState){var t="",e=!0;if(200===r.status){var i=r.responseXML;if(i){var o=i.getElementsByTagName("root");if(o.length&&"1"!==yt.getNode(o[0],"error"))n&&"function"==typeof n&&n(i),e=!1;else if(o.length){var s=yt.getNode(o[0],"message");s&&(t=s)}}}e&&a&&"function"==typeof a&&a(t)}};var s=null;if(e instanceof HTMLFormElement)s=new FormData(e),o="POST";else{for(var c in e)e.hasOwnProperty(c)&&i.push(c+"="+encodeURIComponent(e[c]));s=(s=i.join("&")).replace(/%20/g,"+")}"GET"===o&&i.length&&(t+="?"+s,s=null),r.open(o,t,!0),"POST"!==o||e instanceof HTMLFormElement||r.setRequestHeader("Content-type","application/x-www-form-urlencoded"),r.send(s)})}}]),t}(),_t=function(){function t(e,n,i,o){(function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")})(this,t),this[i]=e,this[o]=n,Object.defineProperty(this,"key",{get:function(){return this[i]}}),Object.defineProperty(this,"value",{get:function(){return this[o]}})}return function(t,e,n){e&&d(t.prototype,e),n&&d(t,n)}(t,[{key:"emit",value:function(t,e){var n=e||this;this.binder.dispatchEvent(t,n)}},{key:"binder",set:function(t){this._binder=t},get:function(){return this._binder}}]),t}(),St=function(t){function e(t,n){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),p(this,m(e).call(this,t,n,"id","login"))}return 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&&g(t,e)}(e,_t),function(t,e,n){e&&f(t.prototype,e),n&&f(t,n)}(e,[{key:"update",value:function(t){var e=this,n=this.password;return delete this.password,Et.post("utils/handleuser.php",{action:t,login:this.login,pass:n}).then(function(n){return"add"===t&&(e.id=yt.getNodeAsInt(n,"userid")),e})}},{key:"changePass",value:function(t,e){return Et.post("utils/changepass.php",{login:this.login,pass:t,oldpass:e})}}]),e}(),Lt=new(function(){function t(){(function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")})(this,t),this.auth={},this.config={},this.lang={},this.loaded||this.initialize()}return function(t,e,n){e&&y(t.prototype,e),n&&y(t,n)}(t,[{key:"initialize",value:function(){var e=t.fetch();e&&(this.initAuth(e),this.initConfig(e),this.initLang(e),this.loaded=!0)}},{key:"initAuth",value:function(t){this.auth=new bt;var e=t.getElementsByTagName("auth");if(e.length&&1===yt.getNodeAsInt(e[0],"isAuthenticated")){var n=yt.getNodeAsInt(e[0],"userId"),i=yt.getNode(e[0],"userLogin");this.auth.user=new St(n,i),this.auth.isAdmin=1===yt.getNodeAsInt(e[0],"isAdmin")}}},{key:"initLang",value:function(t){var e=t.getElementsByTagName("lang");e.length&&(this.lang.strings=yt.getNodesArray(e[0],"strings"))}},{key:"initConfig",value:function(t){this.config=new wt;var e=t.getElementsByTagName("config");if(e.length){this.config.interval=yt.getNodeAsInt(e[0],"interval"),this.config.units=yt.getNode(e[0],"units"),this.config.mapapi=yt.getNode(e[0],"mapapi"),this.config.gkey=yt.getNode(e[0],"gkey"),this.config.ol_layers=yt.getNodesArray(e[0],"ol_layers"),this.config.init_latitude=yt.getNodeAsFloat(e[0],"init_latitude"),this.config.init_longitude=yt.getNodeAsFloat(e[0],"init_longitude");var n=yt.getNode(e[0],"pass_regex");this.config.pass_regex=new RegExp(n.substr(1,n.length-2)),this.config.strokeWeight=yt.getNodeAsInt(e[0],"strokeWeight"),this.config.strokeColor=yt.getNode(e[0],"strokeColor"),this.config.strokeOpacity=yt.getNodeAsInt(e[0],"strokeOpacity")}}}],[{key:"fetch",value:function(){var t=null,e=new XMLHttpRequest;return e.open("GET","utils/getconstants.php",!1),e.send(null),200===e.status&&(t=e.responseXML),t}}]),t}()),At=Lt.config,Ct=Lt.lang,Tt=Lt.auth,Ot=function(){function t(e){(function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")})(this,t),this.track=e;var n='<div style="float:left">'.concat(yt.sprintf(Ct.strings.editingtrack,"<b>".concat(yt.htmlEncode(this.track.name),"</b>")),'</div>\n <div class="red-button button-resolve" data-action="delete" data-confirm="').concat(yt.sprintf(Ct.strings.trackdelwarn,yt.htmlEncode(this.track.name)),'"><b><a>').concat(Ct.strings.deltrack,'</a></b></div>\n <div style="clear: both; padding-bottom: 1em;"></div>\n <form id="trackForm">\n <label><b>').concat(Ct.strings.trackname,'</b></label>\n <input type="text" placeholder="').concat(Ct.strings.trackname,'" name="trackname" value="').concat(yt.htmlEncode(this.track.name),'" required>\n <div class="buttons">\n <button class="button-reject" type="button">').concat(Ct.strings.cancel,'</button>\n <button class="button-resolve" type="submit" data-action="update">').concat(Ct.strings.submit,"</button>\n </div>\n </form>");this.dialog=new gt(n),this.form=this.dialog.modal.querySelector("#trackForm"),this.form.onsubmit=function(){return!1}}return function(t,e,n){e&&v(t.prototype,e),n&&v(t,n)}(t,[{key:"show",value:function(){var t=this;return new Promise(function(e){t.resolveModal(e)})}},{key:"resolveModal",value:function(t){var e=this;this.dialog.show().then(function(n){if(n.cancelled)return e.hide();if("update"===n.action){if(!e.validate())return e.resolveModal(t);n.data=e.getData()}return t(n)})}},{key:"hide",value:function(){this.dialog.hide()}},{key:"getData",value:function(){return{name:this.form.elements.trackname.value.trim()}}},{key:"validate",value:function(){var t=this.form.elements.trackname.value.trim();return!(t===this.track.name||!t&&(alert(Ct.strings.allrequired),1))}}]),t}(),It=function(){function t(e,n,i){(function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")})(this,t),this.data=[],this.binder=n,this._showAllOption=!1,this.hasHead=!1,this.headValue="",this.allValue="",this.T=i||_t,this.domElement=document.querySelector(e),this.binder&&(this.binder.addEventListener(kt.ADD,this),this.binder.addEventListener(kt.CHANGE,this),this.binder.addEventListener(kt.CONFIG,this),this.binder.addEventListener(kt.EDIT,this)),this.selectedId="",this.fromDom()}return function(t,e,n){e&&k(t.prototype,e),n&&k(t,n)}(t,[{key:"select",value:function(t,e){this.selectedId=t.toString(),this.render(),e||this.onChange()}},{key:"clear",value:function(){this.domElement.options.length=0,this.data.length=0,this.selectedId=""}},{key:"fromXml",value:function(t,e,n){if(t){var i=!0,o=!1,r=void 0;try{for(var a,s=t[Symbol.iterator]();!(i=(a=s.next()).done);i=!0){var c=a.value,l=new this.T(yt.getNodeAsInt(c,e),yt.getNode(c,n));this.updateDataRow(l),l.binder=this.binder,this.data.push(l)}}catch(t){o=!0,r=t}finally{try{i||null==s.return||s.return()}finally{if(o)throw r}}this.data.length&&(this.selectedId=this.data[0].key.toString()),this.render(),this.onChange()}}},{key:"fromDom",value:function(){if(this.domElement){var t=!0,e=!1,n=void 0;try{for(var i,o,r=this.domElement[Symbol.iterator]();!(t=(i=r.next()).done);t=!0){if("all"===(o=i.value).value)this._showAllOption=!0;else if(!o.disabled){var a=new this.T(parseInt(o.value),o.innerText);this.updateDataRow(a),a.binder=this.binder,this.data.push(a)}o.selected&&(this.selectedId=o.value)}}catch(t){e=!0,n=t}finally{try{t||null==r.return||r.return()}finally{if(e)throw n}}}}},{key:"handleEvent",value:function(t,e){t.type===kt.CHANGE&&e.el===this.domElement?(this.selectedId=e.id,this.onChange()):t.type===kt.EDIT&&e===this.domElement?this.onEdit():t.type===kt.ADD&&e===this.domElement?this.onAdd():t.type===kt.CONFIG&&this.onConfigChange(e)}},{key:"add",value:function(t){this.data.push(t),this.render()}},{key:"has",value:function(t){return-1!==this.data.findIndex(function(e){return e.key===t})}},{key:"remove",value:function(t){var e=this.current.key;this.data.splice(this.data.findIndex(function(e){return e.key===t}),1),t===e&&(this.selectDefault(),this.onChange()),this.render()}},{key:"selectDefault",value:function(){this.selectedId=this.data.length?this.data[0].key.toString():""}},{key:"render",value:function(){if(this.domElement.options.length=0,this.hasHead){var t=new Option(this.headValue,"0",!0,"0"===this.selectedId);t.disabled=!0,this.domElement.options.add(t)}this._showAllOption&&this.domElement.options.add(new Option(this.allValue,"all"));var e=!0,n=!1,i=void 0;try{for(var o,r,a=this.data[Symbol.iterator]();!(e=(o=a.next()).done);e=!0)r=o.value,this.domElement.options.add(new Option(r.value,r.key.toString(),!1,r.key.toString()===this.selectedId))}catch(t){n=!0,i=t}finally{try{e||null==a.return||a.return()}finally{if(n)throw i}}}},{key:"updateDataRow",value:function(){}},{key:"onChange",value:function(){}},{key:"onEdit",value:function(){}},{key:"onReload",value:function(){}},{key:"onAdd",value:function(){}},{key:"onConfigChange",value:function(){}},{key:"current",get:function(){var t=parseInt(this.selectedId);return isNaN(t)?null:this.data.find(function(e){return e.key===t})}},{key:"isSelectedAllOption",get:function(){return"all"===this.selectedId}},{key:"showAllOption",get:function(){return this._showAllOption},set:function(t){this._showAllOption!==t&&(this._showAllOption=t,!1===t&&this.selectDefault(),this.render(),this.onChange())}}]),t}(),Rt=function(){function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t)}return function(t,e,n){e&&b(t.prototype,e),n&&b(t,n)}(t,[{key:"hasComment",value:function(){return null!=this.comment&&this.comment.length}},{key:"hasImage",value:function(){return null!=this.image&&this.image.length}}],[{key:"fromXml",value:function(e){var n=new t;return n.id=yt.getAttributeAsInt(e,"id"),n.latitude=yt.getNodeAsFloat(e,"latitude"),n.longitude=yt.getNodeAsFloat(e,"longitude"),n.altitude=yt.getNodeAsInt(e,"altitude"),n.speed=yt.getNodeAsInt(e,"speed"),n.bearing=yt.getNodeAsInt(e,"bearing"),n.accuracy=yt.getNodeAsInt(e,"accuracy"),n.provider=yt.getNode(e,"provider"),n.comment=yt.getNode(e,"comment"),n.image=yt.getNode(e,"image"),n.username=yt.getNode(e,"username"),n.trackname=yt.getNode(e,"trackname"),n.trackid=yt.getNodeAsInt(e,"trackid"),n.timestamp=yt.getNodeAsInt(e,"timestamp"),n.distance=yt.getNodeAsInt(e,"distance"),n.seconds=yt.getNodeAsInt(e,"seconds"),n.totalDistance=0,n.totalSeconds=0,n}}]),t}(),xt=function(t){function e(t,n,i){var o;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),(o=_(this,S(e).call(this,t,n,"id","name")))._user=i,o._positions=null,o._plotData=null,o._maxId=0,o._onlyLatest=!1,o._continuous=!0,o}return 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&&L(t,e)}(e,_t),function(t,e,n){e&&E(t.prototype,e),n&&E(t,n)}(e,[{key:"clear",value:function(){this._positions=null,this._plotData=null}},{key:"fromXml",value:function(t,e){var n=[],i=[],o=0,r=0;e&&this._positions&&(n=this._positions,i=this._plotData,o=n[n.length-1].totalDistance,r=n[n.length-1].totalSeconds);var a=t.getElementsByTagName("position"),s=!0,c=!1,l=void 0;try{for(var u,d=a[Symbol.iterator]();!(s=(u=d.next()).done);s=!0){t=u.value;var h=Rt.fromXml(t);o+=h.distance,r+=h.seconds,h.totalDistance=o,h.totalSeconds=r,n.push(h),null!=h.altitude&&i.push({x:h.totalDistance,y:h.altitude*At.factor_m}),h.id>this._maxId&&(this._maxId=h.id)}}catch(t){c=!0,l=t}finally{try{s||null==d.return||d.return()}finally{if(c)throw l}}this._positions=n,this._plotData=i}},{key:"fetch",value:function(){var t=this,e={userid:this._user.id},n=this.hasPositions;return At.showLatest?(e.last=1,n=!1):e.trackid=this.id,this._onlyLatest===At.showLatest?e.afterid=this._maxId:(this._onlyLatest=At.showLatest,n=!1),Et.get("utils/getpositions.php",e).then(function(e){return t.fromXml(e,n),t.render(),e})}},{key:"update",value:function(t){return Et.post("utils/handletrack.php",{action:t,trackid:this.id,trackname:this.name})}},{key:"render",value:function(){this.emit(kt.TRACK_READY)}},{key:"export",value:function(t){var e="utils/export.php?type=".concat(t,"&userid=").concat(this._user.id,"&trackid=").concat(this.id);this.emit(kt.OPEN_URL,e)}},{key:"positions",get:function(){return this._positions}},{key:"user",set:function(t){this._user=t},get:function(){return this._user}},{key:"continuous",set:function(t){this._continuous=t},get:function(){return this._continuous}},{key:"onlyLatest",set:function(t){this._onlyLatest=t}},{key:"plotData",get:function(){return this._plotData}},{key:"length",get:function(){return this._positions?this._positions.length:0}},{key:"hasPositions",get:function(){return null!==this._positions}}]),e}(),Pt=function(t){function e(t,n){var i;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),i=function(t,e){return!e||"object"!==A(e)&&"function"!=typeof e?T(t):e}(this,I(e).call(this,t,n,xt)),n&&(i.binder.addEventListener(kt.EXPORT,T(i)),i.binder.addEventListener(kt.IMPORT,T(i))),i}return 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&&R(t,e)}(e,It),function(t,e,n){e&&C(t.prototype,e),n&&C(t,n)}(e,[{key:"updateDataRow",value:function(t){t.user=re.userList.current}},{key:"handleEvent",value:function(t,n){t.type===kt.CHANGE&&(At.showLatest=!1),O(I(e.prototype),"handleEvent",this).call(this,t,n),t.type===kt.EXPORT?this.current.export(n):t.type===kt.IMPORT&&this.import(n).catch(function(t){return alert("".concat(Ct.strings.actionfailure,"\n").concat(t))})}},{key:"import",value:function(t){var e=this;return this.emit(!0,"import"),Et.post("utils/import.php",t).then(function(t){var n=t.getElementsByTagName("root"),i=yt.getNodeAsInt(n[0],"trackcnt");1<i&&alert(yt.sprintf(Ct.strings.imultiple,i));var o=yt.getNodeAsInt(n[0],"trackid");return e.emit(!1,"import"),e.fetch().then(function(){return e.select(o)})}).catch(function(t){e.emit(!1,"import"),alert("".concat(Ct.strings.actionfailure,"\n").concat(t))})}},{key:"emit",value:function(t,e){this.binder.dispatchEvent(kt.LOADER,{on:t,action:e})}},{key:"fetch",value:function(){var t=this;return this.emit(!0,"track"),Et.get("utils/gettracks.php",{userid:re.userList.current.id}).then(function(e){return t.clear(),t.fromXml(e.getElementsByTagName("track"),"trackid","trackname"),t.emit(!1,"track"),e}).catch(function(e){t.emit(!1,"track"),alert("".concat(Ct.strings.actionfailure,"\n").concat(e))})}},{key:"fetchLatest",value:function(){var t=this;this.emit(!0,"track");var e={last:1},n=re.userList.isSelectedAllOption;return n||(e.userid=re.userList.current.id),Et.get("utils/getpositions.php",e).then(function(e){if(n){t.clear();var i=new xt(0,"",null);i.binder=t.binder,i.continuous=!1,i.fromXml(e,!1),t.add(i),t.select(0,!0),t.current.render()}else{var o=e.getElementsByTagName("position");if(1===o.length){var r=Rt.fromXml(o[0]);if(!t.has(r.trackid))return t.fetch().then(function(){return t.fetchLatest()});t.select(r.trackid,!0),t.current.fromXml(e,!1),t.current.onlyLatest=!0,t.current.render()}}return t.emit(!1,"track"),e}).catch(function(e){t.emit(!1,"track"),alert("".concat(Ct.strings.actionfailure,"\n").concat(e))})}},{key:"onChange",value:function(){At.showLatest||this.fetchTrack()}},{key:"fetchTrack",value:function(){var t=this;this.current&&(this.emit(!0,"track"),this.current.fetch().then(function(){return t.emit(!1,"track")}).catch(function(e){t.emit(!1,"track"),alert("".concat(Ct.strings.actionfailure,"\n").concat(e))}))}},{key:"onEdit",value:function(){if(this.current){if(this.current.user.login!==Tt.user.login&&!Tt.isAdmin)return void alert(Ct.strings.owntrackswarn);this.editTrack()}}},{key:"editTrack",value:function(t){var e=this,n=t||new Ot(this.current);n.show().then(function(t){switch(t.action){case"update":return e.current.name=t.data.name,e.current.update("update").then(function(){return e.render()});case"delete":return e.current.update("delete").then(function(){return e.remove(e.current.id)})}throw new Error}).then(function(){alert(Ct.strings.actionsuccess),n.hide()}).catch(function(t){alert("".concat(Ct.strings.actionfailure,"\n").concat(t)),e.editTrack(n)})}},{key:"onAdd",value:function(){}}]),e}(),Mt=function(t){function e(t,n){var i;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),i=function(t,e){return!e||"object"!==x(e)&&"function"!=typeof e?M(t):e}(this,B(e).call(this,t,n,St)),j(B(e.prototype),"hasHead",!0,M(i),!0),j(B(e.prototype),"allValue","- ".concat(Ct.strings.allusers," -"),M(i),!0),j(B(e.prototype),"headValue",Ct.strings.suser,M(i),!0),i}return 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&&N(t,e)}(e,It),function(t,e,n){e&&P(t.prototype,e),n&&P(t,n)}(e,[{key:"onChange",value:function(){At.showLatest?this.isSelectedAllOption?re.trackList.fetchLatest():re.trackList.fetch().then(function(){return re.trackList.fetchLatest()}):re.trackList.fetch()}},{key:"onConfigChange",value:function(t){"showLatest"===t&&(At.showLatest&&1<this.data.length?this.showAllOption=!0:!At.showLatest&&this.showAllOption&&(this.showAllOption=!1))}},{key:"onEdit",value:function(){if(!this.isSelectedAllOption&&this.current){if(this.current.login===Tt.user.login)return void alert(Ct.strings.selfeditwarn);this.editUser()}}},{key:"editUser",value:function(t){var e=this,n=t||new vt("edit",this.current);n.show().then(function(t){switch(t.action){case"update":return e.current.password=t.data.password,e.current.update("update");case"delete":return e.current.update("delete").then(function(){return e.remove(e.current.id)})}throw new Error}).then(function(){alert(Ct.strings.actionsuccess),n.hide()}).catch(function(t){alert("".concat(Ct.strings.actionfailure,"\n").concat(t)),e.editUser(n)})}},{key:"onAdd",value:function(){this.addUser()}},{key:"addUser",value:function(t){var e=this,n=t||new vt("add");n.show().then(function(t){var e=new St(0,t.data.login);return e.password=t.data.password,e.update("add")}).then(function(t){alert(Ct.strings.actionsuccess),e.add(t),n.hide()}).catch(function(t){alert("".concat(Ct.strings.actionfailure,"\n").concat(t)),e.addUser(n)})}}]),e}(),Nt=function(){function t(){(function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")})(this,t),this.events=new Map}return function(t,e,n){e&&F(t.prototype,e),n&&F(t,n)}(t,[{key:"addEvent",value:function(t){this.events.set(t,new kt(t))}},{key:"addEventListener",value:function(t,e){if(this.events.has(t)||this.addEvent(t),"object"===H(e)&&"function"==typeof e.handleEvent&&(e=e.handleEvent.bind(e)),"function"!=typeof e)throw new Error("Wrong listener type: ".concat(H(e)));this.events.get(t).addListener(e)}},{key:"removeEventListener",value:function(t,e){this.events.has(t)&&("object"===H(e)&&"function"==typeof e.handleEvent&&(e=e.handleEvent),this.events.get(t).removeListener(e))}},{key:"dispatchEvent",value:function(t,e){this.events.has(t)&&this.events.get(t).dispatch(e)}}]),t}();document.addEventListener("DOMContentLoaded",function(){Dt.onDomLoaded()});var Dt=function(){function t(e){(function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")})(this,t),e.addEventListener(kt.MARKER_OVER,this),e.addEventListener(kt.MARKER_SELECT,this),e.addEventListener(kt.TRACK_READY,this),e.addEventListener(kt.UI_READY,this),this._binder=e,this._targetEl=null,this._points=null}return function(t,e,n){e&&U(t.prototype,e),n&&U(t,n)}(t,[{key:"render",value:function(){var t=this;if(this._targetEl&&(new Chartist.Line(this._targetEl,{series:[this.data]},{lineSmooth:!0,showArea:!0,axisX:{type:Chartist.AutoScaleAxis,onlyInteger:!0,showLabel:!1},plugins:[Chartist.plugins.ctAxisTitle({axisY:{axisTitle:"".concat(Ct.strings.altitude," (").concat(At.unit_m,")"),axisClass:"ct-axis-title",offset:{x:0,y:20},textAnchor:"middle",flipTitle:!0}})]}).on("created",function(){t._points=document.querySelectorAll(".ct-chart-line .ct-point");for(var e=t._points.length,n=0;n<e;n++)!function(e){t._points[e].addEventListener("click",function(){t._binder.dispatchEvent(kt.CHART_CLICKED,e)})}(n);t._binder.dispatchEvent(kt.CHART_READY,e)}),!this.isVisible())){var e=new MutationObserver(function(){t.isVisible()&&(t._targetEl.__chartist__.update(),e.disconnect())});e.observe(this._targetEl.parentNode,{attributes:!0})}}},{key:"isVisible",value:function(){return this._targetEl&&this._targetEl.parentNode&&"block"===this._targetEl.parentNode.style.display}},{key:"handleEvent",value:function(t,e){if(t.type===kt.TRACK_READY)this._data=e.plotData,this.render();else if(t.type===kt.UI_READY)this._targetEl=e.chart;else if(t.type===kt.MARKER_OVER){var n=e;n?this.pointOver(n):this.pointOut()}else if(t.type===kt.MARKER_SELECT){var i=e;i?this.pointSelect(i):this.pointUnselect()}}},{key:"pointOver",value:function(t){this.isVisible()&&this._points[t].classList.add("ct-point-hilight")}},{key:"pointOut",value:function(){this._targetEl.querySelectorAll(".ct-point-hilight").forEach(function(t){return t.classList.remove("ct-point-hilight")})}},{key:"pointSelect",value:function(t){this.isVisible()&&this._points[t].classList.add("ct-point-selected")}},{key:"pointUnselect",value:function(){this._targetEl.querySelectorAll(".ct-point-selected").forEach(function(t){return t.classList.remove("ct-point-selected")})}},{key:"data",get:function(){return this._data}}],[{key:"onDomLoaded",value:function(){yt.addScript("js/lib/chartist.min.js","chartist_js",function(){yt.addScript("js/lib/chartist-plugin-axistitle.min.js","chartist_axistitle_js")}),yt.addCss("css/chartist.min.css","chartist_css")}}]),t}(),jt=function(){function t(e){var n=this;(function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")})(this,t),this._binder=e,e.addEventListener(kt.CONFIG,this),e.addEventListener(kt.CHART_READY,this),e.addEventListener(kt.OPEN_URL,this),e.addEventListener(kt.LOADER,this),e.addEventListener(kt.TRACK_READY,this),document.addEventListener("DOMContentLoaded",function(){n.initUI()}),this.isLiveOn=!1}return function(t,e,n){e&&V(t.prototype,e),n&&V(t,n)}(t,[{key:"initUI",value:function(){var e=this;this.menu=document.getElementById("menu"),this.userMenu=document.getElementById("user-menu"),this.userDropdown=document.getElementById("user-dropdown"),this.userPass=document.getElementById("user-pass"),this.userSelect=function(){var t=document.getElementsByName("user");return t.length?t[0]:null}(),this.trackSelect=document.getElementsByName("track")[0],this.apiSelect=document.getElementsByName("api")[0],this.langSelect=document.getElementsByName("lang")[0],this.unitsSelect=document.getElementsByName("units")[0],this.chart=document.getElementById("chart"),this.chartClose=document.getElementById("chart-close"),this.bottom=document.getElementById("bottom"),this.chartLink=document.getElementById("altitudes"),this.main=document.getElementById("main"),this.menuClose=document.getElementById("menu-close"),this.track=document.getElementById("track"),this.trackTitle=document.querySelector('label[for="track"]'),this.importTitle=document.getElementById("import")||null,this.summary=document.getElementById("summary"),this.latest=document.getElementById("latest"),this.autoReload=document.getElementById("auto-reload"),this.forceReload=document.getElementById("force-reload"),this.interval=document.getElementById("interval"),this.setInterval=document.getElementById("set-interval"),this.exportKml=document.getElementById("export-kml"),this.exportGpx=document.getElementById("export-gpx"),this.inputFile=document.getElementById("input-file"),this.importGpx=document.getElementById("import-gpx"),this.addUser=document.getElementById("adduser"),this.editUser=document.getElementById("edituser"),this.editTrack=document.getElementById("edittrack"),this.map=document.getElementById("map-canvas"),this.head=document.getElementsByTagName("head")[0],this.userMenu&&(this.userMenu.onclick=function(){return e.showUserMenu()}),this.userPass&&(this.userPass.onclick=function(){e.emit(kt.PASSWORD)}),this.hideUserMenu=this.hideUserMenu.bind(this),this.latest.onchange=function(){return t.toggleLatest()},this.autoReload.onchange=function(){return e.toggleAutoReload()},this.setInterval.onclick=function(){return e.setAutoReloadTime()},this.forceReload.onclick=function(){return e.trackReload()},this.chartLink.onclick=function(){return e.toggleChart()},this.trackSelect.onchange=function(){var t=e.trackSelect.options[e.trackSelect.selectedIndex].value;e.emit(kt.CHANGE,{el:e.trackSelect,id:t})},this.userSelect.onchange=function(){var t=e.userSelect.options[e.userSelect.selectedIndex].value;e.emit(kt.CHANGE,{el:e.userSelect,id:t})},this.apiSelect.onchange=function(){var t=e.apiSelect.options[e.apiSelect.selectedIndex].value;e.emit(kt.API_CHANGE,t)},this.langSelect.onchange=function(){t.setLang(e.langSelect.options[e.langSelect.selectedIndex].value)},this.unitsSelect.onchange=function(){t.setUnits(e.unitsSelect.options[e.unitsSelect.selectedIndex].value)},this.exportKml.onclick=function(){e.emit(kt.EXPORT,"kml")},this.exportGpx.onclick=function(){e.emit(kt.EXPORT,"gpx")},this.inputFile&&(this.inputFile.onchange=function(){var t=e.inputFile.parentElement,n=t.elements.MAX_FILE_SIZE.value;return e.inputFile.files&&1===e.inputFile.files.length&&e.inputFile.files[0].size>n?void alert(yt.sprintf(Ct.strings.isizefailure,n)):void e.emit(kt.IMPORT,t)},this.importGpx.onclick=function(){e.inputFile.click()}),this.addUser&&(this.addUser.onclick=function(){e.emit(kt.ADD,e.userSelect)}),this.editUser&&(this.editUser.onclick=function(){e.emit(kt.EDIT,e.userSelect)}),this.editTrack&&(this.editTrack.onclick=function(){e.emit(kt.EDIT,e.trackSelect)}),this.menuClose.onclick=function(){return e.toggleSideMenu()},this.chartClose.onclick=function(){return e.hideChart()},this.emit(kt.UI_READY)}},{key:"trackReload",value:function(){t.emitDom(this.trackSelect,"change")}},{key:"userReload",value:function(){t.emitDom(this.userSelect,"change")}},{key:"toggleAutoReload",value:function(){this.isLiveOn?this.stopAutoReload():this.startAutoReload()}},{key:"startAutoReload",value:function(){var t=this;this.isLiveOn=!0,this.liveInterval=setInterval(function(){t.trackReload()},1e3*At.interval)}},{key:"stopAutoReload",value:function(){this.isLiveOn=!1,clearInterval(this.liveInterval)}},{key:"setAutoReloadTime",value:function(){var t=parseInt(prompt(Ct.strings.newinterval));isNaN(t)||t===At.interval||(At.interval=t,this.interval.innerHTML=At.interval.toString(),this.isLiveOn&&(this.stopAutoReload(),this.startAutoReload()),yt.setCookie("interval",At.interval,30))}},{key:"toggleSideMenu",value:function(){"»"===this.menuClose.innerHTML?(this.menu.style.width="0",this.main.style.marginRight="0",this.menuClose.style.right="0",this.menuClose.innerHTML="«"):(this.menu.style.width="165px",this.main.style.marginRight="165px",this.menuClose.style.right="165px",this.menuClose.innerHTML="»"),t.emitDom(window,"resize")}},{key:"emit",value:function(t,e){var n=e||this;this._binder.dispatchEvent(t,n)}},{key:"isChartVisible",value:function(){return"block"===this.bottom.style.display}},{key:"showChart",value:function(){this.bottom.style.display="block"}},{key:"hideChart",value:function(){this.bottom.style.display="none"}},{key:"toggleChart",value:function(){this.isChartVisible()?this.hideChart():this.showChart()}},{key:"updateSummary",value:function(t,e,n){if(At.showLatest){var i=new Date,o=new Date(1e3*t),r="";o.toDateString()!==i.toDateString()&&(r="".concat(o.getFullYear(),"-").concat("0".concat(o.getMonth()+1).slice(-2),"-").concat("0".concat(o.getDate()).slice(-2),"<br>"));var a,s=o.toTimeString();0<=(a=s.indexOf(" "))&&(s="".concat(s.substr(0,a),' <span style="font-weight:normal">').concat(s.substr(a+1),"</span>")),this.summary.innerHTML='\n <div class="menu-title">'.concat(Ct.strings.latest,":</div>\n ").concat(r,"\n ").concat(s)}else this.summary.innerHTML='\n <div class="menu-title">'.concat(Ct.strings.summary,'</div>\n <div><img class="icon" alt="').concat(Ct.strings.tdistance,'" title="').concat(Ct.strings.tdistance,'" src="images/distance.svg"> ').concat((e.toKm()*At.factor_km).toFixed(2)," ").concat(At.unit_km,'</div>\n <div><img class="icon" alt="').concat(Ct.strings.ttime,'" title="').concat(Ct.strings.ttime,'" src="images/time.svg"> ').concat(n.toHMS(),"</div>")}},{key:"clearMapCanvas",value:function(){this.map.innerHTML=""}},{key:"showUserMenu",value:function(){"block"===this.userDropdown.style.display?this.userDropdown.style.display="none":(this.userDropdown.style.display="block",window.addEventListener("click",this.hideUserMenu,!0))}},{key:"hideUserMenu",value:function(t){var e=t.target.parentElement;this.userDropdown.style.display="none",window.removeEventListener("click",this.hideUserMenu,!0),e.classList.contains("dropdown")||t.stopPropagation()}},{key:"handleEvent",value:function(e,n){if(e.type===kt.CHART_READY)this.chartLink.style.visibility=0<n?"visible":"hidden";else if(e.type===kt.TRACK_READY){var i=n;if(i.hasPositions){var o=i.positions[i.positions.length-1];this.updateSummary(o.timestamp,o.totalDistance,o.totalSeconds)}}else if(e.type===kt.OPEN_URL)window.location.assign(n);else if(e.type===kt.CONFIG)"showLatest"===n&&(this.latest.checked=At.showLatest);else if(e.type===kt.LOADER){var r="track"===n.action?this.trackTitle:this.importTitle;n.on?t.setLoader(r):t.removeLoader(r)}}}],[{key:"emitDom",value:function(t,e){t.dispatchEvent(new Event(e))}},{key:"setLoader",value:function(t){var e=t.textContent;t.innerHTML="";var n=!0,i=!1,o=void 0;try{for(var r,a,s=e[Symbol.iterator]();!(n=(r=s.next()).done);n=!0)a=r.value,t.innerHTML+='<span class="loader">'.concat(a,"</span>")}catch(t){i=!0,o=t}finally{try{n||null==s.return||s.return()}finally{if(i)throw o}}}},{key:"removeLoader",value:function(t){t.innerHTML=t.textContent}},{key:"getPopupHtml",value:function(t){var e=re.trackList.current.positions[t],n=re.trackList.current.positions.length,i="",o="";if(0<e.timestamp){var r=yt.getTimeString(new Date(1e3*e.timestamp));i=r.date,o="".concat(r.time,'<span class="smaller">').concat(r.zone,"</span>")}var a="";"gps"===e.provider?a=' (<img class="icon" alt="'.concat(Ct.strings.gps,'" title="').concat(Ct.strings.gps,'" src="images/gps_dark.svg">)'):"network"===e.provider&&(a=' (<img class="icon" alt="'.concat(Ct.strings.network,'" title="').concat(Ct.strings.network,'" src="images/network_dark.svg">)'));var s="";return At.showLatest||(s='<div id="pright">\n <img class="icon" alt="'.concat(Ct.strings.track,'" src="images/stats_blue.svg" style="padding-left: 3em;"><br>\n <img class="icon" alt="').concat(Ct.strings.ttime,'" title="').concat(Ct.strings.ttime,'" src="images/time_blue.svg"> ').concat(e.totalSeconds.toHMS(),'<br>\n <img class="icon" alt="').concat(Ct.strings.aspeed,'" title="').concat(Ct.strings.aspeed,'" src="images/speed_blue.svg"> ').concat(0<e.totalSeconds?((e.totalDistance/e.totalSeconds).toKmH()*At.factor_kmh).toFixed():0," ").concat(At.unit_kmh,'<br>\n <img class="icon" alt="').concat(Ct.strings.tdistance,'" title="').concat(Ct.strings.tdistance,'" src="images/distance_blue.svg"> ').concat((e.totalDistance.toKm()*At.factor_km).toFixed(2)," ").concat(At.unit_km,"<br>\n </div>")),'<div id="popup">\n <div id="pheader">\n <div><img alt="'.concat(Ct.strings.user,'" title="').concat(Ct.strings.user,'" src="images/user_dark.svg"> ').concat(yt.htmlEncode(e.username),'</div>\n <div><img alt="').concat(Ct.strings.track,'" title="').concat(Ct.strings.track,'" src="images/route_dark.svg"> ').concat(yt.htmlEncode(e.trackname),'</div>\n </div>\n <div id="pbody">\n ').concat(e.hasComment()?'<div id="pcomments">'.concat(yt.htmlEncode(e.comment),"</div>"):"","\n ").concat(e.hasImage()?'<div id="pimage"><img src="uploads/'.concat(e.image,'" alt="image"></div>'):"",'\n <div id="pleft">\n <img class="icon" alt="').concat(Ct.strings.time,'" title="').concat(Ct.strings.time,'" src="images/calendar_dark.svg"> ').concat(i,'<br>\n <img class="icon" alt="').concat(Ct.strings.time,'" title="').concat(Ct.strings.time,'" src="images/clock_dark.svg"> ').concat(o,"<br>\n ").concat(null==e.speed?"":'<img class="icon" alt="'.concat(Ct.strings.speed,'" title="').concat(Ct.strings.speed,'" src="images/speed_dark.svg">').concat(e.speed.toKmH()*At.factor_kmh," ").concat(At.unit_kmh,"<br>"),"\n ").concat(null==e.altitude?"":'<img class="icon" alt="'.concat(Ct.strings.altitude,'" title="').concat(Ct.strings.altitude,'" src="images/altitude_dark.svg">').concat((e.altitude*At.factor_m).toFixed()," ").concat(At.unit_m,"<br>"),"\n ").concat(null==e.accuracy?"":'<img class="icon" alt="'.concat(Ct.strings.accuracy,'" title="').concat(Ct.strings.accuracy,'" src="images/accuracy_dark.svg">').concat((e.accuracy*At.factor_m).toFixed()," ").concat(At.unit_m).concat(a,"<br>"),"\n </div>").concat(s,'</div>\n <div id="pfooter">').concat(yt.sprintf(Ct.strings.pointof,t+1,n),"</div>\n </div>")}},{key:"removeElementById",value:function(t){var e=document.getElementById(t);e&&e.parentNode&&e.parentNode.removeChild(e)}},{key:"setLang",value:function(e){yt.setCookie("lang",e,30),t.reload()}},{key:"setUnits",value:function(e){yt.setCookie("units",e,30),t.reload()}},{key:"reload",value:function(){window.location.reload()}},{key:"toggleLatest",value:function(){At.showLatest=!At.showLatest}},{key:"getMarkerPath",value:function(t){return t?"M15,34.911c0,0,0.359-3.922,1.807-8.588c0.414-1.337,1.011-2.587,2.495-4.159c1.152-1.223,3.073-2.393,3.909-4.447c1.681-6.306-3.676-9.258-8.211-9.258c-4.536,0-9.893,2.952-8.211,9.258c0.836,2.055,2.756,3.225,3.91,4.447c1.484,1.572,2.08,2.822,2.495,4.159C14.64,30.989,15,34.911,15,34.911z M18,15.922c0,1.705-1.342,3.087-2.999,3.087c-1.657,0-3-1.382-3-3.087c0-1.704,1.343-3.086,3-3.086C16.658,12.836,18,14.218,18,15.922z":"M14.999,34.911c0,0,0.232-1.275,1.162-4.848c0.268-1.023,0.652-1.98,1.605-3.184c0.742-0.937,1.975-1.832,2.514-3.404c1.082-4.828-2.363-7.088-5.281-7.088c-2.915,0-6.361,2.26-5.278,7.088c0.538,1.572,1.771,2.468,2.514,3.404c0.953,1.203,1.337,2.16,1.604,3.184C14.77,33.635,14.999,34.911,14.999,34.911z"}},{key:"getMarkerExtra",value:function(t){var e=t?"M28.232,10.942":"M25.486,18.141";return'<path fill="none" stroke="red" stroke-width="2" d="'.concat(t?"M26.074,13.517":"M23.328,20.715",'c0-3.961-3.243-7.167-7.251-7.167"/>\n <path fill="none" stroke="red" stroke-width="2" d="').concat(e,'c-0.5-4.028-3.642-7.083-7.724-7.542"/>')}},{key:"getSvgSrc",value:function(e,n,i){var o='<svg viewBox="0 0 30 35" width="30px" height="35px" xmlns="http://www.w3.org/2000/svg">\n <g><path stroke="black" fill="'.concat(e,'" d="').concat(t.getMarkerPath(n),'"/>').concat(i?t.getMarkerExtra(n):"","</g></svg>");return"data:image/svg+xml,".concat(encodeURIComponent(o))}}]),t}(),Bt=null,Ht=null,Ft=[],Ut=[],Vt=[],Kt=null,Gt=null,qt=null,zt=0,Yt="gmaps",Xt=!1,Wt=!1;window.gm_authFailure=function(){Wt=!0;var t=yt.sprintf(Ct.strings.apifailure,"Google Maps");t+="<br><br>"+Ct.strings.gmauthfailure,t+="<br><br>"+Ct.strings.gmapilink,jt.resolveModal(t)},window.gm_loaded=function(){Xt=!0};var Zt=null,Jt=null,Qt=null,$t=null,te=null,ee={},ne="openlayers",ie=null,oe=function(){function t(e){(function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")})(this,t),e.addEventListener(kt.API_CHANGE,this),e.addEventListener(kt.CHART_CLICKED,this),e.addEventListener(kt.TRACK_READY,this),e.addEventListener(kt.UI_READY,this),this.loadTime=0,this.savedBounds=null,this.api=null,this.mapElement=null,this.lastTrackId=null,this._binder=e,this.track=null}return function(t,e,n){e&&dt(t.prototype,e),n&&dt(t,n)}(t,[{key:"loadMapAPI",value:function(t){if(t){At.mapapi=t;try{this.savedBounds=this.api.getBounds()}catch(t){this.savedBounds=null}this.api.cleanup()}this.api="gmaps"===At.mapapi?pt:mt,this.waitAndInit()}},{key:"waitAndInit",value:function(){var t=this;if(1e4<this.loadTime)return this.loadTime=0,void alert(yt.sprintf(Ct.strings.apifailure,At.mapapi));try{this.api.init(this._binder,this.mapElement)}catch(e){return void setTimeout(function(){t.loadTime+=50,t.waitAndInit()},50)}this.loadTime=0,this.savedBounds&&this.api.zoomToBounds(this.savedBounds),re.trackList.onChange(),yt.setCookie("api",At.mapapi,30)}},{key:"handleEvent",value:function(t,e){if(t.type===kt.TRACK_READY){var n=e;this.api.clearMap();var i=n.id!==this.lastTrackId;this.api.displayTrack(n,i),this.lastTrackId=n.id}else t.type===kt.UI_READY?(this.mapElement=e.map,this.loadMapAPI()):t.type===kt.API_CHANGE?this.loadMapAPI(e):t.type===kt.CHART_CLICKED&&this.api.animateMarker(e)}}]),t}();n.d(e,"uLogger",function(){return re});var re={userList:null,trackList:null},ae=new Nt;ae.addEventListener(kt.PASSWORD,Tt),At.binder=ae,new oe(ae),new Dt(ae),new jt(ae),document.addEventListener("DOMContentLoaded",function(){re.userList=new Mt("#user",ae),re.trackList=new Pt("#track",ae)})}]);