{
  "version": 3,
  "sources": ["../src/index.ts", "../src/gpx-loader.ts", "../src/kml-loader.ts", "../src/tcx-loader.ts"],
  "sourcesContent": ["// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\n// POLYFILL: DOMParser\n// - Node: Yes\n// - Browser: No\n\nexport type {GPXLoaderOptions} from './gpx-loader';\nexport {GPXLoader} from './gpx-loader';\n\nexport type {KMLLoaderOptions} from './kml-loader';\nexport {KMLLoader} from './kml-loader';\n\nexport type {TCXLoaderOptions} from './tcx-loader';\nexport {TCXLoader} from './tcx-loader';\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport type {LoaderOptions, LoaderWithParser} from '@loaders.gl/loader-utils';\nimport {geojsonToBinary} from '@loaders.gl/gis';\nimport type {\n  GeoJSONTable,\n  FeatureCollection,\n  ObjectRowTable,\n  BinaryFeatureCollection\n} from '@loaders.gl/schema';\nimport {gpx} from '@tmcw/togeojson';\nimport {DOMParser} from '@xmldom/xmldom';\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-table' | '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  dataType: null as unknown as ObjectRowTable | GeoJSONTable,\n  batchType: null as never,\n\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: {shape: 'geojson-table'},\n    gis: {}\n  }\n} as const satisfies LoaderWithParser<\n  ObjectRowTable | GeoJSONTable | BinaryFeatureCollection,\n  never,\n  GPXLoaderOptions\n>;\n\nfunction parseTextSync(\n  text: string,\n  options?: GPXLoaderOptions\n): ObjectRowTable | GeoJSONTable | BinaryFeatureCollection {\n  const doc = new DOMParser().parseFromString(text, 'text/xml');\n  const geojson: FeatureCollection = gpx(doc);\n\n  const gpxOptions = {...GPXLoader.options.gpx, ...options?.gpx};\n\n  switch (gpxOptions.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-table': {\n      const table: GeoJSONTable = {\n        shape: 'geojson-table',\n        type: 'FeatureCollection',\n        features: geojson.features\n      };\n      return table;\n    }\n    case 'binary':\n      return geojsonToBinary(geojson.features);\n\n    default:\n      throw new Error(gpxOptions.shape);\n  }\n}\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport type {LoaderWithParser, LoaderOptions} from '@loaders.gl/loader-utils';\n// import {geojsonToBinary} from '@loaders.gl/gis';\n// import {GeoJSONTable} from '@loaders.gl/schema';\nimport {FeatureCollection, GeoJSONTable, ObjectRowTable} from '@loaders.gl/schema';\nimport {kml} from '@tmcw/togeojson';\nimport {DOMParser} from '@xmldom/xmldom';\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-table' | '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  dataType: null as unknown as ObjectRowTable | GeoJSONTable,\n  batchType: null as never,\n\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: {shape: 'geojson-table'},\n    gis: {}\n  }\n} as const satisfies LoaderWithParser<ObjectRowTable | GeoJSONTable, never, KMLLoaderOptions>;\n\nfunction parseTextSync(text: string, options?: KMLLoaderOptions): ObjectRowTable | GeoJSONTable {\n  const doc = new DOMParser().parseFromString(text, 'text/xml');\n  const geojson: FeatureCollection = kml(doc);\n\n  const kmlOptions = {...KMLLoader.options.kml, ...options?.kml};\n\n  switch (kmlOptions.shape) {\n    case 'geojson-table': {\n      const table: GeoJSONTable = {\n        shape: 'geojson-table',\n        type: 'FeatureCollection',\n        features: 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    case 'object-row-table':\n      const table: ObjectRowTable = {\n        shape: 'object-row-table',\n        data: geojson.features\n      };\n      return table;\n    default:\n      throw new Error(kmlOptions.shape);\n  }\n}\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport type {LoaderWithParser, LoaderOptions} from '@loaders.gl/loader-utils';\nimport {geojsonToBinary} from '@loaders.gl/gis';\nimport type {\n  GeoJSONTable,\n  FeatureCollection,\n  ObjectRowTable,\n  BinaryFeatureCollection\n} from '@loaders.gl/schema';\nimport {tcx} from '@tmcw/togeojson';\nimport {DOMParser} from '@xmldom/xmldom';\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-table' | '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  dataType: null as unknown as ObjectRowTable | GeoJSONTable | BinaryFeatureCollection,\n  batchType: null as never,\n\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: {shape: 'geojson-table'},\n    gis: {}\n  }\n} as const satisfies LoaderWithParser<\n  ObjectRowTable | GeoJSONTable | BinaryFeatureCollection,\n  never,\n  TCXLoaderOptions\n>;\n\nfunction parseTextSync(\n  text: string,\n  options?: TCXLoaderOptions\n): ObjectRowTable | GeoJSONTable | BinaryFeatureCollection {\n  const doc = new DOMParser().parseFromString(text, 'text/xml');\n  const geojson: FeatureCollection = tcx(doc);\n\n  const tcxOptions = {...TCXLoader.options.tcx, ...options?.tcx};\n\n  switch (tcxOptions.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-table': {\n      const table: GeoJSONTable = {\n        shape: 'geojson-table',\n        type: 'FeatureCollection',\n        schema: {metadata: {}, fields: []},\n        features: geojson.features\n      };\n      return table;\n    }\n    case 'binary':\n      return geojsonToBinary(geojson.features);\n\n    default:\n      throw new Error(tcxOptions.shape);\n  }\n}\n"],
  "mappings": ";;;;;;;;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G,mCAAS,IAAG;AAE7D,UAAQ,WAAW,OAAO;IACxB,KAAK,oBAAoB;AACvB,YAAM,QAAwB;QAC5B,OAAO;QACP,MAAM,QAAQ;;AAEhB,aAAO;IACT;IACA,KAAK,iBAAiB;AACpB,YAAM,QAAsB;QAC1B,OAAO;QACP,MAAM;QACN,QAAQ,EAAC,UAAU,CAAA,GAAI,QAAQ,CAAA,EAAE;QACjC,UAAU,QAAQ;;AAEpB,aAAO;IACT;IACA,KAAK;AACH,iBAAO,6BAAgB,QAAQ,QAAQ;IAEzC;AACE,YAAM,IAAI,MAAM,WAAW,KAAK;EACpC;AACF;",
  "names": ["import_togeojson", "import_xmldom", "VERSION", "parseTextSync", "table", "import_gis", "import_togeojson", "import_xmldom", "VERSION", "parseTextSync"]
}
