@loaders.gl/kml 3.1.0-alpha.3 → 3.1.0-alpha.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/dist.min.js CHANGED
@@ -1,2 +1,2 @@
1
- !function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var n=t();for(var o in n)("object"==typeof exports?exports:e)[o]=n[o]}}(window,(function(){return function(e){var t={};function n(o){if(t[o])return t[o].exports;var r=t[o]={i:o,l:!1,exports:{}};return e[o].call(r.exports,r,r.exports,n),r.l=!0,r.exports}return n.m=e,n.c=t,n.d=function(e,t,o){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:o})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var o=Object.create(null);if(n.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)n.d(o,r,function(t){return e[t]}.bind(null,r));return o},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=2)}([function(e,t,n){!function(e){"use strict";function t(e){return e&&e.normalize&&e.normalize(),e&&e.textContent||""}function n(e,t){const n=e.getElementsByTagName(t);return n.length?n[0]:null}function o(e){const o={};if(e){const r=n(e,"line");if(r){const e=t(n(r,"color")),i=parseFloat(t(n(r,"opacity"))),s=parseFloat(t(n(r,"width")));e&&(o.stroke=e),isNaN(i)||(o["stroke-opacity"]=i),isNaN(s)||(o["stroke-width"]=96*s/25.4)}}return o}function r(e,o){const r={};let i,s;for(s=0;s<o.length;s++)i=n(e,o[s]),i&&(r[o[s]]=t(i));return r}function i(e){const n=r(e,["name","cmt","desc","type","time","keywords"]),o=e.getElementsByTagNameNS("http://www.garmin.com/xmlschemas/GpxExtensions/v3","*");for(let r=0;r<o.length;r++){const i=o[r];i.parentNode.parentNode===e&&(n[i.tagName.replace(":","_")]=t(i))}const i=e.getElementsByTagName("link");i.length&&(n.links=[]);for(let e=0;e<i.length;e++)n.links.push(Object.assign({href:i[e].getAttribute("href")},r(i[e],["text","type"])));return n}function s(e){const o=[parseFloat(e.getAttribute("lon")),parseFloat(e.getAttribute("lat"))],r=n(e,"ele"),i=n(e,"gpxtpx:hr")||n(e,"hr"),s=n(e,"time");let a;r&&(a=parseFloat(t(r)),isNaN(a)||o.push(a));const l={coordinates:o,time:s?t(s):null,extendedValues:[]};i&&l.extendedValues.push(["heart",parseFloat(t(i))]);const c=n(e,"extensions");if(null!==c)for(const e of["speed","course","hAcc","vAcc"]){const o=parseFloat(t(n(c,e)));isNaN(o)||l.extendedValues.push([e,o])}return l}function a(e){const t=l(e,"rtept");if(t)return{type:"Feature",properties:Object.assign(i(e),o(n(e,"extensions")),{_gpxType:"rte"}),geometry:{type:"LineString",coordinates:t.line}}}function l(e,t){const n=e.getElementsByTagName(t);if(n.length<2)return;const o=[],r=[],i={};for(let e=0;e<n.length;e++){const t=s(n[e]);o.push(t.coordinates),t.time&&r.push(t.time);for(let o=0;o<t.extendedValues.length;o++){const[r,s]=t.extendedValues[o],a="heart"===r?r:r+"s";i[a]||(i[a]=Array(n.length).fill(null)),i[a][e]=s}}return{line:o,times:r,extendedValues:i}}function c(e){const t=e.getElementsByTagName("trkseg"),r=[],s=[],a=[];for(let e=0;e<t.length;e++){const n=l(t[e],"trkpt");n&&(a.push(n),n.times&&n.times.length&&s.push(n.times))}if(0===a.length)return;const c=a.length>1,u=Object.assign(i(e),o(n(e,"extensions")),{_gpxType:"trk"},s.length?{coordinateProperties:{times:c?s:s[0]}}:{});for(let e=0;e<a.length;e++){const t=a[e];r.push(t.line);for(const[n,o]of Object.entries(t.extendedValues)){let t=u;"heart"===n&&(u.coordinateProperties||(u.coordinateProperties={}),t=u.coordinateProperties),c?(t[n]||(t[n]=a.map(e=>new Array(e.line.length).fill(null))),t[n][e]=o):t[n]=o}}return{type:"Feature",properties:u,geometry:c?{type:"MultiLineString",coordinates:r}:{type:"LineString",coordinates:r[0]}}}function*u(e){const t=e.getElementsByTagName("trk"),n=e.getElementsByTagName("rte"),o=e.getElementsByTagName("wpt");for(let e=0;e<t.length;e++){const n=c(t[e]);n&&(yield n)}for(let e=0;e<n.length;e++){const t=a(n[e]);t&&(yield t)}for(let e=0;e<o.length;e++)yield(l=o[e],{type:"Feature",properties:Object.assign(i(l),r(l,["sym"])),geometry:{type:"Point",coordinates:s(l).coordinates}});var l}const p=[["heartRate","heartRates"],["Cadence","cadences"],["Speed","speeds"],["Watts","watts"]],g=[["TotalTimeSeconds","totalTimeSeconds"],["DistanceMeters","distanceMeters"],["MaximumSpeed","maxSpeed"],["AverageHeartRateBpm","avgHeartRate"],["MaximumHeartRateBpm","maxHeartRate"],["AvgSpeed","avgSpeed"],["AvgWatts","avgWatts"],["MaxWatts","maxWatts"]];function d(e,o){const r=[];for(const[i,s]of o){let o=n(e,i);if(!o){const t=e.getElementsByTagNameNS("http://www.garmin.com/xmlschemas/ActivityExtension/v2",i);t.length&&(o=t[0])}const a=parseFloat(t(o));isNaN(a)||r.push([s,a])}return r}function f(e){const o=t(n(e,"LongitudeDegrees")),r=t(n(e,"LatitudeDegrees"));if(!o.length||!r.length)return null;const i=[parseFloat(o),parseFloat(r)],s=n(e,"AltitudeMeters"),a=n(e,"HeartRateBpm"),l=n(e,"Time");let c;return s&&(c=parseFloat(t(s)),isNaN(c)||i.push(c)),{coordinates:i,time:l?t(l):null,heartRate:a?parseFloat(t(a)):null,extensions:d(e,p)}}function y(e,t){const n=e.getElementsByTagName(t),o=[],r=[],i=[];if(n.length<2)return null;const s={extendedProperties:{}};for(let e=0;e<n.length;e++){const t=f(n[e]);if(null!==t){o.push(t.coordinates),t.time&&r.push(t.time),t.heartRate&&i.push(t.heartRate);for(const[o,r]of t.extensions)s.extendedProperties[o]||(s.extendedProperties[o]=Array(n.length).fill(null)),s.extendedProperties[o][e]=r}}return Object.assign(s,{line:o,times:r,heartRates:i})}function m(e){const o=e.getElementsByTagName("Track"),r=[],i=[],s=[],a=[];let l;const c=function(e){const t={};for(const[n,o]of e)t[n]=o;return t}(d(e,g)),u=n(e,"Name");u&&(c.name=t(u));for(let e=0;e<o.length;e++)l=y(o[e],"Trackpoint"),l&&(r.push(l.line),l.times.length&&i.push(l.times),l.heartRates.length&&s.push(l.heartRates),a.push(l.extendedProperties));for(let e=0;e<a.length;e++){const t=a[e];for(const n in t)1===o.length?c[n]=l.extendedProperties[n]:(c[n]||(c[n]=r.map(e=>Array(e.length).fill(null))),c[n][e]=t[n])}if(0!==r.length)return(i.length||s.length)&&(c.coordinateProperties=Object.assign(i.length?{times:1===r.length?i[0]:i}:{},s.length?{heart:1===r.length?s[0]:s}:{})),{type:"Feature",properties:c,geometry:{type:1===r.length?"LineString":"MultiLineString",coordinates:1===r.length?r[0]:r}}}function*h(e){const t=e.getElementsByTagName("Lap");for(let e=0;e<t.length;e++){const n=m(t[e]);n&&(yield n)}const n=e.getElementsByTagName("Courses");for(let e=0;e<n.length;e++){const t=m(n[e]);t&&(yield t)}}const b=/\s*/g,x=/^\s*|\s*$/g,P=/\s+/;function w(e){if(!e||!e.length)return 0;let t=0;for(let n=0;n<e.length;n++)t=(t<<5)-t+e.charCodeAt(n)|0;return t}function v(e){return e.replace(b,"").split(",").map(parseFloat)}function T(e){return e.replace(x,"").split(P).map(v)}function F(e){if(void 0!==e.xml)return e.xml;if(e.tagName){let t=e.tagName;for(let n=0;n<e.attributes.length;n++)t+=e.attributes[n].name+e.attributes[n].value;for(let n=0;n<e.childNodes.length;n++)t+=F(e.childNodes[n]);return t}return"#text"===e.nodeName?(e.nodeValue||e.value||"").trim():"#cdata-section"===e.nodeName?e.nodeValue:""}const k=["Polygon","LineString","Point","Track","gx:Track"];function A(e,o,r){let i=t(n(o,"color"))||"";const s="stroke"==r||"fill"===r?r:r+"-color";"#"===i.substr(0,1)&&(i=i.substr(1)),6===i.length||3===i.length?e[s]=i:8===i.length&&(e[r+"-opacity"]=parseInt(i.substr(0,2),16)/255,e[s]="#"+i.substr(6,2)+i.substr(4,2)+i.substr(2,2))}function N(e,o,r,i){const s=parseFloat(t(n(o,r)));isNaN(s)||(e[i]=s)}function S(e){let n=e.getElementsByTagName("coord");const o=[],r=[];0===n.length&&(n=e.getElementsByTagName("gx:coord"));for(let e=0;e<n.length;e++)o.push(t(n[e]).split(" ").map(parseFloat));const i=e.getElementsByTagName("when");for(let e=0;e<i.length;e++)r.push(t(i[e]));return{coords:o,times:r}}function I(e,o,r,i){const s=function e(o){let r,i,s,a,l;const c=[],u=[];if(n(o,"MultiGeometry"))return e(n(o,"MultiGeometry"));if(n(o,"MultiTrack"))return e(n(o,"MultiTrack"));if(n(o,"gx:MultiTrack"))return e(n(o,"gx:MultiTrack"));for(s=0;s<k.length;s++)if(i=o.getElementsByTagName(k[s]),i)for(a=0;a<i.length;a++)if(r=i[a],"Point"===k[s])c.push({type:"Point",coordinates:v(t(n(r,"coordinates")))});else if("LineString"===k[s])c.push({type:"LineString",coordinates:T(t(n(r,"coordinates")))});else if("Polygon"===k[s]){const e=r.getElementsByTagName("LinearRing"),o=[];for(l=0;l<e.length;l++)o.push(T(t(n(e[l],"coordinates"))));c.push({type:"Polygon",coordinates:o})}else if("Track"===k[s]||"gx:Track"===k[s]){const e=S(r);c.push({type:"LineString",coordinates:e.coords}),e.times.length&&u.push(e.times)}return{geoms:c,coordTimes:u}}(e);let a;const l={},c=t(n(e,"name")),u=t(n(e,"address"));let p=t(n(e,"styleUrl"));const g=t(n(e,"description")),d=n(e,"TimeSpan"),f=n(e,"TimeStamp"),y=n(e,"ExtendedData");let m=n(e,"IconStyle"),h=n(e,"LabelStyle"),b=n(e,"LineStyle"),x=n(e,"PolyStyle");const P=n(e,"visibility");if(c&&(l.name=c),u&&(l.address=u),p){"#"!==p[0]&&(p="#"+p),l.styleUrl=p,o[p]&&(l.styleHash=o[p]),r[p]&&(l.styleMapHash=r[p],l.styleHash=o[r[p].normal]);const e=i[l.styleHash];e&&(m||(m=n(e,"IconStyle")),h||(h=n(e,"LabelStyle")),b||(b=n(e,"LineStyle")),x||(x=n(e,"PolyStyle")))}if(g&&(l.description=g),d){const e=t(n(d,"begin")),o=t(n(d,"end"));l.timespan={begin:e,end:o}}if(f&&(l.timestamp=t(n(f,"when"))),m){A(l,m,"icon"),N(l,m,"scale","icon-scale"),N(l,m,"heading","icon-heading");const e=n(m,"hotSpot");if(e){const t=parseFloat(e.getAttribute("x")),n=parseFloat(e.getAttribute("y"));isNaN(t)||isNaN(n)||(l["icon-offset"]=[t,n])}const o=n(m,"Icon");if(o){const e=t(n(o,"href"));e&&(l.icon=e)}}if(h&&(A(l,h,"label"),N(l,h,"scale","label-scale")),b&&(A(l,b,"stroke"),N(l,b,"width","stroke-width")),x){A(l,x,"fill");const e=t(n(x,"fill")),o=t(n(x,"outline"));e&&(l["fill-opacity"]="1"===e?l["fill-opacity"]||1:0),o&&(l["stroke-opacity"]="1"===o?l["stroke-opacity"]||1:0)}if(y){const e=y.getElementsByTagName("Data"),o=y.getElementsByTagName("SimpleData");for(a=0;a<e.length;a++)l[e[a].getAttribute("name")]=t(n(e[a],"value"));for(a=0;a<o.length;a++)l[o[a].getAttribute("name")]=t(o[a])}P&&(l.visibility=t(P)),s.coordTimes.length&&(l.coordinateProperties={times:1===s.coordTimes.length?s.coordTimes[0]:s.coordTimes});const w={type:"Feature",geometry:0===s.geoms.length?null:1===s.geoms.length?s.geoms[0]:{type:"GeometryCollection",geometries:s.geoms},properties:l};return e.getAttribute("id")&&(w.id=e.getAttribute("id")),w}function*j(e){const o={},r={},i={},s=e.getElementsByTagName("Placemark"),a=e.getElementsByTagName("Style"),l=e.getElementsByTagName("StyleMap");for(let e=0;e<a.length;e++){const t=w(F(a[e])).toString(16);o["#"+a[e].getAttribute("id")]=t,r[t]=a[e]}for(let e=0;e<l.length;e++){o["#"+l[e].getAttribute("id")]=w(F(l[e])).toString(16);const r=l[e].getElementsByTagName("Pair"),s={};for(let e=0;e<r.length;e++)s[t(n(r[e],"key"))]=t(n(r[e],"styleUrl"));i["#"+l[e].getAttribute("id")]=s}for(let e=0;e<s.length;e++){const t=I(s[e],o,i,r);t&&(yield t)}}e.gpx=function(e){return{type:"FeatureCollection",features:Array.from(u(e))}},e.gpxGen=u,e.kml=function(e){return{type:"FeatureCollection",features:Array.from(j(e))}},e.kmlGen=j,e.tcx=function(e){return{type:"FeatureCollection",features:Array.from(h(e))}},e.tcxGen=h,Object.defineProperty(e,"__esModule",{value:!0})}(t)},,function(e,t,n){const o=n(3);globalThis.loaders=globalThis.loaders||{},e.exports=Object.assign(globalThis.loaders,o)},function(e,t,n){"use strict";function o(e,t={}){const n=r(e);return i(e,n,{coordLength:t.coordLength||n.coordLength,numericPropKeys:t.numericPropKeys||n.numericPropKeys,PositionDataType:t.PositionDataType||Float32Array})}n.r(t),n.d(t,"GPXLoader",(function(){return h})),n.d(t,"KMLLoader",(function(){return x})),n.d(t,"TCXLoader",(function(){return w}));function r(e){let t=0,n=0,o=0,r=0,i=0,s=0,a=0,l=0,c=0;const u=new Set,p={};for(const d of e){const e=d.geometry;switch(e.type){case"Point":n++,t++,u.add(e.coordinates.length);break;case"MultiPoint":n++,t+=e.coordinates.length;for(const t of e.coordinates)u.add(t.length);break;case"LineString":i++,o+=e.coordinates.length,r++;for(const t of e.coordinates)u.add(t.length);break;case"MultiLineString":i++;for(const t of e.coordinates){o+=t.length,r++;for(const e of t)u.add(e.length)}break;case"Polygon":c++,a++,l+=e.coordinates.length,s+=y(e.coordinates).length;for(const t of y(e.coordinates))u.add(t.length);break;case"MultiPolygon":c++;for(const t of e.coordinates){a++,l+=t.length,s+=y(t).length;for(const e of y(t))u.add(e.length)}break;default:throw new Error("Unsupported geometry type: "+e.type)}if(d.properties)for(const e in d.properties){const t=d.properties[e];p[e]=p[e]||void 0===p[e]?(g=t,Number.isFinite(g)):p[e]}}var g;return{coordLength:u.size>0?Math.max(...u):2,pointPositionsCount:t,pointFeaturesCount:n,linePositionsCount:o,linePathsCount:r,lineFeaturesCount:i,polygonPositionsCount:s,polygonObjectsCount:a,polygonRingsCount:l,polygonFeaturesCount:c,numericPropKeys:Object.keys(p).filter(e=>p[e])}}function i(e,t,n){const{pointPositionsCount:o,pointFeaturesCount:r,linePositionsCount:i,linePathsCount:g,lineFeaturesCount:f,polygonPositionsCount:y,polygonObjectsCount:m,polygonRingsCount:h,polygonFeaturesCount:b}=t,{coordLength:x,numericPropKeys:P,PositionDataType:w=Float32Array}=n,v=e.length>65535?Uint32Array:Uint16Array,T={positions:new w(o*x),globalFeatureIds:new v(o),featureIds:r>65535?new Uint32Array(o):new Uint16Array(o),numericProps:{},properties:Array(),fields:Array()},F={positions:new w(i*x),pathIndices:i>65535?new Uint32Array(g+1):new Uint16Array(g+1),globalFeatureIds:new v(i),featureIds:f>65535?new Uint32Array(i):new Uint16Array(i),numericProps:{},properties:Array(),fields:Array()},k={positions:new w(y*x),polygonIndices:y>65535?new Uint32Array(m+1):new Uint16Array(m+1),primitivePolygonIndices:y>65535?new Uint32Array(h+1):new Uint16Array(h+1),globalFeatureIds:new v(y),featureIds:b>65535?new Uint32Array(y):new Uint16Array(y),numericProps:{},properties:Array(),fields:Array()};for(const e of[T,F,k])for(const t of P||[])e.numericProps[t]=new Float32Array(e.positions.length/x);F.pathIndices[g]=i,k.polygonIndices[m]=y,k.primitivePolygonIndices[h]=y;const A={pointPosition:0,pointFeature:0,linePosition:0,linePath:0,lineFeature:0,polygonPosition:0,polygonObject:0,polygonRing:0,polygonFeature:0,feature:0};for(const t of e){const e=t.geometry,n=t.properties||{};switch(e.type){case"Point":s(e.coordinates,T,A,x,n),T.properties.push(d(n,P)),A.pointFeature++;break;case"MultiPoint":a(e.coordinates,T,A,x,n),T.properties.push(d(n,P)),A.pointFeature++;break;case"LineString":l(e.coordinates,F,A,x,n),F.properties.push(d(n,P)),A.lineFeature++;break;case"MultiLineString":c(e.coordinates,F,A,x,n),F.properties.push(d(n,P)),A.lineFeature++;break;case"Polygon":u(e.coordinates,k,A,x,n),k.properties.push(d(n,P)),A.polygonFeature++;break;case"MultiPolygon":p(e.coordinates,k,A,x,n),k.properties.push(d(n,P)),A.polygonFeature++;break;default:throw new Error("Invalid geometry type")}A.feature++}return function(e,t,n,o){const r={points:{...e,positions:{value:e.positions,size:o},globalFeatureIds:{value:e.globalFeatureIds,size:1},featureIds:{value:e.featureIds,size:1},type:"Point"},lines:{...t,pathIndices:{value:t.pathIndices,size:1},positions:{value:t.positions,size:o},globalFeatureIds:{value:t.globalFeatureIds,size:1},featureIds:{value:t.featureIds,size:1},type:"LineString"},polygons:{...n,polygonIndices:{value:n.polygonIndices,size:1},primitivePolygonIndices:{value:n.primitivePolygonIndices,size:1},positions:{value:n.positions,size:o},globalFeatureIds:{value:n.globalFeatureIds,size:1},featureIds:{value:n.featureIds,size:1},type:"Polygon"}};for(const e in r)for(const t in r[e].numericProps)r[e].numericProps[t]={value:r[e].numericProps[t],size:1};return r}(T,F,k,x)}function s(e,t,n,o,r){t.positions.set(e,n.pointPosition*o),t.globalFeatureIds[n.pointPosition]=n.feature,t.featureIds[n.pointPosition]=n.pointFeature,g(t,r,n.pointPosition,1),n.pointPosition++}function a(e,t,n,o,r){for(const i of e)s(i,t,n,o,r)}function l(e,t,n,o,r){t.pathIndices[n.linePath]=n.linePosition,n.linePath++,f(t.positions,e,n.linePosition,o);const i=e.length;g(t,r,n.linePosition,i),t.globalFeatureIds.set(new Uint32Array(i).fill(n.feature),n.linePosition),t.featureIds.set(new Uint32Array(i).fill(n.lineFeature),n.linePosition),n.linePosition+=i}function c(e,t,n,o,r){for(const i of e)l(i,t,n,o,r)}function u(e,t,n,o,r){t.polygonIndices[n.polygonObject]=n.polygonPosition,n.polygonObject++;for(const i of e){t.primitivePolygonIndices[n.polygonRing]=n.polygonPosition,n.polygonRing++,f(t.positions,i,n.polygonPosition,o);const e=i.length;g(t,r,n.polygonPosition,e),t.globalFeatureIds.set(new Uint32Array(e).fill(n.feature),n.polygonPosition),t.featureIds.set(new Uint32Array(e).fill(n.polygonFeature),n.polygonPosition),n.polygonPosition+=e}}function p(e,t,n,o,r){for(const i of e)u(i,t,n,o,r)}function g(e,t,n,o){for(const r in e.numericProps)r in t&&e.numericProps[r].set(new Array(o).fill(t[r]),n)}function d(e,t){const n={};for(const o in e)t.includes(o)||(n[o]=e[o]);return n}function f(e,t,n,o){let r=n*o;for(const n of t)e.set(n,r),r+=o}function y(e){return[].concat(...e)}var m=n(0);const h={name:"GPX (GPS exchange format)",id:"gpx",module:"kml",version:"3.1.0-alpha.3",extensions:["gpx"],mimeTypes:["application/gpx+xml"],text:!0,tests:['<?xml version="1.0" encoding="UTF-8"?>\n<gpx'],parse:async(e,t)=>b((new TextDecoder).decode(e),t),parseTextSync:b,options:{gpx:{},gis:{format:"geojson"}}};function b(e,t){var n,r;const i=(new DOMParser).parseFromString(e,"text/xml"),s=Object(m.gpx)(i);switch(null==t||null===(n=t.gpx)||void 0===n?void 0:n.type){case"object-row-table":return s.features}switch(null==t||null===(r=t.gis)||void 0===r?void 0:r.format){case"geojson":return s;case"binary":return o(s.features);case"raw":return i;default:throw new Error}}const x={name:"KML (Keyhole Markup Language)",id:"kml",module:"kml",version:"3.1.0-alpha.3",extensions:["kml"],mimeTypes:["application/vnd.google-earth.kml+xml"],text:!0,tests:['<?xml version="1.0" encoding="UTF-8"?>\n<kml xmlns="http://www.opengis.net/kml/2.2">'],parse:async(e,t)=>P((new TextDecoder).decode(e),t),parseTextSync:P,options:{kml:{},gis:{format:"geojson"}}};function P(e,t){var n,r;const i=(new DOMParser).parseFromString(e,"text/xml"),s=Object(m.kml)(i);switch(null==t||null===(n=t.kml)||void 0===n?void 0:n.type){case"object-row-table":return s.features}switch(null==t||null===(r=t.gis)||void 0===r?void 0:r.format){case"geojson":return s;case"binary":return o(s.features);case"raw":return i;default:throw new Error}}const w={name:"TCX (Training Center XML)",id:"tcx",module:"kml",version:"3.1.0-alpha.3",extensions:["tcx"],mimeTypes:["application/vnd.garmin.tcx+xml"],text:!0,tests:['<?xml version="1.0" encoding="UTF-8"?>\n<TrainingCenterDatabase'],parse:async(e,t)=>v((new TextDecoder).decode(e),t),parseTextSync:v,options:{tcx:{},gis:{format:"geojson"}}};function v(e,t={}){var n,r;const i=(new DOMParser).parseFromString(e,"text/xml"),s=Object(m.tcx)(i);switch(null==t||null===(n=t.tcx)||void 0===n?void 0:n.type){case"object-row-table":return s.features}switch(null==t||null===(r=t.gis)||void 0===r?void 0:r.format){case"geojson":return s;case"binary":return o(s.features);case"raw":return i;default:throw new Error}}}])}));
1
+ !function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var n=t();for(var o in n)("object"==typeof exports?exports:e)[o]=n[o]}}(window,(function(){return function(e){var t={};function n(o){if(t[o])return t[o].exports;var r=t[o]={i:o,l:!1,exports:{}};return e[o].call(r.exports,r,r.exports,n),r.l=!0,r.exports}return n.m=e,n.c=t,n.d=function(e,t,o){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:o})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var o=Object.create(null);if(n.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)n.d(o,r,function(t){return e[t]}.bind(null,r));return o},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=2)}([function(e,t,n){!function(e){"use strict";function t(e){return e&&e.normalize&&e.normalize(),e&&e.textContent||""}function n(e,t){const n=e.getElementsByTagName(t);return n.length?n[0]:null}function o(e){const o={};if(e){const r=n(e,"line");if(r){const e=t(n(r,"color")),i=parseFloat(t(n(r,"opacity"))),s=parseFloat(t(n(r,"width")));e&&(o.stroke=e),isNaN(i)||(o["stroke-opacity"]=i),isNaN(s)||(o["stroke-width"]=96*s/25.4)}}return o}function r(e,o){const r={};let i,s;for(s=0;s<o.length;s++)i=n(e,o[s]),i&&(r[o[s]]=t(i));return r}function i(e){const n=r(e,["name","cmt","desc","type","time","keywords"]),o=e.getElementsByTagNameNS("http://www.garmin.com/xmlschemas/GpxExtensions/v3","*");for(let r=0;r<o.length;r++){const i=o[r];i.parentNode.parentNode===e&&(n[i.tagName.replace(":","_")]=t(i))}const i=e.getElementsByTagName("link");i.length&&(n.links=[]);for(let e=0;e<i.length;e++)n.links.push(Object.assign({href:i[e].getAttribute("href")},r(i[e],["text","type"])));return n}function s(e){const o=[parseFloat(e.getAttribute("lon")),parseFloat(e.getAttribute("lat"))],r=n(e,"ele"),i=n(e,"gpxtpx:hr")||n(e,"hr"),s=n(e,"time");let a;r&&(a=parseFloat(t(r)),isNaN(a)||o.push(a));const l={coordinates:o,time:s?t(s):null,extendedValues:[]};i&&l.extendedValues.push(["heart",parseFloat(t(i))]);const c=n(e,"extensions");if(null!==c)for(const e of["speed","course","hAcc","vAcc"]){const o=parseFloat(t(n(c,e)));isNaN(o)||l.extendedValues.push([e,o])}return l}function a(e){const t=l(e,"rtept");if(t)return{type:"Feature",properties:Object.assign(i(e),o(n(e,"extensions")),{_gpxType:"rte"}),geometry:{type:"LineString",coordinates:t.line}}}function l(e,t){const n=e.getElementsByTagName(t);if(n.length<2)return;const o=[],r=[],i={};for(let e=0;e<n.length;e++){const t=s(n[e]);o.push(t.coordinates),t.time&&r.push(t.time);for(let o=0;o<t.extendedValues.length;o++){const[r,s]=t.extendedValues[o],a="heart"===r?r:r+"s";i[a]||(i[a]=Array(n.length).fill(null)),i[a][e]=s}}return{line:o,times:r,extendedValues:i}}function c(e){const t=e.getElementsByTagName("trkseg"),r=[],s=[],a=[];for(let e=0;e<t.length;e++){const n=l(t[e],"trkpt");n&&(a.push(n),n.times&&n.times.length&&s.push(n.times))}if(0===a.length)return;const c=a.length>1,u=Object.assign(i(e),o(n(e,"extensions")),{_gpxType:"trk"},s.length?{coordinateProperties:{times:c?s:s[0]}}:{});for(let e=0;e<a.length;e++){const t=a[e];r.push(t.line);for(const[n,o]of Object.entries(t.extendedValues)){let t=u;"heart"===n&&(u.coordinateProperties||(u.coordinateProperties={}),t=u.coordinateProperties),c?(t[n]||(t[n]=a.map(e=>new Array(e.line.length).fill(null))),t[n][e]=o):t[n]=o}}return{type:"Feature",properties:u,geometry:c?{type:"MultiLineString",coordinates:r}:{type:"LineString",coordinates:r[0]}}}function*u(e){const t=e.getElementsByTagName("trk"),n=e.getElementsByTagName("rte"),o=e.getElementsByTagName("wpt");for(let e=0;e<t.length;e++){const n=c(t[e]);n&&(yield n)}for(let e=0;e<n.length;e++){const t=a(n[e]);t&&(yield t)}for(let e=0;e<o.length;e++)yield(l=o[e],{type:"Feature",properties:Object.assign(i(l),r(l,["sym"])),geometry:{type:"Point",coordinates:s(l).coordinates}});var l}const p=[["heartRate","heartRates"],["Cadence","cadences"],["Speed","speeds"],["Watts","watts"]],g=[["TotalTimeSeconds","totalTimeSeconds"],["DistanceMeters","distanceMeters"],["MaximumSpeed","maxSpeed"],["AverageHeartRateBpm","avgHeartRate"],["MaximumHeartRateBpm","maxHeartRate"],["AvgSpeed","avgSpeed"],["AvgWatts","avgWatts"],["MaxWatts","maxWatts"]];function d(e,o){const r=[];for(const[i,s]of o){let o=n(e,i);if(!o){const t=e.getElementsByTagNameNS("http://www.garmin.com/xmlschemas/ActivityExtension/v2",i);t.length&&(o=t[0])}const a=parseFloat(t(o));isNaN(a)||r.push([s,a])}return r}function f(e){const o=t(n(e,"LongitudeDegrees")),r=t(n(e,"LatitudeDegrees"));if(!o.length||!r.length)return null;const i=[parseFloat(o),parseFloat(r)],s=n(e,"AltitudeMeters"),a=n(e,"HeartRateBpm"),l=n(e,"Time");let c;return s&&(c=parseFloat(t(s)),isNaN(c)||i.push(c)),{coordinates:i,time:l?t(l):null,heartRate:a?parseFloat(t(a)):null,extensions:d(e,p)}}function y(e,t){const n=e.getElementsByTagName(t),o=[],r=[],i=[];if(n.length<2)return null;const s={extendedProperties:{}};for(let e=0;e<n.length;e++){const t=f(n[e]);if(null!==t){o.push(t.coordinates),t.time&&r.push(t.time),t.heartRate&&i.push(t.heartRate);for(const[o,r]of t.extensions)s.extendedProperties[o]||(s.extendedProperties[o]=Array(n.length).fill(null)),s.extendedProperties[o][e]=r}}return Object.assign(s,{line:o,times:r,heartRates:i})}function m(e){const o=e.getElementsByTagName("Track"),r=[],i=[],s=[],a=[];let l;const c=function(e){const t={};for(const[n,o]of e)t[n]=o;return t}(d(e,g)),u=n(e,"Name");u&&(c.name=t(u));for(let e=0;e<o.length;e++)l=y(o[e],"Trackpoint"),l&&(r.push(l.line),l.times.length&&i.push(l.times),l.heartRates.length&&s.push(l.heartRates),a.push(l.extendedProperties));for(let e=0;e<a.length;e++){const t=a[e];for(const n in t)1===o.length?c[n]=l.extendedProperties[n]:(c[n]||(c[n]=r.map(e=>Array(e.length).fill(null))),c[n][e]=t[n])}if(0!==r.length)return(i.length||s.length)&&(c.coordinateProperties=Object.assign(i.length?{times:1===r.length?i[0]:i}:{},s.length?{heart:1===r.length?s[0]:s}:{})),{type:"Feature",properties:c,geometry:{type:1===r.length?"LineString":"MultiLineString",coordinates:1===r.length?r[0]:r}}}function*h(e){const t=e.getElementsByTagName("Lap");for(let e=0;e<t.length;e++){const n=m(t[e]);n&&(yield n)}const n=e.getElementsByTagName("Courses");for(let e=0;e<n.length;e++){const t=m(n[e]);t&&(yield t)}}const b=/\s*/g,x=/^\s*|\s*$/g,P=/\s+/;function w(e){if(!e||!e.length)return 0;let t=0;for(let n=0;n<e.length;n++)t=(t<<5)-t+e.charCodeAt(n)|0;return t}function v(e){return e.replace(b,"").split(",").map(parseFloat)}function T(e){return e.replace(x,"").split(P).map(v)}function F(e){if(void 0!==e.xml)return e.xml;if(e.tagName){let t=e.tagName;for(let n=0;n<e.attributes.length;n++)t+=e.attributes[n].name+e.attributes[n].value;for(let n=0;n<e.childNodes.length;n++)t+=F(e.childNodes[n]);return t}return"#text"===e.nodeName?(e.nodeValue||e.value||"").trim():"#cdata-section"===e.nodeName?e.nodeValue:""}const k=["Polygon","LineString","Point","Track","gx:Track"];function A(e,o,r){let i=t(n(o,"color"))||"";const s="stroke"==r||"fill"===r?r:r+"-color";"#"===i.substr(0,1)&&(i=i.substr(1)),6===i.length||3===i.length?e[s]=i:8===i.length&&(e[r+"-opacity"]=parseInt(i.substr(0,2),16)/255,e[s]="#"+i.substr(6,2)+i.substr(4,2)+i.substr(2,2))}function N(e,o,r,i){const s=parseFloat(t(n(o,r)));isNaN(s)||(e[i]=s)}function S(e){let n=e.getElementsByTagName("coord");const o=[],r=[];0===n.length&&(n=e.getElementsByTagName("gx:coord"));for(let e=0;e<n.length;e++)o.push(t(n[e]).split(" ").map(parseFloat));const i=e.getElementsByTagName("when");for(let e=0;e<i.length;e++)r.push(t(i[e]));return{coords:o,times:r}}function I(e,o,r,i){const s=function e(o){let r,i,s,a,l;const c=[],u=[];if(n(o,"MultiGeometry"))return e(n(o,"MultiGeometry"));if(n(o,"MultiTrack"))return e(n(o,"MultiTrack"));if(n(o,"gx:MultiTrack"))return e(n(o,"gx:MultiTrack"));for(s=0;s<k.length;s++)if(i=o.getElementsByTagName(k[s]),i)for(a=0;a<i.length;a++)if(r=i[a],"Point"===k[s])c.push({type:"Point",coordinates:v(t(n(r,"coordinates")))});else if("LineString"===k[s])c.push({type:"LineString",coordinates:T(t(n(r,"coordinates")))});else if("Polygon"===k[s]){const e=r.getElementsByTagName("LinearRing"),o=[];for(l=0;l<e.length;l++)o.push(T(t(n(e[l],"coordinates"))));c.push({type:"Polygon",coordinates:o})}else if("Track"===k[s]||"gx:Track"===k[s]){const e=S(r);c.push({type:"LineString",coordinates:e.coords}),e.times.length&&u.push(e.times)}return{geoms:c,coordTimes:u}}(e);let a;const l={},c=t(n(e,"name")),u=t(n(e,"address"));let p=t(n(e,"styleUrl"));const g=t(n(e,"description")),d=n(e,"TimeSpan"),f=n(e,"TimeStamp"),y=n(e,"ExtendedData");let m=n(e,"IconStyle"),h=n(e,"LabelStyle"),b=n(e,"LineStyle"),x=n(e,"PolyStyle");const P=n(e,"visibility");if(c&&(l.name=c),u&&(l.address=u),p){"#"!==p[0]&&(p="#"+p),l.styleUrl=p,o[p]&&(l.styleHash=o[p]),r[p]&&(l.styleMapHash=r[p],l.styleHash=o[r[p].normal]);const e=i[l.styleHash];e&&(m||(m=n(e,"IconStyle")),h||(h=n(e,"LabelStyle")),b||(b=n(e,"LineStyle")),x||(x=n(e,"PolyStyle")))}if(g&&(l.description=g),d){const e=t(n(d,"begin")),o=t(n(d,"end"));l.timespan={begin:e,end:o}}if(f&&(l.timestamp=t(n(f,"when"))),m){A(l,m,"icon"),N(l,m,"scale","icon-scale"),N(l,m,"heading","icon-heading");const e=n(m,"hotSpot");if(e){const t=parseFloat(e.getAttribute("x")),n=parseFloat(e.getAttribute("y"));isNaN(t)||isNaN(n)||(l["icon-offset"]=[t,n])}const o=n(m,"Icon");if(o){const e=t(n(o,"href"));e&&(l.icon=e)}}if(h&&(A(l,h,"label"),N(l,h,"scale","label-scale")),b&&(A(l,b,"stroke"),N(l,b,"width","stroke-width")),x){A(l,x,"fill");const e=t(n(x,"fill")),o=t(n(x,"outline"));e&&(l["fill-opacity"]="1"===e?l["fill-opacity"]||1:0),o&&(l["stroke-opacity"]="1"===o?l["stroke-opacity"]||1:0)}if(y){const e=y.getElementsByTagName("Data"),o=y.getElementsByTagName("SimpleData");for(a=0;a<e.length;a++)l[e[a].getAttribute("name")]=t(n(e[a],"value"));for(a=0;a<o.length;a++)l[o[a].getAttribute("name")]=t(o[a])}P&&(l.visibility=t(P)),s.coordTimes.length&&(l.coordinateProperties={times:1===s.coordTimes.length?s.coordTimes[0]:s.coordTimes});const w={type:"Feature",geometry:0===s.geoms.length?null:1===s.geoms.length?s.geoms[0]:{type:"GeometryCollection",geometries:s.geoms},properties:l};return e.getAttribute("id")&&(w.id=e.getAttribute("id")),w}function*j(e){const o={},r={},i={},s=e.getElementsByTagName("Placemark"),a=e.getElementsByTagName("Style"),l=e.getElementsByTagName("StyleMap");for(let e=0;e<a.length;e++){const t=w(F(a[e])).toString(16);o["#"+a[e].getAttribute("id")]=t,r[t]=a[e]}for(let e=0;e<l.length;e++){o["#"+l[e].getAttribute("id")]=w(F(l[e])).toString(16);const r=l[e].getElementsByTagName("Pair"),s={};for(let e=0;e<r.length;e++)s[t(n(r[e],"key"))]=t(n(r[e],"styleUrl"));i["#"+l[e].getAttribute("id")]=s}for(let e=0;e<s.length;e++){const t=I(s[e],o,i,r);t&&(yield t)}}e.gpx=function(e){return{type:"FeatureCollection",features:Array.from(u(e))}},e.gpxGen=u,e.kml=function(e){return{type:"FeatureCollection",features:Array.from(j(e))}},e.kmlGen=j,e.tcx=function(e){return{type:"FeatureCollection",features:Array.from(h(e))}},e.tcxGen=h,Object.defineProperty(e,"__esModule",{value:!0})}(t)},,function(e,t,n){const o=n(3);globalThis.loaders=globalThis.loaders||{},e.exports=Object.assign(globalThis.loaders,o)},function(e,t,n){"use strict";function o(e,t={}){const n=r(e);return i(e,n,{coordLength:t.coordLength||n.coordLength,numericPropKeys:t.numericPropKeys||n.numericPropKeys,PositionDataType:t.PositionDataType||Float32Array})}n.r(t),n.d(t,"GPXLoader",(function(){return h})),n.d(t,"KMLLoader",(function(){return x})),n.d(t,"TCXLoader",(function(){return w}));function r(e){let t=0,n=0,o=0,r=0,i=0,s=0,a=0,l=0,c=0;const u=new Set,p={};for(const d of e){const e=d.geometry;switch(e.type){case"Point":n++,t++,u.add(e.coordinates.length);break;case"MultiPoint":n++,t+=e.coordinates.length;for(const t of e.coordinates)u.add(t.length);break;case"LineString":i++,o+=e.coordinates.length,r++;for(const t of e.coordinates)u.add(t.length);break;case"MultiLineString":i++;for(const t of e.coordinates){o+=t.length,r++;for(const e of t)u.add(e.length)}break;case"Polygon":c++,a++,l+=e.coordinates.length,s+=y(e.coordinates).length;for(const t of y(e.coordinates))u.add(t.length);break;case"MultiPolygon":c++;for(const t of e.coordinates){a++,l+=t.length,s+=y(t).length;for(const e of y(t))u.add(e.length)}break;default:throw new Error("Unsupported geometry type: "+e.type)}if(d.properties)for(const e in d.properties){const t=d.properties[e];p[e]=p[e]||void 0===p[e]?(g=t,Number.isFinite(g)):p[e]}}var g;return{coordLength:u.size>0?Math.max(...u):2,pointPositionsCount:t,pointFeaturesCount:n,linePositionsCount:o,linePathsCount:r,lineFeaturesCount:i,polygonPositionsCount:s,polygonObjectsCount:a,polygonRingsCount:l,polygonFeaturesCount:c,numericPropKeys:Object.keys(p).filter(e=>p[e])}}function i(e,t,n){const{pointPositionsCount:o,pointFeaturesCount:r,linePositionsCount:i,linePathsCount:g,lineFeaturesCount:f,polygonPositionsCount:y,polygonObjectsCount:m,polygonRingsCount:h,polygonFeaturesCount:b}=t,{coordLength:x,numericPropKeys:P,PositionDataType:w=Float32Array}=n,v=e.length>65535?Uint32Array:Uint16Array,T={positions:new w(o*x),globalFeatureIds:new v(o),featureIds:r>65535?new Uint32Array(o):new Uint16Array(o),numericProps:{},properties:Array(),fields:Array()},F={positions:new w(i*x),pathIndices:i>65535?new Uint32Array(g+1):new Uint16Array(g+1),globalFeatureIds:new v(i),featureIds:f>65535?new Uint32Array(i):new Uint16Array(i),numericProps:{},properties:Array(),fields:Array()},k={positions:new w(y*x),polygonIndices:y>65535?new Uint32Array(m+1):new Uint16Array(m+1),primitivePolygonIndices:y>65535?new Uint32Array(h+1):new Uint16Array(h+1),globalFeatureIds:new v(y),featureIds:b>65535?new Uint32Array(y):new Uint16Array(y),numericProps:{},properties:Array(),fields:Array()};for(const e of[T,F,k])for(const t of P||[])e.numericProps[t]=new Float32Array(e.positions.length/x);F.pathIndices[g]=i,k.polygonIndices[m]=y,k.primitivePolygonIndices[h]=y;const A={pointPosition:0,pointFeature:0,linePosition:0,linePath:0,lineFeature:0,polygonPosition:0,polygonObject:0,polygonRing:0,polygonFeature:0,feature:0};for(const t of e){const e=t.geometry,n=t.properties||{};switch(e.type){case"Point":s(e.coordinates,T,A,x,n),T.properties.push(d(n,P)),A.pointFeature++;break;case"MultiPoint":a(e.coordinates,T,A,x,n),T.properties.push(d(n,P)),A.pointFeature++;break;case"LineString":l(e.coordinates,F,A,x,n),F.properties.push(d(n,P)),A.lineFeature++;break;case"MultiLineString":c(e.coordinates,F,A,x,n),F.properties.push(d(n,P)),A.lineFeature++;break;case"Polygon":u(e.coordinates,k,A,x,n),k.properties.push(d(n,P)),A.polygonFeature++;break;case"MultiPolygon":p(e.coordinates,k,A,x,n),k.properties.push(d(n,P)),A.polygonFeature++;break;default:throw new Error("Invalid geometry type")}A.feature++}return function(e,t,n,o){const r={points:{...e,positions:{value:e.positions,size:o},globalFeatureIds:{value:e.globalFeatureIds,size:1},featureIds:{value:e.featureIds,size:1},type:"Point"},lines:{...t,pathIndices:{value:t.pathIndices,size:1},positions:{value:t.positions,size:o},globalFeatureIds:{value:t.globalFeatureIds,size:1},featureIds:{value:t.featureIds,size:1},type:"LineString"},polygons:{...n,polygonIndices:{value:n.polygonIndices,size:1},primitivePolygonIndices:{value:n.primitivePolygonIndices,size:1},positions:{value:n.positions,size:o},globalFeatureIds:{value:n.globalFeatureIds,size:1},featureIds:{value:n.featureIds,size:1},type:"Polygon"}};for(const e in r)for(const t in r[e].numericProps)r[e].numericProps[t]={value:r[e].numericProps[t],size:1};return r}(T,F,k,x)}function s(e,t,n,o,r){t.positions.set(e,n.pointPosition*o),t.globalFeatureIds[n.pointPosition]=n.feature,t.featureIds[n.pointPosition]=n.pointFeature,g(t,r,n.pointPosition,1),n.pointPosition++}function a(e,t,n,o,r){for(const i of e)s(i,t,n,o,r)}function l(e,t,n,o,r){t.pathIndices[n.linePath]=n.linePosition,n.linePath++,f(t.positions,e,n.linePosition,o);const i=e.length;g(t,r,n.linePosition,i),t.globalFeatureIds.set(new Uint32Array(i).fill(n.feature),n.linePosition),t.featureIds.set(new Uint32Array(i).fill(n.lineFeature),n.linePosition),n.linePosition+=i}function c(e,t,n,o,r){for(const i of e)l(i,t,n,o,r)}function u(e,t,n,o,r){t.polygonIndices[n.polygonObject]=n.polygonPosition,n.polygonObject++;for(const i of e){t.primitivePolygonIndices[n.polygonRing]=n.polygonPosition,n.polygonRing++,f(t.positions,i,n.polygonPosition,o);const e=i.length;g(t,r,n.polygonPosition,e),t.globalFeatureIds.set(new Uint32Array(e).fill(n.feature),n.polygonPosition),t.featureIds.set(new Uint32Array(e).fill(n.polygonFeature),n.polygonPosition),n.polygonPosition+=e}}function p(e,t,n,o,r){for(const i of e)u(i,t,n,o,r)}function g(e,t,n,o){for(const r in e.numericProps)r in t&&e.numericProps[r].set(new Array(o).fill(t[r]),n)}function d(e,t){const n={};for(const o in e)t.includes(o)||(n[o]=e[o]);return n}function f(e,t,n,o){let r=n*o;for(const n of t)e.set(n,r),r+=o}function y(e){return[].concat(...e)}var m=n(0);const h={name:"GPX (GPS exchange format)",id:"gpx",module:"kml",version:"3.1.0-alpha.4",extensions:["gpx"],mimeTypes:["application/gpx+xml"],text:!0,tests:['<?xml version="1.0" encoding="UTF-8"?>\n<gpx'],parse:async(e,t)=>b((new TextDecoder).decode(e),t),parseTextSync:b,options:{gpx:{},gis:{format:"geojson"}}};function b(e,t){var n,r;const i=(new DOMParser).parseFromString(e,"text/xml"),s=Object(m.gpx)(i);switch(null==t||null===(n=t.gpx)||void 0===n?void 0:n.type){case"object-row-table":return s.features}switch(null==t||null===(r=t.gis)||void 0===r?void 0:r.format){case"geojson":return s;case"binary":return o(s.features);case"raw":return i;default:throw new Error}}const x={name:"KML (Keyhole Markup Language)",id:"kml",module:"kml",version:"3.1.0-alpha.4",extensions:["kml"],mimeTypes:["application/vnd.google-earth.kml+xml"],text:!0,tests:['<?xml version="1.0" encoding="UTF-8"?>\n<kml xmlns="http://www.opengis.net/kml/2.2">'],parse:async(e,t)=>P((new TextDecoder).decode(e),t),parseTextSync:P,options:{kml:{},gis:{format:"geojson"}}};function P(e,t){var n,r;const i=(new DOMParser).parseFromString(e,"text/xml"),s=Object(m.kml)(i);switch(null==t||null===(n=t.kml)||void 0===n?void 0:n.type){case"object-row-table":return s.features}switch(null==t||null===(r=t.gis)||void 0===r?void 0:r.format){case"geojson":return s;case"binary":return o(s.features);case"raw":return i;default:throw new Error}}const w={name:"TCX (Training Center XML)",id:"tcx",module:"kml",version:"3.1.0-alpha.4",extensions:["tcx"],mimeTypes:["application/vnd.garmin.tcx+xml"],text:!0,tests:['<?xml version="1.0" encoding="UTF-8"?>\n<TrainingCenterDatabase'],parse:async(e,t)=>v((new TextDecoder).decode(e),t),parseTextSync:v,options:{tcx:{},gis:{format:"geojson"}}};function v(e,t={}){var n,r;const i=(new DOMParser).parseFromString(e,"text/xml"),s=Object(m.tcx)(i);switch(null==t||null===(n=t.tcx)||void 0===n?void 0:n.type){case"object-row-table":return s.features}switch(null==t||null===(r=t.gis)||void 0===r?void 0:r.format){case"geojson":return s;case"binary":return o(s.features);case"raw":return i;default:throw new Error}}}])}));
2
2
  //# sourceMappingURL=dist.min.js.map
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+
3
+ var moduleExports = require('./index');
4
+
5
+ globalThis.loaders = globalThis.loaders || {};
6
+ module.exports = Object.assign(globalThis.loaders, moduleExports);
7
+ //# sourceMappingURL=bundle.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/bundle.ts"],"names":["moduleExports","require","globalThis","loaders","module","exports","Object","assign"],"mappings":";;AACA,IAAMA,aAAa,GAAGC,OAAO,CAAC,SAAD,CAA7B;;AACAC,UAAU,CAACC,OAAX,GAAqBD,UAAU,CAACC,OAAX,IAAsB,EAA3C;AACAC,MAAM,CAACC,OAAP,GAAiBC,MAAM,CAACC,MAAP,CAAcL,UAAU,CAACC,OAAzB,EAAkCH,aAAlC,CAAjB","sourcesContent":["// @ts-nocheck\nconst moduleExports = require('./index');\nglobalThis.loaders = globalThis.loaders || {};\nmodule.exports = Object.assign(globalThis.loaders, moduleExports);\n"],"file":"bundle.js"}
@@ -0,0 +1,91 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports._typecheckGPXLoader = exports.GPXLoader = void 0;
9
+
10
+ var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
11
+
12
+ var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
13
+
14
+ var _gis = require("@loaders.gl/gis");
15
+
16
+ var _togeojson = require("@tmcw/togeojson");
17
+
18
+ var VERSION = typeof "3.1.0-alpha.4" !== 'undefined' ? "3.1.0-alpha.4" : 'latest';
19
+ var GPX_HEADER = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<gpx";
20
+ var GPXLoader = {
21
+ name: 'GPX (GPS exchange format)',
22
+ id: 'gpx',
23
+ module: 'kml',
24
+ version: VERSION,
25
+ extensions: ['gpx'],
26
+ mimeTypes: ['application/gpx+xml'],
27
+ text: true,
28
+ tests: [GPX_HEADER],
29
+ parse: function () {
30
+ var _parse = (0, _asyncToGenerator2.default)(_regenerator.default.mark(function _callee(arrayBuffer, options) {
31
+ return _regenerator.default.wrap(function _callee$(_context) {
32
+ while (1) {
33
+ switch (_context.prev = _context.next) {
34
+ case 0:
35
+ return _context.abrupt("return", parseTextSync(new TextDecoder().decode(arrayBuffer), options));
36
+
37
+ case 1:
38
+ case "end":
39
+ return _context.stop();
40
+ }
41
+ }
42
+ }, _callee);
43
+ }));
44
+
45
+ function parse(_x, _x2) {
46
+ return _parse.apply(this, arguments);
47
+ }
48
+
49
+ return parse;
50
+ }(),
51
+ parseTextSync: parseTextSync,
52
+ options: {
53
+ gpx: {},
54
+ gis: {
55
+ format: 'geojson'
56
+ }
57
+ }
58
+ };
59
+ exports.GPXLoader = GPXLoader;
60
+
61
+ function parseTextSync(text, options) {
62
+ var _options$gpx, _options$gis;
63
+
64
+ var doc = new DOMParser().parseFromString(text, 'text/xml');
65
+ var geojson = (0, _togeojson.gpx)(doc);
66
+
67
+ switch (options === null || options === void 0 ? void 0 : (_options$gpx = options.gpx) === null || _options$gpx === void 0 ? void 0 : _options$gpx.type) {
68
+ case 'object-row-table':
69
+ return geojson.features;
70
+
71
+ default:
72
+ }
73
+
74
+ switch (options === null || options === void 0 ? void 0 : (_options$gis = options.gis) === null || _options$gis === void 0 ? void 0 : _options$gis.format) {
75
+ case 'geojson':
76
+ return geojson;
77
+
78
+ case 'binary':
79
+ return (0, _gis.geojsonToBinary)(geojson.features);
80
+
81
+ case 'raw':
82
+ return doc;
83
+
84
+ default:
85
+ throw new Error();
86
+ }
87
+ }
88
+
89
+ var _typecheckGPXLoader = GPXLoader;
90
+ exports._typecheckGPXLoader = _typecheckGPXLoader;
91
+ //# sourceMappingURL=gpx-loader.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/gpx-loader.ts"],"names":["VERSION","GPX_HEADER","GPXLoader","name","id","module","version","extensions","mimeTypes","text","tests","parse","arrayBuffer","options","parseTextSync","TextDecoder","decode","gpx","gis","format","doc","DOMParser","parseFromString","geojson","type","features","Error","_typecheckGPXLoader"],"mappings":";;;;;;;;;;;;;AACA;;AACA;;AAIA,IAAMA,OAAO,GAAG,2BAAuB,WAAvB,qBAAmD,QAAnE;AAMA,IAAMC,UAAU,qDAAhB;AAOO,IAAMC,SAAS,GAAG;AACvBC,EAAAA,IAAI,EAAE,2BADiB;AAEvBC,EAAAA,EAAE,EAAE,KAFmB;AAGvBC,EAAAA,MAAM,EAAE,KAHe;AAIvBC,EAAAA,OAAO,EAAEN,OAJc;AAKvBO,EAAAA,UAAU,EAAE,CAAC,KAAD,CALW;AAMvBC,EAAAA,SAAS,EAAE,CAAC,qBAAD,CANY;AAOvBC,EAAAA,IAAI,EAAE,IAPiB;AAQvBC,EAAAA,KAAK,EAAE,CAACT,UAAD,CARgB;AASvBU,EAAAA,KAAK;AAAA,2EAAE,iBAAOC,WAAP,EAAoBC,OAApB;AAAA;AAAA;AAAA;AAAA;AAAA,+CACLC,aAAa,CAAC,IAAIC,WAAJ,GAAkBC,MAAlB,CAAyBJ,WAAzB,CAAD,EAAwCC,OAAxC,CADR;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,KAAF;;AAAA;AAAA;AAAA;;AAAA;AAAA,KATkB;AAWvBC,EAAAA,aAAa,EAAbA,aAXuB;AAYvBD,EAAAA,OAAO,EAAE;AACPI,IAAAA,GAAG,EAAE,EADE;AAEPC,IAAAA,GAAG,EAAE;AAACC,MAAAA,MAAM,EAAE;AAAT;AAFE;AAZc,CAAlB;;;AAkBP,SAASL,aAAT,CAAuBL,IAAvB,EAAqCI,OAArC,EAAmD;AAAA;;AACjD,MAAMO,GAAG,GAAG,IAAIC,SAAJ,GAAgBC,eAAhB,CAAgCb,IAAhC,EAAsC,UAAtC,CAAZ;AACA,MAAMc,OAAO,GAAG,oBAAIH,GAAJ,CAAhB;;AAEA,UAAQP,OAAR,aAAQA,OAAR,uCAAQA,OAAO,CAAEI,GAAjB,iDAAQ,aAAcO,IAAtB;AACE,SAAK,kBAAL;AACE,aAAOD,OAAO,CAACE,QAAf;;AACF;AAHF;;AAMA,UAAQZ,OAAR,aAAQA,OAAR,uCAAQA,OAAO,CAAEK,GAAjB,iDAAQ,aAAcC,MAAtB;AACE,SAAK,SAAL;AACE,aAAOI,OAAP;;AACF,SAAK,QAAL;AACE,aAAO,0BAAgBA,OAAO,CAACE,QAAxB,CAAP;;AACF,SAAK,KAAL;AACE,aAAOL,GAAP;;AACF;AACE,YAAM,IAAIM,KAAJ,EAAN;AARJ;AAUD;;AAEM,IAAMC,mBAAmB,GAAGzB,SAA5B","sourcesContent":["import type {LoaderOptions} from '@loaders.gl/loader-utils';\nimport {geojsonToBinary} from '@loaders.gl/gis';\nimport {gpx} from '@tmcw/togeojson';\n\n// __VERSION__ is injected by babel-plugin-version-inline\n// @ts-ignore TS2304: Cannot find name '__VERSION__'.\nconst VERSION = typeof __VERSION__ !== 'undefined' ? __VERSION__ : 'latest';\n\nexport type GPXLoaderOptions = LoaderOptions & {\n gpx?: {};\n};\n\nconst GPX_HEADER = `\\\n<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<gpx`;\n\n/**\n * Loader for GPX (GPS exchange format)\n */\nexport const GPXLoader = {\n name: 'GPX (GPS exchange format)',\n id: 'gpx',\n module: 'kml',\n version: VERSION,\n extensions: ['gpx'],\n mimeTypes: ['application/gpx+xml'],\n text: true,\n tests: [GPX_HEADER],\n parse: async (arrayBuffer, options) =>\n parseTextSync(new TextDecoder().decode(arrayBuffer), options),\n parseTextSync,\n options: {\n gpx: {},\n gis: {format: 'geojson'}\n }\n};\n\nfunction parseTextSync(text: string, options: any) {\n const doc = new DOMParser().parseFromString(text, 'text/xml');\n const geojson = gpx(doc);\n\n switch (options?.gpx?.type) {\n case 'object-row-table':\n return geojson.features;\n default:\n }\n\n switch (options?.gis?.format) {\n case 'geojson':\n return geojson;\n case 'binary':\n return geojsonToBinary(geojson.features);\n case 'raw':\n return doc;\n default:\n throw new Error();\n }\n}\n\nexport const _typecheckGPXLoader = GPXLoader;\n"],"file":"gpx-loader.js"}
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ Object.defineProperty(exports, "GPXLoader", {
7
+ enumerable: true,
8
+ get: function get() {
9
+ return _gpxLoader.GPXLoader;
10
+ }
11
+ });
12
+ Object.defineProperty(exports, "KMLLoader", {
13
+ enumerable: true,
14
+ get: function get() {
15
+ return _kmlLoader.KMLLoader;
16
+ }
17
+ });
18
+ Object.defineProperty(exports, "TCXLoader", {
19
+ enumerable: true,
20
+ get: function get() {
21
+ return _tcxLoader.TCXLoader;
22
+ }
23
+ });
24
+
25
+ var _gpxLoader = require("./gpx-loader");
26
+
27
+ var _kmlLoader = require("./kml-loader");
28
+
29
+ var _tcxLoader = require("./tcx-loader");
30
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AACA;;AAGA;;AAGA","sourcesContent":["export type {GPXLoaderOptions} from './gpx-loader';\nexport {GPXLoader} from './gpx-loader';\n\nexport type {KMLLoaderOptions} from './kml-loader';\nexport {KMLLoader} from './kml-loader';\n\nexport type {TCXLoaderOptions} from './tcx-loader';\nexport {TCXLoader} from './tcx-loader';\n"],"file":"index.js"}
@@ -0,0 +1,91 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports._typecheckKMLLoader = exports.KMLLoader = void 0;
9
+
10
+ var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
11
+
12
+ var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
13
+
14
+ var _gis = require("@loaders.gl/gis");
15
+
16
+ var _togeojson = require("@tmcw/togeojson");
17
+
18
+ var VERSION = typeof "3.1.0-alpha.4" !== 'undefined' ? "3.1.0-alpha.4" : 'latest';
19
+ var KML_HEADER = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<kml xmlns=\"http://www.opengis.net/kml/2.2\">";
20
+ var KMLLoader = {
21
+ name: 'KML (Keyhole Markup Language)',
22
+ id: 'kml',
23
+ module: 'kml',
24
+ version: VERSION,
25
+ extensions: ['kml'],
26
+ mimeTypes: ['application/vnd.google-earth.kml+xml'],
27
+ text: true,
28
+ tests: [KML_HEADER],
29
+ parse: function () {
30
+ var _parse = (0, _asyncToGenerator2.default)(_regenerator.default.mark(function _callee(arrayBuffer, options) {
31
+ return _regenerator.default.wrap(function _callee$(_context) {
32
+ while (1) {
33
+ switch (_context.prev = _context.next) {
34
+ case 0:
35
+ return _context.abrupt("return", parseTextSync(new TextDecoder().decode(arrayBuffer), options));
36
+
37
+ case 1:
38
+ case "end":
39
+ return _context.stop();
40
+ }
41
+ }
42
+ }, _callee);
43
+ }));
44
+
45
+ function parse(_x, _x2) {
46
+ return _parse.apply(this, arguments);
47
+ }
48
+
49
+ return parse;
50
+ }(),
51
+ parseTextSync: parseTextSync,
52
+ options: {
53
+ kml: {},
54
+ gis: {
55
+ format: 'geojson'
56
+ }
57
+ }
58
+ };
59
+ exports.KMLLoader = KMLLoader;
60
+
61
+ function parseTextSync(text, options) {
62
+ var _options$kml, _options$gis;
63
+
64
+ var doc = new DOMParser().parseFromString(text, 'text/xml');
65
+ var geojson = (0, _togeojson.kml)(doc);
66
+
67
+ switch (options === null || options === void 0 ? void 0 : (_options$kml = options.kml) === null || _options$kml === void 0 ? void 0 : _options$kml.type) {
68
+ case 'object-row-table':
69
+ return geojson.features;
70
+
71
+ default:
72
+ }
73
+
74
+ switch (options === null || options === void 0 ? void 0 : (_options$gis = options.gis) === null || _options$gis === void 0 ? void 0 : _options$gis.format) {
75
+ case 'geojson':
76
+ return geojson;
77
+
78
+ case 'binary':
79
+ return (0, _gis.geojsonToBinary)(geojson.features);
80
+
81
+ case 'raw':
82
+ return doc;
83
+
84
+ default:
85
+ throw new Error();
86
+ }
87
+ }
88
+
89
+ var _typecheckKMLLoader = KMLLoader;
90
+ exports._typecheckKMLLoader = _typecheckKMLLoader;
91
+ //# sourceMappingURL=kml-loader.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/kml-loader.ts"],"names":["VERSION","KML_HEADER","KMLLoader","name","id","module","version","extensions","mimeTypes","text","tests","parse","arrayBuffer","options","parseTextSync","TextDecoder","decode","kml","gis","format","doc","DOMParser","parseFromString","geojson","type","features","Error","_typecheckKMLLoader"],"mappings":";;;;;;;;;;;;;AACA;;AACA;;AAIA,IAAMA,OAAO,GAAG,2BAAuB,WAAvB,qBAAmD,QAAnE;AAMA,IAAMC,UAAU,+FAAhB;AAOO,IAAMC,SAAS,GAAG;AACvBC,EAAAA,IAAI,EAAE,+BADiB;AAEvBC,EAAAA,EAAE,EAAE,KAFmB;AAGvBC,EAAAA,MAAM,EAAE,KAHe;AAIvBC,EAAAA,OAAO,EAAEN,OAJc;AAKvBO,EAAAA,UAAU,EAAE,CAAC,KAAD,CALW;AAMvBC,EAAAA,SAAS,EAAE,CAAC,sCAAD,CANY;AAOvBC,EAAAA,IAAI,EAAE,IAPiB;AAQvBC,EAAAA,KAAK,EAAE,CAACT,UAAD,CARgB;AASvBU,EAAAA,KAAK;AAAA,2EAAE,iBAAOC,WAAP,EAAoBC,OAApB;AAAA;AAAA;AAAA;AAAA;AAAA,+CACLC,aAAa,CAAC,IAAIC,WAAJ,GAAkBC,MAAlB,CAAyBJ,WAAzB,CAAD,EAAwCC,OAAxC,CADR;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,KAAF;;AAAA;AAAA;AAAA;;AAAA;AAAA,KATkB;AAWvBC,EAAAA,aAAa,EAAbA,aAXuB;AAYvBD,EAAAA,OAAO,EAAE;AACPI,IAAAA,GAAG,EAAE,EADE;AAEPC,IAAAA,GAAG,EAAE;AAACC,MAAAA,MAAM,EAAE;AAAT;AAFE;AAZc,CAAlB;;;AAkBP,SAASL,aAAT,CAAuBL,IAAvB,EAAqCI,OAArC,EAAmD;AAAA;;AACjD,MAAMO,GAAG,GAAG,IAAIC,SAAJ,GAAgBC,eAAhB,CAAgCb,IAAhC,EAAsC,UAAtC,CAAZ;AACA,MAAMc,OAAO,GAAG,oBAAIH,GAAJ,CAAhB;;AAEA,UAAQP,OAAR,aAAQA,OAAR,uCAAQA,OAAO,CAAEI,GAAjB,iDAAQ,aAAcO,IAAtB;AACE,SAAK,kBAAL;AACE,aAAOD,OAAO,CAACE,QAAf;;AACF;AAHF;;AAMA,UAAQZ,OAAR,aAAQA,OAAR,uCAAQA,OAAO,CAAEK,GAAjB,iDAAQ,aAAcC,MAAtB;AACE,SAAK,SAAL;AACE,aAAOI,OAAP;;AACF,SAAK,QAAL;AACE,aAAO,0BAAgBA,OAAO,CAACE,QAAxB,CAAP;;AACF,SAAK,KAAL;AACE,aAAOL,GAAP;;AACF;AACE,YAAM,IAAIM,KAAJ,EAAN;AARJ;AAUD;;AAEM,IAAMC,mBAAqC,GAAGzB,SAA9C","sourcesContent":["import type {LoaderWithParser, LoaderOptions} from '@loaders.gl/loader-utils';\nimport {geojsonToBinary} from '@loaders.gl/gis';\nimport {kml} from '@tmcw/togeojson';\n\n// __VERSION__ is injected by babel-plugin-version-inline\n// @ts-ignore TS2304: Cannot find name '__VERSION__'.\nconst VERSION = typeof __VERSION__ !== 'undefined' ? __VERSION__ : 'latest';\n\nexport type KMLLoaderOptions = LoaderOptions & {\n kml?: {};\n};\n\nconst KML_HEADER = `\\\n<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<kml xmlns=\"http://www.opengis.net/kml/2.2\">`;\n\n/**\n * Loader for KML (Keyhole Markup Language)\n */\nexport const KMLLoader = {\n name: 'KML (Keyhole Markup Language)',\n id: 'kml',\n module: 'kml',\n version: VERSION,\n extensions: ['kml'],\n mimeTypes: ['application/vnd.google-earth.kml+xml'],\n text: true,\n tests: [KML_HEADER],\n parse: async (arrayBuffer, options) =>\n parseTextSync(new TextDecoder().decode(arrayBuffer), options),\n parseTextSync,\n options: {\n kml: {},\n gis: {format: 'geojson'}\n }\n};\n\nfunction parseTextSync(text: string, options: any) {\n const doc = new DOMParser().parseFromString(text, 'text/xml');\n const geojson = kml(doc);\n\n switch (options?.kml?.type) {\n case 'object-row-table':\n return geojson.features;\n default:\n }\n\n switch (options?.gis?.format) {\n case 'geojson':\n return geojson;\n case 'binary':\n return geojsonToBinary(geojson.features);\n case 'raw':\n return doc;\n default:\n throw new Error();\n }\n}\n\nexport const _typecheckKMLLoader: LoaderWithParser = KMLLoader;\n"],"file":"kml-loader.js"}
@@ -0,0 +1,92 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports._typecheckTCXLoader = exports.TCXLoader = void 0;
9
+
10
+ var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
11
+
12
+ var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
13
+
14
+ var _gis = require("@loaders.gl/gis");
15
+
16
+ var _togeojson = require("@tmcw/togeojson");
17
+
18
+ var VERSION = typeof "3.1.0-alpha.4" !== 'undefined' ? "3.1.0-alpha.4" : 'latest';
19
+ var TCX_HEADER = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<TrainingCenterDatabase";
20
+ var TCXLoader = {
21
+ name: 'TCX (Training Center XML)',
22
+ id: 'tcx',
23
+ module: 'kml',
24
+ version: VERSION,
25
+ extensions: ['tcx'],
26
+ mimeTypes: ['application/vnd.garmin.tcx+xml'],
27
+ text: true,
28
+ tests: [TCX_HEADER],
29
+ parse: function () {
30
+ var _parse = (0, _asyncToGenerator2.default)(_regenerator.default.mark(function _callee(arrayBuffer, options) {
31
+ return _regenerator.default.wrap(function _callee$(_context) {
32
+ while (1) {
33
+ switch (_context.prev = _context.next) {
34
+ case 0:
35
+ return _context.abrupt("return", parseTextSync(new TextDecoder().decode(arrayBuffer), options));
36
+
37
+ case 1:
38
+ case "end":
39
+ return _context.stop();
40
+ }
41
+ }
42
+ }, _callee);
43
+ }));
44
+
45
+ function parse(_x, _x2) {
46
+ return _parse.apply(this, arguments);
47
+ }
48
+
49
+ return parse;
50
+ }(),
51
+ parseTextSync: parseTextSync,
52
+ options: {
53
+ tcx: {},
54
+ gis: {
55
+ format: 'geojson'
56
+ }
57
+ }
58
+ };
59
+ exports.TCXLoader = TCXLoader;
60
+
61
+ function parseTextSync(text) {
62
+ var _options$tcx, _options$gis;
63
+
64
+ var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
65
+ var doc = new DOMParser().parseFromString(text, 'text/xml');
66
+ var geojson = (0, _togeojson.tcx)(doc);
67
+
68
+ switch (options === null || options === void 0 ? void 0 : (_options$tcx = options.tcx) === null || _options$tcx === void 0 ? void 0 : _options$tcx.type) {
69
+ case 'object-row-table':
70
+ return geojson.features;
71
+
72
+ default:
73
+ }
74
+
75
+ switch (options === null || options === void 0 ? void 0 : (_options$gis = options.gis) === null || _options$gis === void 0 ? void 0 : _options$gis.format) {
76
+ case 'geojson':
77
+ return geojson;
78
+
79
+ case 'binary':
80
+ return (0, _gis.geojsonToBinary)(geojson.features);
81
+
82
+ case 'raw':
83
+ return doc;
84
+
85
+ default:
86
+ throw new Error();
87
+ }
88
+ }
89
+
90
+ var _typecheckTCXLoader = TCXLoader;
91
+ exports._typecheckTCXLoader = _typecheckTCXLoader;
92
+ //# sourceMappingURL=tcx-loader.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/tcx-loader.ts"],"names":["VERSION","TCX_HEADER","TCXLoader","name","id","module","version","extensions","mimeTypes","text","tests","parse","arrayBuffer","options","parseTextSync","TextDecoder","decode","tcx","gis","format","doc","DOMParser","parseFromString","geojson","type","features","Error","_typecheckTCXLoader"],"mappings":";;;;;;;;;;;;;AACA;;AACA;;AAIA,IAAMA,OAAO,GAAG,2BAAuB,WAAvB,qBAAmD,QAAnE;AAMA,IAAMC,UAAU,wEAAhB;AAOO,IAAMC,SAAS,GAAG;AACvBC,EAAAA,IAAI,EAAE,2BADiB;AAEvBC,EAAAA,EAAE,EAAE,KAFmB;AAGvBC,EAAAA,MAAM,EAAE,KAHe;AAIvBC,EAAAA,OAAO,EAAEN,OAJc;AAKvBO,EAAAA,UAAU,EAAE,CAAC,KAAD,CALW;AAMvBC,EAAAA,SAAS,EAAE,CAAC,gCAAD,CANY;AAOvBC,EAAAA,IAAI,EAAE,IAPiB;AAQvBC,EAAAA,KAAK,EAAE,CAACT,UAAD,CARgB;AASvBU,EAAAA,KAAK;AAAA,2EAAE,iBAAOC,WAAP,EAAoBC,OAApB;AAAA;AAAA;AAAA;AAAA;AAAA,+CACLC,aAAa,CAAC,IAAIC,WAAJ,GAAkBC,MAAlB,CAAyBJ,WAAzB,CAAD,EAAwCC,OAAxC,CADR;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,KAAF;;AAAA;AAAA;AAAA;;AAAA;AAAA,KATkB;AAWvBC,EAAAA,aAAa,EAAbA,aAXuB;AAYvBD,EAAAA,OAAO,EAAE;AACPI,IAAAA,GAAG,EAAE,EADE;AAEPC,IAAAA,GAAG,EAAE;AAACC,MAAAA,MAAM,EAAE;AAAT;AAFE;AAZc,CAAlB;;;AAkBP,SAASL,aAAT,CAAuBL,IAAvB,EAAwD;AAAA;;AAAA,MAAnBI,OAAmB,uEAAJ,EAAI;AACtD,MAAMO,GAAG,GAAG,IAAIC,SAAJ,GAAgBC,eAAhB,CAAgCb,IAAhC,EAAsC,UAAtC,CAAZ;AACA,MAAMc,OAAO,GAAG,oBAAIH,GAAJ,CAAhB;;AAEA,UAAQP,OAAR,aAAQA,OAAR,uCAAQA,OAAO,CAAEI,GAAjB,iDAAQ,aAAcO,IAAtB;AACE,SAAK,kBAAL;AACE,aAAOD,OAAO,CAACE,QAAf;;AACF;AAHF;;AAMA,UAAQZ,OAAR,aAAQA,OAAR,uCAAQA,OAAO,CAAEK,GAAjB,iDAAQ,aAAcC,MAAtB;AACE,SAAK,SAAL;AACE,aAAOI,OAAP;;AACF,SAAK,QAAL;AACE,aAAO,0BAAgBA,OAAO,CAACE,QAAxB,CAAP;;AACF,SAAK,KAAL;AACE,aAAOL,GAAP;;AACF;AACE,YAAM,IAAIM,KAAJ,EAAN;AARJ;AAUD;;AAEM,IAAMC,mBAAqC,GAAGzB,SAA9C","sourcesContent":["import type {LoaderWithParser, LoaderOptions} from '@loaders.gl/loader-utils';\nimport {geojsonToBinary} from '@loaders.gl/gis';\nimport {tcx} from '@tmcw/togeojson';\n\n// __VERSION__ is injected by babel-plugin-version-inline\n// @ts-ignore TS2304: Cannot find name '__VERSION__'.\nconst VERSION = typeof __VERSION__ !== 'undefined' ? __VERSION__ : 'latest';\n\nexport type TCXLoaderOptions = LoaderOptions & {\n tcx?: {};\n};\n\nconst TCX_HEADER = `\\\n<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<TrainingCenterDatabase`;\n\n/**\n * Loader for TCX (Training Center XML) - Garmin GPS track format\n */\nexport const TCXLoader = {\n name: 'TCX (Training Center XML)',\n id: 'tcx',\n module: 'kml',\n version: VERSION,\n extensions: ['tcx'],\n mimeTypes: ['application/vnd.garmin.tcx+xml'],\n text: true,\n tests: [TCX_HEADER],\n parse: async (arrayBuffer, options) =>\n parseTextSync(new TextDecoder().decode(arrayBuffer), options),\n parseTextSync,\n options: {\n tcx: {},\n gis: {format: 'geojson'}\n }\n};\n\nfunction parseTextSync(text: string, options: any = {}) {\n const doc = new DOMParser().parseFromString(text, 'text/xml');\n const geojson = tcx(doc);\n\n switch (options?.tcx?.type) {\n case 'object-row-table':\n return geojson.features;\n default:\n }\n\n switch (options?.gis?.format) {\n case 'geojson':\n return geojson;\n case 'binary':\n return geojsonToBinary(geojson.features);\n case 'raw':\n return doc;\n default:\n throw new Error();\n }\n}\n\nexport const _typecheckTCXLoader: LoaderWithParser = TCXLoader;\n"],"file":"tcx-loader.js"}
File without changes
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/bundle.ts"],"names":["moduleExports","require","globalThis","loaders","module","exports","Object","assign"],"mappings":"AACA,MAAMA,aAAa,GAAGC,OAAO,CAAC,SAAD,CAA7B;;AACAC,UAAU,CAACC,OAAX,GAAqBD,UAAU,CAACC,OAAX,IAAsB,EAA3C;AACAC,MAAM,CAACC,OAAP,GAAiBC,MAAM,CAACC,MAAP,CAAcL,UAAU,CAACC,OAAzB,EAAkCH,aAAlC,CAAjB","sourcesContent":["// @ts-nocheck\nconst moduleExports = require('./index');\nglobalThis.loaders = globalThis.loaders || {};\nmodule.exports = Object.assign(globalThis.loaders, moduleExports);\n"],"file":"bundle.js"}
@@ -1,6 +1,6 @@
1
1
  import { geojsonToBinary } from '@loaders.gl/gis';
2
2
  import { gpx } from '@tmcw/togeojson';
3
- const VERSION = typeof "3.1.0-alpha.3" !== 'undefined' ? "3.1.0-alpha.3" : 'latest';
3
+ const VERSION = typeof "3.1.0-alpha.4" !== 'undefined' ? "3.1.0-alpha.4" : 'latest';
4
4
  const GPX_HEADER = `\
5
5
  <?xml version="1.0" encoding="UTF-8"?>
6
6
  <gpx`;
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/gpx-loader.ts"],"names":["geojsonToBinary","gpx","VERSION","GPX_HEADER","GPXLoader","name","id","module","version","extensions","mimeTypes","text","tests","parse","arrayBuffer","options","parseTextSync","TextDecoder","decode","gis","format","doc","DOMParser","parseFromString","geojson","type","features","Error","_typecheckGPXLoader"],"mappings":"AACA,SAAQA,eAAR,QAA8B,iBAA9B;AACA,SAAQC,GAAR,QAAkB,iBAAlB;AAIA,MAAMC,OAAO,GAAG,2BAAuB,WAAvB,qBAAmD,QAAnE;AAMA,MAAMC,UAAU,GAAI;AACpB;AACA,KAFA;AAOA,OAAO,MAAMC,SAAS,GAAG;AACvBC,EAAAA,IAAI,EAAE,2BADiB;AAEvBC,EAAAA,EAAE,EAAE,KAFmB;AAGvBC,EAAAA,MAAM,EAAE,KAHe;AAIvBC,EAAAA,OAAO,EAAEN,OAJc;AAKvBO,EAAAA,UAAU,EAAE,CAAC,KAAD,CALW;AAMvBC,EAAAA,SAAS,EAAE,CAAC,qBAAD,CANY;AAOvBC,EAAAA,IAAI,EAAE,IAPiB;AAQvBC,EAAAA,KAAK,EAAE,CAACT,UAAD,CARgB;AASvBU,EAAAA,KAAK,EAAE,OAAOC,WAAP,EAAoBC,OAApB,KACLC,aAAa,CAAC,IAAIC,WAAJ,GAAkBC,MAAlB,CAAyBJ,WAAzB,CAAD,EAAwCC,OAAxC,CAVQ;AAWvBC,EAAAA,aAXuB;AAYvBD,EAAAA,OAAO,EAAE;AACPd,IAAAA,GAAG,EAAE,EADE;AAEPkB,IAAAA,GAAG,EAAE;AAACC,MAAAA,MAAM,EAAE;AAAT;AAFE;AAZc,CAAlB;;AAkBP,SAASJ,aAAT,CAAuBL,IAAvB,EAAqCI,OAArC,EAAmD;AAAA;;AACjD,QAAMM,GAAG,GAAG,IAAIC,SAAJ,GAAgBC,eAAhB,CAAgCZ,IAAhC,EAAsC,UAAtC,CAAZ;AACA,QAAMa,OAAO,GAAGvB,GAAG,CAACoB,GAAD,CAAnB;;AAEA,UAAQN,OAAR,aAAQA,OAAR,uCAAQA,OAAO,CAAEd,GAAjB,iDAAQ,aAAcwB,IAAtB;AACE,SAAK,kBAAL;AACE,aAAOD,OAAO,CAACE,QAAf;;AACF;AAHF;;AAMA,UAAQX,OAAR,aAAQA,OAAR,uCAAQA,OAAO,CAAEI,GAAjB,iDAAQ,aAAcC,MAAtB;AACE,SAAK,SAAL;AACE,aAAOI,OAAP;;AACF,SAAK,QAAL;AACE,aAAOxB,eAAe,CAACwB,OAAO,CAACE,QAAT,CAAtB;;AACF,SAAK,KAAL;AACE,aAAOL,GAAP;;AACF;AACE,YAAM,IAAIM,KAAJ,EAAN;AARJ;AAUD;;AAED,OAAO,MAAMC,mBAAmB,GAAGxB,SAA5B","sourcesContent":["import type {LoaderOptions} from '@loaders.gl/loader-utils';\nimport {geojsonToBinary} from '@loaders.gl/gis';\nimport {gpx} from '@tmcw/togeojson';\n\n// __VERSION__ is injected by babel-plugin-version-inline\n// @ts-ignore TS2304: Cannot find name '__VERSION__'.\nconst VERSION = typeof __VERSION__ !== 'undefined' ? __VERSION__ : 'latest';\n\nexport type GPXLoaderOptions = LoaderOptions & {\n gpx?: {};\n};\n\nconst GPX_HEADER = `\\\n<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<gpx`;\n\n/**\n * Loader for GPX (GPS exchange format)\n */\nexport const GPXLoader = {\n name: 'GPX (GPS exchange format)',\n id: 'gpx',\n module: 'kml',\n version: VERSION,\n extensions: ['gpx'],\n mimeTypes: ['application/gpx+xml'],\n text: true,\n tests: [GPX_HEADER],\n parse: async (arrayBuffer, options) =>\n parseTextSync(new TextDecoder().decode(arrayBuffer), options),\n parseTextSync,\n options: {\n gpx: {},\n gis: {format: 'geojson'}\n }\n};\n\nfunction parseTextSync(text: string, options: any) {\n const doc = new DOMParser().parseFromString(text, 'text/xml');\n const geojson = gpx(doc);\n\n switch (options?.gpx?.type) {\n case 'object-row-table':\n return geojson.features;\n default:\n }\n\n switch (options?.gis?.format) {\n case 'geojson':\n return geojson;\n case 'binary':\n return geojsonToBinary(geojson.features);\n case 'raw':\n return doc;\n default:\n throw new Error();\n }\n}\n\nexport const _typecheckGPXLoader = GPXLoader;\n"],"file":"gpx-loader.js"}
File without changes
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/index.ts"],"names":["GPXLoader","KMLLoader","TCXLoader"],"mappings":"AACA,SAAQA,SAAR,QAAwB,cAAxB;AAGA,SAAQC,SAAR,QAAwB,cAAxB;AAGA,SAAQC,SAAR,QAAwB,cAAxB","sourcesContent":["export type {GPXLoaderOptions} from './gpx-loader';\nexport {GPXLoader} from './gpx-loader';\n\nexport type {KMLLoaderOptions} from './kml-loader';\nexport {KMLLoader} from './kml-loader';\n\nexport type {TCXLoaderOptions} from './tcx-loader';\nexport {TCXLoader} from './tcx-loader';\n"],"file":"index.js"}
@@ -1,6 +1,6 @@
1
1
  import { geojsonToBinary } from '@loaders.gl/gis';
2
2
  import { kml } from '@tmcw/togeojson';
3
- const VERSION = typeof "3.1.0-alpha.3" !== 'undefined' ? "3.1.0-alpha.3" : 'latest';
3
+ const VERSION = typeof "3.1.0-alpha.4" !== 'undefined' ? "3.1.0-alpha.4" : 'latest';
4
4
  const KML_HEADER = `\
5
5
  <?xml version="1.0" encoding="UTF-8"?>
6
6
  <kml xmlns="http://www.opengis.net/kml/2.2">`;
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/kml-loader.ts"],"names":["geojsonToBinary","kml","VERSION","KML_HEADER","KMLLoader","name","id","module","version","extensions","mimeTypes","text","tests","parse","arrayBuffer","options","parseTextSync","TextDecoder","decode","gis","format","doc","DOMParser","parseFromString","geojson","type","features","Error","_typecheckKMLLoader"],"mappings":"AACA,SAAQA,eAAR,QAA8B,iBAA9B;AACA,SAAQC,GAAR,QAAkB,iBAAlB;AAIA,MAAMC,OAAO,GAAG,2BAAuB,WAAvB,qBAAmD,QAAnE;AAMA,MAAMC,UAAU,GAAI;AACpB;AACA,6CAFA;AAOA,OAAO,MAAMC,SAAS,GAAG;AACvBC,EAAAA,IAAI,EAAE,+BADiB;AAEvBC,EAAAA,EAAE,EAAE,KAFmB;AAGvBC,EAAAA,MAAM,EAAE,KAHe;AAIvBC,EAAAA,OAAO,EAAEN,OAJc;AAKvBO,EAAAA,UAAU,EAAE,CAAC,KAAD,CALW;AAMvBC,EAAAA,SAAS,EAAE,CAAC,sCAAD,CANY;AAOvBC,EAAAA,IAAI,EAAE,IAPiB;AAQvBC,EAAAA,KAAK,EAAE,CAACT,UAAD,CARgB;AASvBU,EAAAA,KAAK,EAAE,OAAOC,WAAP,EAAoBC,OAApB,KACLC,aAAa,CAAC,IAAIC,WAAJ,GAAkBC,MAAlB,CAAyBJ,WAAzB,CAAD,EAAwCC,OAAxC,CAVQ;AAWvBC,EAAAA,aAXuB;AAYvBD,EAAAA,OAAO,EAAE;AACPd,IAAAA,GAAG,EAAE,EADE;AAEPkB,IAAAA,GAAG,EAAE;AAACC,MAAAA,MAAM,EAAE;AAAT;AAFE;AAZc,CAAlB;;AAkBP,SAASJ,aAAT,CAAuBL,IAAvB,EAAqCI,OAArC,EAAmD;AAAA;;AACjD,QAAMM,GAAG,GAAG,IAAIC,SAAJ,GAAgBC,eAAhB,CAAgCZ,IAAhC,EAAsC,UAAtC,CAAZ;AACA,QAAMa,OAAO,GAAGvB,GAAG,CAACoB,GAAD,CAAnB;;AAEA,UAAQN,OAAR,aAAQA,OAAR,uCAAQA,OAAO,CAAEd,GAAjB,iDAAQ,aAAcwB,IAAtB;AACE,SAAK,kBAAL;AACE,aAAOD,OAAO,CAACE,QAAf;;AACF;AAHF;;AAMA,UAAQX,OAAR,aAAQA,OAAR,uCAAQA,OAAO,CAAEI,GAAjB,iDAAQ,aAAcC,MAAtB;AACE,SAAK,SAAL;AACE,aAAOI,OAAP;;AACF,SAAK,QAAL;AACE,aAAOxB,eAAe,CAACwB,OAAO,CAACE,QAAT,CAAtB;;AACF,SAAK,KAAL;AACE,aAAOL,GAAP;;AACF;AACE,YAAM,IAAIM,KAAJ,EAAN;AARJ;AAUD;;AAED,OAAO,MAAMC,mBAAqC,GAAGxB,SAA9C","sourcesContent":["import type {LoaderWithParser, LoaderOptions} from '@loaders.gl/loader-utils';\nimport {geojsonToBinary} from '@loaders.gl/gis';\nimport {kml} from '@tmcw/togeojson';\n\n// __VERSION__ is injected by babel-plugin-version-inline\n// @ts-ignore TS2304: Cannot find name '__VERSION__'.\nconst VERSION = typeof __VERSION__ !== 'undefined' ? __VERSION__ : 'latest';\n\nexport type KMLLoaderOptions = LoaderOptions & {\n kml?: {};\n};\n\nconst KML_HEADER = `\\\n<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<kml xmlns=\"http://www.opengis.net/kml/2.2\">`;\n\n/**\n * Loader for KML (Keyhole Markup Language)\n */\nexport const KMLLoader = {\n name: 'KML (Keyhole Markup Language)',\n id: 'kml',\n module: 'kml',\n version: VERSION,\n extensions: ['kml'],\n mimeTypes: ['application/vnd.google-earth.kml+xml'],\n text: true,\n tests: [KML_HEADER],\n parse: async (arrayBuffer, options) =>\n parseTextSync(new TextDecoder().decode(arrayBuffer), options),\n parseTextSync,\n options: {\n kml: {},\n gis: {format: 'geojson'}\n }\n};\n\nfunction parseTextSync(text: string, options: any) {\n const doc = new DOMParser().parseFromString(text, 'text/xml');\n const geojson = kml(doc);\n\n switch (options?.kml?.type) {\n case 'object-row-table':\n return geojson.features;\n default:\n }\n\n switch (options?.gis?.format) {\n case 'geojson':\n return geojson;\n case 'binary':\n return geojsonToBinary(geojson.features);\n case 'raw':\n return doc;\n default:\n throw new Error();\n }\n}\n\nexport const _typecheckKMLLoader: LoaderWithParser = KMLLoader;\n"],"file":"kml-loader.js"}
@@ -1,6 +1,6 @@
1
1
  import { geojsonToBinary } from '@loaders.gl/gis';
2
2
  import { tcx } from '@tmcw/togeojson';
3
- const VERSION = typeof "3.1.0-alpha.3" !== 'undefined' ? "3.1.0-alpha.3" : 'latest';
3
+ const VERSION = typeof "3.1.0-alpha.4" !== 'undefined' ? "3.1.0-alpha.4" : 'latest';
4
4
  const TCX_HEADER = `\
5
5
  <?xml version="1.0" encoding="UTF-8"?>
6
6
  <TrainingCenterDatabase`;
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/tcx-loader.ts"],"names":["geojsonToBinary","tcx","VERSION","TCX_HEADER","TCXLoader","name","id","module","version","extensions","mimeTypes","text","tests","parse","arrayBuffer","options","parseTextSync","TextDecoder","decode","gis","format","doc","DOMParser","parseFromString","geojson","type","features","Error","_typecheckTCXLoader"],"mappings":"AACA,SAAQA,eAAR,QAA8B,iBAA9B;AACA,SAAQC,GAAR,QAAkB,iBAAlB;AAIA,MAAMC,OAAO,GAAG,2BAAuB,WAAvB,qBAAmD,QAAnE;AAMA,MAAMC,UAAU,GAAI;AACpB;AACA,wBAFA;AAOA,OAAO,MAAMC,SAAS,GAAG;AACvBC,EAAAA,IAAI,EAAE,2BADiB;AAEvBC,EAAAA,EAAE,EAAE,KAFmB;AAGvBC,EAAAA,MAAM,EAAE,KAHe;AAIvBC,EAAAA,OAAO,EAAEN,OAJc;AAKvBO,EAAAA,UAAU,EAAE,CAAC,KAAD,CALW;AAMvBC,EAAAA,SAAS,EAAE,CAAC,gCAAD,CANY;AAOvBC,EAAAA,IAAI,EAAE,IAPiB;AAQvBC,EAAAA,KAAK,EAAE,CAACT,UAAD,CARgB;AASvBU,EAAAA,KAAK,EAAE,OAAOC,WAAP,EAAoBC,OAApB,KACLC,aAAa,CAAC,IAAIC,WAAJ,GAAkBC,MAAlB,CAAyBJ,WAAzB,CAAD,EAAwCC,OAAxC,CAVQ;AAWvBC,EAAAA,aAXuB;AAYvBD,EAAAA,OAAO,EAAE;AACPd,IAAAA,GAAG,EAAE,EADE;AAEPkB,IAAAA,GAAG,EAAE;AAACC,MAAAA,MAAM,EAAE;AAAT;AAFE;AAZc,CAAlB;;AAkBP,SAASJ,aAAT,CAAuBL,IAAvB,EAAqCI,OAAY,GAAG,EAApD,EAAwD;AAAA;;AACtD,QAAMM,GAAG,GAAG,IAAIC,SAAJ,GAAgBC,eAAhB,CAAgCZ,IAAhC,EAAsC,UAAtC,CAAZ;AACA,QAAMa,OAAO,GAAGvB,GAAG,CAACoB,GAAD,CAAnB;;AAEA,UAAQN,OAAR,aAAQA,OAAR,uCAAQA,OAAO,CAAEd,GAAjB,iDAAQ,aAAcwB,IAAtB;AACE,SAAK,kBAAL;AACE,aAAOD,OAAO,CAACE,QAAf;;AACF;AAHF;;AAMA,UAAQX,OAAR,aAAQA,OAAR,uCAAQA,OAAO,CAAEI,GAAjB,iDAAQ,aAAcC,MAAtB;AACE,SAAK,SAAL;AACE,aAAOI,OAAP;;AACF,SAAK,QAAL;AACE,aAAOxB,eAAe,CAACwB,OAAO,CAACE,QAAT,CAAtB;;AACF,SAAK,KAAL;AACE,aAAOL,GAAP;;AACF;AACE,YAAM,IAAIM,KAAJ,EAAN;AARJ;AAUD;;AAED,OAAO,MAAMC,mBAAqC,GAAGxB,SAA9C","sourcesContent":["import type {LoaderWithParser, LoaderOptions} from '@loaders.gl/loader-utils';\nimport {geojsonToBinary} from '@loaders.gl/gis';\nimport {tcx} from '@tmcw/togeojson';\n\n// __VERSION__ is injected by babel-plugin-version-inline\n// @ts-ignore TS2304: Cannot find name '__VERSION__'.\nconst VERSION = typeof __VERSION__ !== 'undefined' ? __VERSION__ : 'latest';\n\nexport type TCXLoaderOptions = LoaderOptions & {\n tcx?: {};\n};\n\nconst TCX_HEADER = `\\\n<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<TrainingCenterDatabase`;\n\n/**\n * Loader for TCX (Training Center XML) - Garmin GPS track format\n */\nexport const TCXLoader = {\n name: 'TCX (Training Center XML)',\n id: 'tcx',\n module: 'kml',\n version: VERSION,\n extensions: ['tcx'],\n mimeTypes: ['application/vnd.garmin.tcx+xml'],\n text: true,\n tests: [TCX_HEADER],\n parse: async (arrayBuffer, options) =>\n parseTextSync(new TextDecoder().decode(arrayBuffer), options),\n parseTextSync,\n options: {\n tcx: {},\n gis: {format: 'geojson'}\n }\n};\n\nfunction parseTextSync(text: string, options: any = {}) {\n const doc = new DOMParser().parseFromString(text, 'text/xml');\n const geojson = tcx(doc);\n\n switch (options?.tcx?.type) {\n case 'object-row-table':\n return geojson.features;\n default:\n }\n\n switch (options?.gis?.format) {\n case 'geojson':\n return geojson;\n case 'binary':\n return geojsonToBinary(geojson.features);\n case 'raw':\n return doc;\n default:\n throw new Error();\n }\n}\n\nexport const _typecheckTCXLoader: LoaderWithParser = TCXLoader;\n"],"file":"tcx-loader.js"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@loaders.gl/kml",
3
- "version": "3.1.0-alpha.3",
3
+ "version": "3.1.0-alpha.4",
4
4
  "description": "Framework-independent loader for the KML format",
5
5
  "license": "MIT",
6
6
  "publishConfig": {
@@ -19,8 +19,8 @@
19
19
  "KML"
20
20
  ],
21
21
  "types": "src/index.ts",
22
- "main": "dist/index.js",
23
- "module": "dist/index.js",
22
+ "main": "dist/es5/index.js",
23
+ "module": "dist/esm/index.js",
24
24
  "sideEffects": false,
25
25
  "files": [
26
26
  "src",
@@ -32,11 +32,11 @@
32
32
  "build-bundle": "webpack --display=minimal --config ../../scripts/webpack/bundle.js"
33
33
  },
34
34
  "dependencies": {
35
- "@loaders.gl/core": "3.1.0-alpha.3",
36
- "@loaders.gl/gis": "3.1.0-alpha.3",
37
- "@loaders.gl/loader-utils": "3.1.0-alpha.3",
38
- "@loaders.gl/schema": "3.1.0-alpha.3",
35
+ "@loaders.gl/core": "3.1.0-alpha.4",
36
+ "@loaders.gl/gis": "3.1.0-alpha.4",
37
+ "@loaders.gl/loader-utils": "3.1.0-alpha.4",
38
+ "@loaders.gl/schema": "3.1.0-alpha.4",
39
39
  "@tmcw/togeojson": "^4.5.0"
40
40
  },
41
- "gitHead": "68e1c443d1b63aa2515436a7411ed0a029b42c15"
41
+ "gitHead": "e309784af37ef9f3640c7733c7851124c72e1fa3"
42
42
  }
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/bundle.ts"],"names":["moduleExports","require","globalThis","loaders","module","exports","Object","assign"],"mappings":"AACA,MAAMA,aAAa,GAAGC,OAAO,CAAC,SAAD,CAA7B;;AACAC,UAAU,CAACC,OAAX,GAAqBD,UAAU,CAACC,OAAX,IAAsB,EAA3C;AACAC,MAAM,CAACC,OAAP,GAAiBC,MAAM,CAACC,MAAP,CAAcL,UAAU,CAACC,OAAzB,EAAkCH,aAAlC,CAAjB","sourcesContent":["// @ts-nocheck\nconst moduleExports = require('./index');\nglobalThis.loaders = globalThis.loaders || {};\nmodule.exports = Object.assign(globalThis.loaders, moduleExports);\n"],"file":"bundle.js"}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/gpx-loader.ts"],"names":["geojsonToBinary","gpx","VERSION","GPX_HEADER","GPXLoader","name","id","module","version","extensions","mimeTypes","text","tests","parse","arrayBuffer","options","parseTextSync","TextDecoder","decode","gis","format","doc","DOMParser","parseFromString","geojson","type","features","Error","_typecheckGPXLoader"],"mappings":"AACA,SAAQA,eAAR,QAA8B,iBAA9B;AACA,SAAQC,GAAR,QAAkB,iBAAlB;AAIA,MAAMC,OAAO,GAAG,2BAAuB,WAAvB,qBAAmD,QAAnE;AAMA,MAAMC,UAAU,GAAI;AACpB;AACA,KAFA;AAOA,OAAO,MAAMC,SAAS,GAAG;AACvBC,EAAAA,IAAI,EAAE,2BADiB;AAEvBC,EAAAA,EAAE,EAAE,KAFmB;AAGvBC,EAAAA,MAAM,EAAE,KAHe;AAIvBC,EAAAA,OAAO,EAAEN,OAJc;AAKvBO,EAAAA,UAAU,EAAE,CAAC,KAAD,CALW;AAMvBC,EAAAA,SAAS,EAAE,CAAC,qBAAD,CANY;AAOvBC,EAAAA,IAAI,EAAE,IAPiB;AAQvBC,EAAAA,KAAK,EAAE,CAACT,UAAD,CARgB;AASvBU,EAAAA,KAAK,EAAE,OAAOC,WAAP,EAAoBC,OAApB,KACLC,aAAa,CAAC,IAAIC,WAAJ,GAAkBC,MAAlB,CAAyBJ,WAAzB,CAAD,EAAwCC,OAAxC,CAVQ;AAWvBC,EAAAA,aAXuB;AAYvBD,EAAAA,OAAO,EAAE;AACPd,IAAAA,GAAG,EAAE,EADE;AAEPkB,IAAAA,GAAG,EAAE;AAACC,MAAAA,MAAM,EAAE;AAAT;AAFE;AAZc,CAAlB;;AAkBP,SAASJ,aAAT,CAAuBL,IAAvB,EAAqCI,OAArC,EAAmD;AAAA;;AACjD,QAAMM,GAAG,GAAG,IAAIC,SAAJ,GAAgBC,eAAhB,CAAgCZ,IAAhC,EAAsC,UAAtC,CAAZ;AACA,QAAMa,OAAO,GAAGvB,GAAG,CAACoB,GAAD,CAAnB;;AAEA,UAAQN,OAAR,aAAQA,OAAR,uCAAQA,OAAO,CAAEd,GAAjB,iDAAQ,aAAcwB,IAAtB;AACE,SAAK,kBAAL;AACE,aAAOD,OAAO,CAACE,QAAf;;AACF;AAHF;;AAMA,UAAQX,OAAR,aAAQA,OAAR,uCAAQA,OAAO,CAAEI,GAAjB,iDAAQ,aAAcC,MAAtB;AACE,SAAK,SAAL;AACE,aAAOI,OAAP;;AACF,SAAK,QAAL;AACE,aAAOxB,eAAe,CAACwB,OAAO,CAACE,QAAT,CAAtB;;AACF,SAAK,KAAL;AACE,aAAOL,GAAP;;AACF;AACE,YAAM,IAAIM,KAAJ,EAAN;AARJ;AAUD;;AAED,OAAO,MAAMC,mBAAmB,GAAGxB,SAA5B","sourcesContent":["import type {LoaderOptions} from '@loaders.gl/loader-utils';\nimport {geojsonToBinary} from '@loaders.gl/gis';\nimport {gpx} from '@tmcw/togeojson';\n\n// __VERSION__ is injected by babel-plugin-version-inline\n// @ts-ignore TS2304: Cannot find name '__VERSION__'.\nconst VERSION = typeof __VERSION__ !== 'undefined' ? __VERSION__ : 'latest';\n\nexport type GPXLoaderOptions = LoaderOptions & {\n gpx?: {};\n};\n\nconst GPX_HEADER = `\\\n<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<gpx`;\n\n/**\n * Loader for GPX (GPS exchange format)\n */\nexport const GPXLoader = {\n name: 'GPX (GPS exchange format)',\n id: 'gpx',\n module: 'kml',\n version: VERSION,\n extensions: ['gpx'],\n mimeTypes: ['application/gpx+xml'],\n text: true,\n tests: [GPX_HEADER],\n parse: async (arrayBuffer, options) =>\n parseTextSync(new TextDecoder().decode(arrayBuffer), options),\n parseTextSync,\n options: {\n gpx: {},\n gis: {format: 'geojson'}\n }\n};\n\nfunction parseTextSync(text: string, options: any) {\n const doc = new DOMParser().parseFromString(text, 'text/xml');\n const geojson = gpx(doc);\n\n switch (options?.gpx?.type) {\n case 'object-row-table':\n return geojson.features;\n default:\n }\n\n switch (options?.gis?.format) {\n case 'geojson':\n return geojson;\n case 'binary':\n return geojsonToBinary(geojson.features);\n case 'raw':\n return doc;\n default:\n throw new Error();\n }\n}\n\nexport const _typecheckGPXLoader = GPXLoader;\n"],"file":"gpx-loader.js"}
package/dist/index.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/index.ts"],"names":["GPXLoader","KMLLoader","TCXLoader"],"mappings":"AACA,SAAQA,SAAR,QAAwB,cAAxB;AAGA,SAAQC,SAAR,QAAwB,cAAxB;AAGA,SAAQC,SAAR,QAAwB,cAAxB","sourcesContent":["export type {GPXLoaderOptions} from './gpx-loader';\nexport {GPXLoader} from './gpx-loader';\n\nexport type {KMLLoaderOptions} from './kml-loader';\nexport {KMLLoader} from './kml-loader';\n\nexport type {TCXLoaderOptions} from './tcx-loader';\nexport {TCXLoader} from './tcx-loader';\n"],"file":"index.js"}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/kml-loader.ts"],"names":["geojsonToBinary","kml","VERSION","KML_HEADER","KMLLoader","name","id","module","version","extensions","mimeTypes","text","tests","parse","arrayBuffer","options","parseTextSync","TextDecoder","decode","gis","format","doc","DOMParser","parseFromString","geojson","type","features","Error","_typecheckKMLLoader"],"mappings":"AACA,SAAQA,eAAR,QAA8B,iBAA9B;AACA,SAAQC,GAAR,QAAkB,iBAAlB;AAIA,MAAMC,OAAO,GAAG,2BAAuB,WAAvB,qBAAmD,QAAnE;AAMA,MAAMC,UAAU,GAAI;AACpB;AACA,6CAFA;AAOA,OAAO,MAAMC,SAAS,GAAG;AACvBC,EAAAA,IAAI,EAAE,+BADiB;AAEvBC,EAAAA,EAAE,EAAE,KAFmB;AAGvBC,EAAAA,MAAM,EAAE,KAHe;AAIvBC,EAAAA,OAAO,EAAEN,OAJc;AAKvBO,EAAAA,UAAU,EAAE,CAAC,KAAD,CALW;AAMvBC,EAAAA,SAAS,EAAE,CAAC,sCAAD,CANY;AAOvBC,EAAAA,IAAI,EAAE,IAPiB;AAQvBC,EAAAA,KAAK,EAAE,CAACT,UAAD,CARgB;AASvBU,EAAAA,KAAK,EAAE,OAAOC,WAAP,EAAoBC,OAApB,KACLC,aAAa,CAAC,IAAIC,WAAJ,GAAkBC,MAAlB,CAAyBJ,WAAzB,CAAD,EAAwCC,OAAxC,CAVQ;AAWvBC,EAAAA,aAXuB;AAYvBD,EAAAA,OAAO,EAAE;AACPd,IAAAA,GAAG,EAAE,EADE;AAEPkB,IAAAA,GAAG,EAAE;AAACC,MAAAA,MAAM,EAAE;AAAT;AAFE;AAZc,CAAlB;;AAkBP,SAASJ,aAAT,CAAuBL,IAAvB,EAAqCI,OAArC,EAAmD;AAAA;;AACjD,QAAMM,GAAG,GAAG,IAAIC,SAAJ,GAAgBC,eAAhB,CAAgCZ,IAAhC,EAAsC,UAAtC,CAAZ;AACA,QAAMa,OAAO,GAAGvB,GAAG,CAACoB,GAAD,CAAnB;;AAEA,UAAQN,OAAR,aAAQA,OAAR,uCAAQA,OAAO,CAAEd,GAAjB,iDAAQ,aAAcwB,IAAtB;AACE,SAAK,kBAAL;AACE,aAAOD,OAAO,CAACE,QAAf;;AACF;AAHF;;AAMA,UAAQX,OAAR,aAAQA,OAAR,uCAAQA,OAAO,CAAEI,GAAjB,iDAAQ,aAAcC,MAAtB;AACE,SAAK,SAAL;AACE,aAAOI,OAAP;;AACF,SAAK,QAAL;AACE,aAAOxB,eAAe,CAACwB,OAAO,CAACE,QAAT,CAAtB;;AACF,SAAK,KAAL;AACE,aAAOL,GAAP;;AACF;AACE,YAAM,IAAIM,KAAJ,EAAN;AARJ;AAUD;;AAED,OAAO,MAAMC,mBAAqC,GAAGxB,SAA9C","sourcesContent":["import type {LoaderWithParser, LoaderOptions} from '@loaders.gl/loader-utils';\nimport {geojsonToBinary} from '@loaders.gl/gis';\nimport {kml} from '@tmcw/togeojson';\n\n// __VERSION__ is injected by babel-plugin-version-inline\n// @ts-ignore TS2304: Cannot find name '__VERSION__'.\nconst VERSION = typeof __VERSION__ !== 'undefined' ? __VERSION__ : 'latest';\n\nexport type KMLLoaderOptions = LoaderOptions & {\n kml?: {};\n};\n\nconst KML_HEADER = `\\\n<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<kml xmlns=\"http://www.opengis.net/kml/2.2\">`;\n\n/**\n * Loader for KML (Keyhole Markup Language)\n */\nexport const KMLLoader = {\n name: 'KML (Keyhole Markup Language)',\n id: 'kml',\n module: 'kml',\n version: VERSION,\n extensions: ['kml'],\n mimeTypes: ['application/vnd.google-earth.kml+xml'],\n text: true,\n tests: [KML_HEADER],\n parse: async (arrayBuffer, options) =>\n parseTextSync(new TextDecoder().decode(arrayBuffer), options),\n parseTextSync,\n options: {\n kml: {},\n gis: {format: 'geojson'}\n }\n};\n\nfunction parseTextSync(text: string, options: any) {\n const doc = new DOMParser().parseFromString(text, 'text/xml');\n const geojson = kml(doc);\n\n switch (options?.kml?.type) {\n case 'object-row-table':\n return geojson.features;\n default:\n }\n\n switch (options?.gis?.format) {\n case 'geojson':\n return geojson;\n case 'binary':\n return geojsonToBinary(geojson.features);\n case 'raw':\n return doc;\n default:\n throw new Error();\n }\n}\n\nexport const _typecheckKMLLoader: LoaderWithParser = KMLLoader;\n"],"file":"kml-loader.js"}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/tcx-loader.ts"],"names":["geojsonToBinary","tcx","VERSION","TCX_HEADER","TCXLoader","name","id","module","version","extensions","mimeTypes","text","tests","parse","arrayBuffer","options","parseTextSync","TextDecoder","decode","gis","format","doc","DOMParser","parseFromString","geojson","type","features","Error","_typecheckTCXLoader"],"mappings":"AACA,SAAQA,eAAR,QAA8B,iBAA9B;AACA,SAAQC,GAAR,QAAkB,iBAAlB;AAIA,MAAMC,OAAO,GAAG,2BAAuB,WAAvB,qBAAmD,QAAnE;AAMA,MAAMC,UAAU,GAAI;AACpB;AACA,wBAFA;AAOA,OAAO,MAAMC,SAAS,GAAG;AACvBC,EAAAA,IAAI,EAAE,2BADiB;AAEvBC,EAAAA,EAAE,EAAE,KAFmB;AAGvBC,EAAAA,MAAM,EAAE,KAHe;AAIvBC,EAAAA,OAAO,EAAEN,OAJc;AAKvBO,EAAAA,UAAU,EAAE,CAAC,KAAD,CALW;AAMvBC,EAAAA,SAAS,EAAE,CAAC,gCAAD,CANY;AAOvBC,EAAAA,IAAI,EAAE,IAPiB;AAQvBC,EAAAA,KAAK,EAAE,CAACT,UAAD,CARgB;AASvBU,EAAAA,KAAK,EAAE,OAAOC,WAAP,EAAoBC,OAApB,KACLC,aAAa,CAAC,IAAIC,WAAJ,GAAkBC,MAAlB,CAAyBJ,WAAzB,CAAD,EAAwCC,OAAxC,CAVQ;AAWvBC,EAAAA,aAXuB;AAYvBD,EAAAA,OAAO,EAAE;AACPd,IAAAA,GAAG,EAAE,EADE;AAEPkB,IAAAA,GAAG,EAAE;AAACC,MAAAA,MAAM,EAAE;AAAT;AAFE;AAZc,CAAlB;;AAkBP,SAASJ,aAAT,CAAuBL,IAAvB,EAAqCI,OAAY,GAAG,EAApD,EAAwD;AAAA;;AACtD,QAAMM,GAAG,GAAG,IAAIC,SAAJ,GAAgBC,eAAhB,CAAgCZ,IAAhC,EAAsC,UAAtC,CAAZ;AACA,QAAMa,OAAO,GAAGvB,GAAG,CAACoB,GAAD,CAAnB;;AAEA,UAAQN,OAAR,aAAQA,OAAR,uCAAQA,OAAO,CAAEd,GAAjB,iDAAQ,aAAcwB,IAAtB;AACE,SAAK,kBAAL;AACE,aAAOD,OAAO,CAACE,QAAf;;AACF;AAHF;;AAMA,UAAQX,OAAR,aAAQA,OAAR,uCAAQA,OAAO,CAAEI,GAAjB,iDAAQ,aAAcC,MAAtB;AACE,SAAK,SAAL;AACE,aAAOI,OAAP;;AACF,SAAK,QAAL;AACE,aAAOxB,eAAe,CAACwB,OAAO,CAACE,QAAT,CAAtB;;AACF,SAAK,KAAL;AACE,aAAOL,GAAP;;AACF;AACE,YAAM,IAAIM,KAAJ,EAAN;AARJ;AAUD;;AAED,OAAO,MAAMC,mBAAqC,GAAGxB,SAA9C","sourcesContent":["import type {LoaderWithParser, LoaderOptions} from '@loaders.gl/loader-utils';\nimport {geojsonToBinary} from '@loaders.gl/gis';\nimport {tcx} from '@tmcw/togeojson';\n\n// __VERSION__ is injected by babel-plugin-version-inline\n// @ts-ignore TS2304: Cannot find name '__VERSION__'.\nconst VERSION = typeof __VERSION__ !== 'undefined' ? __VERSION__ : 'latest';\n\nexport type TCXLoaderOptions = LoaderOptions & {\n tcx?: {};\n};\n\nconst TCX_HEADER = `\\\n<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<TrainingCenterDatabase`;\n\n/**\n * Loader for TCX (Training Center XML) - Garmin GPS track format\n */\nexport const TCXLoader = {\n name: 'TCX (Training Center XML)',\n id: 'tcx',\n module: 'kml',\n version: VERSION,\n extensions: ['tcx'],\n mimeTypes: ['application/vnd.garmin.tcx+xml'],\n text: true,\n tests: [TCX_HEADER],\n parse: async (arrayBuffer, options) =>\n parseTextSync(new TextDecoder().decode(arrayBuffer), options),\n parseTextSync,\n options: {\n tcx: {},\n gis: {format: 'geojson'}\n }\n};\n\nfunction parseTextSync(text: string, options: any = {}) {\n const doc = new DOMParser().parseFromString(text, 'text/xml');\n const geojson = tcx(doc);\n\n switch (options?.tcx?.type) {\n case 'object-row-table':\n return geojson.features;\n default:\n }\n\n switch (options?.gis?.format) {\n case 'geojson':\n return geojson;\n case 'binary':\n return geojsonToBinary(geojson.features);\n case 'raw':\n return doc;\n default:\n throw new Error();\n }\n}\n\nexport const _typecheckTCXLoader: LoaderWithParser = TCXLoader;\n"],"file":"tcx-loader.js"}