rpg-westreiche/RPG/.obsidian/plugins/obsidian-leaflet-plugin/main.js

3 lines
1.5 MiB
JavaScript
Raw Normal View History

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