!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/g,">")}},{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 '),e="\n \n \n ');break;case"edit":t="update",n='
'.concat(yt.sprintf(Ct.strings.editinguser,"".concat(yt.htmlEncode(this.user.login),"")),'
\n \n
'),e="\n \n \n ');break;case"pass":t="update",e="\n \n \n \n \n ');break;default:throw new Error("Unknown dialog type: ".concat(this.type))}return"".concat(n,'\n
\n ').concat(i,"\n ").concat(e,'\n
\n \n \n
\n
")}},{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='
'.concat(yt.sprintf(Ct.strings.editingtrack,"".concat(yt.htmlEncode(this.track.name),"")),'
\n \n
\n
\n \n \n
\n \n \n
\n
");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");1n?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),"
"));var a,s=o.toTimeString();0<=(a=s.indexOf(" "))&&(s="".concat(s.substr(0,a),' ').concat(s.substr(a+1),"")),this.summary.innerHTML='\n \n ").concat(r,"\n ").concat(s)}else this.summary.innerHTML='\n \n
').concat(Ct.strings.tdistance,' ').concat((e.toKm()*At.factor_km).toFixed(2)," ").concat(At.unit_km,'
\n
').concat(Ct.strings.ttime,' ').concat(n.toHMS(),"
")}},{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'.concat(a,"")}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').concat(r.zone,"")}var a="";"gps"===e.provider?a=' ('.concat(Ct.strings.gps,')'):"network"===e.provider&&(a=' ('.concat(Ct.strings.network,')'));var s="";return At.showLatest||(s='
\n '.concat(Ct.strings.track,'
\n ').concat(Ct.strings.ttime,' ').concat(e.totalSeconds.toHMS(),'
\n ').concat(Ct.strings.aspeed,' ').concat(0\n ').concat(Ct.strings.tdistance,' ').concat((e.totalDistance.toKm()*At.factor_km).toFixed(2)," ").concat(At.unit_km,"
\n
")),'")}},{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'\n ')}},{key:"getSvgSrc",value:function(e,n,i){var o='\n ').concat(i?t.getMarkerExtra(n):"","");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+="

"+Ct.strings.gmauthfailure,t+="

"+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