ulogger-server/js/bundle.js
2019-07-27 19:38:00 +02:00

1 line
67 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 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 h(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"!==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 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 L(t){return(L=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function A(t,e){return(A=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function S(t){return(S="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 P(t){return(P="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 x(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 N(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function M(t,e){return(M=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){Bt=t;var n="//maps.googleapis.com/maps/api/js?"+(null==At.gkey?"":"key="+At.gkey+"&")+"callback=gm_loaded";if(gt.addScript(n,"mapapi_gmaps"),!Xt)throw new Error("Google Maps API not ready");!function(t){zt?window.gm_authFailure():(google.maps.visualRefresh=!0,Kt={strokeColor:At.strokeColor,strokeOpacity:At.strokeOpacity,strokeWeight:At.strokeWeight},Gt={center:new google.maps.LatLng(At.init_latitude,At.init_longitude),zoom:8,mapTypeId:google.maps.MapTypeId.ROADMAP,scaleControl:!0},jt=new google.maps.Map(t,Gt))}(e)}function G(){Ht.length=0,Ft.length=0,Ut.length=0,Kt=null,Gt=null,Vt=null,jt&&jt.getDiv()&&(jt.getDiv().innerHTML=""),jt=null}function q(t,e){if(t){var n=new google.maps.Polyline(Kt);n.setMap(jt);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 f=new google.maps.LatLng(u.latitude,u.longitude);t.continuous&&i.push(f),o.extend(f)}}catch(t){s=!0,c=t}finally{try{a||null==d.return||d.return()}finally{if(s)throw c}}if(e&&(jt.fitBounds(o),1==r)){var h=google.maps.event.addListenerOnce(jt,"bounds_changed",function(){this.getZoom()&&this.setZoom(15)});setTimeout(function(){google.maps.event.removeListener(h)},2e3)}Ht.push(n)}}function Y(){for(var t=0;t<Ht.length;t++)Ht[t].setMap(null);for(var e=0;e<Ft.length;e++)google.maps.event.clearInstanceListeners(Ut[e]),Ut[e].setMap(null),Ft[e].setMap(null);Ft.length=0,Ht.length=0,Ut.length=0}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:jt});At.showLatest?o.setIcon("images/marker-red.png"):0===t?o.setIcon("images/marker-green.png"):t===i-1?o.setIcon("images/marker-red.png"):n.hasComment()||n.hasImage()?o.setIcon("images/marker-gray.png"):o.setIcon("images/marker-white.png");var r=new google.maps.InfoWindow;o.addListener("click",function(t){return function(){r.setContent(Dt.getPopupHtml(t)),r.open(jt,o),Bt.dispatchEvent(vt.MARKER_SELECT,t),Vt=r,r.addListener("closeclick",function(){Bt.dispatchEvent(vt.MARKER_SELECT),google.maps.event.clearListeners(r,"closeclick"),Vt=null})}}(t)),o.addListener("mouseover",function(t){return function(){Bt.dispatchEvent(vt.MARKER_OVER,t)}}(t)),o.addListener("mouseout",function(){Bt.dispatchEvent(vt.MARKER_OVER)}),Ft.push(o),Ut.push(r)}function z(t){Vt&&(Vt.close(),clearTimeout(qt));var e=Ft[t].getIcon();Ft[t].setIcon("images/marker-gold.png"),Ft[t].setAnimation(google.maps.Animation.BOUNCE),qt=setTimeout(function(){Ft[t].setIcon(e),Ft[t].setAnimation(null)},2e3)}function W(){var t=jt.getBounds(),e=t.getSouthWest().lat(),n=t.getSouthWest().lng(),i=t.getNorthEast().lat();return[n,e,t.getNorthEast().lng(),i]}function Z(){for(var t,e=new google.maps.LatLngBounds,n=0;n<Ft.length;n++)t=new google.maps.LatLng(Ft[n].position.lat(),Ft[n].position.lng()),e.extend(t);jt.fitBounds(e)}function J(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);jt.fitBounds(i)}function Q(){}function $(t,e){Zt=t,gt.addScript("//cdn.polyfill.io/v2/polyfill.min.js?features=requestAnimationFrame,Element.prototype.classList","mapapi_openlayers_polyfill"),gt.addScript("js/lib/ol.js","mapapi_openlayers"),gt.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:lt()})],i=new ol.View({center:ol.proj.fromLonLat([At.init_longitude,At.init_latitude]),zoom:8});(Wt=new ol.Map({target:e,controls:n,view:i})).on("pointermove",function(t){var e=Wt.forEachFeatureAtPixel(t.pixel,function(t,e){return"Markers"===e.get("name")?t:null}),n=e?e.getId():null;n!==ne&&(Zt.dispatchEvent(vt.MARKER_OVER),ne=n,n&&Zt.dispatchEvent(vt.MARKER_OVER,n)),Wt.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 Wt.addLayer(t),$t=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})});Wt.addLayer(i)}var o=new ol.style.Style({stroke:new ol.style.Stroke({color:gt.hexToRGBA(At.strokeColor,At.strokeOpacity),width:At.strokeWeight})});Jt=new ol.layer.Vector({name:"Track",type:"data",source:new ol.source.Vector,style:o}),Qt=new ol.layer.Vector({name:"Markers",type:"data",source:new ol.source.Vector}),Wt.addLayer(Jt),Wt.addLayer(Qt),function(){function t(){var t=this.value;Wt.getLayers().forEach(function(e){e.get("name")===t&&("data"===e.get("type")?e.getVisible()?e.setVisible(!1):e.setVisible(!0):($t.setVisible(!1),$t=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),Wt.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});Wt.addControl(s)}()}(),function(){te={};var t=new ol.style.Icon({anchor:[.5,1],src:"images/marker-red.png"}),e=new ol.style.Icon({anchor:[.5,1],src:"images/marker-green.png"}),n=new ol.style.Icon({anchor:[.5,1],opacity:.7,src:"images/marker-white.png"}),i=new ol.style.Icon({anchor:[.5,1],src:"images/marker-gray.png"}),o=new ol.style.Icon({anchor:[.5,1],src:"images/marker-gold.png"});te.red=new ol.style.Style({image:t}),te.green=new ol.style.Style({image:e}),te.white=new ol.style.Style({image:n}),te.gray=new ol.style.Style({image:i}),te.gold=new ol.style.Style({image:o})}(),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},Wt.on("click",function(t){var e=t.coordinate,o=Wt.forEachFeatureAtPixel(t.pixel,function(t,e){return"Markers"===e.get("name")?t:null});o?(i.setPosition(e),n.innerHTML=Dt.getPopupHtml(o.getId()),Wt.addOverlay(i),Zt.dispatchEvent(vt.MARKER_SELECT,o.getId())):(i.setPosition(void 0),Zt.dispatchEvent(vt.MARKER_SELECT))})}()}function tt(){Jt=null,Qt=null,$t=null,te=null,Dt.removeElementById("popup"),Dt.removeElementById("switcher"),Wt&&Wt.getTargetElement()&&(Wt.getTargetElement().innerHTML=""),Wt=null}function et(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,it(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});Jt.getSource().addFeature(u)}var d=Qt.getSource().getExtent();if(Wt.getControls().forEach(function(t){t instanceof ol.control.ZoomToExtent&&Wt.removeControl(t)}),e)Wt.getView().fit(d),20<Wt.getView().getZoom()&&(Wt.getView().setZoom(20),d=Wt.getView().calculateExtent(Wt.getSize()));var f=new ol.control.ZoomToExtent({extent:d,label:lt()});Wt.addControl(f)}}function nt(){Jt&&Jt.getSource().clear(),Qt&&Qt.getSource().clear()}function it(t,e){var n,i=e.positions[t],o=e.positions.length,r=new ol.Feature({geometry:new ol.geom.Point(ol.proj.fromLonLat([i.longitude,i.latitude]))});n=At.showLatest?te.red:0===t?te.green:t===o-1?te.red:i.hasComment()||i.hasImage()?te.gray:te.white,r.setStyle(n),r.setId(t),Qt.getSource().addFeature(r)}function ot(t){var e=Qt.getSource().getFeatureById(t),n=e.getStyle(),i=te.gold;e.setStyle(i),setTimeout(function(){return e.setStyle(n)},2e3)}function rt(){var t=Wt.getView().calculateExtent(Wt.getSize()),e=ol.proj.transformExtent(t,"EPSG:900913","EPSG:4326");return[e[0],e[1],e[2],e[3]]}function at(){Wt.getView().fit(Qt.getSource().getExtent())}function st(t){var e=ol.proj.transformExtent(t,"EPSG:4326","EPSG:900913");Wt.getView().fit(e)}function ct(){Wt.updateSize()}function lt(){var t=document.createElement("img");return t.src="images/extent.svg",t.style.width="60%",t}function ut(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 dt=Math.round,ft=Number.prototype;n.r(e);var ht={};n.r(ht),n.d(ht,"name",function(){return Yt}),n.d(ht,"init",function(){return K}),n.d(ht,"cleanup",function(){return G}),n.d(ht,"displayTrack",function(){return q}),n.d(ht,"clearMap",function(){return Y}),n.d(ht,"animateMarker",function(){return z}),n.d(ht,"getBounds",function(){return W}),n.d(ht,"zoomToExtent",function(){return Z}),n.d(ht,"zoomToBounds",function(){return J}),n.d(ht,"updateSize",function(){return Q});var pt={};n.r(pt),n.d(pt,"name",function(){return ee}),n.d(pt,"init",function(){return $}),n.d(pt,"cleanup",function(){return tt}),n.d(pt,"displayTrack",function(){return et}),n.d(pt,"clearMap",function(){return nt}),n.d(pt,"animateMarker",function(){return ot}),n.d(pt,"getBounds",function(){return rt}),n.d(pt,"zoomToExtent",function(){return at}),n.d(pt,"zoomToBounds",function(){return st}),n.d(pt,"updateSize",function(){return ct});var mt=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",St.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,f=e[Symbol.iterator]();!(s=(u=f.next()).done);s=!0)d=u.value,a.append(d)}catch(t){c=!0,l=t}finally{try{s||null==f.return||f.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}(),gt=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 dt(this/10)/100},ft.toKmH=function(){return dt(3600*this/10)/100};var yt=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 mt(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(St.strings.username,'</b></label>\n <input type="text" placeholder="').concat(St.strings.usernameenter,'" name="login" required>'),e="<label><b>".concat(St.strings.password,'</b></label>\n <input type="password" placeholder="').concat(St.strings.passwordenter,'" name="pass" required>\n <label><b>').concat(St.strings.passwordrepeat,'</b></label>\n <input type="password" placeholder="').concat(St.strings.passwordenter,'" name="pass2" required>');break;case"edit":t="update",n='<div style="float:left">'.concat(gt.sprintf(St.strings.editinguser,"<b>".concat(gt.htmlEncode(this.user.login),"</b>")),'</div>\n <div class="red-button button-resolve" data-action="delete" data-confirm="').concat(gt.sprintf(St.strings.userdelwarn,gt.htmlEncode(this.user.login)),'"><b><a>').concat(St.strings.deluser,'</a></b></div>\n <div style="clear: both; padding-bottom: 1em;"></div>'),e="<label><b>".concat(St.strings.password,'</b></label>\n <input type="password" placeholder="').concat(St.strings.passwordenter,'" name="pass" required>\n <label><b>').concat(St.strings.passwordrepeat,'</b></label>\n <input type="password" placeholder="').concat(St.strings.passwordenter,'" name="pass2" required>');break;case"pass":t="update",e="<label><b>".concat(St.strings.oldpassword,'</b></label>\n <input type="password" placeholder="').concat(St.strings.passwordenter,'" name="oldpass" required>\n <label><b>').concat(St.strings.newpassword,'</b></label>\n <input type="password" placeholder="').concat(St.strings.passwordenter,'" name="pass" required>\n <label><b>').concat(St.strings.newpasswordrepeat,'</b></label>\n <input type="password" placeholder="').concat(St.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(St.strings.cancel,'</button>\n <button class="button-resolve" type="submit" data-action="').concat(t,'">').concat(St.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(St.strings.allrequired),!1}else if("pass"===this.type){if(!this.form.elements.oldpass.value.trim())return alert(St.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(St.strings.passlenmin+"\n"+St.strings.passrules),!1):(alert(St.strings.passnotmatch),!1):(alert(St.strings.allrequired),!1)}}]),t}(),vt=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}(),kt=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===vt.PASSWORD&&this.isAuthenticated&&this.changePassword()}},{key:"changePassword",value:function(t){var e=this,n=t||new yt("pass",this.user);n.show().then(function(t){return e.user.changePass(t.data.password,t.data.oldPassword)}).then(function(){alert(St.strings.actionsuccess),n.hide()}).catch(function(t){alert("".concat(St.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}(),bt=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&&l(t.prototype,e),n&&l(t,n)}(t,[{key:"notify",value:function(t){this._binder&&this._binder.dispatchEvent(vt.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}},{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},set:function(t){this._factor_kmh=t}},{key:"unit_kmh",get:function(){return this._unit_kmh},set:function(t){this._unit_kmh=t}},{key:"factor_m",get:function(){return this._factor_m},set:function(t){this._factor_m=t}},{key:"unit_m",get:function(){return this._unit_m},set:function(t){this._unit_m=t}},{key:"factor_km",get:function(){return this._factor_km},set:function(t){this._factor_km=t}},{key:"unit_km",get:function(){return this._unit_km},set:function(t){this._unit_km=t}},{key:"showLatest",get:function(){return this._showLatest},set:function(t){this._showLatest!==t&&(this._showLatest=t,this.notify("showLatest"))}}]),t}(),wt=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"!==gt.getNode(o[0],"error"))n&&"function"==typeof n&&n(i),e=!1;else if(o.length){var s=gt.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}(),Et=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}(),_t=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,Et),function(t,e,n){e&&h(t.prototype,e),n&&h(t,n)}(e,[{key:"update",value:function(t){var e=this,n=this.password;return delete this.password,wt.post("utils/handleuser.php",{action:t,login:this.login,pass:n}).then(function(n){return"add"===t&&(e.id=gt.getNodeAsInt(n,"userid")),e})}},{key:"changePass",value:function(t,e){return wt.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 kt;var e=t.getElementsByTagName("auth");if(e.length&&1===gt.getNodeAsInt(e[0],"isAuthenticated")){var n=gt.getNodeAsInt(e[0],"userId"),i=gt.getNode(e[0],"userLogin");this.auth.user=new _t(n,i),this.auth.isAdmin=1===gt.getNodeAsInt(e[0],"isAdmin")}}},{key:"initLang",value:function(t){var e=t.getElementsByTagName("lang");e.length&&(this.lang.strings=gt.getNodesArray(e[0],"strings"))}},{key:"initConfig",value:function(t){this.config=new bt;var e=t.getElementsByTagName("config");if(e.length){this.config.interval=gt.getNodeAsInt(e[0],"interval"),this.config.units=gt.getNode(e[0],"units"),this.config.mapapi=gt.getNode(e[0],"mapapi"),this.config.gkey=gt.getNode(e[0],"gkey"),this.config.ol_layers=gt.getNodesArray(e[0],"ol_layers"),this.config.init_latitude=gt.getNodeAsFloat(e[0],"init_latitude"),this.config.init_longitude=gt.getNodeAsFloat(e[0],"init_longitude");var n=gt.getNode(e[0],"pass_regex");this.config.pass_regex=new RegExp(n.substr(1,n.length-2)),this.config.strokeWeight=gt.getNodeAsInt(e[0],"strokeWeight"),this.config.strokeColor=gt.getNode(e[0],"strokeColor"),this.config.strokeOpacity=gt.getNodeAsInt(e[0],"strokeOpacity"),this.config.factor_kmh=1,this.config.unit_kmh="km/h",this.config.factor_m=1,this.config.unit_m="m",this.config.factor_km=1,this.config.unit_km="km","imperial"===this.config.units?(this.config.factor_kmh=.62,this.config.unit_kmh="mph",this.config.factor_m=3.28,this.config.unit_m="ft",this.config.factor_km=.62,this.config.unit_km="mi"):"nautical"===this.config.units&&(this.config.factor_kmh=.54,this.config.unit_kmh="kt",this.config.factor_m=1,this.config.unit_m="m",this.config.factor_km=.54,this.config.unit_km="nm"),this.config.showLatest=!1}}}],[{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,St=Lt.lang,Ct=Lt.auth,Tt=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(gt.sprintf(St.strings.editingtrack,"<b>".concat(gt.htmlEncode(this.track.name),"</b>")),'</div>\n <div class="red-button button-resolve" data-action="delete" data-confirm="').concat(gt.sprintf(St.strings.trackdelwarn,gt.htmlEncode(this.track.name)),'"><b><a>').concat(St.strings.deltrack,'</a></b></div>\n <div style="clear: both; padding-bottom: 1em;"></div>\n <form id="trackForm">\n <label><b>').concat(St.strings.trackname,'</b></label>\n <input type="text" placeholder="').concat(St.strings.trackname,'" name="trackname" value="').concat(gt.htmlEncode(this.track.name),'" required>\n <div class="buttons">\n <button class="button-reject" type="button">').concat(St.strings.cancel,'</button>\n <button class="button-resolve" type="submit" data-action="update">').concat(St.strings.submit,"</button>\n </div>\n </form>");this.dialog=new mt(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(St.strings.allrequired),1))}}]),t}(),Ot=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||Et,this.domElement=document.querySelector(e),this.binder&&(this.binder.addEventListener(vt.ADD,this),this.binder.addEventListener(vt.CHANGE,this),this.binder.addEventListener(vt.CONFIG,this),this.binder.addEventListener(vt.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(gt.getNodeAsInt(c,e),gt.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===vt.CHANGE&&e.el===this.domElement?(this.selectedId=e.id,this.onChange()):t.type===vt.EDIT&&e===this.domElement?this.onEdit():t.type===vt.ADD&&e===this.domElement?this.onAdd():t.type===vt.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}(),It=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=gt.getAttributeAsInt(e,"id"),n.latitude=gt.getNodeAsFloat(e,"latitude"),n.longitude=gt.getNodeAsFloat(e,"longitude"),n.altitude=gt.getNodeAsInt(e,"altitude"),n.speed=gt.getNodeAsInt(e,"speed"),n.bearing=gt.getNodeAsInt(e,"bearing"),n.accuracy=gt.getNodeAsInt(e,"accuracy"),n.provider=gt.getNode(e,"provider"),n.comment=gt.getNode(e,"comment"),n.image=gt.getNode(e,"image"),n.username=gt.getNode(e,"username"),n.trackname=gt.getNode(e,"trackname"),n.trackid=gt.getNodeAsInt(e,"trackid"),n.timestamp=gt.getNodeAsInt(e,"timestamp"),n.distance=gt.getNodeAsInt(e,"distance"),n.seconds=gt.getNodeAsInt(e,"seconds"),n.totalDistance=0,n.totalSeconds=0,n}}]),t}(),Rt=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,L(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&&A(t,e)}(e,Et),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 f=It.fromXml(t);o+=f.distance,r+=f.seconds,f.totalDistance=o,f.totalSeconds=r,n.push(f),null!=f.altitude&&i.push({x:f.totalDistance,y:f.altitude*At.factor_m}),f.id>this._maxId&&(this._maxId=f.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),wt.get("utils/getpositions.php",e).then(function(e){return t.fromXml(e,n),t.render(),e})}},{key:"update",value:function(t){return wt.post("utils/handletrack.php",{action:t,trackid:this.id,trackname:this.name})}},{key:"render",value:function(){this.emit(vt.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(vt.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"!==S(e)&&"function"!=typeof e?T(t):e}(this,I(e).call(this,t,n,Rt)),n&&(i.binder.addEventListener(vt.EXPORT,T(i)),i.binder.addEventListener(vt.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,Ot),function(t,e,n){e&&C(t.prototype,e),n&&C(t,n)}(e,[{key:"updateDataRow",value:function(t){t.user=oe.userList.current}},{key:"handleEvent",value:function(t,n){t.type===vt.CHANGE&&(At.showLatest=!1),O(I(e.prototype),"handleEvent",this).call(this,t,n),t.type===vt.EXPORT?this.current.export(n):t.type===vt.IMPORT&&this.import(n).catch(function(t){return alert("".concat(St.strings.actionfailure,"\n").concat(t))})}},{key:"import",value:function(t){var e=this;return this.emit(!0,"import"),wt.post("utils/import.php",t).then(function(t){var n=t.getElementsByTagName("root"),i=gt.getNodeAsInt(n[0],"trackcnt");1<i&&alert(gt.sprintf(St.strings.imultiple,i));var o=gt.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(St.strings.actionfailure,"\n").concat(t))})}},{key:"emit",value:function(t,e){this.binder.dispatchEvent(vt.LOADER,{on:t,action:e})}},{key:"fetch",value:function(){var t=this;return this.emit(!0,"track"),wt.get("utils/gettracks.php",{userid:oe.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(St.strings.actionfailure,"\n").concat(e))})}},{key:"fetchLatest",value:function(){var t=this;this.emit(!0,"track");var e={last:1},n=oe.userList.isSelectedAllOption;return n||(e.userid=oe.userList.current.id),wt.get("utils/getpositions.php",e).then(function(e){if(n){t.clear();var i=new Rt(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=It.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(St.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(St.strings.actionfailure,"\n").concat(e))}))}},{key:"onEdit",value:function(){if(this.current){if(this.current.user.login!==Ct.user.login&&!Ct.isAdmin)return void alert(St.strings.owntrackswarn);this.editTrack()}}},{key:"editTrack",value:function(t){var e=this,n=t||new Tt(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(St.strings.actionsuccess),n.hide()}).catch(function(t){alert("".concat(St.strings.actionfailure,"\n").concat(t)),e.editTrack(n)})}},{key:"onAdd",value:function(){}}]),e}(),xt=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"!==P(e)&&"function"!=typeof e?N(t):e}(this,B(e).call(this,t,n,_t)),j(B(e.prototype),"hasHead",!0,N(i),!0),j(B(e.prototype),"allValue","- ".concat(St.strings.allusers," -"),N(i),!0),j(B(e.prototype),"headValue",St.strings.suser,N(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&&M(t,e)}(e,Ot),function(t,e,n){e&&x(t.prototype,e),n&&x(t,n)}(e,[{key:"onChange",value:function(){At.showLatest?this.isSelectedAllOption?oe.trackList.fetchLatest():oe.trackList.fetch().then(function(){return oe.trackList.fetchLatest()}):oe.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===Ct.user.login)return void alert(St.strings.selfeditwarn);this.editUser()}}},{key:"editUser",value:function(t){var e=this,n=t||new yt("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(St.strings.actionsuccess),n.hide()}).catch(function(t){alert("".concat(St.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 yt("add");n.show().then(function(t){var e=new _t(0,t.data.login);return e.password=t.data.password,e.update("add")}).then(function(t){alert(St.strings.actionsuccess),e.add(t),n.hide()}).catch(function(t){alert("".concat(St.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 vt(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(){Mt.onDomLoaded()});var Mt=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(vt.MARKER_OVER,this),e.addEventListener(vt.MARKER_SELECT,this),e.addEventListener(vt.TRACK_READY,this),e.addEventListener(vt.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(St.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(vt.CHART_CLICKED,e)})}(n);t._binder.dispatchEvent(vt.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===vt.TRACK_READY)this._data=e.plotData,this.render();else if(t.type===vt.UI_READY)this._targetEl=e.chart;else if(t.type===vt.MARKER_OVER){var n=e;n?this.pointOver(n):this.pointOut()}else if(t.type===vt.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(){gt.addScript("js/lib/chartist.min.js","chartist_js",function(){gt.addScript("js/lib/chartist-plugin-axistitle.min.js","chartist_axistitle_js")}),gt.addCss("css/chartist.min.css","chartist_css")}}]),t}(),Dt=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(vt.CONFIG,this),e.addEventListener(vt.CHART_READY,this),e.addEventListener(vt.OPEN_URL,this),e.addEventListener(vt.LOADER,this),e.addEventListener(vt.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(vt.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(vt.CHANGE,{el:e.trackSelect,id:t})},this.userSelect.onchange=function(){var t=e.userSelect.options[e.userSelect.selectedIndex].value;e.emit(vt.CHANGE,{el:e.userSelect,id:t})},this.apiSelect.onchange=function(){var t=e.apiSelect.options[e.apiSelect.selectedIndex].value;e.emit(vt.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(vt.EXPORT,"kml")},this.exportGpx.onclick=function(){e.emit(vt.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(gt.sprintf(St.strings.isizefailure,n)):void e.emit(vt.IMPORT,t)},this.importGpx.onclick=function(){e.inputFile.click()}),this.addUser&&(this.addUser.onclick=function(){e.emit(vt.ADD,e.userSelect)}),this.editUser&&(this.editUser.onclick=function(){e.emit(vt.EDIT,e.userSelect)}),this.editTrack&&(this.editTrack.onclick=function(){e.emit(vt.EDIT,e.trackSelect)}),this.menuClose.onclick=function(){return e.toggleSideMenu()},this.chartClose.onclick=function(){return e.hideChart()},this.emit(vt.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(St.strings.newinterval));isNaN(t)||t===At.interval||(At.interval=t,this.interval.innerHTML=At.interval.toString(),this.isLiveOn&&(this.stopAutoReload(),this.startAutoReload()),gt.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(St.strings.latest,":</div>\n ").concat(r,"\n ").concat(s)}else this.summary.innerHTML='\n <div class="menu-title">'.concat(St.strings.summary,'</div>\n <div><img class="icon" alt="').concat(St.strings.tdistance,'" title="').concat(St.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(St.strings.ttime,'" title="').concat(St.strings.ttime,'" src="images/time.svg"> ').concat(n.toHMS(),"</div>")}},{key:"clearMapCanvas",value:function(){this.map.innerHTML=""}},{key:"showUserMenu",value:function(){this.userDropdown.classList.contains("show")?this.userDropdown.classList.remove("show"):(this.userDropdown.classList.add("show"),window.addEventListener("click",this.hideUserMenu,!0))}},{key:"hideUserMenu",value:function(t){var e=t.target.parentElement;this.userDropdown.classList.remove("show"),window.removeEventListener("click",this.hideUserMenu,!0),e.classList.contains("dropdown")||t.stopPropagation()}},{key:"handleEvent",value:function(e,n){if(e.type===vt.CHART_READY)this.chartLink.style.visibility=0<n?"visible":"hidden";else if(e.type===vt.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===vt.OPEN_URL)window.location.assign(n);else if(e.type===vt.CONFIG)"showLatest"===n&&(this.latest.checked=At.showLatest);else if(e.type===vt.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=oe.trackList.current.positions[t],n=oe.trackList.current.positions.length,i="",o="";if(0<e.timestamp){var r=gt.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(St.strings.gps,'" title="').concat(St.strings.gps,'" src="images/gps_dark.svg">)'):"network"===e.provider&&(a=' (<img class="icon" alt="'.concat(St.strings.network,'" title="').concat(St.strings.network,'" src="images/network_dark.svg">)'));var s="";return At.showLatest||(s='<div id="pright">\n <img class="icon" alt="'.concat(St.strings.track,'" src="images/stats_blue.svg" style="padding-left: 3em;"><br>\n <img class="icon" alt="').concat(St.strings.ttime,'" title="').concat(St.strings.ttime,'" src="images/time_blue.svg"> ').concat(e.totalSeconds.toHMS(),'<br>\n <img class="icon" alt="').concat(St.strings.aspeed,'" title="').concat(St.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(St.strings.tdistance,'" title="').concat(St.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(St.strings.user,'" title="').concat(St.strings.user,'" src="images/user_dark.svg"> ').concat(gt.htmlEncode(e.username),'</div>\n <div><img alt="').concat(St.strings.track,'" title="').concat(St.strings.track,'" src="images/route_dark.svg"> ').concat(gt.htmlEncode(e.trackname),'</div>\n </div>\n <div id="pbody">\n ').concat(e.hasComment()?'<div id="pcomments">'.concat(gt.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(St.strings.time,'" title="').concat(St.strings.time,'" src="images/calendar_dark.svg"> ').concat(i,'<br>\n <img class="icon" alt="').concat(St.strings.time,'" title="').concat(St.strings.time,'" src="images/clock_dark.svg"> ').concat(o,"<br>\n ").concat(null==e.speed?"":'<img class="icon" alt="'.concat(St.strings.speed,'" title="').concat(St.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(St.strings.altitude,'" title="').concat(St.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(St.strings.accuracy,'" title="').concat(St.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(gt.sprintf(St.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){gt.setCookie("lang",e,30),t.reload()}},{key:"setUnits",value:function(e){gt.setCookie("units",e,30),t.reload()}},{key:"reload",value:function(){window.location.reload()}},{key:"toggleLatest",value:function(){At.showLatest=!At.showLatest}}]),t}(),jt=null,Bt=null,Ht=[],Ft=[],Ut=[],Vt=null,Kt=null,Gt=null,qt=0,Yt="gmaps",Xt=!1,zt=!1;window.gm_authFailure=function(){zt=!0;var t=gt.sprintf(St.strings.apifailure,"Google Maps");t+="<br><br>"+St.strings.gmauthfailure,t+="<br><br>"+St.strings.gmapilink,Dt.resolveModal(t)},window.gm_loaded=function(){Xt=!0};var Wt=null,Zt=null,Jt=null,Qt=null,$t=null,te={},ee="openlayers",ne=null,ie=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(vt.API_CHANGE,this),e.addEventListener(vt.CHART_CLICKED,this),e.addEventListener(vt.TRACK_READY,this),e.addEventListener(vt.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&&ut(t.prototype,e),n&&ut(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?ht:pt,this.waitAndInit()}},{key:"waitAndInit",value:function(){var t=this;if(1e4<this.loadTime)return this.loadTime=0,void alert(gt.sprintf(St.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),oe.trackList.onChange(),gt.setCookie("api",At.mapapi,30)}},{key:"handleEvent",value:function(t,e){if(t.type===vt.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===vt.UI_READY?(this.mapElement=e.map,this.loadMapAPI()):t.type===vt.API_CHANGE?this.loadMapAPI(e):t.type===vt.CHART_CLICKED&&this.api.animateMarker(e)}}]),t}();n.d(e,"uLogger",function(){return oe});var oe={userList:null,trackList:null},re=new Nt;re.addEventListener(vt.PASSWORD,Ct),At.binder=re,new ie(re),new Mt(re),new Dt(re),document.addEventListener("DOMContentLoaded",function(){oe.userList=new xt("#user",re),oe.trackList=new Pt("#track",re)})}]);