@loaders.gl/kml 3.4.13 → 3.4.15

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.
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
 
3
- var moduleExports = require('./index');
3
+ const moduleExports = require('./index');
4
4
  globalThis.loaders = globalThis.loaders || {};
5
5
  module.exports = Object.assign(globalThis.loaders, moduleExports);
6
6
  //# sourceMappingURL=bundle.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"bundle.js","names":["moduleExports","require","globalThis","loaders","module","exports","Object","assign"],"sources":["../../src/bundle.ts"],"sourcesContent":["// @ts-nocheck\nconst moduleExports = require('./index');\nglobalThis.loaders = globalThis.loaders || {};\nmodule.exports = Object.assign(globalThis.loaders, moduleExports);\n"],"mappings":";;AACA,IAAMA,aAAa,GAAGC,OAAO,CAAC,SAAS,CAAC;AACxCC,UAAU,CAACC,OAAO,GAAGD,UAAU,CAACC,OAAO,IAAI,CAAC,CAAC;AAC7CC,MAAM,CAACC,OAAO,GAAGC,MAAM,CAACC,MAAM,CAACL,UAAU,CAACC,OAAO,EAAEH,aAAa,CAAC"}
1
+ {"version":3,"file":"bundle.js","names":["moduleExports","require","globalThis","loaders","module","exports","Object","assign"],"sources":["../../src/bundle.ts"],"sourcesContent":["// @ts-nocheck\nconst moduleExports = require('./index');\nglobalThis.loaders = globalThis.loaders || {};\nmodule.exports = Object.assign(globalThis.loaders, moduleExports);\n"],"mappings":";;AACA,MAAMA,aAAa,GAAGC,OAAO,CAAC,SAAS,CAAC;AACxCC,UAAU,CAACC,OAAO,GAAGD,UAAU,CAACC,OAAO,IAAI,CAAC,CAAC;AAC7CC,MAAM,CAACC,OAAO,GAAGC,MAAM,CAACC,MAAM,CAACL,UAAU,CAACC,OAAO,EAAEH,aAAa,CAAC"}
@@ -1,17 +1,14 @@
1
1
  "use strict";
2
2
 
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
3
  Object.defineProperty(exports, "__esModule", {
5
4
  value: true
6
5
  });
7
6
  exports._typecheckGPXLoader = exports.GPXLoader = void 0;
8
- var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
9
- var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
10
7
  var _gis = require("@loaders.gl/gis");
11
8
  var _togeojson = require("@tmcw/togeojson");
12
- var VERSION = typeof "3.4.13" !== 'undefined' ? "3.4.13" : 'latest';
13
- var GPX_HEADER = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<gpx";
14
- var GPXLoader = {
9
+ const VERSION = typeof "3.4.15" !== 'undefined' ? "3.4.15" : 'latest';
10
+ const GPX_HEADER = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<gpx";
11
+ const GPXLoader = {
15
12
  name: 'GPX (GPS exchange format)',
16
13
  id: 'gpx',
17
14
  module: 'kml',
@@ -20,24 +17,8 @@ var GPXLoader = {
20
17
  mimeTypes: ['application/gpx+xml'],
21
18
  text: true,
22
19
  tests: [GPX_HEADER],
23
- parse: function () {
24
- var _parse = (0, _asyncToGenerator2.default)(_regenerator.default.mark(function _callee(arrayBuffer, options) {
25
- return _regenerator.default.wrap(function _callee$(_context) {
26
- while (1) switch (_context.prev = _context.next) {
27
- case 0:
28
- return _context.abrupt("return", parseTextSync(new TextDecoder().decode(arrayBuffer), options));
29
- case 1:
30
- case "end":
31
- return _context.stop();
32
- }
33
- }, _callee);
34
- }));
35
- function parse(_x, _x2) {
36
- return _parse.apply(this, arguments);
37
- }
38
- return parse;
39
- }(),
40
- parseTextSync: parseTextSync,
20
+ parse: async (arrayBuffer, options) => parseTextSync(new TextDecoder().decode(arrayBuffer), options),
21
+ parseTextSync,
41
22
  options: {
42
23
  gpx: {},
43
24
  gis: {}
@@ -46,13 +27,13 @@ var GPXLoader = {
46
27
  exports.GPXLoader = GPXLoader;
47
28
  function parseTextSync(text, options) {
48
29
  var _options$gis, _options$gpx, _options$gpx2;
49
- var doc = new DOMParser().parseFromString(text, 'text/xml');
50
- var geojson = (0, _togeojson.gpx)(doc);
51
- var shape = (options === null || options === void 0 ? void 0 : (_options$gis = options.gis) === null || _options$gis === void 0 ? void 0 : _options$gis.format) || (options === null || options === void 0 ? void 0 : (_options$gpx = options.gpx) === null || _options$gpx === void 0 ? void 0 : _options$gpx.type) || (options === null || options === void 0 ? void 0 : (_options$gpx2 = options.gpx) === null || _options$gpx2 === void 0 ? void 0 : _options$gpx2.shape);
30
+ const doc = new DOMParser().parseFromString(text, 'text/xml');
31
+ const geojson = (0, _togeojson.gpx)(doc);
32
+ const shape = (options === null || options === void 0 ? void 0 : (_options$gis = options.gis) === null || _options$gis === void 0 ? void 0 : _options$gis.format) || (options === null || options === void 0 ? void 0 : (_options$gpx = options.gpx) === null || _options$gpx === void 0 ? void 0 : _options$gpx.type) || (options === null || options === void 0 ? void 0 : (_options$gpx2 = options.gpx) === null || _options$gpx2 === void 0 ? void 0 : _options$gpx2.shape);
52
33
  switch (shape) {
53
34
  case 'object-row-table':
54
35
  {
55
- var table = {
36
+ const table = {
56
37
  shape: 'object-row-table',
57
38
  data: geojson.features
58
39
  };
@@ -60,11 +41,11 @@ function parseTextSync(text, options) {
60
41
  }
61
42
  case 'geojson-row-table':
62
43
  {
63
- var _table = {
44
+ const table = {
64
45
  shape: 'geojson-row-table',
65
46
  data: geojson.features
66
47
  };
67
- return _table;
48
+ return table;
68
49
  }
69
50
  case 'geojson':
70
51
  return geojson;
@@ -76,6 +57,6 @@ function parseTextSync(text, options) {
76
57
  return geojson;
77
58
  }
78
59
  }
79
- var _typecheckGPXLoader = GPXLoader;
60
+ const _typecheckGPXLoader = GPXLoader;
80
61
  exports._typecheckGPXLoader = _typecheckGPXLoader;
81
62
  //# sourceMappingURL=gpx-loader.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"gpx-loader.js","names":["_gis","require","_togeojson","VERSION","GPX_HEADER","GPXLoader","name","id","module","version","extensions","mimeTypes","text","tests","parse","_parse","_asyncToGenerator2","default","_regenerator","mark","_callee","arrayBuffer","options","wrap","_callee$","_context","prev","next","abrupt","parseTextSync","TextDecoder","decode","stop","_x","_x2","apply","arguments","gpx","gis","exports","_options$gis","_options$gpx","_options$gpx2","doc","DOMParser","parseFromString","geojson","shape","format","type","table","data","features","geojsonToBinary","_typecheckGPXLoader"],"sources":["../../src/gpx-loader.ts"],"sourcesContent":["import type {LoaderOptions, LoaderWithParser} from '@loaders.gl/loader-utils';\nimport {geojsonToBinary} from '@loaders.gl/gis';\nimport {gpx} from '@tmcw/togeojson';\nimport type {GeoJSONRowTable, FeatureCollection, ObjectRowTable} from '@loaders.gl/schema';\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 shape?: 'object-row-table' | 'geojson-row-table' | 'geojson' | 'binary' | 'raw';\n /** @deprecated. Use options.gpx.shape */\n type?: 'object-row-table' | 'geojson-row-table' | 'geojson' | 'binary' | 'raw';\n };\n gis?: {\n /** @deprecated. Use options.gpx.shape */\n format?: 'object-row-table' | 'geojson-row-table' | 'geojson' | 'binary' | 'raw';\n };\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?: GPXLoaderOptions) =>\n parseTextSync(new TextDecoder().decode(arrayBuffer), options),\n parseTextSync,\n options: {\n gpx: {},\n gis: {}\n }\n};\n\nfunction parseTextSync(text: string, options?: GPXLoaderOptions) {\n const doc = new DOMParser().parseFromString(text, 'text/xml');\n const geojson: FeatureCollection = gpx(doc);\n\n const shape = options?.gis?.format || options?.gpx?.type || options?.gpx?.shape;\n\n switch (shape) {\n case 'object-row-table': {\n const table: ObjectRowTable = {\n shape: 'object-row-table',\n data: geojson.features\n };\n return table;\n }\n case 'geojson-row-table': {\n const table: GeoJSONRowTable = {\n shape: 'geojson-row-table',\n data: geojson.features\n };\n return table;\n }\n case 'geojson':\n return geojson;\n case 'binary':\n return geojsonToBinary(geojson.features);\n case 'raw':\n return doc;\n default:\n // Default to geojson for backwards compatibility\n return geojson;\n }\n}\n\nexport const _typecheckGPXLoader: LoaderWithParser = GPXLoader;\n"],"mappings":";;;;;;;;;AACA,IAAAA,IAAA,GAAAC,OAAA;AACA,IAAAC,UAAA,GAAAD,OAAA;AAKA,IAAME,OAAO,GAAG,eAAkB,KAAK,WAAW,cAAiB,QAAQ;AAc3E,IAAMC,UAAU,qDAEX;AAKE,IAAMC,SAAS,GAAG;EACvBC,IAAI,EAAE,2BAA2B;EACjCC,EAAE,EAAE,KAAK;EACTC,MAAM,EAAE,KAAK;EACbC,OAAO,EAAEN,OAAO;EAChBO,UAAU,EAAE,CAAC,KAAK,CAAC;EACnBC,SAAS,EAAE,CAAC,qBAAqB,CAAC;EAClCC,IAAI,EAAE,IAAI;EACVC,KAAK,EAAE,CAACT,UAAU,CAAC;EACnBU,KAAK;IAAA,IAAAC,MAAA,OAAAC,kBAAA,CAAAC,OAAA,EAAAC,YAAA,CAAAD,OAAA,CAAAE,IAAA,CAAE,SAAAC,QAAOC,WAAW,EAAEC,OAA0B;MAAA,OAAAJ,YAAA,CAAAD,OAAA,CAAAM,IAAA,UAAAC,SAAAC,QAAA;QAAA,kBAAAA,QAAA,CAAAC,IAAA,GAAAD,QAAA,CAAAE,IAAA;UAAA;YAAA,OAAAF,QAAA,CAAAG,MAAA,WACnDC,aAAa,CAAC,IAAIC,WAAW,CAAC,CAAC,CAACC,MAAM,CAACV,WAAW,CAAC,EAAEC,OAAO,CAAC;UAAA;UAAA;YAA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AO,CAACM;QAChB,CAAC;QACD,OAAOF,MAAK;MACd;IACA,KAAK,SAAS;MACZ,OAAOJ,OAAO;IAChB,KAAK,QAAQ;MACX,OAAO,IAAAO,oBAAe,EAACP,OAAO,CAACM,QAAQ,CAAC;IAC1C,KAAK,KAAK;MACR,OAAOT,GAAG;IACZ;MAEE,OAAOG,OAAO;EAClB;AACF;AAEO,IAAMQ,mBAAqC,GAAGjD,SAAS;AAACkC,OAAA,CAAAe,mBAAA,GAAAA,mBAAA"}
1
+ {"version":3,"file":"gpx-loader.js","names":["_gis","require","_togeojson","VERSION","GPX_HEADER","GPXLoader","name","id","module","version","extensions","mimeTypes","text","tests","parse","arrayBuffer","options","parseTextSync","TextDecoder","decode","gpx","gis","exports","_options$gis","_options$gpx","_options$gpx2","doc","DOMParser","parseFromString","geojson","shape","format","type","table","data","features","geojsonToBinary","_typecheckGPXLoader"],"sources":["../../src/gpx-loader.ts"],"sourcesContent":["import type {LoaderOptions, LoaderWithParser} from '@loaders.gl/loader-utils';\nimport {geojsonToBinary} from '@loaders.gl/gis';\nimport {gpx} from '@tmcw/togeojson';\nimport type {GeoJSONRowTable, FeatureCollection, ObjectRowTable} from '@loaders.gl/schema';\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 shape?: 'object-row-table' | 'geojson-row-table' | 'geojson' | 'binary' | 'raw';\n /** @deprecated. Use options.gpx.shape */\n type?: 'object-row-table' | 'geojson-row-table' | 'geojson' | 'binary' | 'raw';\n };\n gis?: {\n /** @deprecated. Use options.gpx.shape */\n format?: 'object-row-table' | 'geojson-row-table' | 'geojson' | 'binary' | 'raw';\n };\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?: GPXLoaderOptions) =>\n parseTextSync(new TextDecoder().decode(arrayBuffer), options),\n parseTextSync,\n options: {\n gpx: {},\n gis: {}\n }\n};\n\nfunction parseTextSync(text: string, options?: GPXLoaderOptions) {\n const doc = new DOMParser().parseFromString(text, 'text/xml');\n const geojson: FeatureCollection = gpx(doc);\n\n const shape = options?.gis?.format || options?.gpx?.type || options?.gpx?.shape;\n\n switch (shape) {\n case 'object-row-table': {\n const table: ObjectRowTable = {\n shape: 'object-row-table',\n data: geojson.features\n };\n return table;\n }\n case 'geojson-row-table': {\n const table: GeoJSONRowTable = {\n shape: 'geojson-row-table',\n data: geojson.features\n };\n return table;\n }\n case 'geojson':\n return geojson;\n case 'binary':\n return geojsonToBinary(geojson.features);\n case 'raw':\n return doc;\n default:\n // Default to geojson for backwards compatibility\n return geojson;\n }\n}\n\nexport const _typecheckGPXLoader: LoaderWithParser = GPXLoader;\n"],"mappings":";;;;;;AACA,IAAAA,IAAA,GAAAC,OAAA;AACA,IAAAC,UAAA,GAAAD,OAAA;AAKA,MAAME,OAAO,GAAG,eAAkB,KAAK,WAAW,cAAiB,QAAQ;AAc3E,MAAMC,UAAU,qDAEX;AAKE,MAAMC,SAAS,GAAG;EACvBC,IAAI,EAAE,2BAA2B;EACjCC,EAAE,EAAE,KAAK;EACTC,MAAM,EAAE,KAAK;EACbC,OAAO,EAAEN,OAAO;EAChBO,UAAU,EAAE,CAAC,KAAK,CAAC;EACnBC,SAAS,EAAE,CAAC,qBAAqB,CAAC;EAClCC,IAAI,EAAE,IAAI;EACVC,KAAK,EAAE,CAACT,UAAU,CAAC;EACnBU,KAAK,EAAE,MAAAA,CAAOC,WAAW,EAAEC,OAA0B,KACnDC,aAAa,CAAC,IAAIC,WAA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,QAAQ,CAAC;IAC1C,KAAK,KAAK;MACR,OAAOT,GAAG;IACZ;MAEE,OAAOG,OAAO;EAClB;AACF;AAEO,MAAMQ,mBAAqC,GAAGhC,SAAS;AAACiB,OAAA,CAAAe,mBAAA,GAAAA,mBAAA"}
package/dist/es5/index.js CHANGED
@@ -5,19 +5,19 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  Object.defineProperty(exports, "GPXLoader", {
7
7
  enumerable: true,
8
- get: function get() {
8
+ get: function () {
9
9
  return _gpxLoader.GPXLoader;
10
10
  }
11
11
  });
12
12
  Object.defineProperty(exports, "KMLLoader", {
13
13
  enumerable: true,
14
- get: function get() {
14
+ get: function () {
15
15
  return _kmlLoader.KMLLoader;
16
16
  }
17
17
  });
18
18
  Object.defineProperty(exports, "TCXLoader", {
19
19
  enumerable: true,
20
- get: function get() {
20
+ get: function () {
21
21
  return _tcxLoader.TCXLoader;
22
22
  }
23
23
  });
@@ -1,17 +1,14 @@
1
1
  "use strict";
2
2
 
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
3
  Object.defineProperty(exports, "__esModule", {
5
4
  value: true
6
5
  });
7
6
  exports._typecheckKMLLoader = exports.KMLLoader = void 0;
8
- var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
9
- var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
10
7
  var _gis = require("@loaders.gl/gis");
11
8
  var _togeojson = require("@tmcw/togeojson");
12
- var VERSION = typeof "3.4.13" !== 'undefined' ? "3.4.13" : 'latest';
13
- var KML_HEADER = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<kml xmlns=\"http://www.opengis.net/kml/2.2\">";
14
- var KMLLoader = {
9
+ const VERSION = typeof "3.4.15" !== 'undefined' ? "3.4.15" : 'latest';
10
+ const KML_HEADER = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<kml xmlns=\"http://www.opengis.net/kml/2.2\">";
11
+ const KMLLoader = {
15
12
  name: 'KML (Keyhole Markup Language)',
16
13
  id: 'kml',
17
14
  module: 'kml',
@@ -20,24 +17,8 @@ var KMLLoader = {
20
17
  mimeTypes: ['application/vnd.google-earth.kml+xml'],
21
18
  text: true,
22
19
  tests: [KML_HEADER],
23
- parse: function () {
24
- var _parse = (0, _asyncToGenerator2.default)(_regenerator.default.mark(function _callee(arrayBuffer, options) {
25
- return _regenerator.default.wrap(function _callee$(_context) {
26
- while (1) switch (_context.prev = _context.next) {
27
- case 0:
28
- return _context.abrupt("return", parseTextSync(new TextDecoder().decode(arrayBuffer), options));
29
- case 1:
30
- case "end":
31
- return _context.stop();
32
- }
33
- }, _callee);
34
- }));
35
- function parse(_x, _x2) {
36
- return _parse.apply(this, arguments);
37
- }
38
- return parse;
39
- }(),
40
- parseTextSync: parseTextSync,
20
+ parse: async (arrayBuffer, options) => parseTextSync(new TextDecoder().decode(arrayBuffer), options),
21
+ parseTextSync,
41
22
  options: {
42
23
  kml: {},
43
24
  gis: {}
@@ -46,13 +27,13 @@ var KMLLoader = {
46
27
  exports.KMLLoader = KMLLoader;
47
28
  function parseTextSync(text, options) {
48
29
  var _options$gis, _options$kml, _options$kml2;
49
- var doc = new DOMParser().parseFromString(text, 'text/xml');
50
- var geojson = (0, _togeojson.kml)(doc);
51
- var shape = (options === null || options === void 0 ? void 0 : (_options$gis = options.gis) === null || _options$gis === void 0 ? void 0 : _options$gis.format) || (options === null || options === void 0 ? void 0 : (_options$kml = options.kml) === null || _options$kml === void 0 ? void 0 : _options$kml.type) || (options === null || options === void 0 ? void 0 : (_options$kml2 = options.kml) === null || _options$kml2 === void 0 ? void 0 : _options$kml2.shape);
30
+ const doc = new DOMParser().parseFromString(text, 'text/xml');
31
+ const geojson = (0, _togeojson.kml)(doc);
32
+ const shape = (options === null || options === void 0 ? void 0 : (_options$gis = options.gis) === null || _options$gis === void 0 ? void 0 : _options$gis.format) || (options === null || options === void 0 ? void 0 : (_options$kml = options.kml) === null || _options$kml === void 0 ? void 0 : _options$kml.type) || (options === null || options === void 0 ? void 0 : (_options$kml2 = options.kml) === null || _options$kml2 === void 0 ? void 0 : _options$kml2.shape);
52
33
  switch (shape) {
53
34
  case 'object-row-table':
54
35
  {
55
- var table = {
36
+ const table = {
56
37
  shape: 'object-row-table',
57
38
  data: geojson.features
58
39
  };
@@ -60,11 +41,11 @@ function parseTextSync(text, options) {
60
41
  }
61
42
  case 'geojson-row-table':
62
43
  {
63
- var _table = {
44
+ const table = {
64
45
  shape: 'geojson-row-table',
65
46
  data: geojson.features
66
47
  };
67
- return _table;
48
+ return table;
68
49
  }
69
50
  case 'geojson':
70
51
  return geojson;
@@ -76,6 +57,6 @@ function parseTextSync(text, options) {
76
57
  return geojson;
77
58
  }
78
59
  }
79
- var _typecheckKMLLoader = KMLLoader;
60
+ const _typecheckKMLLoader = KMLLoader;
80
61
  exports._typecheckKMLLoader = _typecheckKMLLoader;
81
62
  //# sourceMappingURL=kml-loader.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"kml-loader.js","names":["_gis","require","_togeojson","VERSION","KML_HEADER","KMLLoader","name","id","module","version","extensions","mimeTypes","text","tests","parse","_parse","_asyncToGenerator2","default","_regenerator","mark","_callee","arrayBuffer","options","wrap","_callee$","_context","prev","next","abrupt","parseTextSync","TextDecoder","decode","stop","_x","_x2","apply","arguments","kml","gis","exports","_options$gis","_options$kml","_options$kml2","doc","DOMParser","parseFromString","geojson","shape","format","type","table","data","features","geojsonToBinary","_typecheckKMLLoader"],"sources":["../../src/kml-loader.ts"],"sourcesContent":["import type {LoaderWithParser, LoaderOptions} from '@loaders.gl/loader-utils';\nimport {geojsonToBinary} from '@loaders.gl/gis';\nimport {kml} from '@tmcw/togeojson';\nimport {GeoJSONRowTable, FeatureCollection, ObjectRowTable} from '@loaders.gl/schema';\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 shape?: 'object-row-table' | 'geojson-row-table' | 'geojson' | 'binary' | 'raw';\n /** @deprecated. Use options.kml.shape */\n type?: 'object-row-table' | 'geojson-row-table' | 'geojson' | 'binary' | 'raw';\n };\n gis?: {\n /** @deprecated. Use options.kml.shape */\n format?: 'object-row-table' | 'geojson-row-table' | 'geojson' | 'binary' | 'raw';\n };\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?: KMLLoaderOptions) =>\n parseTextSync(new TextDecoder().decode(arrayBuffer), options),\n parseTextSync,\n options: {\n kml: {},\n gis: {}\n }\n};\n\nfunction parseTextSync(text: string, options?: KMLLoaderOptions) {\n const doc = new DOMParser().parseFromString(text, 'text/xml');\n const geojson: FeatureCollection = kml(doc);\n\n // backwards compatibility\n const shape = options?.gis?.format || options?.kml?.type || options?.kml?.shape;\n switch (shape) {\n case 'object-row-table': {\n const table: ObjectRowTable = {\n shape: 'object-row-table',\n data: geojson.features\n };\n return table;\n }\n case 'geojson-row-table': {\n const table: GeoJSONRowTable = {\n shape: 'geojson-row-table',\n data: geojson.features\n };\n return table;\n }\n case 'geojson':\n return geojson;\n case 'binary':\n return geojsonToBinary(geojson.features);\n case 'raw':\n return doc;\n default:\n // Default to geojson for backwards compatibility\n return geojson;\n }\n}\n\nexport const _typecheckKMLLoader: LoaderWithParser = KMLLoader;\n"],"mappings":";;;;;;;;;AACA,IAAAA,IAAA,GAAAC,OAAA;AACA,IAAAC,UAAA,GAAAD,OAAA;AAKA,IAAME,O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S,CAAC,CAAC,CAACC,eAAe,CAACjC,IAAI,EAAE,UAAU,CAAC;EAC7D,IAAMkC,OAA0B,GAAG,IAAAT,cAAG,EAACM,GAAG,CAAC;EAG3C,IAAMI,KAAK,GAAG,CAAAzB,OAAO,aAAPA,OAAO,wBAAAkB,YAAA,GAAPlB,OAAO,CAAEgB,GAAG,cAAAE,YAAA,uBAAZA,YAAA,CAAcQ,MAAM,MAAI1B,OAAO,aAAPA,OAAO,wBAAAmB,YAAA,GAAPnB,OAAO,CAAEe,GAAG,cAAAI,YAAA,uBAAZA,YAAA,CAAcQ,IAAI,MAAI3B,OAAO,aAAPA,OAAO,wBAAAoB,aAAA,GAAPpB,OAAO,CAAEe,GAAG,cAAAK,aAAA,uBAAZA,aAAA,CAAcK,KAAK;EAC/E,QAAQA,KAAK;IACX,KAAK,kBAAkB;MAAE;QACvB,IAAMG,KAAqB,GAAG;UAC5BH,KAAK,EAAE,kBAAkB;UACzBI,IAAI,EAAEL,OAAO,CAACM;QAChB,CAAC;QACD,OAAOF,KAAK;MACd;IACA,KAAK,mBAAmB;MAAE;QACxB,IAAMA,MAAsB,GAAG;UAC7BH,KAAK,EAAE,mBAAmB;UAC1BI,IAAI,EAAEL,OAAO,CAACM;QAChB,CAAC;QACD,OAAOF,MAAK;MACd;IACA,KAAK,SAAS;MACZ,OAAOJ,OAAO;IAChB,KAAK,QAAQ;MACX,OAAO,IAAAO,oBAAe,EAACP,OAAO,CAACM,QAAQ,CAAC;IAC1C,KAAK,KAAK;MACR,OAAOT,GAAG;IACZ;MAEE,OAAOG,OAAO;EAClB;AACF;AAEO,IAAMQ,mBAAqC,GAAGjD,SAAS;AAACkC,OAAA,CAAAe,mBAAA,GAAAA,mBAAA"}
1
+ {"version":3,"file":"kml-loader.js","names":["_gis","require","_togeojson","VERSION","KML_HEADER","KMLLoader","name","id","module","version","extensions","mimeTypes","text","tests","parse","arrayBuffer","options","parseTextSync","TextDecoder","decode","kml","gis","exports","_options$gis","_options$kml","_options$kml2","doc","DOMParser","parseFromString","geojson","shape","format","type","table","data","features","geojsonToBinary","_typecheckKMLLoader"],"sources":["../../src/kml-loader.ts"],"sourcesContent":["import type {LoaderWithParser, LoaderOptions} from '@loaders.gl/loader-utils';\nimport {geojsonToBinary} from '@loaders.gl/gis';\nimport {kml} from '@tmcw/togeojson';\nimport {GeoJSONRowTable, FeatureCollection, ObjectRowTable} from '@loaders.gl/schema';\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 shape?: 'object-row-table' | 'geojson-row-table' | 'geojson' | 'binary' | 'raw';\n /** @deprecated. Use options.kml.shape */\n type?: 'object-row-table' | 'geojson-row-table' | 'geojson' | 'binary' | 'raw';\n };\n gis?: {\n /** @deprecated. Use options.kml.shape */\n format?: 'object-row-table' | 'geojson-row-table' | 'geojson' | 'binary' | 'raw';\n };\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?: KMLLoaderOptions) =>\n parseTextSync(new TextDecoder().decode(arrayBuffer), options),\n parseTextSync,\n options: {\n kml: {},\n gis: {}\n }\n};\n\nfunction parseTextSync(text: string, options?: KMLLoaderOptions) {\n const doc = new DOMParser().parseFromString(text, 'text/xml');\n const geojson: FeatureCollection = kml(doc);\n\n // backwards compatibility\n const shape = options?.gis?.format || options?.kml?.type || options?.kml?.shape;\n switch (shape) {\n case 'object-row-table': {\n const table: ObjectRowTable = {\n shape: 'object-row-table',\n data: geojson.features\n };\n return table;\n }\n case 'geojson-row-table': {\n const table: GeoJSONRowTable = {\n shape: 'geojson-row-table',\n data: geojson.features\n };\n return table;\n }\n case 'geojson':\n return geojson;\n case 'binary':\n return geojsonToBinary(geojson.features);\n case 'raw':\n return doc;\n default:\n // Default to geojson for backwards compatibility\n return geojson;\n }\n}\n\nexport const _typecheckKMLLoader: LoaderWithParser = KMLLoader;\n"],"mappings":";;;;;;AACA,IAAAA,IAAA,GAAAC,OAAA;AACA,IAAAC,UAAA,GAAAD,OAAA;AAKA,MAAME,OAAO,GAAG,eAAkB,KAAK,WAAW,cAAiB,QAAQ;AAc3E,MAAMC,UAAU,+FAE6B;AAKtC,MAAMC,SAAS,GAAG;EACvBC,IAAI,EAAE,+BAA+B;EACrCC,EAAE,EAAE,KAAK;EACTC,MAAM,EAAE,KAAK;EACbC,OAAO,EAAEN,OAAO;EAChBO,UAAU,EAAE,CAAC,KAAK,CAAC;EACnBC,SAAS,EAAE,CAAC,sCAAsC,CAAC;EACnDC,IAAI,EAAE,IAAI;EACVC,KAAK,EAAE,CAACT,UAAU,CAAC;EACnBU,KAAK,EAAE,MAAAA,CAAOC,WAAW,EAAEC,OAA0B,KACnDC,aAAa,CAAC,IAAIC,WAAW,CAAC,CAAC,CAACC,MAAM,CAACJ,WAAW,CAAC,EAAEC,OAAO,CAAC;EAC/DC,aAAa;EACbD,OAAO,EAAE;IACPI,GAAG,EAAE,CAAC,CAAC;IACPC,GAAG,EAAE,CAAC;EACR;AACF,CAAC;AAACC,OAAA,CAAAjB,SAAA,GAAAA,SAAA;AAEF,SAASY,aAAaA,CAACL,IAAY,EAAEI,OAA0B,EAAE;EAAA,IAAAO,YAAA,EAAAC,YAAA,EAAAC,aAAA;EAC/D,MAAMC,GAAG,GAAG,IAAIC,SAAS,CAAC,CAAC,CAACC,eAAe,CAAChB,IAAI,EAAE,UAAU,CAAC;EAC7D,MAAMiB,OAA0B,GAAG,IAAAT,cAAG,EAACM,GAAG,CAAC;EAG3C,MAAMI,KAAK,GAAG,CAAAd,OAAO,aAAPA,OAAO,wBAAAO,YAAA,GAAPP,OAAO,CAAEK,GAAG,cAAAE,YAAA,uBAAZA,YAAA,CAAcQ,MAAM,MAAIf,OAAO,aAAPA,OAAO,wBAAAQ,YAAA,GAAPR,OAAO,CAAEI,GAAG,cAAAI,YAAA,uBAAZA,YAAA,CAAcQ,IAAI,MAAIhB,OAAO,aAAPA,OAAO,wBAAAS,aAAA,GAAPT,OAAO,CAAEI,GAAG,cAAAK,aAAA,uBAAZA,aAAA,CAAcK,KAAK;EAC/E,QAAQA,KAAK;IACX,KAAK,kBAAkB;MAAE;QACvB,MAAMG,KAAqB,GAAG;UAC5BH,KAAK,EAAE,kBAAkB;UACzBI,IAAI,EAAEL,OAAO,CAACM;QAChB,CAAC;QACD,OAAOF,KAAK;MACd;IACA,KAAK,mBAAmB;MAAE;QACxB,MAAMA,KAAsB,GAAG;UAC7BH,KAAK,EAAE,mBAAmB;UAC1BI,IAAI,EAAEL,OAAO,CAACM;QAChB,CAAC;QACD,OAAOF,KAAK;MACd;IACA,KAAK,SAAS;MACZ,OAAOJ,OAAO;IAChB,KAAK,QAAQ;MACX,OAAO,IAAAO,oBAAe,EAACP,OAAO,CAACM,QAAQ,CAAC;IAC1C,KAAK,KAAK;MACR,OAAOT,GAAG;IACZ;MAEE,OAAOG,OAAO;EAClB;AACF;AAEO,MAAMQ,mBAAqC,GAAGhC,SAAS;AAACiB,OAAA,CAAAe,mBAAA,GAAAA,mBAAA"}
@@ -1,17 +1,14 @@
1
1
  "use strict";
2
2
 
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
3
  Object.defineProperty(exports, "__esModule", {
5
4
  value: true
6
5
  });
7
6
  exports._typecheckTCXLoader = exports.TCXLoader = void 0;
8
- var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
9
- var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
10
7
  var _gis = require("@loaders.gl/gis");
11
8
  var _togeojson = require("@tmcw/togeojson");
12
- var VERSION = typeof "3.4.13" !== 'undefined' ? "3.4.13" : 'latest';
13
- var TCX_HEADER = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<TrainingCenterDatabase";
14
- var TCXLoader = {
9
+ const VERSION = typeof "3.4.15" !== 'undefined' ? "3.4.15" : 'latest';
10
+ const TCX_HEADER = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<TrainingCenterDatabase";
11
+ const TCXLoader = {
15
12
  name: 'TCX (Training Center XML)',
16
13
  id: 'tcx',
17
14
  module: 'kml',
@@ -20,24 +17,8 @@ var TCXLoader = {
20
17
  mimeTypes: ['application/vnd.garmin.tcx+xml'],
21
18
  text: true,
22
19
  tests: [TCX_HEADER],
23
- parse: function () {
24
- var _parse = (0, _asyncToGenerator2.default)(_regenerator.default.mark(function _callee(arrayBuffer, options) {
25
- return _regenerator.default.wrap(function _callee$(_context) {
26
- while (1) switch (_context.prev = _context.next) {
27
- case 0:
28
- return _context.abrupt("return", parseTextSync(new TextDecoder().decode(arrayBuffer), options));
29
- case 1:
30
- case "end":
31
- return _context.stop();
32
- }
33
- }, _callee);
34
- }));
35
- function parse(_x, _x2) {
36
- return _parse.apply(this, arguments);
37
- }
38
- return parse;
39
- }(),
40
- parseTextSync: parseTextSync,
20
+ parse: async (arrayBuffer, options) => parseTextSync(new TextDecoder().decode(arrayBuffer), options),
21
+ parseTextSync,
41
22
  options: {
42
23
  tcx: {},
43
24
  gis: {}
@@ -46,13 +27,13 @@ var TCXLoader = {
46
27
  exports.TCXLoader = TCXLoader;
47
28
  function parseTextSync(text, options) {
48
29
  var _options$gis, _options$tcx, _options$tcx2;
49
- var doc = new DOMParser().parseFromString(text, 'text/xml');
50
- var geojson = (0, _togeojson.tcx)(doc);
51
- var shape = (options === null || options === void 0 ? void 0 : (_options$gis = options.gis) === null || _options$gis === void 0 ? void 0 : _options$gis.format) || (options === null || options === void 0 ? void 0 : (_options$tcx = options.tcx) === null || _options$tcx === void 0 ? void 0 : _options$tcx.type) || (options === null || options === void 0 ? void 0 : (_options$tcx2 = options.tcx) === null || _options$tcx2 === void 0 ? void 0 : _options$tcx2.shape);
30
+ const doc = new DOMParser().parseFromString(text, 'text/xml');
31
+ const geojson = (0, _togeojson.tcx)(doc);
32
+ const shape = (options === null || options === void 0 ? void 0 : (_options$gis = options.gis) === null || _options$gis === void 0 ? void 0 : _options$gis.format) || (options === null || options === void 0 ? void 0 : (_options$tcx = options.tcx) === null || _options$tcx === void 0 ? void 0 : _options$tcx.type) || (options === null || options === void 0 ? void 0 : (_options$tcx2 = options.tcx) === null || _options$tcx2 === void 0 ? void 0 : _options$tcx2.shape);
52
33
  switch (shape) {
53
34
  case 'object-row-table':
54
35
  {
55
- var table = {
36
+ const table = {
56
37
  shape: 'object-row-table',
57
38
  data: geojson.features
58
39
  };
@@ -60,11 +41,11 @@ function parseTextSync(text, options) {
60
41
  }
61
42
  case 'geojson-row-table':
62
43
  {
63
- var _table = {
44
+ const table = {
64
45
  shape: 'geojson-row-table',
65
46
  data: geojson.features
66
47
  };
67
- return _table;
48
+ return table;
68
49
  }
69
50
  case 'geojson':
70
51
  return geojson;
@@ -76,6 +57,6 @@ function parseTextSync(text, options) {
76
57
  return geojson;
77
58
  }
78
59
  }
79
- var _typecheckTCXLoader = TCXLoader;
60
+ const _typecheckTCXLoader = TCXLoader;
80
61
  exports._typecheckTCXLoader = _typecheckTCXLoader;
81
62
  //# sourceMappingURL=tcx-loader.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"tcx-loader.js","names":["_gis","require","_togeojson","VERSION","TCX_HEADER","TCXLoader","name","id","module","version","extensions","mimeTypes","text","tests","parse","_parse","_asyncToGenerator2","default","_regenerator","mark","_callee","arrayBuffer","options","wrap","_callee$","_context","prev","next","abrupt","parseTextSync","TextDecoder","decode","stop","_x","_x2","apply","arguments","tcx","gis","exports","_options$gis","_options$tcx","_options$tcx2","doc","DOMParser","parseFromString","geojson","shape","format","type","table","data","features","geojsonToBinary","_typecheckTCXLoader"],"sources":["../../src/tcx-loader.ts"],"sourcesContent":["import type {LoaderWithParser, LoaderOptions} from '@loaders.gl/loader-utils';\nimport {geojsonToBinary} from '@loaders.gl/gis';\nimport {tcx} from '@tmcw/togeojson';\nimport type {GeoJSONRowTable, FeatureCollection, ObjectRowTable} from '@loaders.gl/schema';\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 shape?: 'object-row-table' | 'geojson-row-table' | 'geojson' | 'binary' | 'raw';\n /** @deprecated. Use options.tcx.shape */\n type?: 'object-row-table' | 'geojson-row-table' | 'geojson' | 'binary' | 'raw';\n };\n gis?: {\n /** @deprecated. Use options.tcx.shape */\n format?: 'object-row-table' | 'geojson-row-table' | 'geojson' | 'binary' | 'raw';\n };\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?: TCXLoaderOptions) =>\n parseTextSync(new TextDecoder().decode(arrayBuffer), options),\n parseTextSync,\n options: {\n tcx: {},\n gis: {}\n }\n};\n\nfunction parseTextSync(text: string, options?: TCXLoaderOptions) {\n const doc = new DOMParser().parseFromString(text, 'text/xml');\n const geojson: FeatureCollection = tcx(doc);\n\n // backwards compatibility\n const shape = options?.gis?.format || options?.tcx?.type || options?.tcx?.shape;\n\n switch (shape) {\n case 'object-row-table': {\n const table: ObjectRowTable = {\n shape: 'object-row-table',\n data: geojson.features\n };\n return table;\n }\n case 'geojson-row-table': {\n const table: GeoJSONRowTable = {\n shape: 'geojson-row-table',\n data: geojson.features\n };\n return table;\n }\n case 'geojson':\n return geojson;\n case 'binary':\n return geojsonToBinary(geojson.features);\n case 'raw':\n return doc;\n default:\n // Default to geojson for backwards compatibility\n return geojson;\n }\n}\n\nexport const _typecheckTCXLoader: LoaderWithParser = TCXLoader;\n"],"mappings":";;;;;;;;;AACA,IAAAA,IAAA,GAAAC,OAAA;AACA,IAAAC,UAAA,GAAAD,OAAA;AAKA,IAAME,OAAO,GAAG,eAAkB,KAAK,WAAW,cAAiB,QAAQ;AAc3E,IAAMC,UAAU,wEAEQ;AAKjB,IAAMC,SAAS,GAAG;EACvBC,IAAI,EAAE,2BAA2B;EACjCC,EAAE,EAAE,KAAK;EACTC,MAAM,EAAE,KAAK;EACbC,OAAO,EAAEN,OAAO;EAChBO,UAAU,EAAE,CAAC,KAAK,CAAC;EACnBC,SAAS,EAAE,CAAC,gCAAgC,CAAC;EAC7CC,IAAI,EAAE,IAAI;EACVC,KAAK,EAAE,CAACT,UAAU,CAAC;EACnBU,KAAK;IAAA,IAAAC,MAAA,OAAAC,kBAAA,CAAAC,OAAA,EAAAC,YAAA,CAAAD,OAAA,CAAAE,IAAA,CAAE,SAAAC,QAAOC,WAAW,EAAEC,OAA0B;MAAA,OAAAJ,YAAA,CAAAD,OAAA,CAAAM,IAAA,UAAAC,SAAAC,QAAA;QAAA,kBAAAA,QAAA,CAAAC,IAAA,GAAAD,QAAA,CAAAE,IAAA;UAAA;YAAA,OAAAF,QAAA,CAAAG,MAAA,WACnDC,aAAa,CAAC,IAAIC,WAAW,CAAC,CAAC,CAACC,MAAM,CAACV,WAAW,CAAC,EAAEC,OAAO,CAAC;UAAA;UAAA;YAAA,OAAAG,QAAA,CAAAO,IAAA;QAAA;MAAA,GAAAZ,OAAA;IAAA;IAAA,SAAAN,MAAAmB,EAAA,EAAAC,GAAA;M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X,OAAO,IAAAO,oBAAe,EAACP,OAAO,CAACM,QAAQ,CAAC;IAC1C,KAAK,KAAK;MACR,OAAOT,GAAG;IACZ;MAEE,OAAOG,OAAO;EAClB;AACF;AAEO,IAAMQ,mBAAqC,GAAGjD,SAAS;AAACkC,OAAA,CAAAe,mBAAA,GAAAA,mBAAA"}
1
+ {"version":3,"file":"tcx-loader.js","names":["_gis","require","_togeojson","VERSION","TCX_HEADER","TCXLoader","name","id","module","version","extensions","mimeTypes","text","tests","parse","arrayBuffer","options","parseTextSync","TextDecoder","decode","tcx","gis","exports","_options$gis","_options$tcx","_options$tcx2","doc","DOMParser","parseFromString","geojson","shape","format","type","table","data","features","geojsonToBinary","_typecheckTCXLoader"],"sources":["../../src/tcx-loader.ts"],"sourcesContent":["import type {LoaderWithParser, LoaderOptions} from '@loaders.gl/loader-utils';\nimport {geojsonToBinary} from '@loaders.gl/gis';\nimport {tcx} from '@tmcw/togeojson';\nimport type {GeoJSONRowTable, FeatureCollection, ObjectRowTable} from '@loaders.gl/schema';\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 shape?: 'object-row-table' | 'geojson-row-table' | 'geojson' | 'binary' | 'raw';\n /** @deprecated. Use options.tcx.shape */\n type?: 'object-row-table' | 'geojson-row-table' | 'geojson' | 'binary' | 'raw';\n };\n gis?: {\n /** @deprecated. Use options.tcx.shape */\n format?: 'object-row-table' | 'geojson-row-table' | 'geojson' | 'binary' | 'raw';\n };\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?: TCXLoaderOptions) =>\n parseTextSync(new TextDecoder().decode(arrayBuffer), options),\n parseTextSync,\n options: {\n tcx: {},\n gis: {}\n }\n};\n\nfunction parseTextSync(text: string, options?: TCXLoaderOptions) {\n const doc = new DOMParser().parseFromString(text, 'text/xml');\n const geojson: FeatureCollection = tcx(doc);\n\n // backwards compatibility\n const shape = options?.gis?.format || options?.tcx?.type || options?.tcx?.shape;\n\n switch (shape) {\n case 'object-row-table': {\n const table: ObjectRowTable = {\n shape: 'object-row-table',\n data: geojson.features\n };\n return table;\n }\n case 'geojson-row-table': {\n const table: GeoJSONRowTable = {\n shape: 'geojson-row-table',\n data: geojson.features\n };\n return table;\n }\n case 'geojson':\n return geojson;\n case 'binary':\n return geojsonToBinary(geojson.features);\n case 'raw':\n return doc;\n default:\n // Default to geojson for backwards compatibility\n return geojson;\n }\n}\n\nexport const _typecheckTCXLoader: LoaderWithParser = TCXLoader;\n"],"mappings":";;;;;;AACA,IAAAA,IAAA,GAAAC,OAAA;AACA,IAAAC,UAAA,GAAAD,OAAA;AAKA,MAAME,OAAO,GAAG,eAAkB,KAAK,WAAW,cAAiB,QAAQ;AAc3E,MAAMC,UAAU,wEAEQ;AAKjB,MAAMC,SAAS,GAAG;EACvBC,IAAI,EAAE,2BAA2B;EACjCC,EAAE,EAAE,KAAK;EACTC,MAAM,EAAE,KAAK;EACbC,OAAO,EAAEN,OAAO;EAChBO,UAAU,EAAE,CAAC,KAAK,CAAC;EACnBC,SAAS,EAAE,CAAC,gCAAgC,CAAC;EAC7CC,IAAI,EAAE,IAAI;EACVC,KAAK,EAAE,CAACT,UAAU,CAAC;EACnBU,KAAK,EAAE,MAAAA,CAAOC,WAAW,EAAEC,OAA0B,KACnDC,aAAa,CAAC,IAAIC,WAAW,CAAC,CAAC,CAACC,MAAM,CAACJ,WAAW,CAAC,EAAEC,OAAO,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AEE,OAAOG,OAAO;EAClB;AACF;AAEO,MAAMQ,mBAAqC,GAAGhC,SAAS;AAACiB,OAAA,CAAAe,mBAAA,GAAAA,mBAAA"}
@@ -1,6 +1,6 @@
1
1
  import { geojsonToBinary } from '@loaders.gl/gis';
2
2
  import { gpx } from '@tmcw/togeojson';
3
- const VERSION = typeof "3.4.13" !== 'undefined' ? "3.4.13" : 'latest';
3
+ const VERSION = typeof "3.4.15" !== 'undefined' ? "3.4.15" : 'latest';
4
4
  const GPX_HEADER = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<gpx";
5
5
  export const GPXLoader = {
6
6
  name: 'GPX (GPS exchange format)',
@@ -1,6 +1,6 @@
1
1
  import { geojsonToBinary } from '@loaders.gl/gis';
2
2
  import { kml } from '@tmcw/togeojson';
3
- const VERSION = typeof "3.4.13" !== 'undefined' ? "3.4.13" : 'latest';
3
+ const VERSION = typeof "3.4.15" !== 'undefined' ? "3.4.15" : 'latest';
4
4
  const KML_HEADER = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<kml xmlns=\"http://www.opengis.net/kml/2.2\">";
5
5
  export const KMLLoader = {
6
6
  name: 'KML (Keyhole Markup Language)',
@@ -1,6 +1,6 @@
1
1
  import { geojsonToBinary } from '@loaders.gl/gis';
2
2
  import { tcx } from '@tmcw/togeojson';
3
- const VERSION = typeof "3.4.13" !== 'undefined' ? "3.4.13" : 'latest';
3
+ const VERSION = typeof "3.4.15" !== 'undefined' ? "3.4.15" : 'latest';
4
4
  const TCX_HEADER = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<TrainingCenterDatabase";
5
5
  export const TCXLoader = {
6
6
  name: 'TCX (Training Center XML)',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@loaders.gl/kml",
3
- "version": "3.4.13",
3
+ "version": "3.4.15",
4
4
  "description": "Framework-independent loader for the KML format",
5
5
  "license": "MIT",
6
6
  "publishConfig": {
@@ -32,10 +32,10 @@
32
32
  "build-bundle": "esbuild src/bundle.ts --bundle --outfile=dist/dist.min.js"
33
33
  },
34
34
  "dependencies": {
35
- "@loaders.gl/gis": "3.4.13",
36
- "@loaders.gl/loader-utils": "3.4.13",
37
- "@loaders.gl/schema": "3.4.13",
35
+ "@loaders.gl/gis": "3.4.15",
36
+ "@loaders.gl/loader-utils": "3.4.15",
37
+ "@loaders.gl/schema": "3.4.15",
38
38
  "@tmcw/togeojson": "^4.5.0"
39
39
  },
40
- "gitHead": "be8849c02972ce541e01720d29b976f830d6af92"
40
+ "gitHead": "19e941d5805568e449ef9092490d6568a4853298"
41
41
  }