FitTrackee/fittrackee/dist/static/js/workouts.c0f5bb2b.js

2 lines
74 KiB
JavaScript
Raw Normal View History

2022-03-20 21:17:33 +01:00
(self["webpackChunkfittrackee_client"]=self["webpackChunkfittrackee_client"]||[]).push([[401],{7520:function(t,e){!function(t,o){o(e)}(0,(function(t){"use strict";function e(t){return t&&t.normalize&&t.normalize(),t&&t.textContent||""}function o(t,e){const o=t.getElementsByTagName(e);return o.length?o[0]:null}function a(t){const a={};if(t){const n=o(t,"line");if(n){const t=e(o(n,"color")),l=parseFloat(e(o(n,"opacity"))),r=parseFloat(e(o(n,"width")));t&&(a.stroke=t),isNaN(l)||(a["stroke-opacity"]=l),isNaN(r)||(a["stroke-width"]=96*r/25.4)}}return a}function n(t,a){const n={};let l,r;for(r=0;r<a.length;r++)l=o(t,a[r]),l&&(n[a[r]]=e(l));return n}function l(t){const o=n(t,["name","cmt","desc","type","time","keywords"]),a=t.getElementsByTagNameNS("http://www.garmin.com/xmlschemas/GpxExtensions/v3","*");for(let n=0;n<a.length;n++){const l=a[n];l.parentNode.parentNode===t&&(o[l.tagName.replace(":","_")]=e(l))}const l=t.getElementsByTagName("link");l.length&&(o.links=[]);for(let e=0;e<l.length;e++)o.links.push(Object.assign({href:l[e].getAttribute("href")},n(l[e],["text","type"])));return o}function r(t){const a=[parseFloat(t.getAttribute("lon")),parseFloat(t.getAttribute("lat"))],n=o(t,"ele"),l=o(t,"gpxtpx:hr")||o(t,"hr"),r=o(t,"time");let s;n&&(s=parseFloat(e(n)),isNaN(s)||a.push(s));const i={coordinates:a,time:r?e(r):null,extendedValues:[]};l&&i.extendedValues.push(["heart",parseFloat(e(l))]);const u=o(t,"extensions");if(null!==u)for(const d of["speed","course","hAcc","vAcc"]){const t=parseFloat(e(o(u,d)));isNaN(t)||i.extendedValues.push([d,t])}return i}function s(t){const e=i(t,"rtept");if(e)return{type:"Feature",properties:Object.assign(l(t),a(o(t,"extensions")),{_gpxType:"rte"}),geometry:{type:"LineString",coordinates:e.line}}}function i(t,e){const o=t.getElementsByTagName(e);if(o.length<2)return;const a=[],n=[],l={};for(let s=0;s<o.length;s++){const t=r(o[s]);a.push(t.coordinates),t.time&&n.push(t.time);for(let e=0;e<t.extendedValues.length;e++){const[a,n]=t.extendedValues[e],r="heart"===a?a:a+"s";l[r]||(l[r]=Array(o.length).fill(null)),l[r][s]=n}}return{line:a,times:n,extendedValues:l}}function u(t){const e=t.getElementsByTagName("trkseg"),n=[],r=[],s=[];for(let o=0;o<e.length;o++){const t=i(e[o],"trkpt");t&&(s.push(t),t.times&&t.times.length&&r.push(t.times))}if(0===s.length)return;const u=s.length>1,d=Object.assign(l(t),a(o(t,"extensions")),{_gpxType:"trk"},r.length?{coordinateProperties:{times:u?r:r[0]}}:{});for(let o=0;o<s.length;o++){const t=s[o];n.push(t.line);for(const[e,a]of Object.entries(t.extendedValues)){let t=d;"heart"===e&&(d.coordinateProperties||(d.coordinateProperties={}),t=d.coordinateProperties),u?(t[e]||(t[e]=s.map((t=>new Array(t.line.length).fill(null)))),t[e][o]=a):t[e]=a}}return{type:"Feature",properties:d,geometry:u?{type:"MultiLineString",coordinates:n}:{type:"LineString",coordinates:n[0]}}}function*d(t){const e=t.getElementsByTagName("trk"),o=t.getElementsByTagName("rte"),a=t.getElementsByTagName("wpt");for(let n=0;n<e.length;n++){const t=u(e[n]);t&&(yield t)}for(let n=0;n<o.length;n++){const t=s(o[n]);t&&(yield t)}for(let s=0;s<a.length;s++)yield(i=a[s],{type:"Feature",properties:Object.assign(l(i),n(i,["sym"])),geometry:{type:"Point",coordinates:r(i).coordinates}});var i}const c=[["heartRate","heartRates"],["Cadence","cadences"],["Speed","speeds"],["Watts","watts"]],p=[["TotalTimeSeconds","totalTimeSeconds"],["DistanceMeters","distanceMeters"],["MaximumSpeed","maxSpeed"],["AverageHeartRateBpm","avgHeartRate"],["MaximumHeartRateBpm","maxHeartRate"],["AvgSpeed","avgSpeed"],["AvgWatts","avgWatts"],["MaxWatts","maxWatts"]];function m(t,a){const n=[];for(const[l,r]of a){let a=o(t,l);if(!a){const e=t.getElementsByTagNameNS("http://www.garmin.com/xmlschemas/ActivityExtension/v2",l);e.length&&(a=e[0])}const s=parseFloat(e(a));isNaN(s)||n.push([r,s])}return n}function w(t){const a=e(o(t,"LongitudeDegrees")),n=e(o(t,"LatitudeDegrees"));if(!a.length||!n.length)return null;const l=[parseFloat(a),parseFloat(n)],r=o(t,"AltitudeMeters"),s=o(t,"HeartRateBpm"),i=o(t,"Time");let u;return r&&(u=parseFloat(e(r)
2022-03-26 18:30:46 +01:00
//# sourceMappingURL=workouts.c0f5bb2b.js.map