@loaders.gl/geospatial 5.0.0-beta.1 → 5.0.0-beta.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -2
- package/WKT-README.md +1 -1
- package/dist/dbf-loader-types.cjs +68 -0
- package/dist/dbf-loader-types.cjs.map +7 -0
- package/dist/dbf-loader-types.d.ts +2 -0
- package/dist/dbf-loader-types.d.ts.map +1 -0
- package/dist/dbf-loader-types.js +2 -0
- package/dist/dbf-loader-types.js.map +1 -0
- package/dist/dbf-loader.cjs +81 -0
- package/dist/dbf-loader.cjs.map +7 -0
- package/dist/dbf-loader.d.ts +2 -0
- package/dist/dbf-loader.d.ts.map +1 -0
- package/dist/dbf-loader.js +2 -0
- package/dist/dbf-loader.js.map +1 -0
- package/dist/dbf-worker.js +1557 -689
- package/dist/flatgeobuf/flatgeobuf-loader-types.cjs +12 -8
- package/dist/flatgeobuf/flatgeobuf-loader-types.cjs.map +2 -2
- package/dist/flatgeobuf/flatgeobuf-loader-types.d.ts +25 -34
- package/dist/flatgeobuf/flatgeobuf-loader-types.d.ts.map +1 -1
- package/dist/flatgeobuf/flatgeobuf-loader-types.js +10 -5
- package/dist/flatgeobuf/flatgeobuf-loader-types.js.map +1 -1
- package/dist/flatgeobuf/flatgeobuf-loader.cjs +4 -2
- package/dist/flatgeobuf/flatgeobuf-loader.cjs.map +2 -2
- package/dist/flatgeobuf/flatgeobuf-loader.d.ts +22 -6
- package/dist/flatgeobuf/flatgeobuf-loader.d.ts.map +1 -1
- package/dist/flatgeobuf/flatgeobuf-loader.js +4 -2
- package/dist/flatgeobuf/flatgeobuf-loader.js.map +1 -1
- package/dist/flatgeobuf/flatgeobuf-source-loader.cjs +15 -23
- package/dist/flatgeobuf/flatgeobuf-source-loader.cjs.map +2 -2
- package/dist/flatgeobuf/flatgeobuf-source-loader.d.ts +8 -32
- package/dist/flatgeobuf/flatgeobuf-source-loader.d.ts.map +1 -1
- package/dist/flatgeobuf/flatgeobuf-source-loader.js +16 -22
- package/dist/flatgeobuf/flatgeobuf-source-loader.js.map +1 -1
- package/dist/flatgeobuf/index.cjs +2 -9
- package/dist/flatgeobuf/index.cjs.map +3 -3
- package/dist/flatgeobuf/index.d.ts +1 -3
- package/dist/flatgeobuf/index.d.ts.map +1 -1
- package/dist/flatgeobuf/index.js +1 -4
- package/dist/flatgeobuf/index.js.map +1 -1
- package/dist/flatgeobuf/lib/flatgeobuf-worker-transport.cjs +5 -36
- package/dist/flatgeobuf/lib/flatgeobuf-worker-transport.cjs.map +2 -2
- package/dist/flatgeobuf/lib/flatgeobuf-worker-transport.d.ts +5 -4
- package/dist/flatgeobuf/lib/flatgeobuf-worker-transport.d.ts.map +1 -1
- package/dist/flatgeobuf/lib/flatgeobuf-worker-transport.js +7 -34
- package/dist/flatgeobuf/lib/flatgeobuf-worker-transport.js.map +1 -1
- package/dist/flatgeobuf/lib/parse-flatgeobuf.cjs +5 -19
- package/dist/flatgeobuf/lib/parse-flatgeobuf.cjs.map +2 -2
- package/dist/flatgeobuf/lib/parse-flatgeobuf.d.ts +7 -6
- package/dist/flatgeobuf/lib/parse-flatgeobuf.d.ts.map +1 -1
- package/dist/flatgeobuf/lib/parse-flatgeobuf.js +8 -21
- package/dist/flatgeobuf/lib/parse-flatgeobuf.js.map +1 -1
- package/dist/flatgeobuf/unbundled.cjs +2 -4
- package/dist/flatgeobuf/unbundled.cjs.map +2 -2
- package/dist/flatgeobuf/unbundled.d.ts +1 -1
- package/dist/flatgeobuf/unbundled.d.ts.map +1 -1
- package/dist/flatgeobuf/unbundled.js +1 -1
- package/dist/flatgeobuf/unbundled.js.map +1 -1
- package/dist/flatgeobuf-loader-types.cjs +74 -0
- package/dist/flatgeobuf-loader-types.cjs.map +7 -0
- package/dist/flatgeobuf-loader-types.d.ts +2 -0
- package/dist/flatgeobuf-loader-types.d.ts.map +1 -0
- package/dist/flatgeobuf-loader-types.js +2 -0
- package/dist/flatgeobuf-loader-types.js.map +1 -0
- package/dist/flatgeobuf-loader.cjs +68 -0
- package/dist/flatgeobuf-loader.cjs.map +7 -0
- package/dist/flatgeobuf-loader.d.ts +2 -0
- package/dist/flatgeobuf-loader.d.ts.map +1 -0
- package/dist/flatgeobuf-loader.js +2 -0
- package/dist/flatgeobuf-loader.js.map +1 -0
- package/dist/flatgeobuf-source-loader.cjs +244 -0
- package/dist/flatgeobuf-source-loader.cjs.map +7 -0
- package/dist/flatgeobuf-source-loader.d.ts +2 -0
- package/dist/flatgeobuf-source-loader.d.ts.map +1 -0
- package/dist/flatgeobuf-source-loader.js +2 -0
- package/dist/flatgeobuf-source-loader.js.map +1 -0
- package/dist/flatgeobuf-worker.js +5610 -1943
- package/dist/geopackage/geopackage-loader-types.cjs +8 -2
- package/dist/geopackage/geopackage-loader-types.cjs.map +2 -2
- package/dist/geopackage/geopackage-loader-types.d.ts +19 -6
- package/dist/geopackage/geopackage-loader-types.d.ts.map +1 -1
- package/dist/geopackage/geopackage-loader-types.js +8 -2
- package/dist/geopackage/geopackage-loader-types.js.map +1 -1
- package/dist/geopackage/geopackage-loader.cjs +2 -0
- package/dist/geopackage/geopackage-loader.cjs.map +2 -2
- package/dist/geopackage/geopackage-loader.d.ts +11 -3
- package/dist/geopackage/geopackage-loader.d.ts.map +1 -1
- package/dist/geopackage/geopackage-loader.js +2 -0
- package/dist/geopackage/geopackage-loader.js.map +1 -1
- package/dist/geopackage/geopackage-source-loader.cjs +37 -37
- package/dist/geopackage/geopackage-source-loader.cjs.map +3 -3
- package/dist/geopackage/geopackage-source-loader.d.ts +17 -43
- package/dist/geopackage/geopackage-source-loader.d.ts.map +1 -1
- package/dist/geopackage/geopackage-source-loader.js +41 -41
- package/dist/geopackage/geopackage-source-loader.js.map +1 -1
- package/dist/geopackage/index.cjs +2 -4
- package/dist/geopackage/index.cjs.map +2 -2
- package/dist/geopackage/index.d.ts +1 -1
- package/dist/geopackage/index.d.ts.map +1 -1
- package/dist/geopackage/index.js +1 -1
- package/dist/geopackage/index.js.map +1 -1
- package/dist/geopackage/lib/parse-geopackage.cjs +2 -2
- package/dist/geopackage/lib/parse-geopackage.cjs.map +2 -2
- package/dist/geopackage/lib/parse-geopackage.d.ts +5 -4
- package/dist/geopackage/lib/parse-geopackage.d.ts.map +1 -1
- package/dist/geopackage/lib/parse-geopackage.js +2 -3
- package/dist/geopackage/lib/parse-geopackage.js.map +1 -1
- package/dist/geopackage-loader-types.cjs +69 -0
- package/dist/geopackage-loader-types.cjs.map +7 -0
- package/dist/geopackage-loader-types.d.ts +2 -0
- package/dist/geopackage-loader-types.d.ts.map +1 -0
- package/dist/geopackage-loader-types.js +2 -0
- package/dist/geopackage-loader-types.js.map +1 -0
- package/dist/geopackage-loader.cjs +41 -0
- package/dist/geopackage-loader.cjs.map +7 -0
- package/dist/geopackage-loader.d.ts +2 -0
- package/dist/geopackage-loader.d.ts.map +1 -0
- package/dist/geopackage-loader.js +2 -0
- package/dist/geopackage-loader.js.map +1 -0
- package/dist/geopackage-source-loader.cjs +265 -0
- package/dist/geopackage-source-loader.cjs.map +7 -0
- package/dist/geopackage-source-loader.d.ts +2 -0
- package/dist/geopackage-source-loader.d.ts.map +1 -0
- package/dist/geopackage-source-loader.js +2 -0
- package/dist/geopackage-source-loader.js.map +1 -0
- package/dist/gpx-loader-types.cjs +61 -0
- package/dist/gpx-loader-types.cjs.map +7 -0
- package/dist/gpx-loader-types.d.ts +2 -0
- package/dist/gpx-loader-types.d.ts.map +1 -0
- package/dist/gpx-loader-types.js +2 -0
- package/dist/gpx-loader-types.js.map +1 -0
- package/dist/gpx-loader.cjs +79 -0
- package/dist/gpx-loader.cjs.map +7 -0
- package/dist/gpx-loader.d.ts +2 -0
- package/dist/gpx-loader.d.ts.map +1 -0
- package/dist/gpx-loader.js +2 -0
- package/dist/gpx-loader.js.map +1 -0
- package/dist/hex-wkb-loader-types.cjs +74 -0
- package/dist/hex-wkb-loader-types.cjs.map +7 -0
- package/dist/hex-wkb-loader-types.d.ts +2 -0
- package/dist/hex-wkb-loader-types.d.ts.map +1 -0
- package/dist/hex-wkb-loader-types.js +2 -0
- package/dist/hex-wkb-loader-types.js.map +1 -0
- package/dist/hex-wkb-loader.cjs +69 -0
- package/dist/hex-wkb-loader.cjs.map +7 -0
- package/dist/hex-wkb-loader.d.ts +2 -0
- package/dist/hex-wkb-loader.d.ts.map +1 -0
- package/dist/hex-wkb-loader.js +2 -0
- package/dist/hex-wkb-loader.js.map +1 -0
- package/dist/index.cjs +0 -7
- package/dist/index.cjs.map +3 -3
- package/dist/index.d.ts +2 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -3
- package/dist/index.js.map +1 -1
- package/dist/kml/bundled.cjs +0 -2
- package/dist/kml/bundled.cjs.map +2 -2
- package/dist/kml/bundled.d.ts +1 -1
- package/dist/kml/bundled.d.ts.map +1 -1
- package/dist/kml/bundled.js +1 -1
- package/dist/kml/bundled.js.map +1 -1
- package/dist/kml/gpx-loader-types.cjs +4 -2
- package/dist/kml/gpx-loader-types.cjs.map +2 -2
- package/dist/kml/gpx-loader-types.d.ts +11 -6
- package/dist/kml/gpx-loader-types.d.ts.map +1 -1
- package/dist/kml/gpx-loader-types.js +4 -2
- package/dist/kml/gpx-loader-types.js.map +1 -1
- package/dist/kml/gpx-loader.cjs +1 -1
- package/dist/kml/gpx-loader.cjs.map +2 -2
- package/dist/kml/gpx-loader.d.ts +9 -18
- package/dist/kml/gpx-loader.d.ts.map +1 -1
- package/dist/kml/gpx-loader.js +2 -2
- package/dist/kml/gpx-loader.js.map +1 -1
- package/dist/kml/index.cjs +0 -2
- package/dist/kml/index.cjs.map +2 -2
- package/dist/kml/index.d.ts +1 -1
- package/dist/kml/index.d.ts.map +1 -1
- package/dist/kml/index.js +1 -1
- package/dist/kml/index.js.map +1 -1
- package/dist/kml/kml-loader-types.cjs +5 -3
- package/dist/kml/kml-loader-types.cjs.map +2 -2
- package/dist/kml/kml-loader-types.d.ts +11 -6
- package/dist/kml/kml-loader-types.d.ts.map +1 -1
- package/dist/kml/kml-loader-types.js +5 -3
- package/dist/kml/kml-loader-types.js.map +1 -1
- package/dist/kml/kml-loader.cjs +1 -1
- package/dist/kml/kml-loader.cjs.map +2 -2
- package/dist/kml/kml-loader.d.ts +9 -18
- package/dist/kml/kml-loader.d.ts.map +1 -1
- package/dist/kml/kml-loader.js +2 -2
- package/dist/kml/kml-loader.js.map +1 -1
- package/dist/kml/kml-parser.cjs +4 -3
- package/dist/kml/kml-parser.cjs.map +2 -2
- package/dist/kml/kml-parser.d.ts.map +1 -1
- package/dist/kml/kml-parser.js +3 -2
- package/dist/kml/kml-parser.js.map +1 -1
- package/dist/kml/kml-writer.cjs +1 -1
- package/dist/kml/kml-writer.cjs.map +1 -1
- package/dist/kml/kml-writer.js +1 -1
- package/dist/kml/kml-writer.js.map +1 -1
- package/dist/kml/kmz-loader-types.cjs +12 -2
- package/dist/kml/kmz-loader-types.cjs.map +2 -2
- package/dist/kml/kmz-loader-types.d.ts +24 -6
- package/dist/kml/kmz-loader-types.d.ts.map +1 -1
- package/dist/kml/kmz-loader-types.js +10 -2
- package/dist/kml/kmz-loader-types.js.map +1 -1
- package/dist/kml/kmz-loader.cjs +5 -2
- package/dist/kml/kmz-loader.cjs.map +2 -2
- package/dist/kml/kmz-loader.d.ts +13 -3
- package/dist/kml/kmz-loader.d.ts.map +1 -1
- package/dist/kml/kmz-loader.js +5 -2
- package/dist/kml/kmz-loader.js.map +1 -1
- package/dist/kml/kmz-source.cjs +9 -23
- package/dist/kml/kmz-source.cjs.map +2 -2
- package/dist/kml/kmz-source.d.ts +2 -32
- package/dist/kml/kmz-source.d.ts.map +1 -1
- package/dist/kml/kmz-source.js +7 -19
- package/dist/kml/kmz-source.js.map +1 -1
- package/dist/kml/lib/feature-collection-to-arrow.cjs.map +2 -2
- package/dist/kml/lib/feature-collection-to-arrow.d.ts +3 -2
- package/dist/kml/lib/feature-collection-to-arrow.d.ts.map +1 -1
- package/dist/kml/lib/feature-collection-to-arrow.js.map +1 -1
- package/dist/kml/sports-track-parser.cjs +4 -3
- package/dist/kml/sports-track-parser.cjs.map +2 -2
- package/dist/kml/sports-track-parser.js +3 -2
- package/dist/kml/sports-track-parser.js.map +1 -1
- package/dist/kml/tcx-loader-types.cjs +4 -2
- package/dist/kml/tcx-loader-types.cjs.map +2 -2
- package/dist/kml/tcx-loader-types.d.ts +11 -6
- package/dist/kml/tcx-loader-types.d.ts.map +1 -1
- package/dist/kml/tcx-loader-types.js +4 -2
- package/dist/kml/tcx-loader-types.js.map +1 -1
- package/dist/kml/tcx-loader.cjs +1 -1
- package/dist/kml/tcx-loader.cjs.map +2 -2
- package/dist/kml/tcx-loader.d.ts +9 -18
- package/dist/kml/tcx-loader.d.ts.map +1 -1
- package/dist/kml/tcx-loader.js +2 -2
- package/dist/kml/tcx-loader.js.map +1 -1
- package/dist/kml/unbundled.cjs +0 -2
- package/dist/kml/unbundled.cjs.map +2 -2
- package/dist/kml/unbundled.d.ts +1 -1
- package/dist/kml/unbundled.d.ts.map +1 -1
- package/dist/kml/unbundled.js +1 -1
- package/dist/kml/unbundled.js.map +1 -1
- package/dist/kml-loader-types.cjs +61 -0
- package/dist/kml-loader-types.cjs.map +7 -0
- package/dist/kml-loader-types.d.ts +2 -0
- package/dist/kml-loader-types.d.ts.map +1 -0
- package/dist/kml-loader-types.js +2 -0
- package/dist/kml-loader-types.js.map +1 -0
- package/dist/kml-loader.cjs +77 -0
- package/dist/kml-loader.cjs.map +7 -0
- package/dist/kml-loader.d.ts +2 -0
- package/dist/kml-loader.d.ts.map +1 -0
- package/dist/kml-loader.js +2 -0
- package/dist/kml-loader.js.map +1 -0
- package/dist/kml-writer.cjs +212 -0
- package/dist/kml-writer.cjs.map +7 -0
- package/dist/kml-writer.d.ts +2 -0
- package/dist/kml-writer.d.ts.map +1 -0
- package/dist/kml-writer.js +2 -0
- package/dist/kml-writer.js.map +1 -0
- package/dist/kmz-loader-types.cjs +68 -0
- package/dist/kmz-loader-types.cjs.map +7 -0
- package/dist/kmz-loader-types.d.ts +2 -0
- package/dist/kmz-loader-types.d.ts.map +1 -0
- package/dist/kmz-loader-types.js +2 -0
- package/dist/kmz-loader-types.js.map +1 -0
- package/dist/kmz-loader.cjs +71 -0
- package/dist/kmz-loader.cjs.map +7 -0
- package/dist/kmz-loader.d.ts +2 -0
- package/dist/kmz-loader.d.ts.map +1 -0
- package/dist/kmz-loader.js +2 -0
- package/dist/kmz-loader.js.map +1 -0
- package/dist/kmz-source.cjs +177 -0
- package/dist/kmz-source.cjs.map +7 -0
- package/dist/kmz-source.d.ts +2 -0
- package/dist/kmz-source.d.ts.map +1 -0
- package/dist/kmz-source.js +2 -0
- package/dist/kmz-source.js.map +1 -0
- package/dist/shapefile/dbf-loader-types.cjs +5 -7
- package/dist/shapefile/dbf-loader-types.cjs.map +2 -2
- package/dist/shapefile/dbf-loader-types.d.ts +1 -3
- package/dist/shapefile/dbf-loader-types.d.ts.map +1 -1
- package/dist/shapefile/dbf-loader-types.js +3 -4
- package/dist/shapefile/dbf-loader-types.js.map +1 -1
- package/dist/shapefile/dbf-loader.cjs +21 -13
- package/dist/shapefile/dbf-loader.cjs.map +2 -2
- package/dist/shapefile/dbf-loader.d.ts +310 -4
- package/dist/shapefile/dbf-loader.d.ts.map +1 -1
- package/dist/shapefile/dbf-loader.js +27 -17
- package/dist/shapefile/dbf-loader.js.map +1 -1
- package/dist/shapefile/index.cjs +0 -6
- package/dist/shapefile/index.cjs.map +3 -3
- package/dist/shapefile/index.d.ts +0 -4
- package/dist/shapefile/index.d.ts.map +1 -1
- package/dist/shapefile/index.js +0 -5
- package/dist/shapefile/index.js.map +1 -1
- package/dist/shapefile/lib/parsers/build-geoarrow-geometry-arrow.cjs +2 -6
- package/dist/shapefile/lib/parsers/build-geoarrow-geometry-arrow.cjs.map +2 -2
- package/dist/shapefile/lib/parsers/build-geoarrow-geometry-arrow.d.ts +5 -4
- package/dist/shapefile/lib/parsers/build-geoarrow-geometry-arrow.d.ts.map +1 -1
- package/dist/shapefile/lib/parsers/build-geoarrow-geometry-arrow.js +3 -7
- package/dist/shapefile/lib/parsers/build-geoarrow-geometry-arrow.js.map +1 -1
- package/dist/shapefile/lib/parsers/build-wkb-geometry-arrow.cjs.map +2 -2
- package/dist/shapefile/lib/parsers/build-wkb-geometry-arrow.d.ts +4 -3
- package/dist/shapefile/lib/parsers/build-wkb-geometry-arrow.d.ts.map +1 -1
- package/dist/shapefile/lib/parsers/build-wkb-geometry-arrow.js.map +1 -1
- package/dist/shapefile/lib/parsers/parse-dbf-to-arrow.cjs.map +2 -2
- package/dist/shapefile/lib/parsers/parse-dbf-to-arrow.d.ts +4 -4
- package/dist/shapefile/lib/parsers/parse-dbf-to-arrow.d.ts.map +1 -1
- package/dist/shapefile/lib/parsers/parse-dbf-to-arrow.js.map +1 -1
- package/dist/shapefile/lib/parsers/parse-shapefile.cjs.map +1 -1
- package/dist/shapefile/lib/parsers/parse-shapefile.js +1 -1
- package/dist/shapefile/lib/parsers/parse-shapefile.js.map +1 -1
- package/dist/shapefile/lib/parsers/parse-shp-header.cjs +4 -3
- package/dist/shapefile/lib/parsers/parse-shp-header.cjs.map +2 -2
- package/dist/shapefile/lib/parsers/parse-shp-header.d.ts +2 -1
- package/dist/shapefile/lib/parsers/parse-shp-header.d.ts.map +1 -1
- package/dist/shapefile/lib/parsers/parse-shp-header.js +4 -5
- package/dist/shapefile/lib/parsers/parse-shp-header.js.map +1 -1
- package/dist/shapefile/lib/parsers/parse-shp-to-arrow.cjs +8 -11
- package/dist/shapefile/lib/parsers/parse-shp-to-arrow.cjs.map +2 -2
- package/dist/shapefile/lib/parsers/parse-shp-to-arrow.d.ts +3 -3
- package/dist/shapefile/lib/parsers/parse-shp-to-arrow.d.ts.map +1 -1
- package/dist/shapefile/lib/parsers/parse-shp-to-arrow.js +12 -10
- package/dist/shapefile/lib/parsers/parse-shp-to-arrow.js.map +1 -1
- package/dist/shapefile/lib/parsers/parse-shp.cjs +1 -1
- package/dist/shapefile/lib/parsers/parse-shp.cjs.map +2 -2
- package/dist/shapefile/lib/parsers/parse-shp.js +1 -1
- package/dist/shapefile/lib/parsers/parse-shp.js.map +1 -1
- package/dist/shapefile/lib/parsers/types.cjs.map +1 -1
- package/dist/shapefile/lib/parsers/types.d.ts +3 -3
- package/dist/shapefile/lib/parsers/types.d.ts.map +1 -1
- package/dist/shapefile/lib/shapefile-worker-transport.cjs +6 -3
- package/dist/shapefile/lib/shapefile-worker-transport.cjs.map +2 -2
- package/dist/shapefile/lib/shapefile-worker-transport.d.ts.map +1 -1
- package/dist/shapefile/lib/shapefile-worker-transport.js +6 -5
- package/dist/shapefile/lib/shapefile-worker-transport.js.map +1 -1
- package/dist/shapefile/shapefile-arrow-loader.cjs +87 -46
- package/dist/shapefile/shapefile-arrow-loader.cjs.map +3 -3
- package/dist/shapefile/shapefile-arrow-loader.d.ts +5 -3
- package/dist/shapefile/shapefile-arrow-loader.d.ts.map +1 -1
- package/dist/shapefile/shapefile-arrow-loader.js +81 -44
- package/dist/shapefile/shapefile-arrow-loader.js.map +1 -1
- package/dist/shapefile/shapefile-loader-types.cjs +5 -3
- package/dist/shapefile/shapefile-loader-types.cjs.map +2 -2
- package/dist/shapefile/shapefile-loader-types.d.ts +17 -12
- package/dist/shapefile/shapefile-loader-types.d.ts.map +1 -1
- package/dist/shapefile/shapefile-loader-types.js +5 -3
- package/dist/shapefile/shapefile-loader-types.js.map +1 -1
- package/dist/shapefile/shapefile-loader.cjs +25 -12
- package/dist/shapefile/shapefile-loader.cjs.map +2 -2
- package/dist/shapefile/shapefile-loader.d.ts +12 -12
- package/dist/shapefile/shapefile-loader.d.ts.map +1 -1
- package/dist/shapefile/shapefile-loader.js +27 -14
- package/dist/shapefile/shapefile-loader.js.map +1 -1
- package/dist/shapefile/shp-loader-types.cjs +3 -5
- package/dist/shapefile/shp-loader-types.cjs.map +2 -2
- package/dist/shapefile/shp-loader-types.d.ts +1 -3
- package/dist/shapefile/shp-loader-types.d.ts.map +1 -1
- package/dist/shapefile/shp-loader-types.js +3 -4
- package/dist/shapefile/shp-loader-types.js.map +1 -1
- package/dist/shapefile/shp-loader.cjs +10 -5
- package/dist/shapefile/shp-loader.cjs.map +2 -2
- package/dist/shapefile/shp-loader.d.ts +77 -3
- package/dist/shapefile/shp-loader.d.ts.map +1 -1
- package/dist/shapefile/shp-loader.js +14 -7
- package/dist/shapefile/shp-loader.js.map +1 -1
- package/dist/shapefile/unbundled.cjs +0 -4
- package/dist/shapefile/unbundled.cjs.map +2 -2
- package/dist/shapefile/unbundled.d.ts +2 -2
- package/dist/shapefile/unbundled.d.ts.map +1 -1
- package/dist/shapefile/unbundled.js +2 -2
- package/dist/shapefile/unbundled.js.map +1 -1
- package/dist/shapefile-arrow-loader.cjs +420 -0
- package/dist/shapefile-arrow-loader.cjs.map +7 -0
- package/dist/shapefile-arrow-loader.d.ts +2 -0
- package/dist/shapefile-arrow-loader.d.ts.map +1 -0
- package/dist/shapefile-arrow-loader.js +2 -0
- package/dist/shapefile-arrow-loader.js.map +1 -0
- package/dist/shapefile-loader-types.cjs +67 -0
- package/dist/shapefile-loader-types.cjs.map +7 -0
- package/dist/shapefile-loader-types.d.ts +2 -0
- package/dist/shapefile-loader-types.d.ts.map +1 -0
- package/dist/shapefile-loader-types.js +2 -0
- package/dist/shapefile-loader-types.js.map +1 -0
- package/dist/shapefile-loader.cjs +88 -0
- package/dist/shapefile-loader.cjs.map +7 -0
- package/dist/shapefile-loader.d.ts +2 -0
- package/dist/shapefile-loader.d.ts.map +1 -0
- package/dist/shapefile-loader.js +2 -0
- package/dist/shapefile-loader.js.map +1 -0
- package/dist/shapefile-worker.js +27319 -25590
- package/dist/shp-loader-types.cjs +67 -0
- package/dist/shp-loader-types.cjs.map +7 -0
- package/dist/shp-loader-types.d.ts +2 -0
- package/dist/shp-loader-types.d.ts.map +1 -0
- package/dist/shp-loader-types.js +2 -0
- package/dist/shp-loader-types.js.map +1 -0
- package/dist/shp-loader.cjs +65 -0
- package/dist/shp-loader.cjs.map +7 -0
- package/dist/shp-loader.d.ts +2 -0
- package/dist/shp-loader.d.ts.map +1 -0
- package/dist/shp-loader.js +2 -0
- package/dist/shp-loader.js.map +1 -0
- package/dist/shp-worker.js +3757 -2205
- package/dist/tcx-loader-types.cjs +61 -0
- package/dist/tcx-loader-types.cjs.map +7 -0
- package/dist/tcx-loader-types.d.ts +2 -0
- package/dist/tcx-loader-types.d.ts.map +1 -0
- package/dist/tcx-loader-types.js +2 -0
- package/dist/tcx-loader-types.js.map +1 -0
- package/dist/tcx-loader.cjs +79 -0
- package/dist/tcx-loader.cjs.map +7 -0
- package/dist/tcx-loader.d.ts +2 -0
- package/dist/tcx-loader.d.ts.map +1 -0
- package/dist/tcx-loader.js +2 -0
- package/dist/tcx-loader.js.map +1 -0
- package/dist/twkb-loader-types.cjs +73 -0
- package/dist/twkb-loader-types.cjs.map +7 -0
- package/dist/twkb-loader-types.d.ts +2 -0
- package/dist/twkb-loader-types.d.ts.map +1 -0
- package/dist/twkb-loader-types.js +2 -0
- package/dist/twkb-loader-types.js.map +1 -0
- package/dist/twkb-loader.cjs +47 -0
- package/dist/twkb-loader.cjs.map +7 -0
- package/dist/twkb-loader.d.ts +2 -0
- package/dist/twkb-loader.d.ts.map +1 -0
- package/dist/twkb-loader.js +2 -0
- package/dist/twkb-loader.js.map +1 -0
- package/dist/twkb-writer.cjs +52 -0
- package/dist/twkb-writer.cjs.map +7 -0
- package/dist/twkb-writer.d.ts +2 -0
- package/dist/twkb-writer.d.ts.map +1 -0
- package/dist/twkb-writer.js +2 -0
- package/dist/twkb-writer.js.map +1 -0
- package/dist/wkb-loader-types.cjs +62 -0
- package/dist/wkb-loader-types.cjs.map +7 -0
- package/dist/wkb-loader-types.d.ts +2 -0
- package/dist/wkb-loader-types.d.ts.map +1 -0
- package/dist/wkb-loader-types.js +2 -0
- package/dist/wkb-loader-types.js.map +1 -0
- package/dist/wkb-loader.cjs +58 -0
- package/dist/wkb-loader.cjs.map +7 -0
- package/dist/wkb-loader.d.ts +2 -0
- package/dist/wkb-loader.d.ts.map +1 -0
- package/dist/wkb-loader.js +2 -0
- package/dist/wkb-loader.js.map +1 -0
- package/dist/wkb-writer.cjs +56 -0
- package/dist/wkb-writer.cjs.map +7 -0
- package/dist/wkb-writer.d.ts +2 -0
- package/dist/wkb-writer.d.ts.map +1 -0
- package/dist/wkb-writer.js +2 -0
- package/dist/wkb-writer.js.map +1 -0
- package/dist/wkt/hex-wkb-loader-types.cjs +1 -1
- package/dist/wkt/hex-wkb-loader-types.cjs.map +2 -2
- package/dist/wkt/hex-wkb-loader-types.d.ts +1 -1
- package/dist/wkt/hex-wkb-loader-types.js +1 -1
- package/dist/wkt/hex-wkb-loader-types.js.map +1 -1
- package/dist/wkt/index.cjs +0 -6
- package/dist/wkt/index.cjs.map +3 -3
- package/dist/wkt/index.d.ts +0 -4
- package/dist/wkt/index.d.ts.map +1 -1
- package/dist/wkt/index.js +0 -5
- package/dist/wkt/index.js.map +1 -1
- package/dist/wkt/lib/version.cjs +1 -1
- package/dist/wkt/lib/version.cjs.map +1 -1
- package/dist/wkt/lib/version.js +1 -1
- package/dist/wkt/lib/version.js.map +1 -1
- package/dist/wkt/twkb-loader-types.cjs +3 -6
- package/dist/wkt/twkb-loader-types.cjs.map +2 -2
- package/dist/wkt/twkb-loader-types.d.ts +0 -23
- package/dist/wkt/twkb-loader-types.d.ts.map +1 -1
- package/dist/wkt/twkb-loader-types.js +1 -3
- package/dist/wkt/twkb-loader-types.js.map +1 -1
- package/dist/wkt/twkb-loader.cjs +1 -1
- package/dist/wkt/twkb-loader.cjs.map +2 -2
- package/dist/wkt/twkb-loader.js +1 -1
- package/dist/wkt/twkb-loader.js.map +1 -1
- package/dist/wkt/unbundled.cjs +2 -6
- package/dist/wkt/unbundled.cjs.map +2 -2
- package/dist/wkt/unbundled.d.ts +2 -2
- package/dist/wkt/unbundled.d.ts.map +1 -1
- package/dist/wkt/unbundled.js +2 -2
- package/dist/wkt/unbundled.js.map +1 -1
- package/dist/wkt/wkb-loader-types.cjs +3 -6
- package/dist/wkt/wkb-loader-types.cjs.map +2 -2
- package/dist/wkt/wkb-loader-types.d.ts +2 -26
- package/dist/wkt/wkb-loader-types.d.ts.map +1 -1
- package/dist/wkt/wkb-loader-types.js +1 -3
- package/dist/wkt/wkb-loader-types.js.map +1 -1
- package/dist/wkt/wkb-loader.cjs +1 -1
- package/dist/wkt/wkb-loader.cjs.map +2 -2
- package/dist/wkt/wkb-loader.js +1 -1
- package/dist/wkt/wkb-loader.js.map +1 -1
- package/dist/wkt/wkt-crs-loader-types.cjs +1 -1
- package/dist/wkt/wkt-crs-loader-types.cjs.map +2 -2
- package/dist/wkt/wkt-crs-loader-types.d.ts +2 -2
- package/dist/wkt/wkt-crs-loader-types.js +1 -1
- package/dist/wkt/wkt-crs-loader-types.js.map +1 -1
- package/dist/wkt/wkt-format.cjs +2 -2
- package/dist/wkt/wkt-format.cjs.map +2 -2
- package/dist/wkt/wkt-format.js +1 -1
- package/dist/wkt/wkt-format.js.map +1 -1
- package/dist/wkt/wkt-loader-types.cjs +3 -6
- package/dist/wkt/wkt-loader-types.cjs.map +2 -2
- package/dist/wkt/wkt-loader-types.d.ts +2 -27
- package/dist/wkt/wkt-loader-types.d.ts.map +1 -1
- package/dist/wkt/wkt-loader-types.js +1 -3
- package/dist/wkt/wkt-loader-types.js.map +1 -1
- package/dist/wkt/wkt-loader.cjs +1 -1
- package/dist/wkt/wkt-loader.cjs.map +2 -2
- package/dist/wkt/wkt-loader.js +1 -1
- package/dist/wkt/wkt-loader.js.map +1 -1
- package/dist/wkt-crs-loader-types.cjs +66 -0
- package/dist/wkt-crs-loader-types.cjs.map +7 -0
- package/dist/wkt-crs-loader-types.d.ts +2 -0
- package/dist/wkt-crs-loader-types.d.ts.map +1 -0
- package/dist/wkt-crs-loader-types.js +2 -0
- package/dist/wkt-crs-loader-types.js.map +1 -0
- package/dist/wkt-crs-loader.cjs +40 -0
- package/dist/wkt-crs-loader.cjs.map +7 -0
- package/dist/wkt-crs-loader.d.ts +2 -0
- package/dist/wkt-crs-loader.d.ts.map +1 -0
- package/dist/wkt-crs-loader.js +2 -0
- package/dist/wkt-crs-loader.js.map +1 -0
- package/dist/wkt-crs-writer.cjs +54 -0
- package/dist/wkt-crs-writer.cjs.map +7 -0
- package/dist/wkt-crs-writer.d.ts +2 -0
- package/dist/wkt-crs-writer.d.ts.map +1 -0
- package/dist/wkt-crs-writer.js +2 -0
- package/dist/wkt-crs-writer.js.map +1 -0
- package/dist/wkt-loader-types.cjs +62 -0
- package/dist/wkt-loader-types.cjs.map +7 -0
- package/dist/wkt-loader-types.d.ts +2 -0
- package/dist/wkt-loader-types.d.ts.map +1 -0
- package/dist/wkt-loader-types.js +2 -0
- package/dist/wkt-loader-types.js.map +1 -0
- package/dist/wkt-loader.cjs +47 -0
- package/dist/wkt-loader.cjs.map +7 -0
- package/dist/wkt-loader.d.ts +2 -0
- package/dist/wkt-loader.d.ts.map +1 -0
- package/dist/wkt-loader.js +2 -0
- package/dist/wkt-loader.js.map +1 -0
- package/dist/wkt-worker.js +749 -124
- package/dist/wkt-writer.cjs +56 -0
- package/dist/wkt-writer.cjs.map +7 -0
- package/dist/wkt-writer.d.ts +2 -0
- package/dist/wkt-writer.d.ts.map +1 -0
- package/dist/wkt-writer.js +2 -0
- package/dist/wkt-writer.js.map +1 -0
- package/dist/workers/dbf-worker.cjs +4 -4
- package/dist/workers/dbf-worker.cjs.map +2 -2
- package/dist/workers/dbf-worker.js +5 -5
- package/dist/workers/dbf-worker.js.map +1 -1
- package/dist/workers/shapefile-worker.cjs +3 -3
- package/dist/workers/shapefile-worker.cjs.map +2 -2
- package/dist/workers/shapefile-worker.js +3 -5
- package/dist/workers/shapefile-worker.js.map +1 -1
- package/package.json +153 -131
- package/src/dbf-loader-types.ts +1 -0
- package/src/dbf-loader.ts +1 -0
- package/src/flatgeobuf/flatgeobuf-loader-types.ts +18 -17
- package/src/flatgeobuf/flatgeobuf-loader.ts +9 -11
- package/src/flatgeobuf/flatgeobuf-source-loader.ts +19 -32
- package/src/flatgeobuf/index.ts +1 -9
- package/src/flatgeobuf/lib/flatgeobuf-worker-transport.ts +12 -50
- package/src/flatgeobuf/lib/parse-flatgeobuf.ts +16 -34
- package/src/flatgeobuf/unbundled.ts +1 -1
- package/src/flatgeobuf-loader-types.ts +1 -0
- package/src/flatgeobuf-loader.ts +1 -0
- package/src/flatgeobuf-source-loader.ts +1 -0
- package/src/geopackage/geopackage-loader-types.ts +13 -8
- package/src/geopackage/geopackage-loader.ts +5 -2
- package/src/geopackage/geopackage-source-loader.ts +56 -57
- package/src/geopackage/index.ts +1 -1
- package/src/geopackage/lib/parse-geopackage.ts +6 -6
- package/src/geopackage-loader-types.ts +1 -0
- package/src/geopackage-loader.ts +1 -0
- package/src/geopackage-source-loader.ts +1 -0
- package/src/gpx-loader-types.ts +1 -0
- package/src/gpx-loader.ts +1 -0
- package/src/hex-wkb-loader-types.ts +1 -0
- package/src/hex-wkb-loader.ts +1 -0
- package/src/index.ts +2 -3
- package/src/kml/bundled.ts +1 -1
- package/src/kml/gpx-loader-types.ts +5 -3
- package/src/kml/gpx-loader.ts +8 -16
- package/src/kml/index.ts +1 -1
- package/src/kml/kml-loader-types.ts +7 -5
- package/src/kml/kml-loader.ts +8 -20
- package/src/kml/kml-parser.ts +3 -2
- package/src/kml/kmz-loader-types.ts +17 -4
- package/src/kml/kmz-loader.ts +7 -3
- package/src/kml/kmz-source.ts +12 -25
- package/src/kml/lib/feature-collection-to-arrow.ts +3 -9
- package/src/kml/sports-track-parser.ts +3 -2
- package/src/kml/tcx-loader-types.ts +5 -3
- package/src/kml/tcx-loader.ts +8 -16
- package/src/kml/unbundled.ts +1 -1
- package/src/kml-loader-types.ts +1 -0
- package/src/kml-loader.ts +1 -0
- package/src/kml-writer.ts +1 -0
- package/src/kmz-loader-types.ts +1 -0
- package/src/kmz-loader.ts +1 -0
- package/src/kmz-source.ts +1 -0
- package/src/shapefile/dbf-loader-types.ts +5 -7
- package/src/shapefile/dbf-loader.ts +40 -27
- package/src/shapefile/index.ts +0 -6
- package/src/shapefile/lib/parsers/build-geoarrow-geometry-arrow.ts +6 -10
- package/src/shapefile/lib/parsers/build-wkb-geometry-arrow.ts +4 -3
- package/src/shapefile/lib/parsers/parse-dbf-to-arrow.ts +6 -5
- package/src/shapefile/lib/parsers/parse-shapefile.ts +1 -1
- package/src/shapefile/lib/parsers/parse-shp-header.ts +4 -5
- package/src/shapefile/lib/parsers/parse-shp-to-arrow.ts +15 -21
- package/src/shapefile/lib/parsers/parse-shp.ts +1 -1
- package/src/shapefile/lib/parsers/types.ts +3 -3
- package/src/shapefile/lib/shapefile-worker-transport.ts +8 -5
- package/src/shapefile/shapefile-arrow-loader.ts +120 -63
- package/src/shapefile/shapefile-loader-types.ts +11 -16
- package/src/shapefile/shapefile-loader.ts +45 -26
- package/src/shapefile/shp-loader-types.ts +6 -11
- package/src/shapefile/shp-loader.ts +21 -14
- package/src/shapefile/unbundled.ts +2 -2
- package/src/shapefile-arrow-loader.ts +1 -0
- package/src/shapefile-loader-types.ts +1 -0
- package/src/shapefile-loader.ts +1 -0
- package/src/shp-loader-types.ts +1 -0
- package/src/shp-loader.ts +1 -0
- package/src/tcx-loader-types.ts +1 -0
- package/src/tcx-loader.ts +1 -0
- package/src/twkb-loader-types.ts +1 -0
- package/src/twkb-loader.ts +1 -0
- package/src/twkb-writer.ts +1 -0
- package/src/wkb-loader-types.ts +1 -0
- package/src/wkb-loader.ts +1 -0
- package/src/wkb-writer.ts +1 -0
- package/src/wkt/hex-wkb-loader-types.ts +1 -1
- package/src/wkt/index.ts +0 -6
- package/src/wkt/twkb-loader-types.ts +1 -4
- package/src/wkt/twkb-loader.ts +1 -1
- package/src/wkt/unbundled.ts +2 -2
- package/src/wkt/wkb-loader-types.ts +1 -4
- package/src/wkt/wkb-loader.ts +1 -1
- package/src/wkt/wkt-crs-loader-types.ts +1 -1
- package/src/wkt/wkt-format.ts +1 -1
- package/src/wkt/wkt-loader-types.ts +1 -4
- package/src/wkt/wkt-loader.ts +1 -1
- package/src/wkt-crs-loader-types.ts +1 -0
- package/src/wkt-crs-loader.ts +1 -0
- package/src/wkt-crs-writer.ts +1 -0
- package/src/wkt-loader-types.ts +1 -0
- package/src/wkt-loader.ts +1 -0
- package/src/wkt-writer.ts +1 -0
- package/src/workers/dbf-worker.ts +5 -5
- package/src/workers/shapefile-worker.ts +3 -6
package/dist/dbf-worker.js
CHANGED
|
@@ -15,29 +15,44 @@
|
|
|
15
15
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
16
16
|
};
|
|
17
17
|
|
|
18
|
-
//
|
|
18
|
+
// ../../node_modules/@math.gl/tasks/dist/worker-utils/lib/node/worker_threads-browser.js
|
|
19
19
|
var parentPort;
|
|
20
20
|
var init_worker_threads_browser = __esm({
|
|
21
|
-
"
|
|
22
|
-
"
|
|
23
|
-
parentPort = null;
|
|
21
|
+
"../../node_modules/@math.gl/tasks/dist/worker-utils/lib/node/worker_threads-browser.js"() {
|
|
22
|
+
parentPort = globalThis.process?.getBuiltinModule?.("node:worker_threads")?.parentPort ?? null;
|
|
24
23
|
}
|
|
25
24
|
});
|
|
26
25
|
|
|
27
|
-
//
|
|
26
|
+
// ../../node_modules/@math.gl/tasks/dist/worker-utils/lib/worker-utils/get-transfer-list.js
|
|
28
27
|
function getTransferList(object, recursive = true, transfers) {
|
|
29
28
|
const transfersSet = transfers || /* @__PURE__ */ new Set();
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
29
|
+
const seen = /* @__PURE__ */ new Set();
|
|
30
|
+
function visit(value) {
|
|
31
|
+
if (!value || typeof value !== "object" || seen.has(value))
|
|
32
|
+
return;
|
|
33
|
+
seen.add(value);
|
|
34
|
+
if (isTransferable(value))
|
|
35
|
+
transfersSet.add(value);
|
|
36
|
+
else if (ArrayBuffer.isView(value)) {
|
|
37
|
+
if (isTransferable(value.buffer))
|
|
38
|
+
transfersSet.add(value.buffer);
|
|
39
|
+
} else if (recursive && typeof MessageChannel !== "undefined" && value instanceof MessageChannel) {
|
|
40
|
+
visit(value.port1);
|
|
41
|
+
visit(value.port2);
|
|
42
|
+
} else if (recursive && value instanceof Map) {
|
|
43
|
+
for (const [key, item] of value) {
|
|
44
|
+
visit(key);
|
|
45
|
+
visit(item);
|
|
46
|
+
}
|
|
47
|
+
} else if (recursive && value instanceof Set) {
|
|
48
|
+
for (const item of value)
|
|
49
|
+
visit(item);
|
|
50
|
+
} else if (recursive) {
|
|
51
|
+
for (const key of Object.keys(value))
|
|
52
|
+
visit(value[key]);
|
|
39
53
|
}
|
|
40
54
|
}
|
|
55
|
+
visit(object);
|
|
41
56
|
return transfers === void 0 ? Array.from(transfersSet) : [];
|
|
42
57
|
}
|
|
43
58
|
function isTransferable(object) {
|
|
@@ -59,12 +74,11 @@
|
|
|
59
74
|
return false;
|
|
60
75
|
}
|
|
61
76
|
var init_get_transfer_list = __esm({
|
|
62
|
-
"
|
|
63
|
-
"use strict";
|
|
77
|
+
"../../node_modules/@math.gl/tasks/dist/worker-utils/lib/worker-utils/get-transfer-list.js"() {
|
|
64
78
|
}
|
|
65
79
|
});
|
|
66
80
|
|
|
67
|
-
//
|
|
81
|
+
// ../../node_modules/@math.gl/tasks/dist/worker-utils/lib/worker-farm/worker-body.js
|
|
68
82
|
async function getParentPort() {
|
|
69
83
|
return parentPort;
|
|
70
84
|
}
|
|
@@ -77,31 +91,31 @@
|
|
|
77
91
|
}
|
|
78
92
|
var onMessageWrapperMap, WorkerBody;
|
|
79
93
|
var init_worker_body = __esm({
|
|
80
|
-
"
|
|
81
|
-
"use strict";
|
|
94
|
+
"../../node_modules/@math.gl/tasks/dist/worker-utils/lib/worker-farm/worker-body.js"() {
|
|
82
95
|
init_get_transfer_list();
|
|
83
96
|
init_worker_threads_browser();
|
|
84
97
|
onMessageWrapperMap = /* @__PURE__ */ new Map();
|
|
85
98
|
WorkerBody = class {
|
|
86
99
|
/** Check that we are actually in a worker thread */
|
|
87
100
|
static async inWorkerThread() {
|
|
88
|
-
|
|
101
|
+
const workerGlobalScope = globalThis.WorkerGlobalScope;
|
|
102
|
+
return typeof workerGlobalScope === "function" && globalThis instanceof workerGlobalScope || Boolean(await getParentPort());
|
|
89
103
|
}
|
|
90
104
|
/*
|
|
91
105
|
* (type: WorkerMessageType, payload: WorkerMessagePayload) => any
|
|
92
106
|
*/
|
|
93
107
|
static set onmessage(onMessage) {
|
|
94
108
|
async function handleMessage(message) {
|
|
95
|
-
const
|
|
96
|
-
const { type, payload } =
|
|
109
|
+
const parentPort3 = await getParentPort();
|
|
110
|
+
const { type, payload } = parentPort3 ? message : message.data;
|
|
97
111
|
onMessage(type, payload);
|
|
98
112
|
}
|
|
99
|
-
getParentPort().then((
|
|
100
|
-
if (
|
|
101
|
-
|
|
113
|
+
getParentPort().then((parentPort3) => {
|
|
114
|
+
if (parentPort3) {
|
|
115
|
+
parentPort3.on("message", (message) => {
|
|
102
116
|
handleMessage(message);
|
|
103
117
|
});
|
|
104
|
-
|
|
118
|
+
parentPort3.on("exit", () => console.debug("Node worker closing"));
|
|
105
119
|
} else {
|
|
106
120
|
globalThis.onmessage = handleMessage;
|
|
107
121
|
}
|
|
@@ -119,9 +133,9 @@
|
|
|
119
133
|
};
|
|
120
134
|
onMessageWrapperMap.set(onMessage, onMessageWrapper);
|
|
121
135
|
}
|
|
122
|
-
const
|
|
123
|
-
if (
|
|
124
|
-
|
|
136
|
+
const parentPort3 = await getParentPort();
|
|
137
|
+
if (parentPort3) {
|
|
138
|
+
parentPort3.on("message", onMessageWrapper);
|
|
125
139
|
} else {
|
|
126
140
|
globalThis.addEventListener("message", onMessageWrapper);
|
|
127
141
|
}
|
|
@@ -132,9 +146,9 @@
|
|
|
132
146
|
if (!onMessageWrapper) {
|
|
133
147
|
return;
|
|
134
148
|
}
|
|
135
|
-
const
|
|
136
|
-
if (
|
|
137
|
-
|
|
149
|
+
const parentPort3 = await getParentPort();
|
|
150
|
+
if (parentPort3) {
|
|
151
|
+
parentPort3.off("message", onMessageWrapper);
|
|
138
152
|
} else {
|
|
139
153
|
globalThis.removeEventListener("message", onMessageWrapper);
|
|
140
154
|
}
|
|
@@ -144,12 +158,12 @@
|
|
|
144
158
|
* @param type
|
|
145
159
|
* @param payload
|
|
146
160
|
*/
|
|
147
|
-
static async postMessage(type, payload) {
|
|
161
|
+
static async postMessage(type, payload, copy = false) {
|
|
148
162
|
const data = { source: "loaders.gl", type, payload };
|
|
149
|
-
const transferList = getTransferList(payload);
|
|
150
|
-
const
|
|
151
|
-
if (
|
|
152
|
-
|
|
163
|
+
const transferList = copy ? [] : getTransferList(payload);
|
|
164
|
+
const parentPort3 = await getParentPort();
|
|
165
|
+
if (parentPort3) {
|
|
166
|
+
parentPort3.postMessage(data, transferList);
|
|
153
167
|
} else {
|
|
154
168
|
globalThis.postMessage(data, transferList);
|
|
155
169
|
}
|
|
@@ -158,15 +172,11 @@
|
|
|
158
172
|
}
|
|
159
173
|
});
|
|
160
174
|
|
|
161
|
-
//
|
|
175
|
+
// ../../node_modules/@math.gl/tasks/dist/worker-utils/lib/async-queue/async-queue.js
|
|
162
176
|
var AsyncQueue;
|
|
163
177
|
var init_async_queue = __esm({
|
|
164
|
-
"
|
|
165
|
-
"use strict";
|
|
178
|
+
"../../node_modules/@math.gl/tasks/dist/worker-utils/lib/async-queue/async-queue.js"() {
|
|
166
179
|
AsyncQueue = class {
|
|
167
|
-
_values;
|
|
168
|
-
_settlers;
|
|
169
|
-
_closed;
|
|
170
180
|
constructor() {
|
|
171
181
|
this._values = [];
|
|
172
182
|
this._settlers = [];
|
|
@@ -234,8 +244,63 @@
|
|
|
234
244
|
}
|
|
235
245
|
});
|
|
236
246
|
|
|
237
|
-
//
|
|
238
|
-
|
|
247
|
+
// ../../node_modules/@math.gl/tasks/dist/worker-utils/lib/worker-api/shared-state.js
|
|
248
|
+
var SharedWorkerState;
|
|
249
|
+
var init_shared_state = __esm({
|
|
250
|
+
"../../node_modules/@math.gl/tasks/dist/worker-utils/lib/worker-api/shared-state.js"() {
|
|
251
|
+
SharedWorkerState = class {
|
|
252
|
+
constructor(buffer) {
|
|
253
|
+
if (typeof SharedArrayBuffer === "undefined" || !(buffer instanceof SharedArrayBuffer) || buffer.byteLength !== 16)
|
|
254
|
+
throw new Error("Expected a 16-byte shared worker control buffer");
|
|
255
|
+
this.buffer = buffer;
|
|
256
|
+
this.values = new Int32Array(buffer);
|
|
257
|
+
}
|
|
258
|
+
get snapshot() {
|
|
259
|
+
return {
|
|
260
|
+
cancelled: Atomics.load(this.values, 0) !== 0,
|
|
261
|
+
completed: Atomics.load(this.values, 1),
|
|
262
|
+
total: Atomics.load(this.values, 2),
|
|
263
|
+
revision: Atomics.load(this.values, 3)
|
|
264
|
+
};
|
|
265
|
+
}
|
|
266
|
+
cancel() {
|
|
267
|
+
Atomics.store(this.values, 0, 1);
|
|
268
|
+
Atomics.add(this.values, 3, 1);
|
|
269
|
+
Atomics.notify(this.values, 0);
|
|
270
|
+
}
|
|
271
|
+
throwIfCancelled() {
|
|
272
|
+
if (Atomics.load(this.values, 0) !== 0) {
|
|
273
|
+
const error = new Error("Shared worker task was cancelled");
|
|
274
|
+
error.name = "AbortError";
|
|
275
|
+
throw error;
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
/** Integer counters for application-defined work; messages still carry phase names and units. */
|
|
279
|
+
setProgress(completed, total = -1) {
|
|
280
|
+
if (!Number.isInteger(completed) || completed < 0 || completed > 2147483647 || !Number.isInteger(total) || total < -1 || total > 2147483647) {
|
|
281
|
+
throw new RangeError("Shared progress requires nonnegative int32 counts (or total -1)");
|
|
282
|
+
}
|
|
283
|
+
Atomics.store(this.values, 1, completed);
|
|
284
|
+
Atomics.store(this.values, 2, total);
|
|
285
|
+
Atomics.add(this.values, 3, 1);
|
|
286
|
+
}
|
|
287
|
+
};
|
|
288
|
+
}
|
|
289
|
+
});
|
|
290
|
+
|
|
291
|
+
// ../../node_modules/@math.gl/tasks/dist/worker-utils/lib/worker-api/validate-output-ownership.js
|
|
292
|
+
function validateOutputOwnership(ownership) {
|
|
293
|
+
if (ownership !== void 0 && ownership !== "copy" && ownership !== "transfer") {
|
|
294
|
+
throw new Error("Invalid worker output ownership");
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
var init_validate_output_ownership = __esm({
|
|
298
|
+
"../../node_modules/@math.gl/tasks/dist/worker-utils/lib/worker-api/validate-output-ownership.js"() {
|
|
299
|
+
}
|
|
300
|
+
});
|
|
301
|
+
|
|
302
|
+
// ../../node_modules/@math.gl/tasks/dist/worker-utils/lib/worker-api/create-worker.js
|
|
303
|
+
async function createWorker(process2, processInBatches, preload) {
|
|
239
304
|
if (!await WorkerBody.inWorkerThread()) {
|
|
240
305
|
return;
|
|
241
306
|
}
|
|
@@ -243,27 +308,59 @@
|
|
|
243
308
|
process: processOnMainThread
|
|
244
309
|
};
|
|
245
310
|
WorkerBody.onmessage = async (type, payload) => {
|
|
311
|
+
if (type === "cancel") {
|
|
312
|
+
activeController?.abort();
|
|
313
|
+
activeInputBatches?.close();
|
|
314
|
+
activeOutputAcknowledgements?.close();
|
|
315
|
+
return;
|
|
316
|
+
}
|
|
317
|
+
const controller = type === "process" || type === "process-in-batches" ? new AbortController() : void 0;
|
|
318
|
+
if (controller)
|
|
319
|
+
activeController = controller;
|
|
320
|
+
const startedAt = performance.now();
|
|
246
321
|
const reporter = type === "process" || type === "process-in-batches" ? createProgressReporter() : void 0;
|
|
247
|
-
|
|
322
|
+
let sharedState;
|
|
323
|
+
const throwIfAborted = () => {
|
|
324
|
+
controller?.signal.throwIfAborted();
|
|
325
|
+
sharedState?.throwIfCancelled();
|
|
326
|
+
};
|
|
327
|
+
const jobContext = {
|
|
328
|
+
...context,
|
|
329
|
+
signal: controller?.signal,
|
|
330
|
+
sharedState,
|
|
331
|
+
throwIfAborted,
|
|
332
|
+
reportProgress: (progress) => {
|
|
333
|
+
if (!controller?.signal.aborted && !sharedState?.snapshot.cancelled)
|
|
334
|
+
reporter?.report(progress);
|
|
335
|
+
}
|
|
336
|
+
};
|
|
248
337
|
try {
|
|
338
|
+
if (controller && payload.options?.["sharedState"]) {
|
|
339
|
+
sharedState = new SharedWorkerState(payload.options["sharedState"]);
|
|
340
|
+
jobContext.sharedState = sharedState;
|
|
341
|
+
}
|
|
249
342
|
switch (type) {
|
|
250
343
|
case "preload":
|
|
344
|
+
await preload?.();
|
|
251
345
|
WorkerBody.postMessage("done", {});
|
|
252
346
|
break;
|
|
253
347
|
case "process":
|
|
254
|
-
|
|
348
|
+
throwIfAborted();
|
|
349
|
+
validateOutputOwnership(payload.options?.["outputOwnership"]);
|
|
350
|
+
if (!process2) {
|
|
255
351
|
throw new Error("Worker does not support atomic processing");
|
|
256
352
|
}
|
|
257
|
-
const result = await
|
|
258
|
-
|
|
259
|
-
payload.options || {},
|
|
260
|
-
jobContext,
|
|
261
|
-
payload.context || {}
|
|
262
|
-
);
|
|
353
|
+
const result = await process2(payload.input, payload.options || {}, jobContext, payload.context || {});
|
|
354
|
+
throwIfAborted();
|
|
263
355
|
reporter?.finish();
|
|
264
|
-
WorkerBody.postMessage("done", {
|
|
356
|
+
await WorkerBody.postMessage("done", {
|
|
357
|
+
result,
|
|
358
|
+
executionMs: performance.now() - startedAt
|
|
359
|
+
}, payload.options?.["outputOwnership"] === "copy");
|
|
265
360
|
break;
|
|
266
361
|
case "process-in-batches":
|
|
362
|
+
throwIfAborted();
|
|
363
|
+
validateOutputOwnership(payload.options?.["outputOwnership"]);
|
|
267
364
|
if (!processInBatches) {
|
|
268
365
|
throw new Error("Worker does not support batched processing");
|
|
269
366
|
}
|
|
@@ -272,18 +369,15 @@
|
|
|
272
369
|
activeInputBatches = inputBatches;
|
|
273
370
|
activeOutputAcknowledgements = outputAcknowledgements;
|
|
274
371
|
try {
|
|
275
|
-
const resultIterator = processInBatches(
|
|
276
|
-
createDemandDrivenIterator(inputBatches),
|
|
277
|
-
payload.options || {},
|
|
278
|
-
jobContext,
|
|
279
|
-
payload.context || {}
|
|
280
|
-
);
|
|
372
|
+
const resultIterator = processInBatches(createDemandDrivenIterator(inputBatches), payload.options || {}, jobContext, payload.context || {});
|
|
281
373
|
for await (const batch of resultIterator) {
|
|
282
|
-
|
|
374
|
+
throwIfAborted();
|
|
375
|
+
await WorkerBody.postMessage("output-batch", { result: batch }, payload.options?.["outputOwnership"] === "copy");
|
|
283
376
|
await outputAcknowledgements.next();
|
|
284
377
|
}
|
|
378
|
+
throwIfAborted();
|
|
285
379
|
reporter?.finish();
|
|
286
|
-
await WorkerBody.postMessage("done", {});
|
|
380
|
+
await WorkerBody.postMessage("done", { executionMs: performance.now() - startedAt });
|
|
287
381
|
} finally {
|
|
288
382
|
activeInputBatches = null;
|
|
289
383
|
activeOutputAcknowledgements = null;
|
|
@@ -310,11 +404,18 @@
|
|
|
310
404
|
default:
|
|
311
405
|
}
|
|
312
406
|
} catch (error) {
|
|
313
|
-
reporter?.finish();
|
|
407
|
+
reporter?.finish(controller?.signal.aborted || sharedState?.snapshot.cancelled);
|
|
314
408
|
const message = error instanceof Error ? error.message : "";
|
|
315
|
-
WorkerBody.postMessage("error", {
|
|
409
|
+
await WorkerBody.postMessage("error", {
|
|
410
|
+
error: message,
|
|
411
|
+
errorName: error instanceof Error ? error.name : "Error"
|
|
412
|
+
});
|
|
413
|
+
} finally {
|
|
414
|
+
if (controller && activeController === controller)
|
|
415
|
+
activeController = null;
|
|
316
416
|
}
|
|
317
417
|
};
|
|
418
|
+
await WorkerBody.postMessage("ready", {});
|
|
318
419
|
}
|
|
319
420
|
async function* createDemandDrivenIterator(inputBatches) {
|
|
320
421
|
while (true) {
|
|
@@ -327,81 +428,691 @@
|
|
|
327
428
|
}
|
|
328
429
|
}
|
|
329
430
|
function processOnMainThread(arrayBuffer, options = {}, jobContext = {}) {
|
|
431
|
+
const signal = activeController?.signal;
|
|
432
|
+
signal?.throwIfAborted();
|
|
330
433
|
return new Promise((resolve, reject) => {
|
|
331
434
|
const id = requestId++;
|
|
332
|
-
const
|
|
333
|
-
|
|
435
|
+
const cleanup = () => {
|
|
436
|
+
signal?.removeEventListener("abort", abort);
|
|
437
|
+
void WorkerBody.removeEventListener(onMessage);
|
|
438
|
+
};
|
|
439
|
+
const abort = () => {
|
|
440
|
+
cleanup();
|
|
441
|
+
reject(signal?.reason);
|
|
442
|
+
};
|
|
443
|
+
const onMessage = (type, payload) => {
|
|
444
|
+
if (payload.id !== id)
|
|
334
445
|
return;
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
case "error":
|
|
342
|
-
WorkerBody.removeEventListener(onMessage);
|
|
343
|
-
reject(payload2.error);
|
|
344
|
-
break;
|
|
345
|
-
default:
|
|
446
|
+
if (type === "done") {
|
|
447
|
+
cleanup();
|
|
448
|
+
resolve(payload.result);
|
|
449
|
+
} else if (type === "error") {
|
|
450
|
+
cleanup();
|
|
451
|
+
reject(payload.error);
|
|
346
452
|
}
|
|
347
453
|
};
|
|
348
|
-
WorkerBody.addEventListener(onMessage)
|
|
349
|
-
|
|
350
|
-
|
|
454
|
+
void WorkerBody.addEventListener(onMessage).then(async () => {
|
|
455
|
+
if (signal?.aborted) {
|
|
456
|
+
abort();
|
|
457
|
+
return;
|
|
458
|
+
}
|
|
459
|
+
signal?.addEventListener("abort", abort, { once: true });
|
|
460
|
+
await WorkerBody.postMessage("process", {
|
|
461
|
+
id,
|
|
462
|
+
input: arrayBuffer,
|
|
463
|
+
options,
|
|
464
|
+
context: jobContext
|
|
465
|
+
});
|
|
466
|
+
}).catch((error) => {
|
|
467
|
+
cleanup();
|
|
468
|
+
reject(error);
|
|
469
|
+
});
|
|
351
470
|
});
|
|
352
471
|
}
|
|
353
472
|
function createProgressReporter() {
|
|
354
|
-
let
|
|
473
|
+
let pending2;
|
|
355
474
|
let finished = false;
|
|
356
475
|
let scheduled = false;
|
|
357
476
|
const flush = () => {
|
|
358
477
|
scheduled = false;
|
|
359
|
-
if (
|
|
360
|
-
WorkerBody.postMessage("progress", { progress:
|
|
361
|
-
|
|
478
|
+
if (pending2) {
|
|
479
|
+
WorkerBody.postMessage("progress", { progress: pending2 });
|
|
480
|
+
pending2 = void 0;
|
|
362
481
|
}
|
|
363
482
|
};
|
|
364
483
|
return {
|
|
365
484
|
/** Records progress while retaining phase transitions. */
|
|
366
485
|
report(progress) {
|
|
367
|
-
if (finished)
|
|
368
|
-
|
|
369
|
-
|
|
486
|
+
if (finished)
|
|
487
|
+
return;
|
|
488
|
+
if (pending2 && pending2.phase !== progress.phase)
|
|
489
|
+
flush();
|
|
490
|
+
pending2 = { ...progress };
|
|
370
491
|
if (!scheduled) {
|
|
371
492
|
scheduled = true;
|
|
372
493
|
setTimeout(flush, 0);
|
|
373
494
|
}
|
|
374
495
|
},
|
|
375
496
|
/** Flushes final progress and suppresses reports from stale callbacks. */
|
|
376
|
-
finish() {
|
|
497
|
+
finish(discard = false) {
|
|
498
|
+
if (discard)
|
|
499
|
+
pending2 = void 0;
|
|
377
500
|
flush();
|
|
378
501
|
finished = true;
|
|
379
502
|
}
|
|
380
503
|
};
|
|
381
504
|
}
|
|
382
|
-
var requestId, activeInputBatches, activeOutputAcknowledgements;
|
|
505
|
+
var requestId, activeController, activeInputBatches, activeOutputAcknowledgements;
|
|
383
506
|
var init_create_worker = __esm({
|
|
384
|
-
"
|
|
385
|
-
|
|
507
|
+
"../../node_modules/@math.gl/tasks/dist/worker-utils/lib/worker-api/create-worker.js"() {
|
|
508
|
+
init_shared_state();
|
|
386
509
|
init_async_queue();
|
|
387
510
|
init_worker_body();
|
|
511
|
+
init_validate_output_ownership();
|
|
388
512
|
requestId = 0;
|
|
513
|
+
activeController = null;
|
|
389
514
|
activeInputBatches = null;
|
|
390
515
|
activeOutputAcknowledgements = null;
|
|
391
516
|
}
|
|
392
517
|
});
|
|
393
518
|
|
|
394
|
-
//
|
|
519
|
+
// ../../node_modules/@math.gl/tasks/dist/worker-utils/index.js
|
|
520
|
+
var import_meta, path, moduleUrl;
|
|
395
521
|
var init_worker_utils = __esm({
|
|
522
|
+
"../../node_modules/@math.gl/tasks/dist/worker-utils/index.js"() {
|
|
523
|
+
init_worker_body();
|
|
524
|
+
init_create_worker();
|
|
525
|
+
init_get_transfer_list();
|
|
526
|
+
import_meta = {};
|
|
527
|
+
path = typeof __filename === "string" ? __filename.replace(/\\/g, "/") : "";
|
|
528
|
+
moduleUrl = path ? `file://${path.startsWith("/") ? "" : "/"}${encodeURI(path).replace(/#/g, "%23").replace(/\?/g, "%3F")}` : import_meta.url;
|
|
529
|
+
}
|
|
530
|
+
});
|
|
531
|
+
|
|
532
|
+
// ../../node_modules/@math.gl/tasks/dist/tasks/task-preload.js
|
|
533
|
+
function preloadTaskCode(task, signal) {
|
|
534
|
+
if (!task.preload)
|
|
535
|
+
return Promise.resolve();
|
|
536
|
+
let promise = pending.get(task);
|
|
537
|
+
if (!promise) {
|
|
538
|
+
promise = Promise.resolve().then(() => task.preload()).then(() => {
|
|
539
|
+
loaded.add(task);
|
|
540
|
+
});
|
|
541
|
+
pending.set(task, promise);
|
|
542
|
+
void promise.catch(() => pending.delete(task));
|
|
543
|
+
}
|
|
544
|
+
return withSignal(promise, signal);
|
|
545
|
+
}
|
|
546
|
+
function withSignal(operation, signal) {
|
|
547
|
+
if (!signal)
|
|
548
|
+
return operation;
|
|
549
|
+
return new Promise((resolve, reject) => {
|
|
550
|
+
const abort = () => {
|
|
551
|
+
signal.removeEventListener("abort", abort);
|
|
552
|
+
reject(signal.reason);
|
|
553
|
+
};
|
|
554
|
+
signal.addEventListener("abort", abort, { once: true });
|
|
555
|
+
if (signal.aborted)
|
|
556
|
+
abort();
|
|
557
|
+
operation.then((value) => {
|
|
558
|
+
signal.removeEventListener("abort", abort);
|
|
559
|
+
resolve(value);
|
|
560
|
+
}, (error) => {
|
|
561
|
+
signal.removeEventListener("abort", abort);
|
|
562
|
+
reject(error);
|
|
563
|
+
});
|
|
564
|
+
});
|
|
565
|
+
}
|
|
566
|
+
var pending, loaded;
|
|
567
|
+
var init_task_preload = __esm({
|
|
568
|
+
"../../node_modules/@math.gl/tasks/dist/tasks/task-preload.js"() {
|
|
569
|
+
pending = /* @__PURE__ */ new WeakMap();
|
|
570
|
+
loaded = /* @__PURE__ */ new WeakSet();
|
|
571
|
+
}
|
|
572
|
+
});
|
|
573
|
+
|
|
574
|
+
// ../../node_modules/@math.gl/tasks/dist/tasks/task-channel.js
|
|
575
|
+
var TaskRequestError, TaskChannel;
|
|
576
|
+
var init_task_channel = __esm({
|
|
577
|
+
"../../node_modules/@math.gl/tasks/dist/tasks/task-channel.js"() {
|
|
578
|
+
TaskRequestError = class extends Error {
|
|
579
|
+
};
|
|
580
|
+
TaskChannel = class {
|
|
581
|
+
constructor(options) {
|
|
582
|
+
this.options = options;
|
|
583
|
+
this.nextId = 1;
|
|
584
|
+
this.pending = /* @__PURE__ */ new Map();
|
|
585
|
+
this.incoming = /* @__PURE__ */ new Map();
|
|
586
|
+
}
|
|
587
|
+
/** Send a request without serializing other in-flight requests. */
|
|
588
|
+
request(operation, value, signal, transfer = []) {
|
|
589
|
+
if (this.failure)
|
|
590
|
+
return Promise.reject(this.failure.reason);
|
|
591
|
+
if (signal?.aborted)
|
|
592
|
+
return Promise.reject(signal.reason);
|
|
593
|
+
const id = this.nextId++;
|
|
594
|
+
return new Promise((resolve, reject) => {
|
|
595
|
+
const abort = () => {
|
|
596
|
+
const pending2 = this.pending.get(id);
|
|
597
|
+
if (!pending2)
|
|
598
|
+
return;
|
|
599
|
+
this.pending.delete(id);
|
|
600
|
+
pending2.cleanup();
|
|
601
|
+
reject(signal?.reason);
|
|
602
|
+
this.send({ source: "math.gl/tasks", kind: "cancel", id });
|
|
603
|
+
};
|
|
604
|
+
this.pending.set(id, {
|
|
605
|
+
resolve,
|
|
606
|
+
reject,
|
|
607
|
+
cleanup: () => signal?.removeEventListener("abort", abort)
|
|
608
|
+
});
|
|
609
|
+
signal?.addEventListener("abort", abort, { once: true });
|
|
610
|
+
this.send({ source: "math.gl/tasks", kind: "request", id, operation, value }, transfer);
|
|
611
|
+
});
|
|
612
|
+
}
|
|
613
|
+
/** Send a one-way notification. */
|
|
614
|
+
emit(operation, value, transfer = []) {
|
|
615
|
+
if (this.failure)
|
|
616
|
+
throw this.failure.reason;
|
|
617
|
+
this.send({ source: "math.gl/tasks", kind: "event", id: 0, operation, value }, transfer);
|
|
618
|
+
}
|
|
619
|
+
/** Dispatch a transport message; unrelated protocols are ignored. */
|
|
620
|
+
receive(message) {
|
|
621
|
+
if (this.failure || message?.source !== "math.gl/tasks")
|
|
622
|
+
return;
|
|
623
|
+
if (message.kind === "failure") {
|
|
624
|
+
const reason = new Error(message.error?.message ?? "Task channel failed");
|
|
625
|
+
this.close(reason);
|
|
626
|
+
this.options.onFailure?.(reason);
|
|
627
|
+
} else if (message.kind === "result" || message.kind === "error") {
|
|
628
|
+
const pending2 = this.pending.get(message.id);
|
|
629
|
+
if (!pending2)
|
|
630
|
+
return;
|
|
631
|
+
this.pending.delete(message.id);
|
|
632
|
+
pending2.cleanup();
|
|
633
|
+
if (message.kind === "result")
|
|
634
|
+
pending2.resolve(message.value);
|
|
635
|
+
else {
|
|
636
|
+
const error = new TaskRequestError(message.error?.message ?? "Task request failed");
|
|
637
|
+
error.name = message.error?.name ?? "Error";
|
|
638
|
+
pending2.reject(error);
|
|
639
|
+
}
|
|
640
|
+
} else if (message.kind === "cancel") {
|
|
641
|
+
this.incoming.get(message.id)?.abort(new DOMException("Task request cancelled", "AbortError"));
|
|
642
|
+
} else if (message.kind === "event") {
|
|
643
|
+
try {
|
|
644
|
+
this.options.handleEvent?.(message.operation, message.value);
|
|
645
|
+
} catch (error) {
|
|
646
|
+
this.fail(error);
|
|
647
|
+
}
|
|
648
|
+
} else if (message.kind === "request") {
|
|
649
|
+
if (this.incoming.has(message.id)) {
|
|
650
|
+
this.fail(new Error("Duplicate task request identifier"));
|
|
651
|
+
return;
|
|
652
|
+
}
|
|
653
|
+
const controller = new AbortController();
|
|
654
|
+
this.incoming.set(message.id, controller);
|
|
655
|
+
void Promise.resolve().then(() => {
|
|
656
|
+
controller.signal.throwIfAborted();
|
|
657
|
+
return this.options.handleRequest(message.operation, message.value, controller.signal);
|
|
658
|
+
}).then((value) => {
|
|
659
|
+
if (!controller.signal.aborted && !this.failure) {
|
|
660
|
+
this.send({ source: "math.gl/tasks", kind: "result", id: message.id, value }, this.options.getResultTransferList?.(value, message.value));
|
|
661
|
+
}
|
|
662
|
+
}).catch((reason) => {
|
|
663
|
+
if (!controller.signal.aborted && !this.failure) {
|
|
664
|
+
this.send({
|
|
665
|
+
source: "math.gl/tasks",
|
|
666
|
+
kind: "error",
|
|
667
|
+
id: message.id,
|
|
668
|
+
error: {
|
|
669
|
+
name: reason instanceof Error ? reason.name : "Error",
|
|
670
|
+
message: reason instanceof Error ? reason.message : String(reason)
|
|
671
|
+
}
|
|
672
|
+
});
|
|
673
|
+
}
|
|
674
|
+
}).finally(() => this.incoming.delete(message.id));
|
|
675
|
+
}
|
|
676
|
+
}
|
|
677
|
+
/** Reject all outstanding calls with a common cause and abort incoming callbacks. */
|
|
678
|
+
close(reason = new Error("Task channel closed")) {
|
|
679
|
+
if (this.failure)
|
|
680
|
+
return;
|
|
681
|
+
this.failure = { reason };
|
|
682
|
+
for (const pending2 of this.pending.values()) {
|
|
683
|
+
pending2.cleanup();
|
|
684
|
+
pending2.reject(reason);
|
|
685
|
+
}
|
|
686
|
+
this.pending.clear();
|
|
687
|
+
for (const controller of this.incoming.values())
|
|
688
|
+
controller.abort(reason);
|
|
689
|
+
this.incoming.clear();
|
|
690
|
+
}
|
|
691
|
+
send(message, transfer = []) {
|
|
692
|
+
if (this.failure)
|
|
693
|
+
return;
|
|
694
|
+
try {
|
|
695
|
+
this.options.send(message, transfer);
|
|
696
|
+
} catch (error) {
|
|
697
|
+
this.fail(error);
|
|
698
|
+
}
|
|
699
|
+
}
|
|
700
|
+
/** Invalidate the channel and notify the peer when the transport still works. */
|
|
701
|
+
fail(reason) {
|
|
702
|
+
if (this.failure)
|
|
703
|
+
return;
|
|
704
|
+
this.close(reason);
|
|
705
|
+
try {
|
|
706
|
+
this.options.send({
|
|
707
|
+
source: "math.gl/tasks",
|
|
708
|
+
kind: "failure",
|
|
709
|
+
id: 0,
|
|
710
|
+
error: {
|
|
711
|
+
name: reason instanceof Error ? reason.name : "Error",
|
|
712
|
+
message: reason instanceof Error ? reason.message : String(reason)
|
|
713
|
+
}
|
|
714
|
+
}, []);
|
|
715
|
+
} catch {
|
|
716
|
+
}
|
|
717
|
+
this.options.onFailure?.(reason);
|
|
718
|
+
}
|
|
719
|
+
};
|
|
720
|
+
}
|
|
721
|
+
});
|
|
722
|
+
|
|
723
|
+
// ../../node_modules/@math.gl/tasks/dist/tasks/task-runtime.js
|
|
724
|
+
function assertPayload(value) {
|
|
725
|
+
if (!value || typeof value !== "object" || Object.getPrototypeOf(value) !== Object.prototype) {
|
|
726
|
+
throw new TypeError("Task payloads must be plain objects with named fields");
|
|
727
|
+
}
|
|
728
|
+
}
|
|
729
|
+
function clonePayload(value, ownership = "copy") {
|
|
730
|
+
assertPayload(value);
|
|
731
|
+
if (!["copy", "transfer", "share"].includes(ownership))
|
|
732
|
+
throw new TypeError("Invalid input ownership");
|
|
733
|
+
const transfer = getTransferList(value);
|
|
734
|
+
if (ownership === "share" && transfer.length)
|
|
735
|
+
throw new TypeError("Share requires shared storage");
|
|
736
|
+
return structuredClone(value, {
|
|
737
|
+
transfer: ownership === "transfer" ? transfer : []
|
|
738
|
+
});
|
|
739
|
+
}
|
|
740
|
+
function taskContext(state, context = {}) {
|
|
741
|
+
const signal = context.signal ?? new AbortController().signal;
|
|
742
|
+
return {
|
|
743
|
+
state,
|
|
744
|
+
signal,
|
|
745
|
+
requestHost: async (operation, payload, controls) => {
|
|
746
|
+
signal.throwIfAborted();
|
|
747
|
+
if (!context.requestHost)
|
|
748
|
+
throw new Error("No host request handler configured");
|
|
749
|
+
return context.requestHost(operation, payload, controls);
|
|
750
|
+
},
|
|
751
|
+
emitHost: (operation, payload) => {
|
|
752
|
+
signal.throwIfAborted();
|
|
753
|
+
context.emitHost?.(operation, payload);
|
|
754
|
+
},
|
|
755
|
+
throwIfAborted: () => {
|
|
756
|
+
signal.throwIfAborted();
|
|
757
|
+
context.throwIfAborted?.();
|
|
758
|
+
},
|
|
759
|
+
reportProgress: (progress) => context.reportProgress?.({
|
|
760
|
+
...progress,
|
|
761
|
+
phase: progress.phase ?? "process",
|
|
762
|
+
unit: progress.unit ?? "items"
|
|
763
|
+
})
|
|
764
|
+
};
|
|
765
|
+
}
|
|
766
|
+
async function initializeTaskWorker(task) {
|
|
767
|
+
if (!await WorkerBody.inWorkerThread())
|
|
768
|
+
throw new Error("initializeTaskWorker must run inside a worker");
|
|
769
|
+
if (installed)
|
|
770
|
+
throw new Error("A task is already installed in this worker");
|
|
771
|
+
installed = true;
|
|
772
|
+
const runtime = new TaskRuntime(task);
|
|
773
|
+
let channelStream;
|
|
774
|
+
const channel = new TaskChannel({
|
|
775
|
+
getResultTransferList: (value, request) => request.outputOwnership === "transfer" ? getTransferList(value) : [],
|
|
776
|
+
send: (message, transfer) => {
|
|
777
|
+
const snapshot = structuredClone(message, { transfer });
|
|
778
|
+
void WorkerBody.postMessage("task-channel", snapshot).catch((reason) => channel.fail(reason));
|
|
779
|
+
},
|
|
780
|
+
handleRequest: async (operation, value, signal) => {
|
|
781
|
+
const request = value;
|
|
782
|
+
const context = {
|
|
783
|
+
signal,
|
|
784
|
+
reportProgress: (progress) => channel.emit("task:progress", { id: request.progressId, progress }),
|
|
785
|
+
requestHost: (operation2, payload, controls = {}) => {
|
|
786
|
+
const request2 = {
|
|
787
|
+
operation: operation2,
|
|
788
|
+
payload: clonePayload(payload, controls.inputOwnership),
|
|
789
|
+
outputOwnership: controls.outputOwnership ?? "copy"
|
|
790
|
+
};
|
|
791
|
+
return channel.request("task:host-request", request2, signal, getTransferList(request2));
|
|
792
|
+
},
|
|
793
|
+
emitHost: (operation2, payload) => channel.emit("task:host-event", { operation: operation2, payload, id: request.progressId })
|
|
794
|
+
};
|
|
795
|
+
switch (operation) {
|
|
796
|
+
case "initialize":
|
|
797
|
+
return runtime.initialize(request.input, context);
|
|
798
|
+
case "process":
|
|
799
|
+
return runtime.process(request.input, request.options, context);
|
|
800
|
+
case "stream-open": {
|
|
801
|
+
if (channelStream)
|
|
802
|
+
throw new Error("A task stream is already open");
|
|
803
|
+
async function* inputs() {
|
|
804
|
+
while (true) {
|
|
805
|
+
const result = await channel.request("task:next-input", { outputOwnership: "transfer" }, signal);
|
|
806
|
+
if (result.done)
|
|
807
|
+
return;
|
|
808
|
+
yield result.value;
|
|
809
|
+
}
|
|
810
|
+
}
|
|
811
|
+
channelStream = runtime.stream(inputs(), request.options, context)[Symbol.asyncIterator]();
|
|
812
|
+
return {};
|
|
813
|
+
}
|
|
814
|
+
case "stream-next":
|
|
815
|
+
if (!channelStream)
|
|
816
|
+
throw new Error("No active task stream");
|
|
817
|
+
return channelStream.next();
|
|
818
|
+
case "stream-close":
|
|
819
|
+
try {
|
|
820
|
+
await channelStream?.return?.();
|
|
821
|
+
} finally {
|
|
822
|
+
channelStream = void 0;
|
|
823
|
+
}
|
|
824
|
+
return {};
|
|
825
|
+
case "destroy":
|
|
826
|
+
return runtime.destroy();
|
|
827
|
+
default:
|
|
828
|
+
throw new Error("Unknown task channel operation");
|
|
829
|
+
}
|
|
830
|
+
}
|
|
831
|
+
});
|
|
832
|
+
await WorkerBody.addEventListener((type, payload) => {
|
|
833
|
+
if (type === "task-channel")
|
|
834
|
+
channel.receive(payload);
|
|
835
|
+
});
|
|
836
|
+
let streamOptions = {};
|
|
837
|
+
return createWorker(async (request, _options, context) => {
|
|
838
|
+
switch (request.operation) {
|
|
839
|
+
case "initialize":
|
|
840
|
+
return runtime.initialize(request.input, context);
|
|
841
|
+
case "destroy":
|
|
842
|
+
return runtime.destroy();
|
|
843
|
+
case "stream-options":
|
|
844
|
+
streamOptions = request.options;
|
|
845
|
+
return {};
|
|
846
|
+
case "process":
|
|
847
|
+
return runtime.process(request.input, request.options, context);
|
|
848
|
+
default:
|
|
849
|
+
throw new Error("Unknown task operation");
|
|
850
|
+
}
|
|
851
|
+
}, async function* (inputs, _options, context) {
|
|
852
|
+
async function* batches() {
|
|
853
|
+
for await (const input of inputs) {
|
|
854
|
+
assertPayload(input);
|
|
855
|
+
yield input;
|
|
856
|
+
}
|
|
857
|
+
}
|
|
858
|
+
try {
|
|
859
|
+
yield* runtime.stream(batches(), streamOptions, context);
|
|
860
|
+
} finally {
|
|
861
|
+
streamOptions = {};
|
|
862
|
+
}
|
|
863
|
+
}, () => preloadTaskCode(task));
|
|
864
|
+
}
|
|
865
|
+
var TaskRuntime, installed;
|
|
866
|
+
var init_task_runtime = __esm({
|
|
867
|
+
"../../node_modules/@math.gl/tasks/dist/tasks/task-runtime.js"() {
|
|
868
|
+
init_worker_utils();
|
|
869
|
+
init_task_preload();
|
|
870
|
+
init_task_channel();
|
|
871
|
+
TaskRuntime = class {
|
|
872
|
+
constructor(task) {
|
|
873
|
+
this.task = task;
|
|
874
|
+
this.initialized = false;
|
|
875
|
+
}
|
|
876
|
+
async initialize(input, context = {}) {
|
|
877
|
+
if (this.initialized)
|
|
878
|
+
throw new Error("Task is already initialized");
|
|
879
|
+
assertPayload(input);
|
|
880
|
+
await preloadTaskCode(this.task, context.signal);
|
|
881
|
+
context.signal?.throwIfAborted();
|
|
882
|
+
this.state = await this.task.initialize?.(input, taskContext(void 0, context));
|
|
883
|
+
this.initialized = true;
|
|
884
|
+
return {};
|
|
885
|
+
}
|
|
886
|
+
async destroy() {
|
|
887
|
+
if (this.initialized) {
|
|
888
|
+
this.initialized = false;
|
|
889
|
+
const state = this.state;
|
|
890
|
+
this.state = void 0;
|
|
891
|
+
if (this.task.initialize)
|
|
892
|
+
await this.task.destroy?.(state);
|
|
893
|
+
}
|
|
894
|
+
return {};
|
|
895
|
+
}
|
|
896
|
+
async process(input, options, context = {}) {
|
|
897
|
+
if (!this.initialized)
|
|
898
|
+
throw new Error("Task is not initialized");
|
|
899
|
+
if (!this.task.process)
|
|
900
|
+
throw new Error("Task has no atomic processor");
|
|
901
|
+
assertPayload(input);
|
|
902
|
+
const result = await this.task.process(input, options, taskContext(this.state, context));
|
|
903
|
+
assertPayload(result);
|
|
904
|
+
return result;
|
|
905
|
+
}
|
|
906
|
+
async *stream(inputs, options, context = {}) {
|
|
907
|
+
if (!this.initialized)
|
|
908
|
+
throw new Error("Task is not initialized");
|
|
909
|
+
if (!this.task.processInBatches)
|
|
910
|
+
throw new Error("Task has no streaming processor");
|
|
911
|
+
for await (const output of this.task.processInBatches(inputs, options, taskContext(this.state, context))) {
|
|
912
|
+
assertPayload(output);
|
|
913
|
+
yield output;
|
|
914
|
+
}
|
|
915
|
+
}
|
|
916
|
+
};
|
|
917
|
+
installed = false;
|
|
918
|
+
}
|
|
919
|
+
});
|
|
920
|
+
|
|
921
|
+
// ../../node_modules/@math.gl/tasks/dist/tasks/index.js
|
|
922
|
+
var init_tasks = __esm({
|
|
923
|
+
"../../node_modules/@math.gl/tasks/dist/tasks/index.js"() {
|
|
924
|
+
init_task_runtime();
|
|
925
|
+
}
|
|
926
|
+
});
|
|
927
|
+
|
|
928
|
+
// ../../node_modules/@math.gl/tasks/dist/index.js
|
|
929
|
+
var init_dist = __esm({
|
|
930
|
+
"../../node_modules/@math.gl/tasks/dist/index.js"() {
|
|
931
|
+
init_tasks();
|
|
932
|
+
}
|
|
933
|
+
});
|
|
934
|
+
|
|
935
|
+
// ../core/src/worker-utils/lib/node/worker_threads-browser.ts
|
|
936
|
+
var worker_threads_browser_exports = {};
|
|
937
|
+
__export(worker_threads_browser_exports, {
|
|
938
|
+
NodeWorker: () => NodeWorker,
|
|
939
|
+
parentPort: () => parentPort2
|
|
940
|
+
});
|
|
941
|
+
var NodeWorker, parentPort2;
|
|
942
|
+
var init_worker_threads_browser2 = __esm({
|
|
943
|
+
"../core/src/worker-utils/lib/node/worker_threads-browser.ts"() {
|
|
944
|
+
"use strict";
|
|
945
|
+
NodeWorker = class {
|
|
946
|
+
/** Restores the native worker constructor when this browser shim is embedded in a Node bundle. */
|
|
947
|
+
constructor(...arguments_) {
|
|
948
|
+
const runtimeProcess = globalThis.process;
|
|
949
|
+
const WorkerConstructor = runtimeProcess?.getBuiltinModule?.("node:worker_threads").Worker;
|
|
950
|
+
if (WorkerConstructor) {
|
|
951
|
+
return new WorkerConstructor(...arguments_);
|
|
952
|
+
}
|
|
953
|
+
}
|
|
954
|
+
/** No-op browser fallback matching the native Worker API. */
|
|
955
|
+
terminate() {
|
|
956
|
+
}
|
|
957
|
+
};
|
|
958
|
+
parentPort2 = null;
|
|
959
|
+
}
|
|
960
|
+
});
|
|
961
|
+
|
|
962
|
+
// ../core/src/worker-utils/lib/worker-api/task-runtime.ts
|
|
963
|
+
function normalizeTaskProgress(progress) {
|
|
964
|
+
return { ...progress, phase: progress.phase ?? "process", unit: progress.unit ?? "items" };
|
|
965
|
+
}
|
|
966
|
+
async function isWorkerThread() {
|
|
967
|
+
if (typeof self !== "undefined" && typeof document === "undefined" && typeof self.postMessage === "function")
|
|
968
|
+
return true;
|
|
969
|
+
if (typeof process !== "undefined" && process.versions?.node) {
|
|
970
|
+
const { isMainThread } = await Promise.resolve().then(() => (init_worker_threads_browser2(), worker_threads_browser_exports));
|
|
971
|
+
return !isMainThread;
|
|
972
|
+
}
|
|
973
|
+
return false;
|
|
974
|
+
}
|
|
975
|
+
var initializeTaskWorker2;
|
|
976
|
+
var init_task_runtime2 = __esm({
|
|
977
|
+
"../core/src/worker-utils/lib/worker-api/task-runtime.ts"() {
|
|
978
|
+
"use strict";
|
|
979
|
+
init_dist();
|
|
980
|
+
initializeTaskWorker2 = initializeTaskWorker;
|
|
981
|
+
}
|
|
982
|
+
});
|
|
983
|
+
|
|
984
|
+
// ../core/src/worker-utils/lib/worker-utils/get-transfer-list.ts
|
|
985
|
+
function getTransferList2(object, recursive = true, transfers) {
|
|
986
|
+
const transfersSet = transfers || /* @__PURE__ */ new Set();
|
|
987
|
+
if (!object) {
|
|
988
|
+
} else if (isTransferable2(object)) {
|
|
989
|
+
transfersSet.add(object);
|
|
990
|
+
} else if (isTransferable2(object.buffer)) {
|
|
991
|
+
transfersSet.add(object.buffer);
|
|
992
|
+
} else if (ArrayBuffer.isView(object)) {
|
|
993
|
+
} else if (recursive && typeof object === "object") {
|
|
994
|
+
for (const key in object) {
|
|
995
|
+
getTransferList2(object[key], recursive, transfersSet);
|
|
996
|
+
}
|
|
997
|
+
}
|
|
998
|
+
return transfers === void 0 ? Array.from(transfersSet) : [];
|
|
999
|
+
}
|
|
1000
|
+
function isTransferable2(object) {
|
|
1001
|
+
if (!object) {
|
|
1002
|
+
return false;
|
|
1003
|
+
}
|
|
1004
|
+
if (object instanceof ArrayBuffer) {
|
|
1005
|
+
return true;
|
|
1006
|
+
}
|
|
1007
|
+
if (typeof MessagePort !== "undefined" && object instanceof MessagePort) {
|
|
1008
|
+
return true;
|
|
1009
|
+
}
|
|
1010
|
+
if (typeof ImageBitmap !== "undefined" && object instanceof ImageBitmap) {
|
|
1011
|
+
return true;
|
|
1012
|
+
}
|
|
1013
|
+
if (typeof OffscreenCanvas !== "undefined" && object instanceof OffscreenCanvas) {
|
|
1014
|
+
return true;
|
|
1015
|
+
}
|
|
1016
|
+
return false;
|
|
1017
|
+
}
|
|
1018
|
+
var init_get_transfer_list2 = __esm({
|
|
1019
|
+
"../core/src/worker-utils/lib/worker-utils/get-transfer-list.ts"() {
|
|
1020
|
+
"use strict";
|
|
1021
|
+
}
|
|
1022
|
+
});
|
|
1023
|
+
|
|
1024
|
+
// ../core/src/worker-utils/lib/worker-api/create-worker.ts
|
|
1025
|
+
async function createWorker2(process2, processInBatches) {
|
|
1026
|
+
if (!await isWorkerThread()) return;
|
|
1027
|
+
await initializeTaskWorker2(createWorkerTask(process2, processInBatches));
|
|
1028
|
+
}
|
|
1029
|
+
function createWorkerTask(process2, processInBatches) {
|
|
1030
|
+
return {
|
|
1031
|
+
id: "loaders.gl",
|
|
1032
|
+
initialize: (state) => state,
|
|
1033
|
+
destroy: (state) => state.port?.close(),
|
|
1034
|
+
process: async ({ value }, options, context) => {
|
|
1035
|
+
if (!process2) throw new Error("Worker does not support atomic processing");
|
|
1036
|
+
return { value: await process2(value, options, createContext(context), context.state.context) };
|
|
1037
|
+
},
|
|
1038
|
+
...processInBatches ? {
|
|
1039
|
+
processInBatches: async function* (inputs, options, context) {
|
|
1040
|
+
async function* values() {
|
|
1041
|
+
for await (const input of inputs) yield input.value;
|
|
1042
|
+
}
|
|
1043
|
+
for await (const value of processInBatches(
|
|
1044
|
+
values(),
|
|
1045
|
+
options,
|
|
1046
|
+
createContext(context),
|
|
1047
|
+
context.state.context
|
|
1048
|
+
)) {
|
|
1049
|
+
yield { value };
|
|
1050
|
+
}
|
|
1051
|
+
}
|
|
1052
|
+
} : {}
|
|
1053
|
+
};
|
|
1054
|
+
}
|
|
1055
|
+
function createContext(context) {
|
|
1056
|
+
let requestIdentifier = 0;
|
|
1057
|
+
const port = context.state.port;
|
|
1058
|
+
return {
|
|
1059
|
+
signal: context.signal,
|
|
1060
|
+
throwIfAborted: () => context.throwIfAborted(),
|
|
1061
|
+
reportProgress: (progress) => context.reportProgress(normalizeTaskProgress(progress)),
|
|
1062
|
+
process: port ? (input, options = {}, jobContext = {}) => {
|
|
1063
|
+
context.throwIfAborted();
|
|
1064
|
+
const identifier = ++requestIdentifier;
|
|
1065
|
+
return new Promise((resolve, reject) => {
|
|
1066
|
+
const onMessage = (event) => {
|
|
1067
|
+
if (event.data.identifier !== identifier) return;
|
|
1068
|
+
cleanup();
|
|
1069
|
+
if (event.data.error) {
|
|
1070
|
+
const error = new Error(event.data.error.message);
|
|
1071
|
+
error.name = event.data.error.name;
|
|
1072
|
+
reject(error);
|
|
1073
|
+
} else resolve(event.data.value);
|
|
1074
|
+
};
|
|
1075
|
+
const onAbort = () => {
|
|
1076
|
+
cleanup();
|
|
1077
|
+
reject(context.signal.reason);
|
|
1078
|
+
};
|
|
1079
|
+
const cleanup = () => {
|
|
1080
|
+
port.removeEventListener("message", onMessage);
|
|
1081
|
+
context.signal.removeEventListener("abort", onAbort);
|
|
1082
|
+
};
|
|
1083
|
+
port.addEventListener("message", onMessage);
|
|
1084
|
+
context.signal.addEventListener("abort", onAbort, { once: true });
|
|
1085
|
+
port.start();
|
|
1086
|
+
try {
|
|
1087
|
+
const request = { identifier, input, options, context: jobContext };
|
|
1088
|
+
port.postMessage(request, getTransferList2(request));
|
|
1089
|
+
} catch (error) {
|
|
1090
|
+
cleanup();
|
|
1091
|
+
reject(error);
|
|
1092
|
+
}
|
|
1093
|
+
});
|
|
1094
|
+
} : void 0
|
|
1095
|
+
};
|
|
1096
|
+
}
|
|
1097
|
+
var init_create_worker2 = __esm({
|
|
1098
|
+
"../core/src/worker-utils/lib/worker-api/create-worker.ts"() {
|
|
1099
|
+
"use strict";
|
|
1100
|
+
init_task_runtime2();
|
|
1101
|
+
init_get_transfer_list2();
|
|
1102
|
+
}
|
|
1103
|
+
});
|
|
1104
|
+
|
|
1105
|
+
// ../core/src/worker-utils/index.ts
|
|
1106
|
+
var init_worker_utils2 = __esm({
|
|
396
1107
|
"../core/src/worker-utils/index.ts"() {
|
|
397
1108
|
"use strict";
|
|
398
|
-
|
|
1109
|
+
init_create_worker2();
|
|
399
1110
|
}
|
|
400
1111
|
});
|
|
401
1112
|
|
|
402
1113
|
// ../core/src/loader-utils/lib/worker-loader-utils/create-loader-worker.ts
|
|
403
1114
|
async function createLoaderWorker(loader, selectLoader = () => loader) {
|
|
404
|
-
await
|
|
1115
|
+
await createWorker2(
|
|
405
1116
|
(input, options, workerContext, loaderContext) => processLoaderWorkerData(
|
|
406
1117
|
selectLoader(options || {}),
|
|
407
1118
|
input,
|
|
@@ -539,7 +1250,7 @@
|
|
|
539
1250
|
var init_create_loader_worker = __esm({
|
|
540
1251
|
"../core/src/loader-utils/lib/worker-loader-utils/create-loader-worker.ts"() {
|
|
541
1252
|
"use strict";
|
|
542
|
-
|
|
1253
|
+
init_worker_utils2();
|
|
543
1254
|
}
|
|
544
1255
|
});
|
|
545
1256
|
|
|
@@ -822,277 +1533,6 @@
|
|
|
822
1533
|
}
|
|
823
1534
|
});
|
|
824
1535
|
|
|
825
|
-
// src/shapefile/lib/streaming/binary-chunk-reader.ts
|
|
826
|
-
var init_binary_chunk_reader2 = __esm({
|
|
827
|
-
"src/shapefile/lib/streaming/binary-chunk-reader.ts"() {
|
|
828
|
-
"use strict";
|
|
829
|
-
init_loader_utils();
|
|
830
|
-
}
|
|
831
|
-
});
|
|
832
|
-
|
|
833
|
-
// src/shapefile/lib/parsers/parse-dbf.ts
|
|
834
|
-
function parseDBF(arrayBuffer, options = {}) {
|
|
835
|
-
const dbfParser = new DBFParser({
|
|
836
|
-
...options,
|
|
837
|
-
dbf: {
|
|
838
|
-
...options.dbf,
|
|
839
|
-
batchSize: void 0
|
|
840
|
-
}
|
|
841
|
-
});
|
|
842
|
-
dbfParser.write(arrayBuffer);
|
|
843
|
-
dbfParser.end();
|
|
844
|
-
const { data, schema } = dbfParser.result;
|
|
845
|
-
const shape = options?.dbf?.shape;
|
|
846
|
-
switch (shape) {
|
|
847
|
-
case "object-row-table": {
|
|
848
|
-
const table = {
|
|
849
|
-
shape: "object-row-table",
|
|
850
|
-
schema,
|
|
851
|
-
data
|
|
852
|
-
};
|
|
853
|
-
return table;
|
|
854
|
-
}
|
|
855
|
-
case "table":
|
|
856
|
-
return { schema, rows: data };
|
|
857
|
-
case "rows":
|
|
858
|
-
default:
|
|
859
|
-
return data;
|
|
860
|
-
}
|
|
861
|
-
}
|
|
862
|
-
async function* parseDBFInBatches(asyncIterator, options = {}) {
|
|
863
|
-
const parser = new DBFParser(options);
|
|
864
|
-
let headerReturned = false;
|
|
865
|
-
for await (const arrayBuffer of toArrayBufferIterator(asyncIterator)) {
|
|
866
|
-
parser.write(arrayBuffer);
|
|
867
|
-
if (!headerReturned && parser.result.dbfHeader) {
|
|
868
|
-
headerReturned = true;
|
|
869
|
-
yield parser.result.dbfHeader;
|
|
870
|
-
}
|
|
871
|
-
if (parser.result.data.length > 0) {
|
|
872
|
-
yield parser.result.data;
|
|
873
|
-
parser.result.data = [];
|
|
874
|
-
}
|
|
875
|
-
}
|
|
876
|
-
parser.end();
|
|
877
|
-
if (parser.result.data.length > 0) {
|
|
878
|
-
yield parser.result.data;
|
|
879
|
-
}
|
|
880
|
-
}
|
|
881
|
-
function parseState(state, result, binaryReader, textDecoder, options) {
|
|
882
|
-
while (true) {
|
|
883
|
-
try {
|
|
884
|
-
switch (state) {
|
|
885
|
-
case 4 /* ERROR */:
|
|
886
|
-
case 3 /* END */:
|
|
887
|
-
return state;
|
|
888
|
-
case 0 /* START */:
|
|
889
|
-
const dataView = binaryReader.getDataView(DBF_HEADER_SIZE);
|
|
890
|
-
if (!dataView) {
|
|
891
|
-
return state;
|
|
892
|
-
}
|
|
893
|
-
result.dbfHeader = parseDBFHeader(dataView);
|
|
894
|
-
result.progress = {
|
|
895
|
-
bytesUsed: 0,
|
|
896
|
-
rowsTotal: result.dbfHeader.nRecords,
|
|
897
|
-
rows: 0
|
|
898
|
-
};
|
|
899
|
-
state = 1 /* FIELD_DESCRIPTORS */;
|
|
900
|
-
break;
|
|
901
|
-
case 1 /* FIELD_DESCRIPTORS */:
|
|
902
|
-
const fieldDescriptorView = binaryReader.getDataView(
|
|
903
|
-
// @ts-ignore
|
|
904
|
-
result.dbfHeader.headerLength - DBF_HEADER_SIZE
|
|
905
|
-
);
|
|
906
|
-
if (!fieldDescriptorView) {
|
|
907
|
-
return state;
|
|
908
|
-
}
|
|
909
|
-
result.dbfFields = parseFieldDescriptors(fieldDescriptorView, textDecoder);
|
|
910
|
-
result.schema = {
|
|
911
|
-
fields: result.dbfFields.map((dbfField) => makeField(dbfField)),
|
|
912
|
-
metadata: {}
|
|
913
|
-
};
|
|
914
|
-
state = 2 /* FIELD_PROPERTIES */;
|
|
915
|
-
binaryReader.skip(1);
|
|
916
|
-
break;
|
|
917
|
-
case 2 /* FIELD_PROPERTIES */:
|
|
918
|
-
const { recordLength = 0, nRecords = 0 } = result?.dbfHeader || {};
|
|
919
|
-
while ((result.progress?.rows || 0) < nRecords) {
|
|
920
|
-
const batchSize = options.dbf?.batchSize || Number.POSITIVE_INFINITY;
|
|
921
|
-
if (result.data.length >= batchSize) {
|
|
922
|
-
return state;
|
|
923
|
-
}
|
|
924
|
-
const recordView = binaryReader.getDataView(recordLength - 1);
|
|
925
|
-
if (!recordView) {
|
|
926
|
-
return state;
|
|
927
|
-
}
|
|
928
|
-
binaryReader.skip(1);
|
|
929
|
-
const row = parseRow(recordView, result.dbfFields, textDecoder);
|
|
930
|
-
result.data.push(row);
|
|
931
|
-
result.progress.rows++;
|
|
932
|
-
}
|
|
933
|
-
state = 3 /* END */;
|
|
934
|
-
break;
|
|
935
|
-
default:
|
|
936
|
-
state = 4 /* ERROR */;
|
|
937
|
-
result.error = `illegal parser state ${state}`;
|
|
938
|
-
return state;
|
|
939
|
-
}
|
|
940
|
-
} catch (error) {
|
|
941
|
-
state = 4 /* ERROR */;
|
|
942
|
-
result.error = `DBF parsing failed: ${error.message}`;
|
|
943
|
-
return state;
|
|
944
|
-
}
|
|
945
|
-
}
|
|
946
|
-
}
|
|
947
|
-
function parseDBFHeader(headerView) {
|
|
948
|
-
return {
|
|
949
|
-
// Last updated date
|
|
950
|
-
year: headerView.getUint8(1) + 1900,
|
|
951
|
-
month: headerView.getUint8(2),
|
|
952
|
-
day: headerView.getUint8(3),
|
|
953
|
-
// Number of records in data file
|
|
954
|
-
nRecords: headerView.getUint32(4, LITTLE_ENDIAN),
|
|
955
|
-
// Length of header in bytes
|
|
956
|
-
headerLength: headerView.getUint16(8, LITTLE_ENDIAN),
|
|
957
|
-
// Length of each record
|
|
958
|
-
recordLength: headerView.getUint16(10, LITTLE_ENDIAN),
|
|
959
|
-
// Not sure if this is usually set
|
|
960
|
-
languageDriver: headerView.getUint8(29)
|
|
961
|
-
};
|
|
962
|
-
}
|
|
963
|
-
function parseFieldDescriptors(view, textDecoder) {
|
|
964
|
-
const nFields = (view.byteLength - 1) / 32;
|
|
965
|
-
const fields = [];
|
|
966
|
-
let offset = 0;
|
|
967
|
-
for (let i = 0; i < nFields; i++) {
|
|
968
|
-
const name = textDecoder.decode(new Uint8Array(view.buffer, view.byteOffset + offset, 11)).replace(/\u0000/g, "");
|
|
969
|
-
fields.push({
|
|
970
|
-
name,
|
|
971
|
-
dataType: String.fromCharCode(view.getUint8(offset + 11)),
|
|
972
|
-
fieldLength: view.getUint8(offset + 16),
|
|
973
|
-
decimal: view.getUint8(offset + 17)
|
|
974
|
-
});
|
|
975
|
-
offset += 32;
|
|
976
|
-
}
|
|
977
|
-
return fields;
|
|
978
|
-
}
|
|
979
|
-
function parseRow(view, fields, textDecoder) {
|
|
980
|
-
const out = {};
|
|
981
|
-
let offset = 0;
|
|
982
|
-
for (const field of fields) {
|
|
983
|
-
const text = textDecoder.decode(
|
|
984
|
-
new Uint8Array(view.buffer, view.byteOffset + offset, field.fieldLength)
|
|
985
|
-
);
|
|
986
|
-
out[field.name] = parseField(text, field.dataType);
|
|
987
|
-
offset += field.fieldLength;
|
|
988
|
-
}
|
|
989
|
-
return out;
|
|
990
|
-
}
|
|
991
|
-
function parseField(text, dataType) {
|
|
992
|
-
switch (dataType) {
|
|
993
|
-
case "B":
|
|
994
|
-
return parseNumber(text);
|
|
995
|
-
case "C":
|
|
996
|
-
return parseCharacter(text);
|
|
997
|
-
case "F":
|
|
998
|
-
return parseNumber(text);
|
|
999
|
-
case "N":
|
|
1000
|
-
return parseNumber(text);
|
|
1001
|
-
case "O":
|
|
1002
|
-
return parseNumber(text);
|
|
1003
|
-
case "D":
|
|
1004
|
-
return parseDate(text);
|
|
1005
|
-
case "L":
|
|
1006
|
-
return parseBoolean(text);
|
|
1007
|
-
default:
|
|
1008
|
-
throw new Error("Unsupported data type");
|
|
1009
|
-
}
|
|
1010
|
-
}
|
|
1011
|
-
function parseDate(str) {
|
|
1012
|
-
return Date.UTC(str.slice(0, 4), parseInt(str.slice(4, 6), 10) - 1, str.slice(6, 8));
|
|
1013
|
-
}
|
|
1014
|
-
function parseBoolean(value) {
|
|
1015
|
-
return /^[nf]$/i.test(value) ? false : /^[yt]$/i.test(value) ? true : null;
|
|
1016
|
-
}
|
|
1017
|
-
function parseNumber(text) {
|
|
1018
|
-
const number = parseFloat(text);
|
|
1019
|
-
return Number.isNaN(number) ? null : number;
|
|
1020
|
-
}
|
|
1021
|
-
function parseCharacter(text) {
|
|
1022
|
-
return text.trim() || null;
|
|
1023
|
-
}
|
|
1024
|
-
function makeField({ name, dataType, fieldLength, decimal }) {
|
|
1025
|
-
switch (dataType) {
|
|
1026
|
-
case "B":
|
|
1027
|
-
return { name, type: "float64", nullable: true, metadata: {} };
|
|
1028
|
-
case "C":
|
|
1029
|
-
return { name, type: "utf8", nullable: true, metadata: {} };
|
|
1030
|
-
case "F":
|
|
1031
|
-
return { name, type: "float64", nullable: true, metadata: {} };
|
|
1032
|
-
case "N":
|
|
1033
|
-
return { name, type: "float64", nullable: true, metadata: {} };
|
|
1034
|
-
case "O":
|
|
1035
|
-
return { name, type: "float64", nullable: true, metadata: {} };
|
|
1036
|
-
case "D":
|
|
1037
|
-
return { name, type: "timestamp-millisecond", nullable: true, metadata: {} };
|
|
1038
|
-
case "L":
|
|
1039
|
-
return { name, type: "bool", nullable: true, metadata: {} };
|
|
1040
|
-
default:
|
|
1041
|
-
throw new Error("Unsupported data type");
|
|
1042
|
-
}
|
|
1043
|
-
}
|
|
1044
|
-
var LITTLE_ENDIAN, DBF_HEADER_SIZE, DBFParser;
|
|
1045
|
-
var init_parse_dbf = __esm({
|
|
1046
|
-
"src/shapefile/lib/parsers/parse-dbf.ts"() {
|
|
1047
|
-
"use strict";
|
|
1048
|
-
init_loader_utils();
|
|
1049
|
-
init_binary_chunk_reader2();
|
|
1050
|
-
LITTLE_ENDIAN = true;
|
|
1051
|
-
DBF_HEADER_SIZE = 32;
|
|
1052
|
-
DBFParser = class {
|
|
1053
|
-
binaryReader = new BinaryChunkReader();
|
|
1054
|
-
textDecoder;
|
|
1055
|
-
options;
|
|
1056
|
-
state = 0 /* START */;
|
|
1057
|
-
result = {
|
|
1058
|
-
data: []
|
|
1059
|
-
};
|
|
1060
|
-
constructor(options) {
|
|
1061
|
-
const { encoding = "latin1" } = options.dbf || {};
|
|
1062
|
-
this.options = options;
|
|
1063
|
-
this.textDecoder = new TextDecoder(encoding);
|
|
1064
|
-
}
|
|
1065
|
-
/**
|
|
1066
|
-
* @param arrayBuffer
|
|
1067
|
-
*/
|
|
1068
|
-
write(arrayBuffer) {
|
|
1069
|
-
this.binaryReader.write(arrayBuffer);
|
|
1070
|
-
this.state = parseState(
|
|
1071
|
-
this.state,
|
|
1072
|
-
this.result,
|
|
1073
|
-
this.binaryReader,
|
|
1074
|
-
this.textDecoder,
|
|
1075
|
-
this.options
|
|
1076
|
-
);
|
|
1077
|
-
}
|
|
1078
|
-
end() {
|
|
1079
|
-
this.binaryReader.end();
|
|
1080
|
-
this.state = parseState(
|
|
1081
|
-
this.state,
|
|
1082
|
-
this.result,
|
|
1083
|
-
this.binaryReader,
|
|
1084
|
-
this.textDecoder,
|
|
1085
|
-
this.options
|
|
1086
|
-
);
|
|
1087
|
-
if (this.state !== 3 /* END */) {
|
|
1088
|
-
this.state = 4 /* ERROR */;
|
|
1089
|
-
this.result.error = "DBF incomplete file";
|
|
1090
|
-
}
|
|
1091
|
-
}
|
|
1092
|
-
};
|
|
1093
|
-
}
|
|
1094
|
-
});
|
|
1095
|
-
|
|
1096
1536
|
// ../../node_modules/tslib/tslib.es6.mjs
|
|
1097
1537
|
function __rest(s, e) {
|
|
1098
1538
|
var t = {};
|
|
@@ -8743,11 +9183,11 @@ return true;`);
|
|
|
8743
9183
|
this._offsets = new OffsetsBufferBuilder(opts.type);
|
|
8744
9184
|
}
|
|
8745
9185
|
setValue(index, value) {
|
|
8746
|
-
const
|
|
8747
|
-
const current =
|
|
9186
|
+
const pending2 = this._pending || (this._pending = /* @__PURE__ */ new Map());
|
|
9187
|
+
const current = pending2.get(index);
|
|
8748
9188
|
current && (this._pendingLength -= current.length);
|
|
8749
9189
|
this._pendingLength += value instanceof MapRow ? value[kKeys].length : value.length;
|
|
8750
|
-
|
|
9190
|
+
pending2.set(index, value);
|
|
8751
9191
|
}
|
|
8752
9192
|
setValid(index, isValid) {
|
|
8753
9193
|
if (!super.setValid(index, isValid)) {
|
|
@@ -8770,12 +9210,12 @@ return true;`);
|
|
|
8770
9210
|
return super.finish();
|
|
8771
9211
|
}
|
|
8772
9212
|
_flush() {
|
|
8773
|
-
const
|
|
9213
|
+
const pending2 = this._pending;
|
|
8774
9214
|
const pendingLength = this._pendingLength;
|
|
8775
9215
|
this._pendingLength = 0;
|
|
8776
9216
|
this._pending = void 0;
|
|
8777
|
-
if (
|
|
8778
|
-
this._flushPending(
|
|
9217
|
+
if (pending2 && pending2.size > 0) {
|
|
9218
|
+
this._flushPending(pending2, pendingLength);
|
|
8779
9219
|
}
|
|
8780
9220
|
return this;
|
|
8781
9221
|
}
|
|
@@ -11361,11 +11801,11 @@ return true;`);
|
|
|
11361
11801
|
setValue(index, value) {
|
|
11362
11802
|
return super.setValue(index, toUint8Array(value));
|
|
11363
11803
|
}
|
|
11364
|
-
_flushPending(
|
|
11804
|
+
_flushPending(pending2, pendingLength) {
|
|
11365
11805
|
const offsets = this._offsets;
|
|
11366
11806
|
const data = this._values.reserve(pendingLength).buffer;
|
|
11367
11807
|
let offset = 0;
|
|
11368
|
-
for (const [index, value] of
|
|
11808
|
+
for (const [index, value] of pending2) {
|
|
11369
11809
|
if (value === void 0) {
|
|
11370
11810
|
offsets.set(index, 0);
|
|
11371
11811
|
} else {
|
|
@@ -11402,11 +11842,11 @@ return true;`);
|
|
|
11402
11842
|
setValue(index, value) {
|
|
11403
11843
|
return super.setValue(index, toUint8Array(value));
|
|
11404
11844
|
}
|
|
11405
|
-
_flushPending(
|
|
11845
|
+
_flushPending(pending2, pendingLength) {
|
|
11406
11846
|
const offsets = this._offsets;
|
|
11407
11847
|
const data = this._values.reserve(pendingLength).buffer;
|
|
11408
11848
|
let offset = 0;
|
|
11409
|
-
for (const [index, value] of
|
|
11849
|
+
for (const [index, value] of pending2) {
|
|
11410
11850
|
if (value === void 0) {
|
|
11411
11851
|
offsets.set(index, BigInt(0));
|
|
11412
11852
|
} else {
|
|
@@ -11717,10 +12157,10 @@ return true;`);
|
|
|
11717
12157
|
this.type = new List2(new Field2(name, child.type, true));
|
|
11718
12158
|
return this.numChildren - 1;
|
|
11719
12159
|
}
|
|
11720
|
-
_flushPending(
|
|
12160
|
+
_flushPending(pending2) {
|
|
11721
12161
|
const offsets = this._offsets;
|
|
11722
12162
|
const [child] = this.children;
|
|
11723
|
-
for (const [index, value] of
|
|
12163
|
+
for (const [index, value] of pending2) {
|
|
11724
12164
|
if (typeof value === "undefined") {
|
|
11725
12165
|
offsets.set(index, 0);
|
|
11726
12166
|
} else {
|
|
@@ -11759,10 +12199,10 @@ return true;`);
|
|
|
11759
12199
|
this.type = new LargeList2(new Field2(name, child.type, true));
|
|
11760
12200
|
return this.numChildren - 1;
|
|
11761
12201
|
}
|
|
11762
|
-
_flushPending(
|
|
12202
|
+
_flushPending(pending2) {
|
|
11763
12203
|
const offsets = this._offsets;
|
|
11764
12204
|
const [child] = this.children;
|
|
11765
|
-
for (const [index, value] of
|
|
12205
|
+
for (const [index, value] of pending2) {
|
|
11766
12206
|
if (typeof value === "undefined") {
|
|
11767
12207
|
offsets.set(index, BigInt(0));
|
|
11768
12208
|
} else {
|
|
@@ -11792,11 +12232,11 @@ return true;`);
|
|
|
11792
12232
|
}
|
|
11793
12233
|
setValue(index, value) {
|
|
11794
12234
|
const row = value instanceof Map ? value : new Map(Object.entries(value));
|
|
11795
|
-
const
|
|
11796
|
-
const current =
|
|
12235
|
+
const pending2 = this._pending || (this._pending = /* @__PURE__ */ new Map());
|
|
12236
|
+
const current = pending2.get(index);
|
|
11797
12237
|
current && (this._pendingLength -= current.size);
|
|
11798
12238
|
this._pendingLength += row.size;
|
|
11799
|
-
|
|
12239
|
+
pending2.set(index, row);
|
|
11800
12240
|
}
|
|
11801
12241
|
addChild(child, name = `${this.numChildren}`) {
|
|
11802
12242
|
if (this.numChildren > 0) {
|
|
@@ -11806,10 +12246,10 @@ return true;`);
|
|
|
11806
12246
|
this.type = new Map_(new Field2(name, child.type, true), this.type.keysSorted);
|
|
11807
12247
|
return this.numChildren - 1;
|
|
11808
12248
|
}
|
|
11809
|
-
_flushPending(
|
|
12249
|
+
_flushPending(pending2) {
|
|
11810
12250
|
const offsets = this._offsets;
|
|
11811
12251
|
const [child] = this.children;
|
|
11812
|
-
for (const [index, value] of
|
|
12252
|
+
for (const [index, value] of pending2) {
|
|
11813
12253
|
if (value === void 0) {
|
|
11814
12254
|
offsets.set(index, 0);
|
|
11815
12255
|
} else {
|
|
@@ -12018,7 +12458,7 @@ return true;`);
|
|
|
12018
12458
|
return super.setValue(index, encodeUtf8(value));
|
|
12019
12459
|
}
|
|
12020
12460
|
// @ts-ignore
|
|
12021
|
-
_flushPending(
|
|
12461
|
+
_flushPending(pending2, pendingLength) {
|
|
12022
12462
|
}
|
|
12023
12463
|
};
|
|
12024
12464
|
Utf8Builder.prototype._flushPending = BinaryBuilder.prototype._flushPending;
|
|
@@ -12049,7 +12489,7 @@ return true;`);
|
|
|
12049
12489
|
return super.setValue(index, encodeUtf8(value));
|
|
12050
12490
|
}
|
|
12051
12491
|
// @ts-ignore
|
|
12052
|
-
_flushPending(
|
|
12492
|
+
_flushPending(pending2, pendingLength) {
|
|
12053
12493
|
}
|
|
12054
12494
|
};
|
|
12055
12495
|
LargeUtf8Builder.prototype._flushPending = LargeBinaryBuilder.prototype._flushPending;
|
|
@@ -16337,213 +16777,467 @@ return true;`);
|
|
|
16337
16777
|
case "interval-yearmonth":
|
|
16338
16778
|
return new IntervalYearMonth();
|
|
16339
16779
|
default:
|
|
16340
|
-
throw new Error("array type not supported");
|
|
16780
|
+
throw new Error("array type not supported");
|
|
16781
|
+
}
|
|
16782
|
+
}
|
|
16783
|
+
function getOptionalArrowConstructor(typeName) {
|
|
16784
|
+
return Arrow_dom_exports[typeName];
|
|
16785
|
+
}
|
|
16786
|
+
function isArrowViewType(arrowType, viewTypeName) {
|
|
16787
|
+
const constructor = getOptionalArrowConstructor(viewTypeName);
|
|
16788
|
+
if (constructor && arrowType instanceof constructor) {
|
|
16789
|
+
return true;
|
|
16790
|
+
}
|
|
16791
|
+
const guards = DataType;
|
|
16792
|
+
const guard = viewTypeName === "BinaryView" ? guards.isBinaryView : guards.isUtf8View;
|
|
16793
|
+
return Boolean(guard?.(arrowType));
|
|
16794
|
+
}
|
|
16795
|
+
function isOptionalArrowType(arrowType, typeName) {
|
|
16796
|
+
const constructor = getOptionalArrowConstructor(typeName);
|
|
16797
|
+
return Boolean(constructor && arrowType instanceof constructor);
|
|
16798
|
+
}
|
|
16799
|
+
function makeVariableWidthArrowType(viewTypeName, fallbackType, options) {
|
|
16800
|
+
const viewTypeMode = options?.viewTypes || "never";
|
|
16801
|
+
if (viewTypeMode === "never") {
|
|
16802
|
+
return fallbackType;
|
|
16803
|
+
}
|
|
16804
|
+
const constructor = getOptionalArrowConstructor(viewTypeName);
|
|
16805
|
+
if (constructor) {
|
|
16806
|
+
return new constructor();
|
|
16807
|
+
}
|
|
16808
|
+
if (viewTypeMode === "require") {
|
|
16809
|
+
throw new Error(
|
|
16810
|
+
`${viewTypeName} requires apache-arrow 21.2.0 or later; the installed runtime does not support it`
|
|
16811
|
+
);
|
|
16812
|
+
}
|
|
16813
|
+
return fallbackType;
|
|
16814
|
+
}
|
|
16815
|
+
function makeRequiredArrowViewType(viewTypeName) {
|
|
16816
|
+
const constructor = getOptionalArrowConstructor(viewTypeName);
|
|
16817
|
+
if (!constructor) {
|
|
16818
|
+
throw new Error(
|
|
16819
|
+
`${viewTypeName} requires apache-arrow 21.2.0 or later; the installed runtime does not support it`
|
|
16820
|
+
);
|
|
16821
|
+
}
|
|
16822
|
+
return new constructor();
|
|
16823
|
+
}
|
|
16824
|
+
function serializeArrowDictionaryKeyType(arrowType) {
|
|
16825
|
+
if (arrowType instanceof Int_) {
|
|
16826
|
+
const prefix = arrowType.isSigned ? "int" : "uint";
|
|
16827
|
+
const keyType = `${prefix}${arrowType.bitWidth}`;
|
|
16828
|
+
if (isSchemaDictionaryKeyType(keyType)) {
|
|
16829
|
+
return keyType;
|
|
16830
|
+
}
|
|
16831
|
+
}
|
|
16832
|
+
switch (arrowType.constructor) {
|
|
16833
|
+
case Int8:
|
|
16834
|
+
return "int8";
|
|
16835
|
+
case Int16:
|
|
16836
|
+
return "int16";
|
|
16837
|
+
case Int32:
|
|
16838
|
+
return "int32";
|
|
16839
|
+
case Uint8:
|
|
16840
|
+
return "uint8";
|
|
16841
|
+
case Uint16:
|
|
16842
|
+
return "uint16";
|
|
16843
|
+
case Uint32:
|
|
16844
|
+
return "uint32";
|
|
16845
|
+
default:
|
|
16846
|
+
throw new Error(`arrow dictionary index type not supported: ${arrowType.constructor.name}`);
|
|
16847
|
+
}
|
|
16848
|
+
}
|
|
16849
|
+
function isSchemaDictionaryKeyType(keyType) {
|
|
16850
|
+
return ["int8", "int16", "int32", "uint8", "uint16", "uint32"].includes(keyType);
|
|
16851
|
+
}
|
|
16852
|
+
function deserializeArrowDictionaryKeyType(keyType) {
|
|
16853
|
+
switch (keyType) {
|
|
16854
|
+
case "int8":
|
|
16855
|
+
return new Int8();
|
|
16856
|
+
case "int16":
|
|
16857
|
+
return new Int16();
|
|
16858
|
+
case "int32":
|
|
16859
|
+
return new Int32();
|
|
16860
|
+
case "uint8":
|
|
16861
|
+
return new Uint8();
|
|
16862
|
+
case "uint16":
|
|
16863
|
+
return new Uint16();
|
|
16864
|
+
case "uint32":
|
|
16865
|
+
return new Uint32();
|
|
16866
|
+
default:
|
|
16867
|
+
throw new Error(`schema dictionary index type not supported: ${keyType}`);
|
|
16868
|
+
}
|
|
16869
|
+
}
|
|
16870
|
+
var init_convert_arrow_schema = __esm({
|
|
16871
|
+
"../core/src/schema-utils/lib/schema/convert-arrow-schema.ts"() {
|
|
16872
|
+
"use strict";
|
|
16873
|
+
init_Arrow_dom();
|
|
16874
|
+
}
|
|
16875
|
+
});
|
|
16876
|
+
|
|
16877
|
+
// ../core/src/schema-utils/lib/arrow/arrow-metadata.ts
|
|
16878
|
+
function snapshotArrowSchema(schema) {
|
|
16879
|
+
return deserializeArrowSchema(serializeArrowSchema(schema));
|
|
16880
|
+
}
|
|
16881
|
+
var init_arrow_metadata = __esm({
|
|
16882
|
+
"../core/src/schema-utils/lib/arrow/arrow-metadata.ts"() {
|
|
16883
|
+
"use strict";
|
|
16884
|
+
init_convert_arrow_schema();
|
|
16885
|
+
}
|
|
16886
|
+
});
|
|
16887
|
+
|
|
16888
|
+
// ../core/src/schema-utils/lib/table/batch-builder/arrow-table-builder.ts
|
|
16889
|
+
var ArrowTableBuilder;
|
|
16890
|
+
var init_arrow_table_builder = __esm({
|
|
16891
|
+
"../core/src/schema-utils/lib/table/batch-builder/arrow-table-builder.ts"() {
|
|
16892
|
+
"use strict";
|
|
16893
|
+
init_arrow_metadata();
|
|
16894
|
+
init_Arrow_dom();
|
|
16895
|
+
init_convert_arrow_schema();
|
|
16896
|
+
ArrowTableBuilder = class {
|
|
16897
|
+
schema;
|
|
16898
|
+
arrowSchema;
|
|
16899
|
+
arrowBuilders;
|
|
16900
|
+
length;
|
|
16901
|
+
constructor(schema, options) {
|
|
16902
|
+
this.arrowSchema = convertSchemaToArrow(schema, options);
|
|
16903
|
+
this.schema = options?.viewTypes && options.viewTypes !== "never" ? convertArrowToSchema(this.arrowSchema) : schema;
|
|
16904
|
+
this.arrowBuilders = this.arrowSchema.fields.map(
|
|
16905
|
+
(field) => makeBuilder({ type: field.type, nullValues: [null, void 0] })
|
|
16906
|
+
);
|
|
16907
|
+
this.length = 0;
|
|
16908
|
+
}
|
|
16909
|
+
addObjectRow(row) {
|
|
16910
|
+
for (let i = 0; i < this.arrowBuilders.length; i++) {
|
|
16911
|
+
const columnName = this.schema.fields[i].name;
|
|
16912
|
+
const value = row[columnName];
|
|
16913
|
+
this.arrowBuilders[i].append(value);
|
|
16914
|
+
}
|
|
16915
|
+
this.length++;
|
|
16916
|
+
}
|
|
16917
|
+
addArrayRow(row) {
|
|
16918
|
+
for (let i = 0; i < this.arrowBuilders.length; i++) {
|
|
16919
|
+
this.arrowBuilders[i].append(row[i]);
|
|
16920
|
+
}
|
|
16921
|
+
this.length++;
|
|
16922
|
+
}
|
|
16923
|
+
/** Emits the declared schema before any rows are buffered. */
|
|
16924
|
+
firstBatch() {
|
|
16925
|
+
return this.length === 0 ? this._getArrowRecordBatch() : null;
|
|
16926
|
+
}
|
|
16927
|
+
/** Flushes the buffered rows as a native record batch. */
|
|
16928
|
+
flushBatch() {
|
|
16929
|
+
return this.length === 0 ? null : this._getArrowRecordBatch();
|
|
16930
|
+
}
|
|
16931
|
+
/** Finishes the builders and returns the final native batch when it has rows or fields. */
|
|
16932
|
+
finishBatch() {
|
|
16933
|
+
const batch = this._getArrowRecordBatch();
|
|
16934
|
+
this.arrowBuilders.forEach((builder) => builder.finish());
|
|
16935
|
+
return batch.numCols || batch.numRows ? batch : null;
|
|
16936
|
+
}
|
|
16937
|
+
/** Finishes the builders and returns a native Arrow table. */
|
|
16938
|
+
finishTable() {
|
|
16939
|
+
const batch = this._getArrowRecordBatch();
|
|
16940
|
+
this.arrowBuilders.forEach((builder) => builder.finish());
|
|
16941
|
+
return new Table(batch);
|
|
16942
|
+
}
|
|
16943
|
+
/** Extract a record batch flushing the currently accumulated data in the builders */
|
|
16944
|
+
_getArrowRecordBatch() {
|
|
16945
|
+
const { arrowBuilders, arrowSchema } = this;
|
|
16946
|
+
const arrowDatas = arrowBuilders.map((builder) => builder.flush());
|
|
16947
|
+
const length = arrowDatas[0]?.length || this.length;
|
|
16948
|
+
this.length = 0;
|
|
16949
|
+
const structField = new Struct(arrowSchema.fields);
|
|
16950
|
+
const arrowStructData = new Data(structField, 0, length, 0, void 0, arrowDatas);
|
|
16951
|
+
const arrowRecordBatch = new RecordBatch3(
|
|
16952
|
+
snapshotArrowSchema(arrowSchema),
|
|
16953
|
+
arrowStructData
|
|
16954
|
+
);
|
|
16955
|
+
return arrowRecordBatch;
|
|
16956
|
+
}
|
|
16957
|
+
};
|
|
16958
|
+
}
|
|
16959
|
+
});
|
|
16960
|
+
|
|
16961
|
+
// ../core/src/schema-utils/index.ts
|
|
16962
|
+
var init_schema_utils = __esm({
|
|
16963
|
+
"../core/src/schema-utils/index.ts"() {
|
|
16964
|
+
"use strict";
|
|
16965
|
+
init_convert_arrow_schema();
|
|
16966
|
+
init_arrow_table_builder();
|
|
16967
|
+
}
|
|
16968
|
+
});
|
|
16969
|
+
|
|
16970
|
+
// src/shapefile/lib/streaming/binary-chunk-reader.ts
|
|
16971
|
+
var init_binary_chunk_reader2 = __esm({
|
|
16972
|
+
"src/shapefile/lib/streaming/binary-chunk-reader.ts"() {
|
|
16973
|
+
"use strict";
|
|
16974
|
+
init_loader_utils();
|
|
16975
|
+
}
|
|
16976
|
+
});
|
|
16977
|
+
|
|
16978
|
+
// src/shapefile/lib/parsers/parse-dbf.ts
|
|
16979
|
+
function parseDBF(arrayBuffer, options = {}) {
|
|
16980
|
+
const dbfParser = new DBFParser({
|
|
16981
|
+
...options,
|
|
16982
|
+
dbf: {
|
|
16983
|
+
...options.dbf,
|
|
16984
|
+
batchSize: void 0
|
|
16985
|
+
}
|
|
16986
|
+
});
|
|
16987
|
+
dbfParser.write(arrayBuffer);
|
|
16988
|
+
dbfParser.end();
|
|
16989
|
+
const { data, schema } = dbfParser.result;
|
|
16990
|
+
const shape = options?.dbf?.shape;
|
|
16991
|
+
switch (shape) {
|
|
16992
|
+
case "object-row-table": {
|
|
16993
|
+
const table = {
|
|
16994
|
+
shape: "object-row-table",
|
|
16995
|
+
schema,
|
|
16996
|
+
data
|
|
16997
|
+
};
|
|
16998
|
+
return table;
|
|
16999
|
+
}
|
|
17000
|
+
case "table":
|
|
17001
|
+
return { schema, rows: data };
|
|
17002
|
+
case "rows":
|
|
17003
|
+
default:
|
|
17004
|
+
return data;
|
|
16341
17005
|
}
|
|
16342
17006
|
}
|
|
16343
|
-
function
|
|
16344
|
-
|
|
17007
|
+
async function* parseDBFInBatches(asyncIterator, options = {}) {
|
|
17008
|
+
const parser = new DBFParser(options);
|
|
17009
|
+
let headerReturned = false;
|
|
17010
|
+
for await (const arrayBuffer of toArrayBufferIterator(asyncIterator)) {
|
|
17011
|
+
parser.write(arrayBuffer);
|
|
17012
|
+
if (!headerReturned && parser.result.dbfHeader) {
|
|
17013
|
+
headerReturned = true;
|
|
17014
|
+
yield parser.result.dbfHeader;
|
|
17015
|
+
}
|
|
17016
|
+
if (parser.result.data.length > 0) {
|
|
17017
|
+
yield parser.result.data;
|
|
17018
|
+
parser.result.data = [];
|
|
17019
|
+
}
|
|
17020
|
+
}
|
|
17021
|
+
parser.end();
|
|
17022
|
+
if (parser.result.data.length > 0) {
|
|
17023
|
+
yield parser.result.data;
|
|
17024
|
+
}
|
|
16345
17025
|
}
|
|
16346
|
-
function
|
|
16347
|
-
|
|
16348
|
-
|
|
16349
|
-
|
|
17026
|
+
function parseState(state, result, binaryReader, textDecoder, options) {
|
|
17027
|
+
while (true) {
|
|
17028
|
+
try {
|
|
17029
|
+
switch (state) {
|
|
17030
|
+
case 4 /* ERROR */:
|
|
17031
|
+
case 3 /* END */:
|
|
17032
|
+
return state;
|
|
17033
|
+
case 0 /* START */:
|
|
17034
|
+
const dataView = binaryReader.getDataView(DBF_HEADER_SIZE);
|
|
17035
|
+
if (!dataView) {
|
|
17036
|
+
return state;
|
|
17037
|
+
}
|
|
17038
|
+
result.dbfHeader = parseDBFHeader(dataView);
|
|
17039
|
+
result.progress = {
|
|
17040
|
+
bytesUsed: 0,
|
|
17041
|
+
rowsTotal: result.dbfHeader.nRecords,
|
|
17042
|
+
rows: 0
|
|
17043
|
+
};
|
|
17044
|
+
state = 1 /* FIELD_DESCRIPTORS */;
|
|
17045
|
+
break;
|
|
17046
|
+
case 1 /* FIELD_DESCRIPTORS */:
|
|
17047
|
+
const fieldDescriptorView = binaryReader.getDataView(
|
|
17048
|
+
// @ts-ignore
|
|
17049
|
+
result.dbfHeader.headerLength - DBF_HEADER_SIZE
|
|
17050
|
+
);
|
|
17051
|
+
if (!fieldDescriptorView) {
|
|
17052
|
+
return state;
|
|
17053
|
+
}
|
|
17054
|
+
result.dbfFields = parseFieldDescriptors(fieldDescriptorView, textDecoder);
|
|
17055
|
+
result.schema = {
|
|
17056
|
+
fields: result.dbfFields.map((dbfField) => makeField(dbfField)),
|
|
17057
|
+
metadata: {}
|
|
17058
|
+
};
|
|
17059
|
+
state = 2 /* FIELD_PROPERTIES */;
|
|
17060
|
+
binaryReader.skip(1);
|
|
17061
|
+
break;
|
|
17062
|
+
case 2 /* FIELD_PROPERTIES */:
|
|
17063
|
+
const { recordLength = 0, nRecords = 0 } = result?.dbfHeader || {};
|
|
17064
|
+
while ((result.progress?.rows || 0) < nRecords) {
|
|
17065
|
+
const batchSize = options.dbf?.batchSize || Number.POSITIVE_INFINITY;
|
|
17066
|
+
if (result.data.length >= batchSize) {
|
|
17067
|
+
return state;
|
|
17068
|
+
}
|
|
17069
|
+
const recordView = binaryReader.getDataView(recordLength - 1);
|
|
17070
|
+
if (!recordView) {
|
|
17071
|
+
return state;
|
|
17072
|
+
}
|
|
17073
|
+
binaryReader.skip(1);
|
|
17074
|
+
const row = parseRow(recordView, result.dbfFields, textDecoder);
|
|
17075
|
+
result.data.push(row);
|
|
17076
|
+
result.progress.rows++;
|
|
17077
|
+
}
|
|
17078
|
+
state = 3 /* END */;
|
|
17079
|
+
break;
|
|
17080
|
+
default:
|
|
17081
|
+
state = 4 /* ERROR */;
|
|
17082
|
+
result.error = `illegal parser state ${state}`;
|
|
17083
|
+
return state;
|
|
17084
|
+
}
|
|
17085
|
+
} catch (error) {
|
|
17086
|
+
state = 4 /* ERROR */;
|
|
17087
|
+
result.error = `DBF parsing failed: ${error.message}`;
|
|
17088
|
+
return state;
|
|
17089
|
+
}
|
|
16350
17090
|
}
|
|
16351
|
-
const guards = DataType;
|
|
16352
|
-
const guard = viewTypeName === "BinaryView" ? guards.isBinaryView : guards.isUtf8View;
|
|
16353
|
-
return Boolean(guard?.(arrowType));
|
|
16354
17091
|
}
|
|
16355
|
-
function
|
|
16356
|
-
|
|
16357
|
-
|
|
17092
|
+
function parseDBFHeader(headerView) {
|
|
17093
|
+
return {
|
|
17094
|
+
// Last updated date
|
|
17095
|
+
year: headerView.getUint8(1) + 1900,
|
|
17096
|
+
month: headerView.getUint8(2),
|
|
17097
|
+
day: headerView.getUint8(3),
|
|
17098
|
+
// Number of records in data file
|
|
17099
|
+
nRecords: headerView.getUint32(4, LITTLE_ENDIAN),
|
|
17100
|
+
// Length of header in bytes
|
|
17101
|
+
headerLength: headerView.getUint16(8, LITTLE_ENDIAN),
|
|
17102
|
+
// Length of each record
|
|
17103
|
+
recordLength: headerView.getUint16(10, LITTLE_ENDIAN),
|
|
17104
|
+
// Not sure if this is usually set
|
|
17105
|
+
languageDriver: headerView.getUint8(29)
|
|
17106
|
+
};
|
|
16358
17107
|
}
|
|
16359
|
-
function
|
|
16360
|
-
const
|
|
16361
|
-
|
|
16362
|
-
|
|
16363
|
-
|
|
16364
|
-
|
|
16365
|
-
|
|
16366
|
-
|
|
16367
|
-
|
|
16368
|
-
|
|
16369
|
-
|
|
16370
|
-
|
|
16371
|
-
|
|
17108
|
+
function parseFieldDescriptors(view, textDecoder) {
|
|
17109
|
+
const nFields = (view.byteLength - 1) / 32;
|
|
17110
|
+
const fields = [];
|
|
17111
|
+
let offset = 0;
|
|
17112
|
+
for (let i = 0; i < nFields; i++) {
|
|
17113
|
+
const name = textDecoder.decode(new Uint8Array(view.buffer, view.byteOffset + offset, 11)).replace(/\u0000/g, "");
|
|
17114
|
+
fields.push({
|
|
17115
|
+
name,
|
|
17116
|
+
dataType: String.fromCharCode(view.getUint8(offset + 11)),
|
|
17117
|
+
fieldLength: view.getUint8(offset + 16),
|
|
17118
|
+
decimal: view.getUint8(offset + 17)
|
|
17119
|
+
});
|
|
17120
|
+
offset += 32;
|
|
16372
17121
|
}
|
|
16373
|
-
return
|
|
17122
|
+
return fields;
|
|
16374
17123
|
}
|
|
16375
|
-
function
|
|
16376
|
-
const
|
|
16377
|
-
|
|
16378
|
-
|
|
16379
|
-
|
|
17124
|
+
function parseRow(view, fields, textDecoder) {
|
|
17125
|
+
const out = {};
|
|
17126
|
+
let offset = 0;
|
|
17127
|
+
for (const field of fields) {
|
|
17128
|
+
const text = textDecoder.decode(
|
|
17129
|
+
new Uint8Array(view.buffer, view.byteOffset + offset, field.fieldLength)
|
|
16380
17130
|
);
|
|
17131
|
+
out[field.name] = parseField(text, field.dataType);
|
|
17132
|
+
offset += field.fieldLength;
|
|
16381
17133
|
}
|
|
16382
|
-
return
|
|
17134
|
+
return out;
|
|
16383
17135
|
}
|
|
16384
|
-
function
|
|
16385
|
-
|
|
16386
|
-
|
|
16387
|
-
|
|
16388
|
-
|
|
16389
|
-
return
|
|
16390
|
-
|
|
16391
|
-
|
|
16392
|
-
|
|
16393
|
-
|
|
16394
|
-
|
|
16395
|
-
|
|
16396
|
-
|
|
16397
|
-
|
|
16398
|
-
|
|
16399
|
-
|
|
16400
|
-
return "uint8";
|
|
16401
|
-
case Uint16:
|
|
16402
|
-
return "uint16";
|
|
16403
|
-
case Uint32:
|
|
16404
|
-
return "uint32";
|
|
17136
|
+
function parseField(text, dataType) {
|
|
17137
|
+
switch (dataType) {
|
|
17138
|
+
case "B":
|
|
17139
|
+
return parseNumber(text);
|
|
17140
|
+
case "C":
|
|
17141
|
+
return parseCharacter(text);
|
|
17142
|
+
case "F":
|
|
17143
|
+
return parseNumber(text);
|
|
17144
|
+
case "N":
|
|
17145
|
+
return parseNumber(text);
|
|
17146
|
+
case "O":
|
|
17147
|
+
return parseNumber(text);
|
|
17148
|
+
case "D":
|
|
17149
|
+
return parseDate(text);
|
|
17150
|
+
case "L":
|
|
17151
|
+
return parseBoolean(text);
|
|
16405
17152
|
default:
|
|
16406
|
-
throw new Error(
|
|
17153
|
+
throw new Error("Unsupported data type");
|
|
16407
17154
|
}
|
|
16408
17155
|
}
|
|
16409
|
-
function
|
|
16410
|
-
return
|
|
17156
|
+
function parseDate(str) {
|
|
17157
|
+
return Date.UTC(str.slice(0, 4), parseInt(str.slice(4, 6), 10) - 1, str.slice(6, 8));
|
|
16411
17158
|
}
|
|
16412
|
-
function
|
|
16413
|
-
|
|
16414
|
-
|
|
16415
|
-
|
|
16416
|
-
|
|
16417
|
-
|
|
16418
|
-
|
|
16419
|
-
|
|
16420
|
-
|
|
16421
|
-
|
|
16422
|
-
|
|
16423
|
-
|
|
16424
|
-
case "
|
|
16425
|
-
return
|
|
17159
|
+
function parseBoolean(value) {
|
|
17160
|
+
return /^[nf]$/i.test(value) ? false : /^[yt]$/i.test(value) ? true : null;
|
|
17161
|
+
}
|
|
17162
|
+
function parseNumber(text) {
|
|
17163
|
+
const number = parseFloat(text);
|
|
17164
|
+
return Number.isNaN(number) ? null : number;
|
|
17165
|
+
}
|
|
17166
|
+
function parseCharacter(text) {
|
|
17167
|
+
return text.trim() || null;
|
|
17168
|
+
}
|
|
17169
|
+
function makeField({ name, dataType, fieldLength, decimal }) {
|
|
17170
|
+
switch (dataType) {
|
|
17171
|
+
case "B":
|
|
17172
|
+
return { name, type: "float64", nullable: true, metadata: {} };
|
|
17173
|
+
case "C":
|
|
17174
|
+
return { name, type: "utf8", nullable: true, metadata: {} };
|
|
17175
|
+
case "F":
|
|
17176
|
+
return { name, type: "float64", nullable: true, metadata: {} };
|
|
17177
|
+
case "N":
|
|
17178
|
+
return { name, type: "float64", nullable: true, metadata: {} };
|
|
17179
|
+
case "O":
|
|
17180
|
+
return { name, type: "float64", nullable: true, metadata: {} };
|
|
17181
|
+
case "D":
|
|
17182
|
+
return { name, type: "timestamp-millisecond", nullable: true, metadata: {} };
|
|
17183
|
+
case "L":
|
|
17184
|
+
return { name, type: "bool", nullable: true, metadata: {} };
|
|
16426
17185
|
default:
|
|
16427
|
-
throw new Error(
|
|
17186
|
+
throw new Error("Unsupported data type");
|
|
16428
17187
|
}
|
|
16429
17188
|
}
|
|
16430
|
-
var
|
|
16431
|
-
|
|
16432
|
-
|
|
16433
|
-
init_Arrow_dom();
|
|
16434
|
-
}
|
|
16435
|
-
});
|
|
16436
|
-
|
|
16437
|
-
// ../core/src/schema-utils/lib/table/batch-builder/arrow-table-builder.ts
|
|
16438
|
-
var ArrowTableBuilder;
|
|
16439
|
-
var init_arrow_table_builder = __esm({
|
|
16440
|
-
"../core/src/schema-utils/lib/table/batch-builder/arrow-table-builder.ts"() {
|
|
17189
|
+
var LITTLE_ENDIAN, DBF_HEADER_SIZE, DBFParser;
|
|
17190
|
+
var init_parse_dbf = __esm({
|
|
17191
|
+
"src/shapefile/lib/parsers/parse-dbf.ts"() {
|
|
16441
17192
|
"use strict";
|
|
16442
|
-
|
|
16443
|
-
|
|
16444
|
-
|
|
16445
|
-
|
|
16446
|
-
|
|
16447
|
-
|
|
16448
|
-
|
|
16449
|
-
|
|
16450
|
-
|
|
16451
|
-
|
|
16452
|
-
|
|
16453
|
-
|
|
16454
|
-
|
|
16455
|
-
|
|
16456
|
-
|
|
16457
|
-
|
|
16458
|
-
for (let i = 0; i < this.arrowBuilders.length; i++) {
|
|
16459
|
-
const columnName = this.schema.fields[i].name;
|
|
16460
|
-
const value = row[columnName];
|
|
16461
|
-
this.arrowBuilders[i].append(value);
|
|
16462
|
-
}
|
|
16463
|
-
this.length++;
|
|
16464
|
-
}
|
|
16465
|
-
addArrayRow(row) {
|
|
16466
|
-
for (let i = 0; i < this.arrowBuilders.length; i++) {
|
|
16467
|
-
this.arrowBuilders[i].append(row[i]);
|
|
16468
|
-
}
|
|
16469
|
-
this.length++;
|
|
16470
|
-
}
|
|
16471
|
-
/** Makes sure that a first batch with schema is sent even if no rows */
|
|
16472
|
-
firstBatch() {
|
|
16473
|
-
const arrowRecordBatch = this._getArrowRecordBatch();
|
|
16474
|
-
if (arrowRecordBatch.numCols !== 0) {
|
|
16475
|
-
return null;
|
|
16476
|
-
}
|
|
16477
|
-
return {
|
|
16478
|
-
shape: "arrow-table",
|
|
16479
|
-
batchType: "data",
|
|
16480
|
-
length: arrowRecordBatch.numRows,
|
|
16481
|
-
schema: this.schema,
|
|
16482
|
-
data: new Table(arrowRecordBatch)
|
|
16483
|
-
};
|
|
17193
|
+
init_loader_utils();
|
|
17194
|
+
init_binary_chunk_reader2();
|
|
17195
|
+
LITTLE_ENDIAN = true;
|
|
17196
|
+
DBF_HEADER_SIZE = 32;
|
|
17197
|
+
DBFParser = class {
|
|
17198
|
+
binaryReader = new BinaryChunkReader();
|
|
17199
|
+
textDecoder;
|
|
17200
|
+
options;
|
|
17201
|
+
state = 0 /* START */;
|
|
17202
|
+
result = {
|
|
17203
|
+
data: []
|
|
17204
|
+
};
|
|
17205
|
+
constructor(options) {
|
|
17206
|
+
const { encoding = "latin1" } = options.dbf || {};
|
|
17207
|
+
this.options = options;
|
|
17208
|
+
this.textDecoder = new TextDecoder(encoding);
|
|
16484
17209
|
}
|
|
16485
|
-
/**
|
|
16486
|
-
|
|
16487
|
-
|
|
16488
|
-
|
|
16489
|
-
|
|
16490
|
-
|
|
16491
|
-
|
|
16492
|
-
|
|
16493
|
-
|
|
16494
|
-
|
|
16495
|
-
|
|
16496
|
-
|
|
16497
|
-
};
|
|
17210
|
+
/**
|
|
17211
|
+
* @param arrayBuffer
|
|
17212
|
+
*/
|
|
17213
|
+
write(arrayBuffer) {
|
|
17214
|
+
this.binaryReader.write(arrayBuffer);
|
|
17215
|
+
this.state = parseState(
|
|
17216
|
+
this.state,
|
|
17217
|
+
this.result,
|
|
17218
|
+
this.binaryReader,
|
|
17219
|
+
this.textDecoder,
|
|
17220
|
+
this.options
|
|
17221
|
+
);
|
|
16498
17222
|
}
|
|
16499
|
-
|
|
16500
|
-
|
|
16501
|
-
|
|
16502
|
-
|
|
16503
|
-
|
|
16504
|
-
|
|
17223
|
+
end() {
|
|
17224
|
+
this.binaryReader.end();
|
|
17225
|
+
this.state = parseState(
|
|
17226
|
+
this.state,
|
|
17227
|
+
this.result,
|
|
17228
|
+
this.binaryReader,
|
|
17229
|
+
this.textDecoder,
|
|
17230
|
+
this.options
|
|
17231
|
+
);
|
|
17232
|
+
if (this.state !== 3 /* END */) {
|
|
17233
|
+
this.state = 4 /* ERROR */;
|
|
17234
|
+
this.result.error = "DBF incomplete file";
|
|
16505
17235
|
}
|
|
16506
|
-
return {
|
|
16507
|
-
shape: "arrow-table",
|
|
16508
|
-
batchType: "data",
|
|
16509
|
-
length: arrowRecordBatch.numRows,
|
|
16510
|
-
schema: this.schema,
|
|
16511
|
-
data: new Table(arrowRecordBatch)
|
|
16512
|
-
};
|
|
16513
|
-
}
|
|
16514
|
-
/** Return a table with all the accumulated data */
|
|
16515
|
-
finishTable() {
|
|
16516
|
-
const arrowRecordBatch = this._getArrowRecordBatch();
|
|
16517
|
-
this.arrowBuilders.forEach((builder) => builder.finish());
|
|
16518
|
-
return {
|
|
16519
|
-
shape: "arrow-table",
|
|
16520
|
-
schema: this.schema,
|
|
16521
|
-
data: new Table(arrowRecordBatch)
|
|
16522
|
-
};
|
|
16523
|
-
}
|
|
16524
|
-
/** Extract a record batch flushing the currently accumulated data in the builders */
|
|
16525
|
-
_getArrowRecordBatch() {
|
|
16526
|
-
const { arrowBuilders, arrowSchema } = this;
|
|
16527
|
-
const arrowDatas = arrowBuilders.map((builder) => builder.flush());
|
|
16528
|
-
const length = arrowDatas[0]?.length || this.length;
|
|
16529
|
-
this.length = 0;
|
|
16530
|
-
const structField = new Struct(arrowSchema.fields);
|
|
16531
|
-
const arrowStructData = new Data(structField, 0, length, 0, void 0, arrowDatas);
|
|
16532
|
-
const arrowRecordBatch = new RecordBatch3(arrowSchema, arrowStructData);
|
|
16533
|
-
return arrowRecordBatch;
|
|
16534
17236
|
}
|
|
16535
17237
|
};
|
|
16536
17238
|
}
|
|
16537
17239
|
});
|
|
16538
17240
|
|
|
16539
|
-
// ../core/src/schema-utils/index.ts
|
|
16540
|
-
var init_schema_utils = __esm({
|
|
16541
|
-
"../core/src/schema-utils/index.ts"() {
|
|
16542
|
-
"use strict";
|
|
16543
|
-
init_arrow_table_builder();
|
|
16544
|
-
}
|
|
16545
|
-
});
|
|
16546
|
-
|
|
16547
17241
|
// src/shapefile/lib/parsers/parse-dbf-to-arrow.ts
|
|
16548
17242
|
function parseDBF2(arrayBuffer, options = {}) {
|
|
16549
17243
|
const dbfParser = new DBFParser2({
|
|
@@ -16841,11 +17535,11 @@ return true;`);
|
|
|
16841
17535
|
const { DBFLoaderWithParser: DBFLoaderWithParser2 } = await Promise.resolve().then(() => (init_dbf(), dbf_exports));
|
|
16842
17536
|
return DBFLoaderWithParser2;
|
|
16843
17537
|
}
|
|
16844
|
-
var VERSION, DBFLoader
|
|
17538
|
+
var VERSION, DBFLoader;
|
|
16845
17539
|
var init_dbf_loader_types = __esm({
|
|
16846
17540
|
"src/shapefile/dbf-loader-types.ts"() {
|
|
16847
17541
|
"use strict";
|
|
16848
|
-
VERSION = true ? "5.0.0-beta.
|
|
17542
|
+
VERSION = true ? "5.0.0-beta.11" : "latest";
|
|
16849
17543
|
DBFLoader = {
|
|
16850
17544
|
name: "DBF",
|
|
16851
17545
|
dataType: null,
|
|
@@ -16855,24 +17549,97 @@ return true;`);
|
|
|
16855
17549
|
version: VERSION,
|
|
16856
17550
|
worker: true,
|
|
16857
17551
|
workerInBatches: true,
|
|
17552
|
+
supportsNativeArrow: true,
|
|
16858
17553
|
category: "table",
|
|
16859
17554
|
extensions: ["dbf"],
|
|
16860
17555
|
mimeTypes: ["application/x-dbf"],
|
|
16861
17556
|
options: {
|
|
16862
17557
|
dbf: {
|
|
16863
17558
|
encoding: "latin1",
|
|
16864
|
-
shape: "arrow
|
|
17559
|
+
shape: "arrow"
|
|
16865
17560
|
}
|
|
16866
17561
|
},
|
|
16867
17562
|
preload: preloadDBFLoader
|
|
16868
17563
|
};
|
|
16869
|
-
DBFWorkerLoader = DBFLoader;
|
|
16870
17564
|
}
|
|
16871
17565
|
});
|
|
16872
17566
|
|
|
16873
|
-
//
|
|
17567
|
+
// ../../node_modules/@math.gl/arrow/dist/arrow/indexed-arrow-helpers.js
|
|
17568
|
+
var init_indexed_arrow_helpers = __esm({
|
|
17569
|
+
"../../node_modules/@math.gl/arrow/dist/arrow/indexed-arrow-helpers.js"() {
|
|
17570
|
+
}
|
|
17571
|
+
});
|
|
17572
|
+
|
|
17573
|
+
// ../../node_modules/@math.gl/arrow/dist/arrow/arrow-schema-utils.js
|
|
17574
|
+
var init_arrow_schema_utils = __esm({
|
|
17575
|
+
"../../node_modules/@math.gl/arrow/dist/arrow/arrow-schema-utils.js"() {
|
|
17576
|
+
}
|
|
17577
|
+
});
|
|
17578
|
+
|
|
17579
|
+
// ../../node_modules/@math.gl/arrow/dist/arrow/arrow-data.js
|
|
17580
|
+
function getArrowVariadicBuffers(data) {
|
|
17581
|
+
return data.variadicBuffers ?? [];
|
|
17582
|
+
}
|
|
17583
|
+
function createArrowData(type, offset, length, nullCount, buffers, children, dictionary, variadicBuffers) {
|
|
17584
|
+
return Reflect.construct(Data, [
|
|
17585
|
+
type,
|
|
17586
|
+
offset,
|
|
17587
|
+
length,
|
|
17588
|
+
nullCount,
|
|
17589
|
+
buffers,
|
|
17590
|
+
children,
|
|
17591
|
+
dictionary,
|
|
17592
|
+
variadicBuffers
|
|
17593
|
+
]);
|
|
17594
|
+
}
|
|
17595
|
+
var init_arrow_data = __esm({
|
|
17596
|
+
"../../node_modules/@math.gl/arrow/dist/arrow/arrow-data.js"() {
|
|
17597
|
+
init_Arrow_dom();
|
|
17598
|
+
}
|
|
17599
|
+
});
|
|
17600
|
+
|
|
17601
|
+
// ../../node_modules/@math.gl/arrow/dist/arrow/arrow-record-batch.js
|
|
17602
|
+
function getRecordBatchMetadata(batch) {
|
|
17603
|
+
return batch.metadata;
|
|
17604
|
+
}
|
|
17605
|
+
function createRecordBatchWithMetadata(schema, data, metadata) {
|
|
17606
|
+
if ("metadata" in RecordBatch3.prototype) {
|
|
17607
|
+
const MetadataRecordBatch = RecordBatch3;
|
|
17608
|
+
return Object.assign(new MetadataRecordBatch(schema, data, metadata), { data });
|
|
17609
|
+
}
|
|
17610
|
+
const batch = Object.assign(new RecordBatch3(schema, data), { data });
|
|
17611
|
+
return metadata === void 0 ? batch : Object.assign(batch, { metadata });
|
|
17612
|
+
}
|
|
17613
|
+
var init_arrow_record_batch = __esm({
|
|
17614
|
+
"../../node_modules/@math.gl/arrow/dist/arrow/arrow-record-batch.js"() {
|
|
17615
|
+
init_Arrow_dom();
|
|
17616
|
+
}
|
|
17617
|
+
});
|
|
17618
|
+
|
|
17619
|
+
// ../../node_modules/@math.gl/arrow/dist/arrow/arrow-column-utils.js
|
|
17620
|
+
function isArrowTable2(value) {
|
|
17621
|
+
const table = value;
|
|
17622
|
+
return Boolean(table && Number.isInteger(table.numRows) && Array.isArray(table.batches) && Array.isArray(table.schema?.fields) && typeof table.get === "function" && typeof table.getChild === "function");
|
|
17623
|
+
}
|
|
17624
|
+
function isArrowRecordBatch2(value) {
|
|
17625
|
+
const batch = value;
|
|
17626
|
+
return Boolean(batch && Number.isInteger(batch.numRows) && Array.isArray(batch.schema?.fields) && Array.isArray(batch.data?.children) && typeof batch.get === "function" && typeof batch.getChild === "function");
|
|
17627
|
+
}
|
|
17628
|
+
var init_arrow_column_utils = __esm({
|
|
17629
|
+
"../../node_modules/@math.gl/arrow/dist/arrow/arrow-column-utils.js"() {
|
|
17630
|
+
}
|
|
17631
|
+
});
|
|
17632
|
+
|
|
17633
|
+
// ../../node_modules/@math.gl/arrow/dist/arrow/split-arrow-buffers.js
|
|
16874
17634
|
function splitArrowBuffers(input, options = {}) {
|
|
16875
|
-
const
|
|
17635
|
+
const retainedBuffers = /* @__PURE__ */ new Set();
|
|
17636
|
+
const visited = /* @__PURE__ */ new Set();
|
|
17637
|
+
for (const retained of options.retain ?? []) {
|
|
17638
|
+
const chunks = isArrowTable2(retained) ? retained.batches.map((batch) => batch.data) : isArrowVector2(retained) ? retained.data : [isArrowRecordBatch2(retained) ? retained.data : retained];
|
|
17639
|
+
for (const data of chunks)
|
|
17640
|
+
collectArrowBuffers(data, retainedBuffers, visited);
|
|
17641
|
+
}
|
|
17642
|
+
const context = { ...options, copies: /* @__PURE__ */ new WeakMap(), retainedBuffers };
|
|
16876
17643
|
if (isArrowTable2(input)) {
|
|
16877
17644
|
return splitArrowTableBuffersInternal(input, context);
|
|
16878
17645
|
}
|
|
@@ -16884,26 +17651,16 @@ return true;`);
|
|
|
16884
17651
|
}
|
|
16885
17652
|
return splitArrowDataBuffers(input, context);
|
|
16886
17653
|
}
|
|
16887
|
-
function isArrowTable2(input) {
|
|
16888
|
-
return "batches" in input;
|
|
16889
|
-
}
|
|
16890
|
-
function isArrowRecordBatch2(input) {
|
|
16891
|
-
return "schema" in input && "data" in input && !Array.isArray(input.data);
|
|
16892
|
-
}
|
|
16893
17654
|
function isArrowVector2(input) {
|
|
16894
17655
|
return "data" in input && Array.isArray(input.data);
|
|
16895
17656
|
}
|
|
16896
|
-
function splitArrowTableBuffersInternal(
|
|
16897
|
-
const recordBatches =
|
|
16898
|
-
|
|
16899
|
-
);
|
|
16900
|
-
return new Table(table.schema, recordBatches);
|
|
17657
|
+
function splitArrowTableBuffersInternal(arrowTable, options) {
|
|
17658
|
+
const recordBatches = arrowTable.batches.map((recordBatch) => splitArrowRecordBatchBuffers(recordBatch, options));
|
|
17659
|
+
return new Table(arrowTable.schema, recordBatches);
|
|
16901
17660
|
}
|
|
16902
17661
|
function splitArrowRecordBatchBuffers(recordBatch, options) {
|
|
16903
|
-
|
|
16904
|
-
|
|
16905
|
-
splitArrowDataBuffers(recordBatch.data, options)
|
|
16906
|
-
);
|
|
17662
|
+
const data = splitArrowDataBuffers(recordBatch.data, options);
|
|
17663
|
+
return createRecordBatchWithMetadata(recordBatch.schema, data, getRecordBatchMetadata(recordBatch));
|
|
16907
17664
|
}
|
|
16908
17665
|
function splitArrowDataBuffers(data, options) {
|
|
16909
17666
|
const children = data.children.map((childData) => splitArrowDataBuffers(childData, options));
|
|
@@ -16914,7 +17671,7 @@ return true;`);
|
|
|
16914
17671
|
[BufferType.VALIDITY]: splitArrowBuffer(data.buffers[BufferType.VALIDITY], options),
|
|
16915
17672
|
[BufferType.TYPE]: splitArrowBuffer(data.buffers[BufferType.TYPE], options)
|
|
16916
17673
|
};
|
|
16917
|
-
return
|
|
17674
|
+
return createArrowData(
|
|
16918
17675
|
data.type,
|
|
16919
17676
|
data.offset,
|
|
16920
17677
|
data.length,
|
|
@@ -16922,25 +17679,37 @@ return true;`);
|
|
|
16922
17679
|
data._nullCount,
|
|
16923
17680
|
buffers,
|
|
16924
17681
|
children,
|
|
16925
|
-
dictionary
|
|
17682
|
+
dictionary,
|
|
17683
|
+
getArrowVariadicBuffers(data).map((buffer) => splitArrowBuffer(buffer, options))
|
|
16926
17684
|
);
|
|
16927
17685
|
}
|
|
16928
17686
|
function splitArrowVectorBuffers(vector, options) {
|
|
16929
17687
|
return new Vector(vector.data.map((data) => splitArrowDataBuffers(data, options)));
|
|
16930
17688
|
}
|
|
17689
|
+
function collectArrowBuffers(data, buffers, visited) {
|
|
17690
|
+
if (visited.has(data))
|
|
17691
|
+
return;
|
|
17692
|
+
visited.add(data);
|
|
17693
|
+
for (const view of [...Object.values(data.buffers), ...getArrowVariadicBuffers(data)]) {
|
|
17694
|
+
if (isArrowTypedArray(view))
|
|
17695
|
+
buffers.add(view.buffer);
|
|
17696
|
+
}
|
|
17697
|
+
for (const child of data.children)
|
|
17698
|
+
collectArrowBuffers(child, buffers, visited);
|
|
17699
|
+
for (const chunk of data.dictionary?.data ?? [])
|
|
17700
|
+
collectArrowBuffers(chunk, buffers, visited);
|
|
17701
|
+
}
|
|
16931
17702
|
function splitArrowBuffer(array, options) {
|
|
16932
17703
|
if (!isArrowTypedArray(array)) {
|
|
16933
17704
|
return array;
|
|
16934
17705
|
}
|
|
16935
|
-
|
|
16936
|
-
|
|
16937
|
-
}
|
|
16938
|
-
if (options.copy !== "all" && array.byteOffset === 0 && array.byteLength === array.buffer.byteLength) {
|
|
17706
|
+
const sliced = array.byteOffset !== 0 || array.byteLength !== array.buffer.byteLength;
|
|
17707
|
+
if (!options.retainedBuffers.has(array.buffer) && options.copy !== "all" && (options.copy === "none" || !sliced)) {
|
|
16939
17708
|
return array;
|
|
16940
17709
|
}
|
|
16941
17710
|
let copy = options.copies.get(array);
|
|
16942
17711
|
if (!copy) {
|
|
16943
|
-
copy = array.slice();
|
|
17712
|
+
copy = array instanceof Uint8Array ? new Uint8Array(array) : array.slice();
|
|
16944
17713
|
options.copies.set(array, copy);
|
|
16945
17714
|
}
|
|
16946
17715
|
return copy;
|
|
@@ -16949,117 +17718,208 @@ return true;`);
|
|
|
16949
17718
|
return ArrayBuffer.isView(value) && !(value instanceof DataView);
|
|
16950
17719
|
}
|
|
16951
17720
|
var init_split_arrow_buffers = __esm({
|
|
16952
|
-
"
|
|
16953
|
-
"use strict";
|
|
17721
|
+
"../../node_modules/@math.gl/arrow/dist/arrow/split-arrow-buffers.js"() {
|
|
16954
17722
|
init_Arrow_dom();
|
|
17723
|
+
init_arrow_record_batch();
|
|
17724
|
+
init_arrow_data();
|
|
17725
|
+
init_arrow_column_utils();
|
|
17726
|
+
}
|
|
17727
|
+
});
|
|
17728
|
+
|
|
17729
|
+
// ../../node_modules/@math.gl/arrow/dist/arrow/take-arrow-rows.js
|
|
17730
|
+
var init_take_arrow_rows = __esm({
|
|
17731
|
+
"../../node_modules/@math.gl/arrow/dist/arrow/take-arrow-rows.js"() {
|
|
17732
|
+
init_arrow_data();
|
|
17733
|
+
init_split_arrow_buffers();
|
|
17734
|
+
}
|
|
17735
|
+
});
|
|
17736
|
+
|
|
17737
|
+
// ../../node_modules/@math.gl/arrow/dist/arrow/indexed-arrow-vector.js
|
|
17738
|
+
var init_indexed_arrow_vector = __esm({
|
|
17739
|
+
"../../node_modules/@math.gl/arrow/dist/arrow/indexed-arrow-vector.js"() {
|
|
17740
|
+
init_indexed_arrow_helpers();
|
|
17741
|
+
}
|
|
17742
|
+
});
|
|
17743
|
+
|
|
17744
|
+
// ../../node_modules/@math.gl/arrow/dist/arrow/indexed-arrow-table.js
|
|
17745
|
+
var init_indexed_arrow_table = __esm({
|
|
17746
|
+
"../../node_modules/@math.gl/arrow/dist/arrow/indexed-arrow-table.js"() {
|
|
17747
|
+
init_indexed_arrow_helpers();
|
|
17748
|
+
init_arrow_schema_utils();
|
|
17749
|
+
init_take_arrow_rows();
|
|
17750
|
+
init_indexed_arrow_vector();
|
|
17751
|
+
}
|
|
17752
|
+
});
|
|
17753
|
+
|
|
17754
|
+
// ../../node_modules/@math.gl/arrow/dist/arrow/mapped-arrow-table.js
|
|
17755
|
+
var init_mapped_arrow_table = __esm({
|
|
17756
|
+
"../../node_modules/@math.gl/arrow/dist/arrow/mapped-arrow-table.js"() {
|
|
17757
|
+
init_indexed_arrow_helpers();
|
|
17758
|
+
init_indexed_arrow_table();
|
|
17759
|
+
}
|
|
17760
|
+
});
|
|
17761
|
+
|
|
17762
|
+
// ../../node_modules/@math.gl/arrow/dist/arrow/rename-arrow-columns.js
|
|
17763
|
+
var init_rename_arrow_columns = __esm({
|
|
17764
|
+
"../../node_modules/@math.gl/arrow/dist/arrow/rename-arrow-columns.js"() {
|
|
17765
|
+
init_arrow_schema_utils();
|
|
16955
17766
|
}
|
|
16956
17767
|
});
|
|
16957
17768
|
|
|
16958
|
-
//
|
|
16959
|
-
function dehydrateArrowTable(
|
|
16960
|
-
const splitTable = splitArrowBuffers(
|
|
17769
|
+
// ../../node_modules/@math.gl/arrow/dist/arrow/arrow-table-transport.js
|
|
17770
|
+
function dehydrateArrowTable(arrowTable, options) {
|
|
17771
|
+
const splitTable = splitArrowBuffers(arrowTable, options);
|
|
16961
17772
|
return {
|
|
16962
|
-
shape: "arrow-table",
|
|
16963
17773
|
transport: "arrow-js",
|
|
16964
|
-
|
|
16965
|
-
|
|
17774
|
+
version: 1,
|
|
17775
|
+
schema: tableToIPC(new Table(splitTable.schema, [])),
|
|
17776
|
+
metadataVersion: splitTable.schema.metadataVersion,
|
|
17777
|
+
batches: splitTable.batches.map((batch) => {
|
|
17778
|
+
const metadata = getRecordBatchMetadata(batch);
|
|
17779
|
+
return {
|
|
17780
|
+
...dehydrateArrowData(batch.data),
|
|
17781
|
+
...metadata !== void 0 ? { metadata: [...metadata] } : {}
|
|
17782
|
+
};
|
|
17783
|
+
})
|
|
16966
17784
|
};
|
|
16967
17785
|
}
|
|
16968
17786
|
function hydrateArrowTable(table) {
|
|
16969
|
-
|
|
16970
|
-
|
|
16971
|
-
|
|
16972
|
-
);
|
|
16973
|
-
|
|
16974
|
-
|
|
16975
|
-
|
|
16976
|
-
|
|
16977
|
-
|
|
16978
|
-
}
|
|
16979
|
-
|
|
16980
|
-
return {
|
|
16981
|
-
...structuredClone(metadata),
|
|
16982
|
-
data: dehydrateArrowTable(data, { copy: "all" })
|
|
16983
|
-
};
|
|
16984
|
-
}
|
|
16985
|
-
function deserializeArrowWorkerTable(result) {
|
|
16986
|
-
if (!isDehydratedArrowTableWrapper(result)) {
|
|
16987
|
-
throw new Error("Workers require Arrow column transport");
|
|
16988
|
-
}
|
|
16989
|
-
return { ...result, data: hydrateArrowTable(result.data) };
|
|
16990
|
-
}
|
|
16991
|
-
function isArrowTableWrapper(value) {
|
|
16992
|
-
const table = value;
|
|
16993
|
-
return Boolean(
|
|
16994
|
-
table && table.shape === "arrow-table" && table.data && typeof table.data === "object" && "batches" in table.data
|
|
16995
|
-
);
|
|
16996
|
-
}
|
|
16997
|
-
function isDehydratedArrowTableWrapper(value) {
|
|
16998
|
-
const table = value;
|
|
16999
|
-
return Boolean(
|
|
17000
|
-
table && table.shape === "arrow-table" && table.data && table.data.transport === "arrow-js" && Array.isArray(table.data.batches)
|
|
17001
|
-
);
|
|
17002
|
-
}
|
|
17003
|
-
function dehydrateArrowRecordBatch(recordBatch) {
|
|
17004
|
-
return { data: dehydrateArrowData(recordBatch.data) };
|
|
17787
|
+
if (table.transport !== "arrow-js" || table.version !== 1) {
|
|
17788
|
+
throw new Error("Unsupported Arrow column-buffer transport protocol.");
|
|
17789
|
+
}
|
|
17790
|
+
const decodedSchema = tableFromIPC(table.schema).schema;
|
|
17791
|
+
const schema = new Schema2(decodedSchema.fields, decodedSchema.metadata, decodedSchema.dictionaries, table.metadataVersion);
|
|
17792
|
+
const type = new Struct(schema.fields);
|
|
17793
|
+
const batches = table.batches.map((payload) => {
|
|
17794
|
+
const data = hydrateArrowData(payload, type);
|
|
17795
|
+
return createRecordBatchWithMetadata(schema, data, payload.metadata && new Map(payload.metadata));
|
|
17796
|
+
});
|
|
17797
|
+
return new Table(schema, batches);
|
|
17005
17798
|
}
|
|
17006
17799
|
function dehydrateArrowData(data) {
|
|
17007
17800
|
return {
|
|
17008
|
-
type: serializeArrowType(data.type),
|
|
17009
17801
|
offset: data.offset,
|
|
17010
17802
|
length: data.length,
|
|
17011
|
-
|
|
17012
|
-
nullCount: data._nullCount,
|
|
17803
|
+
nullCount: data.nullCount,
|
|
17013
17804
|
buffers: {
|
|
17014
17805
|
[BufferType.OFFSET]: data.buffers[BufferType.OFFSET],
|
|
17015
17806
|
[BufferType.DATA]: data.buffers[BufferType.DATA],
|
|
17016
17807
|
[BufferType.VALIDITY]: data.buffers[BufferType.VALIDITY],
|
|
17017
17808
|
[BufferType.TYPE]: data.buffers[BufferType.TYPE]
|
|
17018
17809
|
},
|
|
17019
|
-
children: data.children.map((
|
|
17020
|
-
|
|
17810
|
+
children: data.children.map((child) => dehydrateArrowData(child)),
|
|
17811
|
+
variadicBuffers: getArrowVariadicBuffers(data),
|
|
17812
|
+
dictionary: data.dictionary?.data.map((chunk) => dehydrateArrowData(chunk))
|
|
17021
17813
|
};
|
|
17022
17814
|
}
|
|
17023
|
-
function
|
|
17024
|
-
|
|
17815
|
+
function hydrateArrowData(data, type) {
|
|
17816
|
+
const children = data.children.map((child, index) => hydrateArrowData(child, type.children[index].type));
|
|
17817
|
+
const dictionary = data.dictionary && DataType.isDictionary(type) ? new Vector(data.dictionary.map((chunk) => hydrateArrowData(chunk, type.dictionary))) : void 0;
|
|
17818
|
+
return createArrowData(type, data.offset, data.length, data.nullCount, data.buffers, children, dictionary, data.variadicBuffers);
|
|
17025
17819
|
}
|
|
17026
|
-
function
|
|
17027
|
-
|
|
17028
|
-
const dictionary = data.dictionary ? hydrateArrowVector(data.dictionary) : void 0;
|
|
17029
|
-
return new Data(
|
|
17030
|
-
deserializeArrowType(data.type),
|
|
17031
|
-
data.offset,
|
|
17032
|
-
data.length,
|
|
17033
|
-
data.nullCount,
|
|
17034
|
-
data.buffers,
|
|
17035
|
-
children,
|
|
17036
|
-
dictionary
|
|
17037
|
-
);
|
|
17820
|
+
function dehydrateArrowRecordBatch(batch, options) {
|
|
17821
|
+
return dehydrateArrowTable(new Table(batch.schema, [batch]), options);
|
|
17038
17822
|
}
|
|
17039
|
-
function
|
|
17040
|
-
|
|
17823
|
+
function hydrateArrowRecordBatch(payload) {
|
|
17824
|
+
if (payload.batches.length !== 1) {
|
|
17825
|
+
throw new Error("Arrow record batch transport requires exactly one batch.");
|
|
17826
|
+
}
|
|
17827
|
+
return hydrateArrowTable(payload).batches[0];
|
|
17041
17828
|
}
|
|
17042
17829
|
var init_arrow_table_transport = __esm({
|
|
17043
|
-
"
|
|
17044
|
-
"use strict";
|
|
17830
|
+
"../../node_modules/@math.gl/arrow/dist/arrow/arrow-table-transport.js"() {
|
|
17045
17831
|
init_Arrow_dom();
|
|
17046
|
-
|
|
17832
|
+
init_arrow_record_batch();
|
|
17833
|
+
init_arrow_data();
|
|
17047
17834
|
init_split_arrow_buffers();
|
|
17048
17835
|
}
|
|
17049
17836
|
});
|
|
17050
17837
|
|
|
17051
|
-
//
|
|
17052
|
-
var
|
|
17053
|
-
"
|
|
17054
|
-
|
|
17055
|
-
|
|
17838
|
+
// ../../node_modules/@math.gl/arrow/dist/arrow/index.js
|
|
17839
|
+
var init_arrow = __esm({
|
|
17840
|
+
"../../node_modules/@math.gl/arrow/dist/arrow/index.js"() {
|
|
17841
|
+
init_indexed_arrow_table();
|
|
17842
|
+
init_indexed_arrow_vector();
|
|
17843
|
+
init_mapped_arrow_table();
|
|
17844
|
+
init_arrow_schema_utils();
|
|
17845
|
+
init_rename_arrow_columns();
|
|
17056
17846
|
init_split_arrow_buffers();
|
|
17847
|
+
init_arrow_table_transport();
|
|
17848
|
+
init_arrow_column_utils();
|
|
17849
|
+
init_take_arrow_rows();
|
|
17850
|
+
init_arrow_record_batch();
|
|
17851
|
+
}
|
|
17852
|
+
});
|
|
17853
|
+
|
|
17854
|
+
// ../../node_modules/@math.gl/arrow/dist/index.js
|
|
17855
|
+
var init_dist2 = __esm({
|
|
17856
|
+
"../../node_modules/@math.gl/arrow/dist/index.js"() {
|
|
17857
|
+
init_arrow();
|
|
17858
|
+
}
|
|
17859
|
+
});
|
|
17860
|
+
|
|
17861
|
+
// ../core/src/arrow-worker-transport.ts
|
|
17862
|
+
function serializeNativeArrowWorkerResult(result, options = { copy: "all" }) {
|
|
17863
|
+
const batch = result instanceof RecordBatch3;
|
|
17864
|
+
if (!batch && !(result instanceof Table)) {
|
|
17865
|
+
throw new Error("Workers require Arrow table output");
|
|
17866
|
+
}
|
|
17867
|
+
return {
|
|
17868
|
+
transport: batch ? "arrow-record-batch" : "arrow-table-columns",
|
|
17869
|
+
columns: batch ? { data: dehydrateArrowRecordBatch(result, options) } : serializeWorkerColumns(result, options)
|
|
17870
|
+
};
|
|
17871
|
+
}
|
|
17872
|
+
function deserializeNativeArrowWorkerResult(result) {
|
|
17873
|
+
const payload = result;
|
|
17874
|
+
if (payload?.transport !== "arrow-table-columns" && payload?.transport !== "arrow-record-batch" || !hasArrowWorkerColumns(payload.columns)) {
|
|
17875
|
+
throw new Error("Workers require Arrow column transport");
|
|
17876
|
+
}
|
|
17877
|
+
if (payload.transport === "arrow-record-batch" && !payload.columns.arrowBatchMetadata) {
|
|
17878
|
+
return hydrateArrowRecordBatch(payload.columns.data);
|
|
17879
|
+
}
|
|
17880
|
+
const data = hydrateWorkerTable(payload.columns);
|
|
17881
|
+
return payload.transport === "arrow-record-batch" ? data.batches[0] : data;
|
|
17882
|
+
}
|
|
17883
|
+
function hasArrowWorkerColumns(value) {
|
|
17884
|
+
const columns = value;
|
|
17885
|
+
return columns?.data?.transport === "arrow-js" && Array.isArray(columns.data.batches);
|
|
17886
|
+
}
|
|
17887
|
+
function serializeWorkerColumns(table, options) {
|
|
17888
|
+
return {
|
|
17889
|
+
arrowBatchMetadata: snapshotBatchMetadata(table),
|
|
17890
|
+
data: dehydrateArrowTable(table, options)
|
|
17891
|
+
};
|
|
17892
|
+
}
|
|
17893
|
+
function snapshotBatchMetadata(table) {
|
|
17894
|
+
return table.batches.map((batch) => ({
|
|
17895
|
+
schema: tableToIPC(new Table(batch.schema, []))
|
|
17896
|
+
}));
|
|
17897
|
+
}
|
|
17898
|
+
function hydrateWorkerTable(result) {
|
|
17899
|
+
const { arrowBatchMetadata, data } = result;
|
|
17900
|
+
const table = hydrateArrowTable(data);
|
|
17901
|
+
const batches = table.batches.map((batch, index) => {
|
|
17902
|
+
const snapshot = arrowBatchMetadata?.[index];
|
|
17903
|
+
return snapshot ? createRecordBatchWithMetadata(
|
|
17904
|
+
tableFromIPC(snapshot.schema).schema,
|
|
17905
|
+
batch.data,
|
|
17906
|
+
snapshot.metadata ? new Map(snapshot.metadata) : getRecordBatchMetadata(batch)
|
|
17907
|
+
) : batch;
|
|
17908
|
+
});
|
|
17909
|
+
return new Table(table.schema, batches);
|
|
17910
|
+
}
|
|
17911
|
+
var init_arrow_worker_transport = __esm({
|
|
17912
|
+
"../core/src/arrow-worker-transport.ts"() {
|
|
17913
|
+
"use strict";
|
|
17914
|
+
init_Arrow_dom();
|
|
17915
|
+
init_dist2();
|
|
17057
17916
|
}
|
|
17058
17917
|
});
|
|
17059
17918
|
|
|
17060
17919
|
// src/shapefile/lib/shapefile-worker-transport.ts
|
|
17061
17920
|
function serializeShapefileWorkerResult(result) {
|
|
17062
|
-
if (result
|
|
17921
|
+
if (result instanceof Table || result instanceof RecordBatch3)
|
|
17922
|
+
return serializeNativeArrowWorkerResult(result);
|
|
17063
17923
|
if (Array.isArray(result) && result.every((value) => value === null || value instanceof Uint8Array)) {
|
|
17064
17924
|
return { transport: "shp-wkb", geometries: result.map((value) => value?.slice() ?? null) };
|
|
17065
17925
|
}
|
|
@@ -17077,7 +17937,8 @@ return true;`);
|
|
|
17077
17937
|
throw new Error("Shapefile workers require Arrow columns or WKB buffers");
|
|
17078
17938
|
}
|
|
17079
17939
|
function deserializeShapefileWorkerResult(result) {
|
|
17080
|
-
if (result?.
|
|
17940
|
+
if (result?.transport === "arrow-table-columns" || result?.transport === "arrow-record-batch")
|
|
17941
|
+
return deserializeNativeArrowWorkerResult(result);
|
|
17081
17942
|
if (result?.transport === "shapefile-header") return result.header;
|
|
17082
17943
|
if (result?.transport === "shp-wkb") {
|
|
17083
17944
|
return result.header ? {
|
|
@@ -17094,55 +17955,62 @@ return true;`);
|
|
|
17094
17955
|
var init_shapefile_worker_transport = __esm({
|
|
17095
17956
|
"src/shapefile/lib/shapefile-worker-transport.ts"() {
|
|
17096
17957
|
"use strict";
|
|
17097
|
-
|
|
17958
|
+
init_Arrow_dom();
|
|
17959
|
+
init_arrow_worker_transport();
|
|
17098
17960
|
serializeShapefileWorkerBatch = serializeShapefileWorkerResult;
|
|
17099
17961
|
}
|
|
17100
17962
|
});
|
|
17101
17963
|
|
|
17102
17964
|
// src/shapefile/dbf-loader.ts
|
|
17103
17965
|
function getDBFShape(options) {
|
|
17104
|
-
return options?.dbf?.shape || "arrow
|
|
17966
|
+
return options?.dbf?.shape || "arrow";
|
|
17105
17967
|
}
|
|
17106
17968
|
function deserializeDBFWorkerResult(result, options) {
|
|
17107
17969
|
const table = deserializeShapefileWorkerResult(result);
|
|
17108
17970
|
const shape = getDBFShape(options);
|
|
17109
|
-
if (shape === "arrow
|
|
17110
|
-
const rows = table.
|
|
17971
|
+
if (shape === "arrow") return table;
|
|
17972
|
+
const rows = table.toArray().map((row) => row.toJSON());
|
|
17111
17973
|
if (shape === "rows") return rows;
|
|
17112
|
-
|
|
17113
|
-
|
|
17974
|
+
const schema = convertArrowToSchema(table.schema);
|
|
17975
|
+
if (shape === "table") return { schema, rows };
|
|
17976
|
+
return { shape: "object-row-table", schema, data: rows };
|
|
17114
17977
|
}
|
|
17115
17978
|
function deserializeDBFWorkerBatch(result, options) {
|
|
17116
|
-
|
|
17117
|
-
|
|
17118
|
-
return table.shape === "arrow-table" ? table.data.toArray().map((row) => row.toJSON()) : table;
|
|
17979
|
+
const batch = deserializeShapefileWorkerResult(result);
|
|
17980
|
+
return batch instanceof RecordBatch3 && getDBFShape(options) !== "arrow" ? batch.toArray().map((row) => row.toJSON()) : batch;
|
|
17119
17981
|
}
|
|
17120
|
-
var _DBFWorkerLoaderPreload, DBFWorkerLoaderMetadataWithoutPreload, _DBFLoaderPreload, DBFLoaderMetadataWithoutPreload, DBFWorkerLoaderWithParser, DBFLoaderWithParser;
|
|
17982
|
+
var _DBFWorkerLoaderPreload, DBFWorkerLoaderMetadataWithoutPreload, _DBFLoaderPreload, DBFLoaderMetadataWithoutPreload, DBFWorkerLoaderWithParser, DBFColumnLoader, DBFLoaderWithParser;
|
|
17121
17983
|
var init_dbf_loader = __esm({
|
|
17122
17984
|
"src/shapefile/dbf-loader.ts"() {
|
|
17123
17985
|
"use strict";
|
|
17986
|
+
init_Arrow_dom();
|
|
17987
|
+
init_schema_utils();
|
|
17124
17988
|
init_parse_dbf();
|
|
17125
17989
|
init_parse_dbf_to_arrow();
|
|
17126
17990
|
init_dbf_loader_types();
|
|
17127
17991
|
init_dbf_loader_types();
|
|
17128
17992
|
init_shapefile_worker_transport();
|
|
17129
|
-
({ preload: _DBFWorkerLoaderPreload, ...DBFWorkerLoaderMetadataWithoutPreload } =
|
|
17993
|
+
({ preload: _DBFWorkerLoaderPreload, ...DBFWorkerLoaderMetadataWithoutPreload } = DBFLoader);
|
|
17130
17994
|
({ preload: _DBFLoaderPreload, ...DBFLoaderMetadataWithoutPreload } = DBFLoader);
|
|
17131
17995
|
DBFWorkerLoaderWithParser = {
|
|
17132
17996
|
...DBFWorkerLoaderMetadataWithoutPreload
|
|
17133
17997
|
};
|
|
17134
|
-
|
|
17998
|
+
DBFColumnLoader = {
|
|
17135
17999
|
...DBFLoaderMetadataWithoutPreload,
|
|
17136
|
-
|
|
17137
|
-
|
|
18000
|
+
dataType: null,
|
|
18001
|
+
batchType: null,
|
|
18002
|
+
parse: async (arrayBuffer, options) => getDBFShape(options) === "arrow" ? parseDBF2(arrayBuffer, options) : parseDBF(arrayBuffer, options),
|
|
18003
|
+
parseSync: (arrayBuffer, options) => getDBFShape(options) === "arrow" ? parseDBF2(arrayBuffer, options) : parseDBF(arrayBuffer, options),
|
|
17138
18004
|
parseInBatches(arrayBufferIterator, options) {
|
|
17139
|
-
|
|
18005
|
+
const batchOptions = typeof options?.core?.batchSize === "number" ? { ...options, dbf: { ...options.dbf, batchSize: options.core.batchSize } } : options;
|
|
18006
|
+
return getDBFShape(batchOptions) === "arrow" ? parseDBFInBatches2(arrayBufferIterator, batchOptions) : parseDBFInBatches(arrayBufferIterator, batchOptions);
|
|
17140
18007
|
},
|
|
17141
18008
|
serializeWorkerResult: serializeShapefileWorkerResult,
|
|
17142
18009
|
deserializeWorkerResult: deserializeDBFWorkerResult,
|
|
17143
18010
|
serializeWorkerBatch: serializeShapefileWorkerBatch,
|
|
17144
18011
|
deserializeWorkerBatch: deserializeDBFWorkerBatch
|
|
17145
18012
|
};
|
|
18013
|
+
DBFLoaderWithParser = DBFColumnLoader;
|
|
17146
18014
|
}
|
|
17147
18015
|
});
|
|
17148
18016
|
|
|
@@ -17151,12 +18019,12 @@ return true;`);
|
|
|
17151
18019
|
init_dbf_loader();
|
|
17152
18020
|
init_parse_dbf_to_arrow();
|
|
17153
18021
|
createLoaderWorker({
|
|
17154
|
-
...
|
|
18022
|
+
...DBFColumnLoader,
|
|
17155
18023
|
/** Decodes attributes directly into Arrow buffers for every requested output shape. */
|
|
17156
18024
|
parse(input, options) {
|
|
17157
|
-
return
|
|
18025
|
+
return DBFColumnLoader.parse(input, {
|
|
17158
18026
|
...options,
|
|
17159
|
-
dbf: { ...options?.dbf, shape: "arrow
|
|
18027
|
+
dbf: { ...options?.dbf, shape: "arrow" }
|
|
17160
18028
|
});
|
|
17161
18029
|
},
|
|
17162
18030
|
/** Preserves legacy header events while returning only column buffers for row data. */
|
|
@@ -17164,7 +18032,7 @@ return true;`);
|
|
|
17164
18032
|
return parseDBFArrowBatches(
|
|
17165
18033
|
input,
|
|
17166
18034
|
options,
|
|
17167
|
-
options?.dbf?.shape !== "arrow
|
|
18035
|
+
options?.dbf?.shape !== "arrow"
|
|
17168
18036
|
);
|
|
17169
18037
|
}
|
|
17170
18038
|
});
|