@npm9912/v-map 0.1.0
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/LICENSE +21 -0
- package/README.md +185 -0
- package/dist/cjs/_commonjsHelpers-B83fTs8d.js +36 -0
- package/dist/cjs/app-globals-V2Kpy_OQ.js +5 -0
- package/dist/cjs/cesium-provider-BiFFyAl9.js +2598 -0
- package/dist/cjs/deck-provider-Ctq3Q8a1.js +47824 -0
- package/dist/cjs/geotiff-CEwvF9cG.js +47 -0
- package/dist/cjs/geotiff-source-RaNzzWkC.js +1522 -0
- package/dist/cjs/index-B1oGO1g-.js +10658 -0
- package/dist/cjs/index-B8LHqjyg.js +1765 -0
- package/dist/cjs/index-BIL4VsgP.js +310 -0
- package/dist/cjs/index-Blku2QY8.js +167 -0
- package/dist/cjs/index-CJvvX4yx.js +21 -0
- package/dist/cjs/index-CbVT-Con.js +699 -0
- package/dist/cjs/index-ISOEpMC3.js +20478 -0
- package/dist/cjs/index-JSwBbvGA.js +1621 -0
- package/dist/cjs/index.browser-DQhD8Jwl.js +6873 -0
- package/dist/cjs/index.cjs.js +2 -0
- package/dist/cjs/layer-extension-B_olS0rc.js +65 -0
- package/dist/cjs/leaflet-provider-DOqfs7g5.js +1815 -0
- package/dist/cjs/loader.cjs.js +13 -0
- package/dist/cjs/main-dist-7TykwFci.js +2655 -0
- package/dist/cjs/messages-D7h4m8Tx.js +186 -0
- package/dist/cjs/openlayers-provider-Dfeg6L4n.js +1604 -0
- package/dist/cjs/polygon-layer-B9PrN7vr.js +1300 -0
- package/dist/cjs/scenegraph-layer-DwNoxQdi.js +2530 -0
- package/dist/cjs/styleconfig-CVRqArk-.js +23 -0
- package/dist/cjs/v-map-builder.cjs.entry.js +3786 -0
- package/dist/cjs/v-map-layer-geojson_12.cjs.entry.js +40894 -0
- package/dist/cjs/v-map-layer-helper-iAzxAg9I.js +285 -0
- package/dist/cjs/v-map-layer-terrain-geotiff.cjs.entry.js +258 -0
- package/dist/cjs/v-map-layercontrol.cjs.entry.js +247 -0
- package/dist/cjs/v-map.cjs.js +25 -0
- package/dist/cjs/v-map.v-map-layer-osm.v-map-layergroup-BsXp3BoL.js +582 -0
- package/dist/cjs/v-map_3.cjs.entry.js +12 -0
- package/dist/collection/collection-manifest.json +30 -0
- package/dist/collection/components/v-map/v-map.css +3 -0
- package/dist/collection/components/v-map/v-map.js +467 -0
- package/dist/collection/components/v-map/v-map.test.js +33 -0
- package/dist/collection/components/v-map-builder/v-map-builder.css +1 -0
- package/dist/collection/components/v-map-builder/v-map-builder.js +913 -0
- package/dist/collection/components/v-map-builder/v-map-builder.test.js +56 -0
- package/dist/collection/components/v-map-layer-geojson/v-map-layer-geojson.js +862 -0
- package/dist/collection/components/v-map-layer-geojson/v-map-layer-geojson.test.js +42 -0
- package/dist/collection/components/v-map-layer-geotiff/v-map-layer-geotiff.css +4 -0
- package/dist/collection/components/v-map-layer-geotiff/v-map-layer-geotiff.js +500 -0
- package/dist/collection/components/v-map-layer-geotiff/v-map-layer-geotiff.test.js +38 -0
- package/dist/collection/components/v-map-layer-google/v-map-layer-google.css +1 -0
- package/dist/collection/components/v-map-layer-google/v-map-layer-google.js +442 -0
- package/dist/collection/components/v-map-layer-osm/error-api.test.js +108 -0
- package/dist/collection/components/v-map-layer-osm/v-map-layer-osm.css +4 -0
- package/dist/collection/components/v-map-layer-osm/v-map-layer-osm.js +311 -0
- package/dist/collection/components/v-map-layer-osm/v-map-layer-osm.test.js +36 -0
- package/dist/collection/components/v-map-layer-scatterplot/v-map-layer-scatterplot.css +1 -0
- package/dist/collection/components/v-map-layer-scatterplot/v-map-layer-scatterplot.js +305 -0
- package/dist/collection/components/v-map-layer-terrain/v-map-layer-terrain.css +3 -0
- package/dist/collection/components/v-map-layer-terrain/v-map-layer-terrain.js +548 -0
- package/dist/collection/components/v-map-layer-terrain/v-map-layer-terrain.test.js +36 -0
- package/dist/collection/components/v-map-layer-terrain-geotiff/v-map-layer-terrain-geotiff.css +3 -0
- package/dist/collection/components/v-map-layer-terrain-geotiff/v-map-layer-terrain-geotiff.js +735 -0
- package/dist/collection/components/v-map-layer-terrain-geotiff/v-map-layer-terrain-geotiff.test.js +42 -0
- package/dist/collection/components/v-map-layer-tile3d/v-map-layer-tile3d.css +3 -0
- package/dist/collection/components/v-map-layer-tile3d/v-map-layer-tile3d.js +449 -0
- package/dist/collection/components/v-map-layer-tile3d/v-map-layer-tile3d.test.js +50 -0
- package/dist/collection/components/v-map-layer-wcs/v-map-layer-wcs.css +1 -0
- package/dist/collection/components/v-map-layer-wcs/v-map-layer-wcs.js +448 -0
- package/dist/collection/components/v-map-layer-wcs/v-map-layer-wcs.test.js +39 -0
- package/dist/collection/components/v-map-layer-wfs/v-map-layer-wfs.css +1 -0
- package/dist/collection/components/v-map-layer-wfs/v-map-layer-wfs.js +489 -0
- package/dist/collection/components/v-map-layer-wfs/v-map-layer-wfs.test.js +43 -0
- package/dist/collection/components/v-map-layer-wkt/v-map-layer-wkt.css +1 -0
- package/dist/collection/components/v-map-layer-wkt/v-map-layer-wkt.js +811 -0
- package/dist/collection/components/v-map-layer-wkt/v-map-layer-wkt.test.js +34 -0
- package/dist/collection/components/v-map-layer-wms/v-map-layer-wms.css +1 -0
- package/dist/collection/components/v-map-layer-wms/v-map-layer-wms.js +453 -0
- package/dist/collection/components/v-map-layer-wms/v-map-layer-wms.test.js +36 -0
- package/dist/collection/components/v-map-layer-xyz/v-map-layer-xyz.css +1 -0
- package/dist/collection/components/v-map-layer-xyz/v-map-layer-xyz.js +331 -0
- package/dist/collection/components/v-map-layer-xyz/v-map-layer-xyz.test.js +28 -0
- package/dist/collection/components/v-map-layercontrol/v-map-layercontrol.css +74 -0
- package/dist/collection/components/v-map-layercontrol/v-map-layercontrol.js +277 -0
- package/dist/collection/components/v-map-layercontrol/v-map-layercontrol.test.js +134 -0
- package/dist/collection/components/v-map-layergroup/v-map-layergroup.css +4 -0
- package/dist/collection/components/v-map-layergroup/v-map-layergroup.js +212 -0
- package/dist/collection/components/v-map-layergroup/v-map-layergroup.test.js +39 -0
- package/dist/collection/components/v-map-style/v-map-style.css +38 -0
- package/dist/collection/components/v-map-style/v-map-style.js +492 -0
- package/dist/collection/components/v-map-style/v-map-style.unit.js +62 -0
- package/dist/collection/index.js +1 -0
- package/dist/collection/layer/v-map-layer-helper.js +281 -0
- package/dist/collection/layer/v-map-layer-helper.unit.js +234 -0
- package/dist/collection/lib/cesium-loader.js +58 -0
- package/dist/collection/lib/ensure-importmap.js +12 -0
- package/dist/collection/lib/ensure-importmap.unit.js +57 -0
- package/dist/collection/lib/versions.gen.js +6 -0
- package/dist/collection/lib/vstyle.js +8 -0
- package/dist/collection/map-provider/cesium/CesiumGeoTIFFTerrainProvider.js +285 -0
- package/dist/collection/map-provider/cesium/CesiumLayerGroups.js +159 -0
- package/dist/collection/map-provider/cesium/GeoTIFFImageryProvider.js +192 -0
- package/dist/collection/map-provider/cesium/GeoTIFFImageryProvider.test.js +57 -0
- package/dist/collection/map-provider/cesium/cesium-provider.js +1408 -0
- package/dist/collection/map-provider/cesium/i-layer.js +1 -0
- package/dist/collection/map-provider/cesium/layer-manager.js +467 -0
- package/dist/collection/map-provider/deck/DeckGLGeoTIFFLayer.js +483 -0
- package/dist/collection/map-provider/deck/DeckGLGeoTIFFTerrainLayer.js +410 -0
- package/dist/collection/map-provider/deck/LayerGroupWithModel.js +169 -0
- package/dist/collection/map-provider/deck/LayerGroups.js +192 -0
- package/dist/collection/map-provider/deck/LayerModel.js +1 -0
- package/dist/collection/map-provider/deck/RenderableGroup.js +1 -0
- package/dist/collection/map-provider/deck/deck-provider.js +1563 -0
- package/dist/collection/map-provider/geotiff/geotiff-source.js +172 -0
- package/dist/collection/map-provider/geotiff/utils/AABB2D.js +24 -0
- package/dist/collection/map-provider/geotiff/utils/BVHNode2D.js +166 -0
- package/dist/collection/map-provider/geotiff/utils/GeoTIFFTileProcessor.js +484 -0
- package/dist/collection/map-provider/geotiff/utils/Triangle.js +1 -0
- package/dist/collection/map-provider/geotiff/utils/Triangulation.js +321 -0
- package/dist/collection/map-provider/geotiff/utils/colormap-utils.js +190 -0
- package/dist/collection/map-provider/geotiff/utils/normalization-utils.js +122 -0
- package/dist/collection/map-provider/geotiff/utils/sampling-utils.js +108 -0
- package/dist/collection/map-provider/leaflet/GeoTIFFGridLayer.js +147 -0
- package/dist/collection/map-provider/leaflet/WCSGridLayer.js +124 -0
- package/dist/collection/map-provider/leaflet/google-map-tiles-layer.js +352 -0
- package/dist/collection/map-provider/leaflet/leaflet-helpers.js +94 -0
- package/dist/collection/map-provider/leaflet/leaflet-provider.js +1095 -0
- package/dist/collection/map-provider/ol/CustomGeoTiff.js +145 -0
- package/dist/collection/map-provider/ol/openlayers-helper.js +26 -0
- package/dist/collection/map-provider/ol/openlayers-provider.js +1427 -0
- package/dist/collection/map-provider/provider-factory.js +44 -0
- package/dist/collection/map-provider/provider-factory.unit.js +66 -0
- package/dist/collection/testing/browser-test-utils.js +49 -0
- package/dist/collection/testing/e2e-testing.js +122 -0
- package/dist/collection/testing/e2e-utils.js +70 -0
- package/dist/collection/testing/geotiff-test-server.js +100 -0
- package/dist/collection/testing/mocks/geostyler-lyrx-parser.js +12 -0
- package/dist/collection/testing/mocks/geostyler-mapbox-parser.js +12 -0
- package/dist/collection/testing/mocks/geostyler-qgis-parser.js +12 -0
- package/dist/collection/testing/mocks/geostyler-sld-parser.js +13 -0
- package/dist/collection/testing/mocks/geostyler-style.js +5 -0
- package/dist/collection/testing/setupTests.browser.js +1 -0
- package/dist/collection/testing/setupTests.stencil.js +20 -0
- package/dist/collection/testing/setupTests.vitest.js +59 -0
- package/dist/collection/testing/stencil-testing-wrapper.js +43 -0
- package/dist/collection/testing/styleMock.js +1 -0
- package/dist/collection/types/color.js +1 -0
- package/dist/collection/types/cssmode.js +1 -0
- package/dist/collection/types/flavour.js +1 -0
- package/dist/collection/types/layerconfig.js +1 -0
- package/dist/collection/types/lonlat.js +1 -0
- package/dist/collection/types/mapinitoptions.js +1 -0
- package/dist/collection/types/mapprovider.js +1 -0
- package/dist/collection/types/provideroptions.js +1 -0
- package/dist/collection/types/styleconfig.js +19 -0
- package/dist/collection/types/styling.js +13 -0
- package/dist/collection/types/styling.unit.js +37 -0
- package/dist/collection/types/vmaplayer.js +1 -0
- package/dist/collection/utils/async-mutex.js +28 -0
- package/dist/collection/utils/diff.js +142 -0
- package/dist/collection/utils/diff.unit.js +59 -0
- package/dist/collection/utils/dom-env.js +43 -0
- package/dist/collection/utils/dom-env.unit.js +92 -0
- package/dist/collection/utils/events.js +8 -0
- package/dist/collection/utils/logger.js +183 -0
- package/dist/collection/utils/logger.unit.js +98 -0
- package/dist/collection/utils/messages.js +12 -0
- package/dist/collection/utils/spatial-utils.js +27 -0
- package/dist/collection/utils/spatial-utils.unit.js +24 -0
- package/dist/components/_commonjsHelpers.js +1 -0
- package/dist/components/cesium-provider.js +1 -0
- package/dist/components/deck-provider.js +1 -0
- package/dist/components/events.js +1 -0
- package/dist/components/geotiff-source.js +1 -0
- package/dist/components/geotiff.js +4 -0
- package/dist/components/index.browser.js +15 -0
- package/dist/components/index.d.ts +35 -0
- package/dist/components/index.js +1 -0
- package/dist/components/index2.js +1 -0
- package/dist/components/index3.js +1 -0
- package/dist/components/index4.js +1 -0
- package/dist/components/index5.js +1 -0
- package/dist/components/index6.js +1 -0
- package/dist/components/index7.js +1 -0
- package/dist/components/index8.js +7 -0
- package/dist/components/layer-extension.js +1 -0
- package/dist/components/leaflet-provider.js +1 -0
- package/dist/components/main-dist.js +1 -0
- package/dist/components/messages.js +1 -0
- package/dist/components/openlayers-provider.js +1 -0
- package/dist/components/polygon-layer.js +1 -0
- package/dist/components/scenegraph-layer.js +1 -0
- package/dist/components/styleconfig.js +1 -0
- package/dist/components/styling.js +1 -0
- package/dist/components/v-map-builder.d.ts +11 -0
- package/dist/components/v-map-builder.js +2 -0
- package/dist/components/v-map-layer-geojson.d.ts +11 -0
- package/dist/components/v-map-layer-geojson.js +1 -0
- package/dist/components/v-map-layer-geojson2.js +1 -0
- package/dist/components/v-map-layer-geotiff.d.ts +11 -0
- package/dist/components/v-map-layer-geotiff.js +1 -0
- package/dist/components/v-map-layer-geotiff2.js +1 -0
- package/dist/components/v-map-layer-google.d.ts +11 -0
- package/dist/components/v-map-layer-google.js +1 -0
- package/dist/components/v-map-layer-google2.js +1 -0
- package/dist/components/v-map-layer-helper.js +1 -0
- package/dist/components/v-map-layer-osm.d.ts +11 -0
- package/dist/components/v-map-layer-osm.js +1 -0
- package/dist/components/v-map-layer-osm2.js +1 -0
- package/dist/components/v-map-layer-scatterplot.d.ts +11 -0
- package/dist/components/v-map-layer-scatterplot.js +1 -0
- package/dist/components/v-map-layer-scatterplot2.js +1 -0
- package/dist/components/v-map-layer-terrain-geotiff.d.ts +11 -0
- package/dist/components/v-map-layer-terrain-geotiff.js +1 -0
- package/dist/components/v-map-layer-terrain.d.ts +11 -0
- package/dist/components/v-map-layer-terrain.js +1 -0
- package/dist/components/v-map-layer-terrain2.js +1 -0
- package/dist/components/v-map-layer-tile3d.d.ts +11 -0
- package/dist/components/v-map-layer-tile3d.js +1 -0
- package/dist/components/v-map-layer-tile3d2.js +1 -0
- package/dist/components/v-map-layer-wcs.d.ts +11 -0
- package/dist/components/v-map-layer-wcs.js +1 -0
- package/dist/components/v-map-layer-wcs2.js +1 -0
- package/dist/components/v-map-layer-wfs.d.ts +11 -0
- package/dist/components/v-map-layer-wfs.js +1 -0
- package/dist/components/v-map-layer-wfs2.js +1 -0
- package/dist/components/v-map-layer-wkt.d.ts +11 -0
- package/dist/components/v-map-layer-wkt.js +1 -0
- package/dist/components/v-map-layer-wkt2.js +1 -0
- package/dist/components/v-map-layer-wms.d.ts +11 -0
- package/dist/components/v-map-layer-wms.js +1 -0
- package/dist/components/v-map-layer-wms2.js +1 -0
- package/dist/components/v-map-layer-xyz.d.ts +11 -0
- package/dist/components/v-map-layer-xyz.js +1 -0
- package/dist/components/v-map-layer-xyz2.js +1 -0
- package/dist/components/v-map-layercontrol.d.ts +11 -0
- package/dist/components/v-map-layercontrol.js +1 -0
- package/dist/components/v-map-layergroup.d.ts +11 -0
- package/dist/components/v-map-layergroup.js +1 -0
- package/dist/components/v-map-layergroup2.js +1 -0
- package/dist/components/v-map-style.d.ts +11 -0
- package/dist/components/v-map-style.js +1 -0
- package/dist/components/v-map-style2.js +10 -0
- package/dist/components/v-map.d.ts +11 -0
- package/dist/components/v-map.js +1 -0
- package/dist/components/v-map2.js +1 -0
- package/dist/esm/_commonjsHelpers-E-ZsRS8r.js +32 -0
- package/dist/esm/app-globals-DQuL1Twl.js +3 -0
- package/dist/esm/cesium-provider-BJfAup3w.js +2596 -0
- package/dist/esm/deck-provider-C7U9VDEq.js +47709 -0
- package/dist/esm/geotiff-BEWxTIfH.js +45 -0
- package/dist/esm/geotiff-source-esnDnC-u.js +1516 -0
- package/dist/esm/index-B1zwA4IC.js +685 -0
- package/dist/esm/index-BBpiaTpT.js +165 -0
- package/dist/esm/index-BIEmlzCf.js +1697 -0
- package/dist/esm/index-BUHa4Jj0.js +307 -0
- package/dist/esm/index-DbSdn93t.js +20461 -0
- package/dist/esm/index-RpJarvr_.js +10656 -0
- package/dist/esm/index-jN06TXUp.js +14 -0
- package/dist/esm/index-jzneDarq.js +1613 -0
- package/dist/esm/index.browser-DhQAXuA7.js +6860 -0
- package/dist/esm/index.js +1 -0
- package/dist/esm/layer-extension-CZXK5goK.js +63 -0
- package/dist/esm/leaflet-provider-Q41TB6ku.js +1794 -0
- package/dist/esm/loader.js +11 -0
- package/dist/esm/main-dist-CwnA7_Xn.js +2652 -0
- package/dist/esm/messages-CMKJzsgL.js +180 -0
- package/dist/esm/openlayers-provider-CMsDsQTQ.js +1602 -0
- package/dist/esm/polygon-layer-ByhxGhWC.js +1295 -0
- package/dist/esm/scenegraph-layer-09K_B6DT.js +2526 -0
- package/dist/esm/styleconfig-B-bAcABs.js +21 -0
- package/dist/esm/v-map-builder.entry.js +3784 -0
- package/dist/esm/v-map-layer-geojson_12.entry.js +40881 -0
- package/dist/esm/v-map-layer-helper-Dys44Cgo.js +283 -0
- package/dist/esm/v-map-layer-terrain-geotiff.entry.js +256 -0
- package/dist/esm/v-map-layercontrol.entry.js +245 -0
- package/dist/esm/v-map.js +21 -0
- package/dist/esm/v-map.v-map-layer-osm.v-map-layergroup-B4pFHuSf.js +572 -0
- package/dist/esm/v-map_3.entry.js +4 -0
- package/dist/index.cjs.js +1 -0
- package/dist/index.js +1 -0
- package/dist/types/cesium-augment.d.ts +5 -0
- package/dist/types/components/v-map/v-map.d.ts +70 -0
- package/dist/types/components/v-map/v-map.test.d.ts +1 -0
- package/dist/types/components/v-map-builder/v-map-builder.d.ts +48 -0
- package/dist/types/components/v-map-builder/v-map-builder.test.d.ts +1 -0
- package/dist/types/components/v-map-layer-geojson/v-map-layer-geojson.d.ts +129 -0
- package/dist/types/components/v-map-layer-geojson/v-map-layer-geojson.test.d.ts +1 -0
- package/dist/types/components/v-map-layer-geotiff/v-map-layer-geotiff.d.ts +74 -0
- package/dist/types/components/v-map-layer-geotiff/v-map-layer-geotiff.test.d.ts +1 -0
- package/dist/types/components/v-map-layer-google/v-map-layer-google.d.ts +78 -0
- package/dist/types/components/v-map-layer-osm/error-api.test.d.ts +1 -0
- package/dist/types/components/v-map-layer-osm/v-map-layer-osm.d.ts +50 -0
- package/dist/types/components/v-map-layer-osm/v-map-layer-osm.test.d.ts +1 -0
- package/dist/types/components/v-map-layer-scatterplot/v-map-layer-scatterplot.d.ts +54 -0
- package/dist/types/components/v-map-layer-terrain/v-map-layer-terrain.d.ts +74 -0
- package/dist/types/components/v-map-layer-terrain/v-map-layer-terrain.test.d.ts +1 -0
- package/dist/types/components/v-map-layer-terrain-geotiff/v-map-layer-terrain-geotiff.d.ts +117 -0
- package/dist/types/components/v-map-layer-terrain-geotiff/v-map-layer-terrain-geotiff.test.d.ts +1 -0
- package/dist/types/components/v-map-layer-tile3d/v-map-layer-tile3d.d.ts +69 -0
- package/dist/types/components/v-map-layer-tile3d/v-map-layer-tile3d.test.d.ts +1 -0
- package/dist/types/components/v-map-layer-wcs/v-map-layer-wcs.d.ts +47 -0
- package/dist/types/components/v-map-layer-wcs/v-map-layer-wcs.test.d.ts +1 -0
- package/dist/types/components/v-map-layer-wfs/v-map-layer-wfs.d.ts +59 -0
- package/dist/types/components/v-map-layer-wfs/v-map-layer-wfs.test.d.ts +1 -0
- package/dist/types/components/v-map-layer-wkt/v-map-layer-wkt.d.ts +132 -0
- package/dist/types/components/v-map-layer-wkt/v-map-layer-wkt.test.d.ts +1 -0
- package/dist/types/components/v-map-layer-wms/v-map-layer-wms.d.ts +76 -0
- package/dist/types/components/v-map-layer-wms/v-map-layer-wms.test.d.ts +1 -0
- package/dist/types/components/v-map-layer-xyz/v-map-layer-xyz.d.ts +59 -0
- package/dist/types/components/v-map-layer-xyz/v-map-layer-xyz.test.d.ts +1 -0
- package/dist/types/components/v-map-layercontrol/v-map-layercontrol.d.ts +44 -0
- package/dist/types/components/v-map-layercontrol/v-map-layercontrol.test.d.ts +1 -0
- package/dist/types/components/v-map-layergroup/v-map-layergroup.d.ts +31 -0
- package/dist/types/components/v-map-layergroup/v-map-layergroup.test.d.ts +1 -0
- package/dist/types/components/v-map-style/v-map-style.d.ts +75 -0
- package/dist/types/components/v-map-style/v-map-style.unit.d.ts +1 -0
- package/dist/types/components.d.ts +2391 -0
- package/dist/types/globals.d.ts +16 -0
- package/dist/types/index.d.ts +10 -0
- package/dist/types/layer/v-map-layer-helper.d.ts +45 -0
- package/dist/types/layer/v-map-layer-helper.unit.d.ts +1 -0
- package/dist/types/leaflet-augment.d.ts +15 -0
- package/dist/types/lib/cesium-loader.d.ts +3 -0
- package/dist/types/lib/ensure-importmap.d.ts +3 -0
- package/dist/types/lib/ensure-importmap.unit.d.ts +1 -0
- package/dist/types/lib/versions.gen.d.ts +5 -0
- package/dist/types/lib/vstyle.d.ts +44 -0
- package/dist/types/map-provider/cesium/CesiumGeoTIFFTerrainProvider.d.ts +92 -0
- package/dist/types/map-provider/cesium/CesiumLayerGroups.d.ts +64 -0
- package/dist/types/map-provider/cesium/GeoTIFFImageryProvider.d.ts +75 -0
- package/dist/types/map-provider/cesium/GeoTIFFImageryProvider.test.d.ts +1 -0
- package/dist/types/map-provider/cesium/cesium-provider.d.ts +87 -0
- package/dist/types/map-provider/cesium/i-layer.d.ts +11 -0
- package/dist/types/map-provider/cesium/layer-manager.d.ts +31 -0
- package/dist/types/map-provider/deck/DeckGLGeoTIFFLayer.d.ts +91 -0
- package/dist/types/map-provider/deck/DeckGLGeoTIFFTerrainLayer.d.ts +82 -0
- package/dist/types/map-provider/deck/LayerGroupWithModel.d.ts +55 -0
- package/dist/types/map-provider/deck/LayerGroups.d.ts +63 -0
- package/dist/types/map-provider/deck/LayerModel.d.ts +8 -0
- package/dist/types/map-provider/deck/RenderableGroup.d.ts +20 -0
- package/dist/types/map-provider/deck/deck-provider.d.ts +92 -0
- package/dist/types/map-provider/geotiff/geotiff-source.d.ts +30 -0
- package/dist/types/map-provider/geotiff/utils/AABB2D.d.ts +28 -0
- package/dist/types/map-provider/geotiff/utils/BVHNode2D.d.ts +36 -0
- package/dist/types/map-provider/geotiff/utils/GeoTIFFTileProcessor.d.ts +116 -0
- package/dist/types/map-provider/geotiff/utils/Triangle.d.ts +5 -0
- package/dist/types/map-provider/geotiff/utils/Triangulation.d.ts +94 -0
- package/dist/types/map-provider/geotiff/utils/colormap-utils.d.ts +47 -0
- package/dist/types/map-provider/geotiff/utils/normalization-utils.d.ts +39 -0
- package/dist/types/map-provider/geotiff/utils/sampling-utils.d.ts +13 -0
- package/dist/types/map-provider/leaflet/GeoTIFFGridLayer.d.ts +34 -0
- package/dist/types/map-provider/leaflet/WCSGridLayer.d.ts +38 -0
- package/dist/types/map-provider/leaflet/google-map-tiles-layer.d.ts +73 -0
- package/dist/types/map-provider/leaflet/leaflet-helpers.d.ts +6 -0
- package/dist/types/map-provider/leaflet/leaflet-provider.d.ts +73 -0
- package/dist/types/map-provider/ol/CustomGeoTiff.d.ts +14 -0
- package/dist/types/map-provider/ol/openlayers-helper.d.ts +2 -0
- package/dist/types/map-provider/ol/openlayers-provider.d.ts +80 -0
- package/dist/types/map-provider/provider-factory.d.ts +12 -0
- package/dist/types/map-provider/provider-factory.unit.d.ts +1 -0
- package/dist/types/namespaces.d.ts +3 -0
- package/dist/types/ol-augment.d.ts +3 -0
- package/dist/types/ol-override.d.ts +7 -0
- package/dist/types/ol.d.ts +10 -0
- package/dist/types/stencil-public-runtime.d.ts +1860 -0
- package/dist/types/testing/browser-test-utils.d.ts +6 -0
- package/dist/types/testing/e2e-testing.d.ts +5 -0
- package/dist/types/testing/e2e-utils.d.ts +4 -0
- package/dist/types/testing/geotiff-test-server.d.ts +5 -0
- package/dist/types/testing/mocks/geostyler-lyrx-parser.d.ts +11 -0
- package/dist/types/testing/mocks/geostyler-mapbox-parser.d.ts +11 -0
- package/dist/types/testing/mocks/geostyler-qgis-parser.d.ts +11 -0
- package/dist/types/testing/mocks/geostyler-sld-parser.d.ts +11 -0
- package/dist/types/testing/mocks/geostyler-style.d.ts +5 -0
- package/dist/types/testing/setupTests.browser.d.ts +1 -0
- package/dist/types/testing/setupTests.stencil.d.ts +1 -0
- package/dist/types/testing/setupTests.vitest.d.ts +1 -0
- package/dist/types/testing/stencil-testing-wrapper.d.ts +3 -0
- package/dist/types/types/color.d.ts +1 -0
- package/dist/types/types/cssmode.d.ts +1 -0
- package/dist/types/types/flavour.d.ts +1 -0
- package/dist/types/types/layerconfig.d.ts +207 -0
- package/dist/types/types/lonlat.d.ts +1 -0
- package/dist/types/types/mapinitoptions.d.ts +4 -0
- package/dist/types/types/mapprovider.d.ts +46 -0
- package/dist/types/types/provideroptions.d.ts +8 -0
- package/dist/types/types/styleconfig.d.ts +27 -0
- package/dist/types/types/styling.d.ts +24 -0
- package/dist/types/types/styling.unit.d.ts +1 -0
- package/dist/types/types/vmaplayer.d.ts +10 -0
- package/dist/types/utils/async-mutex.d.ts +7 -0
- package/dist/types/utils/diff.d.ts +64 -0
- package/dist/types/utils/diff.unit.d.ts +1 -0
- package/dist/types/utils/dom-env.d.ts +5 -0
- package/dist/types/utils/dom-env.unit.d.ts +1 -0
- package/dist/types/utils/events.d.ts +29 -0
- package/dist/types/utils/logger.d.ts +47 -0
- package/dist/types/utils/logger.unit.d.ts +1 -0
- package/dist/types/utils/messages.d.ts +12 -0
- package/dist/types/utils/spatial-utils.d.ts +6 -0
- package/dist/types/utils/spatial-utils.unit.d.ts +1 -0
- package/dist/types/versions.d.ts +7 -0
- package/dist/v-map/index.esm.js +0 -0
- package/dist/v-map/p--vVleK-M.js +1 -0
- package/dist/v-map/p-09d10db0.entry.js +1 -0
- package/dist/v-map/p-5eba6058.entry.js +10 -0
- package/dist/v-map/p-6b102336.entry.js +1 -0
- package/dist/v-map/p-B-bAcABs.js +1 -0
- package/dist/v-map/p-BBpiaTpT.js +1 -0
- package/dist/v-map/p-BdijL4Av.js +1 -0
- package/dist/v-map/p-Be3r33VF.js +4 -0
- package/dist/v-map/p-BeFu0ap4.js +1 -0
- package/dist/v-map/p-BxFJezdK.js +1 -0
- package/dist/v-map/p-CMKJzsgL.js +1 -0
- package/dist/v-map/p-CXfA_q8m.js +1 -0
- package/dist/v-map/p-CZqY0yW4.js +1 -0
- package/dist/v-map/p-CafTHT9i.js +1 -0
- package/dist/v-map/p-DCTHyf58.js +1 -0
- package/dist/v-map/p-DQuL1Twl.js +1 -0
- package/dist/v-map/p-DR9McdNX.js +1 -0
- package/dist/v-map/p-Dckgonw8.js +1 -0
- package/dist/v-map/p-DhQAXuA7.js +15 -0
- package/dist/v-map/p-DmICdG34.js +7 -0
- package/dist/v-map/p-DrOQ9V4h.js +1 -0
- package/dist/v-map/p-DvHXtWUg.js +1 -0
- package/dist/v-map/p-E-ZsRS8r.js +1 -0
- package/dist/v-map/p-MyTSFnEk.js +1 -0
- package/dist/v-map/p-RpJarvr_.js +1 -0
- package/dist/v-map/p-WaMDUuAz.js +1 -0
- package/dist/v-map/p-aa410e64.entry.js +2 -0
- package/dist/v-map/p-c21c93fe.entry.js +1 -0
- package/dist/v-map/p-jzneDarq.js +2 -0
- package/dist/v-map/p-uiIP-taz.js +1 -0
- package/dist/v-map/v-map.esm.js +1 -0
- package/loader/cdn.js +1 -0
- package/loader/index.cjs.js +1 -0
- package/loader/index.d.ts +24 -0
- package/loader/index.es2017.js +1 -0
- package/loader/index.js +2 -0
- package/package.json +193 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const N={COMPONENT_CONNECTED_CALLBACK:"connectedCallback",COMPONENT_WILL_LOAD:"componentWillLoad",COMPONENT_WILL_RENDER:"componentWillRender",COMPONENT_RENDER:"render",COMPONENT_DID_RENDER:"componentDidRender",COMPONENT_DID_LOAD:"componentDidLoad",COMPONENT_DISCONNECTED_CALLBACK:"disconnectedCallback"};export{N as M}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import e from"ol/Map";import t from"ol/View";import r from"ol/layer/Vector";import o from"ol/layer/Group";import s from"ol/layer/Tile";import n from"ol/layer/Image";import a from"ol/source/Vector";import i from"ol/source/TileWMS";import c from"ol/source/OSM";import l from"ol/source/XYZ";import u from"ol/source/Google";import f from"ol/source/TileArcGISRest";import w from"ol/Image";import y from"ol/source/Image";import h from"ol/format/GeoJSON";import m from"ol/format/GML2";import p from"ol/format/GML3";import d from"ol/format/GML32";import g from"ol/format/WKT";import b from"ol/control/Control";import S from"ol/style/Style";import L from"ol/style/Fill";import G from"ol/style/Stroke";import I from"ol/style/Circle";import v from"ol/style/Icon";import j from"ol/style/Text";import{bbox as E}from"ol/loadingstrategy";import{get as k,fromLonLat as F}from"ol/proj";import{D as $}from"./styleconfig.js";import{w as P,e as T,l as x}from"./events.js";import{O as W}from"./v-map2.js";import C from"./index4.js";import O from"ol/source/GeoTIFF";import{g as M}from"./main-dist.js";import{register as R}from"ol/proj/proj4";import N from"ol/layer/WebGLTile";async function z(e){return class extends O{geoKeys_=null;constructor(){super(e)}async getGeoKeys(){if(null!==this.geoKeys_)return this.geoKeys_;await this.getView();const e=this.sourceImagery_;return e&&e.length>0&&this.determineGeoKeys(e),this.geoKeys_}determineGeoKeys(e){if(!e||0===e.length)return;const t=e[0];for(let e=t.length-1;e>=0;--e){const o="function"==typeof(r=t[e]).getGeoKeys?r.getGeoKeys()||null:r.geoKeys||null;if(o){this.geoKeys_=o;break}}var r}async getProjectionParameters(){const e=await this.getGeoKeys();return e?M.toProj4(e):null}async getProj4String(){const e=await this.getProjectionParameters();return e&&e.proj4||null}async registerProjectionIfNeeded(){try{const e=await this.getProj4String(),t=this.getProjection()?.getCode();return k(t)||(null===e?(P(`Can not get proj string for code: ${t}`),null):(C.defs(t,e),R(C),k(t)))}catch(e){return T("Fehler bei der Registrierung der Projektion:",e),null}}}}class A{map;layers=[];baseLayers=[];googleLogoAdded=!1;projection="EPSG:3857";layerErrorCallbacks=new globalThis.Map;layerErrorCleanups=new globalThis.Map;async init(r){await async function(e){if(!e)return;const t="ol-css-sheet";if(e.querySelector(`style[data-id="${t}"]`))return;const r=`https://cdn.jsdelivr.net/npm/ol@${W}/ol.css`,o=await(await fetch(r)).text();if("adoptedStyleSheets"in Document.prototype){const t=new CSSStyleSheet;await t.replace(o),e.adoptedStyleSheets=[...e.adoptedStyleSheets??[],t]}else{const r=document.createElement("style");r.setAttribute("data-id",t),r.textContent=o,e.appendChild(r)}}(r.shadowRoot),Object.assign(r.target.style,{width:"100%",height:"100%",position:"relative",background:"#fff"}),this.map=new e({target:r.target,layers:[],view:new t({projection:this.projection,center:F(r?.mapInitOptions?.center??[0,0]),zoom:r?.mapInitOptions?.zoom??2})}),new ResizeObserver((()=>this.map?.updateSize())).observe(r.target)}async destroy(){this.map?.setTarget(void 0),this.map=void 0}async updateLayer(e,t){const r=await this._getLayerById(e);switch(t.type){case"geojson":await this.updateGeoJSONLayer(r,t.data);break;case"osm":await this.updateOSMLayer(r,t.data);break;case"wms":await this.updateWMSLayer(r,t.data);break;case"wfs":await this.updateWFSLayer(r,t.data);break;case"wcs":await this.updateWCSLayer(r,t.data);break;case"arcgis":await this.updateArcGISLayer(r,t.data);break;case"wkt":await this.updateWKTLayer(r,t.data);break;case"geotiff":await this.updateGeoTIFFLayer(r,t.data)}}async ensureGroup(e,t,r){await this._ensureGroup(e,t)}async _ensureGroup(e,t){if(!this.map)return null;let r=this.layers.find((t=>t.get?.("groupId")===e));return r||(r=new o({layers:[],properties:{groupId:e,visible:void 0===typeof t||t}}),this.map.addLayer(r),this.layers.push(r)),r}async setBaseLayer(e,t){if(null===t)return void x("ol - setBaseLayer - layerElementId is null.");const r=this.layers.find((t=>t.get?.("groupId")===e)),o=this.baseLayers.find((e=>e.get("layerElementId")===t));void 0!==o?(r.getLayers().clear(),r.getLayers().push(o)):x("ol - setBaseLayer - layer not found. layerElementId: "+t)}async addBaseLayer(e,t,r){if(null==r)return x("ol - addBaseLayer - layerElementId not set."),null;null==t&&x("ol - addBaseLayer - basemapid not set.");const o=await this._ensureGroup(e.groupId,e.groupVisible);if(null==o)return null;o.set("basemap",!0,!1);const s=await this.createLayer(e);if(null==s)return null;s.set("group",o),this.baseLayers.push(s);let n=null;if(s){n=crypto.randomUUID(),s.set("id",n,!1),s.set("layerElementId",r,!1);const a=e;void 0!==a.opacity&&s.setOpacity(a.opacity),void 0!==a.zIndex&&s.setZIndex(a.zIndex),a.visible?s.setVisible(!0):!1===a.visible&&s.setVisible(!1),t===r&&(o.getLayers().clear(),o.getLayers().push(s))}return n}async addLayerToGroup(e){const t=await this._ensureGroup(e.groupId,e.groupVisible);if(null==t)return null;const r=await this.createLayer(e);if(null===r)return null;r.set("group",t),t.getLayers().push(r);const o=crypto.randomUUID();r.set("id",o,!1);const s=e;return void 0!==s.opacity&&r.setOpacity(s.opacity),void 0!==s.zIndex&&r.setZIndex(s.zIndex),s.visible?r.setVisible(!0):!1===s.visible&&r.setVisible(!1),o}async createLayer(e){switch(e.type){case"geojson":return this.createGeoJSONLayer(e);case"xyz":return this.createXYZLayer(e);case"google":return this.createGoogleLayer(e);case"osm":return this.createOSMLayer(e);case"wms":return this.createWMSLayer(e);case"wfs":return this.createWFSLayer(e);case"wcs":return this.createWCSLayer(e);case"arcgis":return this.createArcGISLayer(e);case"wkt":return this.createWKTLayer(e);case"geotiff":return this.createGeoTIFFLayer(e);default:throw new Error(`Unsupported layer type: ${e.type}`)}}async updateWMSLayer(e,t){e.setSource(new i({url:t.url,params:{LAYERS:t.layers,TILED:!0,...t.extraParams??{}}}))}async updateOSMLayer(e,t){let r="https://tile.openstreetmap.org/{z}/{x}/{y}.png";t.url&&(r=t.url+"/{z}/{x}/{y}.png"),e.setSource(new c({url:r}))}async updateGeoJSONLayer(e,t){let r=null;const o={featureProjection:this.projection};if(t.geojson){const e=JSON.parse(t.geojson);r=new a({features:new h(o).readFeatures(e)})}else r=new a({url:t.url,format:new h(o)});let s;e.setSource(r),t.geostylerStyle?s=await this.createGeostylerStyleFunction(t.geostylerStyle):t.style&&(s=await this.createEnhancedStyleFunction(t.style)),s&&e.setStyle(s)}async updateWFSLayer(e,t){const r=this.mergeLayerConfig(e,"wfsConfig",t),o=await this.createWFSSpource(r);let s;e.setSource(o),r.geostylerStyle?s=await this.createGeostylerStyleFunction(r.geostylerStyle):r.style&&(s=await this.createEnhancedStyleFunction(r.style)),s&&e.setStyle(s)}async updateWCSLayer(e,t){const r=this.mergeLayerConfig(e,"wcsConfig",t),o=await this.createWcsSource(r);e.setSource(o)}async updateArcGISLayer(e,t){const r=e,o=r.getSource(),s={...o?.getParams?.()??{},...t?.params??{}};t?.token&&(s.token=t.token);const n={url:t?.url??o?.getUrls?.()?.[0],params:s,...t?.options??{}},a=new f(n);r.setSource(a)}async createEnhancedStyleFunction(e){function t(e,t){if(e.startsWith("rgba")){const r=e.match(/rgba?\((\d+),\s*(\d+),\s*(\d+)/);if(r){const[,e,o,s]=r;return`rgba(${e}, ${o}, ${s}, ${t})`}}else if(e.startsWith("rgb")){const r=e.match(/rgb\((\d+),\s*(\d+),\s*(\d+)\)/);if(r){const[,e,o,s]=r;return`rgba(${e}, ${o}, ${s}, ${t})`}}else if(e.startsWith("#")){const r=e.slice(1);return`rgba(${parseInt(r.slice(0,2),16)}, ${parseInt(r.slice(2,4),16)}, ${parseInt(r.slice(4,6),16)}, ${t})`}return e}return r=>{const o=[],s=r.getGeometry().getType(),n=new L({color:t(e.fillColor??"rgba(0,100,255,0.3)",e.fillOpacity??.3)}),a=e.strokeWidth??2,i=new G({color:t(e.strokeColor??"rgba(0,100,255,1)",e.strokeOpacity??1),width:a,lineDash:e.strokeDashArray});if(o.push(new S("Point"===s?e.iconUrl?{image:new v({src:e.iconUrl,size:e.iconSize||[32,32],anchor:e.iconAnchor||[.5,1]})}:{image:new I({radius:e.pointRadius??6,fill:new L({color:t(e.pointColor??"rgba(0,100,255,1)",e.pointOpacity??1)}),stroke:i})}:{fill:s.includes("Polygon")?n:void 0,stroke:i})),e.textProperty&&r.get(e.textProperty)){const t=e.textColor??"#000000",s=e.textSize??12,n=e.textHaloColor,a=e.textHaloWidth??2,i=e.textOffset||[0,0];o.push(new S({text:new j({text:String(r.get(e.textProperty)),font:`${s}px Arial`,fill:new L({color:t}),stroke:n?new G({color:n,width:a}):void 0,offsetX:i[0],offsetY:i[1]})}))}return o}}async createGeoJSONLayer(e){let t=null;const o={featureProjection:this.projection};if(e.geojson){const r=JSON.parse(e.geojson);t=new a({features:new h(o).readFeatures(r)})}else t=new a({url:e.url,format:new h(o)});let s;if(e.geostylerStyle)s=await this.createGeostylerStyleFunction(e.geostylerStyle);else{const t=e.style?{...$,...e.style}:$;s=await this.createEnhancedStyleFunction(t)}return new r({source:t,style:s})}async createWFSSpource(e){const t=(e.outputFormat??"application/json").toLowerCase();let r=new h;switch(t){case"gml2":r=new m;break;case"gml3":r=new p;break;case"gml32":r=new d}const o=this.getWFSGetFeatureUrl(e);return new a({format:r,url:o,strategy:E})}async createWFSLayer(e){const t=await this.createWFSSpource(e);let o;if(e.geostylerStyle)o=await this.createGeostylerStyleFunction(e.geostylerStyle);else{const t=e.style?{...$,...e.style}:$;o=await this.createEnhancedStyleFunction(t)}const s=new r({source:t,style:o});return s.set("wfsConfig",e,!1),s}async createGeostylerStyleFunction(e){const t=(e,t)=>null==e||"object"==typeof e&&e.name?t:e;return r=>{const o=[],s=r.getGeometry().getType();if(e.rules)for(const n of e.rules)if(n.symbolizers)for(const e of n.symbolizers)switch(e.kind){case"Fill":if(s.includes("Polygon")){const r=t(e.color,"rgba(0,100,255,0.3)"),s=t(e.outlineColor),n=t(e.outlineWidth,1);o.push(new S({fill:new L({color:r}),stroke:s?new G({color:s,width:n}):void 0}))}break;case"Line":{const r=t(e.color,"rgba(0,100,255,1)"),s=t(e.width,1),n=e.dasharray&&Array.isArray(e.dasharray)?e.dasharray.map((e=>t(e,0))):void 0;o.push(new S({stroke:new G({color:r,width:s,lineDash:n})}))}break;case"Mark":if("Point"===s){const r=t(e.color,"rgba(0,100,255,1)"),s=t(e.radius,6),n=t(e.strokeColor),a=t(e.strokeWidth,1);o.push(new S({image:new I({radius:s,fill:new L({color:r}),stroke:n?new G({color:n,width:a}):void 0})}))}break;case"Icon":if("Point"===s){const r=t(e.image),s=t(e.size,32),n=t(e.opacity,1);r&&"string"==typeof r&&o.push(new S({image:new v({src:r,size:[s,s],opacity:n})}))}break;case"Text":{const s=e,n=t(s.label);if(n&&r.get(n)){const e=t(s.color,"#000000"),a=t(s.size,12),i=t(s.font?.[0],"Arial"),c=t(s.haloColor),l=t(s.haloWidth,1),u=s.offset,f=u&&Array.isArray(u)?t(u[0],0):0,w=u&&Array.isArray(u)?t(u[1],0):0;o.push(new S({text:new j({text:String(r.get(n)),font:`${a}px ${i}`,fill:new L({color:e}),stroke:c?new G({color:c,width:l}):void 0,offsetX:f,offsetY:w})}))}}}return o.length>0?o:void 0}}async createXYZLayer(e){return new s({source:new l({url:e.url,attributions:e.attributions,maxZoom:e.maxZoom??19,...e.options??{}})})}async createGoogleLayer(e){if(!e.apiKey)throw new Error("Google-Layer benötigt 'apiKey' (Google Maps Platform).");const t=new u({key:e.apiKey,mapType:e.mapType??"roadmap",scale:e.scale??"scaleFactor2x",highDpi:e.highDpi??!0,language:e.language,region:e.region,imageFormat:e.imageFormat,styles:e.styles,layerTypes:e.layerTypes});t.on("change",(()=>{if("error"===t.getState()){const e=t.getError();T("Google source error",e),this.map.getTargetElement()?.dispatchEvent(new CustomEvent("google-source-error",{detail:{message:e??"Google source error"},bubbles:!0,composed:!0}))}}));const r=new s({source:t});if(!this.googleLogoAdded){class e extends b{constructor(){const e=document.createElement("img");e.style.pointerEvents="none",e.style.position="absolute",e.style.bottom="5px",e.style.left="5px",e.style.height="18px",e.alt="Google",e.src="https://developers.google.com/static/maps/documentation/images/google_on_white.png",super({element:e})}}this.map.addControl(new e),this.googleLogoAdded=!0}return r}async createOSMLayer(e){let t="https://tile.openstreetmap.org/{z}/{x}/{y}.png";return e.url&&(t=e.url+"/{z}/{x}/{y}.png"),new s({source:new c({url:t})})}async createWMSLayer(e){return new s({source:new i({url:e.url,params:{LAYERS:e.layers,TILED:!0,...e.extraParams??{}}})})}onLayerError(e,t){this.layerErrorCallbacks.set(e,t),this._getLayerById(e).then((t=>{t&&this.attachSourceErrorListeners(e,t)}))}offLayerError(e){this.layerErrorCleanups.get(e)?.(),this.layerErrorCleanups.delete(e),this.layerErrorCallbacks.delete(e)}attachSourceErrorListeners(e,t){this.layerErrorCleanups.get(e)?.();const r=this.layerErrorCallbacks.get(e);if(!r)return;const o=t.getSource?.();if(!o)return;const s=[];if("getTile"in o||o instanceof i||o instanceof c||o instanceof l||o instanceof u||o instanceof f){const e=()=>{r({type:"network",message:"Tile load error"})};o.on("tileloaderror",e),s.push((()=>o.un("tileloaderror",e)))}if(o instanceof a){const e=()=>{r({type:"network",message:"Feature load error"})};o.on("featuresloaderror",e),s.push((()=>o.un("featuresloaderror",e)))}if(o instanceof y){const e=()=>{r({type:"network",message:"Image load error"})};o.on("imageloaderror",e),s.push((()=>o.un("imageloaderror",e)))}const n=()=>{this.attachSourceErrorListeners(e,t)};t.on("change:source",n),s.push((()=>t.un("change:source",n))),this.layerErrorCleanups.set(e,(()=>s.forEach((e=>e()))))}async setView(e,t){this.map&&this.map.getView().animate({center:F(e),zoom:t,duration:0})}async _forEachLayer(e,t){if(e instanceof o){const r=e.getLayers().getArray();for(const e of r)if(await this._forEachLayer(e,t))return!0}else if(t(e))return!0;return!1}async _getLayerById(e){if(!this.map)return null;let t=null;return await this._forEachLayer(this.map.getLayerGroup(),(r=>{if(r.get("id")===e)return t=r,!0})),t||(t=this.baseLayers.find((t=>t.get("id")===e)),void 0===t?null:t)}async _getLayerGroupById(e){if(!this.map)return null;const t=this.layers.find((t=>t.get?.("groupId")===e));return void 0!==t?t:null}async removeLayer(e){if(!e)return;this.offLayerError(e);const t=await this._getLayerById(e);if(t){const e=t.get("group");e&&e.getLayers().remove(t)}}async setOpacity(e,t){if(!e)return;const r=await this._getLayerById(e);r&&r.setOpacity(t)}async setZIndex(e,t){if(!e)return;const r=await this._getLayerById(e);r&&r.setZIndex(t)}async setVisible(e,t){const r=await this._getLayerById(e);r&&r.setVisible(t)}async setGroupVisible(e,t){const r=await this._getLayerGroupById(e);r&&r.setVisible(t)}async updateWKTLayer(e,t){const r=new g;let o=null;const s=this.map?.getView()?.getProjection();if(t.wkt){const e=r.readFeature(t.wkt,{dataProjection:"EPSG:4326",featureProjection:s});o=new a({features:[e]})}else if(t.url){const e=await fetch(t.url);if(!e.ok)throw new Error(`Failed to fetch WKT: ${e.status}`);const n=await e.text(),i=r.readFeature(n,{dataProjection:"EPSG:4326",featureProjection:s});o=new a({features:[i]})}let n;o&&e.setSource(o),t.geostylerStyle?n=await this.createGeostylerStyleFunction(t.geostylerStyle):t.style&&(n=await this.createEnhancedStyleFunction(t.style)),n&&e.setStyle(n)}async createWKTLayer(e){const t=new g;let o=null;const s=this.map?.getView()?.getProjection();if(e.wkt)try{const r=t.readFeature(e.wkt,{dataProjection:"EPSG:4326",featureProjection:s});o=new a({features:[r]})}catch(e){T("Failed to parse WKT:",e),o=new a({features:[]})}else if(e.url)try{const r=await fetch(e.url);if(!r.ok)throw new Error(`Failed to fetch WKT: ${r.status}`);const n=await r.text(),i=t.readFeature(n,{dataProjection:"EPSG:4326",featureProjection:s});o=new a({features:[i]})}catch(e){T("Failed to load WKT from URL:",e),o=new a({features:[]})}else o=new a({features:[]});let n;if(e.geostylerStyle)n=await this.createGeostylerStyleFunction(e.geostylerStyle);else{const t=e.style?{...$,...e.style}:$;n=await this.createEnhancedStyleFunction(t)}return new r({source:o,style:n,opacity:e.opacity??1,visible:e.visible??!0,zIndex:e.zIndex??1e3})}async createGeoTIFFLayer(e){if(!e.url)throw new Error("GeoTIFF layer requires a URL");const t={url:e.url};null===e.nodata||isNaN(e.nodata)||(t.nodata=e.nodata);const r=new(await z({sources:[t],wrapX:!1}));return await r.registerProjectionIfNeeded(),new N({source:r,opacity:e.opacity??1,visible:e.visible??!0,zIndex:e.zIndex??100})}async createWCSLayer(e){const t=await this.createWcsSource(e),r=new n({source:t,visible:e.visible??!0,opacity:e.opacity??1});return r.set("wcsConfig",e,!1),r}getWFSGetFeatureUrl(e){return t=>{const r={service:"WFS",request:"GetFeature",version:e.version??"1.1.0",typeName:e.typeName,outputFormat:e.outputFormat??"application/json",bbox:t.join(","),srsName:e.srsName??this.projection,...e.params??{}};return this.appendParams(e.url,r)}}getWCSGetCoverageUrl(e,t){return r=>{const o=e.version??"2.0.1",s=e.format??"image/tiff",n=e.projection??this.projection,a={SERVICE:"WCS",REQUEST:"GetCoverage",VERSION:o,FORMAT:s};if(o.startsWith("2.0")){a.coverageId=e.coverageName;const[t,o,n,i]=r;a.subset=`X(${t},${n})`,a.subset2=`Y(${o},${i})`,(s.includes("tiff")||s.includes("geotiff"))&&(a["geotiff:compression"]="LZW")}else{a.COVERAGE=e.coverageName,a.BBOX=r.join(","),a.CRS=n;const o=Math.round((r[2]-r[0])/t),s=Math.round((r[3]-r[1])/t);a.WIDTH=o,a.HEIGHT=s}if(e.params&&Object.entries(e.params).forEach((([e,t])=>{"string"!=typeof t&&"number"!=typeof t||(a[e]=t)})),o.startsWith("2.0")){const t=a.subset2;delete a.subset2;const r=new URLSearchParams;Object.entries(a).forEach((([e,t])=>{null!=t&&r.append(e,String(t))})),t&&r.append("subset",String(t));const o=e.url;return`${o}${o.includes("?")?"&":"?"}${r.toString()}`}return this.appendParams(e.url,a)}}mergeLayerConfig(e,t,r){const o={...e.get(t)??{},...r};return e.set(t,o,!1),o}appendParams(e,t){const r=new URLSearchParams;return Object.entries(t).forEach((([e,t])=>{null!=t&&r.set(e,String(t))})),r.toString()?`${e}${e.includes("?")?"&":"?"}${r.toString()}`:e}async createWcsSource(e){const t=e.projection??this.projection,r=this.map?.getView()?.getResolution()??1,o=this.getWCSGetCoverageUrl(e,r);return new class extends y{urlFunction_;constructor(r){super({projection:t,resolutions:e.resolutions}),this.urlFunction_=r}getImageInternal(e,t,r,o){const s=this.urlFunction_(e),n=new w(e,t,r,s);return n.load=()=>{const e=n.getImage();e.src!==s&&(e.crossOrigin="anonymous",e.src=s)},n}}(o)}async createArcGISLayer(e){const t={...e.params??{}};e.token&&(t.token=e.token);const r={url:e.url,params:t,...e.options??{}};return new s({source:new f(r),visible:e.visible??!0})}async updateGeoTIFFLayer(e,t){if(!t.url)throw new Error("GeoTIFF update requires a URL");const r={url:t.url};null==t.nodata||isNaN(t.nodata)||(r.nodata=t.nodata);const o=new(await z({sources:[r],wrapX:!1}));await o.registerProjectionIfNeeded(),e.setSource(o)}getMap(){return this.map}}export{A as OpenLayersProvider}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{L as e,p as t,a as n,U as i,M as o,c as s,i as a,G as r,j as l,m as c,W as d,k as g,C as u,r as f,l as p,n as h,f as m,P as v}from"./deck-provider.js";const x="uniform arcUniforms {\n bool greatCircle;\n bool useShortestPath;\n float numSegments;\n float widthScale;\n float widthMinPixels;\n float widthMaxPixels;\n highp int widthUnits;\n} arc;\n",y={name:"arc",vs:x,fs:x,uniformTypes:{greatCircle:"f32",useShortestPath:"f32",numSegments:"f32",widthScale:"f32",widthMinPixels:"f32",widthMaxPixels:"f32",widthUnits:"i32"}},P=[0,0,0,255],_={getSourcePosition:{type:"accessor",value:e=>e.sourcePosition},getTargetPosition:{type:"accessor",value:e=>e.targetPosition},getSourceColor:{type:"accessor",value:P},getTargetColor:{type:"accessor",value:P},getWidth:{type:"accessor",value:1},getHeight:{type:"accessor",value:1},getTilt:{type:"accessor",value:0},greatCircle:!1,numSegments:{type:"number",value:50,min:1},widthUnits:"pixels",widthScale:{type:"number",value:1,min:0},widthMinPixels:{type:"number",value:0,min:0},widthMaxPixels:{type:"number",value:Number.MAX_SAFE_INTEGER,min:0}};class C extends e{getBounds(){return this.getAttributeManager()?.getBounds(["instanceSourcePositions","instanceTargetPositions"])}getShaders(){return super.getShaders({vs:"#version 300 es\n#define SHADER_NAME arc-layer-vertex-shader\nin vec4 instanceSourceColors;\nin vec4 instanceTargetColors;\nin vec3 instanceSourcePositions;\nin vec3 instanceSourcePositions64Low;\nin vec3 instanceTargetPositions;\nin vec3 instanceTargetPositions64Low;\nin vec3 instancePickingColors;\nin float instanceWidths;\nin float instanceHeights;\nin float instanceTilts;\nout vec4 vColor;\nout vec2 uv;\nout float isValid;\nfloat paraboloid(float distance, float sourceZ, float targetZ, float ratio) {\nfloat deltaZ = targetZ - sourceZ;\nfloat dh = distance * instanceHeights;\nif (dh == 0.0) {\nreturn sourceZ + deltaZ * ratio;\n}\nfloat unitZ = deltaZ / dh;\nfloat p2 = unitZ * unitZ + 1.0;\nfloat dir = step(deltaZ, 0.0);\nfloat z0 = mix(sourceZ, targetZ, dir);\nfloat r = mix(ratio, 1.0 - ratio, dir);\nreturn sqrt(r * (p2 - r)) * dh + z0;\n}\nvec2 getExtrusionOffset(vec2 line_clipspace, float offset_direction, float width) {\nvec2 dir_screenspace = normalize(line_clipspace * project.viewportSize);\ndir_screenspace = vec2(-dir_screenspace.y, dir_screenspace.x);\nreturn dir_screenspace * offset_direction * width / 2.0;\n}\nfloat getSegmentRatio(float index) {\nreturn smoothstep(0.0, 1.0, index / (arc.numSegments - 1.0));\n}\nvec3 interpolateFlat(vec3 source, vec3 target, float segmentRatio) {\nfloat distance = length(source.xy - target.xy);\nfloat z = paraboloid(distance, source.z, target.z, segmentRatio);\nfloat tiltAngle = radians(instanceTilts);\nvec2 tiltDirection = normalize(target.xy - source.xy);\nvec2 tilt = vec2(-tiltDirection.y, tiltDirection.x) * z * sin(tiltAngle);\nreturn vec3(\nmix(source.xy, target.xy, segmentRatio) + tilt,\nz * cos(tiltAngle)\n);\n}\nfloat getAngularDist (vec2 source, vec2 target) {\nvec2 sourceRadians = radians(source);\nvec2 targetRadians = radians(target);\nvec2 sin_half_delta = sin((sourceRadians - targetRadians) / 2.0);\nvec2 shd_sq = sin_half_delta * sin_half_delta;\nfloat a = shd_sq.y + cos(sourceRadians.y) * cos(targetRadians.y) * shd_sq.x;\nreturn 2.0 * asin(sqrt(a));\n}\nvec3 interpolateGreatCircle(vec3 source, vec3 target, vec3 source3D, vec3 target3D, float angularDist, float t) {\nvec2 lngLat;\nif(abs(angularDist - PI) < 0.001) {\nlngLat = (1.0 - t) * source.xy + t * target.xy;\n} else {\nfloat a = sin((1.0 - t) * angularDist);\nfloat b = sin(t * angularDist);\nvec3 p = source3D.yxz * a + target3D.yxz * b;\nlngLat = degrees(vec2(atan(p.y, -p.x), atan(p.z, length(p.xy))));\n}\nfloat z = paraboloid(angularDist * EARTH_RADIUS, source.z, target.z, t);\nreturn vec3(lngLat, z);\n}\nvoid main(void) {\ngeometry.worldPosition = instanceSourcePositions;\ngeometry.worldPositionAlt = instanceTargetPositions;\nfloat segmentIndex = float(gl_VertexID / 2);\nfloat segmentSide = mod(float(gl_VertexID), 2.) == 0. ? -1. : 1.;\nfloat segmentRatio = getSegmentRatio(segmentIndex);\nfloat prevSegmentRatio = getSegmentRatio(max(0.0, segmentIndex - 1.0));\nfloat nextSegmentRatio = getSegmentRatio(min(arc.numSegments - 1.0, segmentIndex + 1.0));\nfloat indexDir = mix(-1.0, 1.0, step(segmentIndex, 0.0));\nisValid = 1.0;\nuv = vec2(segmentRatio, segmentSide);\ngeometry.uv = uv;\ngeometry.pickingColor = instancePickingColors;\nvec4 curr;\nvec4 next;\nvec3 source;\nvec3 target;\nif ((arc.greatCircle || project.projectionMode == PROJECTION_MODE_GLOBE) && project.coordinateSystem == COORDINATE_SYSTEM_LNGLAT) {\nsource = project_globe_(vec3(instanceSourcePositions.xy, 0.0));\ntarget = project_globe_(vec3(instanceTargetPositions.xy, 0.0));\nfloat angularDist = getAngularDist(instanceSourcePositions.xy, instanceTargetPositions.xy);\nvec3 prevPos = interpolateGreatCircle(instanceSourcePositions, instanceTargetPositions, source, target, angularDist, prevSegmentRatio);\nvec3 currPos = interpolateGreatCircle(instanceSourcePositions, instanceTargetPositions, source, target, angularDist, segmentRatio);\nvec3 nextPos = interpolateGreatCircle(instanceSourcePositions, instanceTargetPositions, source, target, angularDist, nextSegmentRatio);\nif (abs(currPos.x - prevPos.x) > 180.0) {\nindexDir = -1.0;\nisValid = 0.0;\n} else if (abs(currPos.x - nextPos.x) > 180.0) {\nindexDir = 1.0;\nisValid = 0.0;\n}\nnextPos = indexDir < 0.0 ? prevPos : nextPos;\nnextSegmentRatio = indexDir < 0.0 ? prevSegmentRatio : nextSegmentRatio;\nif (isValid == 0.0) {\nnextPos.x += nextPos.x > 0.0 ? -360.0 : 360.0;\nfloat t = ((currPos.x > 0.0 ? 180.0 : -180.0) - currPos.x) / (nextPos.x - currPos.x);\ncurrPos = mix(currPos, nextPos, t);\nsegmentRatio = mix(segmentRatio, nextSegmentRatio, t);\n}\nvec3 currPos64Low = mix(instanceSourcePositions64Low, instanceTargetPositions64Low, segmentRatio);\nvec3 nextPos64Low = mix(instanceSourcePositions64Low, instanceTargetPositions64Low, nextSegmentRatio);\ncurr = project_position_to_clipspace(currPos, currPos64Low, vec3(0.0), geometry.position);\nnext = project_position_to_clipspace(nextPos, nextPos64Low, vec3(0.0));\n} else {\nvec3 source_world = instanceSourcePositions;\nvec3 target_world = instanceTargetPositions;\nif (arc.useShortestPath) {\nsource_world.x = mod(source_world.x + 180., 360.0) - 180.;\ntarget_world.x = mod(target_world.x + 180., 360.0) - 180.;\nfloat deltaLng = target_world.x - source_world.x;\nif (deltaLng > 180.) target_world.x -= 360.;\nif (deltaLng < -180.) source_world.x -= 360.;\n}\nsource = project_position(source_world, instanceSourcePositions64Low);\ntarget = project_position(target_world, instanceTargetPositions64Low);\nfloat antiMeridianX = 0.0;\nif (arc.useShortestPath) {\nif (project.projectionMode == PROJECTION_MODE_WEB_MERCATOR_AUTO_OFFSET) {\nantiMeridianX = -(project.coordinateOrigin.x + 180.) / 360. * TILE_SIZE;\n}\nfloat thresholdRatio = (antiMeridianX - source.x) / (target.x - source.x);\nif (prevSegmentRatio <= thresholdRatio && nextSegmentRatio > thresholdRatio) {\nisValid = 0.0;\nindexDir = sign(segmentRatio - thresholdRatio);\nsegmentRatio = thresholdRatio;\n}\n}\nnextSegmentRatio = indexDir < 0.0 ? prevSegmentRatio : nextSegmentRatio;\nvec3 currPos = interpolateFlat(source, target, segmentRatio);\nvec3 nextPos = interpolateFlat(source, target, nextSegmentRatio);\nif (arc.useShortestPath) {\nif (nextPos.x < antiMeridianX) {\ncurrPos.x += TILE_SIZE;\nnextPos.x += TILE_SIZE;\n}\n}\ncurr = project_common_position_to_clipspace(vec4(currPos, 1.0));\nnext = project_common_position_to_clipspace(vec4(nextPos, 1.0));\ngeometry.position = vec4(currPos, 1.0);\n}\nfloat widthPixels = clamp(\nproject_size_to_pixel(instanceWidths * arc.widthScale, arc.widthUnits),\narc.widthMinPixels, arc.widthMaxPixels\n);\nvec3 offset = vec3(\ngetExtrusionOffset((next.xy - curr.xy) * indexDir, segmentSide, widthPixels),\n0.0);\nDECKGL_FILTER_SIZE(offset, geometry);\nDECKGL_FILTER_GL_POSITION(curr, geometry);\ngl_Position = curr + vec4(project_pixel_size_to_clipspace(offset.xy), 0.0, 0.0);\nvec4 color = mix(instanceSourceColors, instanceTargetColors, segmentRatio);\nvColor = vec4(color.rgb, color.a * layer.opacity);\nDECKGL_FILTER_COLOR(vColor, geometry);\n}\n",fs:"#version 300 es\n#define SHADER_NAME arc-layer-fragment-shader\nprecision highp float;\nin vec4 vColor;\nin vec2 uv;\nin float isValid;\nout vec4 fragColor;\nvoid main(void) {\nif (isValid == 0.0) {\ndiscard;\n}\nfragColor = vColor;\ngeometry.uv = uv;\nDECKGL_FILTER_COLOR(fragColor, geometry);\n}\n",modules:[t,n,y]})}get wrapLongitude(){return!1}initializeState(){this.getAttributeManager().addInstanced({instanceSourcePositions:{size:3,type:"float64",fp64:this.use64bitPositions(),transition:!0,accessor:"getSourcePosition"},instanceTargetPositions:{size:3,type:"float64",fp64:this.use64bitPositions(),transition:!0,accessor:"getTargetPosition"},instanceSourceColors:{size:this.props.colorFormat.length,type:"unorm8",transition:!0,accessor:"getSourceColor",defaultValue:P},instanceTargetColors:{size:this.props.colorFormat.length,type:"unorm8",transition:!0,accessor:"getTargetColor",defaultValue:P},instanceWidths:{size:1,transition:!0,accessor:"getWidth",defaultValue:1},instanceHeights:{size:1,transition:!0,accessor:"getHeight",defaultValue:1},instanceTilts:{size:1,transition:!0,accessor:"getTilt",defaultValue:0}})}updateState(e){super.updateState(e),e.changeFlags.extensionsChanged&&(this.state.model?.destroy(),this.state.model=this._getModel(),this.getAttributeManager().invalidateAll())}draw({}){const{widthUnits:e,widthScale:t,widthMinPixels:n,widthMaxPixels:o,greatCircle:s,wrapLongitude:a,numSegments:r}=this.props,l=this.state.model;l.shaderInputs.setProps({arc:{numSegments:r,widthUnits:i[e],widthScale:t,widthMinPixels:n,widthMaxPixels:o,greatCircle:s,useShortestPath:a}}),l.setVertexCount(2*r),l.draw(this.context.renderPass)}_getModel(){return new o(this.context.device,{...this.getShaders(),id:this.props.id,bufferLayout:this.getAttributeManager().getBufferLayouts(),topology:"triangle-strip",isInstanced:!0})}}C.layerName="ArcLayer",C.defaultProps=_;const S="uniform pointCloudUniforms {\n float radiusPixels;\n highp int sizeUnits;\n} pointCloud;\n",w={name:"pointCloud",source:"struct PointCloudUniforms {\n radiusPixels: f32,\n sizeUnits: i32,\n};\n\n@group(0) @binding(3)\nvar<uniform> pointCloud: PointCloudUniforms;\n",vs:S,fs:S,uniformTypes:{radiusPixels:"f32",sizeUnits:"i32"}},L=[0,0,0,255],R=[0,0,1],E={sizeUnits:"pixels",pointSize:{type:"number",min:0,value:10},getPosition:{type:"accessor",value:e=>e.position},getNormal:{type:"accessor",value:R},getColor:{type:"accessor",value:L},material:!0,radiusPixels:{deprecatedFor:"pointSize"}};class T extends e{getShaders(){return super.getShaders({vs:"#version 300 es\n#define SHADER_NAME point-cloud-layer-vertex-shader\nin vec3 positions;\nin vec3 instanceNormals;\nin vec4 instanceColors;\nin vec3 instancePositions;\nin vec3 instancePositions64Low;\nin vec3 instancePickingColors;\nout vec4 vColor;\nout vec2 unitPosition;\nvoid main(void) {\ngeometry.worldPosition = instancePositions;\ngeometry.normal = project_normal(instanceNormals);\nunitPosition = positions.xy;\ngeometry.uv = unitPosition;\ngeometry.pickingColor = instancePickingColors;\nvec3 offset = vec3(positions.xy * project_size_to_pixel(pointCloud.radiusPixels, pointCloud.sizeUnits), 0.0);\nDECKGL_FILTER_SIZE(offset, geometry);\ngl_Position = project_position_to_clipspace(instancePositions, instancePositions64Low, vec3(0.), geometry.position);\nDECKGL_FILTER_GL_POSITION(gl_Position, geometry);\ngl_Position.xy += project_pixel_size_to_clipspace(offset.xy);\nvec3 lightColor = lighting_getLightColor(instanceColors.rgb, project.cameraPosition, geometry.position.xyz, geometry.normal);\nvColor = vec4(lightColor, instanceColors.a * layer.opacity);\nDECKGL_FILTER_COLOR(vColor, geometry);\n}\n",fs:"#version 300 es\n#define SHADER_NAME point-cloud-layer-fragment-shader\nprecision highp float;\nin vec4 vColor;\nin vec2 unitPosition;\nout vec4 fragColor;\nvoid main(void) {\ngeometry.uv = unitPosition.xy;\nfloat distToCenter = length(unitPosition);\nif (distToCenter > 1.0) {\ndiscard;\n}\nfragColor = vColor;\nDECKGL_FILTER_COLOR(fragColor, geometry);\n}\n",source:"struct ConstantAttributes {\n instanceNormals: vec3<f32>,\n instanceColors: vec4<f32>,\n instancePositions: vec3<f32>,\n instancePositions64Low: vec3<f32>,\n instancePickingColors: vec3<f32>\n};\n\nconst constants = ConstantAttributes(\n vec3<f32>(1.0, 0.0, 0.0),\n vec4<f32>(0.0, 0.0, 0.0, 1.0),\n vec3<f32>(0.0),\n vec3<f32>(0.0),\n vec3<f32>(0.0)\n);\n\nstruct Attributes {\n @builtin(instance_index) instanceIndex : u32,\n @builtin(vertex_index) vertexIndex : u32,\n @location(0) positions: vec3<f32>,\n @location(1) instancePositions: vec3<f32>,\n @location(2) instancePositions64Low: vec3<f32>,\n @location(3) instanceNormals: vec3<f32>,\n @location(4) instanceColors: vec4<f32>,\n @location(5) instancePickingColors: vec3<f32>\n};\n\nstruct Varyings {\n @builtin(position) position: vec4<f32>,\n @location(0) vColor: vec4<f32>,\n @location(1) unitPosition: vec2<f32>,\n};\n\n@vertex\nfn vertexMain(attributes: Attributes) -> Varyings {\n var varyings: Varyings;\n \n // var geometry: Geometry;\n // geometry.worldPosition = instancePositions;\n // geometry.normal = project_normal(instanceNormals);\n\n // position on the containing square in [-1, 1] space\n varyings.unitPosition = attributes.positions.xy;\n geometry.uv = varyings.unitPosition;\n geometry.pickingColor = attributes.instancePickingColors;\n\n // Find the center of the point and add the current vertex\n let offset = vec3<f32>(attributes.positions.xy * project_unit_size_to_pixel(pointCloud.radiusPixels, pointCloud.sizeUnits), 0.0);\n // DECKGL_FILTER_SIZE(offset, geometry);\n\n varyings.position = project_position_to_clipspace(attributes.instancePositions, attributes.instancePositions64Low, vec3<f32>(0.0)); // TODO , geometry.position);\n // DECKGL_FILTER_GL_POSITION(gl_Position, geometry);\n let clipPixels = project_pixel_size_to_clipspace(offset.xy);\n varyings.position.x += clipPixels.x;\n varyings.position.y += clipPixels.y;\n\n // Apply lighting\n let lightColor = lighting_getLightColor2(attributes.instanceColors.rgb, project.cameraPosition, geometry.position.xyz, geometry.normal);\n\n // Apply opacity to instance color, or return instance picking color\n varyings.vColor = vec4(lightColor, attributes.instanceColors.a * color.opacity);\n // DECKGL_FILTER_COLOR(vColor, geometry);\n\n return varyings;\n}\n\n@fragment\nfn fragmentMain(varyings: Varyings) -> @location(0) vec4<f32> {\n // var geometry: Geometry;\n // geometry.uv = unitPosition.xy;\n\n let distToCenter = length(varyings.unitPosition);\n if (distToCenter > 1.0) {\n discard;\n }\n\n var fragColor: vec4<f32>;\n\n fragColor = varyings.vColor;\n // DECKGL_FILTER_COLOR(fragColor, geometry);\n\n // Apply premultiplied alpha as required by transparent canvas\n fragColor = deckgl_premultiplied_alpha(fragColor);\n\n return fragColor;\n}\n",modules:[t,s,a,n,w]})}initializeState(){this.getAttributeManager().addInstanced({instancePositions:{size:3,type:"float64",fp64:this.use64bitPositions(),transition:!0,accessor:"getPosition"},instanceNormals:{size:3,transition:!0,accessor:"getNormal",defaultValue:R},instanceColors:{size:this.props.colorFormat.length,type:"unorm8",transition:!0,accessor:"getColor",defaultValue:L}})}updateState(e){const{changeFlags:t,props:n}=e;super.updateState(e),t.extensionsChanged&&(this.state.model?.destroy(),this.state.model=this._getModel(),this.getAttributeManager().invalidateAll()),t.dataChanged&&function(e){const{header:t,attributes:n}=e;if(t&&n&&(e.length=t.vertexCount,n.POSITION&&(n.instancePositions=n.POSITION),n.NORMAL&&(n.instanceNormals=n.NORMAL),n.COLOR_0)){const{size:e,value:t}=n.COLOR_0;n.instanceColors={size:e,type:"unorm8",value:t}}}(n.data)}draw({}){const{pointSize:e,sizeUnits:t}=this.props,n=this.state.model;n.shaderInputs.setProps({pointCloud:{sizeUnits:i[t],radiusPixels:e}}),"webgpu"===this.context.device.type&&(n.instanceCount=this.props.data.length),n.draw(this.context.renderPass)}_getModel(){const e="webgpu"===this.context.device.type?{depthWriteEnabled:!0,depthCompare:"less-equal"}:void 0,t=[];for(let e=0;e<3;e++){const n=e/3*Math.PI*2;t.push(2*Math.cos(n),2*Math.sin(n),0)}return new o(this.context.device,{...this.getShaders(),id:this.props.id,bufferLayout:this.getAttributeManager().getBufferLayouts(),geometry:new r({topology:"triangle-list",attributes:{positions:new Float32Array(t)}}),parameters:e,isInstanced:!0})}}T.layerName="PointCloudLayer",T.defaultProps=E;class z extends r{constructor(e){const{indices:t,attributes:n}=function(e){const{radius:t,height:n=1,nradial:i=10}=e;let{vertices:o}=e;o&&(l.assert(o.length>=i),o=o.flatMap((e=>[e[0],e[1]])),c(o,d.COUNTER_CLOCKWISE));const s=n>0,a=i+1,r=s?3*a+1:i,g=2*Math.PI/i,u=new Uint16Array(s?3*i*2:0),f=new Float32Array(3*r),p=new Float32Array(3*r);let h=0;if(s){for(let e=0;e<a;e++){const s=e*g,a=e%i,r=Math.sin(s),l=Math.cos(s);for(let e=0;e<2;e++)f[h+0]=o?o[2*a]:l*t,f[h+1]=o?o[2*a+1]:r*t,f[h+2]=(.5-e)*n,p[h+0]=o?o[2*a]:l,p[h+1]=o?o[2*a+1]:r,h+=3}f[h+0]=f[h-3],f[h+1]=f[h-2],f[h+2]=f[h-1],h+=3}for(let e=s?0:1;e<a;e++){const s=Math.floor(e/2)*Math.sign(.5-e%2),a=s*g,r=(s+i)%i,l=Math.sin(a),c=Math.cos(a);f[h+0]=o?o[2*r]:c*t,f[h+1]=o?o[2*r+1]:l*t,f[h+2]=n/2,p[h+2]=1,h+=3}if(s){let e=0;for(let t=0;t<i;t++)u[e++]=2*t+0,u[e++]=2*t+2,u[e++]=2*t+0,u[e++]=2*t+1,u[e++]=2*t+1,u[e++]=2*t+3}return{indices:u,attributes:{POSITION:{size:3,value:f},NORMAL:{size:3,value:p}}}}(e);super({...e,indices:t,attributes:n})}}const D="uniform columnUniforms {\n float radius;\n float angle;\n vec2 offset;\n bool extruded;\n bool stroked;\n bool isStroke;\n float coverage;\n float elevationScale;\n float edgeDistance;\n float widthScale;\n float widthMinPixels;\n float widthMaxPixels;\n highp int radiusUnits;\n highp int widthUnits;\n} column;\n",M={name:"column",vs:D,fs:D,uniformTypes:{radius:"f32",angle:"f32",offset:"vec2<f32>",extruded:"f32",stroked:"f32",isStroke:"f32",coverage:"f32",elevationScale:"f32",edgeDistance:"f32",widthScale:"f32",widthMinPixels:"f32",widthMaxPixels:"f32",radiusUnits:"i32",widthUnits:"i32"}},b=[0,0,0,255],I={diskResolution:{type:"number",min:4,value:20},vertices:null,radius:{type:"number",min:0,value:1e3},angle:{type:"number",value:0},offset:{type:"array",value:[0,0]},coverage:{type:"number",min:0,max:1,value:1},elevationScale:{type:"number",min:0,value:1},radiusUnits:"meters",lineWidthUnits:"meters",lineWidthScale:1,lineWidthMinPixels:0,lineWidthMaxPixels:Number.MAX_SAFE_INTEGER,extruded:!0,wireframe:!1,filled:!0,stroked:!1,flatShading:!1,getPosition:{type:"accessor",value:e=>e.position},getFillColor:{type:"accessor",value:b},getLineColor:{type:"accessor",value:b},getLineWidth:{type:"accessor",value:1},getElevation:{type:"accessor",value:1e3},material:!0,getColor:{deprecatedFor:["getFillColor","getLineColor"]}};class O extends e{getShaders(){const e={},{flatShading:i}=this.props;return i&&(e.FLAT_SHADING=1),super.getShaders({vs:"#version 300 es\n#define SHADER_NAME column-layer-vertex-shader\nin vec3 positions;\nin vec3 normals;\nin vec3 instancePositions;\nin float instanceElevations;\nin vec3 instancePositions64Low;\nin vec4 instanceFillColors;\nin vec4 instanceLineColors;\nin float instanceStrokeWidths;\nin vec3 instancePickingColors;\nout vec4 vColor;\n#ifdef FLAT_SHADING\nout vec3 cameraPosition;\nout vec4 position_commonspace;\n#endif\nvoid main(void) {\ngeometry.worldPosition = instancePositions;\nvec4 color = column.isStroke ? instanceLineColors : instanceFillColors;\nmat2 rotationMatrix = mat2(cos(column.angle), sin(column.angle), -sin(column.angle), cos(column.angle));\nfloat elevation = 0.0;\nfloat strokeOffsetRatio = 1.0;\nif (column.extruded) {\nelevation = instanceElevations * (positions.z + 1.0) / 2.0 * column.elevationScale;\n} else if (column.stroked) {\nfloat widthPixels = clamp(\nproject_size_to_pixel(instanceStrokeWidths * column.widthScale, column.widthUnits),\ncolumn.widthMinPixels, column.widthMaxPixels) / 2.0;\nfloat halfOffset = project_pixel_size(widthPixels) / project_size(column.edgeDistance * column.coverage * column.radius);\nif (column.isStroke) {\nstrokeOffsetRatio -= sign(positions.z) * halfOffset;\n} else {\nstrokeOffsetRatio -= halfOffset;\n}\n}\nfloat shouldRender = float(color.a > 0.0 && instanceElevations >= 0.0);\nfloat dotRadius = column.radius * column.coverage * shouldRender;\ngeometry.pickingColor = instancePickingColors;\nvec3 centroidPosition = vec3(instancePositions.xy, instancePositions.z + elevation);\nvec3 centroidPosition64Low = instancePositions64Low;\nvec2 offset = (rotationMatrix * positions.xy * strokeOffsetRatio + column.offset) * dotRadius;\nif (column.radiusUnits == UNIT_METERS) {\noffset = project_size(offset);\n} else if (column.radiusUnits == UNIT_PIXELS) {\noffset = project_pixel_size(offset);\n}\nvec3 pos = vec3(offset, 0.);\nDECKGL_FILTER_SIZE(pos, geometry);\ngl_Position = project_position_to_clipspace(centroidPosition, centroidPosition64Low, pos, geometry.position);\ngeometry.normal = project_normal(vec3(rotationMatrix * normals.xy, normals.z));\nDECKGL_FILTER_GL_POSITION(gl_Position, geometry);\nif (column.extruded && !column.isStroke) {\n#ifdef FLAT_SHADING\ncameraPosition = project.cameraPosition;\nposition_commonspace = geometry.position;\nvColor = vec4(color.rgb, color.a * layer.opacity);\n#else\nvec3 lightColor = lighting_getLightColor(color.rgb, project.cameraPosition, geometry.position.xyz, geometry.normal);\nvColor = vec4(lightColor, color.a * layer.opacity);\n#endif\n} else {\nvColor = vec4(color.rgb, color.a * layer.opacity);\n}\nDECKGL_FILTER_COLOR(vColor, geometry);\n}\n",fs:"#version 300 es\n#define SHADER_NAME column-layer-fragment-shader\nprecision highp float;\nout vec4 fragColor;\nin vec4 vColor;\n#ifdef FLAT_SHADING\nin vec3 cameraPosition;\nin vec4 position_commonspace;\n#endif\nvoid main(void) {\nfragColor = vColor;\ngeometry.uv = vec2(0.);\n#ifdef FLAT_SHADING\nif (column.extruded && !column.isStroke && !bool(picking.isActive)) {\nvec3 normal = normalize(cross(dFdx(position_commonspace.xyz), dFdy(position_commonspace.xyz)));\nfragColor.rgb = lighting_getLightColor(vColor.rgb, cameraPosition, position_commonspace.xyz, normal);\n}\n#endif\nDECKGL_FILTER_COLOR(fragColor, geometry);\n}\n",defines:e,modules:[t,i?g:a,n,M]})}initializeState(){this.getAttributeManager().addInstanced({instancePositions:{size:3,type:"float64",fp64:this.use64bitPositions(),transition:!0,accessor:"getPosition"},instanceElevations:{size:1,transition:!0,accessor:"getElevation"},instanceFillColors:{size:this.props.colorFormat.length,type:"unorm8",transition:!0,accessor:"getFillColor",defaultValue:b},instanceLineColors:{size:this.props.colorFormat.length,type:"unorm8",transition:!0,accessor:"getLineColor",defaultValue:b},instanceStrokeWidths:{size:1,accessor:"getLineWidth",transition:!0}})}updateState(e){super.updateState(e);const{props:t,oldProps:n,changeFlags:i}=e,o=i.extensionsChanged||t.flatShading!==n.flatShading;o&&(this.state.models?.forEach((e=>e.destroy())),this.setState(this._getModels()),this.getAttributeManager().invalidateAll());const s=this.getNumInstances();this.state.fillModel.setInstanceCount(s),this.state.wireframeModel.setInstanceCount(s),(o||t.diskResolution!==n.diskResolution||t.vertices!==n.vertices||(t.extruded||t.stroked)!==(n.extruded||n.stroked))&&this._updateGeometry(t)}getGeometry(e,t,n){const i=new z({radius:1,height:n?2:0,vertices:t,nradial:e});let o=0;if(t)for(let n=0;n<e;n++){const i=t[n];o+=Math.sqrt(i[0]*i[0]+i[1]*i[1])/e}else o=1;return this.setState({edgeDistance:Math.cos(Math.PI/e)*o}),i}_getModels(){const e=this.getShaders(),t=this.getAttributeManager().getBufferLayouts(),n=new o(this.context.device,{...e,id:`${this.props.id}-fill`,bufferLayout:t,isInstanced:!0}),i=new o(this.context.device,{...e,id:`${this.props.id}-wireframe`,bufferLayout:t,isInstanced:!0});return{fillModel:n,wireframeModel:i,models:[i,n]}}_updateGeometry({diskResolution:e,vertices:t,extruded:n,stroked:i}){const o=this.getGeometry(e,t,n||i);this.setState({fillVertexCount:o.attributes.POSITION.value.length/3});const s=this.state.fillModel,a=this.state.wireframeModel;s.setGeometry(o),s.setTopology("triangle-strip"),s.setIndexBuffer(null),a.setGeometry(o),a.setTopology("line-list")}draw({}){const{lineWidthUnits:e,lineWidthScale:t,lineWidthMinPixels:n,lineWidthMaxPixels:o,radiusUnits:s,elevationScale:a,extruded:r,filled:l,stroked:c,wireframe:d,offset:g,coverage:u,radius:f,angle:p}=this.props,h=this.state.fillModel,m=this.state.wireframeModel,{fillVertexCount:v,edgeDistance:x}=this.state,y={radius:f,angle:p/180*Math.PI,offset:g,extruded:r,stroked:c,coverage:u,elevationScale:a,edgeDistance:x,radiusUnits:i[s],widthUnits:i[e],widthScale:t,widthMinPixels:n,widthMaxPixels:o};r&&d&&(m.shaderInputs.setProps({column:{...y,isStroke:!0}}),m.draw(this.context.renderPass)),l&&(h.setVertexCount(v),h.shaderInputs.setProps({column:{...y,isStroke:!1}}),h.draw(this.context.renderPass)),!r&&c&&(h.setVertexCount(2*v/3),h.shaderInputs.setProps({column:{...y,isStroke:!0}}),h.draw(this.context.renderPass))}}O.layerName="ColumnLayer",O.defaultProps=I;const A=[0,0,0,255],F={stroked:!0,filled:!0,extruded:!1,elevationScale:1,wireframe:!1,_normalize:!0,_windingOrder:"CW",lineWidthUnits:"meters",lineWidthScale:1,lineWidthMinPixels:0,lineWidthMaxPixels:Number.MAX_SAFE_INTEGER,lineJointRounded:!1,lineMiterLimit:4,getPolygon:{type:"accessor",value:e=>e.polygon},getFillColor:{type:"accessor",value:[0,0,0,255]},getLineColor:{type:"accessor",value:A},getLineWidth:{type:"accessor",value:1},getElevation:{type:"accessor",value:1e3},material:!0};class k extends u{initializeState(){this.state={paths:[],pathsDiff:null},this.props.getLineDashArray&&l.removed("getLineDashArray","PathStyleExtension")()}updateState({changeFlags:e}){const t=e.dataChanged||e.updateTriggersChanged&&(e.updateTriggersChanged.all||e.updateTriggersChanged.getPolygon);if(t&&Array.isArray(e.dataChanged)){const t=this.state.paths.slice(),n=e.dataChanged.map((e=>f({data:t,getIndex:e=>e.__source.index,dataRange:e,replace:this._getPaths(e)})));this.setState({paths:t,pathsDiff:n})}else t&&this.setState({paths:this._getPaths(),pathsDiff:null})}_getPaths(e={}){const{data:t,getPolygon:n,positionFormat:i,_normalize:o}=this.props,s=[],a="XY"===i?2:3,{startRow:r,endRow:l}=e,{iterable:c,objectInfo:d}=p(t,r,l);for(const e of c){d.index++;let t=n(e,d);o&&(t=h(t,a));const{holeIndices:i}=t,r=t.positions||t;if(i)for(let t=0;t<=i.length;t++){const n=r.slice(i[t-1]||0,i[t]||r.length);s.push(this.getSubLayerRow({path:n},e,d.index))}else s.push(this.getSubLayerRow({path:r},e,d.index))}return s}renderLayers(){const{data:e,_dataDiff:t,stroked:n,filled:i,extruded:o,wireframe:s,_normalize:a,_windingOrder:r,elevationScale:l,transitions:c,positionFormat:d}=this.props,{lineWidthUnits:g,lineWidthScale:u,lineWidthMinPixels:f,lineWidthMaxPixels:p,lineJointRounded:h,lineMiterLimit:x,lineDashJustified:y}=this.props,{getFillColor:P,getLineColor:_,getLineWidth:C,getLineDashArray:S,getElevation:w,getPolygon:L,updateTriggers:R,material:E}=this.props,{paths:T,pathsDiff:z}=this.state,D=this.getSubLayerClass("fill",m),M=this.getSubLayerClass("stroke",v),b=this.shouldRenderSubLayer("fill",T)&&new D({_dataDiff:t,extruded:o,elevationScale:l,filled:i,wireframe:s,_normalize:a,_windingOrder:r,getElevation:w,getFillColor:P,getLineColor:o&&s?_:A,material:E,transitions:c},this.getSubLayerProps({id:"fill",updateTriggers:R&&{getPolygon:R.getPolygon,getElevation:R.getElevation,getFillColor:R.getFillColor,lineColors:o&&s,getLineColor:R.getLineColor}}),{data:e,positionFormat:d,getPolygon:L});return[!o&&b,!o&&n&&this.shouldRenderSubLayer("stroke",T)&&new M({_dataDiff:z&&(()=>z),widthUnits:g,widthScale:u,widthMinPixels:f,widthMaxPixels:p,jointRounded:h,miterLimit:x,dashJustified:y,_pathType:"loop",transitions:c&&{getWidth:c.getLineWidth,getColor:c.getLineColor,getPath:c.getPolygon},getColor:this.getSubLayerAccessor(_),getWidth:this.getSubLayerAccessor(C),getDashArray:this.getSubLayerAccessor(S)},this.getSubLayerProps({id:"stroke",updateTriggers:R&&{getWidth:R.getLineWidth,getColor:R.getLineColor,getDashArray:R.getLineDashArray}}),{data:T,positionFormat:d,getPath:e=>e.path}),o&&b]}}k.layerName="PolygonLayer",k.defaultProps=F;export{C as A,O as C,T as P,k as a}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{postProcessGLTF as n,GLTFLoader as e}from"@loaders.gl/gltf";import{aK as t,a0 as o,V as r,u as i,aL as a,M as s,G as l,aM as c,L as f,p,a as d,aN as u,j as m,aO as b}from"./deck-provider.js";const g="uniform pbrProjectionUniforms {\n mat4 modelViewProjectionMatrix;\n mat4 modelMatrix;\n mat4 normalMatrix;\n vec3 camera;\n} pbrProjection;\n",h={props:{},uniforms:{},name:"pbrMaterial",dependencies:[t,{name:"pbrProjection",vs:g,fs:g,getUniforms:n=>n,uniformTypes:{modelViewProjectionMatrix:"mat4x4<f32>",modelMatrix:"mat4x4<f32>",normalMatrix:"mat4x4<f32>",camera:"vec3<i32>"}}],source:"struct PBRFragmentInputs {\n pbr_vPosition: vec3f,\n pbr_vUV: vec2f,\n pbr_vTBN: mat3f,\n pbr_vNormal: vec3f\n};\n\nvar fragmentInputs: PBRFragmentInputs;\n\nfn pbr_setPositionNormalTangentUV(position: vec4f, normal: vec4f, tangent: vec4f, uv: vec2f)\n{\n var pos: vec4f = pbrProjection.modelMatrix * position;\n pbr_vPosition = vec3(pos.xyz) / pos.w;\n\n#ifdef HAS_NORMALS\n#ifdef HAS_TANGENTS\n let normalW: vec3f = normalize(vec3(pbrProjection.normalMatrix * vec4(normal.xyz, 0.0)));\n let tangentW: vec3f = normalize(vec3(pbrProjection.modelMatrix * vec4(tangent.xyz, 0.0)));\n let bitangentW: vec3f = cross(normalW, tangentW) * tangent.w;\n fragmentInputs,pbr_vTBN = mat3(tangentW, bitangentW, normalW);\n#else // HAS_TANGENTS != 1\n fragmentInputs.pbr_vNormal = normalize(vec3(pbrProjection.modelMatrix * vec4(normal.xyz, 0.0)));\n#endif\n#endif\n\n#ifdef HAS_UV\n pbr_vUV = uv;\n#else\n pbr_vUV = vec2(0.,0.);\n#endif\n}\n\nstruct pbrMaterialUniforms {\n // Material is unlit\n unlit: uint32,\n\n // Base color map\n baseColorMapEnabled: uint32,\n baseColorFactor: vec4f,\n\n normalMapEnabled : uint32,\n normalScale: f32, // #ifdef HAS_NORMALMAP\n\n emissiveMapEnabled: uint32,\n emissiveFactor: vec3f, // #ifdef HAS_EMISSIVEMAP\n\n metallicRoughnessValues: vec2f,\n metallicRoughnessMapEnabled: uint32,\n\n occlusionMapEnabled: i32,\n occlusionStrength: f32, // #ifdef HAS_OCCLUSIONMAP\n \n alphaCutoffEnabled: i32,\n alphaCutoff: f32, // #ifdef ALPHA_CUTOFF\n \n // IBL\n IBLenabled: i32,\n scaleIBLAmbient: vec2f, // #ifdef USE_IBL\n \n // debugging flags used for shader output of intermediate PBR variables\n // #ifdef PBR_DEBUG\n scaleDiffBaseMR: vec4f,\n scaleFGDSpec: vec4f\n // #endif\n} \n \n@binding(2) @group(0) var<uniform> material : pbrMaterialUniforms;\n\n// Samplers\n#ifdef HAS_BASECOLORMAP\nuniform sampler2D pbr_baseColorSampler;\n#endif\n#ifdef HAS_NORMALMAP\nuniform sampler2D pbr_normalSampler;\n#endif\n#ifdef HAS_EMISSIVEMAP\nuniform sampler2D pbr_emissiveSampler;\n#endif\n#ifdef HAS_METALROUGHNESSMAP\nuniform sampler2D pbr_metallicRoughnessSampler;\n#endif\n#ifdef HAS_OCCLUSIONMAP\nuniform sampler2D pbr_occlusionSampler;\n#endif\n#ifdef USE_IBL\nuniform samplerCube pbr_diffuseEnvSampler;\nuniform samplerCube pbr_specularEnvSampler;\nuniform sampler2D pbr_brdfLUT;\n#endif\n\n// Encapsulate the various inputs used by the various functions in the shading equation\n// We store values in this struct to simplify the integration of alternative implementations\n// of the shading terms, outlined in the Readme.MD Appendix.\nstruct PBRInfo {\n NdotL: f32, // cos angle between normal and light direction\n NdotV: f32, // cos angle between normal and view direction\n NdotH: f32, // cos angle between normal and half vector\n LdotH: f32, // cos angle between light direction and half vector\n VdotH: f32, // cos angle between view direction and half vector\n perceptualRoughness: f32, // roughness value, as authored by the model creator (input to shader)\n metalness: f32, // metallic value at the surface\n reflectance0: vec3f, // full reflectance color (normal incidence angle)\n reflectance90: vec3f, // reflectance color at grazing angle\n alphaRoughness: f32, // roughness mapped to a more linear change in the roughness (proposed by [2])\n diffuseColor: vec3f, // color contribution from diffuse lighting\n specularColor: vec3f, // color contribution from specular lighting\n n: vec3f, // normal at surface point\n v: vec3f, // vector from surface point to camera\n};\n\nconst M_PI = 3.141592653589793;\nconst c_MinRoughness = 0.04;\n\nfn SRGBtoLINEAR(srgbIn: vec4f ) -> vec4f\n{\n#ifdef MANUAL_SRGB\n#ifdef SRGB_FAST_APPROXIMATION\n var linOut: vec3f = pow(srgbIn.xyz,vec3(2.2));\n#else // SRGB_FAST_APPROXIMATION\n var bLess: vec3f = step(vec3(0.04045),srgbIn.xyz);\n var linOut: vec3f = mix( srgbIn.xyz/vec3(12.92), pow((srgbIn.xyz+vec3(0.055))/vec3(1.055),vec3(2.4)), bLess );\n#endif //SRGB_FAST_APPROXIMATION\n return vec4f(linOut,srgbIn.w);;\n#else //MANUAL_SRGB\n return srgbIn;\n#endif //MANUAL_SRGB\n}\n\n// Find the normal for this fragment, pulling either from a predefined normal map\n// or from the interpolated mesh normal and tangent attributes.\nfn getNormal() -> vec3f\n{\n // Retrieve the tangent space matrix\n#ifndef HAS_TANGENTS\n var pos_dx: vec3f = dFdx(pbr_vPosition);\n var pos_dy: vec3f = dFdy(pbr_vPosition);\n var tex_dx: vec3f = dFdx(vec3(pbr_vUV, 0.0));\n var tex_dy: vec3f = dFdy(vec3(pbr_vUV, 0.0));\n var t: vec3f = (tex_dy.t * pos_dx - tex_dx.t * pos_dy) / (tex_dx.s * tex_dy.t - tex_dy.s * tex_dx.t);\n\n#ifdef HAS_NORMALS\n var ng: vec3f = normalize(pbr_vNormal);\n#else\n var ng: vec3f = cross(pos_dx, pos_dy);\n#endif\n\n t = normalize(t - ng * dot(ng, t));\n var b: vec3f = normalize(cross(ng, t));\n var tbn: mat3f = mat3f(t, b, ng);\n#else // HAS_TANGENTS\n var tbn: mat3f = pbr_vTBN;\n#endif\n\n#ifdef HAS_NORMALMAP\n vec3 n = texture(pbr_normalSampler, pbr_vUV).rgb;\n n = normalize(tbn * ((2.0 * n - 1.0) * vec3(pbrMaterial.normalScale, pbrMaterial.normalScale, 1.0)));\n#else\n // The tbn matrix is linearly interpolated, so we need to re-normalize\n vec3 n = normalize(tbn[2].xyz);\n#endif\n\n return n;\n}\n\n// Calculation of the lighting contribution from an optional Image Based Light source.\n// Precomputed Environment Maps are required uniform inputs and are computed as outlined in [1].\n// See our README.md on Environment Maps [3] for additional discussion.\n#ifdef USE_IBL\nfn getIBLContribution(PBRInfo pbrInfo, vec3 n, vec3 reflection) -> vec3f\n{\n float mipCount = 9.0; // resolution of 512x512\n float lod = (pbrInfo.perceptualRoughness * mipCount);\n // retrieve a scale and bias to F0. See [1], Figure 3\n vec3 brdf = SRGBtoLINEAR(texture(pbr_brdfLUT,\n vec2(pbrInfo.NdotV, 1.0 - pbrInfo.perceptualRoughness))).rgb;\n vec3 diffuseLight = SRGBtoLINEAR(texture(pbr_diffuseEnvSampler, n)).rgb;\n\n#ifdef USE_TEX_LOD\n vec3 specularLight = SRGBtoLINEAR(texture(pbr_specularEnvSampler, reflection, lod)).rgb;\n#else\n vec3 specularLight = SRGBtoLINEAR(texture(pbr_specularEnvSampler, reflection)).rgb;\n#endif\n\n vec3 diffuse = diffuseLight * pbrInfo.diffuseColor;\n vec3 specular = specularLight * (pbrInfo.specularColor * brdf.x + brdf.y);\n\n // For presentation, this allows us to disable IBL terms\n diffuse *= pbrMaterial.scaleIBLAmbient.x;\n specular *= pbrMaterial.scaleIBLAmbient.y;\n\n return diffuse + specular;\n}\n#endif\n\n// Basic Lambertian diffuse\n// Implementation from Lambert's Photometria https://archive.org/details/lambertsphotome00lambgoog\n// See also [1], Equation 1\nfn diffuse(pbrInfo: PBRInfo) -> vec3<f32> {\n return pbrInfo.diffuseColor / PI;\n}\n\n// The following equation models the Fresnel reflectance term of the spec equation (aka F())\n// Implementation of fresnel from [4], Equation 15\nfn specularReflection(pbrInfo: PBRInfo) -> vec3<f32> {\n return pbrInfo.reflectance0 +\n (pbrInfo.reflectance90 - pbrInfo.reflectance0) *\n pow(clamp(1.0 - pbrInfo.VdotH, 0.0, 1.0), 5.0);\n}\n\n// This calculates the specular geometric attenuation (aka G()),\n// where rougher material will reflect less light back to the viewer.\n// This implementation is based on [1] Equation 4, and we adopt their modifications to\n// alphaRoughness as input as originally proposed in [2].\nfn geometricOcclusion(pbrInfo: PBRInfo) -> f32 {\n let NdotL: f32 = pbrInfo.NdotL;\n let NdotV: f32 = pbrInfo.NdotV;\n let r: f32 = pbrInfo.alphaRoughness;\n\n let attenuationL = 2.0 * NdotL / (NdotL + sqrt(r * r + (1.0 - r * r) * (NdotL * NdotL)));\n let attenuationV = 2.0 * NdotV / (NdotV + sqrt(r * r + (1.0 - r * r) * (NdotV * NdotV)));\n return attenuationL * attenuationV;\n}\n\n// The following equation(s) model the distribution of microfacet normals across\n// the area being drawn (aka D())\n// Implementation from \"Average Irregularity Representation of a Roughened Surface\n// for Ray Reflection\" by T. S. Trowbridge, and K. P. Reitz\n// Follows the distribution function recommended in the SIGGRAPH 2013 course notes\n// from EPIC Games [1], Equation 3.\nfn microfacetDistribution(pbrInfo: PBRInfo) -> f32 {\n let roughnessSq = pbrInfo.alphaRoughness * pbrInfo.alphaRoughness;\n let f = (pbrInfo.NdotH * roughnessSq - pbrInfo.NdotH) * pbrInfo.NdotH + 1.0;\n return roughnessSq / (PI * f * f);\n}\n\nfn PBRInfo_setAmbientLight(pbrInfo: ptr<function, PBRInfo>) {\n (*pbrInfo).NdotL = 1.0;\n (*pbrInfo).NdotH = 0.0;\n (*pbrInfo).LdotH = 0.0;\n (*pbrInfo).VdotH = 1.0;\n}\n\nfn PBRInfo_setDirectionalLight(pbrInfo: ptr<function, PBRInfo>, lightDirection: vec3<f32>) {\n let n = (*pbrInfo).n;\n let v = (*pbrInfo).v;\n let l = normalize(lightDirection); // Vector from surface point to light\n let h = normalize(l + v); // Half vector between both l and v\n\n (*pbrInfo).NdotL = clamp(dot(n, l), 0.001, 1.0);\n (*pbrInfo).NdotH = clamp(dot(n, h), 0.0, 1.0);\n (*pbrInfo).LdotH = clamp(dot(l, h), 0.0, 1.0);\n (*pbrInfo).VdotH = clamp(dot(v, h), 0.0, 1.0);\n}\n\nfn PBRInfo_setPointLight(pbrInfo: ptr<function, PBRInfo>, pointLight: PointLight) {\n let light_direction = normalize(pointLight.position - pbr_vPosition);\n PBRInfo_setDirectionalLight(pbrInfo, light_direction);\n}\n\nfn calculateFinalColor(pbrInfo: PBRInfo, lightColor: vec3<f32>) -> vec3<f32> {\n // Calculate the shading terms for the microfacet specular shading model\n let F = specularReflection(pbrInfo);\n let G = geometricOcclusion(pbrInfo);\n let D = microfacetDistribution(pbrInfo);\n\n // Calculation of analytical lighting contribution\n let diffuseContrib = (1.0 - F) * diffuse(pbrInfo);\n let specContrib = F * G * D / (4.0 * pbrInfo.NdotL * pbrInfo.NdotV);\n // Obtain final intensity as reflectance (BRDF) scaled by the energy of the light (cosine law)\n return pbrInfo.NdotL * lightColor * (diffuseContrib + specContrib);\n}\n\nfn pbr_filterColor(colorUnused: vec4<f32>) -> vec4<f32> {\n // The albedo may be defined from a base texture or a flat color\n var baseColor: vec4<f32>;\n #ifdef HAS_BASECOLORMAP\n baseColor = SRGBtoLINEAR(textureSample(pbr_baseColorSampler, pbr_baseColorSampler, pbr_vUV)) * pbrMaterial.baseColorFactor;\n #else\n baseColor = pbrMaterial.baseColorFactor;\n #endif\n\n #ifdef ALPHA_CUTOFF\n if (baseColor.a < pbrMaterial.alphaCutoff) {\n discard;\n }\n #endif\n\n var color = vec3<f32>(0.0, 0.0, 0.0);\n\n if (pbrMaterial.unlit) {\n color = baseColor.rgb;\n } else {\n // Metallic and Roughness material properties are packed together\n // In glTF, these factors can be specified by fixed scalar values\n // or from a metallic-roughness map\n var perceptualRoughness = pbrMaterial.metallicRoughnessValues.y;\n var metallic = pbrMaterial.metallicRoughnessValues.x;\n #ifdef HAS_METALROUGHNESSMAP\n // Roughness is stored in the 'g' channel, metallic is stored in the 'b' channel.\n // This layout intentionally reserves the 'r' channel for (optional) occlusion map data\n let mrSample = textureSample(pbr_metallicRoughnessSampler, pbr_metallicRoughnessSampler, pbr_vUV);\n perceptualRoughness = mrSample.g * perceptualRoughness;\n metallic = mrSample.b * metallic;\n #endif\n perceptualRoughness = clamp(perceptualRoughness, c_MinRoughness, 1.0);\n metallic = clamp(metallic, 0.0, 1.0);\n // Roughness is authored as perceptual roughness; as is convention,\n // convert to material roughness by squaring the perceptual roughness [2].\n let alphaRoughness = perceptualRoughness * perceptualRoughness;\n\n let f0 = vec3<f32>(0.04);\n var diffuseColor = baseColor.rgb * (vec3<f32>(1.0) - f0);\n diffuseColor *= 1.0 - metallic;\n let specularColor = mix(f0, baseColor.rgb, metallic);\n\n // Compute reflectance.\n let reflectance = max(max(specularColor.r, specularColor.g), specularColor.b);\n\n // For typical incident reflectance range (between 4% to 100%) set the grazing\n // reflectance to 100% for typical fresnel effect.\n // For very low reflectance range on highly diffuse objects (below 4%),\n // incrementally reduce grazing reflectance to 0%.\n let reflectance90 = clamp(reflectance * 25.0, 0.0, 1.0);\n let specularEnvironmentR0 = specularColor;\n let specularEnvironmentR90 = vec3<f32>(1.0, 1.0, 1.0) * reflectance90;\n\n let n = getNormal(); // normal at surface point\n let v = normalize(pbrProjection.camera - pbr_vPosition); // Vector from surface point to camera\n\n let NdotV = clamp(abs(dot(n, v)), 0.001, 1.0);\n let reflection = -normalize(reflect(v, n));\n\n var pbrInfo = PBRInfo(\n 0.0, // NdotL\n NdotV,\n 0.0, // NdotH\n 0.0, // LdotH\n 0.0, // VdotH\n perceptualRoughness,\n metallic,\n specularEnvironmentR0,\n specularEnvironmentR90,\n alphaRoughness,\n diffuseColor,\n specularColor,\n n,\n v\n );\n\n #ifdef USE_LIGHTS\n // Apply ambient light\n PBRInfo_setAmbientLight(&pbrInfo);\n color += calculateFinalColor(pbrInfo, lighting.ambientColor);\n\n // Apply directional light\n for (var i = 0; i < lighting.directionalLightCount; i++) {\n if (i < lighting.directionalLightCount) {\n PBRInfo_setDirectionalLight(&pbrInfo, lighting_getDirectionalLight(i).direction);\n color += calculateFinalColor(pbrInfo, lighting_getDirectionalLight(i).color);\n }\n }\n\n // Apply point light\n for (var i = 0; i < lighting.pointLightCount; i++) {\n if (i < lighting.pointLightCount) {\n PBRInfo_setPointLight(&pbrInfo, lighting_getPointLight(i));\n let attenuation = getPointLightAttenuation(lighting_getPointLight(i), distance(lighting_getPointLight(i).position, pbr_vPosition));\n color += calculateFinalColor(pbrInfo, lighting_getPointLight(i).color / attenuation);\n }\n }\n #endif\n\n // Calculate lighting contribution from image based lighting source (IBL)\n #ifdef USE_IBL\n if (pbrMaterial.IBLenabled) {\n color += getIBLContribution(pbrInfo, n, reflection);\n }\n #endif\n\n // Apply optional PBR terms for additional (optional) shading\n #ifdef HAS_OCCLUSIONMAP\n if (pbrMaterial.occlusionMapEnabled) {\n let ao = textureSample(pbr_occlusionSampler, pbr_occlusionSampler, pbr_vUV).r;\n color = mix(color, color * ao, pbrMaterial.occlusionStrength);\n }\n #endif\n\n #ifdef HAS_EMISSIVEMAP\n if (pbrMaterial.emissiveMapEnabled) {\n let emissive = SRGBtoLINEAR(textureSample(pbr_emissiveSampler, pbr_emissiveSampler, pbr_vUV)).rgb * pbrMaterial.emissiveFactor;\n color += emissive;\n }\n #endif\n\n // This section uses mix to override final color for reference app visualization\n // of various parameters in the lighting equation.\n #ifdef PBR_DEBUG\n // TODO: Figure out how to debug multiple lights\n\n // color = mix(color, F, pbr_scaleFGDSpec.x);\n // color = mix(color, vec3(G), pbr_scaleFGDSpec.y);\n // color = mix(color, vec3(D), pbr_scaleFGDSpec.z);\n // color = mix(color, specContrib, pbr_scaleFGDSpec.w);\n\n // color = mix(color, diffuseContrib, pbr_scaleDiffBaseMR.x);\n color = mix(color, baseColor.rgb, pbrMaterial.scaleDiffBaseMR.y);\n color = mix(color, vec3<f32>(metallic), pbrMaterial.scaleDiffBaseMR.z);\n color = mix(color, vec3<f32>(perceptualRoughness), pbrMaterial.scaleDiffBaseMR.w);\n #endif\n }\n\n return vec4<f32>(pow(color, vec3<f32>(1.0 / 2.2)), baseColor.a);\n}\n",vs:"out vec3 pbr_vPosition;\nout vec2 pbr_vUV;\n\n#ifdef HAS_NORMALS\n# ifdef HAS_TANGENTS\nout mat3 pbr_vTBN;\n# else\nout vec3 pbr_vNormal;\n# endif\n#endif\n\nvoid pbr_setPositionNormalTangentUV(vec4 position, vec4 normal, vec4 tangent, vec2 uv)\n{\n vec4 pos = pbrProjection.modelMatrix * position;\n pbr_vPosition = vec3(pos.xyz) / pos.w;\n\n#ifdef HAS_NORMALS\n#ifdef HAS_TANGENTS\n vec3 normalW = normalize(vec3(pbrProjection.normalMatrix * vec4(normal.xyz, 0.0)));\n vec3 tangentW = normalize(vec3(pbrProjection.modelMatrix * vec4(tangent.xyz, 0.0)));\n vec3 bitangentW = cross(normalW, tangentW) * tangent.w;\n pbr_vTBN = mat3(tangentW, bitangentW, normalW);\n#else // HAS_TANGENTS != 1\n pbr_vNormal = normalize(vec3(pbrProjection.modelMatrix * vec4(normal.xyz, 0.0)));\n#endif\n#endif\n\n#ifdef HAS_UV\n pbr_vUV = uv;\n#else\n pbr_vUV = vec2(0.,0.);\n#endif\n}\n",fs:"precision highp float;\n\nuniform pbrMaterialUniforms {\n // Material is unlit\n bool unlit;\n\n // Base color map\n bool baseColorMapEnabled;\n vec4 baseColorFactor;\n\n bool normalMapEnabled; \n float normalScale; // #ifdef HAS_NORMALMAP\n\n bool emissiveMapEnabled;\n vec3 emissiveFactor; // #ifdef HAS_EMISSIVEMAP\n\n vec2 metallicRoughnessValues;\n bool metallicRoughnessMapEnabled;\n\n bool occlusionMapEnabled;\n float occlusionStrength; // #ifdef HAS_OCCLUSIONMAP\n \n bool alphaCutoffEnabled;\n float alphaCutoff; // #ifdef ALPHA_CUTOFF\n \n // IBL\n bool IBLenabled;\n vec2 scaleIBLAmbient; // #ifdef USE_IBL\n \n // debugging flags used for shader output of intermediate PBR variables\n // #ifdef PBR_DEBUG\n vec4 scaleDiffBaseMR;\n vec4 scaleFGDSpec;\n // #endif\n} pbrMaterial;\n\n// Samplers\n#ifdef HAS_BASECOLORMAP\nuniform sampler2D pbr_baseColorSampler;\n#endif\n#ifdef HAS_NORMALMAP\nuniform sampler2D pbr_normalSampler;\n#endif\n#ifdef HAS_EMISSIVEMAP\nuniform sampler2D pbr_emissiveSampler;\n#endif\n#ifdef HAS_METALROUGHNESSMAP\nuniform sampler2D pbr_metallicRoughnessSampler;\n#endif\n#ifdef HAS_OCCLUSIONMAP\nuniform sampler2D pbr_occlusionSampler;\n#endif\n#ifdef USE_IBL\nuniform samplerCube pbr_diffuseEnvSampler;\nuniform samplerCube pbr_specularEnvSampler;\nuniform sampler2D pbr_brdfLUT;\n#endif\n\n// Inputs from vertex shader\n\nin vec3 pbr_vPosition;\nin vec2 pbr_vUV;\n\n#ifdef HAS_NORMALS\n#ifdef HAS_TANGENTS\nin mat3 pbr_vTBN;\n#else\nin vec3 pbr_vNormal;\n#endif\n#endif\n\n// Encapsulate the various inputs used by the various functions in the shading equation\n// We store values in this struct to simplify the integration of alternative implementations\n// of the shading terms, outlined in the Readme.MD Appendix.\nstruct PBRInfo {\n float NdotL; // cos angle between normal and light direction\n float NdotV; // cos angle between normal and view direction\n float NdotH; // cos angle between normal and half vector\n float LdotH; // cos angle between light direction and half vector\n float VdotH; // cos angle between view direction and half vector\n float perceptualRoughness; // roughness value, as authored by the model creator (input to shader)\n float metalness; // metallic value at the surface\n vec3 reflectance0; // full reflectance color (normal incidence angle)\n vec3 reflectance90; // reflectance color at grazing angle\n float alphaRoughness; // roughness mapped to a more linear change in the roughness (proposed by [2])\n vec3 diffuseColor; // color contribution from diffuse lighting\n vec3 specularColor; // color contribution from specular lighting\n vec3 n; // normal at surface point\n vec3 v; // vector from surface point to camera\n};\n\nconst float M_PI = 3.141592653589793;\nconst float c_MinRoughness = 0.04;\n\nvec4 SRGBtoLINEAR(vec4 srgbIn)\n{\n#ifdef MANUAL_SRGB\n#ifdef SRGB_FAST_APPROXIMATION\n vec3 linOut = pow(srgbIn.xyz,vec3(2.2));\n#else // SRGB_FAST_APPROXIMATION\n vec3 bLess = step(vec3(0.04045),srgbIn.xyz);\n vec3 linOut = mix( srgbIn.xyz/vec3(12.92), pow((srgbIn.xyz+vec3(0.055))/vec3(1.055),vec3(2.4)), bLess );\n#endif //SRGB_FAST_APPROXIMATION\n return vec4(linOut,srgbIn.w);;\n#else //MANUAL_SRGB\n return srgbIn;\n#endif //MANUAL_SRGB\n}\n\n// Find the normal for this fragment, pulling either from a predefined normal map\n// or from the interpolated mesh normal and tangent attributes.\nvec3 getNormal()\n{\n // Retrieve the tangent space matrix\n#ifndef HAS_TANGENTS\n vec3 pos_dx = dFdx(pbr_vPosition);\n vec3 pos_dy = dFdy(pbr_vPosition);\n vec3 tex_dx = dFdx(vec3(pbr_vUV, 0.0));\n vec3 tex_dy = dFdy(vec3(pbr_vUV, 0.0));\n vec3 t = (tex_dy.t * pos_dx - tex_dx.t * pos_dy) / (tex_dx.s * tex_dy.t - tex_dy.s * tex_dx.t);\n\n#ifdef HAS_NORMALS\n vec3 ng = normalize(pbr_vNormal);\n#else\n vec3 ng = cross(pos_dx, pos_dy);\n#endif\n\n t = normalize(t - ng * dot(ng, t));\n vec3 b = normalize(cross(ng, t));\n mat3 tbn = mat3(t, b, ng);\n#else // HAS_TANGENTS\n mat3 tbn = pbr_vTBN;\n#endif\n\n#ifdef HAS_NORMALMAP\n vec3 n = texture(pbr_normalSampler, pbr_vUV).rgb;\n n = normalize(tbn * ((2.0 * n - 1.0) * vec3(pbrMaterial.normalScale, pbrMaterial.normalScale, 1.0)));\n#else\n // The tbn matrix is linearly interpolated, so we need to re-normalize\n vec3 n = normalize(tbn[2].xyz);\n#endif\n\n return n;\n}\n\n// Calculation of the lighting contribution from an optional Image Based Light source.\n// Precomputed Environment Maps are required uniform inputs and are computed as outlined in [1].\n// See our README.md on Environment Maps [3] for additional discussion.\n#ifdef USE_IBL\nvec3 getIBLContribution(PBRInfo pbrInfo, vec3 n, vec3 reflection)\n{\n float mipCount = 9.0; // resolution of 512x512\n float lod = (pbrInfo.perceptualRoughness * mipCount);\n // retrieve a scale and bias to F0. See [1], Figure 3\n vec3 brdf = SRGBtoLINEAR(texture(pbr_brdfLUT,\n vec2(pbrInfo.NdotV, 1.0 - pbrInfo.perceptualRoughness))).rgb;\n vec3 diffuseLight = SRGBtoLINEAR(texture(pbr_diffuseEnvSampler, n)).rgb;\n\n#ifdef USE_TEX_LOD\n vec3 specularLight = SRGBtoLINEAR(texture(pbr_specularEnvSampler, reflection, lod)).rgb;\n#else\n vec3 specularLight = SRGBtoLINEAR(texture(pbr_specularEnvSampler, reflection)).rgb;\n#endif\n\n vec3 diffuse = diffuseLight * pbrInfo.diffuseColor;\n vec3 specular = specularLight * (pbrInfo.specularColor * brdf.x + brdf.y);\n\n // For presentation, this allows us to disable IBL terms\n diffuse *= pbrMaterial.scaleIBLAmbient.x;\n specular *= pbrMaterial.scaleIBLAmbient.y;\n\n return diffuse + specular;\n}\n#endif\n\n// Basic Lambertian diffuse\n// Implementation from Lambert's Photometria https://archive.org/details/lambertsphotome00lambgoog\n// See also [1], Equation 1\nvec3 diffuse(PBRInfo pbrInfo)\n{\n return pbrInfo.diffuseColor / M_PI;\n}\n\n// The following equation models the Fresnel reflectance term of the spec equation (aka F())\n// Implementation of fresnel from [4], Equation 15\nvec3 specularReflection(PBRInfo pbrInfo)\n{\n return pbrInfo.reflectance0 +\n (pbrInfo.reflectance90 - pbrInfo.reflectance0) *\n pow(clamp(1.0 - pbrInfo.VdotH, 0.0, 1.0), 5.0);\n}\n\n// This calculates the specular geometric attenuation (aka G()),\n// where rougher material will reflect less light back to the viewer.\n// This implementation is based on [1] Equation 4, and we adopt their modifications to\n// alphaRoughness as input as originally proposed in [2].\nfloat geometricOcclusion(PBRInfo pbrInfo)\n{\n float NdotL = pbrInfo.NdotL;\n float NdotV = pbrInfo.NdotV;\n float r = pbrInfo.alphaRoughness;\n\n float attenuationL = 2.0 * NdotL / (NdotL + sqrt(r * r + (1.0 - r * r) * (NdotL * NdotL)));\n float attenuationV = 2.0 * NdotV / (NdotV + sqrt(r * r + (1.0 - r * r) * (NdotV * NdotV)));\n return attenuationL * attenuationV;\n}\n\n// The following equation(s) model the distribution of microfacet normals across\n// the area being drawn (aka D())\n// Implementation from \"Average Irregularity Representation of a Roughened Surface\n// for Ray Reflection\" by T. S. Trowbridge, and K. P. Reitz\n// Follows the distribution function recommended in the SIGGRAPH 2013 course notes\n// from EPIC Games [1], Equation 3.\nfloat microfacetDistribution(PBRInfo pbrInfo)\n{\n float roughnessSq = pbrInfo.alphaRoughness * pbrInfo.alphaRoughness;\n float f = (pbrInfo.NdotH * roughnessSq - pbrInfo.NdotH) * pbrInfo.NdotH + 1.0;\n return roughnessSq / (M_PI * f * f);\n}\n\nvoid PBRInfo_setAmbientLight(inout PBRInfo pbrInfo) {\n pbrInfo.NdotL = 1.0;\n pbrInfo.NdotH = 0.0;\n pbrInfo.LdotH = 0.0;\n pbrInfo.VdotH = 1.0;\n}\n\nvoid PBRInfo_setDirectionalLight(inout PBRInfo pbrInfo, vec3 lightDirection) {\n vec3 n = pbrInfo.n;\n vec3 v = pbrInfo.v;\n vec3 l = normalize(lightDirection); // Vector from surface point to light\n vec3 h = normalize(l+v); // Half vector between both l and v\n\n pbrInfo.NdotL = clamp(dot(n, l), 0.001, 1.0);\n pbrInfo.NdotH = clamp(dot(n, h), 0.0, 1.0);\n pbrInfo.LdotH = clamp(dot(l, h), 0.0, 1.0);\n pbrInfo.VdotH = clamp(dot(v, h), 0.0, 1.0);\n}\n\nvoid PBRInfo_setPointLight(inout PBRInfo pbrInfo, PointLight pointLight) {\n vec3 light_direction = normalize(pointLight.position - pbr_vPosition);\n PBRInfo_setDirectionalLight(pbrInfo, light_direction);\n}\n\nvec3 calculateFinalColor(PBRInfo pbrInfo, vec3 lightColor) {\n // Calculate the shading terms for the microfacet specular shading model\n vec3 F = specularReflection(pbrInfo);\n float G = geometricOcclusion(pbrInfo);\n float D = microfacetDistribution(pbrInfo);\n\n // Calculation of analytical lighting contribution\n vec3 diffuseContrib = (1.0 - F) * diffuse(pbrInfo);\n vec3 specContrib = F * G * D / (4.0 * pbrInfo.NdotL * pbrInfo.NdotV);\n // Obtain final intensity as reflectance (BRDF) scaled by the energy of the light (cosine law)\n return pbrInfo.NdotL * lightColor * (diffuseContrib + specContrib);\n}\n\nvec4 pbr_filterColor(vec4 colorUnused)\n{\n // The albedo may be defined from a base texture or a flat color\n#ifdef HAS_BASECOLORMAP\n vec4 baseColor = SRGBtoLINEAR(texture(pbr_baseColorSampler, pbr_vUV)) * pbrMaterial.baseColorFactor;\n#else\n vec4 baseColor = pbrMaterial.baseColorFactor;\n#endif\n\n#ifdef ALPHA_CUTOFF\n if (baseColor.a < pbrMaterial.alphaCutoff) {\n discard;\n }\n#endif\n\n vec3 color = vec3(0, 0, 0);\n\n if(pbrMaterial.unlit){\n color.rgb = baseColor.rgb;\n }\n else{\n // Metallic and Roughness material properties are packed together\n // In glTF, these factors can be specified by fixed scalar values\n // or from a metallic-roughness map\n float perceptualRoughness = pbrMaterial.metallicRoughnessValues.y;\n float metallic = pbrMaterial.metallicRoughnessValues.x;\n#ifdef HAS_METALROUGHNESSMAP\n // Roughness is stored in the 'g' channel, metallic is stored in the 'b' channel.\n // This layout intentionally reserves the 'r' channel for (optional) occlusion map data\n vec4 mrSample = texture(pbr_metallicRoughnessSampler, pbr_vUV);\n perceptualRoughness = mrSample.g * perceptualRoughness;\n metallic = mrSample.b * metallic;\n#endif\n perceptualRoughness = clamp(perceptualRoughness, c_MinRoughness, 1.0);\n metallic = clamp(metallic, 0.0, 1.0);\n // Roughness is authored as perceptual roughness; as is convention,\n // convert to material roughness by squaring the perceptual roughness [2].\n float alphaRoughness = perceptualRoughness * perceptualRoughness;\n\n vec3 f0 = vec3(0.04);\n vec3 diffuseColor = baseColor.rgb * (vec3(1.0) - f0);\n diffuseColor *= 1.0 - metallic;\n vec3 specularColor = mix(f0, baseColor.rgb, metallic);\n\n // Compute reflectance.\n float reflectance = max(max(specularColor.r, specularColor.g), specularColor.b);\n\n // For typical incident reflectance range (between 4% to 100%) set the grazing\n // reflectance to 100% for typical fresnel effect.\n // For very low reflectance range on highly diffuse objects (below 4%),\n // incrementally reduce grazing reflecance to 0%.\n float reflectance90 = clamp(reflectance * 25.0, 0.0, 1.0);\n vec3 specularEnvironmentR0 = specularColor.rgb;\n vec3 specularEnvironmentR90 = vec3(1.0, 1.0, 1.0) * reflectance90;\n\n vec3 n = getNormal(); // normal at surface point\n vec3 v = normalize(pbrProjection.camera - pbr_vPosition); // Vector from surface point to camera\n\n float NdotV = clamp(abs(dot(n, v)), 0.001, 1.0);\n vec3 reflection = -normalize(reflect(v, n));\n\n PBRInfo pbrInfo = PBRInfo(\n 0.0, // NdotL\n NdotV,\n 0.0, // NdotH\n 0.0, // LdotH\n 0.0, // VdotH\n perceptualRoughness,\n metallic,\n specularEnvironmentR0,\n specularEnvironmentR90,\n alphaRoughness,\n diffuseColor,\n specularColor,\n n,\n v\n );\n\n\n#ifdef USE_LIGHTS\n // Apply ambient light\n PBRInfo_setAmbientLight(pbrInfo);\n color += calculateFinalColor(pbrInfo, lighting.ambientColor);\n\n // Apply directional light\n for(int i = 0; i < lighting.directionalLightCount; i++) {\n if (i < lighting.directionalLightCount) {\n PBRInfo_setDirectionalLight(pbrInfo, lighting_getDirectionalLight(i).direction);\n color += calculateFinalColor(pbrInfo, lighting_getDirectionalLight(i).color);\n }\n }\n\n // Apply point light\n for(int i = 0; i < lighting.pointLightCount; i++) {\n if (i < lighting.pointLightCount) {\n PBRInfo_setPointLight(pbrInfo, lighting_getPointLight(i));\n float attenuation = getPointLightAttenuation(lighting_getPointLight(i), distance(lighting_getPointLight(i).position, pbr_vPosition));\n color += calculateFinalColor(pbrInfo, lighting_getPointLight(i).color / attenuation);\n }\n }\n#endif\n\n // Calculate lighting contribution from image based lighting source (IBL)\n#ifdef USE_IBL\n if (pbrMaterial.IBLenabled) {\n color += getIBLContribution(pbrInfo, n, reflection);\n }\n#endif\n\n // Apply optional PBR terms for additional (optional) shading\n#ifdef HAS_OCCLUSIONMAP\n if (pbrMaterial.occlusionMapEnabled) {\n float ao = texture(pbr_occlusionSampler, pbr_vUV).r;\n color = mix(color, color * ao, pbrMaterial.occlusionStrength);\n }\n#endif\n\n#ifdef HAS_EMISSIVEMAP\n if (pbrMaterial.emissiveMapEnabled) {\n vec3 emissive = SRGBtoLINEAR(texture(pbr_emissiveSampler, pbr_vUV)).rgb * pbrMaterial.emissiveFactor;\n color += emissive;\n }\n#endif\n\n // This section uses mix to override final color for reference app visualization\n // of various parameters in the lighting equation.\n#ifdef PBR_DEBUG\n // TODO: Figure out how to debug multiple lights\n\n // color = mix(color, F, pbr_scaleFGDSpec.x);\n // color = mix(color, vec3(G), pbr_scaleFGDSpec.y);\n // color = mix(color, vec3(D), pbr_scaleFGDSpec.z);\n // color = mix(color, specContrib, pbr_scaleFGDSpec.w);\n\n // color = mix(color, diffuseContrib, pbr_scaleDiffBaseMR.x);\n color = mix(color, baseColor.rgb, pbrMaterial.scaleDiffBaseMR.y);\n color = mix(color, vec3(metallic), pbrMaterial.scaleDiffBaseMR.z);\n color = mix(color, vec3(perceptualRoughness), pbrMaterial.scaleDiffBaseMR.w);\n#endif\n\n }\n\n return vec4(pow(color,vec3(1.0/2.2)), baseColor.a);\n}\n",defines:{LIGHTING_FRAGMENT:!0,HAS_NORMALMAP:!1,HAS_EMISSIVEMAP:!1,HAS_OCCLUSIONMAP:!1,HAS_BASECOLORMAP:!1,HAS_METALROUGHNESSMAP:!1,ALPHA_CUTOFF:!1,USE_IBL:!1,PBR_DEBUG:!1},getUniforms:n=>n,uniformTypes:{unlit:"i32",baseColorMapEnabled:"i32",baseColorFactor:"vec4<f32>",normalMapEnabled:"i32",normalScale:"f32",emissiveMapEnabled:"i32",emissiveFactor:"vec3<f32>",metallicRoughnessValues:"vec2<f32>",metallicRoughnessMapEnabled:"i32",occlusionMapEnabled:"i32",occlusionStrength:"f32",alphaCutoffEnabled:"i32",alphaCutoff:"f32",IBLenabled:"i32",scaleIBLAmbient:"vec2<f32>",scaleDiffBaseMR:"vec4<f32>",scaleFGDSpec:"vec4<f32>"}};class v{id;matrix=new o;display=!0;position=new r;rotation=new r;scale=new r(1,1,1);userData={};props={};constructor(n={}){const{id:e}=n;this.id=e||i(this.constructor.name),this._setScenegraphNodeProps(n)}getBounds(){return null}destroy(){}delete(){this.destroy()}setProps(n){return this._setScenegraphNodeProps(n),this}toString(){return`{type: ScenegraphNode, id: ${this.id})}`}setPosition(n){return this.position=n,this}setRotation(n){return this.rotation=n,this}setScale(n){return this.scale=n,this}setMatrix(n,e=!0){e?this.matrix.copy(n):this.matrix=n}setMatrixComponents(n){const{position:e,rotation:t,scale:o,update:r=!0}=n;return e&&this.setPosition(e),t&&this.setRotation(t),o&&this.setScale(o),r&&this.updateMatrix(),this}updateMatrix(){const n=this.position,e=this.rotation,t=this.scale;return this.matrix.identity(),this.matrix.translate(n),this.matrix.rotateXYZ(e),this.matrix.scale(t),this}update(n={}){const{position:e,rotation:t,scale:o}=n;return e&&this.setPosition(e),t&&this.setRotation(t),o&&this.setScale(o),this.updateMatrix(),this}getCoordinateUniforms(n,e){e=e||this.matrix;const t=new o(n).multiplyRight(e),r=t.invert(),i=r.transpose();return{viewMatrix:n,modelMatrix:e,objectMatrix:e,worldMatrix:t,worldInverseMatrix:r,worldInverseTransposeMatrix:i}}_setScenegraphNodeProps(n){"position"in n&&this.setPosition(n.position),"rotation"in n&&this.setRotation(n.rotation),"scale"in n&&this.setScale(n.scale),"matrix"in n&&this.setMatrix(n.matrix),Object.assign(this.props,n)}}class _ extends v{children;constructor(n={}){n=Array.isArray(n)?{children:n}:n;const{children:e=[]}=n;a.assert(e.every((n=>n instanceof v)),"every child must an instance of ScenegraphNode"),super(n),this.children=e}getBounds(){const n=[[1/0,1/0,1/0],[-1/0,-1/0,-1/0]];return this.traverse(((e,{worldMatrix:t})=>{const o=e.getBounds();if(!o)return;const[i,a]=o,s=new r(i).add(a).divide([2,2,2]);t.transformAsPoint(s,s);const l=new r(a).subtract(i).divide([2,2,2]);t.transformAsVector(l,l);for(let e=0;e<8;e++){const t=new r(1&e?-1:1,2&e?-1:1,4&e?-1:1).multiply(l).add(s);for(let e=0;e<3;e++)n[0][e]=Math.min(n[0][e],t[e]),n[1][e]=Math.max(n[1][e],t[e])}})),Number.isFinite(n[0][0])?n:null}destroy(){this.children.forEach((n=>n.destroy())),this.removeAll(),super.destroy()}add(...n){for(const e of n)Array.isArray(e)?this.add(...e):this.children.push(e);return this}remove(n){const e=this.children,t=e.indexOf(n);return t>-1&&e.splice(t,1),this}removeAll(){return this.children=[],this}traverse(n,{worldMatrix:e=new o}={}){const t=new o(e).multiplyRight(this.matrix);for(const e of this.children)e instanceof _?e.traverse(n,{worldMatrix:t}):n(e,{worldMatrix:t})}}class S extends v{model;bounds=null;managedResources;constructor(n){super(n),this.model=n.model,this.managedResources=n.managedResources||[],this.bounds=n.bounds||null,this.setProps(n)}destroy(){this.model&&(this.model.destroy(),this.model=null),this.managedResources.forEach((n=>n.destroy())),this.managedResources=[]}getBounds(){return this.bounds}draw(n){return this.model.draw(n)}}function I(n){return{addressModeU:A(n.wrapS),addressModeV:A(n.wrapT),magFilter:M(n.magFilter),...R(n.minFilter)}}function A(n){switch(n){case 33071:return"clamp-to-edge";case 10497:return"repeat";case 33648:return"mirror-repeat";default:return}}function M(n){switch(n){case 9728:return"nearest";case 9729:return"linear";default:return}}function R(n){switch(n){case 9728:return{minFilter:"nearest"};case 9729:return{minFilter:"linear"};case 9984:return{minFilter:"nearest",mipmapFilter:"nearest"};case 9985:return{minFilter:"linear",mipmapFilter:"nearest"};case 9986:return{minFilter:"nearest",mipmapFilter:"linear"};case 9987:return{minFilter:"linear",mipmapFilter:"linear"};default:return{}}}function L(n,e,t,o){const r={defines:{MANUAL_SRGB:!0,SRGB_FAST_APPROXIMATION:!0},bindings:{},uniforms:{camera:[0,0,0],metallicRoughnessValues:[1,1]},parameters:{},glParameters:{},generatedTextures:[]};r.defines.USE_TEX_LOD=!0;const{imageBasedLightingEnvironment:i}=o;return i&&(r.bindings.pbr_diffuseEnvSampler=i.diffuseEnvSampler.texture,r.bindings.pbr_specularEnvSampler=i.specularEnvSampler.texture,r.bindings.pbr_BrdfLUT=i.brdfLutTexture.texture,r.uniforms.scaleIBLAmbient=[1,1]),o?.pbrDebug&&(r.defines.PBR_DEBUG=!0,r.uniforms.scaleDiffBaseMR=[0,0,0,0],r.uniforms.scaleFGDSpec=[0,0,0,0]),t.NORMAL&&(r.defines.HAS_NORMALS=!0),t.TANGENT&&o?.useTangents&&(r.defines.HAS_TANGENTS=!0),t.TEXCOORD_0&&(r.defines.HAS_UV=!0),o?.imageBasedLightingEnvironment&&(r.defines.USE_IBL=!0),o?.lights&&(r.defines.USE_LIGHTS=!0),e&&function(n,e,t){if(t.uniforms.unlit=Boolean(e.unlit),e.pbrMetallicRoughness&&function(n,e,t){e.baseColorTexture&&N(n,e.baseColorTexture,"pbr_baseColorSampler","HAS_BASECOLORMAP",t),t.uniforms.baseColorFactor=e.baseColorFactor||[1,1,1,1],e.metallicRoughnessTexture&&N(n,e.metallicRoughnessTexture,"pbr_metallicRoughnessSampler","HAS_METALROUGHNESSMAP",t);const{metallicFactor:o=1,roughnessFactor:r=1}=e;t.uniforms.metallicRoughnessValues=[o,r]}(n,e.pbrMetallicRoughness,t),e.normalTexture){N(n,e.normalTexture,"pbr_normalSampler","HAS_NORMALMAP",t);const{scale:o=1}=e.normalTexture;t.uniforms.normalScale=o}if(e.occlusionTexture){N(n,e.occlusionTexture,"pbr_occlusionSampler","HAS_OCCLUSIONMAP",t);const{strength:o=1}=e.occlusionTexture;t.uniforms.occlusionStrength=o}switch(e.emissiveTexture&&(N(n,e.emissiveTexture,"pbr_emissiveSampler","HAS_EMISSIVEMAP",t),t.uniforms.emissiveFactor=e.emissiveFactor||[0,0,0]),e.alphaMode||"MASK"){case"MASK":const{alphaCutoff:n=.5}=e;t.defines.ALPHA_CUTOFF=!0,t.uniforms.alphaCutoff=n;break;case"BLEND":a.warn("glTF BLEND alphaMode might not work well because it requires mesh sorting")(),t.parameters.blend=!0,t.parameters.blendColorOperation="add",t.parameters.blendColorSrcFactor="src-alpha",t.parameters.blendColorDstFactor="one-minus-src-alpha",t.parameters.blendAlphaOperation="add",t.parameters.blendAlphaSrcFactor="one",t.parameters.blendAlphaDstFactor="one-minus-src-alpha",t.glParameters.blend=!0,t.glParameters.blendEquation=32774,t.glParameters.blendFunc=[770,771,1,771]}}(n,e,r),r}function N(n,e,t,o,r){const i=e.texture.source.image;let a;a=i.compressed?i:{data:i};const s={wrapS:10497,wrapT:10497,...e?.texture?.sampler},l=n.createTexture({id:e.uniformName||e.id,sampler:I(s),...a});r.bindings[t]=l,o&&(r.defines[o]=!0),r.generatedTextures.push(l)}var P;!function(n){n[n.POINTS=0]="POINTS",n[n.LINES=1]="LINES",n[n.LINE_LOOP=2]="LINE_LOOP",n[n.LINE_STRIP=3]="LINE_STRIP",n[n.TRIANGLES=4]="TRIANGLES",n[n.TRIANGLE_STRIP=5]="TRIANGLE_STRIP",n[n.TRIANGLE_FAN=6]="TRIANGLE_FAN"}(P||(P={}));const C={modelOptions:{},pbrDebug:!1,imageBasedLightingEnvironment:void 0,lights:!0,useTangents:!1};function x(n,e,t={}){const o={...C,...t},r=e.scenes.map((t=>function(n,e,t,o){const r=(e.nodes||[]).map((e=>E(n,e,t,o)));return new _({id:e.name||e.id,children:r})}(n,t,e.nodes,o)));return r}function E(n,e,t,r){if(!e._node){const i=(e.children||[]).map((e=>E(n,e,t,r)));e.mesh&&i.push(function(n,e,t){if(!e._mesh){const o=(e.primitives||[]).map(((o,r)=>function(n,e,t,o,r){const i=e.name||`${o.name||o.id}-primitive-${t}`,l=function(n){switch(n){case P.POINTS:return"point-list";case P.LINES:return"line-list";case P.LINE_STRIP:return"line-strip";case P.TRIANGLES:return"triangle-list";case P.TRIANGLE_STRIP:return"triangle-strip";default:throw new Error(String(n))}}(e.mode||4),c=e.indices?e.indices.count:function(){throw new Error("getVertexCount not implemented")}(),f=y(i,e,l),p=L(n,e.material,f.attributes,r),d=function(n,e){const{id:t,geometry:o,parsedPPBRMaterial:r,vertexCount:i,modelOptions:l={}}=e;a.info(4,"createGLTFModel defines: ",r.defines)();const c={id:t,source:"\nlayout(0) positions: vec4; // in vec4 POSITION;\n\n #ifdef HAS_NORMALS\n in vec4 normals; // in vec4 NORMAL;\n #endif\n\n #ifdef HAS_TANGENTS\n in vec4 TANGENT;\n #endif\n\n #ifdef HAS_UV\n // in vec2 TEXCOORD_0;\n in vec2 texCoords;\n #endif\n\n@vertex\n void main(void) {\n vec4 _NORMAL = vec4(0.);\n vec4 _TANGENT = vec4(0.);\n vec2 _TEXCOORD_0 = vec2(0.);\n\n #ifdef HAS_NORMALS\n _NORMAL = normals;\n #endif\n\n #ifdef HAS_TANGENTS\n _TANGENT = TANGENT;\n #endif\n\n #ifdef HAS_UV\n _TEXCOORD_0 = texCoords;\n #endif\n\n pbr_setPositionNormalTangentUV(positions, _NORMAL, _TANGENT, _TEXCOORD_0);\n gl_Position = u_MVPMatrix * positions;\n }\n\n@fragment\n out vec4 fragmentColor;\n\n void main(void) {\n vec3 pos = pbr_vPosition;\n fragmentColor = pbr_filterColor(vec4(1.0));\n }\n",vs:"#version 300 es\n\n // in vec4 POSITION;\n in vec4 positions;\n\n #ifdef HAS_NORMALS\n // in vec4 NORMAL;\n in vec4 normals;\n #endif\n\n #ifdef HAS_TANGENTS\n in vec4 TANGENT;\n #endif\n\n #ifdef HAS_UV\n // in vec2 TEXCOORD_0;\n in vec2 texCoords;\n #endif\n\n void main(void) {\n vec4 _NORMAL = vec4(0.);\n vec4 _TANGENT = vec4(0.);\n vec2 _TEXCOORD_0 = vec2(0.);\n\n #ifdef HAS_NORMALS\n _NORMAL = normals;\n #endif\n\n #ifdef HAS_TANGENTS\n _TANGENT = TANGENT;\n #endif\n\n #ifdef HAS_UV\n _TEXCOORD_0 = texCoords;\n #endif\n\n pbr_setPositionNormalTangentUV(positions, _NORMAL, _TANGENT, _TEXCOORD_0);\n gl_Position = pbrProjection.modelViewProjectionMatrix * positions;\n }\n",fs:"#version 300 es\n out vec4 fragmentColor;\n\n void main(void) {\n vec3 pos = pbr_vPosition;\n fragmentColor = pbr_filterColor(vec4(1.0));\n }\n",geometry:o,topology:o.topology,vertexCount:i,modules:[h],...l,defines:{...r.defines,...l.defines},parameters:{depthWriteEnabled:!0,depthCompare:"less",depthFormat:"depth24plus",cullMode:"back",...r.parameters,...l.parameters}},f=new s(n,c),{camera:p,...d}={...r.uniforms,...l.uniforms,...r.bindings,...l.bindings};return f.shaderInputs.setProps({pbrMaterial:d,pbrProjection:{camera:p}}),new S({managedResources:[],model:f})}(n,{id:i,geometry:y(i,e,l),parsedPPBRMaterial:p,modelOptions:r.modelOptions,vertexCount:c});return d.bounds=[e.attributes.POSITION.min,e.attributes.POSITION.max],d}(n,o,r,e,t))),r=new _({id:e.name||e.id,children:o});e._mesh=r}return e._mesh}(n,e.mesh,r));const l=new _({id:e.name||e.id,children:i});if(e.matrix)l.setMatrix(e.matrix);else{if(l.matrix.identity(),e.translation&&l.matrix.translate(e.translation),e.rotation){const n=(new o).fromQuaternion(e.rotation);l.matrix.multiplyRight(n)}e.scale&&l.matrix.scale(e.scale)}e._node=l}return t.find((n=>n.id===e.id))._node=e._node,e._node}function y(n,e,t){const o={};for(const[n,t]of Object.entries(e.attributes)){const{components:e,size:r,value:i}=t;o[n]={size:r??e,value:i}}return new l({id:n,topology:t,indices:e.indices.value,attributes:o})}const T=new c;class B{animation;startTime=0;playing=!0;speed=1;constructor(n){this.animation=n.animation,this.animation.name||="unnamed",Object.assign(this,n)}setTime(n){if(!this.playing)return;const e=(n/1e3-this.startTime)*this.speed;this.animation.channels.forEach((({sampler:n,target:t,path:o})=>{(function(n,{input:e,interpolation:t,output:o},r,i){const s=n%e[e.length-1],l=e.findIndex((n=>n>=s)),c=Math.max(0,l-1);if(!Array.isArray(r[i]))switch(i){case"translation":r[i]=[0,0,0];break;case"rotation":r[i]=[0,0,0,1];break;case"scale":r[i]=[1,1,1];break;default:a.warn(`Bad animation path ${i}`)()}const f=e[c],p=e[l];switch(t){case"STEP":!function(n,e,t){if(!n[e])throw new Error;for(let o=0;o<t.length;o++)n[e][o]=t[o]}(r,i,o[c]);break;case"LINEAR":p>f&&function(n,e,t,o,r){if(!n[e])throw new Error;if("rotation"===e){T.slerp({start:t,target:o,ratio:r});for(let t=0;t<T.length;t++)n[e][t]=T[t]}else for(let i=0;i<t.length;i++)n[e][i]=r*o[i]+(1-r)*t[i]}(r,i,o[c],o[l],(s-f)/(p-f));break;case"CUBICSPLINE":p>f&&function(n,e,{p0:t,outTangent0:o,inTangent1:r,p1:i,tDiff:a,ratio:s}){if(!n[e])throw new Error;for(let l=0;l<n[e].length;l++){const c=o[l]*a,f=r[l]*a;n[e][l]=(2*Math.pow(s,3)-3*Math.pow(s,2)+1)*t[l]+(Math.pow(s,3)-2*Math.pow(s,2)+s)*c+(-2*Math.pow(s,3)+3*Math.pow(s,2))*i[l]+(Math.pow(s,3)-Math.pow(s,2))*f}}(r,i,{p0:o[3*c+1],outTangent0:o[3*c+2],inTangent1:o[3*l+0],p1:o[3*l+1],tDiff:p-f,ratio:(s-f)/(p-f)});break;default:a.warn(`Interpolation ${t} not supported`)()}})(e,n,t,o),function(n,e){if(e.matrix.identity(),n.translation&&e.matrix.translate(n.translation),n.rotation){const t=H.fromQuaternion(n.rotation);e.matrix.multiplyRight(t)}n.scale&&e.matrix.scale(n.scale)}(t,t._node)}))}}class O{animations;constructor(n){this.animations=n.animations.map(((n,e)=>new B({animation:{name:n.name||`Animation-${e}`,channels:n.channels}})))}animate(n){a.warn("GLTFAnimator#animate is deprecated. Use GLTFAnimator#setTime instead")(),this.setTime(n)}setTime(n){this.animations.forEach((e=>e.setTime(n)))}getAnimations(){return this.animations}}const H=new o,w={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},G={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array};function F(n){if(!n._animation){const{typedArray:e,components:t}=function(n){const e=G[n.componentType],t=w[n.type],o=t*n.count,{buffer:r,byteOffset:i=0}=n.bufferView?.data??{};return{typedArray:new e(r,i+(n.byteOffset||0),o),components:t}}(n);if(1===t)n._animation=Array.from(e);else{const o=[];for(let n=0;n<e.length;n+=t)o.push(Array.from(e.slice(n,n+t)));n._animation=o}}return n._animation}function V(n){if(ArrayBuffer.isView(n)||n instanceof ArrayBuffer||n instanceof ImageBitmap)return n;if(Array.isArray(n))return n.map(V);if(n&&"object"==typeof n){const e={};for(const t in n)e[t]=V(n[t]);return e}return n}const U="uniform scenegraphUniforms {\n float sizeScale;\n float sizeMinPixels;\n float sizeMaxPixels;\n mat4 sceneModelMatrix;\n bool composeModelMatrix;\n} scenegraph;\n",D={name:"scenegraph",vs:U,fs:U,uniformTypes:{sizeScale:"f32",sizeMinPixels:"f32",sizeMaxPixels:"f32",sceneModelMatrix:"mat4x4<f32>",composeModelMatrix:"f32"}},z=[255,255,255,255],j={scenegraph:{type:"object",value:null,async:!0},getScene:n=>n&&n.scenes?"object"==typeof n.scene?n.scene:n.scenes[n.scene||0]:n,getAnimator:n=>n&&n.animator,_animations:null,sizeScale:{type:"number",value:1,min:0},sizeMinPixels:{type:"number",min:0,value:0},sizeMaxPixels:{type:"number",min:0,value:Number.MAX_SAFE_INTEGER},getPosition:{type:"accessor",value:n=>n.position},getColor:{type:"accessor",value:z},_lighting:"flat",_imageBasedLightingEnvironment:void 0,getOrientation:{type:"accessor",value:[0,0,0]},getScale:{type:"accessor",value:[1,1,1]},getTranslation:{type:"accessor",value:[0,0,0]},getTransformMatrix:{type:"accessor",value:[]},loaders:[e]};class q extends f{getShaders(){const n={};let e;return"pbr"===this.props._lighting?(e=h,n.LIGHTING_PBR=1):e={name:"pbrMaterial"},super.getShaders({defines:n,vs:"#version 300 es\n#define SHADER_NAME scenegraph-layer-vertex-shader\nin vec3 instancePositions;\nin vec3 instancePositions64Low;\nin vec4 instanceColors;\nin vec3 instancePickingColors;\nin vec3 instanceModelMatrixCol0;\nin vec3 instanceModelMatrixCol1;\nin vec3 instanceModelMatrixCol2;\nin vec3 instanceTranslation;\nin vec3 positions;\n#ifdef HAS_UV\nin vec2 texCoords;\n#endif\n#ifdef LIGHTING_PBR\n#ifdef HAS_NORMALS\nin vec3 normals;\n#endif\n#endif\nout vec4 vColor;\n#ifndef LIGHTING_PBR\n#ifdef HAS_UV\nout vec2 vTEXCOORD_0;\n#endif\n#endif\nvoid main(void) {\n#if defined(HAS_UV) && !defined(LIGHTING_PBR)\nvTEXCOORD_0 = texCoords;\ngeometry.uv = texCoords;\n#endif\ngeometry.worldPosition = instancePositions;\ngeometry.pickingColor = instancePickingColors;\nmat3 instanceModelMatrix = mat3(instanceModelMatrixCol0, instanceModelMatrixCol1, instanceModelMatrixCol2);\nvec3 normal = vec3(0.0, 0.0, 1.0);\n#ifdef LIGHTING_PBR\n#ifdef HAS_NORMALS\nnormal = instanceModelMatrix * (scenegraph.sceneModelMatrix * vec4(normals, 0.0)).xyz;\n#endif\n#endif\nfloat originalSize = project_size_to_pixel(scenegraph.sizeScale);\nfloat clampedSize = clamp(originalSize, scenegraph.sizeMinPixels, scenegraph.sizeMaxPixels);\nvec3 pos = (instanceModelMatrix * (scenegraph.sceneModelMatrix * vec4(positions, 1.0)).xyz) * scenegraph.sizeScale * (clampedSize / originalSize) + instanceTranslation;\nif(scenegraph.composeModelMatrix) {\nDECKGL_FILTER_SIZE(pos, geometry);\ngeometry.normal = project_normal(normal);\ngeometry.worldPosition += pos;\ngl_Position = project_position_to_clipspace(pos + instancePositions, instancePositions64Low, vec3(0.0), geometry.position);\n}\nelse {\npos = project_size(pos);\nDECKGL_FILTER_SIZE(pos, geometry);\ngl_Position = project_position_to_clipspace(instancePositions, instancePositions64Low, pos, geometry.position);\ngeometry.normal = project_normal(normal);\n}\nDECKGL_FILTER_GL_POSITION(gl_Position, geometry);\n#ifdef LIGHTING_PBR\npbr_vPosition = geometry.position.xyz;\n#ifdef HAS_NORMALS\npbr_vNormal = geometry.normal;\n#endif\n#ifdef HAS_UV\npbr_vUV = texCoords;\n#else\npbr_vUV = vec2(0., 0.);\n#endif\ngeometry.uv = pbr_vUV;\n#endif\nvColor = instanceColors;\nDECKGL_FILTER_COLOR(vColor, geometry);\n}\n",fs:"#version 300 es\n#define SHADER_NAME scenegraph-layer-fragment-shader\nin vec4 vColor;\nout vec4 fragColor;\n#ifndef LIGHTING_PBR\n#if defined(HAS_UV) && defined(HAS_BASECOLORMAP)\nin vec2 vTEXCOORD_0;\nuniform sampler2D pbr_baseColorSampler;\n#endif\n#endif\nvoid main(void) {\n#ifdef LIGHTING_PBR\nfragColor = vColor * pbr_filterColor(vec4(0));\ngeometry.uv = pbr_vUV;\n#else\n#if defined(HAS_UV) && defined(HAS_BASECOLORMAP)\nfragColor = vColor * texture(pbr_baseColorSampler, vTEXCOORD_0);\ngeometry.uv = vTEXCOORD_0;\n#else\nfragColor = vColor;\n#endif\n#endif\nfragColor.a *= layer.opacity;\nDECKGL_FILTER_COLOR(fragColor, geometry);\n}\n",modules:[p,d,D,e]})}initializeState(){this.getAttributeManager().addInstanced({instancePositions:{size:3,type:"float64",fp64:this.use64bitPositions(),accessor:"getPosition",transition:!0},instanceColors:{type:"unorm8",size:this.props.colorFormat.length,accessor:"getColor",defaultValue:z,transition:!0},instanceModelMatrix:u})}updateState(n){super.updateState(n);const{props:e,oldProps:t}=n;e.scenegraph!==t.scenegraph?this._updateScenegraph():e._animations!==t._animations&&this._applyAnimationsProp(this.state.animator,e._animations)}finalizeState(n){super.finalizeState(n),this.state.scenegraph?.destroy()}get isLoaded(){return Boolean(this.state?.scenegraph&&super.isLoaded)}_updateScenegraph(){const e=this.props,{device:t}=this.context;let o=null;if(e.scenegraph instanceof v)o={scenes:[e.scenegraph]};else if(e.scenegraph&&"object"==typeof e.scenegraph){const r=e.scenegraph,i=r.json?n(r):r,a=function(n,e,t){const o=x(n,e=V(e),t),r=function(n){return(n.animations||[]).map(((e,t)=>{const o=e.name||`Animation-${t}`,r=e.samplers.map((({input:e,interpolation:t="LINEAR",output:o})=>({input:F(n.accessors[e]),interpolation:t,output:F(n.accessors[o])})));return{name:o,channels:e.channels.map((({sampler:e,target:t})=>({sampler:r[e],target:n.nodes[t.node??0],path:t.path})))}}))}(e);return{scenes:o,animator:new O({animations:r})}}(t,i,this._getModelOptions());o={gltf:i,...a},async function(n){const e=[];return n.scenes.forEach((n=>{n.traverse((()=>{}))})),await async function(){for(;e.some((n=>!n.loaded));)await new Promise((n=>requestAnimationFrame(n)))}()}(a).then((()=>{this.setNeedsRedraw()})).catch((n=>{this.raiseError(n,"loading glTF")}))}const r={layer:this,device:this.context.device},i=e.getScene(o,r),a=e.getAnimator(o,r);if(i instanceof _){this.state.scenegraph?.destroy(),this._applyAnimationsProp(a,e._animations);const n=[];i.traverse((e=>{e instanceof S&&n.push(e.model)})),this.setState({scenegraph:i,animator:a,models:n}),this.getAttributeManager().invalidateAll()}else null!==i&&m.warn("invalid scenegraph:",i)()}_applyAnimationsProp(n,e){if(!n||!e)return;const t=n.getAnimations();Object.keys(e).sort().forEach((n=>{const o=e[n];if("*"===n)t.forEach((n=>{Object.assign(n,o)}));else if(Number.isFinite(Number(n))){const e=Number(n);e>=0&&e<t.length?Object.assign(t[e],o):m.warn(`animation ${n} not found`)()}else{const e=t.find((({animation:e})=>e.name===n));e?Object.assign(e,o):m.warn(`animation ${n} not found`)()}}))}_getModelOptions(){const{_imageBasedLightingEnvironment:n}=this.props;let e;return n&&(e="function"==typeof n?n({gl:this.context.gl,layer:this}):n),{imageBasedLightingEnvironment:e,modelOptions:{id:this.props.id,isInstanced:!0,bufferLayout:this.getAttributeManager().getBufferLayouts(),...this.getShaders()},useTangents:!1}}draw({context:n}){if(!this.state.scenegraph)return;this.props._animations&&this.state.animator&&(this.state.animator.animate(n.timeline.getTime()),this.setNeedsRedraw());const{viewport:e,renderPass:t}=this.context,{sizeScale:o,sizeMinPixels:r,sizeMaxPixels:i,coordinateSystem:a}=this.props,s={camera:e.cameraPosition},l=this.getNumInstances();this.state.scenegraph.traverse(((n,{worldMatrix:c})=>{if(n instanceof S){const{model:f}=n;f.setInstanceCount(l);const p={sizeScale:o,sizeMinPixels:r,sizeMaxPixels:i,composeModelMatrix:b(e,a),sceneModelMatrix:c};f.shaderInputs.setProps({pbrProjection:s,scenegraph:p}),f.draw(t)}}))}}q.defaultProps=j,q.layerName="ScenegraphLayer";export{q as S,L as a,h as p}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const o={fillColor:"rgba(0, 100, 255, 0.3)",fillOpacity:.3,strokeColor:"rgba(0, 100, 255, 1)",strokeWidth:2,strokeOpacity:1,pointRadius:6,pointColor:"rgba(0, 100, 255, 1)",pointOpacity:1,textColor:"#000000",textSize:12};export{o as D}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function r(r){return"object"==typeof r&&null!==r&&("string"==typeof r.name&&null!=(t=r.rules)&&"number"==typeof t.length&&(Array.isArray(t)||void 0!==t[0]));var t}export{r as i}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Components, JSX } from "../types/components";
|
|
2
|
+
|
|
3
|
+
interface VMapBuilder extends Components.VMapBuilder, HTMLElement {}
|
|
4
|
+
export const VMapBuilder: {
|
|
5
|
+
prototype: VMapBuilder;
|
|
6
|
+
new (): VMapBuilder;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Used to define this component and all nested components recursively.
|
|
10
|
+
*/
|
|
11
|
+
export const defineCustomElement: () => void;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{transformTag as e,proxyCustomElement as t,HTMLElement as r,createEvent as n,h as o}from"@stencil/core/internal/client";import{l as a,V as i}from"./events.js";import{M as s}from"./messages.js";import{d as l}from"./v-map2.js";import{d as c}from"./v-map-layer-geojson2.js";import{d as u}from"./v-map-layer-geotiff2.js";import{d as f}from"./v-map-layer-google2.js";import{d as p}from"./v-map-layer-osm2.js";import{d as m}from"./v-map-layer-scatterplot2.js";import{d}from"./v-map-layer-terrain2.js";import{d as y}from"./v-map-layer-tile3d2.js";import{d as h}from"./v-map-layer-wcs2.js";import{d as b}from"./v-map-layer-wfs2.js";import{d as v}from"./v-map-layer-wkt2.js";import{d as g}from"./v-map-layer-wms2.js";import{d as w}from"./v-map-layer-xyz2.js";import{d as k}from"./v-map-layergroup2.js";import{d as j}from"./v-map-style2.js";
|
|
2
|
+
/*! js-yaml 4.1.0 https://github.com/nodeca/js-yaml @license MIT */var x=function(e){return"object"==typeof e&&null!==e},O=function(e,t){var r,n="";for(r=0;r<t;r+=1)n+=e;return n},A=function(e){return 0===e&&-1/0==1/e};function N(e,t){var r="",n=e.reason||"(unknown reason)";return e.mark?(e.mark.name&&(r+='in "'+e.mark.name+'" '),r+="("+(e.mark.line+1)+":"+(e.mark.column+1)+")",!t&&e.mark.snippet&&(r+="\n\n"+e.mark.snippet),n+" "+r):n}function S(e,t){Error.call(this),this.name="YAMLException",this.reason=e,this.mark=t,this.message=N(this,!1),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=Error().stack||""}(S.prototype=Object.create(Error.prototype)).constructor=S,S.prototype.toString=function(e){return this.name+": "+N(this,e)};var E=S;function z(e,t,r,n,o){var a="",i="",s=Math.floor(o/2)-1;return n-t>s&&(t=n-s+(a=" ... ").length),r-n>s&&(r=n+s-(i=" ...").length),{str:a+e.slice(t,r).replace(/\t/g,"→")+i,pos:n-t+a.length}}function F(e,t){return O(" ",t-e.length)+e}var C=["kind","multi","resolve","construct","instanceOf","predicate","represent","representName","defaultStyle","styleAliases"],M=["scalar","sequence","mapping"],T=function(e,t){if(Object.keys(t=t||{}).forEach((function(t){if(-1===C.indexOf(t))throw new E('Unknown option "'+t+'" is met in definition of "'+e+'" YAML type.')})),this.options=t,this.tag=e,this.kind=t.kind||null,this.resolve=t.resolve||function(){return!0},this.construct=t.construct||function(e){return e},this.instanceOf=t.instanceOf||null,this.predicate=t.predicate||null,this.represent=t.represent||null,this.representName=t.representName||null,this.defaultStyle=t.defaultStyle||null,this.multi=t.multi||!1,this.styleAliases=function(e){var t={};return null!==e&&Object.keys(e).forEach((function(r){e[r].forEach((function(e){t[e+""]=r}))})),t}(t.styleAliases||null),-1===M.indexOf(this.kind))throw new E('Unknown kind "'+this.kind+'" is specified for "'+e+'" YAML type.')};function L(e,t){var r=[];return e[t].forEach((function(e){var t=r.length;r.forEach((function(r,n){r.tag===e.tag&&r.kind===e.kind&&r.multi===e.multi&&(t=n)})),r[t]=e})),r}function _(e){return this.extend(e)}_.prototype.extend=function(e){var t=[],r=[];if(e instanceof T)r.push(e);else if(Array.isArray(e))r=r.concat(e);else{if(!e||!Array.isArray(e.implicit)&&!Array.isArray(e.explicit))throw new E("Schema.extend argument should be a Type, [ Type ], or a schema definition ({ implicit: [...], explicit: [...] })");e.implicit&&(t=t.concat(e.implicit)),e.explicit&&(r=r.concat(e.explicit))}t.forEach((function(e){if(!(e instanceof T))throw new E("Specified list of YAML types (or a single Type object) contains a non-Type object.");if(e.loadKind&&"scalar"!==e.loadKind)throw new E("There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.");if(e.multi)throw new E("There is a multi type in the implicit list of a schema. Multi tags can only be listed as explicit.")})),r.forEach((function(e){if(!(e instanceof T))throw new E("Specified list of YAML types (or a single Type object) contains a non-Type object.")}));var n=Object.create(_.prototype);return n.implicit=(this.implicit||[]).concat(t),n.explicit=(this.explicit||[]).concat(r),n.compiledImplicit=L(n,"implicit"),n.compiledExplicit=L(n,"explicit"),n.compiledTypeMap=function(){var e,t,r={scalar:{},sequence:{},mapping:{},fallback:{},multi:{scalar:[],sequence:[],mapping:[],fallback:[]}};function n(e){e.multi?(r.multi[e.kind].push(e),r.multi.fallback.push(e)):r[e.kind][e.tag]=r.fallback[e.tag]=e}for(e=0,t=arguments.length;e<t;e+=1)arguments[e].forEach(n);return r}(n.compiledImplicit,n.compiledExplicit),n};var I=new _({explicit:[new T("tag:yaml.org,2002:str",{kind:"scalar",construct:function(e){return null!==e?e:""}}),new T("tag:yaml.org,2002:seq",{kind:"sequence",construct:function(e){return null!==e?e:[]}}),new T("tag:yaml.org,2002:map",{kind:"mapping",construct:function(e){return null!==e?e:{}}})]}),J=new T("tag:yaml.org,2002:null",{kind:"scalar",resolve:function(e){if(null===e)return!0;var t=e.length;return 1===t&&"~"===e||4===t&&("null"===e||"Null"===e||"NULL"===e)},construct:function(){return null},predicate:function(e){return null===e},represent:{canonical:function(){return"~"},lowercase:function(){return"null"},uppercase:function(){return"NULL"},camelcase:function(){return"Null"},empty:function(){return""}},defaultStyle:"lowercase"}),D=new T("tag:yaml.org,2002:bool",{kind:"scalar",resolve:function(e){if(null===e)return!1;var t=e.length;return 4===t&&("true"===e||"True"===e||"TRUE"===e)||5===t&&("false"===e||"False"===e||"FALSE"===e)},construct:function(e){return"true"===e||"True"===e||"TRUE"===e},predicate:function(e){return"[object Boolean]"===Object.prototype.toString.call(e)},represent:{lowercase:function(e){return e?"true":"false"},uppercase:function(e){return e?"TRUE":"FALSE"},camelcase:function(e){return e?"True":"False"}},defaultStyle:"lowercase"});function q(e){return 48<=e&&e<=57||65<=e&&e<=70||97<=e&&e<=102}function R(e){return 48<=e&&e<=55}function U(e){return 48<=e&&e<=57}var $=new T("tag:yaml.org,2002:int",{kind:"scalar",resolve:function(e){if(null===e)return!1;var t,r=e.length,n=0,o=!1;if(!r)return!1;if("-"!==(t=e[n])&&"+"!==t||(t=e[++n]),"0"===t){if(n+1===r)return!0;if("b"===(t=e[++n])){for(n++;n<r;n++)if("_"!==(t=e[n])){if("0"!==t&&"1"!==t)return!1;o=!0}return o&&"_"!==t}if("x"===t){for(n++;n<r;n++)if("_"!==(t=e[n])){if(!q(e.charCodeAt(n)))return!1;o=!0}return o&&"_"!==t}if("o"===t){for(n++;n<r;n++)if("_"!==(t=e[n])){if(!R(e.charCodeAt(n)))return!1;o=!0}return o&&"_"!==t}}if("_"===t)return!1;for(;n<r;n++)if("_"!==(t=e[n])){if(!U(e.charCodeAt(n)))return!1;o=!0}return!(!o||"_"===t)},construct:function(e){var t,r=e,n=1;if(-1!==r.indexOf("_")&&(r=r.replace(/_/g,"")),"-"!==(t=r[0])&&"+"!==t||("-"===t&&(n=-1),t=(r=r.slice(1))[0]),"0"===r)return 0;if("0"===t){if("b"===r[1])return n*parseInt(r.slice(2),2);if("x"===r[1])return n*parseInt(r.slice(2),16);if("o"===r[1])return n*parseInt(r.slice(2),8)}return n*parseInt(r,10)},predicate:function(e){return"[object Number]"===Object.prototype.toString.call(e)&&e%1==0&&!A(e)},represent:{binary:function(e){return e>=0?"0b"+e.toString(2):"-0b"+e.toString(2).slice(1)},octal:function(e){return e>=0?"0o"+e.toString(8):"-0o"+e.toString(8).slice(1)},decimal:function(e){return e.toString(10)},hexadecimal:function(e){return e>=0?"0x"+e.toString(16).toUpperCase():"-0x"+e.toString(16).toUpperCase().slice(1)}},defaultStyle:"decimal",styleAliases:{binary:[2,"bin"],octal:[8,"oct"],decimal:[10,"dec"],hexadecimal:[16,"hex"]}}),Y=RegExp("^(?:[-+]?(?:[0-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$"),B=/^[-+]?[0-9]+e/,G=new T("tag:yaml.org,2002:float",{kind:"scalar",resolve:function(e){return null!==e&&!(!Y.test(e)||"_"===e[e.length-1])},construct:function(e){var t,r;return r="-"===(t=e.replace(/_/g,"").toLowerCase())[0]?-1:1,"+-".indexOf(t[0])>=0&&(t=t.slice(1)),".inf"===t?1===r?1/0:-1/0:".nan"===t?NaN:r*parseFloat(t,10)},predicate:function(e){return"[object Number]"===Object.prototype.toString.call(e)&&(e%1!=0||A(e))},represent:function(e,t){var r;if(isNaN(e))switch(t){case"lowercase":return".nan";case"uppercase":return".NAN";case"camelcase":return".NaN"}else if(1/0===e)switch(t){case"lowercase":return".inf";case"uppercase":return".INF";case"camelcase":return".Inf"}else if(-1/0===e)switch(t){case"lowercase":return"-.inf";case"uppercase":return"-.INF";case"camelcase":return"-.Inf"}else if(A(e))return"-0.0";return B.test(r=e.toString(10))?r.replace("e",".e"):r},defaultStyle:"lowercase"}),Z=I.extend({implicit:[J,D,$,G]}),K=RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$"),P=RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9]?)-([0-9][0-9]?)(?:[Tt]|[ \\t]+)([0-9][0-9]?):([0-9][0-9]):([0-9][0-9])(?:\\.([0-9]*))?(?:[ \\t]*(Z|([-+])([0-9][0-9]?)(?::([0-9][0-9]))?))?$"),W=new T("tag:yaml.org,2002:timestamp",{kind:"scalar",resolve:function(e){return null!==e&&(null!==K.exec(e)||null!==P.exec(e))},construct:function(e){var t,r,n,o,a,i,s,l,c=0,u=null;if(null===(t=K.exec(e))&&(t=P.exec(e)),null===t)throw Error("Date resolve error");if(r=+t[1],n=+t[2]-1,o=+t[3],!t[4])return new Date(Date.UTC(r,n,o));if(a=+t[4],i=+t[5],s=+t[6],t[7]){for(c=t[7].slice(0,3);c.length<3;)c+="0";c=+c}return t[9]&&(u=6e4*(60*+t[10]+ +(t[11]||0)),"-"===t[9]&&(u=-u)),l=new Date(Date.UTC(r,n,o,a,i,s,c)),u&&l.setTime(l.getTime()-u),l},instanceOf:Date,represent:function(e){return e.toISOString()}}),V=new T("tag:yaml.org,2002:merge",{kind:"scalar",resolve:function(e){return"<<"===e||null===e}}),H="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\n\r",Q=new T("tag:yaml.org,2002:binary",{kind:"scalar",resolve:function(e){if(null===e)return!1;var t,r,n=0,o=e.length,a=H;for(r=0;r<o;r++)if(!((t=a.indexOf(e.charAt(r)))>64)){if(t<0)return!1;n+=6}return n%8==0},construct:function(e){var t,r,n=e.replace(/[\r\n=]/g,""),o=n.length,a=H,i=0,s=[];for(t=0;t<o;t++)t%4==0&&t&&(s.push(i>>16&255),s.push(i>>8&255),s.push(255&i)),i=i<<6|a.indexOf(n.charAt(t));return 0==(r=o%4*6)?(s.push(i>>16&255),s.push(i>>8&255),s.push(255&i)):18===r?(s.push(i>>10&255),s.push(i>>2&255)):12===r&&s.push(i>>4&255),new Uint8Array(s)},predicate:function(e){return"[object Uint8Array]"===Object.prototype.toString.call(e)},represent:function(e){var t,r,n="",o=0,a=e.length,i=H;for(t=0;t<a;t++)t%3==0&&t&&(n+=i[o>>18&63],n+=i[o>>12&63],n+=i[o>>6&63],n+=i[63&o]),o=(o<<8)+e[t];return 0==(r=a%3)?(n+=i[o>>18&63],n+=i[o>>12&63],n+=i[o>>6&63],n+=i[63&o]):2===r?(n+=i[o>>10&63],n+=i[o>>4&63],n+=i[o<<2&63],n+="="):1===r&&(n+=i[o>>2&63],n+=i[o<<4&63],n+="=",n+="="),n}}),X=Object.prototype.hasOwnProperty,ee=Object.prototype.toString,te=new T("tag:yaml.org,2002:omap",{kind:"sequence",resolve:function(e){if(null===e)return!0;var t,r,n,o,a,i=[],s=e;for(t=0,r=s.length;t<r;t+=1){if(a=!1,"[object Object]"!==ee.call(n=s[t]))return!1;for(o in n)if(X.call(n,o)){if(a)return!1;a=!0}if(!a)return!1;if(-1!==i.indexOf(o))return!1;i.push(o)}return!0},construct:function(e){return null!==e?e:[]}}),re=Object.prototype.toString,ne=new T("tag:yaml.org,2002:pairs",{kind:"sequence",resolve:function(e){if(null===e)return!0;var t,r,n,o,a,i=e;for(a=Array(i.length),t=0,r=i.length;t<r;t+=1){if("[object Object]"!==re.call(n=i[t]))return!1;if(1!==(o=Object.keys(n)).length)return!1;a[t]=[o[0],n[o[0]]]}return!0},construct:function(e){if(null===e)return[];var t,r,n,o,a,i=e;for(a=Array(i.length),t=0,r=i.length;t<r;t+=1)a[t]=[(o=Object.keys(n=i[t]))[0],n[o[0]]];return a}}),oe=Object.prototype.hasOwnProperty,ae=new T("tag:yaml.org,2002:set",{kind:"mapping",resolve:function(e){if(null===e)return!0;var t,r=e;for(t in r)if(oe.call(r,t)&&null!==r[t])return!1;return!0},construct:function(e){return null!==e?e:{}}}),ie=Z.extend({implicit:[W,V],explicit:[Q,te,ne,ae]}),se=Object.prototype.hasOwnProperty,le=/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,ce=/[\x85\u2028\u2029]/,ue=/[,\[\]\{\}]/,fe=/^(?:!|!!|![a-z\-]+!)$/i,pe=/^(?:!|[^,\[\]\{\}])(?:%[0-9a-f]{2}|[0-9a-z\-#;\/\?:@&=\+\$,_\.!~\*'\(\)\[\]])*$/i;function me(e){return Object.prototype.toString.call(e)}function de(e){return 10===e||13===e}function ye(e){return 9===e||32===e}function he(e){return 9===e||32===e||10===e||13===e}function be(e){return 44===e||91===e||93===e||123===e||125===e}function ve(e){var t;return 48<=e&&e<=57?e-48:97<=(t=32|e)&&t<=102?t-97+10:-1}function ge(e){return 120===e?2:117===e?4:85===e?8:0}function we(e){return 48<=e&&e<=57?e-48:-1}function ke(e){return 48===e?"\0":97===e?"":98===e?"\b":116===e||9===e?"\t":110===e?"\n":118===e?"\v":102===e?"\f":114===e?"\r":101===e?"":32===e?" ":34===e?'"':47===e?"/":92===e?"\\":78===e?"
":95===e?" ":76===e?"\u2028":80===e?"\u2029":""}function je(e){return e<=65535?String.fromCharCode(e):String.fromCharCode(55296+(e-65536>>10),56320+(e-65536&1023))}for(var xe=Array(256),Oe=Array(256),Ae=0;Ae<256;Ae++)xe[Ae]=ke(Ae)?1:0,Oe[Ae]=ke(Ae);function Ne(e,t){this.input=e,this.filename=t.filename||null,this.schema=t.schema||ie,this.onWarning=t.onWarning||null,this.legacy=t.legacy||!1,this.json=t.json||!1,this.listener=t.listener||null,this.implicitTypes=this.schema.compiledImplicit,this.typeMap=this.schema.compiledTypeMap,this.length=e.length,this.position=0,this.line=0,this.lineStart=0,this.lineIndent=0,this.firstTabInLine=-1,this.documents=[]}function Se(e,t){var r={name:e.filename,buffer:e.input.slice(0,-1),position:e.position,line:e.line,column:e.position-e.lineStart};return r.snippet=function(e,t){if(!e.buffer)return null;(t=Object.create(t||null)).maxLength||(t.maxLength=79),"number"!=typeof t.indent&&(t.indent=1),"number"!=typeof t.linesBefore&&(t.linesBefore=3),"number"!=typeof t.linesAfter&&(t.linesAfter=2);for(var r,n=/\r?\n|\r|\0/g,o=[0],a=[],i=-1;r=n.exec(e.buffer);)a.push(r.index),o.push(r.index+r[0].length),e.position<=r.index&&i<0&&(i=o.length-2);i<0&&(i=o.length-1);var s,l,c="",u=(""+Math.min(e.line+t.linesAfter,a.length)).length,f=t.maxLength-(t.indent+u+3);for(s=1;s<=t.linesBefore&&!(i-s<0);s++)l=z(e.buffer,o[i-s],a[i-s],e.position-(o[i]-o[i-s]),f),c=O(" ",t.indent)+F(""+(e.line-s+1),u)+" | "+l.str+"\n"+c;for(l=z(e.buffer,o[i],a[i],e.position,f),c+=O(" ",t.indent)+F(""+(e.line+1),u)+" | "+l.str+"\n",c+=O("-",t.indent+u+3+l.pos)+"^\n",s=1;s<=t.linesAfter&&!(i+s>=a.length);s++)l=z(e.buffer,o[i+s],a[i+s],e.position-(o[i]-o[i+s]),f),c+=O(" ",t.indent)+F(""+(e.line+s+1),u)+" | "+l.str+"\n";return c.replace(/\n$/,"")}(r),new E(t,r)}function Ee(e,t){throw Se(e,t)}function ze(e,t){e.onWarning&&e.onWarning.call(null,Se(e,t))}var Fe={YAML:function(e,t,r){var n,o,a;null!==e.version&&Ee(e,"duplication of %YAML directive"),1!==r.length&&Ee(e,"YAML directive accepts exactly one argument"),null===(n=/^([0-9]+)\.([0-9]+)$/.exec(r[0]))&&Ee(e,"ill-formed argument of the YAML directive"),o=parseInt(n[1],10),a=parseInt(n[2],10),1!==o&&Ee(e,"unacceptable YAML version of the document"),e.version=r[0],e.checkLineBreaks=a<2,1!==a&&2!==a&&ze(e,"unsupported YAML version of the document")},TAG:function(e,t,r){var n,o;2!==r.length&&Ee(e,"TAG directive accepts exactly two arguments"),o=r[1],fe.test(n=r[0])||Ee(e,"ill-formed tag handle (first argument) of the TAG directive"),se.call(e.tagMap,n)&&Ee(e,'there is a previously declared suffix for "'+n+'" tag handle'),pe.test(o)||Ee(e,"ill-formed tag prefix (second argument) of the TAG directive");try{o=decodeURIComponent(o)}catch(t){Ee(e,"tag prefix is malformed: "+o)}e.tagMap[n]=o}};function Ce(e,t,r,n){var o,a,i,s;if(t<r){if(s=e.input.slice(t,r),n)for(o=0,a=s.length;o<a;o+=1)9===(i=s.charCodeAt(o))||32<=i&&i<=1114111||Ee(e,"expected valid JSON character");else le.test(s)&&Ee(e,"the stream contains non-printable characters");e.result+=s}}function Me(e,t,r,n){var o,a,i,s;for(x(r)||Ee(e,"cannot merge mappings; the provided source object is unacceptable"),i=0,s=(o=Object.keys(r)).length;i<s;i+=1)se.call(t,a=o[i])||(t[a]=r[a],n[a]=!0)}function Te(e,t,r,n,o,a,i,s,l){var c,u;if(Array.isArray(o))for(c=0,u=(o=Array.prototype.slice.call(o)).length;c<u;c+=1)Array.isArray(o[c])&&Ee(e,"nested arrays are not supported inside keys"),"object"==typeof o&&"[object Object]"===me(o[c])&&(o[c]="[object Object]");if("object"==typeof o&&"[object Object]"===me(o)&&(o="[object Object]"),o+="",null===t&&(t={}),"tag:yaml.org,2002:merge"===n)if(Array.isArray(a))for(c=0,u=a.length;c<u;c+=1)Me(e,t,a[c],r);else Me(e,t,a,r);else e.json||se.call(r,o)||!se.call(t,o)||(e.line=i||e.line,e.lineStart=s||e.lineStart,e.position=l||e.position,Ee(e,"duplicated mapping key")),"__proto__"===o?Object.defineProperty(t,o,{configurable:!0,enumerable:!0,writable:!0,value:a}):t[o]=a,delete r[o];return t}function Le(e){var t;10===(t=e.input.charCodeAt(e.position))?e.position++:13===t?(e.position++,10===e.input.charCodeAt(e.position)&&e.position++):Ee(e,"a line break is expected"),e.line+=1,e.lineStart=e.position,e.firstTabInLine=-1}function _e(e,t,r){for(var n=0,o=e.input.charCodeAt(e.position);0!==o;){for(;ye(o);)9===o&&-1===e.firstTabInLine&&(e.firstTabInLine=e.position),o=e.input.charCodeAt(++e.position);if(t&&35===o)do{o=e.input.charCodeAt(++e.position)}while(10!==o&&13!==o&&0!==o);if(!de(o))break;for(Le(e),o=e.input.charCodeAt(e.position),n++,e.lineIndent=0;32===o;)e.lineIndent++,o=e.input.charCodeAt(++e.position)}return-1!==r&&0!==n&&e.lineIndent<r&&ze(e,"deficient indentation"),n}function Ie(e){var t,r=e.position;return!(45!==(t=e.input.charCodeAt(r))&&46!==t||t!==e.input.charCodeAt(r+1)||t!==e.input.charCodeAt(r+2)||0!==(t=e.input.charCodeAt(r+=3))&&!he(t))}function Je(e,t){1===t?e.result+=" ":t>1&&(e.result+=O("\n",t-1))}function De(e,t){var r,n,o=e.tag,a=e.anchor,i=[],s=!1;if(-1!==e.firstTabInLine)return!1;for(null!==e.anchor&&(e.anchorMap[e.anchor]=i),n=e.input.charCodeAt(e.position);0!==n&&(-1!==e.firstTabInLine&&(e.position=e.firstTabInLine,Ee(e,"tab characters must not be used in indentation")),45===n)&&he(e.input.charCodeAt(e.position+1));)if(s=!0,e.position++,_e(e,!0,-1)&&e.lineIndent<=t)i.push(null),n=e.input.charCodeAt(e.position);else if(r=e.line,Ue(e,t,3,!1,!0),i.push(e.result),_e(e,!0,-1),n=e.input.charCodeAt(e.position),(e.line===r||e.lineIndent>t)&&0!==n)Ee(e,"bad indentation of a sequence entry");else if(e.lineIndent<t)break;return!!s&&(e.tag=o,e.anchor=a,e.kind="sequence",e.result=i,!0)}function qe(e){var t,r,n,o,a=!1,i=!1;if(33!==(o=e.input.charCodeAt(e.position)))return!1;if(null!==e.tag&&Ee(e,"duplication of a tag property"),60===(o=e.input.charCodeAt(++e.position))?(a=!0,o=e.input.charCodeAt(++e.position)):33===o?(i=!0,r="!!",o=e.input.charCodeAt(++e.position)):r="!",t=e.position,a){do{o=e.input.charCodeAt(++e.position)}while(0!==o&&62!==o);e.position<e.length?(n=e.input.slice(t,e.position),o=e.input.charCodeAt(++e.position)):Ee(e,"unexpected end of the stream within a verbatim tag")}else{for(;0!==o&&!he(o);)33===o&&(i?Ee(e,"tag suffix cannot contain exclamation marks"):(r=e.input.slice(t-1,e.position+1),fe.test(r)||Ee(e,"named tag handle cannot contain such characters"),i=!0,t=e.position+1)),o=e.input.charCodeAt(++e.position);n=e.input.slice(t,e.position),ue.test(n)&&Ee(e,"tag suffix cannot contain flow indicator characters")}n&&!pe.test(n)&&Ee(e,"tag name cannot contain such characters: "+n);try{n=decodeURIComponent(n)}catch(t){Ee(e,"tag name is malformed: "+n)}return a?e.tag=n:se.call(e.tagMap,r)?e.tag=e.tagMap[r]+n:"!"===r?e.tag="!"+n:"!!"===r?e.tag="tag:yaml.org,2002:"+n:Ee(e,'undeclared tag handle "'+r+'"'),!0}function Re(e){var t,r;if(38!==(r=e.input.charCodeAt(e.position)))return!1;for(null!==e.anchor&&Ee(e,"duplication of an anchor property"),r=e.input.charCodeAt(++e.position),t=e.position;0!==r&&!he(r)&&!be(r);)r=e.input.charCodeAt(++e.position);return e.position===t&&Ee(e,"name of an anchor node must contain at least one character"),e.anchor=e.input.slice(t,e.position),!0}function Ue(e,t,r,n,o){var a,i,s,l,c,u,f,p,m,d=1,y=!1,h=!1;if(null!==e.listener&&e.listener("open",e),e.tag=null,e.anchor=null,e.kind=null,e.result=null,a=i=s=4===r||3===r,n&&_e(e,!0,-1)&&(y=!0,e.lineIndent>t?d=1:e.lineIndent===t?d=0:e.lineIndent<t&&(d=-1)),1===d)for(;qe(e)||Re(e);)_e(e,!0,-1)?(y=!0,s=a,e.lineIndent>t?d=1:e.lineIndent===t?d=0:e.lineIndent<t&&(d=-1)):s=!1;if(s&&(s=y||o),1!==d&&4!==r||(p=1===r||2===r?t:t+1,m=e.position-e.lineStart,1===d?s&&(De(e,m)||function(e,t,r){var n,o,a,i,s,l,c,u=e.tag,f=e.anchor,p={},m=Object.create(null),d=null,y=null,h=null,b=!1,v=!1;if(-1!==e.firstTabInLine)return!1;for(null!==e.anchor&&(e.anchorMap[e.anchor]=p),c=e.input.charCodeAt(e.position);0!==c;){if(b||-1===e.firstTabInLine||(e.position=e.firstTabInLine,Ee(e,"tab characters must not be used in indentation")),n=e.input.charCodeAt(e.position+1),a=e.line,63!==c&&58!==c||!he(n)){if(i=e.line,s=e.lineStart,l=e.position,!Ue(e,r,2,!1,!0))break;if(e.line===a){for(c=e.input.charCodeAt(e.position);ye(c);)c=e.input.charCodeAt(++e.position);if(58===c)he(c=e.input.charCodeAt(++e.position))||Ee(e,"a whitespace character is expected after the key-value separator within a block mapping"),b&&(Te(e,p,m,d,y,null,i,s,l),d=y=h=null),v=!0,b=!1,o=!1,d=e.tag,y=e.result;else{if(!v)return e.tag=u,e.anchor=f,!0;Ee(e,"can not read an implicit mapping pair; a colon is missed")}}else{if(!v)return e.tag=u,e.anchor=f,!0;Ee(e,"can not read a block mapping entry; a multiline key may not be an implicit key")}}else 63===c?(b&&(Te(e,p,m,d,y,null,i,s,l),d=y=h=null),v=!0,b=!0,o=!0):b?(b=!1,o=!0):Ee(e,"incomplete explicit mapping pair; a key node is missed; or followed by a non-tabulated empty line"),e.position+=1,c=n;if((e.line===a||e.lineIndent>t)&&(b&&(i=e.line,s=e.lineStart,l=e.position),Ue(e,t,4,!0,o)&&(b?y=e.result:h=e.result),b||(Te(e,p,m,d,y,h,i,s,l),d=y=h=null),_e(e,!0,-1),c=e.input.charCodeAt(e.position)),(e.line===a||e.lineIndent>t)&&0!==c)Ee(e,"bad indentation of a mapping entry");else if(e.lineIndent<t)break}return b&&Te(e,p,m,d,y,null,i,s,l),v&&(e.tag=u,e.anchor=f,e.kind="mapping",e.result=p),v}(e,m,p))||function(e,t){var r,n,o,a,i,s,l,c,u,f,p,m,d=!0,y=e.tag,h=e.anchor,b=Object.create(null);if(91===(m=e.input.charCodeAt(e.position)))i=93,c=!1,a=[];else{if(123!==m)return!1;i=125,c=!0,a={}}for(null!==e.anchor&&(e.anchorMap[e.anchor]=a),m=e.input.charCodeAt(++e.position);0!==m;){if(_e(e,!0,t),(m=e.input.charCodeAt(e.position))===i)return e.position++,e.tag=y,e.anchor=h,e.kind=c?"mapping":"sequence",e.result=a,!0;d?44===m&&Ee(e,"expected the node content, but found ','"):Ee(e,"missed comma between flow collection entries"),p=null,s=l=!1,63===m&&he(e.input.charCodeAt(e.position+1))&&(s=l=!0,e.position++,_e(e,!0,t)),r=e.line,n=e.lineStart,o=e.position,Ue(e,t,1,!1,!0),f=e.tag,u=e.result,_e(e,!0,t),m=e.input.charCodeAt(e.position),!l&&e.line!==r||58!==m||(s=!0,m=e.input.charCodeAt(++e.position),_e(e,!0,t),Ue(e,t,1,!1,!0),p=e.result),c?Te(e,a,b,f,u,p,r,n,o):a.push(s?Te(e,null,b,f,u,p,r,n,o):u),_e(e,!0,t),44===(m=e.input.charCodeAt(e.position))?(d=!0,m=e.input.charCodeAt(++e.position)):d=!1}Ee(e,"unexpected end of the stream within a flow collection")}(e,p)?h=!0:(i&&function(e,t){var r,n,o,a,i=1,s=!1,l=!1,c=t,u=0,f=!1;if(124===(a=e.input.charCodeAt(e.position)))n=!1;else{if(62!==a)return!1;n=!0}for(e.kind="scalar",e.result="";0!==a;)if(43===(a=e.input.charCodeAt(++e.position))||45===a)1===i?i=43===a?3:2:Ee(e,"repeat of a chomping mode identifier");else{if(!((o=we(a))>=0))break;0===o?Ee(e,"bad explicit indentation width of a block scalar; it cannot be less than one"):l?Ee(e,"repeat of an indentation width identifier"):(c=t+o-1,l=!0)}if(ye(a)){do{a=e.input.charCodeAt(++e.position)}while(ye(a));if(35===a)do{a=e.input.charCodeAt(++e.position)}while(!de(a)&&0!==a)}for(;0!==a;){for(Le(e),e.lineIndent=0,a=e.input.charCodeAt(e.position);(!l||e.lineIndent<c)&&32===a;)e.lineIndent++,a=e.input.charCodeAt(++e.position);if(!l&&e.lineIndent>c&&(c=e.lineIndent),de(a))u++;else{if(e.lineIndent<c){3===i?e.result+=O("\n",s?1+u:u):1===i&&s&&(e.result+="\n");break}for(n?ye(a)?(f=!0,e.result+=O("\n",s?1+u:u)):f?(f=!1,e.result+=O("\n",u+1)):0===u?s&&(e.result+=" "):e.result+=O("\n",u):e.result+=O("\n",s?1+u:u),s=!0,l=!0,u=0,r=e.position;!de(a)&&0!==a;)a=e.input.charCodeAt(++e.position);Ce(e,r,e.position,!1)}}return!0}(e,p)||function(e,t){var r,n,o;if(39!==(r=e.input.charCodeAt(e.position)))return!1;for(e.kind="scalar",e.result="",e.position++,n=o=e.position;0!==(r=e.input.charCodeAt(e.position));)if(39===r){if(Ce(e,n,e.position,!0),39!==(r=e.input.charCodeAt(++e.position)))return!0;n=e.position,e.position++,o=e.position}else de(r)?(Ce(e,n,o,!0),Je(e,_e(e,!1,t)),n=o=e.position):e.position===e.lineStart&&Ie(e)?Ee(e,"unexpected end of the document within a single quoted scalar"):(e.position++,o=e.position);Ee(e,"unexpected end of the stream within a single quoted scalar")}(e,p)||function(e,t){var r,n,o,a,i,s;if(34!==(s=e.input.charCodeAt(e.position)))return!1;for(e.kind="scalar",e.result="",e.position++,r=n=e.position;0!==(s=e.input.charCodeAt(e.position));){if(34===s)return Ce(e,r,e.position,!0),e.position++,!0;if(92===s){if(Ce(e,r,e.position,!0),de(s=e.input.charCodeAt(++e.position)))_e(e,!1,t);else if(s<256&&xe[s])e.result+=Oe[s],e.position++;else if((i=ge(s))>0){for(o=i,a=0;o>0;o--)(i=ve(s=e.input.charCodeAt(++e.position)))>=0?a=(a<<4)+i:Ee(e,"expected hexadecimal character");e.result+=je(a),e.position++}else Ee(e,"unknown escape sequence");r=n=e.position}else de(s)?(Ce(e,r,n,!0),Je(e,_e(e,!1,t)),r=n=e.position):e.position===e.lineStart&&Ie(e)?Ee(e,"unexpected end of the document within a double quoted scalar"):(e.position++,n=e.position)}Ee(e,"unexpected end of the stream within a double quoted scalar")}(e,p)?h=!0:function(e){var t,r,n;if(42!==(n=e.input.charCodeAt(e.position)))return!1;for(n=e.input.charCodeAt(++e.position),t=e.position;0!==n&&!he(n)&&!be(n);)n=e.input.charCodeAt(++e.position);return e.position===t&&Ee(e,"name of an alias node must contain at least one character"),r=e.input.slice(t,e.position),se.call(e.anchorMap,r)||Ee(e,'unidentified alias "'+r+'"'),e.result=e.anchorMap[r],_e(e,!0,-1),!0}(e)?(h=!0,null===e.tag&&null===e.anchor||Ee(e,"alias node should not have any properties")):function(e,t,r){var n,o,a,i,s,l,c,u,f=e.kind,p=e.result;if(he(u=e.input.charCodeAt(e.position))||be(u)||35===u||38===u||42===u||33===u||124===u||62===u||39===u||34===u||37===u||64===u||96===u)return!1;if((63===u||45===u)&&(he(n=e.input.charCodeAt(e.position+1))||r&&be(n)))return!1;for(e.kind="scalar",e.result="",o=a=e.position,i=!1;0!==u;){if(58===u){if(he(n=e.input.charCodeAt(e.position+1))||r&&be(n))break}else if(35===u){if(he(e.input.charCodeAt(e.position-1)))break}else{if(e.position===e.lineStart&&Ie(e)||r&&be(u))break;if(de(u)){if(s=e.line,l=e.lineStart,c=e.lineIndent,_e(e,!1,-1),e.lineIndent>=t){i=!0,u=e.input.charCodeAt(e.position);continue}e.position=a,e.line=s,e.lineStart=l,e.lineIndent=c;break}}i&&(Ce(e,o,a,!1),Je(e,e.line-s),o=a=e.position,i=!1),ye(u)||(a=e.position+1),u=e.input.charCodeAt(++e.position)}return Ce(e,o,a,!1),!!e.result||(e.kind=f,e.result=p,!1)}(e,p,1===r)&&(h=!0,null===e.tag&&(e.tag="?")),null!==e.anchor&&(e.anchorMap[e.anchor]=e.result)):0===d&&(h=s&&De(e,m))),null===e.tag)null!==e.anchor&&(e.anchorMap[e.anchor]=e.result);else if("?"===e.tag){for(null!==e.result&&"scalar"!==e.kind&&Ee(e,'unacceptable node kind for !<?> tag; it should be "scalar", not "'+e.kind+'"'),l=0,c=e.implicitTypes.length;l<c;l+=1)if((f=e.implicitTypes[l]).resolve(e.result)){e.result=f.construct(e.result),e.tag=f.tag,null!==e.anchor&&(e.anchorMap[e.anchor]=e.result);break}}else if("!"!==e.tag){if(se.call(e.typeMap[e.kind||"fallback"],e.tag))f=e.typeMap[e.kind||"fallback"][e.tag];else for(f=null,l=0,c=(u=e.typeMap.multi[e.kind||"fallback"]).length;l<c;l+=1)if(e.tag.slice(0,u[l].tag.length)===u[l].tag){f=u[l];break}f||Ee(e,"unknown tag !<"+e.tag+">"),null!==e.result&&f.kind!==e.kind&&Ee(e,"unacceptable node kind for !<"+e.tag+'> tag; it should be "'+f.kind+'", not "'+e.kind+'"'),f.resolve(e.result,e.tag)?(e.result=f.construct(e.result,e.tag),null!==e.anchor&&(e.anchorMap[e.anchor]=e.result)):Ee(e,"cannot resolve a node with !<"+e.tag+"> explicit tag")}return null!==e.listener&&e.listener("close",e),null!==e.tag||null!==e.anchor||h}function $e(e){var t,r,n,o,a=e.position,i=!1;for(e.version=null,e.checkLineBreaks=e.legacy,e.tagMap=Object.create(null),e.anchorMap=Object.create(null);0!==(o=e.input.charCodeAt(e.position))&&(_e(e,!0,-1),o=e.input.charCodeAt(e.position),!(e.lineIndent>0||37!==o));){for(i=!0,o=e.input.charCodeAt(++e.position),t=e.position;0!==o&&!he(o);)o=e.input.charCodeAt(++e.position);for(n=[],(r=e.input.slice(t,e.position)).length<1&&Ee(e,"directive name must not be less than one character in length");0!==o;){for(;ye(o);)o=e.input.charCodeAt(++e.position);if(35===o){do{o=e.input.charCodeAt(++e.position)}while(0!==o&&!de(o));break}if(de(o))break;for(t=e.position;0!==o&&!he(o);)o=e.input.charCodeAt(++e.position);n.push(e.input.slice(t,e.position))}0!==o&&Le(e),se.call(Fe,r)?Fe[r](e,r,n):ze(e,'unknown document directive "'+r+'"')}_e(e,!0,-1),0===e.lineIndent&&45===e.input.charCodeAt(e.position)&&45===e.input.charCodeAt(e.position+1)&&45===e.input.charCodeAt(e.position+2)?(e.position+=3,_e(e,!0,-1)):i&&Ee(e,"directives end mark is expected"),Ue(e,e.lineIndent-1,4,!1,!0),_e(e,!0,-1),e.checkLineBreaks&&ce.test(e.input.slice(a,e.position))&&ze(e,"non-ASCII line breaks are interpreted as content"),e.documents.push(e.result),e.position===e.lineStart&&Ie(e)?46===e.input.charCodeAt(e.position)&&(e.position+=3,_e(e,!0,-1)):e.position<e.length-1&&Ee(e,"end of the stream or a document separator is expected")}var Ye=function(e,t){var r=function(e,t){t=t||{},0!==(e+="").length&&(10!==e.charCodeAt(e.length-1)&&13!==e.charCodeAt(e.length-1)&&(e+="\n"),65279===e.charCodeAt(0)&&(e=e.slice(1)));var r=new Ne(e,t),n=e.indexOf("\0");for(-1!==n&&(r.position=n,Ee(r,"null byte is not allowed in input")),r.input+="\0";32===r.input.charCodeAt(r.position);)r.lineIndent+=1,r.position+=1;for(;r.position<r.length-1;)$e(r);return r.documents}(e,t);if(0!==r.length){if(1===r.length)return r[0];throw new E("expected a single document in the stream, but found more")}};function Be(e){if(null==e)return;if("boolean"==typeof e)return e?"true":"false";const t=(e+"").toLowerCase();return"true"===t||"1"===t?"true":"false"===t||"0"===t?"false":t}function Ge(e){if(null==e)return;const t="number"==typeof e?e:Number(e);return Number.isFinite(t)?t:void 0}function Ze(e){if(null==e)return;if("object"!=typeof e)return JSON.stringify(e);const t=Object.keys(e).sort(),r={};for(const n of t)r[n]=e[n];return JSON.stringify(r)}function Ke(e,t){return null==e&&null==t||null!=e&&null!=t&&Math.abs(e-t)<=1e-9}function Pe(e,t){return(e??void 0)===(t??void 0)}function We(e,t){const r={};e.type!==t.type&&(r.type={old:e.type,new:t.type});const n=Be(e.visible),o=Be(t.visible);Pe(n,o)||(r.visible={old:n,new:o});const a=Ge(e.opacity),i=Ge(t.opacity);Ke(a,i)||(r.opacity={old:a,new:i});const s=Ge(e.zIndex),l=Ge(t.zIndex);Ke(s,l)||(r.zIndex={old:s,new:l}),Pe(e.url,t.url)||(r.url={old:e.url,new:t.url}),Pe(e.layers,t.layers)||(r.layers={old:e.layers,new:t.layers});const c=Be(e.tiled),u=Be(t.tiled);return Pe(c,u)||(r.tiled={old:c,new:u}),Pe(Ze(e.style),Ze(t.style))||(r.style={old:e.style,new:t.style}),Pe(Ze(e.data),Ze(t.data))||(r.data={old:e.data,new:t.data}),r}const Ve="v-map-builder - ",He=t(class extends r{constructor(e){super(),!1!==e&&this.__registerHost(),this.__attachShadow(),this.configReady=n(this,"configReady",7),this.configError=n(this,"configError",7)}get hostEl(){return this}mapconfig;configReady;configError;current;async componentDidLoad(){a(Ve+s.COMPONENT_DID_LOAD),this.parseFromSlot()}async onMapConfigChanged(e,t){a(Ve+"onMapConfigChanged"),this.parseFromSlot()}parseFromSlot(){a(Ve+"parseFromSlot");try{const e=this.hostEl.querySelector('script[type*="json"], script[type*="yaml"], script[type*="yml"]');if(!e)throw Error("No configuration <script> found.");const t=(e.type||"").toLowerCase(),r=e.textContent??"",n=t.includes("json")?JSON.parse(r):Ye(r),o=this.normalize(n);this.applyDiff(this.current,o),this.current=o,a(Ve+"emit configReady"),this.configReady.emit(o)}catch(e){const t=e,r=t?.message||"Unknown error";this.configError.emit({message:r,errors:t?.errors}),this.hostEl.dispatchEvent(new CustomEvent(i.Error,{detail:{type:"validation",message:r,cause:e},bubbles:!0,composed:!0}))}}normalizeLayerType(e){const t=((e??"")+"").toLowerCase();switch(t){case"osm":case"wms":case"wms-tiled":case"geojson":case"xyz":case"terrain":case"wfs":case"wcs":case"google":case"geotiff":case"tile3d":case"scatterplot":case"wkt":return t;default:return"custom"}}toOptionalString(e){if(null!=e)return"string"==typeof e?e:e+""}toOptionalNumber(e){if(null==e||""===e)return;const t="number"==typeof e?e:Number(e);return Number.isFinite(t)?t:void 0}toOptionalBoolean(e){if(null==e||""===e)return;if("boolean"==typeof e)return e;const t=(e+"").trim().toLowerCase();return!!["true","1","yes","y"].includes(t)||!["false","0","no","n"].includes(t)&&void 0}toCsv(e){if(null!=e)return Array.isArray(e)?e.map((e=>this.toOptionalString(e))).filter((e=>null!=e&&""!==e)).join(","):this.toOptionalString(e)}cleanRecord(e){if(!e)return;const t={};for(const[r,n]of Object.entries(e))null!=n&&(t[r]=n);return Object.keys(t).length?t:void 0}normalizeLayer(e,t,r){const n=this.normalizeLayerType(e?.type??e?.layerType),o={id:(e?.id??`${t+1}-${r+1}`)+"",type:n,visible:e?.visible,opacity:e?.opacity,zIndex:e?.zIndex};null!=e?.style&&(o.style=e.style);const a={},i=(e,t)=>{null!=t&&(o[e]=t)};switch(n){case"wms":case"wms-tiled":{const t=this.toOptionalString(e?.url),r=this.toOptionalString(e?.layers??e?.sublayers),o="wms-tiled"===n||this.toOptionalBoolean(e?.tiled);i("url",t),i("layers",r),void 0!==o&&i("tiled",o);const s=e?.params??e?.extraParams;Object.assign(a,this.cleanRecord({styles:e?.styles,format:e?.format,transparent:this.toOptionalBoolean(e?.transparent),tiled:o,version:e?.version,time:e?.time,params:s})??{});break}case"geojson":i("url",this.toOptionalString(e?.url)),Object.assign(a,this.cleanRecord({geojson:e?.geojson??e?.data,fillColor:e?.fillColor,fillOpacity:this.toOptionalNumber(e?.fillOpacity),strokeColor:e?.strokeColor,strokeWidth:this.toOptionalNumber(e?.strokeWidth),strokeOpacity:this.toOptionalNumber(e?.strokeOpacity),pointRadius:this.toOptionalNumber(e?.pointRadius),pointColor:e?.pointColor,iconUrl:e?.iconUrl,iconSize:e?.iconSize,textProperty:e?.textProperty,textColor:e?.textColor,textSize:this.toOptionalNumber(e?.textSize)})??{});break;case"xyz":i("url",this.toOptionalString(e?.url)),Object.assign(a,this.cleanRecord({attributions:e?.attributions,maxZoom:this.toOptionalNumber(e?.maxZoom),tileSize:this.toOptionalNumber(e?.tileSize),subdomains:this.toCsv(e?.subdomains)})??{});break;case"terrain":{const t=null!=e?.data&&"object"==typeof e.data?e.data:{};Object.assign(a,this.cleanRecord({elevationData:e?.elevationData??e?.url??t.elevationData,texture:e?.texture??t.texture,elevationDecoder:e?.elevationDecoder??t.elevationDecoder,wireframe:this.toOptionalBoolean(e?.wireframe??t.wireframe),color:e?.color??t.color,minZoom:this.toOptionalNumber(e?.minZoom??t.minZoom),maxZoom:this.toOptionalNumber(e?.maxZoom??t.maxZoom),meshMaxError:this.toOptionalNumber(e?.meshMaxError??t.meshMaxError)})??{});break}case"wfs":{const t=this.toOptionalString(e?.url);i("url",t),Object.assign(a,this.cleanRecord({url:t,typeName:e?.typeName??e?.layerName,version:e?.version,outputFormat:e?.outputFormat??e?.format,srsName:e?.srsName??e?.crs,params:e?.params})??{});break}case"wcs":{const t=this.toOptionalString(e?.url);i("url",t),Object.assign(a,this.cleanRecord({url:t,coverageName:e?.coverageName,format:e?.format,version:e?.version,projection:e?.projection,resolutions:e?.resolutions,params:e?.params})??{});break}case"google":Object.assign(a,this.cleanRecord({apiKey:e?.apiKey??e?.api_key,mapType:e?.mapType,language:e?.language,region:e?.region,scale:e?.scale,libraries:this.toCsv(e?.libraries),maxZoom:this.toOptionalNumber(e?.maxZoom),styles:e?.styles})??{});break;case"geotiff":case"osm":i("url",this.toOptionalString(e?.url));break;case"tile3d":i("url",this.toOptionalString(e?.url)),Object.assign(a,this.cleanRecord({tilesetOptions:e?.tilesetOptions??e?.options??e?.data,style:e?.style??e?.cesiumStyle})??{});break;case"scatterplot":Object.assign(a,this.cleanRecord({url:this.toOptionalString(e?.url),data:e?.data,getFillColor:e?.getFillColor,getRadius:this.toOptionalNumber(e?.getRadius)})??{});break;case"wkt":Object.assign(a,this.cleanRecord({wkt:e?.wkt,url:this.toOptionalString(e?.url),fillColor:e?.fillColor,fillOpacity:this.toOptionalNumber(e?.fillOpacity),strokeColor:e?.strokeColor,strokeWidth:this.toOptionalNumber(e?.strokeWidth),strokeOpacity:this.toOptionalNumber(e?.strokeOpacity),pointRadius:this.toOptionalNumber(e?.pointRadius),pointColor:e?.pointColor,iconUrl:e?.iconUrl,iconSize:e?.iconSize,textProperty:e?.textProperty,textColor:e?.textColor,textSize:this.toOptionalNumber(e?.textSize)})??{});break;default:{const t=e?.data&&"object"==typeof e.data?e.data:e;t&&"object"==typeof t&&Object.assign(a,this.cleanRecord(t)??{})}}return o.data=this.cleanRecord(a),o}normalize(e){const t=null!=e&&"object"==typeof e?e:{},r=null!=t.map&&"object"==typeof t.map?t.map:t;return{map:{flavour:(r.flavour??"ol")+"",id:(r.id??"map1")+"",zoom:Number(r.zoom??2),center:(r.center??"0,0")+"",style:(r.style??"")+"",styles:this.normalizeStyles(r.styles),layerGroups:(Array.isArray(r.layerGroups)?r.layerGroups:[]).map(((e,t)=>({groupTitle:(e.groupTitle??e.group??e.title??"Group "+(t+1))+"",basemapid:(e.basemapid??"")+"",visible:e.visible,layers:(Array.isArray(e.layers)?e.layers:[]).map(((e,r)=>this.normalizeLayer(e,t,r)))})))}}}normalizeStyles(e){return(Array.isArray(e)?e:e?[e]:[]).map(((e,t)=>this.normalizeStyle(e,t))).filter((e=>!!e))}normalizeStyle(e,t){if(null==e)return;const r="object"==typeof e&&null!==e?e:{content:e},n=r.key??r.id??r.name,o=(null!=n?n:"style-"+(t+1))+"",i=((r.format??"sld")+"").toLowerCase();let s;if(Array.isArray(r.layerTargets)){const e=r.layerTargets.map((e=>(e+"").trim())).filter(Boolean);s=e.length?e.join(","):void 0}else if("string"==typeof r.layerTargets){const e=r.layerTargets.split(",").map((e=>e.trim())).filter(Boolean);s=e.length?e.join(","):void 0}const l=null==r.autoApply?void 0:"boolean"==typeof r.autoApply?r.autoApply:"false"!==(r.autoApply+"").toLowerCase();let c=null!=r.src?(r.src+"").trim():void 0;""===c&&(c=void 0);let u=null!=r.content?r.content+"":void 0;if(!c&&!u&&"string"==typeof r.source){const e=r.source.trim();e&&(/^(https?:)?\/\//.test(e)||e.startsWith("/")||e.startsWith("./")||e.startsWith("../")?c=e:u=e)}if(!c&&!u){if("string"!=typeof e)return void a(`${Ve}normalizeStyle: skipping style without src/content (key=${o})`);u=e+""}return{key:o,format:i,src:c,content:u,layerTargets:s,autoApply:l,id:null!=r.id?r.id+"":void 0}}syncStyles(e,t){const r=Array.from(e.querySelectorAll('v-map-style[data-builder-style="true"]')),n=new Map;for(const e of r){const t=e.getAttribute("data-builder-style-id");t&&n.set(t,e)}const o=new Set,a=Array.from(e.children).find((e=>"v-map-style"!==e.tagName.toLowerCase()||"true"!==e.getAttribute("data-builder-style")));t.forEach(((t,r)=>{const i=t.key||"style-"+(r+1);let s=n.get(i);s&&s.parentElement===e?(s.setAttribute("data-builder-style","true"),s.setAttribute("data-builder-style-id",i)):(s=document.createElement("v-map-style"),s.setAttribute("data-builder-style","true"),s.setAttribute("data-builder-style-id",i)),o.add(i),this.ensureAttr(s,"format",t.format),this.ensureAttr(s,"layer-targets",t.layerTargets),s.autoApply=void 0===t.autoApply||t.autoApply,this.ensureAttr(s,"auto-apply",!0===t.autoApply?"":void 0),this.ensureAttr(s,"id",t.id),this.ensureAttr(s,"src",t.src),this.ensureAttr(s,"content",t.content);const l=a&&a.parentElement===e?a:null;s.isConnected&&s.parentElement===e?l&&e.insertBefore(s,l):e.insertBefore(s,l)}));for(const t of r){const r=t.getAttribute("data-builder-style-id")||"";o.has(r)||e.removeChild(t)}}ensureAttr(e,t,r){const n=null==r?void 0:r+"",o=e.getAttribute(t);null!=n?o!==n&&e.setAttribute(t,n):null!=o&&e.removeAttribute(t)}ensureGroup(e,t,r,n,o){let a=Array.from(e.children).find((e=>"v-map-layergroup"===e.tagName.toLowerCase()&&e.getAttribute("group-title")===t));return a||(a=document.createElement("v-map-layergroup"),a.setAttribute("group-title",t),e.insertBefore(a,(null!=o?e.children[o]:null)||null)),this.ensureAttr(a,"visible",n),r&&this.ensureAttr(a,"basemapid",r),a}toKebabCase(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/[\s_]+/g,"-").toLowerCase()}createLayerEl(e){const t=e.data||{},r={id:e.id,visible:e.visible,opacity:e.opacity,"z-index":e.zIndex,...e.style?{style:JSON.stringify(e.style)}:{}},n=(e,t,n)=>{if(null!=t)if(n?.json&&"string"!=typeof t)try{r[e]=JSON.stringify(t)}catch{r[e]=t+""}else r[e]=t};let o;switch(e.type){case"osm":o=document.createElement("v-map-layer-osm");break;case"wms":case"wms-tiled":o=document.createElement("v-map-layer-wms"),n("url",e.url??t.url),n("layers",e.layers??t.layers),n("tiled","wms-tiled"===e.type||(t.tiled??e.tiled??void 0)),n("styles",t.styles),n("format",t.format),n("transparent",t.transparent),n("version",t.version),n("time",t.time),t.params&&n("params","string"==typeof t.params?t.params:JSON.stringify(t.params));break;case"geojson":{o=document.createElement("v-map-layer-geojson"),n("url",e.url??t.url);const r=t.geojson??t.data;void 0!==r&&n("geojson","string"==typeof r?r:JSON.stringify(r)),n("fill-color",t.fillColor),n("fill-opacity",t.fillOpacity),n("stroke-color",t.strokeColor),n("stroke-width",t.strokeWidth),n("stroke-opacity",t.strokeOpacity),n("point-radius",t.pointRadius),n("point-color",t.pointColor),n("icon-url",t.iconUrl),n("icon-size",t.iconSize),n("text-property",t.textProperty),n("text-color",t.textColor),n("text-size",t.textSize);break}case"xyz":o=document.createElement("v-map-layer-xyz"),n("url",e.url??t.url),n("attributions",t.attributions),n("max-zoom",t.maxZoom),n("tile-size",t.tileSize),n("subdomains",t.subdomains);break;case"terrain":o=document.createElement("v-map-layer-terrain"),n("elevation-data",t.elevationData),n("texture",t.texture),t.elevationDecoder&&n("elevation-decoder",t.elevationDecoder,{json:"string"!=typeof t.elevationDecoder}),n("wireframe",t.wireframe),t.color&&n("color",Array.isArray(t.color)?JSON.stringify(t.color):t.color),n("min-zoom",t.minZoom),n("max-zoom",t.maxZoom),n("mesh-max-error",t.meshMaxError);break;case"wfs":o=document.createElement("v-map-layer-wfs"),n("url",t.url??e.url),n("type-name",t.typeName),n("version",t.version),n("output-format",t.outputFormat),n("srs-name",t.srsName),t.params&&n("params","string"==typeof t.params?t.params:JSON.stringify(t.params));break;case"wcs":o=document.createElement("v-map-layer-wcs"),n("url",t.url??e.url),n("coverage-name",t.coverageName),n("format",t.format),n("version",t.version),n("projection",t.projection),t.resolutions&&n("resolutions","string"==typeof t.resolutions?t.resolutions:JSON.stringify(t.resolutions)),t.params&&n("params","string"==typeof t.params?t.params:JSON.stringify(t.params));break;case"google":o=document.createElement("v-map-layer-google"),n("api-key",t.apiKey),n("map-type",t.mapType),n("language",t.language),n("region",t.region),n("scale",t.scale),n("libraries",t.libraries),n("max-zoom",t.maxZoom),t.styles&&n("styles","string"==typeof t.styles?t.styles:JSON.stringify(t.styles));break;case"geotiff":o=document.createElement("v-map-layer-geotiff"),n("url",e.url??t.url);break;case"tile3d":o=document.createElement("v-map-layer-tile3d"),n("url",e.url??t.url),t.tilesetOptions&&n("tileset-options","string"==typeof t.tilesetOptions?t.tilesetOptions:JSON.stringify(t.tilesetOptions));break;case"scatterplot":o=document.createElement("v-map-layer-scatterplot"),n("url",t.url),t.data&&n("data","string"==typeof t.data?t.data:JSON.stringify(t.data)),n("get-fill-color",t.getFillColor),n("get-radius",t.getRadius);break;case"wkt":o=document.createElement("v-map-layer-wkt"),t.wkt&&n("wkt","string"==typeof t.wkt?t.wkt:JSON.stringify(t.wkt)),n("url",t.url),n("fill-color",t.fillColor),n("fill-opacity",t.fillOpacity),n("stroke-color",t.strokeColor),n("stroke-width",t.strokeWidth),n("stroke-opacity",t.strokeOpacity),n("point-radius",t.pointRadius),n("point-color",t.pointColor),n("icon-url",t.iconUrl),n("icon-size",t.iconSize),n("text-property",t.textProperty),n("text-color",t.textColor),n("text-size",t.textSize);break;default:if(o=document.createElement("v-map-layer-custom"),o.setAttribute("type",e.type),t&&"object"==typeof t)for(const[e,r]of Object.entries(t))n(this.toKebabCase(e),"object"==typeof r&&null!==r?JSON.stringify(r):r)}for(const[e,t]of Object.entries(r))this.ensureAttr(o,e,t);return o}patchLayer(e,t,r){for(const[n,o]of Object.entries(t)){const t=o.new;switch(n){case"visible":this.ensureAttr(e,"visible",t);break;case"opacity":this.ensureAttr(e,"opacity",t);break;case"zIndex":this.ensureAttr(e,"z-index",t);break;case"url":this.ensureAttr(e,"url",t);break;case"layers":this.ensureAttr(e,"layers",t);break;case"tiled":this.ensureAttr(e,"tiled",t);break;case"style":this.ensureAttr(e,"style",t?JSON.stringify(t):void 0);break;case"data":if(["terrain","wfs","wcs","wms","wms-tiled","geojson","xyz","google","tile3d","scatterplot","wkt"].includes(r.type)){const t=e.parentElement,n=this.createLayerEl(r);return void t.replaceChild(n,e)}if(e.setData?.(t),!e.setData){const r="object"==typeof t?JSON.stringify(t):t;this.ensureAttr(e,"data",r)}break;case"type":const n=e.parentElement,o=this.createLayerEl(r);return void n.replaceChild(o,e)}}}applyDiff(e,t){const r=this.hostEl;let n=Array.from(r.children).find((e=>"v-map"===e.tagName.toLowerCase()));n||(n=document.createElement("v-map"),r.appendChild(n)),this.ensureAttr(n,"flavour",t.map.flavour),this.ensureAttr(n,"id",t.map.id),this.ensureAttr(n,"zoom",t.map.zoom+""),this.ensureAttr(n,"center",t.map.center),this.ensureAttr(n,"style",t.map.style),this.syncStyles(n,t.map.styles||[]);const o=new Set(t.map.layerGroups.map((e=>e.groupTitle)));Array.from(n.children).forEach((e=>{if("v-map-layergroup"!==e.tagName.toLowerCase())return;const t=e.getAttribute("group-title")||"";o.has(t)||n.removeChild(e)})),t.map.layerGroups.forEach(((e,t)=>{const r=this.ensureGroup(n,e.groupTitle,e.basemapid,e.visible,t),o=[];Array.from(r.children).forEach((e=>{const t=e.getAttribute("id")||"",r=e.tagName.toLowerCase().replace("v-map-layer-","");o.push({id:t,type:r})}));const{removed:a,updated:i,moved:s}=function(e,t){const r=new Map(e.map((e=>[e.id,e]))),n=new Map(t.map((e=>[e.id,e]))),o=[],a=[],i=[],s=[];for(const e of t){const t=r.get(e.id);if(!t){o.push(e);continue}const n=We(t,e);Object.keys(n).length?i.push({id:e.id,changes:n}):s.push(e.id)}for(const t of e)n.has(t.id)||a.push(t);const l=e.filter((e=>n.has(e.id))).map((e=>e.id)),c=t.filter((e=>r.has(e.id))).map((e=>e.id)),u=function(e,t){const r=e.length,n=t.length,o=Array.from({length:r+1},(()=>Array(n+1).fill(0)));for(let a=r-1;a>=0;a--)for(let r=n-1;r>=0;r--)o[a][r]=e[a]===t[r]?o[a+1][r+1]+1:Math.max(o[a+1][r],o[a][r+1]);const a=[];let i=0,s=0;for(;i<r&&s<n;)e[i]===t[s]?(a.push(e[i]),i++,s++):o[i+1][s]>=o[i][s+1]?i++:s++;return a}(l,c),f=new Set(u),p=[];for(const e of c)if(!f.has(e)&&!o.find((t=>t.id===e))){const t=l.indexOf(e),r=c.indexOf(e);-1!==t&&-1!==r&&p.push({id:e,from:t,to:r})}return{added:o,removed:a,updated:i,moved:p,unchangedIds:s}}(o,e.layers);for(const e of a){const t=Array.from(r.children).find((t=>t.getAttribute("id")===e.id));t&&r.removeChild(t)}for(const e of s){const t=Array.from(r.children).find((t=>t.getAttribute("id")===e.id));t&&r.insertBefore(t,r.children[e.to]||null)}for(const t of i){const n=Array.from(r.children).find((e=>e.getAttribute("id")===t.id));if(!n)continue;const o=e.layers.find((e=>e.id===t.id));this.patchLayer(n,t.changes,o)}e.layers.forEach(((e,t)=>{if(!Array.from(r.children).some((t=>t.getAttribute("id")===e.id))){const n=this.createLayerEl(e);r.insertBefore(n,r.children[t]||null)}}))}))}onSlotChange=()=>{a(Ve+"onSlotChange"),this.parseFromSlot()};render(){return a(Ve+s.COMPONENT_RENDER),o("div",{key:"0e041d9d068e0b31b1d1245888e8aa3668b22625",class:"root"},o("slot",{key:"0141bfb2be32531f9673bc8d0759943dd7ac63b1",name:"mapconfig",onSlotchange:this.onSlotChange}),o("slot",{key:"2df1c8fe43ea7ee4db3fc57875f0cec126b1fa97"}))}static get watchers(){return{mapconfig:[{onMapConfigChanged:0}]}}static get style(){return":host{display:block;height:100%}.root{height:100%}"}},[769,"v-map-builder",{mapconfig:[1040]},void 0,{mapconfig:[{onMapConfigChanged:0}]}]);function Qe(){"undefined"!=typeof customElements&&["v-map-builder","v-map","v-map-layer-geojson","v-map-layer-geotiff","v-map-layer-google","v-map-layer-osm","v-map-layer-scatterplot","v-map-layer-terrain","v-map-layer-tile3d","v-map-layer-wcs","v-map-layer-wfs","v-map-layer-wkt","v-map-layer-wms","v-map-layer-xyz","v-map-layergroup","v-map-style"].forEach((t=>{switch(t){case"v-map-builder":customElements.get(e(t))||customElements.define(e(t),He);break;case"v-map":customElements.get(e(t))||l();break;case"v-map-layer-geojson":customElements.get(e(t))||c();break;case"v-map-layer-geotiff":customElements.get(e(t))||u();break;case"v-map-layer-google":customElements.get(e(t))||f();break;case"v-map-layer-osm":customElements.get(e(t))||p();break;case"v-map-layer-scatterplot":customElements.get(e(t))||m();break;case"v-map-layer-terrain":customElements.get(e(t))||d();break;case"v-map-layer-tile3d":customElements.get(e(t))||y();break;case"v-map-layer-wcs":customElements.get(e(t))||h();break;case"v-map-layer-wfs":customElements.get(e(t))||b();break;case"v-map-layer-wkt":customElements.get(e(t))||v();break;case"v-map-layer-wms":customElements.get(e(t))||g();break;case"v-map-layer-xyz":customElements.get(e(t))||w();break;case"v-map-layergroup":customElements.get(e(t))||k();break;case"v-map-style":customElements.get(e(t))||j()}}))}Qe();const Xe=He,et=Qe;export{Xe as VMapBuilder,et as defineCustomElement}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Components, JSX } from "../types/components";
|
|
2
|
+
|
|
3
|
+
interface VMapLayerGeojson extends Components.VMapLayerGeojson, HTMLElement {}
|
|
4
|
+
export const VMapLayerGeojson: {
|
|
5
|
+
prototype: VMapLayerGeojson;
|
|
6
|
+
new (): VMapLayerGeojson;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Used to define this component and all nested components recursively.
|
|
10
|
+
*/
|
|
11
|
+
export const defineCustomElement: () => void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{V as o,d as s}from"./v-map-layer-geojson2.js";const a=o,r=s;export{a as VMapLayerGeojson,r as defineCustomElement}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{transformTag as t,proxyCustomElement as e,HTMLElement as o,h as i}from"@stencil/core/internal/client";import{V as s}from"./v-map-layer-helper.js";import{l as n}from"./events.js";import{M as a}from"./messages.js";import{i as l}from"./styling.js";const r="v-map-layer-geojson - ",h=e(class extends o{constructor(t){super(),!1!==t&&this.__registerHost(),this.__attachShadow()}get el(){return this}loadState="idle";geojson;url=null;visible=!0;zIndex=1e3;opacity=1;fillColor;fillOpacity;strokeColor;strokeWidth;strokeOpacity;pointRadius;pointColor;iconUrl;iconSize;textProperty;textColor;textSize;geoSlot;mo;lastString;layerId=null;didLoad=!1;hasLoadedOnce=!1;helper;appliedGeostylerStyle;async getLayerId(){return this.layerId}setLoadState(t){this.loadState=t}async getError(){return this.helper?.getError()}async connectedCallback(){n(r+a.COMPONENT_CONNECTED_CALLBACK),this.hasLoadedOnce&&(this.helper.startLoading(),await this.helper.initLayer((()=>this.createLayerConfig()),this.el.id))}async componentWillLoad(){n(r+a.COMPONENT_WILL_LOAD),this.helper=new s(this.el,this)}async componentDidLoad(){n(r+a.COMPONENT_DID_LOAD),this.geoSlot=this.el.shadowRoot.querySelector('slot[name="geojson"]'),this.geoSlot&&(this.geoSlot.addEventListener("slotchange",this.onSlotChange),this.observeAssignedNodes(),this.readGeoJsonFromSlot()),this.helper.startLoading(),await this.helper.initLayer((()=>this.createLayerConfig()),this.el.id),await this.applyExistingStyles(),this.didLoad=!0,this.hasLoadedOnce=!0}async disconnectedCallback(){n(r+a.COMPONENT_DISCONNECTED_CALLBACK),this.mo?.disconnect(),this.geoSlot?.removeEventListener("slotchange",this.onSlotChange),await(this.helper?.dispose())}isReady(){return this.didLoad}async onGeoJsonChanged(t,e){if(n(r+"onGeoJsonChanged"),t!==e){let t=null;"object"==typeof this.geojson?t=JSON.stringify(this.geojson):"string"==typeof this.geojson&&(t=this.geojson),await(this.helper?.updateLayer({type:"geojson",data:{geojson:t}}))}}async onUrlChanged(t,e){n(r+"onUrlChanged"),t!==e&&await(this.helper?.updateLayer({type:"geojson",data:{url:this.url}}))}async onVisibleChanged(){n(r+"onVisibleChanged"),await(this.helper?.setVisible(this.visible))}async onOpacityChanged(){n(r+"onOpacityChanged"),await(this.helper?.setOpacity(this.opacity))}async onZIndexChanged(){n(r+"onZIndexChanged"),await(this.helper?.setZIndex(this.zIndex))}async onStyleChanged(){n(r+"onStyleChanged"),await(this.helper?.updateLayer({type:"geojson",data:{geojson:this.geojson,url:this.url}}))}async onStyleReady(t){l(t.detail.style)&&this.isTargetedByStyle(t.detail.layerIds)&&(n(r+"Applying geostyler style"),this.appliedGeostylerStyle=t.detail.style,await this.updateLayerWithGeostylerStyle())}isTargetedByStyle(t){return!!t&&(t.includes(this.el.id)||0===t.length)}async applyExistingStyles(){const t=Array.from(document.querySelectorAll("v-map-style"));for(const e of t){const t=e.getStyle?await e.getStyle():void 0;if(!t)continue;if(!l(t))continue;const o=e.getLayerTargetIds?await e.getLayerTargetIds():void 0;o&&this.isTargetedByStyle(o)&&(n(r+"Applying existing geostyler style"),this.appliedGeostylerStyle=t,await this.updateLayerWithGeostylerStyle())}}async updateLayerWithGeostylerStyle(){this.appliedGeostylerStyle&&this.helper&&await this.helper.updateLayer({type:"geojson",data:{geojson:this.geojson,url:this.url,geostylerStyle:this.appliedGeostylerStyle}})}onSlotChange=()=>{n(r+"onSlotChange"),this.observeAssignedNodes(),this.readGeoJsonFromSlot()};observeAssignedNodes(){if(n(r+"observeAssignedNodes"),this.mo?.disconnect(),!this.geoSlot)return;const t=this.geoSlot.assignedNodes({flatten:!0});this.mo=new MutationObserver((()=>this.readGeoJsonFromSlot()));for(const e of t)this.mo.observe(e,{characterData:!0,childList:!0,subtree:!0})}readGeoJsonFromSlot(){if(n(r+"readGeoJsonFromSlot"),!this.geoSlot)return void n(r+"readGeoJsonFromSlot - geoSlot: false");const t=this.geoSlot.assignedNodes({flatten:!0}).map((t=>t.textContent||"")).join("").trim();if(t)if(t!==this.lastString){this.lastString=t;try{const e=JSON.parse(t);n(r+"readGeoJsonFromSlot: ",e),this.geojson=e}catch(t){this.helper?.setError({type:"parse",message:"Ungültiges JSON im Slot",attribute:"geojson",cause:t})}}else n(r+"readGeoJsonFromSlot - raw === this.lastString");else n(r+"readGeoJsonFromSlot - raw: false")}createLayerConfig(){const t=this.iconSize?this.iconSize.split(",").map((t=>parseInt(t.trim(),10))):void 0;let e=null;"object"==typeof this.geojson?e=JSON.stringify(this.geojson):"string"==typeof this.geojson&&(e=this.geojson);const o={type:"geojson",opacity:this.opacity,visible:this.visible,zIndex:this.zIndex,url:this.url,geojson:e,style:{fillColor:this.fillColor,fillOpacity:this.fillOpacity,strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeOpacity:this.strokeOpacity,pointRadius:this.pointRadius,pointColor:this.pointColor,iconUrl:this.iconUrl,iconSize:t,textProperty:this.textProperty,textColor:this.textColor,textSize:this.textSize}};return this.appliedGeostylerStyle&&(o.geostylerStyle=this.appliedGeostylerStyle),o}render(){return i("slot",{key:"093a5de19ea7090df1883b15e379b604dfabc1a1",name:"geojson",onSlotchange:this.onSlotChange})}static get watchers(){return{geojson:[{onGeoJsonChanged:0}],url:[{onUrlChanged:0}],visible:[{onVisibleChanged:0}],opacity:[{onOpacityChanged:0}],zIndex:[{onZIndexChanged:0}],fillColor:[{onStyleChanged:0}],fillOpacity:[{onStyleChanged:0}],strokeColor:[{onStyleChanged:0}],strokeWidth:[{onStyleChanged:0}],strokeOpacity:[{onStyleChanged:0}],pointRadius:[{onStyleChanged:0}],pointColor:[{onStyleChanged:0}],iconUrl:[{onStyleChanged:0}],iconSize:[{onStyleChanged:0}],textProperty:[{onStyleChanged:0}],textColor:[{onStyleChanged:0}],textSize:[{onStyleChanged:0}]}}},[769,"v-map-layer-geojson",{loadState:[1537,"load-state"],geojson:[1025],url:[513],visible:[516],zIndex:[514,"z-index"],opacity:[514],fillColor:[513,"fill-color"],fillOpacity:[514,"fill-opacity"],strokeColor:[513,"stroke-color"],strokeWidth:[514,"stroke-width"],strokeOpacity:[514,"stroke-opacity"],pointRadius:[514,"point-radius"],pointColor:[513,"point-color"],iconUrl:[513,"icon-url"],iconSize:[513,"icon-size"],textProperty:[513,"text-property"],textColor:[513,"text-color"],textSize:[514,"text-size"],getLayerId:[64],getError:[64]},[[4,"styleReady","onStyleReady"]],{geojson:[{onGeoJsonChanged:0}],url:[{onUrlChanged:0}],visible:[{onVisibleChanged:0}],opacity:[{onOpacityChanged:0}],zIndex:[{onZIndexChanged:0}],fillColor:[{onStyleChanged:0}],fillOpacity:[{onStyleChanged:0}],strokeColor:[{onStyleChanged:0}],strokeWidth:[{onStyleChanged:0}],strokeOpacity:[{onStyleChanged:0}],pointRadius:[{onStyleChanged:0}],pointColor:[{onStyleChanged:0}],iconUrl:[{onStyleChanged:0}],iconSize:[{onStyleChanged:0}],textProperty:[{onStyleChanged:0}],textColor:[{onStyleChanged:0}],textSize:[{onStyleChanged:0}]}]);function d(){"undefined"!=typeof customElements&&["v-map-layer-geojson"].forEach((e=>{"v-map-layer-geojson"===e&&(customElements.get(t(e))||customElements.define(t(e),h))}))}d();export{h as V,d}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Components, JSX } from "../types/components";
|
|
2
|
+
|
|
3
|
+
interface VMapLayerGeotiff extends Components.VMapLayerGeotiff, HTMLElement {}
|
|
4
|
+
export const VMapLayerGeotiff: {
|
|
5
|
+
prototype: VMapLayerGeotiff;
|
|
6
|
+
new (): VMapLayerGeotiff;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Used to define this component and all nested components recursively.
|
|
10
|
+
*/
|
|
11
|
+
export const defineCustomElement: () => void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{V as o,d as a}from"./v-map-layer-geotiff2.js";const r=o,s=a;export{r as VMapLayerGeotiff,s as defineCustomElement}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{transformTag as t,proxyCustomElement as a,HTMLElement as e,createEvent as n}from"@stencil/core/internal/client";import{V as i}from"./v-map-layer-helper.js";import{l as o}from"./events.js";import{M as s}from"./messages.js";import{i as l}from"./styling.js";const h="v-map-layer-geotiff - ",r=a(class extends e{constructor(t){super(),!1!==t&&this.__registerHost(),this.__attachShadow(),this.ready=n(this,"ready",7)}get el(){return this}loadState="idle";url=null;visible=!0;opacity=1;zIndex=100;nodata=null;colorMap=null;valueRange=null;ready;didLoad=!1;hasLoadedOnce=!1;helper;setLoadState(t){this.loadState=t}async getError(){return this.helper?.getError()}async onUrlChanged(){o(h+"onUrlChanged"),await(this.helper?.updateLayer({type:"geotiff",data:{url:this.url,nodata:this.nodata,colorMap:this.colorMap,valueRange:this.valueRange}}))}async onVisibleChanged(){o(h+"onVisibleChanged"),await(this.helper?.setVisible(this.visible))}async onOpacityChanged(){o(h+"onOpacityChanged"),await(this.helper?.setOpacity(this.opacity))}async onZIndexChanged(){o(h+"onZIndexChanged"),await(this.helper?.setZIndex(this.zIndex))}async onNodataChanged(){o(h+"onNodataChanged"),isNaN(this.nodata)&&(this.nodata=null),await(this.helper?.updateLayer({type:"geotiff",data:{url:this.url,nodata:this.nodata,colorMap:this.colorMap,valueRange:this.valueRange}}))}async onColorMapChanged(){o(h+"onColorMapChanged"),await(this.helper?.updateLayer({type:"geotiff",data:{url:this.url,nodata:this.nodata,colorMap:this.colorMap,valueRange:this.valueRange}}))}async onValueRangeChanged(){o(h+"onValueRangeChanged"),await(this.helper?.updateLayer({type:"geotiff",data:{url:this.url,nodata:this.nodata,colorMap:this.colorMap,valueRange:this.valueRange}}))}isReady(){return this.didLoad}async getLayerId(){return this.helper.getLayerId()}createLayerConfig(){return{type:"geotiff",visible:this.visible,zIndex:this.zIndex,opacity:this.opacity,url:this.url,nodata:this.nodata,colorMap:this.colorMap,valueRange:this.valueRange}}async connectedCallback(){o(h+s.COMPONENT_CONNECTED_CALLBACK),this.hasLoadedOnce&&(this.helper.startLoading(),await this.helper.initLayer((()=>this.createLayerConfig()),this.el.id)),document.addEventListener("styleReady",this.handleStyleReady.bind(this))}async disconnectedCallback(){document.removeEventListener("styleReady",this.handleStyleReady.bind(this)),await(this.helper?.dispose())}async handleStyleReady(t){o(h+"handleStyleReady");const a=t.detail;if(a.layerIds&&a.layerIds.length>0){const t=this.helper?.getLayerId(),e=a.layerIds;if(t&&!e.includes(t)&&!e.includes(this.el.id))return void o(h+"style not targeted for this layer")}if(!l(a.style))return void o(h+"not a GeoStyler style");const e=this.extractRasterSymbolizer(a.style);e&&(o(h+"applying RasterSymbolizer from style"),e.colorMap&&(this.colorMap=e.colorMap),void 0!==e.opacity&&"number"==typeof e.opacity&&(this.opacity=e.opacity),void 0!==e.visibility&&"boolean"==typeof e.visibility&&(this.visible=e.visibility))}extractRasterSymbolizer(t){for(const a of t.rules)for(const t of a.symbolizers)if("Raster"===t.kind)return t;return null}async componentWillLoad(){o(h+s.COMPONENT_WILL_LOAD),this.helper=new i(this.el,this)}async componentDidLoad(){o(h+s.COMPONENT_DID_LOAD),this.helper.startLoading(),await this.helper.initLayer((()=>this.createLayerConfig()),this.el.id),this.hasLoadedOnce=!0,this.didLoad=!0,this.ready.emit()}async componentWillRender(){o(h+s.COMPONENT_WILL_RENDER)}render(){}static get watchers(){return{url:[{onUrlChanged:0}],visible:[{onVisibleChanged:0}],opacity:[{onOpacityChanged:0}],zIndex:[{onZIndexChanged:0}],nodata:[{onNodataChanged:0}],colorMap:[{onColorMapChanged:0}],valueRange:[{onValueRangeChanged:0}]}}static get style(){return":host{display:none;}"}},[513,"v-map-layer-geotiff",{loadState:[1537,"load-state"],url:[1],visible:[4],opacity:[2],zIndex:[2,"z-index"],nodata:[2],colorMap:[1,"color-map"],valueRange:[16],getError:[64],getLayerId:[64]},void 0,{url:[{onUrlChanged:0}],visible:[{onVisibleChanged:0}],opacity:[{onOpacityChanged:0}],zIndex:[{onZIndexChanged:0}],nodata:[{onNodataChanged:0}],colorMap:[{onColorMapChanged:0}],valueRange:[{onValueRangeChanged:0}]}]);function d(){"undefined"!=typeof customElements&&["v-map-layer-geotiff"].forEach((a=>{"v-map-layer-geotiff"===a&&(customElements.get(t(a))||customElements.define(t(a),r))}))}d();export{r as V,d}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Components, JSX } from "../types/components";
|
|
2
|
+
|
|
3
|
+
interface VMapLayerGoogle extends Components.VMapLayerGoogle, HTMLElement {}
|
|
4
|
+
export const VMapLayerGoogle: {
|
|
5
|
+
prototype: VMapLayerGoogle;
|
|
6
|
+
new (): VMapLayerGoogle;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Used to define this component and all nested components recursively.
|
|
10
|
+
*/
|
|
11
|
+
export const defineCustomElement: () => void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{V as o,d as a}from"./v-map-layer-google2.js";const r=o,s=a;export{r as VMapLayerGoogle,s as defineCustomElement}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{transformTag as t,proxyCustomElement as e,HTMLElement as s,createEvent as a}from"@stencil/core/internal/client";import{l as i}from"./events.js";import{M as o}from"./messages.js";import{V as r}from"./v-map-layer-helper.js";const l="v-map-layer-google - ",n=e(class extends s{constructor(t){super(),!1!==t&&this.__registerHost(),this.__attachShadow(),this.ready=a(this,"ready",7)}get el(){return this}loadState="idle";mapType="roadmap";apiKey;language;region;visible=!0;opacity=1;scale;maxZoom;styles;libraries;ready;hasLoadedOnce=!1;helper;setLoadState(t){this.loadState=t}async getError(){return this.helper?.getError()}parseStyles(t){if("string"==typeof t)try{const e=JSON.parse(t);this.styles=e}catch(t){this.helper?.setError({type:"parse",message:"Invalid JSON in styles attribute",attribute:"styles",cause:t})}}createLayerConfig(){return{type:"google",apiKey:this.apiKey??"",mapType:this.mapType,language:this.language,region:this.region,visible:this.visible,opacity:this.opacity,scale:this.scale,maxZoom:this.maxZoom,styles:this.styles,libraries:this.libraries?this.libraries.split(",").map((t=>t.trim())):void 0}}async connectedCallback(){i(l+o.COMPONENT_CONNECTED_CALLBACK),"string"==typeof this.styles&&this.parseStyles(this.styles),this.hasLoadedOnce&&(this.helper.startLoading(),await this.helper.initLayer((()=>this.createLayerConfig()),this.el.id))}async componentWillLoad(){i(l+o.COMPONENT_WILL_LOAD),this.helper=new r(this.el,this)}async componentDidLoad(){i(l+o.COMPONENT_DID_LOAD),this.helper.startLoading(),await this.helper.initLayer((()=>this.createLayerConfig()),this.el.id),this.hasLoadedOnce=!0,this.ready.emit()}async disconnectedCallback(){i(l+o.COMPONENT_DISCONNECTED_CALLBACK),await(this.helper?.dispose())}render(){}static get watchers(){return{styles:[{parseStyles:0}]}}static get style(){return""}},[513,"v-map-layer-google",{loadState:[1537,"load-state"],mapType:[513,"map-type"],apiKey:[513,"api-key"],language:[513],region:[513],visible:[516],opacity:[514],scale:[513],maxZoom:[514,"max-zoom"],styles:[1025],libraries:[513],getError:[64]},void 0,{styles:[{parseStyles:0}]}]);function h(){"undefined"!=typeof customElements&&["v-map-layer-google"].forEach((e=>{"v-map-layer-google"===e&&(customElements.get(t(e))||customElements.define(t(e),n))}))}h();export{n as V,h as d}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{V as t,w as i,l as s}from"./events.js";class e{el;static RUNTIME_ERROR_DEBOUNCE_MS=5e3;layerId=null;mapProvider=null;_error;host;initContext;listenersBound=!1;recreateInFlight=!1;lastRuntimeErrorTime=0;constructor(t,i){this.el=t,this.host=i}startLoading(){this.host?.setLoadState("loading")}markReady(){this.clearError(),this.host?.setLoadState("ready")}markUpdated(){this.markReady()}setError(s){this._error=s,this.host?.setLoadState("error"),this.el.dispatchEvent(new CustomEvent(t.Error,{detail:s,bubbles:!0,composed:!0})),i(`${this.el.nodeName.toLowerCase()} - ${s.message}`)}setRuntimeError(t){const i=Date.now();i-this.lastRuntimeErrorTime<e.RUNTIME_ERROR_DEBOUNCE_MS||(this.lastRuntimeErrorTime=i,this.setError(t))}clearError(){this._error=void 0,this.lastRuntimeErrorTime=0}getError(){return this._error}async addLayer(t,s,e,a,r){return this.mapProvider?t?await(this.mapProvider?.addBaseLayer({...a,groupId:s,groupVisible:e},t,r)):await(this.mapProvider?.addLayerToGroup({...a,groupId:s,groupVisible:e})):(i("Map provider not available."),null)}async addToMapInternal(t,i,e,a){if(this.layerId&&(this.unregisterLayerError(),await(this.mapProvider?.removeLayer(this.layerId)),this.layerId=null),!0===await(i.isMapProviderReady?.())){s(`${this.el.nodeName.toLowerCase()} - layer is being added`),this.mapProvider=i.__vMapProvider??null;const r=await t.getGroupId(),h=await t.visible;if(null===this.layerId&&this.mapProvider)try{this.layerId=await this.addLayer(t.basemapid,r,h,e(),a),this.layerId?(this.registerLayerError(),this.markReady()):this.setError({type:"provider",message:"Layer could not be added: provider returned no layer ID"})}catch(t){this.setError({type:"provider",message:`Layer could not be added: ${t instanceof Error?t.message:String(t)}`,cause:t})}}}bindMapEventsOnce(){if(this.listenersBound||!this.initContext)return;const{vmap:i}=this.initContext;i.addEventListener(t.MapProviderReady,this.onMapProviderReady),i.addEventListener(t.MapProviderWillShutdown,this.onMapProviderWillShutdown),this.listenersBound=!0}onMapProviderReady=async t=>{if(s(`${this.el.nodeName.toLowerCase()} - layer add deferred`),this.mapProvider=t.detail.mapProvider,!this.layerId&&this.initContext){this.startLoading();const{group:t,vmap:i,createLayerConfig:s,elementId:e}=this.initContext;await this.addToMapInternal(t,i,s,e)}};onMapProviderWillShutdown=async()=>{s(`${this.el.nodeName.toLowerCase()} - map provider shutting down`),this.mapProvider=null,this.layerId=null,this.clearError(),this.host?.setLoadState("idle")};async setVisible(t){if(this.layerId&&this.mapProvider)try{await this.mapProvider.setVisible(this.layerId,t)}catch(t){this.setError({type:"provider",message:`setVisible failed: ${t instanceof Error?t.message:String(t)}`,cause:t})}}async setOpacity(t){if(this.layerId&&this.mapProvider)try{await this.mapProvider.setOpacity(this.layerId,t)}catch(t){this.setError({type:"provider",message:`setOpacity failed: ${t instanceof Error?t.message:String(t)}`,cause:t})}}async setZIndex(t){if(this.layerId&&this.mapProvider)try{await this.mapProvider.setZIndex(this.layerId,t)}catch(t){this.setError({type:"provider",message:`setZIndex failed: ${t instanceof Error?t.message:String(t)}`,cause:t})}}async updateLayer(t){if(this.layerId&&this.mapProvider)try{await this.mapProvider.updateLayer(this.layerId,t),this.markUpdated()}catch(t){this.setError({type:"provider",message:`updateLayer failed: ${t instanceof Error?t.message:String(t)}`,cause:t})}else await this.recreateLayer()}async recreateLayer(){if(!this.initContext||this.recreateInFlight)return;this.recreateInFlight=!0,this.startLoading();const{group:t,vmap:i,createLayerConfig:s,elementId:e}=this.initContext;try{await this.addToMapInternal(t,i,s,e)}finally{this.recreateInFlight=!1}}async initLayer(t,s){const e=this.el.closest("v-map-layergroup");if(!e)return void i(`${this.el.nodeName.toLowerCase()} is not inside a v-map-layergroup`);const a=await this.getVMap();a?(this.initContext={group:e,vmap:a,createLayerConfig:t,elementId:s},this.bindMapEventsOnce(),await this.addToMapInternal(e,a,t,s)):i(`No parent v-map component found for ${this.el.nodeName.toLowerCase()}`)}async dispose(){if(this.initContext&&this.listenersBound){const{vmap:i}=this.initContext;i.removeEventListener(t.MapProviderReady,this.onMapProviderReady),i.removeEventListener(t.MapProviderWillShutdown,this.onMapProviderWillShutdown)}this.listenersBound=!1,await this.removeLayer(),this.clearError(),this.host?.setLoadState("idle")}getMapProvider(){return this.mapProvider}getLayerId(){return this.layerId}async removeLayer(){this.unregisterLayerError(),await(this.mapProvider?.removeLayer(this.layerId)),this.layerId=null}registerLayerError(){this.layerId&&this.mapProvider?.onLayerError&&this.mapProvider.onLayerError(this.layerId,(t=>{this.setRuntimeError({type:t.type,message:t.message,cause:t.cause})}))}unregisterLayerError(){this.layerId&&this.mapProvider?.offLayerError&&this.mapProvider.offLayerError(this.layerId)}async getVMap(){s(`${this.el.nodeName.toLowerCase()} - getVMap`);const t=this.el.closest("v-map");if(!t)return s(`${this.el.nodeName.toLowerCase()} - getVMap - v-map not found.`),null;await customElements.whenDefined("v-map");const i=t;return s(`${this.el.nodeName.toLowerCase()} - getVMap - assigned.`),i}}export{e as V}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Components, JSX } from "../types/components";
|
|
2
|
+
|
|
3
|
+
interface VMapLayerOsm extends Components.VMapLayerOsm, HTMLElement {}
|
|
4
|
+
export const VMapLayerOsm: {
|
|
5
|
+
prototype: VMapLayerOsm;
|
|
6
|
+
new (): VMapLayerOsm;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Used to define this component and all nested components recursively.
|
|
10
|
+
*/
|
|
11
|
+
export const defineCustomElement: () => void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{V as o,d as s}from"./v-map-layer-osm2.js";const a=o,m=s;export{a as VMapLayerOsm,m as defineCustomElement}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{transformTag as t,proxyCustomElement as e,HTMLElement as s,createEvent as a}from"@stencil/core/internal/client";import{V as i}from"./v-map-layer-helper.js";import{M as n}from"./messages.js";import{l as o}from"./events.js";const r="v-map-layer-osm - ",h=e(class extends s{constructor(t){super(),!1!==t&&this.__registerHost(),this.__attachShadow(),this.ready=a(this,"ready",7)}get el(){return this}loadState="idle";visible=!0;opacity=1;zIndex=10;url="https://tile.openstreetmap.org";ready;didLoad=!1;hasLoadedOnce=!1;helper;setLoadState(t){this.loadState=t}async getError(){return this.helper?.getError()}async onVisibleChanged(){o(r+"onVisibleChanged"),await(this.helper?.setVisible(this.visible))}async onOpacityChanged(){o(r+"onOpacityChanged"),await(this.helper?.setOpacity(this.opacity))}async onZIndexChanged(){o(r+"onZIndexChanged"),await(this.helper?.setZIndex(this.zIndex))}async onUrlChanged(t,e){o(r+"onUrlChanged"),t!==e&&await(this.helper?.updateLayer({type:"osm",data:{url:this.url}}))}isReady(){return this.didLoad}async getLayerId(){return this.helper?.getLayerId()}createLayerConfig(){return{type:"osm",url:this.url,visible:this.visible,zIndex:this.zIndex,opacity:this.opacity}}async connectedCallback(){o(r+n.COMPONENT_CONNECTED_CALLBACK),this.hasLoadedOnce&&(this.helper.startLoading(),await this.helper.initLayer((()=>this.createLayerConfig()),this.el.id))}async componentWillLoad(){o(r+n.COMPONENT_WILL_LOAD),this.helper=new i(this.el,this)}async componentDidLoad(){o(r+n.COMPONENT_DID_LOAD),this.helper.startLoading(),await this.helper.initLayer((()=>this.createLayerConfig()),this.el.id),this.hasLoadedOnce=!0,this.didLoad=!0,this.ready.emit()}async componentWillRender(){o(r+n.COMPONENT_WILL_RENDER)}async disconnectedCallback(){o(r+n.COMPONENT_DISCONNECTED_CALLBACK),await(this.helper?.dispose())}render(){}static get watchers(){return{visible:[{onVisibleChanged:0}],opacity:[{onOpacityChanged:0}],zIndex:[{onZIndexChanged:0}],url:[{onUrlChanged:0}]}}static get style(){return":host{display:none;}"}},[513,"v-map-layer-osm",{loadState:[1537,"load-state"],visible:[516],opacity:[514],zIndex:[514,"z-index"],url:[513],getError:[64],getLayerId:[64]},void 0,{visible:[{onVisibleChanged:0}],opacity:[{onOpacityChanged:0}],zIndex:[{onZIndexChanged:0}],url:[{onUrlChanged:0}]}]);function d(){"undefined"!=typeof customElements&&["v-map-layer-osm"].forEach((e=>{"v-map-layer-osm"===e&&(customElements.get(t(e))||customElements.define(t(e),h))}))}d();export{h as V,d}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Components, JSX } from "../types/components";
|
|
2
|
+
|
|
3
|
+
interface VMapLayerScatterplot extends Components.VMapLayerScatterplot, HTMLElement {}
|
|
4
|
+
export const VMapLayerScatterplot: {
|
|
5
|
+
prototype: VMapLayerScatterplot;
|
|
6
|
+
new (): VMapLayerScatterplot;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Used to define this component and all nested components recursively.
|
|
10
|
+
*/
|
|
11
|
+
export const defineCustomElement: () => void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{V as t,d as a}from"./v-map-layer-scatterplot2.js";const o=t,r=a;export{o as VMapLayerScatterplot,r as defineCustomElement}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{transformTag as t,proxyCustomElement as e,HTMLElement as s,createEvent as a}from"@stencil/core/internal/client";import{M as i}from"./messages.js";import{l as r}from"./events.js";import{V as o}from"./v-map-layer-helper.js";const l="v-map-layer-scatterplot - ",c=e(class extends s{constructor(t){super(),!1!==t&&this.__registerHost(),this.__attachShadow(),this.ready=a(this,"ready",7)}get el(){return this}loadState="idle";data;url;getFillColor="#3388ff";getRadius=1e3;opacity=1;visible=!0;ready;hasLoadedOnce=!1;helper;setLoadState(t){this.loadState=t}async getError(){return this.helper?.getError()}createLayerConfig(){return{type:"scatterplot",data:this.data,getFillColor:this.getFillColor,getRadius:this.getRadius,opacity:this.opacity,visible:this.visible}}async connectedCallback(){r(l+i.COMPONENT_CONNECTED_CALLBACK),this.hasLoadedOnce&&(this.helper.startLoading(),await this.helper.initLayer((()=>this.createLayerConfig()),this.el.id))}async componentWillLoad(){r(l+i.COMPONENT_WILL_LOAD),this.helper=new o(this.el,this)}async componentDidLoad(){r(l+i.COMPONENT_DID_LOAD),this.helper.startLoading(),await this.helper.initLayer((()=>this.createLayerConfig()),this.el.id),this.hasLoadedOnce=!0,this.ready.emit()}async disconnectedCallback(){r(l+i.COMPONENT_DISCONNECTED_CALLBACK),await(this.helper?.dispose())}render(){}static get style(){return""}},[513,"v-map-layer-scatterplot",{loadState:[1537,"load-state"],data:[513],url:[513],getFillColor:[513,"get-fill-color"],getRadius:[514,"get-radius"],opacity:[514],visible:[516],getError:[64]}]);function n(){"undefined"!=typeof customElements&&["v-map-layer-scatterplot"].forEach((e=>{"v-map-layer-scatterplot"===e&&(customElements.get(t(e))||customElements.define(t(e),c))}))}n();export{c as V,n as d}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Components, JSX } from "../types/components";
|
|
2
|
+
|
|
3
|
+
interface VMapLayerTerrainGeotiff extends Components.VMapLayerTerrainGeotiff, HTMLElement {}
|
|
4
|
+
export const VMapLayerTerrainGeotiff: {
|
|
5
|
+
prototype: VMapLayerTerrainGeotiff;
|
|
6
|
+
new (): VMapLayerTerrainGeotiff;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Used to define this component and all nested components recursively.
|
|
10
|
+
*/
|
|
11
|
+
export const defineCustomElement: () => void;
|