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

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.
@@ -0,0 +1,50 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports._typecheckKMLLoader = exports.KMLLoader = void 0;
4
+ const gis_1 = require("@loaders.gl/gis");
5
+ const togeojson_1 = require("@tmcw/togeojson");
6
+ // __VERSION__ is injected by babel-plugin-version-inline
7
+ // @ts-ignore TS2304: Cannot find name '__VERSION__'.
8
+ const VERSION = typeof __VERSION__ !== 'undefined' ? __VERSION__ : 'latest';
9
+ const KML_HEADER = `\
10
+ <?xml version="1.0" encoding="UTF-8"?>
11
+ <kml xmlns="http://www.opengis.net/kml/2.2">`;
12
+ /**
13
+ * Loader for KML (Keyhole Markup Language)
14
+ */
15
+ exports.KMLLoader = {
16
+ name: 'KML (Keyhole Markup Language)',
17
+ id: 'kml',
18
+ module: 'kml',
19
+ version: VERSION,
20
+ extensions: ['kml'],
21
+ mimeTypes: ['application/vnd.google-earth.kml+xml'],
22
+ text: true,
23
+ tests: [KML_HEADER],
24
+ parse: async (arrayBuffer, options) => parseTextSync(new TextDecoder().decode(arrayBuffer), options),
25
+ parseTextSync,
26
+ options: {
27
+ kml: {},
28
+ gis: { format: 'geojson' }
29
+ }
30
+ };
31
+ function parseTextSync(text, options) {
32
+ const doc = new DOMParser().parseFromString(text, 'text/xml');
33
+ const geojson = (0, togeojson_1.kml)(doc);
34
+ switch (options?.kml?.type) {
35
+ case 'object-row-table':
36
+ return geojson.features;
37
+ default:
38
+ }
39
+ switch (options?.gis?.format) {
40
+ case 'geojson':
41
+ return geojson;
42
+ case 'binary':
43
+ return (0, gis_1.geojsonToBinary)(geojson.features);
44
+ case 'raw':
45
+ return doc;
46
+ default:
47
+ throw new Error();
48
+ }
49
+ }
50
+ exports._typecheckKMLLoader = exports.KMLLoader;
@@ -0,0 +1,29 @@
1
+ import type { LoaderWithParser, LoaderOptions } from '@loaders.gl/loader-utils';
2
+ export declare type TCXLoaderOptions = LoaderOptions & {
3
+ tcx?: {};
4
+ };
5
+ /**
6
+ * Loader for TCX (Training Center XML) - Garmin GPS track format
7
+ */
8
+ export declare const TCXLoader: {
9
+ name: string;
10
+ id: string;
11
+ module: string;
12
+ version: any;
13
+ extensions: string[];
14
+ mimeTypes: string[];
15
+ text: boolean;
16
+ tests: string[];
17
+ parse: (arrayBuffer: any, options: any) => Promise<any>;
18
+ parseTextSync: typeof parseTextSync;
19
+ options: {
20
+ tcx: {};
21
+ gis: {
22
+ format: string;
23
+ };
24
+ };
25
+ };
26
+ declare function parseTextSync(text: string, options?: any): any;
27
+ export declare const _typecheckTCXLoader: LoaderWithParser;
28
+ export {};
29
+ //# sourceMappingURL=tcx-loader.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tcx-loader.d.ts","sourceRoot":"","sources":["../src/tcx-loader.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,gBAAgB,EAAE,aAAa,EAAC,MAAM,0BAA0B,CAAC;AAQ9E,oBAAY,gBAAgB,GAAG,aAAa,GAAG;IAC7C,GAAG,CAAC,EAAE,EAAE,CAAC;CACV,CAAC;AAMF;;GAEG;AACH,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;CAgBrB,CAAC;AAEF,iBAAS,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,GAAE,GAAQ,OAoBrD;AAED,eAAO,MAAM,mBAAmB,EAAE,gBAA4B,CAAC"}
@@ -0,0 +1,50 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports._typecheckTCXLoader = exports.TCXLoader = void 0;
4
+ const gis_1 = require("@loaders.gl/gis");
5
+ const togeojson_1 = require("@tmcw/togeojson");
6
+ // __VERSION__ is injected by babel-plugin-version-inline
7
+ // @ts-ignore TS2304: Cannot find name '__VERSION__'.
8
+ const VERSION = typeof __VERSION__ !== 'undefined' ? __VERSION__ : 'latest';
9
+ const TCX_HEADER = `\
10
+ <?xml version="1.0" encoding="UTF-8"?>
11
+ <TrainingCenterDatabase`;
12
+ /**
13
+ * Loader for TCX (Training Center XML) - Garmin GPS track format
14
+ */
15
+ exports.TCXLoader = {
16
+ name: 'TCX (Training Center XML)',
17
+ id: 'tcx',
18
+ module: 'kml',
19
+ version: VERSION,
20
+ extensions: ['tcx'],
21
+ mimeTypes: ['application/vnd.garmin.tcx+xml'],
22
+ text: true,
23
+ tests: [TCX_HEADER],
24
+ parse: async (arrayBuffer, options) => parseTextSync(new TextDecoder().decode(arrayBuffer), options),
25
+ parseTextSync,
26
+ options: {
27
+ tcx: {},
28
+ gis: { format: 'geojson' }
29
+ }
30
+ };
31
+ function parseTextSync(text, options = {}) {
32
+ const doc = new DOMParser().parseFromString(text, 'text/xml');
33
+ const geojson = (0, togeojson_1.tcx)(doc);
34
+ switch (options?.tcx?.type) {
35
+ case 'object-row-table':
36
+ return geojson.features;
37
+ default:
38
+ }
39
+ switch (options?.gis?.format) {
40
+ case 'geojson':
41
+ return geojson;
42
+ case 'binary':
43
+ return (0, gis_1.geojsonToBinary)(geojson.features);
44
+ case 'raw':
45
+ return doc;
46
+ default:
47
+ throw new Error();
48
+ }
49
+ }
50
+ exports._typecheckTCXLoader = exports.TCXLoader;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@loaders.gl/kml",
3
- "version": "3.1.0-alpha.4",
3
+ "version": "3.1.0-beta.3",
4
4
  "description": "Framework-independent loader for the KML format",
5
5
  "license": "MIT",
6
6
  "publishConfig": {
@@ -18,7 +18,7 @@
18
18
  "point cloud",
19
19
  "KML"
20
20
  ],
21
- "types": "src/index.ts",
21
+ "types": "dist/index.d.ts",
22
22
  "main": "dist/es5/index.js",
23
23
  "module": "dist/esm/index.js",
24
24
  "sideEffects": false,
@@ -29,14 +29,13 @@
29
29
  ],
30
30
  "scripts": {
31
31
  "pre-build": "npm run build-bundle",
32
- "build-bundle": "webpack --display=minimal --config ../../scripts/webpack/bundle.js"
32
+ "build-bundle": "esbuild src/bundle.ts --bundle --outfile=dist/bundle.js"
33
33
  },
34
34
  "dependencies": {
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",
35
+ "@loaders.gl/gis": "3.1.0-beta.3",
36
+ "@loaders.gl/loader-utils": "3.1.0-beta.3",
37
+ "@loaders.gl/schema": "3.1.0-beta.3",
39
38
  "@tmcw/togeojson": "^4.5.0"
40
39
  },
41
- "gitHead": "e309784af37ef9f3640c7733c7851124c72e1fa3"
40
+ "gitHead": "3537c382b3ea4e092b24b6f94c3edee72076039c"
42
41
  }
package/dist/dist.min.js DELETED
@@ -1,2 +0,0 @@
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
- //# sourceMappingURL=dist.min.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["webpack:///webpack/universalModuleDefinition","webpack:///webpack/bootstrap","webpack:////home/user/apps/loaders.gl/node_modules/@tmcw/togeojson/dist/togeojson.umd.js","webpack:///./src/bundle.ts","webpack:///../gis/src/lib/geojson-to-binary.ts","webpack:///./src/gpx-loader.ts","webpack:///./src/kml-loader.ts","webpack:///./src/tcx-loader.ts"],"names":["root","factory","exports","module","define","amd","a","i","window","installedModules","__webpack_require__","moduleId","l","modules","call","m","c","d","name","getter","o","Object","defineProperty","enumerable","get","r","Symbol","toStringTag","value","t","mode","__esModule","ns","create","key","bind","n","object","property","prototype","hasOwnProperty","p","s","e","normalize","textContent","getElementsByTagName","length","parseFloat","stroke","isNaN","getElementsByTagNameNS","parentNode","tagName","replace","links","push","assign","href","getAttribute","coordinates","time","extendedValues","type","properties","_gpxType","geometry","line","Array","fill","times","g","coordinateProperties","entries","map","u","h","heartRate","extensions","f","extendedProperties","heartRates","heart","y","N","x","T","b","charCodeAt","S","split","k","A","xml","attributes","childNodes","nodeName","nodeValue","trim","B","E","substr","parseInt","F","P","coords","L","v","geoms","coordTimes","address","styleUrl","styleHash","styleMapHash","normal","description","timespan","begin","end","timestamp","icon","visibility","geometries","id","M","toString","gpx","features","from","gpxGen","kml","kmlGen","tcx","tcxGen","moduleExports","require","globalThis","loaders","geojsonToBinary","options","firstPassData","firstPass","secondPass","coordLength","numericPropKeys","PositionDataType","Float32Array","pointPositionsCount","pointFeaturesCount","linePositionsCount","linePathsCount","lineFeaturesCount","polygonPositionsCount","polygonObjectsCount","polygonRingsCount","polygonFeaturesCount","coordLengths","Set","feature","add","point","coord","flatten","polygon","Error","val","undefined","Number","isFinite","size","Math","max","keys","filter","GlobalFeatureIdsDataType","Uint32Array","Uint16Array","points","positions","globalFeatureIds","featureIds","numericProps","fields","lines","pathIndices","polygons","polygonIndices","primitivePolygonIndices","propName","indexMap","pointPosition","pointFeature","linePosition","linePath","lineFeature","polygonPosition","polygonObject","polygonRing","polygonFeature","handlePoint","keepStringProperties","handleMultiPoint","handleLineString","handleMultiLineString","handlePolygon","handleMultiPolygon","returnObj","geomType","numericProp","makeAccessorObjects","set","fillNumericProperties","fillCoords","nPositions","ring","index","numericPropName","numericKeys","props","includes","array","startVertex","arrays","concat","GPXLoader","version","mimeTypes","text","tests","parse","async","arrayBuffer","parseTextSync","TextDecoder","decode","gis","format","doc","DOMParser","parseFromString","geojson","KMLLoader","TCXLoader"],"mappings":"C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ACH,OAAOiL,EAAQjH,SAInB,OAAQY,SAAR,UAAQA,EAASgG,WAAjB,aAAQ,EAAcC,QACpB,IAAK,UACH,OAAOI,EACT,IAAK,SACH,OAAOtG,EAAgBsG,EAAQjH,UACjC,IAAK,MACH,OAAO8G,EACT,QACE,MAAM,IAAIzE","file":"dist.min.js","sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([], factory);\n\telse {\n\t\tvar a = factory();\n\t\tfor(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i];\n\t}\n})(window, function() {\nreturn "," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 2);\n","!function(e,t){\"object\"==typeof exports&&\"undefined\"!=typeof module?t(exports):\"function\"==typeof define&&define.amd?define([\"exports\"],t):t((e=\"undefined\"!=typeof globalThis?globalThis:e||self).toGeoJSON={})}(this,(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 s=n(e,\"line\");if(s){const e=t(n(s,\"color\")),r=parseFloat(t(n(s,\"opacity\"))),i=parseFloat(t(n(s,\"width\")));e&&(o.stroke=e),isNaN(r)||(o[\"stroke-opacity\"]=r),isNaN(i)||(o[\"stroke-width\"]=96*i/25.4)}}return o}function s(e,o){const s={};let r,i;for(i=0;i<o.length;i++)r=n(e,o[i]),r&&(s[o[i]]=t(r));return s}function r(e){const n=s(e,[\"name\",\"cmt\",\"desc\",\"type\",\"time\",\"keywords\"]),o=e.getElementsByTagNameNS(\"http://www.garmin.com/xmlschemas/GpxExtensions/v3\",\"*\");for(let s=0;s<o.length;s++){const r=o[s];r.parentNode.parentNode===e&&(n[r.tagName.replace(\":\",\"_\")]=t(r))}const r=e.getElementsByTagName(\"link\");r.length&&(n.links=[]);for(let e=0;e<r.length;e++)n.links.push(Object.assign({href:r[e].getAttribute(\"href\")},s(r[e],[\"text\",\"type\"])));return n}function i(e){const o=[parseFloat(e.getAttribute(\"lon\")),parseFloat(e.getAttribute(\"lat\"))],s=n(e,\"ele\"),r=n(e,\"gpxtpx:hr\")||n(e,\"hr\"),i=n(e,\"time\");let l;s&&(l=parseFloat(t(s)),isNaN(l)||o.push(l));const a={coordinates:o,time:i?t(i):null,extendedValues:[]};r&&a.extendedValues.push([\"heart\",parseFloat(t(r))]);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)||a.extendedValues.push([e,o])}return a}function l(e){const t=a(e,\"rtept\");if(t)return{type:\"Feature\",properties:Object.assign(r(e),o(n(e,\"extensions\")),{_gpxType:\"rte\"}),geometry:{type:\"LineString\",coordinates:t.line}}}function a(e,t){const n=e.getElementsByTagName(t);if(n.length<2)return;const o=[],s=[],r={};for(let e=0;e<n.length;e++){const t=i(n[e]);o.push(t.coordinates),t.time&&s.push(t.time);for(let o=0;o<t.extendedValues.length;o++){const[s,i]=t.extendedValues[o],l=\"heart\"===s?s:s+\"s\";r[l]||(r[l]=Array(n.length).fill(null)),r[l][e]=i}}return{line:o,times:s,extendedValues:r}}function c(e){const t=e.getElementsByTagName(\"trkseg\"),s=[],i=[],l=[];for(let e=0;e<t.length;e++){const n=a(t[e],\"trkpt\");n&&(l.push(n),n.times&&n.times.length&&i.push(n.times))}if(0===l.length)return;const c=l.length>1,g=Object.assign(r(e),o(n(e,\"extensions\")),{_gpxType:\"trk\"},i.length?{coordinateProperties:{times:c?i:i[0]}}:{});for(let e=0;e<l.length;e++){const t=l[e];s.push(t.line);for(const[n,o]of Object.entries(t.extendedValues)){let t=g;\"heart\"===n&&(g.coordinateProperties||(g.coordinateProperties={}),t=g.coordinateProperties),c?(t[n]||(t[n]=l.map((e=>new Array(e.line.length).fill(null)))),t[n][e]=o):t[n]=o}}return{type:\"Feature\",properties:g,geometry:c?{type:\"MultiLineString\",coordinates:s}:{type:\"LineString\",coordinates:s[0]}}}function*g(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=l(n[e]);t&&(yield t)}for(let e=0;e<o.length;e++)yield(a=o[e],{type:\"Feature\",properties:Object.assign(r(a),s(a,[\"sym\"])),geometry:{type:\"Point\",coordinates:i(a).coordinates}});var a}const u=[[\"heartRate\",\"heartRates\"],[\"Cadence\",\"cadences\"],[\"Speed\",\"speeds\"],[\"Watts\",\"watts\"]],m=[[\"TotalTimeSeconds\",\"totalTimeSeconds\"],[\"DistanceMeters\",\"distanceMeters\"],[\"MaximumSpeed\",\"maxSpeed\"],[\"AverageHeartRateBpm\",\"avgHeartRate\"],[\"MaximumHeartRateBpm\",\"maxHeartRate\"],[\"AvgSpeed\",\"avgSpeed\"],[\"AvgWatts\",\"avgWatts\"],[\"MaxWatts\",\"maxWatts\"]];function p(e,o){const s=[];for(const[r,i]of o){let o=n(e,r);if(!o){const t=e.getElementsByTagNameNS(\"http://www.garmin.com/xmlschemas/ActivityExtension/v2\",r);t.length&&(o=t[0])}const l=parseFloat(t(o));isNaN(l)||s.push([i,l])}return s}function h(e){const o=t(n(e,\"LongitudeDegrees\")),s=t(n(e,\"LatitudeDegrees\"));if(!o.length||!s.length)return null;const r=[parseFloat(o),parseFloat(s)],i=n(e,\"AltitudeMeters\"),l=n(e,\"HeartRateBpm\"),a=n(e,\"Time\");let c;return i&&(c=parseFloat(t(i)),isNaN(c)||r.push(c)),{coordinates:r,time:a?t(a):null,heartRate:l?parseFloat(t(l)):null,extensions:p(e,u)}}function f(e,t){const n=e.getElementsByTagName(t),o=[],s=[],r=[];if(n.length<2)return null;const i={extendedProperties:{}};for(let e=0;e<n.length;e++){const t=h(n[e]);if(null!==t){o.push(t.coordinates),t.time&&s.push(t.time),t.heartRate&&r.push(t.heartRate);for(const[o,s]of t.extensions)i.extendedProperties[o]||(i.extendedProperties[o]=Array(n.length).fill(null)),i.extendedProperties[o][e]=s}}return Object.assign(i,{line:o,times:s,heartRates:r})}function d(e){const o=e.getElementsByTagName(\"Track\"),s=[],r=[],i=[],l=[];let a;const c=function(e){const t={};for(const[n,o]of e)t[n]=o;return t}(p(e,m)),g=n(e,\"Name\");g&&(c.name=t(g));for(let e=0;e<o.length;e++)a=f(o[e],\"Trackpoint\"),a&&(s.push(a.line),a.times.length&&r.push(a.times),a.heartRates.length&&i.push(a.heartRates),l.push(a.extendedProperties));for(let e=0;e<l.length;e++){const t=l[e];for(const n in t)1===o.length?c[n]=a.extendedProperties[n]:(c[n]||(c[n]=s.map((e=>Array(e.length).fill(null)))),c[n][e]=t[n])}if(0!==s.length)return(r.length||i.length)&&(c.coordinateProperties=Object.assign(r.length?{times:1===s.length?r[0]:r}:{},i.length?{heart:1===s.length?i[0]:i}:{})),{type:\"Feature\",properties:c,geometry:{type:1===s.length?\"LineString\":\"MultiLineString\",coordinates:1===s.length?s[0]:s}}}function*y(e){const t=e.getElementsByTagName(\"Lap\");for(let e=0;e<t.length;e++){const n=d(t[e]);n&&(yield n)}const n=e.getElementsByTagName(\"Courses\");for(let e=0;e<n.length;e++){const t=d(n[e]);t&&(yield t)}}const N=/\\s*/g,x=/^\\s*|\\s*$/g,T=/\\s+/;function b(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 S(e){return e.replace(N,\"\").split(\",\").map(parseFloat)}function k(e){return e.replace(x,\"\").split(T).map(S)}function A(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+=A(e.childNodes[n]);return t}return\"#text\"===e.nodeName?(e.nodeValue||e.value||\"\").trim():\"#cdata-section\"===e.nodeName?e.nodeValue:\"\"}const B=[\"Polygon\",\"LineString\",\"Point\",\"Track\",\"gx:Track\"];function E(e,o,s){let r=t(n(o,\"color\"))||\"\";const i=\"stroke\"==s||\"fill\"===s?s:s+\"-color\";\"#\"===r.substr(0,1)&&(r=r.substr(1)),6===r.length||3===r.length?e[i]=r:8===r.length&&(e[s+\"-opacity\"]=parseInt(r.substr(0,2),16)/255,e[i]=\"#\"+r.substr(6,2)+r.substr(4,2)+r.substr(2,2))}function F(e,o,s,r){const i=parseFloat(t(n(o,s)));isNaN(i)||(e[r]=i)}function P(e){let n=e.getElementsByTagName(\"coord\");const o=[],s=[];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 r=e.getElementsByTagName(\"when\");for(let e=0;e<r.length;e++)s.push(t(r[e]));return{coords:o,times:s}}function v(e){let o,s,r,i,l;const a=[],c=[];if(n(e,\"MultiGeometry\"))return v(n(e,\"MultiGeometry\"));if(n(e,\"MultiTrack\"))return v(n(e,\"MultiTrack\"));if(n(e,\"gx:MultiTrack\"))return v(n(e,\"gx:MultiTrack\"));for(r=0;r<B.length;r++)if(s=e.getElementsByTagName(B[r]),s)for(i=0;i<s.length;i++)if(o=s[i],\"Point\"===B[r])a.push({type:\"Point\",coordinates:S(t(n(o,\"coordinates\")))});else if(\"LineString\"===B[r])a.push({type:\"LineString\",coordinates:k(t(n(o,\"coordinates\")))});else if(\"Polygon\"===B[r]){const e=o.getElementsByTagName(\"LinearRing\"),s=[];for(l=0;l<e.length;l++)s.push(k(t(n(e[l],\"coordinates\"))));a.push({type:\"Polygon\",coordinates:s})}else if(\"Track\"===B[r]||\"gx:Track\"===B[r]){const e=P(o);a.push({type:\"LineString\",coordinates:e.coords}),e.times.length&&c.push(e.times)}return{geoms:a,coordTimes:c}}function L(e,o,s,r){const i=v(e);let l;const a={},c=t(n(e,\"name\")),g=t(n(e,\"address\"));let u=t(n(e,\"styleUrl\"));const m=t(n(e,\"description\")),p=n(e,\"TimeSpan\"),h=n(e,\"TimeStamp\"),f=n(e,\"ExtendedData\");let d=n(e,\"IconStyle\"),y=n(e,\"LabelStyle\"),N=n(e,\"LineStyle\"),x=n(e,\"PolyStyle\");const T=n(e,\"visibility\");if(c&&(a.name=c),g&&(a.address=g),u){\"#\"!==u[0]&&(u=\"#\"+u),a.styleUrl=u,o[u]&&(a.styleHash=o[u]),s[u]&&(a.styleMapHash=s[u],a.styleHash=o[s[u].normal]);const e=r[a.styleHash];e&&(d||(d=n(e,\"IconStyle\")),y||(y=n(e,\"LabelStyle\")),N||(N=n(e,\"LineStyle\")),x||(x=n(e,\"PolyStyle\")))}if(m&&(a.description=m),p){const e=t(n(p,\"begin\")),o=t(n(p,\"end\"));a.timespan={begin:e,end:o}}if(h&&(a.timestamp=t(n(h,\"when\"))),d){E(a,d,\"icon\"),F(a,d,\"scale\",\"icon-scale\"),F(a,d,\"heading\",\"icon-heading\");const e=n(d,\"hotSpot\");if(e){const t=parseFloat(e.getAttribute(\"x\")),n=parseFloat(e.getAttribute(\"y\"));isNaN(t)||isNaN(n)||(a[\"icon-offset\"]=[t,n])}const o=n(d,\"Icon\");if(o){const e=t(n(o,\"href\"));e&&(a.icon=e)}}if(y&&(E(a,y,\"label\"),F(a,y,\"scale\",\"label-scale\")),N&&(E(a,N,\"stroke\"),F(a,N,\"width\",\"stroke-width\")),x){E(a,x,\"fill\");const e=t(n(x,\"fill\")),o=t(n(x,\"outline\"));e&&(a[\"fill-opacity\"]=\"1\"===e?a[\"fill-opacity\"]||1:0),o&&(a[\"stroke-opacity\"]=\"1\"===o?a[\"stroke-opacity\"]||1:0)}if(f){const e=f.getElementsByTagName(\"Data\"),o=f.getElementsByTagName(\"SimpleData\");for(l=0;l<e.length;l++)a[e[l].getAttribute(\"name\")]=t(n(e[l],\"value\"));for(l=0;l<o.length;l++)a[o[l].getAttribute(\"name\")]=t(o[l])}T&&(a.visibility=t(T)),i.coordTimes.length&&(a.coordinateProperties={times:1===i.coordTimes.length?i.coordTimes[0]:i.coordTimes});const b={type:\"Feature\",geometry:0===i.geoms.length?null:1===i.geoms.length?i.geoms[0]:{type:\"GeometryCollection\",geometries:i.geoms},properties:a};return e.getAttribute(\"id\")&&(b.id=e.getAttribute(\"id\")),b}function*M(e){const o={},s={},r={},i=e.getElementsByTagName(\"Placemark\"),l=e.getElementsByTagName(\"Style\"),a=e.getElementsByTagName(\"StyleMap\");for(let e=0;e<l.length;e++){const t=b(A(l[e])).toString(16);o[\"#\"+l[e].getAttribute(\"id\")]=t,s[t]=l[e]}for(let e=0;e<a.length;e++){o[\"#\"+a[e].getAttribute(\"id\")]=b(A(a[e])).toString(16);const s=a[e].getElementsByTagName(\"Pair\"),i={};for(let e=0;e<s.length;e++)i[t(n(s[e],\"key\"))]=t(n(s[e],\"styleUrl\"));r[\"#\"+a[e].getAttribute(\"id\")]=i}for(let e=0;e<i.length;e++){const t=L(i[e],o,r,s);t&&(yield t)}}e.gpx=function(e){return{type:\"FeatureCollection\",features:Array.from(g(e))}},e.gpxGen=g,e.kml=function(e){return{type:\"FeatureCollection\",features:Array.from(M(e))}},e.kmlGen=M,e.tcx=function(e){return{type:\"FeatureCollection\",features:Array.from(y(e))}},e.tcxGen=y,Object.defineProperty(e,\"__esModule\",{value:!0})}));\n//# sourceMappingURL=togeojson.umd.js.map\n","// @ts-nocheck\nconst moduleExports = require('./index');\nglobalThis.loaders = globalThis.loaders || {};\nmodule.exports = Object.assign(globalThis.loaders, moduleExports);\n","import {Feature, GeoJsonProperties} from '@loaders.gl/schema';\nimport type {BinaryFeatures} from '@loaders.gl/schema';\n\nexport type GeojsonToBinaryOptions = {\n coordLength?: number;\n numericPropKeys?: string[];\n PositionDataType?: Function;\n};\n\n/** Convert GeoJSON features to flat binary arrays */\nexport function geojsonToBinary(\n features: Feature[],\n options: GeojsonToBinaryOptions = {}\n): BinaryFeatures {\n const firstPassData = firstPass(features);\n return secondPass(features, firstPassData, {\n coordLength: options.coordLength || firstPassData.coordLength,\n numericPropKeys: options.numericPropKeys || firstPassData.numericPropKeys,\n PositionDataType: options.PositionDataType || Float32Array\n });\n}\n\nexport const TEST_EXPORTS = {\n firstPass,\n secondPass\n};\n\ntype FirstPassData = {\n coordLength: number;\n numericPropKeys: string[];\n\n pointPositionsCount: number;\n pointFeaturesCount: number;\n linePositionsCount: number;\n linePathsCount: number;\n lineFeaturesCount: number;\n polygonPositionsCount: number;\n polygonObjectsCount: number;\n polygonRingsCount: number;\n polygonFeaturesCount: number;\n};\n\n/**\n * Initial scan over GeoJSON features\n * Counts number of coordinates of each geometry type and\n * keeps track of the max coordinate dimensions\n */\n// eslint-disable-next-line complexity, max-statements\nfunction firstPass(features: Feature[]): FirstPassData {\n // Counts the number of _positions_, so [x, y, z] counts as one\n let pointPositionsCount = 0;\n let pointFeaturesCount = 0;\n let linePositionsCount = 0;\n let linePathsCount = 0;\n let lineFeaturesCount = 0;\n let polygonPositionsCount = 0;\n let polygonObjectsCount = 0;\n let polygonRingsCount = 0;\n let polygonFeaturesCount = 0;\n const coordLengths = new Set<number>();\n const numericPropKeys = {};\n\n for (const feature of features) {\n const geometry = feature.geometry;\n switch (geometry.type) {\n case 'Point':\n pointFeaturesCount++;\n pointPositionsCount++;\n coordLengths.add(geometry.coordinates.length);\n break;\n case 'MultiPoint':\n pointFeaturesCount++;\n pointPositionsCount += geometry.coordinates.length;\n for (const point of geometry.coordinates) {\n coordLengths.add(point.length);\n }\n break;\n case 'LineString':\n lineFeaturesCount++;\n linePositionsCount += geometry.coordinates.length;\n linePathsCount++;\n\n for (const coord of geometry.coordinates) {\n coordLengths.add(coord.length);\n }\n break;\n case 'MultiLineString':\n lineFeaturesCount++;\n for (const line of geometry.coordinates) {\n linePositionsCount += line.length;\n linePathsCount++;\n\n // eslint-disable-next-line max-depth\n for (const coord of line) {\n coordLengths.add(coord.length);\n }\n }\n break;\n case 'Polygon':\n polygonFeaturesCount++;\n polygonObjectsCount++;\n polygonRingsCount += geometry.coordinates.length;\n polygonPositionsCount += flatten(geometry.coordinates).length;\n\n for (const coord of flatten(geometry.coordinates)) {\n coordLengths.add(coord.length);\n }\n break;\n case 'MultiPolygon':\n polygonFeaturesCount++;\n for (const polygon of geometry.coordinates) {\n polygonObjectsCount++;\n polygonRingsCount += polygon.length;\n polygonPositionsCount += flatten(polygon).length;\n\n // eslint-disable-next-line max-depth\n for (const coord of flatten(polygon)) {\n coordLengths.add(coord.length);\n }\n }\n break;\n default:\n throw new Error(`Unsupported geometry type: ${geometry.type}`);\n }\n\n if (feature.properties) {\n for (const key in feature.properties) {\n const val = feature.properties[key];\n\n // If property has not been seen before, or if property has been numeric\n // in all previous features, check if numeric in this feature\n // If not numeric, false is stored to prevent rechecking in the future\n numericPropKeys[key] =\n numericPropKeys[key] || numericPropKeys[key] === undefined\n ? isNumeric(val)\n : numericPropKeys[key];\n }\n }\n }\n\n return {\n coordLength: coordLengths.size > 0 ? Math.max(...coordLengths) : 2,\n\n pointPositionsCount,\n pointFeaturesCount,\n linePositionsCount,\n linePathsCount,\n lineFeaturesCount,\n polygonPositionsCount,\n polygonObjectsCount,\n polygonRingsCount,\n polygonFeaturesCount,\n\n // Array of keys whose values are always numeric\n numericPropKeys: Object.keys(numericPropKeys).filter((k) => numericPropKeys[k])\n };\n}\n\n/**\n * Second scan over GeoJSON features\n * Fills coordinates into pre-allocated typed arrays\n */\n// eslint-disable-next-line complexity\nfunction secondPass(\n features,\n firstPassData: FirstPassData,\n options: Required<GeojsonToBinaryOptions>\n) {\n const {\n pointPositionsCount,\n pointFeaturesCount,\n linePositionsCount,\n linePathsCount,\n lineFeaturesCount,\n polygonPositionsCount,\n polygonObjectsCount,\n polygonRingsCount,\n polygonFeaturesCount\n } = firstPassData;\n const {coordLength, numericPropKeys, PositionDataType = Float32Array} = options;\n const GlobalFeatureIdsDataType = features.length > 65535 ? Uint32Array : Uint16Array;\n const points = {\n // @ts-ignore Typescript doesn't like dynamic constructors\n positions: new PositionDataType(pointPositionsCount * coordLength),\n globalFeatureIds: new GlobalFeatureIdsDataType(pointPositionsCount),\n featureIds:\n pointFeaturesCount > 65535\n ? new Uint32Array(pointPositionsCount)\n : new Uint16Array(pointPositionsCount),\n numericProps: {},\n properties: Array<any>(),\n fields: Array<any>()\n };\n const lines = {\n // @ts-ignore Typescript doesn't like dynamic constructors\n positions: new PositionDataType(linePositionsCount * coordLength),\n pathIndices:\n linePositionsCount > 65535\n ? new Uint32Array(linePathsCount + 1)\n : new Uint16Array(linePathsCount + 1),\n globalFeatureIds: new GlobalFeatureIdsDataType(linePositionsCount),\n featureIds:\n lineFeaturesCount > 65535\n ? new Uint32Array(linePositionsCount)\n : new Uint16Array(linePositionsCount),\n numericProps: {},\n properties: Array<any>(),\n fields: Array<any>()\n };\n const polygons = {\n // @ts-ignore Typescript doesn't like dynamic constructors\n positions: new PositionDataType(polygonPositionsCount * coordLength),\n polygonIndices:\n polygonPositionsCount > 65535\n ? new Uint32Array(polygonObjectsCount + 1)\n : new Uint16Array(polygonObjectsCount + 1),\n primitivePolygonIndices:\n polygonPositionsCount > 65535\n ? new Uint32Array(polygonRingsCount + 1)\n : new Uint16Array(polygonRingsCount + 1),\n globalFeatureIds: new GlobalFeatureIdsDataType(polygonPositionsCount),\n featureIds:\n polygonFeaturesCount > 65535\n ? new Uint32Array(polygonPositionsCount)\n : new Uint16Array(polygonPositionsCount),\n numericProps: {},\n properties: Array<any>(),\n fields: Array<any>()\n };\n\n // Instantiate numeric properties arrays; one value per vertex\n for (const object of [points, lines, polygons]) {\n for (const propName of numericPropKeys || []) {\n // If property has been numeric in all previous features in which the property existed, check\n // if numeric in this feature\n object.numericProps[propName] = new Float32Array(object.positions.length / coordLength);\n }\n }\n\n // Set last element of path/polygon indices as positions length\n lines.pathIndices[linePathsCount] = linePositionsCount;\n polygons.polygonIndices[polygonObjectsCount] = polygonPositionsCount;\n polygons.primitivePolygonIndices[polygonRingsCount] = polygonPositionsCount;\n\n const indexMap = {\n pointPosition: 0,\n pointFeature: 0,\n linePosition: 0,\n linePath: 0,\n lineFeature: 0,\n polygonPosition: 0,\n polygonObject: 0,\n polygonRing: 0,\n polygonFeature: 0,\n feature: 0\n };\n\n for (const feature of features) {\n const geometry = feature.geometry;\n const properties: GeoJsonProperties = feature.properties || {};\n\n switch (geometry.type) {\n case 'Point':\n handlePoint(geometry.coordinates, points, indexMap, coordLength, properties);\n points.properties.push(keepStringProperties(properties, numericPropKeys));\n indexMap.pointFeature++;\n break;\n case 'MultiPoint':\n handleMultiPoint(geometry.coordinates, points, indexMap, coordLength, properties);\n points.properties.push(keepStringProperties(properties, numericPropKeys));\n indexMap.pointFeature++;\n break;\n case 'LineString':\n handleLineString(geometry.coordinates, lines, indexMap, coordLength, properties);\n lines.properties.push(keepStringProperties(properties, numericPropKeys));\n indexMap.lineFeature++;\n break;\n case 'MultiLineString':\n handleMultiLineString(geometry.coordinates, lines, indexMap, coordLength, properties);\n lines.properties.push(keepStringProperties(properties, numericPropKeys));\n indexMap.lineFeature++;\n break;\n case 'Polygon':\n handlePolygon(geometry.coordinates, polygons, indexMap, coordLength, properties);\n polygons.properties.push(keepStringProperties(properties, numericPropKeys));\n indexMap.polygonFeature++;\n break;\n case 'MultiPolygon':\n handleMultiPolygon(geometry.coordinates, polygons, indexMap, coordLength, properties);\n polygons.properties.push(keepStringProperties(properties, numericPropKeys));\n indexMap.polygonFeature++;\n break;\n default:\n throw new Error('Invalid geometry type');\n }\n\n indexMap.feature++;\n }\n\n // Wrap each array in an accessor object with value and size keys\n return makeAccessorObjects(points, lines, polygons, coordLength);\n}\n\n/** Fills Point coordinates into points object of arrays */\nfunction handlePoint(coords, points, indexMap, coordLength, properties) {\n points.positions.set(coords, indexMap.pointPosition * coordLength);\n points.globalFeatureIds[indexMap.pointPosition] = indexMap.feature;\n points.featureIds[indexMap.pointPosition] = indexMap.pointFeature;\n\n fillNumericProperties(points, properties, indexMap.pointPosition, 1);\n indexMap.pointPosition++;\n}\n\n/** Fills MultiPoint coordinates into points object of arrays */\nfunction handleMultiPoint(coords, points, indexMap, coordLength, properties) {\n for (const point of coords) {\n handlePoint(point, points, indexMap, coordLength, properties);\n }\n}\n\n/** Fills LineString coordinates into lines object of arrays */\nfunction handleLineString(coords, lines, indexMap, coordLength, properties) {\n lines.pathIndices[indexMap.linePath] = indexMap.linePosition;\n indexMap.linePath++;\n\n fillCoords(lines.positions, coords, indexMap.linePosition, coordLength);\n\n const nPositions = coords.length;\n fillNumericProperties(lines, properties, indexMap.linePosition, nPositions);\n\n lines.globalFeatureIds.set(\n new Uint32Array(nPositions).fill(indexMap.feature),\n indexMap.linePosition\n );\n lines.featureIds.set(\n new Uint32Array(nPositions).fill(indexMap.lineFeature),\n indexMap.linePosition\n );\n indexMap.linePosition += nPositions;\n}\n\n/** Fills MultiLineString coordinates into lines object of arrays */\nfunction handleMultiLineString(coords, lines, indexMap, coordLength, properties) {\n for (const line of coords) {\n handleLineString(line, lines, indexMap, coordLength, properties);\n }\n}\n\n/** Fills Polygon coordinates into polygons object of arrays */\nfunction handlePolygon(coords, polygons, indexMap, coordLength, properties) {\n polygons.polygonIndices[indexMap.polygonObject] = indexMap.polygonPosition;\n indexMap.polygonObject++;\n\n for (const ring of coords) {\n polygons.primitivePolygonIndices[indexMap.polygonRing] = indexMap.polygonPosition;\n indexMap.polygonRing++;\n\n fillCoords(polygons.positions, ring, indexMap.polygonPosition, coordLength);\n\n const nPositions = ring.length;\n fillNumericProperties(polygons, properties, indexMap.polygonPosition, nPositions);\n\n polygons.globalFeatureIds.set(\n new Uint32Array(nPositions).fill(indexMap.feature),\n indexMap.polygonPosition\n );\n polygons.featureIds.set(\n new Uint32Array(nPositions).fill(indexMap.polygonFeature),\n indexMap.polygonPosition\n );\n indexMap.polygonPosition += nPositions;\n }\n}\n\n/** Fills MultiPolygon coordinates into polygons object of arrays */\nfunction handleMultiPolygon(coords, polygons, indexMap, coordLength, properties) {\n for (const polygon of coords) {\n handlePolygon(polygon, polygons, indexMap, coordLength, properties);\n }\n}\n\n/** Wrap each array in an accessor object with value and size keys */\nfunction makeAccessorObjects(points, lines, polygons, coordLength): BinaryFeatures {\n const returnObj = {\n points: {\n ...points,\n positions: {value: points.positions, size: coordLength},\n globalFeatureIds: {value: points.globalFeatureIds, size: 1},\n featureIds: {value: points.featureIds, size: 1},\n type: 'Point'\n },\n lines: {\n ...lines,\n pathIndices: {value: lines.pathIndices, size: 1},\n positions: {value: lines.positions, size: coordLength},\n globalFeatureIds: {value: lines.globalFeatureIds, size: 1},\n featureIds: {value: lines.featureIds, size: 1},\n type: 'LineString'\n },\n polygons: {\n ...polygons,\n polygonIndices: {value: polygons.polygonIndices, size: 1},\n primitivePolygonIndices: {value: polygons.primitivePolygonIndices, size: 1},\n positions: {value: polygons.positions, size: coordLength},\n globalFeatureIds: {value: polygons.globalFeatureIds, size: 1},\n featureIds: {value: polygons.featureIds, size: 1},\n type: 'Polygon'\n }\n };\n\n for (const geomType in returnObj) {\n for (const numericProp in returnObj[geomType].numericProps) {\n returnObj[geomType].numericProps[numericProp] = {\n value: returnObj[geomType].numericProps[numericProp],\n size: 1\n };\n }\n }\n\n return returnObj as unknown as BinaryFeatures;\n}\n\n/** Add numeric properties to object */\nfunction fillNumericProperties(object, properties, index, length) {\n for (const numericPropName in object.numericProps) {\n if (numericPropName in properties) {\n object.numericProps[numericPropName].set(\n new Array(length).fill(properties[numericPropName]),\n index\n );\n }\n }\n}\n\n/** Keep string properties in object */\nfunction keepStringProperties(properties, numericKeys: string[]): GeoJsonProperties {\n const props = {};\n for (const key in properties) {\n if (!numericKeys.includes(key)) {\n props[key] = properties[key];\n }\n }\n return props;\n}\n\n/** @param coords is expected to be a list of arrays, each with length 2-3 */\nfunction fillCoords(array, coords, startVertex, coordLength): void {\n let index = startVertex * coordLength;\n for (const coord of coords) {\n array.set(coord, index);\n index += coordLength;\n }\n}\n\n// TODO - how does this work? Different `coordinates` have different nesting\nfunction flatten(arrays): number[][] {\n return [].concat(...arrays);\n}\n\nfunction isNumeric(x: any): boolean {\n return Number.isFinite(x);\n}\n","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","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","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"],"sourceRoot":""}