@arcgis/core 6.0.0-next.42 → 6.0.0-next.43
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/Basemap.js +1 -1
- package/Graphic.js +1 -1
- package/Ground.js +1 -1
- package/WebDocument2D.js +1 -1
- package/WebScene.js +1 -1
- package/analysis/ElevationProfile/ElevationProfileLineScene.d.ts +1 -0
- package/analysis/ElevationProfileAnalysis.d.ts +15 -0
- package/analysis/LineOfSightAnalysis.d.ts +6 -1
- package/analysis/ShadowCastAnalysis.d.ts +18 -22
- package/analysis/ShadowCastAnalysis.js +1 -1
- package/analysis/ViewshedAnalysis.d.ts +6 -1
- package/applications/Components/analysisUtils.d.ts +6 -0
- package/applications/Components/analysisUtils.js +1 -1
- package/arcade/ArcadeModuleResolver.js +1 -1
- package/arcade/arcadeCompiler.js +1 -1
- package/arcade/featureset/actions/Adapted.js +1 -1
- package/arcade/featureset/sources/FeatureLayerMemory.js +1 -1
- package/arcade/featureset/support/FeatureSet.js +1 -1
- package/arcade/featureset/support/shared.js +1 -1
- package/arcade/featureset/support/sqlUtils.js +1 -1
- package/arcade/functions/knowledgegraph.js +1 -1
- package/arcade/functions/maths.js +1 -1
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/{2f54e4feb554c1a7b9c4.js → 02debe67e6fef9d88bdd.js} +1 -1
- package/assets/esri/core/workers/chunks/{bd046399e05e759e0bc2.js → 035204000954973b0ebc.js} +1 -1
- package/assets/esri/core/workers/chunks/05225506fdba0c827407.js +1 -0
- package/assets/esri/core/workers/chunks/{4c73c493dabe949c2512.js → 077b755688346e0dc8d3.js} +1 -1
- package/assets/esri/core/workers/chunks/0c1d8e0c2eae21f97fc0.js +1 -0
- package/assets/esri/core/workers/chunks/105865a4d8cb4ddf8a8a.js +1 -0
- package/assets/esri/core/workers/chunks/{afe3e89737fb45189a99.js → 14ed0c34b910eba3434e.js} +1 -1
- package/assets/esri/core/workers/chunks/{f67b37253d6d05d1e339.js → 14ef986665b4a1f6ccdc.js} +1 -1
- package/assets/esri/core/workers/chunks/158cbf4075d3eca83a6a.js +1 -0
- package/assets/esri/core/workers/chunks/{a03f15f2cbc3fed291c2.js → 15f2b27b8edc0d53e399.js} +1 -1
- package/assets/esri/core/workers/chunks/181d24ced5ef6b1f959b.js +1 -0
- package/assets/esri/core/workers/chunks/18dbee576b7b9dbe69fb.js +1 -0
- package/assets/esri/core/workers/chunks/1aebb8fe0692058bf2fb.js +1 -0
- package/assets/esri/core/workers/chunks/1cdb55d9a5ab1a5e3f08.js +1 -0
- package/assets/esri/core/workers/chunks/{cf2e5f827cea7d7319ce.js → 1e5c5029b0653047a769.js} +1 -1
- package/assets/esri/core/workers/chunks/20db6e844708d3e71437.js +1 -0
- package/assets/esri/core/workers/chunks/21a4c3d8265aca775616.js +1 -0
- package/assets/esri/core/workers/chunks/23fff0505e02fd364909.js +1 -0
- package/assets/esri/core/workers/chunks/286e3e050b29e6158e6f.js +1 -0
- package/assets/esri/core/workers/chunks/29ef9d357e30082d267a.js +1 -0
- package/assets/esri/core/workers/chunks/29feef121b0916fb90bf.js +1 -0
- package/assets/esri/core/workers/chunks/2ef91e8da260454f46d8.js +1 -0
- package/assets/esri/core/workers/chunks/32b9bedd4bb0504f0b1d.js +1 -0
- package/assets/esri/core/workers/chunks/{279089a6a3f08022c678.js → 361d620b3f91868b1490.js} +1 -1
- package/assets/esri/core/workers/chunks/37c16e20f022ca27cdae.js +1 -0
- package/assets/esri/core/workers/chunks/380aefa522dfeccb8c65.js +1 -0
- package/assets/esri/core/workers/chunks/394ae3199c78a94c6a2a.js +1 -0
- package/assets/esri/core/workers/chunks/{fdd2b35388f9fe42b623.js → 3a90b6eafa92f1a68ac5.js} +1 -1
- package/assets/esri/core/workers/chunks/{6a65fc1a2931230fe994.js → 3bb1e06861cd0563ed9f.js} +1 -1
- package/assets/esri/core/workers/chunks/3f92afa58c895bf87e62.js +1 -0
- package/assets/esri/core/workers/chunks/422784ceae0d511868a0.js +1 -0
- package/assets/esri/core/workers/chunks/44782e8318dc47cb08a0.js +1 -0
- package/assets/esri/core/workers/chunks/{5882f349f3771868e67f.js → 4521f72ab0ea872e5d7c.js} +1 -1
- package/assets/esri/core/workers/chunks/45b5a61c4e9fbd9ca0b3.js +1 -0
- package/assets/esri/core/workers/chunks/47af220003adfca2167e.js +1 -0
- package/assets/esri/core/workers/chunks/487500443a6037d3599f.js +1 -0
- package/assets/esri/core/workers/chunks/4a4fab74442c3d914505.js +1 -0
- package/assets/esri/core/workers/chunks/4a8903fb1a5d30a68df9.js +1 -0
- package/assets/esri/core/workers/chunks/4d818b231e6d1fa73cc5.js +1 -0
- package/assets/esri/core/workers/chunks/{e0cf6e1e21d0ee739009.js → 4e03aa5518d46a36661c.js} +1 -1
- package/assets/esri/core/workers/chunks/{1a614bac5db42c6263f8.js → 4fe10650ba3cd30aa9a2.js} +1 -1
- package/assets/esri/core/workers/chunks/50b8b1cce0a5f77c8372.js +1 -0
- package/assets/esri/core/workers/chunks/5470a29a69010c8361c4.js +1 -0
- package/assets/esri/core/workers/chunks/564d7f2e58fbc16853c0.js +1 -0
- package/assets/esri/core/workers/chunks/5c2e79f2ca401741bf3e.js +1 -0
- package/assets/esri/core/workers/chunks/5c9ab86bec07264dc9f2.js +1 -0
- package/assets/esri/core/workers/chunks/{04d55ed51e8b2683c4b4.js → 5d908a823b324bafda1e.js} +1 -1
- package/assets/esri/core/workers/chunks/5e6d6676a5c47c0e132a.js +1 -0
- package/assets/esri/core/workers/chunks/5fd4d3cb3c9350131a59.js +1 -0
- package/assets/esri/core/workers/chunks/60637f38159e9bf68d4e.js +1 -0
- package/assets/esri/core/workers/chunks/69b73251257088ce7099.js +1 -0
- package/assets/esri/core/workers/chunks/6cd17c3a254a0b5c2476.js +1 -0
- package/assets/esri/core/workers/chunks/{06102715e9a8f218e07c.js → 6f3732e7ba2d031ba789.js} +1 -1
- package/assets/esri/core/workers/chunks/7191ab31fa040a7c561e.js +1 -0
- package/assets/esri/core/workers/chunks/71ba848c3352ea3ff96f.js +1 -0
- package/assets/esri/core/workers/chunks/76dc8e3264a456f33e61.js +1 -0
- package/assets/esri/core/workers/chunks/77d80b6d65d761214a7c.js +1 -0
- package/assets/esri/core/workers/chunks/{e2430bc3a1edeb5c3266.js → 78a69594c82d37aecbfb.js} +1 -1
- package/assets/esri/core/workers/chunks/{787c1a8bda7d745633f2.js → 81b9894e81cce3490984.js} +1 -1
- package/assets/esri/core/workers/chunks/85cd525705eec6803dd3.js +1 -0
- package/assets/esri/core/workers/chunks/863f04cacdc843d3f208.js +1 -0
- package/assets/esri/core/workers/chunks/8766832c7253557da8fe.js +1 -0
- package/assets/esri/core/workers/chunks/87992070008812f8ae6f.js +1 -0
- package/assets/esri/core/workers/chunks/892fd2c3533ce46a9258.js +1 -0
- package/assets/esri/core/workers/chunks/89b9d716d96135d4f057.js +1 -0
- package/assets/esri/core/workers/chunks/{4b2d392ad8e381bfd6b3.js → 89e9ebc8d5c1022cb265.js} +1 -1
- package/assets/esri/core/workers/chunks/8b38798ac6d774185238.js +1 -0
- package/assets/esri/core/workers/chunks/8b53369cace136ed1329.js +1 -0
- package/assets/esri/core/workers/chunks/8ba4f5e1912edf397947.js +1 -0
- package/assets/esri/core/workers/chunks/{987424121cf30b0f3c50.js → 8d3e92a3367a3ddc02bd.js} +1 -1
- package/assets/esri/core/workers/chunks/8e7a3b1b088c160f4db7.js +1 -0
- package/assets/esri/core/workers/chunks/8f4fba4d2339c91c8b3f.js +1 -0
- package/assets/esri/core/workers/chunks/{45aaefbdffe5e15dfb24.js → 919a6aedf38e9631ee09.js} +1 -1
- package/assets/esri/core/workers/chunks/{487c46d5245cfb35c4bb.js → 921917e53bac82693ec8.js} +1 -1
- package/assets/esri/core/workers/chunks/92809b209b68abcb97ee.js +1 -0
- package/assets/esri/core/workers/chunks/{beccbfff549902733c4e.js → 9869c696e6321c8db0a9.js} +1 -1
- package/assets/esri/core/workers/chunks/98957dba728c93506e50.js +1 -0
- package/assets/esri/core/workers/chunks/99ffb839407cb3c26ad8.js +1 -0
- package/assets/esri/core/workers/chunks/9b517c8d26a86dedb921.js +1 -0
- package/assets/esri/core/workers/chunks/{cb2329d1ea72ce5cc057.js → 9c3f56f22e9baa80a387.js} +1 -1
- package/assets/esri/core/workers/chunks/{1860104c2b33f68785dd.js → 9d0976f5979c4f9154dc.js} +1 -1
- package/assets/esri/core/workers/chunks/9fe1812aad6e566aea31.js +1 -0
- package/assets/esri/core/workers/chunks/a1602995ef96beb7df29.js +1 -0
- package/assets/esri/core/workers/chunks/{dff845574c0037a1dca6.js → a332e31165b65a6fb92e.js} +1 -1
- package/assets/esri/core/workers/chunks/a553478664a688f32488.js +1 -0
- package/assets/esri/core/workers/chunks/a7937b06f4b0860c7671.js +1 -0
- package/assets/esri/core/workers/chunks/{1980fd7ae1617ef4d19d.js → a95186214f1206efd8ed.js} +1 -1
- package/assets/esri/core/workers/chunks/{853563c66ecf58d53d36.js → ab60e8fbe0f92340616a.js} +1 -1
- package/assets/esri/core/workers/chunks/acea0946049136578354.js +1 -0
- package/assets/esri/core/workers/chunks/{342a97974a78007b25e0.js → ad94f54b4c88b3a047bc.js} +1 -1
- package/assets/esri/core/workers/chunks/ae29fec228e70a93ced1.js +1 -0
- package/assets/esri/core/workers/chunks/ae6dc159be974ca0e8da.js +1 -0
- package/assets/esri/core/workers/chunks/ae70972bf88d586fd453.js +1 -0
- package/assets/esri/core/workers/chunks/b021fa4654ede1d04279.js +1 -0
- package/assets/esri/core/workers/chunks/b03f32f02858244c6cd0.js +1 -0
- package/assets/esri/core/workers/chunks/b2d922ecc2c4899dbee1.js +1 -0
- package/assets/esri/core/workers/chunks/b42e50ec6b819f669400.js +1 -0
- package/assets/esri/core/workers/chunks/b6a82775b83d20599635.js +1 -0
- package/assets/esri/core/workers/chunks/b6d365b9198b74b05338.js +1 -0
- package/assets/esri/core/workers/chunks/{48c6230b8a6d3a8a7906.js → bc21241bc9acb83d1b1c.js} +1 -1
- package/assets/esri/core/workers/chunks/bd02d927b0b4991b61c5.js +1 -0
- package/assets/esri/core/workers/chunks/bdf1c4c038d556527483.js +1 -0
- package/assets/esri/core/workers/chunks/c1273f14a5ef3d81de0d.js +1 -0
- package/assets/esri/core/workers/chunks/c752f1e732bb019f657d.js +1 -0
- package/assets/esri/core/workers/chunks/{3f74c61359b4bd6dcf00.js → c7f49493bd548d5dc1e0.js} +1 -1
- package/assets/esri/core/workers/chunks/{36bafcc29ac133a05558.js → c86d3af148b28ded5875.js} +10 -10
- package/assets/esri/core/workers/chunks/{692f0093c444fcc752b5.js → cadd60fa4370284c7ae3.js} +1 -1
- package/assets/esri/core/workers/chunks/{d5e251cddd41d643510c.js → cb62326b6526cde429c1.js} +1 -1
- package/assets/esri/core/workers/chunks/cd8304b1db83d48c57db.js +1 -0
- package/assets/esri/core/workers/chunks/cdf0c7706d3e1221f49b.js +1 -0
- package/assets/esri/core/workers/chunks/d00dd961a5b79f563123.js +1 -0
- package/assets/esri/core/workers/chunks/d893c3bb093104d3db95.js +1 -0
- package/assets/esri/core/workers/chunks/d8fb1d9da16492574a11.js +1 -0
- package/assets/esri/core/workers/chunks/{520f499d79fa71f262c7.js → dd7e4c94a88452425750.js} +1 -1
- package/assets/esri/core/workers/chunks/ddb4689624d091922471.js +1 -0
- package/assets/esri/core/workers/chunks/df32a3fe81d60f0d7462.js +1 -0
- package/assets/esri/core/workers/chunks/dfc6b33f51dc81f3a7be.js +1 -0
- package/assets/esri/core/workers/chunks/e55934eb4a17a5b24c94.js +1 -0
- package/assets/esri/core/workers/chunks/{5473409fee59db80f87d.js → e5bdfef7c2cc5354be52.js} +1 -1
- package/assets/esri/core/workers/chunks/e8cdec961e9cff1cb73b.js +1 -0
- package/assets/esri/core/workers/chunks/{446d172834f8675f1202.js → eaf720dfdf6ceca31249.js} +1 -1
- package/assets/esri/core/workers/chunks/ef274db3fa260eadf371.js +1 -0
- package/assets/esri/core/workers/chunks/efca82a4dc494f57380b.js +1 -0
- package/assets/esri/core/workers/chunks/f05990e6fb378e2e1a3b.js +1 -0
- package/assets/esri/core/workers/chunks/f0fc89cdf50a40913c02.js +1 -0
- package/assets/esri/core/workers/chunks/{8b5dcc4282772bf6b675.js → f11eaab5354cc6aa9569.js} +1 -1
- package/assets/esri/core/workers/chunks/f1c2f7c7ce4bd4096eb0.js +1 -0
- package/assets/esri/core/workers/chunks/f4e63c5f82b8c2bbfacb.js +1 -0
- package/assets/esri/core/workers/chunks/f86ff791a10c802879ec.js +1 -0
- package/assets/esri/core/workers/chunks/{7452b5ae971a9ff2e6e9.js → fdffefd7de540272a8a6.js} +1 -1
- package/assets/esri/core/workers/chunks/fe0248af95d3f37e099e.js +1 -0
- package/chunks/languageUtils.js +1 -1
- package/config.js +1 -1
- package/core/Accessor.js +1 -1
- package/core/Collection.js +1 -1
- package/core/LRUCache.js +1 -1
- package/core/MapUtils.js +1 -1
- package/core/Version.js +1 -1
- package/core/asyncUtils.js +1 -1
- package/core/fontUtils.js +1 -1
- package/core/has.js +1 -1
- package/core/sql/SqlInterval.js +1 -1
- package/core/sql/WhereClause.js +1 -1
- package/core/sql/writeUtils.js +1 -1
- package/core/sql.js +1 -1
- package/core/urlUtils.js +1 -1
- package/editing/sharedTemplates/executor/builders/pointAtIntersectionVerticesOfLine.js +1 -1
- package/editing/sharedTemplates/executor/builders/polygonBoundary.js +1 -1
- package/editing/sharedTemplates/executor/builders/support/builderUtils.js +1 -1
- package/editing/sharedTemplates/executor/support/createFeatureServiceEdit.js +1 -1
- package/geometry/Point.js +1 -1
- package/geometry/Polygon.js +1 -1
- package/geometry/SpatialReference.js +1 -1
- package/geometry/support/webMercatorUtils.js +1 -1
- package/kernel.js +1 -1
- package/layers/FeatureLayer.js +1 -1
- package/layers/GeoJSONLayer.d.ts +5 -1
- package/layers/GeospatialPDFLayer.js +1 -1
- package/layers/KnowledgeGraphLayer.js +1 -1
- package/layers/LineOfSightLayer.d.ts +6 -1
- package/layers/LinkChartLayer.js +1 -1
- package/layers/Lyr3DWasmPerSceneView.js +1 -1
- package/layers/SubtypeGroupLayer.js +1 -1
- package/layers/TileLayer.js +1 -1
- package/layers/VectorTileLayer.d.ts +53 -0
- package/layers/VectorTileLayer.js +1 -1
- package/layers/VideoLayer.js +1 -1
- package/layers/ViewshedLayer.d.ts +6 -1
- package/layers/VoxelLayer.js +1 -1
- package/layers/effects/jsonUtils.js +1 -1
- package/layers/geospatialPDF/GeospatialPDFLayerWorker.js +1 -1
- package/layers/geospatialPDF/GeospatialPDFWorkerClient.js +1 -1
- package/layers/graphics/data/QueryEngineResult.js +1 -1
- package/layers/graphics/data/projectionSupport.js +1 -1
- package/layers/graphics/sources/connections/WebSocketConnection.js +1 -1
- package/layers/graphics/sources/geojson/GeoJSONSourceWorker.js +1 -1
- package/layers/graphics/sources/geojson/geojson.js +1 -1
- package/layers/graphics/sources/parquet/FileProvider.js +1 -1
- package/layers/graphics/sources/support/QueryTask.js +1 -1
- package/layers/graphics/sources/support/uploads.js +1 -1
- package/layers/knowledgeGraph/cypherUtils.js +1 -1
- package/layers/mixins/refresh.js +1 -1
- package/layers/ogc/ogcFeatureUtils.js +1 -1
- package/layers/ogc/wfsUtils.js +1 -1
- package/layers/parquet.js +1 -1
- package/layers/raster/datasets/BaseRaster.js +1 -1
- package/layers/raster/datasets/GeospatialPDFRaster.js +1 -1
- package/layers/raster/datasets/TIFFRaster.js +1 -1
- package/layers/raster/datasets/wcsCoverageParser.js +1 -1
- package/layers/raster/formats/Lerc.js +1 -1
- package/layers/support/ClientSideConnection.js +1 -1
- package/layers/support/ElevationSampler.js +1 -1
- package/layers/support/MultidimensionalSubset.js +1 -1
- package/layers/support/SpriteSource.js +1 -1
- package/layers/support/TileInfo.js +1 -1
- package/layers/support/fieldUtils.js +1 -1
- package/layers/support/infoFor3D.js +1 -1
- package/layers/support/vectorTileLayerLoader.js +1 -1
- package/layers/support/wmsUtils.js +1 -1
- package/layers/support/wmtsUtils.js +1 -1
- package/layers/video/videoUtils.js +1 -1
- package/libs/lyr3d/Lyr3DModule.js +1 -1
- package/linkChart/utils.js +1 -1
- package/networks/support/Circuit.js +1 -1
- package/networks/support/CircuitSection.js +1 -1
- package/package.json +2 -2
- package/portal/Portal.js +1 -1
- package/portal/PortalItemResource.js +1 -1
- package/portal/PortalQueryParams.js +1 -1
- package/renderers/HeatmapRenderer.js +1 -1
- package/renderers/UniqueValueRenderer.js +1 -1
- package/rest/knowledgeGraphService.js +1 -1
- package/rest/query/operations/pbfFeatureServiceParser.js +1 -1
- package/rest/query/operations/queryAttachments.js +1 -1
- package/symbols/cim/placements/PlacementInsidePolygon.js +1 -1
- package/symbols/cim/types.d.ts +15 -11
- package/symbols/support/previewSymbol3D.js +1 -1
- package/tables/support/templateUtils.js +1 -1
- package/views/2d/engine/vectorTiles/SourceLayerData.js +1 -1
- package/views/2d/engine/vectorTiles/SpriteMosaic.js +1 -1
- package/views/2d/engine/vectorTiles/TileHandler.js +1 -1
- package/views/2d/engine/vectorTiles/TileHandler3D.js +1 -1
- package/views/2d/engine/vectorTiles/TileManager.js +1 -1
- package/views/2d/engine/vectorTiles/TileParser.js +1 -1
- package/views/2d/engine/vectorTiles/VectorTileFeatureIndex.js +1 -1
- package/views/2d/engine/vectorTiles/VectorTileSourceData.js +2 -0
- package/views/2d/engine/vectorTiles/WorkerTile.js +1 -1
- package/views/2d/engine/vectorTiles/WorkerTileHandler.js +1 -1
- package/views/2d/engine/vectorTiles/buckets/SymbolBucket.js +1 -1
- package/views/2d/engine/vectorTiles/expression/expression.js +1 -1
- package/views/2d/engine/vectorTiles/style/Filter.js +1 -1
- package/views/2d/engine/vectorTiles/style/GeoJSONVectorTileSourceWorker.js +1 -1
- package/views/2d/engine/vectorTiles/style/StyleProperty.js +1 -1
- package/views/2d/engine/webgl/mesh/MeshData.js +1 -1
- package/views/2d/engine/webgl/mesh/factories/MeshWriterGroupCoordinator.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/graph/ShaderGraphContext.js +4 -4
- package/views/2d/interactive/editingTools/draw/DrawGraphicTool2D.js +1 -1
- package/views/2d/layers/VectorTileLayerView2D.js +1 -1
- package/views/2d/layers/features/Processor.js +1 -1
- package/views/2d/layers/features/support/TileStore.js +1 -1
- package/views/2d/layers/graphics/GraphicsView2D.js +1 -1
- package/views/2d/tiling/TileKey.js +1 -1
- package/views/2d/tiling/TileStrategy.js +1 -1
- package/views/3d/analysis/Dimension/LengthDimensionComputation.js +1 -1
- package/views/3d/analysis/LineOfSight/LineOfSightManipulators.js +1 -1
- package/views/3d/analysis/ShadowCastAnalysisView3D.js +1 -1
- package/views/3d/analysis/images/generateTextures.js +1 -1
- package/views/3d/environment/EnvironmentView.js +1 -1
- package/views/3d/interactive/editingTools/draw/DrawGraphicTool3D.js +1 -1
- package/views/3d/interactive/editingTools/manipulations/MoveZManipulation.js +1 -1
- package/views/3d/interactive/visualElements/PointVisualElement.js +1 -1
- package/views/3d/layers/I3SMeshView3D.js +1 -1
- package/views/3d/layers/IntegratedMeshLayerView3D.js +1 -1
- package/views/3d/layers/VectorTileLayerView3D.js +1 -1
- package/views/3d/layers/graphics/Graphics3DCore.js +1 -1
- package/views/3d/layers/graphics/Graphics3DExtrudeSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DFeatureProcessor.js +1 -1
- package/views/3d/layers/graphics/Graphics3DMeshFillSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DObjectSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DPolygonFillSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DSymbol.js +1 -1
- package/views/3d/layers/graphics/Graphics3DSymbolCreationContext.js +1 -1
- package/views/3d/layers/graphics/Graphics3DWaterSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/MeshFastUpdateProcessor.js +1 -1
- package/views/3d/layers/graphics/defaultSymbolComplexity.js +1 -1
- package/views/3d/layers/graphics/objectResourceUtils.js +1 -1
- package/views/3d/layers/graphics/polygonUtils.js +1 -1
- package/views/3d/layers/graphics/wosrLoader.js +1 -1
- package/views/3d/layers/i3s/I3SAsyncElevationUpdater.js +1 -1
- package/views/3d/layers/i3s/I3SClientNodeLoader.js +1 -1
- package/views/3d/layers/i3s/I3SQueryEngine.js +1 -1
- package/views/3d/layers/i3s/LayerElevationProvider.js +1 -1
- package/views/3d/layers/support/StageLayerElevationProvider.js +1 -1
- package/views/3d/state/ConstraintsManager.js +1 -1
- package/views/3d/state/controllers/GroundNavigationController.js +1 -1
- package/views/3d/support/QualityProfile.js +1 -1
- package/views/3d/support/TextureCollection.js +1 -1
- package/views/3d/terrain/PatchGeometryFactory.js +1 -1
- package/views/3d/terrain/TerrainRenderer.js +1 -1
- package/views/3d/terrain/Tile.js +1 -1
- package/views/3d/webgl-engine/collections/Component/ComponentObject.js +1 -1
- package/views/3d/webgl-engine/collections/Component/ComponentObjectCollection.js +1 -1
- package/views/3d/webgl-engine/core/shaderTechnique/ShaderTechnique.js +1 -1
- package/views/3d/webgl-engine/effects/laserlines/LaserLineRenderer.js +1 -1
- package/views/3d/webgl-engine/effects/laserlines/LaserlinePathTechniqueConfiguration.js +1 -1
- package/views/3d/webgl-engine/lib/BindParameters.js +1 -1
- package/views/3d/webgl-engine/lib/CutFill.js +1 -1
- package/views/3d/webgl-engine/lib/OrderIndependentTransparency.js +1 -1
- package/views/3d/webgl-engine/lib/TextureRepository.js +1 -1
- package/views/3d/webgl-engine/lib/TriangleIntersectionData.js +1 -1
- package/views/3d/webgl-engine/materials/ColorMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/DefaultMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/PathMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/TriangleMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/intersectWithPolygonOffset.js +1 -1
- package/views/3d/webgl-engine/shaders/DefaultMaterialTechnique.js +1 -1
- package/views/SceneView.js +1 -1
- package/views/SelectionManager.js +1 -1
- package/views/analysis/ElevationProfile/ElevationProfileChart.js +2 -2
- package/views/analysis/ElevationProfile/elevationProfileChartBoundsUtils.js +1 -1
- package/views/draw/DrawAction.js +1 -1
- package/views/draw/support/PluginContext.js +1 -1
- package/views/interactive/sketch/normalizedPoint.js +1 -1
- package/views/interactive/tooltip/fields/TooltipFieldElevation.js +1 -1
- package/views/interactive/tooltip/fields/TooltipFieldOrientation.js +1 -1
- package/views/interactive/tooltip/fields/TooltipFieldSize.js +1 -1
- package/widgets/AreaMeasurement2D/AreaMeasurement2DViewModel.js +1 -1
- package/widgets/Attachments.js +1 -1
- package/widgets/Attribution/AttributionViewModel.js +1 -1
- package/widgets/BasemapGallery/BasemapGalleryViewModel.js +1 -1
- package/widgets/BasemapLayerList/BasemapLayerListViewModel.js +1 -1
- package/widgets/BasemapToggle/BasemapToggleViewModel.js +1 -1
- package/widgets/BatchAttributeForm/ReactiveContingentValuesManager.js +1 -1
- package/widgets/BatchAttributeForm/inputs/AttachmentElementInput.js +1 -1
- package/widgets/BatchAttributeForm.js +1 -1
- package/widgets/Bookmarks/BookmarksViewModel.js +1 -1
- package/widgets/BuildingExplorer/BuildingExplorerViewModel.js +1 -1
- package/widgets/BuildingExplorer/BuildingNumericFilterViewModel.js +1 -1
- package/widgets/CatalogLayerList/CatalogLayerListViewModel.js +1 -1
- package/widgets/CatalogLayerList.js +1 -1
- package/widgets/Compass/CompassViewModel.js +1 -1
- package/widgets/CoordinateConversion/support/Format.js +1 -1
- package/widgets/CoordinateConversion/support/formatUtils.js +1 -1
- package/widgets/Daylight/DaylightViewModel.js +1 -1
- package/widgets/DistanceMeasurement2D/DistanceMeasurement2DViewModel.js +1 -1
- package/widgets/Editor/support/SketchController.js +1 -1
- package/widgets/ElevationProfile/ElevationProfileLine.js +1 -1
- package/widgets/ElevationProfile/ElevationProfileViewModel.js +1 -1
- package/widgets/Expand/ExpandViewModel.js +1 -1
- package/widgets/Expand.js +1 -1
- package/widgets/Feature/FeatureMedia.js +1 -1
- package/widgets/Feature/FeatureViewModel.js +1 -1
- package/widgets/Feature.js +1 -1
- package/widgets/FeatureForm.js +1 -1
- package/widgets/FeatureTemplates.js +1 -1
- package/widgets/Features/FeaturesViewModel.js +1 -1
- package/widgets/Features.js +1 -1
- package/widgets/FloorFilter/FloorFilterViewModel.js +1 -1
- package/widgets/Fullscreen/FullscreenViewModel.js +1 -1
- package/widgets/Histogram/HistogramViewModel.js +1 -1
- package/widgets/Histogram.js +1 -1
- package/widgets/HistogramRangeSlider/HistogramRangeSliderViewModel.js +1 -1
- package/widgets/Home/HomeViewModel.js +1 -1
- package/widgets/LayerList/LayerListViewModel.js +1 -1
- package/widgets/Legend/LegendViewModel.js +1 -1
- package/widgets/Legend/styles/card/CardView.js +1 -1
- package/widgets/Legend/styles/classic/ClassicView.js +1 -1
- package/widgets/Locate/LocateViewModel.js +1 -1
- package/widgets/Locate.js +1 -1
- package/widgets/NavigationToggle/NavigationToggleViewModel.js +1 -1
- package/widgets/NavigationToggle.js +1 -1
- package/widgets/OrientedImageryViewer/OrientedImageryViewerViewModel.js +1 -1
- package/widgets/OrientedImageryViewer/galleryUtils.js +1 -1
- package/widgets/OrientedImageryViewer/services/SuperimposeService.js +1 -1
- package/widgets/OrientedImageryViewer/support/urlUtils.js +1 -1
- package/widgets/ScaleRangeSlider/ScaleRangeSliderViewModel.js +1 -1
- package/widgets/Search.js +1 -1
- package/widgets/ShadowCast/DiscreteOptions.js +1 -1
- package/widgets/ShadowCast/DurationOptions.js +1 -1
- package/widgets/ShadowCast/ShadowCastViewModel.js +1 -1
- package/widgets/ShadowCast/ThresholdOptions.js +1 -1
- package/widgets/Sketch.js +1 -1
- package/widgets/Slider/SliderViewModel.js +1 -1
- package/widgets/Slider.js +1 -1
- package/widgets/TableList/TableListViewModel.js +1 -1
- package/widgets/TimeSlider/TimeSliderViewModel.js +1 -1
- package/widgets/Weather/WeatherViewModel.js +1 -1
- package/widgets/Widget.js +1 -1
- package/widgets/Zoom/ZoomViewModel.js +1 -1
- package/widgets/support/AnalysisViewModelMixin.js +1 -1
- package/widgets/support/GridControls.js +1 -1
- package/widgets/support/dateUtils.js +1 -1
- package/assets/esri/core/workers/chunks/00d43f02119167531d1b.js +0 -1
- package/assets/esri/core/workers/chunks/0696fa44a04b99738d7b.js +0 -1
- package/assets/esri/core/workers/chunks/091ec4fe83038f3558f4.js +0 -1
- package/assets/esri/core/workers/chunks/098ac10877d92fde1006.js +0 -1
- package/assets/esri/core/workers/chunks/0a29d87b6e58a3c6df8f.js +0 -1
- package/assets/esri/core/workers/chunks/0d04353843ccb7440342.js +0 -1
- package/assets/esri/core/workers/chunks/0d87cb6417672de95d53.js +0 -1
- package/assets/esri/core/workers/chunks/1132e28aaa5825b10b6e.js +0 -1
- package/assets/esri/core/workers/chunks/1380cec385426673f294.js +0 -1
- package/assets/esri/core/workers/chunks/1b24a40c0fa197014873.js +0 -1
- package/assets/esri/core/workers/chunks/1c7096eb48a3a7f27d4f.js +0 -1
- package/assets/esri/core/workers/chunks/1cc03067f8405285057c.js +0 -1
- package/assets/esri/core/workers/chunks/1f76f6dcdae9f55389cb.js +0 -1
- package/assets/esri/core/workers/chunks/21e1d423ee33f916547e.js +0 -1
- package/assets/esri/core/workers/chunks/247617c0dbae2386ab3b.js +0 -1
- package/assets/esri/core/workers/chunks/25657f70c5f04a4ed978.js +0 -1
- package/assets/esri/core/workers/chunks/2690d5fcd9d5ca92ebf6.js +0 -1
- package/assets/esri/core/workers/chunks/2853606099602f73d379.js +0 -1
- package/assets/esri/core/workers/chunks/28ed020d9995b6577be5.js +0 -1
- package/assets/esri/core/workers/chunks/2b27d3bc492e000bbe58.js +0 -1
- package/assets/esri/core/workers/chunks/2d64a13c2303e9cae613.js +0 -1
- package/assets/esri/core/workers/chunks/36e5f070009b29b7ac3d.js +0 -1
- package/assets/esri/core/workers/chunks/3b5e9e0b180dc10491ec.js +0 -1
- package/assets/esri/core/workers/chunks/46edd6c9ed6701e6b975.js +0 -1
- package/assets/esri/core/workers/chunks/4e17665dd9048c300d87.js +0 -1
- package/assets/esri/core/workers/chunks/4e4f747de424941a0bfa.js +0 -1
- package/assets/esri/core/workers/chunks/4e8e322b469657ac22e2.js +0 -1
- package/assets/esri/core/workers/chunks/5396b6e99a0546a25d19.js +0 -1
- package/assets/esri/core/workers/chunks/553a8bf5bc5c56d1bcaf.js +0 -1
- package/assets/esri/core/workers/chunks/55c0c074e4afe05f5d4d.js +0 -1
- package/assets/esri/core/workers/chunks/5bfb962ca192f90a2724.js +0 -1
- package/assets/esri/core/workers/chunks/60c8eedd06080edab3e3.js +0 -1
- package/assets/esri/core/workers/chunks/61d36730564c5ac5edab.js +0 -1
- package/assets/esri/core/workers/chunks/6588725275c75fae0d9c.js +0 -1
- package/assets/esri/core/workers/chunks/661c6324529dd17b297e.js +0 -1
- package/assets/esri/core/workers/chunks/6699fac01ccd842851ba.js +0 -1
- package/assets/esri/core/workers/chunks/672a5390182b20d632be.js +0 -1
- package/assets/esri/core/workers/chunks/67caef2ecf0dc5f2eed3.js +0 -1
- package/assets/esri/core/workers/chunks/68dd1fd2025c7125ead1.js +0 -1
- package/assets/esri/core/workers/chunks/68fd7b314377d27aaa54.js +0 -1
- package/assets/esri/core/workers/chunks/69627b2634da64dd885f.js +0 -1
- package/assets/esri/core/workers/chunks/6f2e7e663229b223b4df.js +0 -1
- package/assets/esri/core/workers/chunks/7390af96250e89194332.js +0 -1
- package/assets/esri/core/workers/chunks/7b45ac83e279fe9516a5.js +0 -1
- package/assets/esri/core/workers/chunks/7e0ed6e8f7b77e43f628.js +0 -1
- package/assets/esri/core/workers/chunks/832c887fdc5af4c08cf2.js +0 -1
- package/assets/esri/core/workers/chunks/84fb27e3425515cd0e3f.js +0 -1
- package/assets/esri/core/workers/chunks/8502274806ea52308822.js +0 -1
- package/assets/esri/core/workers/chunks/867502158997cb2d6406.js +0 -1
- package/assets/esri/core/workers/chunks/8ceb6697e8adbeffe019.js +0 -1
- package/assets/esri/core/workers/chunks/8e391b5b82429f39791e.js +0 -1
- package/assets/esri/core/workers/chunks/8e6276ddd8d094c61f08.js +0 -1
- package/assets/esri/core/workers/chunks/8fe22c2370219f25c15b.js +0 -1
- package/assets/esri/core/workers/chunks/90d797ab82d4a68ba32f.js +0 -1
- package/assets/esri/core/workers/chunks/91586bf29492735e692d.js +0 -1
- package/assets/esri/core/workers/chunks/96f87c8efd4b11b37686.js +0 -1
- package/assets/esri/core/workers/chunks/9826baa3c15ea2062669.js +0 -1
- package/assets/esri/core/workers/chunks/9c3de54513bf8619271c.js +0 -1
- package/assets/esri/core/workers/chunks/a125650edbed802e419a.js +0 -1
- package/assets/esri/core/workers/chunks/a18c3cbe505a19d29569.js +0 -1
- package/assets/esri/core/workers/chunks/a422a801e55fa125546e.js +0 -1
- package/assets/esri/core/workers/chunks/a5f17e9a025ac2b6e1bf.js +0 -1
- package/assets/esri/core/workers/chunks/a6e846361bf5dd3a11c7.js +0 -1
- package/assets/esri/core/workers/chunks/a91dc05a6a609d04ed04.js +0 -1
- package/assets/esri/core/workers/chunks/a99c50b4e1c7568210e1.js +0 -1
- package/assets/esri/core/workers/chunks/ab48faea5432e2dbd45c.js +0 -1
- package/assets/esri/core/workers/chunks/ac107079342251a984dd.js +0 -1
- package/assets/esri/core/workers/chunks/acf4737ba509cbd73cce.js +0 -1
- package/assets/esri/core/workers/chunks/b7205620ca248f4efc88.js +0 -1
- package/assets/esri/core/workers/chunks/bbddeb1c893ff8bbae5d.js +0 -1
- package/assets/esri/core/workers/chunks/bc2e2bdf1194e6e9eb5e.js +0 -1
- package/assets/esri/core/workers/chunks/c0eb27263f608dc3684b.js +0 -1
- package/assets/esri/core/workers/chunks/c3ba1a3247e14f6b7b3a.js +0 -1
- package/assets/esri/core/workers/chunks/c5d0a034ff31d5954571.js +0 -1
- package/assets/esri/core/workers/chunks/c8057b47c7c6c02a0bda.js +0 -1
- package/assets/esri/core/workers/chunks/ca21786e519c914fc9e1.js +0 -1
- package/assets/esri/core/workers/chunks/cd46d9b4a8de644e7332.js +0 -1
- package/assets/esri/core/workers/chunks/d4c8673ca65df874a7ce.js +0 -1
- package/assets/esri/core/workers/chunks/da1e6962ba0c85c37953.js +0 -1
- package/assets/esri/core/workers/chunks/dcdf837a452dc0cac582.js +0 -1
- package/assets/esri/core/workers/chunks/e0864ca82ffa3c9a0776.js +0 -1
- package/assets/esri/core/workers/chunks/e69cd62f824ce7a22fa0.js +0 -1
- package/assets/esri/core/workers/chunks/e9457a67befc61e11095.js +0 -1
- package/assets/esri/core/workers/chunks/f190a3124d6d03417d73.js +0 -1
- package/assets/esri/core/workers/chunks/f4135779bfdaf349352a.js +0 -1
- package/assets/esri/core/workers/chunks/f6bd7b52745b82ba73dc.js +0 -1
- package/assets/esri/core/workers/chunks/fbe3a3b9d6c8c0b52f65.js +0 -1
- package/assets/esri/core/workers/chunks/fc77eb7683e708774168.js +0 -1
- package/assets/esri/core/workers/chunks/fe7184993ef5713d13fb.js +0 -1
- package/assets/esri/core/workers/chunks/fecaf0bc28aeea4d15db.js +0 -1
- package/views/2d/engine/vectorTiles/style/VectorTilePbfWriter.js +0 -2
- package/views/2d/engine/vectorTiles/style/encodeVectorTileFeatures.js +0 -2
- package/views/2d/layers/features/support/FeatureSetReaderVectorTileFeatureCursor.js +0 -2
- /package/views/2d/engine/vectorTiles/{Feature.js → PbfFeature.js} +0 -0
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import t from"../../Graphic.js";import{equals as n,isSome as r}from"../../core/arrayUtils.js";import{createTask as i}from"../../core/asyncUtils.js";import a from"../../core/Collection.js";import{deprecatedProperty as o}from"../../core/deprecate.js";import s from"../../core/Error.js";import{EventedMixin as c}from"../../core/Evented.js";import{makeHandle as l}from"../../core/handleUtils.js";import{equalsShallow as u}from"../../core/lang.js";import d from"../../core/Logger.js";import{clamp as f,deg2rad as p}from"../../core/mathUtils.js";import{destroyMaybe as m,abortMaybe as h}from"../../core/maybe.js";import{EsriPromise as g}from"../../core/Promise.js";import{isAbortError as _,throwIfAborted as v,waitTick as y}from"../../core/promiseUtils.js";import b from"../../core/ReactiveMap.js";import{whenOnce as x,on as S,watch as C,syncAndInitial as w,initial as ee,when as te}from"../../core/reactiveUtils.js";import{sqlAnd as T}from"../../core/sql.js";import{getMetersPerUnitForSR as E}from"../../core/units.js";import{property as D,subclass as ne}from"../../core/accessorSupport/decorators.js";import{isSerializable as re}from"../../core/support/jsonUtils.js";import{UpdatingHandles as ie}from"../../core/support/UpdatingHandles.js";import ae from"../../geometry/Extent.js";import O from"../../geometry/Point.js";import{projectAsync as k}from"../../geometry/projectionUtils.js";import oe from"../../geometry/SpatialReference.js";import{polygonCentroidPoint as se}from"../../geometry/support/centroid.js";import{isClockwise as ce}from"../../geometry/support/coordsUtils.js";import{normalizeMapX as le}from"../../geometry/support/normalizeUtils.js";import{geographicToWebMercator as ue}from"../../geometry/support/webMercatorUtils.js";import A from"../../layers/GraphicsLayer.js";import de from"../../layers/MediaLayer.js";import{searchImages as j}from"../../layers/orientedImagery/queries.js";import{calculateSuitabilities as fe}from"../../layers/orientedImagery/core/bestImageUtils.js";import{computePolygonForInspection as pe,resizePolygon as me,checkIfFrustumContainsSelectedPoint as he,checkIfPolygonContainsSelectedPoint as ge}from"../../layers/orientedImagery/core/coverageUtils.js";import{isElevationSource as _e}from"../../layers/orientedImagery/core/ElevationSourceDefinitions.js";import{convertGeographicToWebMercator as M}from"../../layers/orientedImagery/core/utils.js";import ve from"../../layers/orientedImagery/transformations/updateElevation.js";import{getElevationSampler as ye}from"../../layers/orientedImagery/transformations/updateElevationUtils.js";import{or as be,getInitialAngle as N,convertPixelLocationToSphereVertex as xe,getUpdateElevationProps as P,adjustHorizonAngles as Se,convertOrientationToPixelLocation as Ce,getImageToWorldProperties as F}from"../../layers/orientedImagery/transformations/utils.js";import we from"../../layers/support/ExtentAndRotationGeoreference.js";import{getFloorFilterClause as Te}from"../../layers/support/floorFilterUtils.js";import Ee from"../../layers/support/VideoElement.js";import De from"../../views/MapView.js";import{distanceComparisonTolerance as Oe}from"../../views/3d/state/utils/navigationUtils.js";import ke from"../../views/draw/Draw.js";import{scale as Ae}from"../../views/draw/support/drawUtils.js";import{ViewEventPriorities as je}from"../../views/input/InputManager.js";import Me from"../PanoramicVideoViewer.js";import I from"../PanoramicViewer.js";import{defaultAngleThresholdInDegrees as L,videoMapViewConstraint as Ne,fixedImageSize as R,clockwiseDirections as Pe,videoFitScaleTolerance as Fe,videoExtent as z,invalidCameraHeading as B,sectorsInOrder as V,sampleExtent as Ie,sectorsRadii as H}from"./constants.js";import{createFeatureCoverage as U}from"./featureCoverage.js";import{isFeatureAttachment as W}from"./galleryUtils.js";import{getPanoramicImageProperties as G}from"./panoramicImageProperties.js";import{crossSymbol as K,crossSymbol3D as Le,measurementPolygonSymbol as Re,polylineSymbolPanoramic as ze,measurementPolylineSymbol as Be,cameraOverlaySymbol3D as Ve,cameraOverlaySymbol as He,diamondSymbol as q,diamondSymbol3D as J,activeSourcePointSymbol as Ue,sourcePointSymbol as We}from"./symbols.js";import{registryKeys as Y}from"./types.js";import{isNoAttachmentError as Ge,extractHorizonAnglesFromMedia as X,isDepthImage as Ke,isTifOrMrf as qe,filterOILLayerView as Je,assignElevationSampleToFeatures as Ye,filterByZ as Xe,createPanoramicMedia as Ze,createNonPanoramicMedia as Qe,isSceneView as $e,isGraphic as et,calculateSegment as tt,calculateDirection as nt}from"./utils.js";import{disableVideoZoomAndPan as rt,getUpdatedConstraints as it,getUpdatedExtentPoints as at,normalizeVideoSource as ot,isSelectedPointWithinVideoFootprint as st,isVideoPixelWithinFrame as ct}from"./videoViewerUtils.js";import lt from"./components/ImageViewer.js";import ut from"./components/NavigationNode.js";import dt from"./components/OrientedImageryVideoViewModel.js";import{NoFeatureFoundWithObjectIdError as ft}from"./navigation/errors.js";import{queryFeatureByObjectIds as pt}from"./navigation/queries.js";import{ImageMeasurementService as mt}from"./services/ImageMeasurementService.js";import ht from"./services/SuperimposeService.js";import{configureSketchTool as gt,extractFieldsFromDataCaptureLayer as _t,constructGraphicFromImageGeometry as vt}from"./support/dataCaptureUtils.js";import{removeZFromGeometry as yt,imageSpaceToPoint as Z,pointToImageSpace as bt}from"./support/geometryUtils.js";import{restorePanoramicNavigationViewState as xt,restoreDefaultNavigationViewState as St}from"./support/navigationViewStateUtils.js";import Ct from"./support/resolveMediaProps.js";import{isValidDataCaptureLayer as wt}from"./support/typeUtils.js";import Tt from"./support/VideoFeatureCache.js";const Q=()=>new s(`orientedimageryviewer:sketch-not-initialized`,`Sketch property is not initialized, call loadSketch first`);let $=class extends c(g){constructor(e){super(e),this.additionalFeatures=new a,this.additionalCameraLocations=new a,this.additionalFootprints=new a,this.areaMeasurementResult=0,this.areaMeasurementAccuracy=0,this.bestFeatureAngle=0,this.bestFeatureCurrentFootprint=null,this.bestFeatureFootprint=null,this.cameraHeadingThreshold=L,this.cameraPitchThreshold=L,this.clickAction=`hittest`,this.correctedLocationPointOnImage=null,this.videoViewModel=null,this.collectionId=null,this.coverageFrustums=new a,this.coveragePolygons=new a,this.currentBestFeature=null,this.currentBestFeatureMeasurementImage=null,this.currentBestFeatureLocation=null,this.currentCoverageVisible=!0,this.depthImage=null,this.featureCache=[],this.videoFeatureIndex=[],this.navigationNodes=new a,this.determineWorkflowForFeature=async(e,t,n)=>{let{currentBestFeature:r,selectedPoint:i}=this;if(this.emit(`popup-close`),r&&i){this.displayMessage=null,this._initialCurrentCoverageUpdate=!0;try{await this._updatePointsAndPolygons(n),await this._loadDepthImage(n),await this._loadCurrentFeatureMedia(r,n)}catch(e){_(e)||(this.loadImageError(e),d.getLogger(this).error(`#loadIImage()`,`error occured while loading image`,e))}}},this.determineWorkflowForTriangularMeasurement=async(e,t,n)=>{if(this.emit(`popup-close`),this.currentBestFeatureMeasurementImage&&this.selectedPoint)try{await this._loadMeasurementViewerImage(n)}catch(e){_(e)||(this.loadImageError(e),d.getLogger(this).error(`#loadIImage()`,`error occured while loading image`,e))}},this.disabled=!1,this.displayMessage={key:`onLoadMessage`,type:`info`},this.displayNewMeasurementButton=!0,this.distanceMeasurementResult=0,this.distanceAccuracyArray=[],this.dataCaptureLayer=null,this.features=new a,this.groundCoordinates=null,this.groundCoordinatesAccuracy=null,this.groundCoordinatesAccuracyLoading=!1,this.heightGraphic=null,this.heightMeasurementResult=0,this.heightMeasurementAccuracy=0,this.imageGeometryField=null,this.imageLocationToolState=!1,this.initialVideoMapViewExtent=null,this.imageMeasurementViewer=new lt,this.isAdditionalCoverageVisible=!1,this.isAdditionalPointSourcesVisible=!1,this.layer=null,this.localPort=null,this.locationPointOnImage=null,this.mapImageConversionToolState=!1,this.measureType=null,this.measurementGraphic=null,this.navigatorCurrentBestFeature=null,this.oiObjectIdField=null,this.overlayedCameraLocations=new a,this.overlayedMapFeatures=new b,this.pixelCoordinates=null,this.preserveAngle=`none`,this.pointSources=new a,this.preloadMedia=!1,this.preloadMediaSize=5,this.previousFeatureAngle=0,this.selectedPoint=null,this.shouldShowSelectedImage=!1,this.superimposeViewEnabled=!1,this.defaultSuperimposeCameraLockEnabled=!0,this.sketch=null,this.sketchTriangular=null,this.sketchTriangularGraphicsLayer=null,this.draw=null,this.drawAdapter=null,this.polylineDrawAction=null,this.scheduledFrameId=null,this.superimposeScheduledFrameId=null,this.superimposeDebounceTimeoutId=null,this.sketchAdapter=null,this.triangularMeasurementActive=!1,this.triangulatedDistanceMeasurement=null,this.triangulatedDistanceAccuracy=null,this.triangulatedAreaMeasurement=null,this.triangulatedAreaAccuracy=0,this.triangulatedMeasurementGraphic=null,this.triangulatedPoint=null,this.triangulatedMeasurementAdapter=null,this.updateFootprint=async(e,t,n)=>{(this.mode!=="default"||this.state===`image-loaded`)&&await this._adapter?.updateFootprint(e,t,n)},this.updateVideoFootprint=async e=>{this.mode.includes(`video`)&&this.videoElement?.content&&await this._adapter?.updateVideoFootprint(e)},this.updateFootprintPanorama=async(e,t)=>{await this._adapter?.updateFootprintPanorama(e,t)},this.updatingTriangularMeasurementState=!1,this.videoElement=null,this.videoLayer=null,this.videoMapView=new De({map:new Map,attributionVisible:!1,constraints:Ne}),this.verticalFilterEnabled=!1,this.frustumSearchEnabled=!1,this._adapter=null,this._highlightedFeatureHandle=null,this._imageViewer=new lt,this._initialCurrentCoverageUpdate=!0,this._locationViewModel=null,this._measurementService=null,this._mediaPrefetcher=null,this._navigationManager=null,this._overlays=new A({listMode:`hide`,internal:!0,elevationInfo:{mode:`absolute-height`},title:`OrentedImageryViewerViewModel overlays layer`}),this._superimposePreviousCurrentCoverageVisible=null,this._superimposeService=new ht({getMapPoint:(e,t)=>this.getMapPoint(e,t),getPanoramicTransformationState:()=>{let{imageToWorldProperties:e,mode:t,updateElevationProps:n}=this._transformationService;return t!==`panoramic`||!e?null:{imageToWorldProperties:e,updateElevationProps:n}},pointToPixel:(e,t)=>this._transformationService.pointToPixel(e,t),overlays:this._overlays,getPointAtDistance:(e,t,n)=>this._transformationService.pixelToPointAtDistance(e,t,n)}),this._panoramicVideoViewer=new Me,this._panoramicViewer=new I,this._panoramicMeasurementViewer=new I,this._referencePointOnGround=null,this._referencePointOnImage=null,this._referenceTransformationService=null,this._sectorData=null,this._transformationService=null,this._featureToSector=null,this._updatingHandles=new ie,this._clickTask=null,this._crossSymbol=null,this._cameraOverlayTask=null,this.footprintExtent=null,this._featureChangedTask=null,this._mediaPrefetchTask=null,this._navigationViewStateTask=null,this._pendingPanoramicNavigationViewState=null,this._restoreSuperimposeMediaTask=null,this._superimposeScheduleController=null,this._suitabilities=null,this._pendingDefaultNavigationViewState=null,this._transformController=new AbortController,this._updateFootprintTask=null,this._videoFeatureCache=new Tt,this.addUpdatingPromise=e=>this._updatingHandles.addPromise(e),this.filterCapturedFeatures=e=>{let t=this.currentBestFeature?.attributes.objectId,n=this.layer?.imageReferenceField;t&&e&&n&&this.overlayedMapFeatures.get(e)?.forEach(e=>{let r=e.attributes??{},i=Object.keys(r).find(e=>e.toLowerCase()===n.toLowerCase());(i?r[i]:null)!==t&&(e.visible=!e.visible)})},this.hideImageGeometry=e=>{},this.highlight=e=>{if(!this._overlaysView)return;this.removeHighlight();let t=this.additionalFootprints.find(({attributes:{imageID:t}})=>t===Number(e));this._highlightedFeatureHandle=t?this._overlaysView?.highlight(t):null},this.loadDataCaptureAdapter=async e=>{await this.loadSketch(e);let{default:t}=await import(`./adapters/sketch/DataCaptureAdapter.js`);return v(e),this.sketchAdapter=new t({viewModel:this}),this.sketchAdapter},this.loadImageFromFeature=(e,t,n)=>this._updatingHandles.addPromise(this._loadImageFromFeature(e,t,n)),this.storeImageMeasurementViewer=e=>{this.imageMeasurementViewer=e},this.storePanoramicMeasurementViewer=e=>{this._panoramicMeasurementViewer=e},this.loadImageViewer=e=>{this._imageViewer?.destroy(),this._imageViewer=e},this.loadPanoramicViewer=e=>{this._panoramicViewer?.destroy(),this._panoramicViewer=e},this.loadPanoramicVideoViewer=e=>{this._panoramicVideoViewer?.destroy(),this._panoramicVideoViewer=e},this.loadVideoViewer=e=>{this.videoMapView.container=e},this.showImageByObjectId=async(e,t)=>{let n=this.additionalFeatures.find(({attributes:t})=>t.objectId===e);if(n&&t?.selectedPoint==null)this.currentBestFeature=n;else{let{layer:n,layerFloorFilterClause:r,layerTimeExtent:i}=this;if(!n){this.setMessage(`noLayerSelected`,`info`);return}this.beforeLoad();let a=this._updatingHandles.addPromise(this._queryAndLoadByObjectId(n,e,r,i,t));try{await a,await this.selectBestFeature(e,t)}catch(t){_(t)||(d.getLogger(this).error(`oriented-imagery-viewer:show-image`,t),t.name===`NoFeatureFoundWithObjectIdError`?this.setMessage(`noFeatureFoundWithObjectId`,`error`,``,{objectId:e}):this.setMessage(`imageLoadError`,`error`,t.message))}}},this.getSectorFeatureById=e=>this._suitabilities?.find(({feature:{attributes:{objectId:t}}})=>t===e),this.getFeatureSectorById=e=>this._featureToSector?.[`${e}`],this.navigate=async(e,t)=>{let{mode:n}=this;if(n!=="default"&&n!==`panoramic`)throw new s(`NavigationError`,`Navigation is only supported in 'default' and 'panoramic' modes.`);if(this._pendingDefaultNavigationViewState=null,this._pendingPanoramicNavigationViewState=null,this._navigationManager==null||!(e=>n==="default"&&e.declaredClass.endsWith(`NavigationManager`)||n===`panoramic`&&e.declaredClass.endsWith(`NavigationManagerPanoramic`))(this._navigationManager)){m(this._navigationManager);let e=n==="default"?import(`./navigation/NavigationManager.js`):import(`./navigation/NavigationManagerPanoramic.js`);this._navigationManager=new(await e).default({viewModel:this})}return this._navigationManager.navigate(e,t)},this.removeHighlight=()=>this._highlightedFeatureHandle?.remove(),this.revealImageGeometry=e=>{},this.selectBestFeature=async(e,t)=>(v(t),this.currentBestFeature=this.features?.find(({attributes:t})=>`${t.objectId}`==`${e}`),x(()=>{switch(this.mode){case`video`:return this.state===`video-loaded`;case`panoramic-video`:return this.panoramicVideoLoaded;default:return this.state===`image-loaded`}},t)),this.toggleImageAttributes=()=>{let{currentBestFeature:e,popupEnabled:n,layer:r,view:i}=this;if(this.emit(`popup-close`),!i||!e||!n||!r)return;let{attributes:a,geometry:o}=e,s=new t({geometry:o,attributes:a.toJSON(),origin:r.graphicOrigin,sourceLayer:r});this.emit(`popup-open`,{features:[s],location:a.location.clone()})},this.updateSuitabilities=(e,t=!0)=>{e.sort((e,t)=>e.suitability-t.suitability),this._suitabilities=e;let n=this._suitabilities.map(({feature:e})=>e);this._initialCurrentCoverageUpdate=!0,this._updateFeatures(n,t),this._groupFeaturesBySectors()},this._computeOverlayImageSize=()=>{let{mode:e}=this;return e===`video`?R:e===`panoramic-video`?this._panoramicVideoViewer.imageSize:this.activeViewer?.imageSize},this._geometryToOverlayImageGeometry=async(e,t,n,r)=>{let{mode:i,videoViewModel:a,_panoramicVideoViewer:o}=this;if(i===`video`)return await a?.geometryToOverlayGeometry(e,t,r)??null;if(i===`panoramic-video`){let a={feature:t,mode:i,imageSize:n,footprintExtent:this.footprintExtent};return await this._transformationService.geometryToImageGeometryForFeature(e,a,o.horizonAngles,r)}return await this._transformationService.geometryToImageGeometry(e,r)},this._createViewClickHandle=()=>{if(this.removeHandles(Y.click),this.disabled||this.view==null)return;let e=this.mapImageConversionToolState&&(this.state===`image-loaded`||this.state===`video-loaded`&&this.mode===`video`&&this.videoViewModel?.videoPaused||this.panoramicVideoLoaded&&this.mode===`panoramic-video`&&this.panoramicVideoPaused)?this._mapImageConversionToolViewClickHandler:this._viewClickHandler;this.addHandles(this.view.on(`click`,e,je.DEFAULT),Y.click)},this._createImageClickHandle=()=>{this.removeHandles(Y.imageClick),this.videoViewModel?.syncMapImageConversionHandle();let{mapImageConversionToolState:e,mode:t,footprintExtent:n,panoramicVideoLoaded:r}=this,a=t===`panoramic-video`?this._panoramicVideoViewer:this.activeViewer,o=a?.imageSize;if(!e||t===`none`||t===`video`||!o||!n)return;let s=t===`panoramic-video`,c=this._getActiveFeatureForCurrentMode(),u=!s||r&&this.panoramicVideoPaused;if(!c||!u)return;let d=a.clickAction;this.clickAction=`pixel-location`;let f=l(()=>{this.clickAction=d}),p=null,m=S(()=>a,`pixel-location`,e=>{this.plotReferencePointOnImage(e),p?.abort(),p=i(async r=>{if(!e)return;let i=this._getActiveFeatureForCurrentMode();if(!i)return;let a={feature:i,mode:t,imageSize:o,footprintExtent:n},c=s?await this.getMapPointForFeature(e,a,{signal:r}):await this._transformationService.pixelToMapPoint(e),l=this.view?.spatialReference;c&&!be(!l,c.spatialReference.equals(l))&&(c=await k(c,l,{signal:r})),v(r),this.plotReferencePointOnGround(c)})});this.addHandles([m,f],Y.imageClick)},this._createTriangularImageClickHandle=()=>{this.removeHandles(Y.triangularImageClick),this.triangularMeasurementActive&&this.mode!==`none`&&this.currentBestFeature&&this.currentBestFeatureMeasurementImage&&this.activeTriangulatedViewer&&this.addHandles(this.activeTriangulatedViewer.imageRenderer.on(`double-click`,this._measurementImageClickHandler),Y.triangularImageClick)},this._enablePan=()=>{this.removeHandles(Y.videoPanHandles)},this._disablePan=()=>{this.removeHandles(Y.videoPanHandles),this.addHandles(rt(this.videoMapView),Y.videoPanHandles)},this._handleImageHitTestResponse=async e=>{let{layer:t,overlayedCameraLocations:n}=this;if(!t)return;let r=e.results.find(({graphic:e,graphic:{attributes:r}})=>n.includes(e)&&r&&!r[t.imageReferenceField]&&!r[t.imageGeometryField]);if(!r)return;let i=r.graphic.attributes[t.objectIdField];await this.showImageByObjectId(i)},this._loadCurrentFeatureMedia=async(e,t)=>{this.mode===`video`?await this._loadFlatVideo(e,t):this.mode===`panoramic-video`?await this._loadVideo(t):await this._loadImage(t)},this._loadFlatVideo=async(e,t)=>{this._initializeVideo(),this.videoViewModel?.playVideoFromSelectedLocation(e);let n=e.attributes.objectId;this._waitForFlatVideoAndPlotSelectedLocation(e,n,t)},this._waitForFlatVideoAndPlotSelectedLocation=async(e,t,n)=>{try{if(await x(()=>this.videoElement?.loaded===!0,n),`${this.currentBestFeature?.attributes.objectId}`!=`${t}`)return;await this.transformAndPlotSelectedLocation(n)}catch(t){_(t)||d.getLogger(this).error(`failed to plot selected point on video`,{error:t,selectedPoint:this.selectedPoint,feature:e})}},this._loadDepthImage=async e=>{let{currentBestFeature:t,layer:n,depthImageNotSupported:r}=this;if(this.depthImage?.destroy(),this.depthImage=null,!n||!t||r)return;let{depthImage:i}=t.attributes;if(!i)return;let a=(await import(`./services/DepthImageService.js`)).default;v(e),this.depthImage=new a({url:i});try{await this.depthImage.load(e)}catch(e){_(e)||(d.getLogger(this).error(`error occurred while loading depth image`,e),this.depthImage?.destroy(),this.depthImage=null)}},this._loadImage=async e=>{let{currentBestFeature:t,layer:n,mode:r}=this,i=this._pendingDefaultNavigationViewState;if(this._pendingDefaultNavigationViewState=null,this.clearGraphics(),n&&t&&r!==`none`&&r!==`video`&&r!==`panoramic-video`)try{if(await this.loadImageFromFeature(n,t,e),v(e),i)try{await this._restoreNavigationViewState(i,e)}catch(e){if(_(e))throw e;d.getLogger(this).warn(`oriented-imagery-viewer:failed-to-restore-navigation-view-state`,e)}await this.transformAndPlotSelectedLocation(e)}catch(e){_(e)||this.loadImageError(e)}},this._loadVideo=async e=>{let{currentBestFeature:t,mode:n,selectedPoint:r}=this,i=t?.attributes.imagePath;if(!t||n!==`panoramic-video`||!i)return;let{attributes:a}=t,{cameraPitch:o,cameraOrientation:s,location:c}=a,l=c.spatialReference.isWGS84&&s?.type!==4?ue(c):new O(c);try{this._panoramicVideoViewer.viewModel.video&&(this._panoramicVideoViewer.viewModel.video.pause(),this._panoramicVideoViewer.viewModel.videoPaused=!0),this._panoramicVideoViewer.videoSource=i;let t=0;l&&r&&(t=await N(l,r)-t),this._panoramicVideoViewer.pitch=o??0,this._panoramicVideoViewer.yaw=t,await this._panoramicVideoViewer.loadVideo(e),v(e)}catch(e){_(e)||this.loadImageError(e)}},this._loadImageFromFeature=async(e,t,n)=>{let{mode:r}=this;if(r!=="default"&&r!==`panoramic`)return;let i;try{i=await Ct(t.attributes,e,n),v(n)}catch(n){if(_(n))return;if(Ge(n)){d.getLogger(this).error(n),this.setMessage(`noAttachment`,`error`,`${e.objectIdField}: ${t.attributes.objectId}`);return}d.getLogger(this).error(n,{[e.objectIdField]:t.attributes.objectId,layer:e}),this.setMessage(`imageLoadError`,`error`,`query-attachments-failed:${e.objectIdField} ${t.attributes.objectId}`);return}if(!i)return;let{mediaUrl:a,datasetFormat:o,rotation:s,searchParams:c,location:l,cameraHeading:u,matrix:f,cameraPitch:p,getDataSetFormatError:m}=i,h=`${t.attributes.objectId}`;try{let i=this._mediaPrefetcher?.getCachedMedia(h);if(!i){let n=this.navigationNodes.find(e=>e.id===t.attributes.objectId);if(n){try{await this._mediaPrefetcher?.startPrefetchForNode(n,e)}catch{}i=this._mediaPrefetcher?.getCachedMedia(h)}}if(i){if(r===`panoramic`){let e=this.triangularMeasurementActive?this._panoramicMeasurementViewer:this._panoramicViewer,r=0;l&&this.selectedPoint&&(r=await N(l,this.selectedPoint)-r),await e.loadMedia(i,n),this.selectedPoint?e.set({yaw:r,pitch:p}):`viewAngle`in t.attributes&&Number.isFinite(t.attributes.viewAngle)&&e.set({yaw:t.attributes.viewAngle,pitch:p}),this.triangularMeasurementActive?await this.initializeReferenceTransformationService(n):await this.initializeTransformationService(n);return}await this._setImageSource(this.triangularMeasurementActive?this.imageMeasurementViewer:this._imageViewer,i,n),this.triangularMeasurementActive?await this.initializeReferenceTransformationService(n):await this.initializeTransformationService(n);return}}catch{}m&&d.getLogger(this).warn(`error occurred while getting dataset format`,m),r===`panoramic`?await this.loadPanoramicMediaSource({lookAt:{yaw:this.selectedPoint?await N(l,this.selectedPoint):`viewAngle`in t.attributes&&Number.isFinite(t.attributes.viewAngle)?t.attributes.viewAngle:0,pitch:p},extension:o?.toUpperCase(),url:a,cameraHeading:u,matrix:f},n):await this.loadMediaSource({datasetFormat:o?.toUpperCase(),url:a,customParameters:c,rotation:s},n),this.triangularMeasurementActive?await this.initializeReferenceTransformationService(n):await this.initializeTransformationService(n)},this._loadMeasurementViewerImage=async e=>{let{currentBestFeatureMeasurementImage:t,layer:n,mode:r}=this;if(this.imageMeasurementViewer.clearGraphics(),this._panoramicMeasurementViewer.clearGraphics(),n&&t&&r!==`none`&&r!==`video`&&r!==`panoramic-video`)try{await this.loadImageFromFeature(n,t,e),v(e)}catch(e){_(e)||this.loadImageError(e)}},this._loadMediaPrefetcher=async e=>{if(!this._mediaPrefetcher){let{default:t}=await import(`./support/MediaPrefetcher.js`);v(e),this._mediaPrefetcher=new t({maxEntries:this.preloadMediaSize*Pe.length})}return this._mediaPrefetcher},this._loadViewAdapter=async e=>{let{view:t}=this;if(this._adapter?.disableDefaultSuperimposeNavigation?.(),this._adapter?.disablePanoramicSuperimposeNavigation?.(),!t)this._adapter=null;else switch(t.type){case`2d`:{let{default:t}=await import(`./adapters/view/MapViewAdapter.js`);v(e),this._adapter=new t(this);break}case`3d`:{let{default:t}=await import(`./adapters/view/SceneViewAdapter.js`);v(e),this._adapter=new t(this);break}}},this._mapImageConversionToolViewClickHandler=e=>{if(e.stopPropagation(),e.preventDefault(),e.mapPoint){let t=e.mapPoint;t.x=le(t.x,t.spatialReference),this.plotMapPoint(e.mapPoint)}},this._measurementImageClickHandler=e=>{e.stopPropagation(),e.preventDefault();let{sketchTriangular:t,triangularMeasurementActive:n,currentBestFeatureMeasurementImage:r,triangulatedMeasurementGraphic:i}=this;t&&n&&r&&i&&t.state!==`active`&&(t.update([i],{tool:`reshape`}),this.updatingTriangularMeasurementState=!0)},this._updateInteraction=()=>{let e=this.videoMapView.extent;if(!e)return;let{minScale:t}=this.videoMapView.constraints,n=this.videoMapView.scale<t-Fe,r=it(e);n&&r?(this._enablePan(),this.videoMapView.constraints.geometry=r):n?(this._disablePan(),this.videoMapView.constraints.geometry=null):(this.initialVideoMapViewExtent&&!this.videoMapView.extent.equals(this.initialVideoMapViewExtent)&&(this.videoMapView.extent=this.initialVideoMapViewExtent),this._disablePan(),this.videoMapView.constraints.geometry=null)},this._viewClickHandler=e=>{this._clickTask?.abort(),this._clickTask=i(async t=>{let{pointerType:n,button:r,mapPoint:i}=e;if(n===`mouse`&&r!==0||!i)return;e.stopPropagation(),e.preventDefault();let{view:a,layer:o}=this;if(a){if(!o)this.setMessage(`noLayerSelected`,`info`);else{if(this.shouldShowSelectedImage){let n=a.hitTest(e,{include:[o]});this._updatingHandles.addPromise(n);let r=await n;return v(t),await this._processHitTestResults(o,r,{signal:t})}return this._updatingHandles.addPromise(this.loadBestImage(i,{signal:t}))}}})},this.plotSelectedPointOnImage=async(e,n)=>{if(await y(n),!e)return;let r=new O({...re(e)?e.toJSON():e});if(this.mode==="default")r.x-=.5,r.y=.5-r.y,r.spatialReference=this._imageViewer.imageRenderer.spatialReference.clone(),this._crossSymbol=new t({geometry:r,symbol:K}),this._imageViewer.addGraphic(this._crossSymbol,0);else if(this.mode===`video`)this._crossSymbol=this.videoViewModel?.plotSelectedPointOnVideo(r)??null;else if(this.mode===`panoramic`){let{imageSize:n,media:r}=this._panoramicViewer;if(!n||!r)return;let i=X(r),a=xe(e,...n,i);this._crossSymbol=new t({geometry:new O({x:a[0],y:a[1],z:a[2],m:a[3],spatialReference:oe.WebMercator}),symbol:Le}),this._panoramicViewer.addGraphic(this._crossSymbol,0)}},this.handleSectorClick=this.handleSectorClick.bind(this),this.searchBestImage=this.searchBestImage.bind(this),this.transformAndPlotReferencePointOnImage=this.transformAndPlotReferencePointOnImage.bind(this)}initialize(){this.addHandles([C(()=>this.view,()=>this.load(),w),C(()=>this.view?.map,(e,t)=>{t?.layers.remove(this._overlays),e?.layers.add(this._overlays)},ee),C(()=>this.view?.map?.allLayers?.length,e=>{e&&this.view?.map?.layers.reorder(this._overlays,e-1)},ee),C(()=>[this.state,this.panoramicVideoLoaded,this.mapImageConversionToolState,this.view,this.disabled,this.panoramicVideoPaused,this.videoViewModel?.videoPaused],(e,t)=>{let n=e[2];t?.[2]&&!n&&(this.plotReferencePointOnGround(null),this.clearReferencePointOnImage()),this._createViewClickHandle(),this._createImageClickHandle()},w),C(()=>[this.triangularMeasurementActive,this.currentBestFeatureMeasurementImage],()=>{this._createTriangularImageClickHandle()},w),C(()=>[this.state,this.imageLocationToolState,this.view],()=>{this._initializeMeasurementService(),this._initializeLocationViewModel()},w),C(()=>this.measureType,()=>{this.clearPreviousMeasurements(),this._initializeMeasurementService()},w),C(()=>this.bestFeatureAngle,(e,t)=>{this.previousFeatureAngle=t??0},w),C(()=>[this.superimposeViewEnabled,this.defaultSuperimposeCameraLockEnabled,this.superimposeViewSupported,this.currentBestFeature,this.mode,this.state,this.view?.type],()=>{this._shouldDisableUnsupportedSuperimposeView()?this.superimposeViewEnabled=!1:this._hasActiveSuperimposeCameraContext()?this._updateSuperimposedImage():this._resetInactiveSuperimposeState()},w),C(()=>this._getSuperimposeCameraWatchState(),()=>this._handleSuperimposeCameraChange(),w),C(()=>this.currentBestFeature,async(e,t)=>{h(this._featureChangedTask),this._featureChangedTask=i(async n=>this.determineWorkflowForFeature.apply(this,[e,t,{signal:n}])),await this._featureChangedTask.promise},{sync:!0}),C(()=>[this.currentNode,this.preloadMedia,this.navigationMode],()=>{this._mediaPrefetchTask?.abort(),this._mediaPrefetchTask=i(async e=>{this.preloadMedia&&this.navigationMode!=null?(this._mediaPrefetcher??=await this._loadMediaPrefetcher({signal:e}),v(e),this.navigationMode===`directional`?this._mediaPrefetcher.enqueueDirectionalPrefetch(this.layer,this.currentNode,this.preloadMediaSize):this._mediaPrefetcher.enqueueSequentialPrefetch(this.layer,this.currentNode,this.preloadMediaSize)):this._mediaPrefetcher?.clear()})},w),C(()=>this.currentBestFeatureMeasurementImage,(e,t)=>{h(this._featureChangedTask),t&&e!==t&&(this.triangulatedPoint=null,this.sketchTriangularGraphicsLayer?.graphics.destroyAll(),this._measurementService?.resetMeasurementVectors()),this._featureChangedTask=i(async n=>{await this.determineWorkflowForTriangularMeasurement(e,t,{signal:n}),v(n),this._reorderTriangularSketchLayer()})},w),C(()=>this.triangularMeasurementActive,(e,t)=>{t&&!e&&(this._measurementService?.resetMeasurementVectors(),this.currentBestFeatureMeasurementImage=null,this.triangulatedDistanceMeasurement=null,this.triangulatedMeasurementGraphic=null,this.triangulatedPoint=null,this.updatingTriangularMeasurementState=!1,this.triangulatedAreaMeasurement=null,this.triangulatedDistanceAccuracy=null,this.triangulatedAreaAccuracy=0,this.sketchTriangularGraphicsLayer?.graphics.destroyAll(),this.clearReferencePointOnImage(),this.imageMeasurementViewer.clearImage(),this.imageMeasurementViewer.clearGraphics(),this._panoramicMeasurementViewer.clearImage(),this._panoramicMeasurementViewer.clearGraphics())}),C(()=>this.mode,e=>{switch(this.removeHandles(Y.interactionHandles),e){case`default`:this.addHandles(C(()=>{let{state:e}=this;return e===`image-loaded`?this._imageViewer.imagePointsInView:null},e=>{e&&(h(this._updateFootprintTask),this._updateFootprintTask=i(async t=>{await this.updateFootprint(e,void 0,{signal:t})}))},{...w,equals:(e,t)=>n(e,t,u)}),Y.interactionHandles);break;case`video`:this.addHandles(C(()=>{let{footprintExtent:e,videoElement:t,bestFeatureFootprint:n}=this;if(e&&t?.loaded&&n)return{videoExtent:z,bestFeatureFootprint:n}},e=>{e?.videoExtent&&e?.bestFeatureFootprint&&(h(this._updateFootprintTask),this._updateFootprintTask=i(async t=>{let n={points:e.videoExtent,feature:void 0,scale:void 0,options:{signal:t}};await this.updateVideoFootprint(n)}))},{...w,equals:(e,t)=>n(e?.videoExtent,t?.videoExtent,u)&&e?.bestFeatureFootprint===t?.bestFeatureFootprint}),Y.interactionHandles);break;case`panoramic`:this.addHandles(C(()=>{let{currentBestFeature:e,state:t,_panoramicViewer:n}=this,{imageSize:r,vfov:i,hfov:a,pitch:o,yaw:s}=n;return!e||!r||t.includes(`loading`)||i==null||a==null||o==null||s==null?null:[i,a,s,o]},e=>{if(!e||this.state.includes(`loading`))return;let[t,n,r,a]=e;this.currentNode&&(this.currentNode.currentHeading=r,this.currentNode.currentPitch=a),h(this._updateFootprintTask),this._updateFootprintTask=i(async e=>{await this.updateFootprintPanorama({verticalFieldOfView:t,horizontalFieldOfView:n,yaw:r,pitch:a},{signal:e}),this._updateFootprintTask=null})},{equals:(e,t)=>n(e,t,u)}),Y.interactionHandles);break;case`panoramic-video`:this.addHandles(C(()=>{let{currentBestFeature:e,state:t,_panoramicVideoViewer:n}=this,{imageSize:r,vfov:i,hfov:a,pitch:o,yaw:s,viewModel:c}=n,l=c.closestFeature??e;return!l||!r||t.includes(`loading`)||i==null||a==null||o==null||s==null?null:[i,a,s,o,l]},e=>{if(!e)return;let[t,n,r,a,o]=e;h(this._updateFootprintTask),this._updateFootprintTask=i(async e=>{await this.updateFootprintPanorama({verticalFieldOfView:t,horizontalFieldOfView:n,yaw:r,pitch:a,feature:o,horizonAngles:this._panoramicVideoViewer.horizonAngles},{signal:e}),v(e),this._updateFootprintTask=null})},{equals:(e,t)=>n(e,t,u)}),Y.interactionHandles)}},w),C(()=>[this.brightness,this.contrast,this.sharpness],()=>{let{_imageViewer:e,brightness:t,contrast:n,mode:r,sharpness:i}=this;r==="default"&&(e.brightness=t,e.contrast=n,e.sharpness=i)},w),C(()=>this.activeViewer?.imageRenderer,()=>{this.sketch&&(this.sketch.view=this.activeViewer?.imageRenderer)}),C(()=>this.activeViewer,e=>{this.removeHandles(Y.hittestHandles),e&&this.addHandles(S(()=>e,`hittest-response`,this._handleImageHitTestResponse),Y.hittestHandles)}),C(()=>this.videoMapView.extent,async()=>{this._scheduleVideoInteractionUpdate();let e=this.videoViewModel?.closestFeature;e&&(h(this._updateFootprintTask),this._updateFootprintTask=i(async t=>{let n={points:this.videoExtentPoints,feature:e,options:{signal:t}};await this.updateVideoFootprint(n)}))}),C(()=>[this.videoMapView.interacting,this.videoMapView.navigating,this.videoMapView.scale],()=>{this._scheduleVideoInteractionUpdate()},{initial:!0}),te(()=>this.videoMapView.extent!=null,()=>{this.initialVideoMapViewExtent=this.videoMapView.extent},{once:!0})]),this.when().finally(()=>{this.notifyChange(`state`)})}destroy(){this._adapter?.disableDefaultSuperimposeNavigation?.(),this._adapter?.disablePanoramicSuperimposeNavigation?.(),this._abortSuperimposeSchedule(),this.currentBestFeature=null,this._updateFootprintTask=h(this._updateFootprintTask),this._clickTask=h(this._clickTask),this._cameraOverlayTask=h(this._cameraOverlayTask),this._navigationViewStateTask=h(this._navigationViewStateTask),this._restoreSuperimposeMediaTask=h(this._restoreSuperimposeMediaTask),this.coverageFrustums.destroy(),this.coveragePolygons.destroy(),this.pointSources.destroy(),this.additionalFootprints.destroy(),this.additionalCameraLocations.destroy(),this.bestFeatureFootprint=m(this.bestFeatureFootprint),this.bestFeatureCurrentFootprint=m(this.bestFeatureCurrentFootprint),this.videoViewModel=m(this.videoViewModel),this._locationViewModel=m(this._locationViewModel),this.clearSelectedPointOnViewer(),this._referencePointOnGround=m(this._referencePointOnGround),this.clearReferencePointOnImage(),this._superimposeService.destroy(),this._overlays&&this.view?.map?.remove(this._overlays),this._overlays.destroy(),this._imageViewer.destroy(),this.imageMeasurementViewer.destroy(),this._panoramicViewer.destroy(),this._panoramicVideoViewer.destroy(),this._panoramicMeasurementViewer.destroy(),this._mediaPrefetcher?.destroy(),this._videoFeatureCache.destroy()}get activeLayer(){return o(d.getLogger(this),`activeLayer`,{replacement:`layer`}),this.layer}set activeLayer(e){o(d.getLogger(this),`activeLayer`,{replacement:`layer`}),this.layer=e}get activeViewer(){let{_imageViewer:e,_panoramicViewer:t,mode:n}=this;switch(n){case`default`:return e;case`panoramic`:return t;default:return null}}get activeTriangulatedViewer(){switch(this.mode){case`default`:return this.imageMeasurementViewer;case`panoramic`:return this._panoramicMeasurementViewer;default:return null}}get accuracyParametersMissing(){let e=this.currentBestFeature?.attributes.orientationAccuracy;return!e||e.every(e=>e===0)}get brightness(){return this._get(`brightness`)??0}set brightness(e){this._set(`brightness`,f(e,-10,10))}get contrast(){return this._get(`contrast`)??0}set contrast(e){this._set(`contrast`,f(e,-10,10))}get currentNode(){let{currentBestFeature:e,navigationNodes:t}=this;return t.find(t=>t.id===e?.attributes.objectId)}get depthImageNotSupported(){if(this.currentBestFeature?.attributes.depthImage)return!Ke(this.currentBestFeature.attributes.depthImage)}get featureCount(){return this.features?.length??0}get hasPendingPanoramicNavigationViewState(){return this._pendingPanoramicNavigationViewState!=null}get imageGalleryEnabled(){let{currentBestFeature:e}=this;if(!e)return!1;let t=e.attributes.imagePath?.trim();return qe(t)||W(t)}get imageLoaded(){return o(d.getLogger(this),`imageLoaded`,{replacement:`Use OrientedImageryViewer.state === "image-loaded"`,version:`4.29`,warnOnce:!0}),this.state===`image-loaded`}get invalidCameraHeading(){return this.currentBestFeature?.attributes?.cameraHeading===B}get imagePointsInView(){let{mode:e,_imageViewer:t}=this;return e==="default"?t.imagePointsInView:null}get layerView(){let{layer:e,view:t}=this;if(e&&t)return t.allLayerViews.find(Je(e))}get layerFloorFilterClause(){let{layerView:e}=this;return e?Te(e):null}get layerTimeExtent(){return this.layerView?.timeExtent??null}get mode(){let e=this.currentBestFeature?.attributes;if(!e)return`none`;let t=e.orientedImageryType;if(t?.includes(`video`))return t.includes(`360`)?`panoramic-video`:`video`;let{horizontalFieldOfView:n,isSpherical:r}=e;return n===360||r?`panoramic`:`default`}get panoramicVideoLoaded(){let{mode:e,_panoramicVideoViewer:t}=this,{videoLoaded:n}=t.viewModel;return e===`panoramic-video`&&n===!0}get overlayGraphicsEnabled(){let{mode:e,state:t,panoramicVideoLoaded:n,videoViewModel:r,panoramicVideoPaused:i}=this;return t===`image-loaded`||e===`video`&&t===`video-loaded`&&r?.videoPaused===!0||e===`panoramic-video`&&n&&i}get panoramicVideoPaused(){return!!this._panoramicVideoViewer.viewModel.videoPaused}get popupEnabled(){return this.layer?.popupEnabled===!0}get referencePoint(){return this._referencePointOnGround?.geometry}get sectorData(){let{_sectorData:e}=this;return e?V.map(t=>e[t]):null}get sharpness(){return this._get(`sharpness`)??0}set sharpness(e){this._set(`sharpness`,f(e,0,1))}get superimposeViewSupported(){return this.mode==="default"||this.mode===`panoramic`}get sketchGraphicsLayer(){let{sketch:e}=this;return e?.layer?.type===`graphics`?e.layer:void 0}get state(){let{mode:e,_updatingHandles:{updating:t},_featureChangedTask:n,_navigationManager:r}=this;if(!this.isFulfilled()||t||n?.finished===!1||r?.navigating)return`loading`;if(this.isRejected())return`error`;if(this.displayMessage?.type===`error`)return`image-load-error`;switch(e){case`default`:return this._imageViewer.state;case`panoramic`:return this._panoramicViewer.state;case`video`:return this.videoElement?.loaded?`video-loaded`:`video-not-loaded`;case`panoramic-video`:return this.panoramicVideoLoaded?`video-loaded`:`video-not-loaded`}return`ready`}get thumbnails(){let{features:e}=this;return e?new a(e.map(({attributes:{imagePath:e,objectId:t,cameraRoll:n,imageRotation:r}})=>{let i=e?.trim();return qe(i)||W(i)?{url:i,objectId:t,rotation:(n??0)+(r??0)}:null}).filter(r)):null}get videoExtentPoints(){let e=at(this.videoMapView.extent);return e.length?e:z}set view(e){this._set(`view`,e)}get _defaultGraphicsLayer(){let e={blendMode:`source-atop`};switch(this.mode){case`panoramic`:return new A({...e,elevationInfo:{mode:`absolute-height`}});case`default`:return new A({...e});default:return}}get _overlaysView(){return this.view?.layerViews.find(({layer:e})=>e===this._overlays)}updatePanoramicSuperimposeRadiusOffset(e){this._superimposeService.updatePanoramicRadiusOffset(e)}setDefaultSuperimposeZOffsetPercentage(e){this._superimposeService.setDefaultZOffsetPercentage(e)}setFrustumSearchEnabled(e){this.frustumSearchEnabled=e}setPanoramicSuperimposeRadiusPercentage(e){this._superimposeService.setPanoramicRadiusPercentage(e)}updateDefaultSuperimposeCameraLock(e){this.defaultSuperimposeCameraLockEnabled=e,this.superimposeViewEnabled&&this.mode==="default"&&(e?this._adapter?.enableDefaultSuperimposeNavigation?.():this._adapter?.disableDefaultSuperimposeNavigation?.())}beforeLoad(e=!0){this.emit(`popup-close`),e&&(this.displayMessage=null),this._pendingDefaultNavigationViewState=null,this._pendingPanoramicNavigationViewState=null,this._abortSuperimposeSchedule(),this._adapter?.disableDefaultSuperimposeNavigation?.(),this._adapter?.disablePanoramicSuperimposeNavigation?.(),this.clearPreviousGroundLocation(),this.triangularMeasurementActive=!1,this.currentBestFeatureMeasurementImage=null,this.measureType=null,this.imageLocationToolState=!1,this.features.removeAll(),this.currentBestFeature=null,this.additionalFeatures.removeAll(),this.additionalFootprints.removeAll(),this.additionalCameraLocations.removeAll(),this.bestFeatureCurrentFootprint=m(this.bestFeatureCurrentFootprint),this._restoreSuperimposeMediaTask=h(this._restoreSuperimposeMediaTask),this._superimposeService.clear(),this._overlays?.removeAll()}async calculateLocationAccuracy(e){return this._measurementService?.calculateLocationAccuracy(e)}clearLocationPointOnImage(e=!1){this.locationPointOnImage&&!e&&(this._imageViewer.removeGraphic(this.locationPointOnImage),this._panoramicViewer.removeGraphic(this.locationPointOnImage),this.locationPointOnImage=m(this.locationPointOnImage)),this.correctedLocationPointOnImage&&=(this.imageMeasurementViewer.removeGraphic(this.correctedLocationPointOnImage),this._panoramicMeasurementViewer.removeGraphic(this.correctedLocationPointOnImage),m(this.correctedLocationPointOnImage))}clearPreviousMeasurements(){this.clearMeasurementGraphics(),this.resetMeasurementData(),this.stopMeasurement()}clearPreviousGroundLocation(){this.groundCoordinates=null,this.groundCoordinatesAccuracy=null,this.groundCoordinatesAccuracyLoading=!1,this.pixelCoordinates=null,this.clearLocationPointOnImage()}clearMeasurementGraphics(){this.measurementGraphic&&=(this.activeViewer?.removeGraphic(this.measurementGraphic),null),this.heightGraphic&&=(this.activeViewer?.removeGraphic(this.heightGraphic),null),this.triangularMeasurementActive&&this.sketchTriangularGraphicsLayer?.graphics.destroyAll()}digitizeCancel(){return this.sketch?.cancel()}digitizeCanRedo(){return this.sketch?.canRedo()??!1}digitizeCanUndo(){return this.sketch?.canUndo()??!1}digitizeComplete(){return this.sketch?.complete()}async digitizeCreate(e,t){let{sketch:n,dataCaptureLayer:r}=this;if(!n)throw Q();gt(r,e,n),await n.create(e,{...t,defaultZ:0})}digitizeDelete(){if(!this.sketch)throw Q();return this.sketch.delete()}digitizeDuplicate(){if(!this.sketch)throw Q();return this.sketch.duplicate()}digitizePlace(e,t){if(!this.sketch)throw Q();return this.sketch.place(e,t)}digitizeRedo(){if(!this.sketch)throw Q();return this.sketch.redo()}digitizeUndo(){if(!this.sketch)throw Q();return this.sketch.undo()}digitizeUpdate(e,t){if(!this.sketch)throw Q();return this.sketch.update(e,t)}filterByFootprints(e,t,n){let r=n?.filterByFrustum??!1,i=n?.skipFilter??!1,a=[],o=[],s=[];return e.forEach(e=>{let{attributes:n}=e,c=e.layer?.coveragePercent,l,{polygon:u,frustum:d}=U(n);l=u.clone(),n.isInspection&&(l=pe(n)),c&&(l=me(l,c));let{cameraHeading:f,objectId:p}=n;if(this._matchesSelectedPointFilter({skipFilter:i,selectedPoint:t,filterByFrustum:r,cameraHeading:f,attributes:n,polygon:l})){s.push(e);let t=n.location.clone();t.imageID=p,this.pointSources.push(t),f!==B&&(a.push(u),d&&o.push(d))}}),{features:s,polygons:a,frustums:o}}async deleteDataCaptureFeatures(e){let{dataCaptureLayer:t}=this;if(!t)throw new s(`orientedimageryviewer:missing-featurelayer`,`Data capture layer is not available`);return t.queryFeatures({objectIds:e,outFields:[t.objectIdField]}).then(({features:e})=>t.applyEdits({deleteFeatures:e}))}handleSectorClick(e){if(isNaN(e))return;let t=(this._sectorData?.[V[e]])?.at(0);t&&(this.triangularMeasurementActive&&this.currentBestFeature?this._updateImageMeasurementBestFeature(t):this._scheduleCurrentBestFeatureUpdate(t))}handleFeatureClick(e){let{sector:t,featureIndexInSector:n}=e;if(isNaN(n))return;let r=(this._sectorData?.[t])?.at(n);r&&(this.triangularMeasurementActive&&this.currentBestFeature?this._updateImageMeasurementBestFeature(r):this._scheduleCurrentBestFeatureUpdate(r))}load(e){return this.addResolvingPromise(this._loadViewAdapter(e).catch(e=>{if(!_(e))throw e})),this}async loadBestImage(e,t){return this.selectedPoint=M(e),this.beforeLoad(),this._fetchFeaturesWithController(e,t)}async loadHeightMeasurementAdapter(e){if(!this.drawAdapter){let{default:t}=await import(`./adapters/draw/HeightMeasurementAdapter.js`);if(v(e),this.drawAdapter=new t({viewModel:this,measurementService:this._measurementService}),!this.drawAdapter.viewModel.isResolved())return}return this.drawAdapter}loadImageError(e){d.getLogger(this).error(`oriented-imagery-viewer:load-image`,e),this.setMessage(`imageLoadError`,`error`,e.message)}async loadSketch(e){if(!this.sketch){let{default:t}=await import(`../Sketch/SketchViewModel.js`);v(e),this.sketch=new t({layer:this._defaultGraphicsLayer,view:this.activeViewer?.imageRenderer,updateOnGraphicClick:!1,defaultUpdateOptions:{reshapeOptions:{edgeOperation:`none`,shapeOperation:`none`,vertexOperation:void 0},enableMoveAllGraphics:!1,enableRotation:!1,enableScaling:!1,multipleSelectionEnabled:!1,toggleToolOnClick:!1,tool:`transform`}})}return this.sketch}async loadMeasurementAdapter(e){if(!this.sketchAdapter){let{default:t}=await import(`./adapters/sketch/MeasurementAdapter.js`);if(v(e),this.sketchAdapter=new t({viewModel:this,measurementService:this._measurementService}),!this.sketchAdapter.viewModel.isResolved())return}return this.sketchAdapter}async processFeatureResponse(e,t,n){let{features:r}=e,i=this.layer?.verticalSearchRange,a=this._shouldUseVerticalFilter(),o=this._shouldUseFrustumSearch();if(this._clearFeatureGeometries(),!this._checkFeatures(r))return;let s=r[0].attributes.location.spatialReference.equals(t.spatialReference)?t:await k(t,r[0].attributes.location.spatialReference),{features:c,polygons:l}=o?this.filterByFootprints(r,s,{filterByFrustum:!0}):this.filterByFootprints(r,s,{skipFilter:n?.skipFilter});if(!this._checkFeatures(c))return;let u=await this.processElevationSample(l,c,n);v(n),await this._updateElevationOfSelectedPointAndLocations(c,t,u),v(n),c.forEach(({attributes:e})=>{if(e.cameraHeading!==B){let{polygon:t,frustum:n}=U(e);this.coveragePolygons.add(t),n&&this.coverageFrustums.add(n)}}),Ye(c,u);let d=c;if(a&&t&&i!=null&&(d=Xe(c,t,i),!d.length)){this.setMessage(`noImageAtElevation`,`info`);return}let f=this._processSuitableFeatures(d,t);this.updateSuitabilities(f,n?.loadBestImage)}async processFeatureElevation(e,t,n){if(!t)return;let{features:r,polygons:i}=this.filterByFootprints(e,t,{skipFilter:!0});if(!r?.length)return;let a=await this.processElevationSample(i,r,n);return v(n),a}async startMeasurement(e,t){this.sketch||await this.loadSketch(t),await this.loadMeasurementAdapter(t);let{sketch:n,sketchAdapter:r,activeViewer:i,mode:a}=this;if(!n||!r||!i||a===`none`)return;if(this.displayNewMeasurementButton=!1,a===`panoramic`&&(n.defaultCreateOptions.defaultZ=0),await n.create(e),a===`panoramic`){let{drawOperation:e}=n.view.activeTool;e.constraintsEnabled=!1,e._set(`elevationDrawSurface`,null)}let o=this.activeViewer?.imageRenderer.effectiveTheme.accentColor;o&&this.sketch&&(this.sketch.polygonSymbol=Re(o),this.sketch.polylineSymbol=a===`panoramic`?ze:Be(o,2.5))}async startHeightMeasurement(){this.displayNewMeasurementButton=!1,this.draw??=new ke({view:this.activeViewer?.imageRenderer}),this.polylineDrawAction=this.draw.create(`polyline`),await this.loadHeightMeasurementAdapter()}initializeMeasurement(e){switch(this.clearMeasurementGraphics(),this.resetMeasurementData(),e){case`distance`:this.startMeasurement(`polyline`);break;case`area`:this.startMeasurement(`polygon`);break;case`height`:this.startHeightMeasurement()}}async overlayCameraLocations(e){this._cameraOverlayTask=h(this._cameraOverlayTask);let{activeViewer:n,overlayedCameraLocations:a,layer:o,mode:s,layerFloorFilterClause:c,layerTimeExtent:l,videoViewModel:u,_panoramicVideoViewer:d}=this,f=s===`video`,p=s===`panoramic-video`,m=this._getActiveFeatureForCurrentMode(),g=this._computeOverlayImageSize();if(!g||!m||!o||s===`none`||!this.overlayGraphicsEnabled)return;let{polygon:y}=U(m.attributes);if(f?u?.removeOverlayGraphics(a.toArray()):p?d.removeManyGraphics(a.toArray()):n?.removeManyGraphics(a.toArray()),a.removeAll(),!e)return;let b=i(async e=>{let{features:i}=await o.queryFeatures({where:T(`${o.objectIdField} <> ${m.attributes.objectId}`,T(o.definitionExpression,c)),geometry:y,returnGeometry:!0,outFields:[o.objectIdField],timeExtent:l},{signal:e});v(e);let h=await Promise.all(i.map(async n=>{let{attributes:r,geometry:i}=n;if(i?.type!==`point`)return null;let a=await this._geometryToOverlayImageGeometry(i,m,g,{signal:e});if(v(e),!a)return null;let o=s===`panoramic`||s===`panoramic-video`?Ve():He();return new t({attributes:r,symbol:o,geometry:a})}));v(e),m===this._getActiveFeatureForCurrentMode()&&this.overlayGraphicsEnabled&&(a.addMany(h.filter(r)),f?u?.addOverlayGraphics(a.toArray()):p?d.addManyGraphics(a.toArray()):n?.addManyGraphics(a.toArray()))});this._cameraOverlayTask=b;try{await b.promise}catch(e){if(!_(e))throw e}finally{this._cameraOverlayTask===b&&(this._cameraOverlayTask=null)}}overlayGraphicsOnImage(e,t){this.removeOverlayedGraphicsOnImage(e),this.overlayedMapFeatures.set(e,t),this.mode===`video`?this.videoViewModel?.addOverlayGraphics(t.toArray()):this.mode===`panoramic-video`?this._panoramicVideoViewer.addManyGraphics(t.toArray()):this.activeViewer?.addManyGraphics(t.toArray())}async overlayMapFeatures(e,n=!1){let{activeViewer:i,mode:o,layer:s,videoViewModel:c,_panoramicVideoViewer:l}=this,u=o===`video`,f=o===`panoramic-video`,p=this._getActiveFeatureForCurrentMode(),m=this._computeOverlayImageSize();if(!m||!p||o===`none`||!this.overlayGraphicsEnabled||!s)return;let{polygon:h}=U(p.attributes);try{let{imageGeometryField:t,oiObjectIdField:n}=_t(e,s.imageGeometryField,s.imageReferenceField);this.imageGeometryField=t.name,this.oiObjectIdField=n.name}catch(e){d.getLogger(this).warn(`oriented-imagery-viewer:overlay-map-features`,e)}let{features:g}=await e.queryFeatures({geometry:h,returnGeometry:!0,outFields:[`*`]}),_=await Promise.all(g.map(async r=>{let a=r.symbol?.clone()??e.renderer?.getSymbol(r)?.clone(),{attributes:s,geometry:h}=r,{imageGeometryField:g,oiObjectIdField:_}=this;if(g&&_&&wt(e,g,_)&&`${s[_]}`==`${p.attributes.objectId}`)try{let r=f?l.horizonAngles:X(i?.media),d=vt(s,g,e,n,m,u?`default`:o,a,r);if(!u)return d;let p=d.geometry;if(!p)return null;let h=c?.imageGeometryToOverlayGeometry(p);return h?new t({attributes:s,layer:e,symbol:d.symbol,geometry:h,visible:d.visible}):null}catch(t){d.getLogger(this).warn(`oriented-imagery-viewer:overlay-map-features`,`couldn't create graphic from attributes, geometry will be used`,{error:t,feature:r,layer:e,imageGeometryField:this.imageGeometryField,imageReferenceField:this.oiObjectIdField})}if(!h)return null;let v={feature:p,imageSize:m,footprintExtent:this.footprintExtent},y=await this._geometryToOverlayImageGeometry(h,v.feature,v.imageSize);return y?new t({attributes:s,layer:e,symbol:a,geometry:y,visible:e.visible&&n}):null})),v=new a(_.filter(r));(o!==`video`&&o!==`panoramic-video`||this.overlayGraphicsEnabled)&&this.overlayGraphicsOnImage(`${e.id}`,v)}getDepthAt(e){let{activeViewer:t,currentBestFeature:n,mode:r,state:i,depthImage:a}=this,o=t?.imageSize;if(!o||!n||r===`none`||i.includes(`loading`))return d.getLogger(this).warnOnce(`oriented-imagery-viewer:get-depth-at`,`Load an image to use depth`),null;if(!a?.loaded)return d.getLogger(this).error(`oriented-imagery-viewer:get-depth-at`,`Depth image is not loaded`),this.emit(`depth-image-service:not-loaded`),null;let s=(Array.isArray(e)?e:[e]).map(e=>a.depthAt(e,{width:o[0],height:o[1]})??null);return Array.isArray(e)?s:s[0]}getActiveSectors(){return V.filter(e=>this._sectorData?.[e]?.length)}async getPixelLocationForFeature(e,t,n){return(await this._transformationService.pointToPixelForFeature([e],t,n))[0]}async getPixelLocationsForFeature(e,t,n){return await this._transformationService.pointToPixelForFeature(e,t,n)}async _getMapPointInViewSpatialReference(e,t){let n=await this.getMapPoint(e,t),r=this.view?.spatialReference;return await k(n,r,t)}async plotMapPoint(e){this.plotReferencePoint(e);let t=this._getActiveFeatureForCurrentMode();if(t)return this.transformAndPlotReferencePointOnImage({feature:t,selectedLocation:e,options:{signal:this._transformController?.signal}})}plotReferencePointOnGround(e){this._referencePointOnGround&&(this._overlays?.remove(this._referencePointOnGround),this._referencePointOnGround.destroy()),e!=null&&(this._referencePointOnGround=new t({geometry:new O({...e.toJSON()}),symbol:q}),this.view?this._overlays?.add(this._referencePointOnGround):this.emit(`plot-ground-point`,{data:{point:this._referencePointOnGround?.geometry}}))}plotReferencePointOnImage(e){switch(this.mode){case`video`:this._plotReferencePointOnVideo(e);return;case`panoramic-video`:this._plotReferencePointOnPanoramicVideo(e);return;case`default`:this._plotReferencePointOnDefaultImage(e);return;case`panoramic`:this._plotReferencePointOnPanoramicImage(e);return}}removeAllOverlayMapFeatures(){let{mode:e}=this;this.overlayedMapFeatures.forEach(t=>{let n=t.toArray();switch(e){case`video`:this.videoViewModel?.removeOverlayGraphics(n);break;case`panoramic-video`:this._panoramicVideoViewer.removeManyGraphics(n);break;default:this.activeViewer?.removeManyGraphics(n)}}),this.overlayedMapFeatures.clear()}removeOverlayedGraphicsOnImage(e){let t=this.overlayedMapFeatures.get(e),{mode:n}=this;if(!t?.length)return;let r=t.toArray();switch(n){case`video`:this.videoViewModel?.removeOverlayGraphics(r);break;case`panoramic-video`:this._panoramicVideoViewer.removeManyGraphics(r);break;default:this.activeViewer?.removeManyGraphics(r)}this.overlayedMapFeatures.delete(e)}reset(){let{mode:e}=this;e==="default"||e===`panoramic`?this.resetImage():e===`video`?this.resetVideo():e===`panoramic-video`&&this.resetVideoPanoramic(),this.beforeLoad(!1)}resetImage(){switch(this.setMessage(`onLoadMessage`,`info`),this.mode){case`default`:this._imageViewer.clearImage(),this._imageViewer.clearGraphics();break;case`panoramic`:this._panoramicViewer.clearImage(),this._panoramicViewer.clearGraphics()}this._clickTask=h(this._clickTask)}resetVideo(){this.setMessage(`onLoadMessage`,`info`),this.videoViewModel?.resetVideoHandler(),this._overlays?.removeAll(),this.videoViewModel=null,this._videoFeatureCache.reset(),this._syncVideoFeatureCacheState(),this.currentBestFeature=null}resetVideoPanoramic(){this.setMessage(`onLoadMessage`,`info`),this._overlays?.removeAll(),this._panoramicVideoViewer.reset(),this.currentBestFeature=null}resetMeasurementData(){this.areaMeasurementResult=0,this.areaMeasurementAccuracy=0,this.distanceMeasurementResult=0,this.distanceAccuracyArray=[],this.heightMeasurementResult=0,this.heightMeasurementAccuracy=0,this.heightGraphic=null,this.triangulatedDistanceMeasurement=null,this.triangulatedDistanceAccuracy=null,this.triangulatedAreaMeasurement=null,this.triangulatedMeasurementGraphic=null,this.updatingTriangularMeasurementState=!1,this.triangulatedAreaAccuracy=0,this._measurementService?.resetMeasurementVectors()}async saveDrawing(){let{dataCaptureLayer:e,sketchAdapter:t}=this;if(!e||t?.type!==`data-capture`)return;let{pendingGraphics:n,savedGraphics:r}=t,i=n.get(e.id),a=i?.toArray();if(!i||!a?.length)return;let{addFeatureResults:o}=await this.saveDataCaptureFeatures(a),s=o.reduce((t,{objectId:n,globalId:r,error:i},o)=>{let s=a[o],{attributes:c}=s;return i?t.error.push(s):(n&&(c[e.objectIdField]=n),r&&e.globalIdField&&(c[e.globalIdField]=r),t.success.push(s)),t},{success:[],error:[]});r.addMany(s.success),i.removeAll(),i.addMany(s.error)}async saveDataCaptureFeatures(e,t){let{activeViewer:n,currentBestFeature:i,dataCaptureLayer:a,mode:o}=this;if(!n?.imageSize||!i||o===`none`||o===`video`||o===`panoramic-video`)throw new s(`orientedimageryviewer:missing-input`,`Image size, current best feature and mode are required to save data capture features`);if(!a)throw new s(`orientedimageryviewer:missing-featurelayer`,`Data capture layer is not available`);let c=await Promise.all(e.map(async e=>{let n=e.clone(),{geometry:r}=n;if(!r)return;let i=r.type,o=a.hasZ,s=a.geometryType,c=i!==s,l=(c?await import(`./transformers.js`):null)?.default[s],u=c?l?.(r):r;if(u&&(n.geometry=await this._transformationService.imageGeometryToMapGeometry(u,t),n.geometry))return o||yt(n.geometry),n})),l=c.filter(r);return a.applyEdits({addFeatures:l}).then(e=>{let{addFeatureResults:t}=e,n=0,r=c.map(e=>{let r=t[n++];return e?r:{error:new s(`orientedimageryviewer:save-unsucccessful`,`Error in saving data capture features`),objectId:null,globalId:null}});return{...e,addFeatureResults:r}})}async searchBestImage(e,t){try{let n=await j(e,t);n&&await this.processFeatureResponse(n,e.point,t)}catch(e){_(e)||(this.setMessage(`imageLoadError`,`error`,e.message),d.getLogger(this).error(`error occurred while finding best image`,e))}}selectTriangularMeasurementFeature(e){this.currentBestFeatureMeasurementImage=this.features?.find(({attributes:t})=>t.objectId===Number(e))}setAdditionalCameraLocationsVisibility(e){this.additionalCameraLocations.forEach(t=>{t.visible=e})}setAdditionalCoverageVisibility(e){this.additionalFootprints.forEach(t=>{t.visible=e})}setCurrentCoverageVisibility(e){this.bestFeatureCurrentFootprint&&(this.bestFeatureCurrentFootprint.visible=e),this.currentBestFeatureLocation&&(this.currentBestFeatureLocation.visible=e)}setMapImageConversionToolState(e){this.mapImageConversionToolState=e}setCurrentPanoramaView(e,t){this._panoramicViewer?.set({yaw:e,pitch:t})}async restorePendingPanoramicNavigationViewState(e){let t=this._pendingPanoramicNavigationViewState;this._pendingPanoramicNavigationViewState=null,this.mode===`panoramic`&&await this._restoreNavigationViewState(t,e)}async startDataCapture(e,t){let n=this.activeViewer?.imageRenderer,{oiObjectIdField:r,currentBestFeature:i}=this;if(!n||!i||!r)return;let{attributes:{objectId:o}}=i,s=this.overlayedMapFeatures.get(e.id)?.toArray()??[],c=[],l=[];for(let e of s)`${e.getAttribute(r)}`==`${o}`?c.push(e):l.push(e);this.overlayGraphicsOnImage(e.id,new a(l)),this.collectionId=e.id;let u=await this.loadSketch(t),d=await this.loadDataCaptureAdapter(t);v(t),u.addGraphics(c),d.savedGraphics.addMany(c);let f=n.ui.find(`zoom`);f.visible=!1,n.map.layers.add(this.sketchGraphicsLayer)}async stopDataCapture(e=!1){this.sketch?.cancel(),this.sketchGraphicsLayer?.removeAll(),this.sketchAdapter=m(this.sketchAdapter),this.sketch=m(this.sketch),this.collectionId=null;let{dataCaptureLayer:t}=this,n=this.activeViewer?.imageRenderer;if(!n||n.destroyed)return;n.map.layers.remove(this.sketchGraphicsLayer),e&&t&&await this.overlayMapFeatures(t,!0);let r=n.ui.find(`zoom`);r&&(r.visible=!0)}stopMeasurement(){this.draw?.reset(),this.sketch?.cancel()}async toggleAllOverlayMapFeatures(e){!e&&this.dataCaptureLayer&&(await this.stopDataCapture(!0),this.dataCaptureLayer=null),this.overlayedMapFeatures.forEach(t=>{this._toggleVisiblity(t,e)})}toggleOverlayMapFeatures(e,t,n){let r=this.overlayedMapFeatures.get(e);r&&n&&this._toggleVisiblity(r,t)}toggleSelection(e){let{sketch:t}=this;t&&(t.updateOnGraphicClick=e,t.cancel())}async transformAndPlotReferencePointOnImage(e){let{feature:t,selectedLocation:n,options:r}=e,i=!1,a=!1,o=this.mode===`video`?this.bestFeatureCurrentFootprint?.geometry:this.bestFeatureFootprint?.geometry;switch(o?.type){case`polygon`:{let e=n.spatialReference.equals(o.spatialReference)?n:await k(n,o.spatialReference);i=o.contains(e);break}case`mesh`:{let e=n.spatialReference.equals(o.spatialReference)?n:await k(n,o.spatialReference);a=o.extent.contains(e);break}}if(!i&&!a){this.clearReferencePointOnImage();return}let s=this.mode===`video`||this.mode===`panoramic-video`?await this.getPixelLocationForFeature(n,{feature:t,mode:this.mode,imageSize:R,footprintExtent:this.footprintExtent},r):await this._transformationService.pointToPixel(n,r);if(!s)this.clearReferencePointOnImage();else return v(r),this.plotReferencePointOnImage(s),{x:s.x,y:s.y}}async updateFeatureCache(e){await this._videoFeatureCache.updateIndex(e),this._syncVideoFeatureCacheState()}cacheHydratedVideoFeature(e){this._videoFeatureCache.cacheHydratedFeature(e),this._syncVideoFeatureCacheState()}getCachedVideoFeatureByOffset(e,t){return this._videoFeatureCache.getCachedFeatureByOffset(e,t)}async getVideoFeatureByOffset(e,t,n){let{layer:r}=this;if(!r)return null;let i=await this._videoFeatureCache.getFeatureByOffset({layer:r,layerFloorFilterClause:this.layerFloorFilterClause,layerTimeExtent:this.layerTimeExtent},e,t,n);return this._syncVideoFeatureCacheState(),i}_shouldUseVerticalFilter(){return!!(this.layer?.verticalSearchRange&&this.layer.hasZ&&this.verticalFilterEnabled)}_shouldUseFrustumSearch(){return!!(this.layer?.hasZ&&this.frustumSearchEnabled&&this.view?.type===`3d`)}_syncVideoFeatureCacheState(){this.featureCache=this._videoFeatureCache.featureCache,this.videoFeatureIndex=this._videoFeatureCache.videoFeatureIndex}_matchesSelectedPointFilter({skipFilter:e,selectedPoint:t,filterByFrustum:n,cameraHeading:r,attributes:i,polygon:a}){return e||!t||(n?r!==B&&he(i,t):ge(a,t))}_plotReferencePointOnVideo(e){this.state===`video-loaded`&&this.videoViewModel?.videoPaused&&(this.clearReferencePointOnImage(),this.videoViewModel.plotReferencePointOnVideo(e))}_plotReferencePointOnPanoramicVideo(e){let n=this._panoramicVideoViewer,{imageSize:r,media:i}=n.viewModel;if(!this.panoramicVideoLoaded||!this.panoramicVideoPaused||!r)return;this.clearReferencePointOnImage();let a=X(i),o=Z(e,`panoramic`,r,a);this._referencePointOnImage=new t({geometry:o,symbol:J.clone()}),n.addGraphic(this._referencePointOnImage,0)}_getActiveFeatureForCurrentMode(){switch(this.mode){case`video`:return this.videoViewModel?.closestFeature??this.currentBestFeature;case`panoramic-video`:return this._panoramicVideoViewer.viewModel.closestFeature??this.currentBestFeature;default:return this.currentBestFeature}}_plotReferencePointOnDefaultImage(e){let n=this._imageViewer,{imageSize:r}=n;if(this.state!==`image-loaded`||!r)return;this.clearReferencePointOnImage();let i=Z(e,`default`,r);this._referencePointOnImage=new t({geometry:i,symbol:q.clone()}),n.addGraphic(this._referencePointOnImage,0)}_plotReferencePointOnPanoramicImage(e){let n=this._panoramicViewer,{imageSize:r,media:i}=n;if(this.state!==`image-loaded`||!r)return;this.clearReferencePointOnImage();let a=X(i),o=Z(e,`panoramic`,r,a);this._referencePointOnImage=new t({geometry:o,symbol:J.clone()}),n.addGraphic(this._referencePointOnImage,0)}async _fetchFeatures(e,t){let{layer:n,layerFloorFilterClause:r,layerTimeExtent:i,view:a}=this;if(!a)return;if(!n){this.setMessage(`noLayerSelected`,`info`);return}e.x=le(e.x,e.spatialReference);let o=n.spatialReference.equals(e.spatialReference)?e:await k(e,n.spatialReference),s=o.spatialReference.isGeographic?ue(o):o,c=T(`1=1`,T(n.definitionExpression,r)),l=s.spatialReference.isGeographic?1:E(s.spatialReference),u={layerInstanceOrURL:n,point:s,queryParams:{where:c,maximumDistance:n.maximumDistance?n.maximumDistance/l:void 0,timeExtent:i}};return await this.searchBestImage(u,t)}async _fetchFeaturesWithController(e,t){try{await this._fetchFeatures(e,t)}catch(e){if(_(e))return;this.setMessage(`imageLoadError`,`error`),d.getLogger(this).error(`error occurred while fetching features`,e)}}_groupFeaturesBySectors(){let{_suitabilities:e,additionalFeatures:t,features:n,invalidCameraHeading:r}=this,i=n.at(0);if(!e||!t||!i||!n||r){this._sectorData=null;return}this._sectorData={};let o={};this._featureToSector=o;for(let e of V)this._sectorData[e]=new a;let s=e.map((e,t)=>({...e,featureIndex:t}));s.sort((e,t)=>e.trueSuitability-t.trueSuitability);let c=s.map(({distance:e})=>e),l=Math.max(...c);s.forEach(e=>{let{distance:t,angle:r,featureIndex:a}=e,s=t/l*H[2],c=tt(t,l),u=nt(r);if(!this._sectorData)return;let d=H[3]+s*Math.sin(r*Math.PI/180),f=H[3]+s*Math.cos(r*Math.PI/180),p,m=n.at(a),h=m===i,{cameraPitch:g}=m.attributes,_=g<5;if(h&&_)p=-90;else{let e=d-H[3],t=f-H[3],n=t/Math.sqrt(e**2+t**2),r=Math.acos(n)*180/Math.PI;(e<0&&t<0||e<0&&t>0)&&(r*=-1),p=r}let v=c===``?u:`${c}_${u}`;h&&(p===this.bestFeatureAngle?this.previousFeatureAngle=p:this.bestFeatureAngle=p,this.navigatorCurrentBestFeature=_?null:{x:d,y:f,direction:u}),o[`${m.attributes.objectId}`]=v;let y=this._sectorData[v];y.add({angle:r,featureIndex:a,x:d,y:f,objectID:m.attributes.objectId,sector:v,featureIndexInSector:y.length})})}async _initializeLocationViewModel(e){if(!this._locationViewModel){let{default:t}=await import(`./components/ImageLocationViewModel.js`);v(e),this._locationViewModel=new t({oiViewModel:this,referenceTransformationService:this._referenceTransformationService})}}_initializeMeasurementService(){this._measurementService||=new mt({transformationService:this._transformationService,referenceTransformationService:this._referenceTransformationService})}_initializeVideo(){if(!this.currentBestFeature)return;let e=ot(this.currentBestFeature.attributes.imagePath),t=ot(this.videoElement?.video);if(e&&t===e&&this.videoViewModel)return;this.videoLayer&&=(this.videoMapView.map.layers.remove(this.videoLayer),this.videoLayer.destroy(),null),this.videoViewModel=m(this.videoViewModel),this.removeHandles(Y.videoPlayerHandles),this.videoElement=new Ee({video:e??this.currentBestFeature.attributes.imagePath,georeference:new we({extent:new ae(Ie)}),autoplay:!1}),this.videoElement.content?.loop&&(this.videoElement.content.loop=!1);let n=new de({source:this.videoElement,title:this.layer?.title,copyright:this.layer?.copyright});this.videoLayer=n,n&&this.videoMapView.map.layers.add(n),this.videoViewModel=new dt({oiViewModel:this})}async getMapPoint(e,t){let n=await this._transformationService.pixelToMapPoint(Array.isArray(e)?e:[e],t);return Array.isArray(e)?n:n[0]}async getMapPointForFeature(e,t,n){let r=await this._transformationService.pixelToMapPointForFeature(Array.isArray(e)?e:[e],t,n);return Array.isArray(e)?r:r[0]}async loadPanoramicMediaSource(e,t){let{lookAt:n,...r}=e,i=Ze(r);try{await i.load(t)}catch(e){if(_(e))return;if(e.name===`unsupported-format`){this.setMessage(`unsupportedPanoramicImageryError`,`error`,void 0,{datasetFormat:i?.extension??`UNKNOWN FORMAT`});return}}let a=this.triangularMeasurementActive?this._panoramicMeasurementViewer:this._panoramicViewer;await a.loadMedia(i,t),n&&a.set(n)}async loadMediaSource(e,t){let n=Qe(e);await this._setImageSource(this.triangularMeasurementActive?this.imageMeasurementViewer:this._imageViewer,n,t)}_clearFeatureGeometries(){this.coveragePolygons.removeAll(),this.coverageFrustums.removeAll(),this.pointSources.removeAll()}_checkFeatures(e){return e?.length?!0:(this.emit(`no-image-found`),this.setMessage(`noImageError`,`error`),this.videoElement?.content?.pause(),this.currentBestFeature=null,!1)}async _getElevationSampleFromGround(e,t,n){if(!e[0])return;let{unionExecuteMany:r}=await import(`../../geometry/operators/unionOperator.js`),i=r(e);if(this._updateFootprintWithFeatures(t,i),this.view?.type===`3d`)try{return await this.view.map.ground.createElevationSampler(this.footprintExtent,n)}catch(e){if(_(e))throw e;d.getLogger(this).error(e);return}}async processElevationSample(e,t,n){let{elevationSource:r}=t[0].attributes,i=await this._getElevationSampleFromGround(e,t,n);if(this.view?.type===`3d`||i)return i;if(r&&this.footprintExtent&&_e(r))return await ye({extent:this.footprintExtent,lod:r.lod,url:r.url,rasterFunction:r.rasterFunction})}_processSuitableFeatures(e,t){return fe({features:e,selectedPoint:t,camera:$e(this.view)?this.view.camera:null,currentImage:this.currentBestFeature})}async _processHitTestResults(e,t,n){let{results:[r]}=t;if(r?.type!==`graphic`){this.beforeLoad(!1),this.emit(`no-image-found`),this.setMessage(`noImageError`,`error`);return}let i=r.graphic.getAttribute(e.objectIdField);return await this.showImageByObjectId(i,n)}async _queryAndLoadByObjectId(e,t,n,r,i){this.displayMessage=null;let{response:a}=await pt(e,t,n,r,i);if(v(i),!a?.features?.length)throw new ft(t);let{attributes:o}=a.features[0],s,c;if(s=i?.selectedPoint?M(i.selectedPoint):void 0,!s){if(o.orientedImageryType?.includes(`360`)){s=M(o.geometry);let{cameraHeading:e,farDistance:t,nearDistance:n}=o,r=[Math.sin(p(e)),Math.cos(p(e))],i=(t+n)/2;c=E(s.spatialReference),s.x+=i*r[0]/c,s.y+=i*r[1]/c,s.z=void 0}else{let e=await this.processFeatureElevation(a.features,o.geometry.clone(),i);v(i),await this._updateElevationOfSelectedPointAndLocations(a.features,o.geometry.clone(),e??void 0,i),v(i);let t=U(o).polygon,n=O.fromJSON(se(t));s=M(n),c=E(s.spatialReference)}}this.selectedPoint=s,c=E(s.spatialReference);let l={layerInstanceOrURL:e,point:s,queryParams:{where:T(T(`1=1`,T(e.definitionExpression,n)),`${e.objectIdField} <> ${t}`),maximumDistance:e.maximumDistance?e.maximumDistance/c:void 0,timeExtent:r}},u=await j(l,i);v(i);let{features:d}=u;return d.push(a.features[0]),await this.processFeatureResponse(u,s,{...i,loadBestImage:!1})}_reorderTriangularSketchLayer(){let e=this.imageMeasurementViewer.imageRenderer.map.layers?.length;this.sketchTriangularGraphicsLayer&&e&&this.imageMeasurementViewer.imageRenderer.map.layers.reorder(this.sketchTriangularGraphicsLayer,e-1)}async _setImageSource(e,t,n){e.media=t,await e.loadMedia(t,n)}async _restoreNavigationViewState(e,t){let n=e?.center?await this._transformationService.pointToPixel(e.center,t):null;if(v(t),this.mode===`panoramic`){let t=X(this._panoramicViewer.media);if(!t)return;xt({viewState:e,panoramicViewer:this._panoramicViewer,horizonAngles:t,imageCenter:n})}St({viewState:e,imageViewer:this._imageViewer,imageCenter:n})}_toggleVisiblity(e,t){e.forEach(e=>{e.visible=t})}async _updateElevationOfSelectedPointAndLocations(e,t,n,r){let{cameraHeight:i}=e[0].attributes,a=e[0].attributes.location,o=await P(a.spatialReference,a.z,i,{elevationSample:n,elevationSource:this.view?.type===`3d`||n?void 0:e[0].attributes.elevationSource,extent:this.footprintExtent},r);v(r);let[s,...c]=await ve([t,...e.map(e=>e.attributes.geometry.clone())],o);v(r),t.elevation=s.z,e.forEach((e,t)=>{e.attributes.elevation=c[t].z;let n=this.pointSources.find(t=>t.imageID===e.attributes.objectId);n&&(n.z=e.attributes.location.z)})}_updateFeatures(e,t=!0){e.length?(this.features.removeAll(),this.features.addMany(e),this.navigationNodes.removeAll(),this.navigationNodes.addMany(e.map(e=>{let{geometry:t,attributes:n}=e,{isSpherical:r,cameraHeading:i,cameraPitch:a}=n;return new ut({geometry:t,attributes:n,currentHeading:r?0:i,currentPitch:r?0:a})})),e.length>1?this.additionalFeatures.addMany(e.slice(1)):this.additionalFeatures.removeAll(),t&&(this.currentBestFeature=e[0])):(this.currentBestFeature=null,this.additionalFeatures.removeAll())}_updateFootprintWithFeatures(e,t){let n=[];for(let{attributes:{location:r}}of e)t.contains(r)||n.push([r.x,r.y]);n.sort((e,t)=>+ce([e,t])),t.addRing(n),this.footprintExtent=Ae(t.extent,2,2)}_scheduleVideoInteractionUpdate(){this.scheduledFrameId||=requestAnimationFrame(()=>{this.scheduledFrameId=null,this._updateInteraction()})}async _updatePointsAndPolygons(e){let{pointSources:n,currentBestFeature:r,currentCoverageVisible:i,isAdditionalPointSourcesVisible:a,mode:o,layer:s}=this;if(r&&(this.additionalFootprints.removeAll(),this.additionalCameraLocations.removeAll(),this.bestFeatureCurrentFootprint&&(this.bestFeatureCurrentFootprint.destroy(),this.bestFeatureCurrentFootprint=null,this.bestFeatureFootprint=null),!this.invalidCameraHeading)){await this._adapter?.createFootprints(e),v(e);for(let o of n){let n=this.view&&!this.view.spatialReference?.equals(o.spatialReference)?await k(o.clone(),this.view?.spatialReference,e):o.clone();o.imageID===r.attributes.objectId?this.currentBestFeatureLocation=new t({attributes:{imageID:o.imageID},geometry:n,symbol:Ue,visible:i}):this.additionalCameraLocations.push(new t({attributes:{imageID:o.imageID},geometry:n,symbol:We,visible:a}))}(o===`video`||o===`panoramic-video`)&&(await this.initializeTransformationService(e),s&&!this.videoFeatureIndex.length&&await this.updateFeatureCache(s),this.cacheHydratedVideoFeature(r))}}_scheduleCurrentBestFeatureUpdate(e){h(this._navigationViewStateTask);let t=i(async t=>{await this._updateCurrentBestFeature(e,{signal:t})});this._navigationViewStateTask=t,t.promise.catch(e=>{if(!_(e))throw e}).finally(()=>{this._navigationViewStateTask===t&&(this._navigationViewStateTask=null)})}async _updateCurrentBestFeature(e,t){if(!e)return;if(await this._capturePendingNavigationViewState(t),v(t),this.currentBestFeature=this.features?.at(e.featureIndex),this.mode===`video`){this.currentBestFeature&&this.videoViewModel?.playVideoFromSelectedLocation(this.currentBestFeature);return}if(this.mode===`panoramic-video`){this.currentBestFeature&&this._panoramicVideoViewer.viewModel.playPanoramicVideoFromSelectedLocation(this.currentBestFeature);return}let n=this.currentBestFeature?.attributes.cameraPitch&&this.currentBestFeature?.attributes.cameraPitch<5,r;if(n)r=-90;else{let t=e.x-H[3],n=e.y-H[3],i=n/Math.sqrt(t**2+n**2),a=Math.acos(i)*180/Math.PI;(t<0&&n<0||t<0&&n>0)&&(a*=-1),r=a}r===this.bestFeatureAngle?this.previousFeatureAngle=r:this.bestFeatureAngle=r,this.navigatorCurrentBestFeature=n?null:{x:e.x,y:e.y,direction:e.sector.includes(`_`)?e.sector.split(`_`)[1]:e.sector},this.mode===`panoramic`&&(await x(()=>this.state===`image-loaded`,t),v(t),await this.restorePendingPanoramicNavigationViewState(t))}async _capturePendingNavigationViewState(e){this.mode==="default"?await this._capturePendingDefaultNavigationViewState(e):this.mode===`panoramic`&&await this._capturePendingPanoramicNavigationViewState(e)}async _capturePendingDefaultNavigationViewState(e){try{let{imageSize:t,imageRenderer:n}=this._imageViewer,r=n.center;if(this.state!==`image-loaded`||!t[0]||!t[1]||!r||Math.abs(n.scale-n.constraints.minScale)<=Oe){this._pendingDefaultNavigationViewState=null;return}let i=bt(r,`default`,t),a=await this._getMapPointInViewSpatialReference(i,e);v(e),this._pendingDefaultNavigationViewState={center:a,scale:n.scale}}catch(e){this._handlePendingNavigationViewStateCaptureError(e)}}async _capturePendingPanoramicNavigationViewState(e){let t=X(this._panoramicViewer.media);if(t)try{let{fov:n,imageSize:r,pitch:i,yaw:a}=this._panoramicViewer;if(this.state!==`image-loaded`||!r||!n){this._pendingPanoramicNavigationViewState=null;return}let[o,s]=Se(a,i,t),c=Ce(o,s,r[0],r[1]),l=await this._getMapPointInViewSpatialReference(c,e);v(e),this._pendingPanoramicNavigationViewState={center:l,fov:n}}catch(e){this._handlePendingNavigationViewStateCaptureError(e)}}_handlePendingNavigationViewStateCaptureError(e){if(_(e))throw e;d.getLogger(this).warn(`oriented-imagery-viewer:failed-to-capture-navigation-view-state`,e)}_updateImageMeasurementBestFeature(e){e&&(this.currentBestFeatureMeasurementImage=this.features?.at(e.featureIndex))}clearGraphics(){this._cameraOverlayTask=h(this._cameraOverlayTask),this._imageViewer.clearGraphics(),this._panoramicViewer.clearGraphics(),this.imageMeasurementViewer.clearGraphics(),this._panoramicMeasurementViewer.clearGraphics()}clearReferencePointOnImage(){this._referencePointOnImage&&=(this._imageViewer.removeGraphic(this._referencePointOnImage),this._panoramicViewer.removeGraphic(this._referencePointOnImage),this._panoramicVideoViewer.removeGraphic(this._referencePointOnImage),m(this._referencePointOnImage)),this.videoViewModel?.clearReferencePointOnVideo()}async initializeReferenceTransformationService(e){let{currentBestFeatureMeasurementImage:t,activeTriangulatedViewer:n,mode:r}=this;if(!t||!n||!n.imageSize||r!==`panoramic`&&r!=="default")return;let{imageSize:i}=n,{attributes:a,elevationSample:o}=t,{cameraHeight:s,elevationSource:c}=a,l=a.location;l.spatialReference.isGeographic&&(l=M(l));let u={...r==="default"?F(a,i[0],i[1]):G(a,i[0],i[1]),cameraLocation:l},d=await P(l.spatialReference,l.z??0,s,{elevationSample:o,elevationSource:this.view?.type===`3d`?void 0:c,extent:this.footprintExtent},e),f=(await import(`./services/TransformationService.js`)).default,p={imageToWorldProperties:u,updateElevationProps:d,mode:r,imageSize:i,depthImageService:this.depthImage};this._referenceTransformationService=new f(p),this._locationViewModel&&(this._locationViewModel.referenceTransformationService=this._referenceTransformationService),this._measurementService&&(this._measurementService.referenceTransformationService=this._referenceTransformationService)}async initializeTransformationService(e){let{currentBestFeature:t,activeViewer:n,mode:r}=this,i=r===`video`||r===`panoramic-video`?R:n?.imageSize;if(!t||!i||r===`none`)return;let{attributes:a,elevationSample:o}=t,{cameraHeight:s,elevationSource:c}=a,l=a.location;l.spatialReference.isGeographic&&(l=M(l));let u=r==="default"||r===`video`?`default`:`panoramic`,d={...u==="default"?F(a,i[0],i[1]):G(a,i[0],i[1]),cameraLocation:l},f=await P(l.spatialReference,l.z??0,s,{elevationSample:o,elevationSource:this.view?.type===`3d`?void 0:c,extent:this.footprintExtent},e),p=(await import(`./services/TransformationService.js`)).default,m={imageToWorldProperties:d,updateElevationProps:f,mode:u,imageSize:i,depthImageService:this.depthImage};this._transformationService=new p(m),this._measurementService&&(this._measurementService.transformationService=this._transformationService)}plotReferencePoint(e){`mapPoint`in e?this.plotReferencePointOnGround(e.mapPoint):this.plotReferencePointOnGround(e)}clearSelectedPointOnViewer(){this._crossSymbol?this.mode===`video`?(this.videoViewModel?.clearSelectedPointOnVideo(),this._crossSymbol=null):(this._panoramicViewer.removeGraphic(this._crossSymbol),this._imageViewer.removeGraphic(this._crossSymbol),this.videoMapView.graphics.remove(this._crossSymbol),this._crossSymbol=m(this._crossSymbol)):this.videoViewModel?.clearSelectedPointOnVideo()}setMessage(e,t,n,r){this.displayMessage={key:e,type:t,data:n,map:r}}async transformAndPlotSelectedLocation(e){let{invalidCameraHeading:t,selectedPoint:n,activeViewer:r,videoElement:i}=this,a=this.mode===`video`?this.videoViewModel?.closestFeature??this.currentBestFeature:this.currentBestFeature;this.clearSelectedPointOnViewer();let o=this.mode===`video`?i?.loaded===!0&&this.videoViewModel?.videoPaused===!0:r?.state===`image-loaded`;if(!n||!a||!o||t||this.mode===`video`&&!await st(n,this.bestFeatureCurrentFootprint?.geometry,e))return;let s;try{if(s=this.mode===`video`?await this.getPixelLocationForFeature(n,{feature:a,mode:this.mode,imageSize:R,footprintExtent:this.footprintExtent},e):await this._transformationService.pointToPixel(n,{signal:e?.signal}),this.mode===`video`&&!ct(s))return;v(e),await this.plotSelectedPointOnImage(s,e)}catch(e){_(e)||d.getLogger(this).error(`failed to transform map point to pixel, cross symbol will not be plotted on image`,{error:e,selectedPoint:n,feature:a})}}updateCurrentCoveragePolygon(e){let{additionalFootprints:n,additionalCameraLocations:r,currentBestFeature:i,currentBestFeatureLocation:a,currentCoverageVisible:o,selectedPoint:s,view:c}=this;if(!i)return;let{attributes:{objectId:l}}=i;if(this._initialCurrentCoverageUpdate){if(this._overlays?.removeAll(),this._initialCurrentCoverageUpdate=!1,this.bestFeatureCurrentFootprint=m(this.bestFeatureCurrentFootprint),e&&!this.invalidCameraHeading&&(e.visible=o,this.bestFeatureCurrentFootprint=e),c){let e=[...n,...r,a].filter(et);s&&(this.bestFeatureCurrentFootprint&&e.splice(-2,0,this.bestFeatureCurrentFootprint),e.push(new t({geometry:s.clone(),symbol:K.clone(),attributes:{imageID:l}}))),this._overlays.graphics.addMany(e)}}else if(c){if(this.invalidCameraHeading){this._superimposeService.clear();return}this.bestFeatureCurrentFootprint&&=(this._overlays?.remove(this.bestFeatureCurrentFootprint),m(this.bestFeatureCurrentFootprint));let t=this.bestFeatureCurrentFootprint&&this._overlays?this._overlays.graphics.indexOf(this.bestFeatureCurrentFootprint):-1;e&&(this.bestFeatureCurrentFootprint=e,e.visible=this.currentCoverageVisible,this._overlays?.graphics.add(this.bestFeatureCurrentFootprint,t>=0?t:this._overlays.graphics.length-1))}}_updateSuperimposedImage(){if(!this._hasActiveSuperimposeCameraContext())return;let e=this.mode===`panoramic`?this._panoramicViewer:null,{currentBestFeature:t,defaultSuperimposeCameraLockEnabled:n,layer:r,mode:i,view:a,state:o,superimposeViewEnabled:s,superimposeViewSupported:c,activeViewer:l,depthImage:u}=this,d=this.coverageFrustums.find(({imageID:e})=>e===t?.attributes.objectId);this._superimposeService.update({activeImageSize:l?.imageSize||void 0,adapter:this._adapter,currentBestFeature:t,currentBestFeatureFrustum:d,defaultSuperimposeCameraLockEnabled:n,depthImageLoaded:u?.loaded??!1,layer:r,mode:i,panoramicCamera:e?.camera,state:o,superimposeViewEnabled:s&&c,view:a}),this.setMessage(`superimposeImageDescription`,`info`),this._superimposePreviousCurrentCoverageVisible??=this.currentCoverageVisible,this.currentCoverageVisible=!1}_getSuperimposeCameraWatchState(){let e=(this.view?.type===`3d`?this.view:null)?.camera;return[this.superimposeViewEnabled,this.superimposeViewSupported,this.mode,this.state,this.view?.type,this.view?.interacting,this.view?.navigating,e?.heading,e?.tilt,e?.fov,e?.position.x,e?.position.y,e?.position.z]}_handleSuperimposeCameraChange(){let e=this.view,t=e?.type===`3d`?e:null;this._hasActiveSuperimposeCameraContext()?this.mode===`panoramic`?this._schedulePanoramicSuperimposeUpdate():!t||t.interacting||t.navigating?this._abortSuperimposeSchedule():this._scheduleDefaultSuperimposeUpdate():this._abortSuperimposeSchedule()}_shouldDisableUnsupportedSuperimposeView(){return this.superimposeViewEnabled&&this.mode===`panoramic`&&!this.superimposeViewSupported}_hasActiveSuperimposeCameraContext(){return(this.mode==="default"||this.mode===`panoramic`)&&this.superimposeViewEnabled&&this.superimposeViewSupported&&this.state===`image-loaded`&&this.view?.type===`3d`&&!!this.view.camera}_abortSuperimposeSchedule(){this._superimposeScheduleController?.abort(),this._superimposeScheduleController=null,this._clearSuperimposeDebounceTimeout(),this._clearSuperimposeScheduledFrame()}_resetInactiveSuperimposeState(){let e=this._superimposePreviousCurrentCoverageVisible!=null;this._abortSuperimposeSchedule(),this._adapter?.disableDefaultSuperimposeNavigation?.(),this._adapter?.disablePanoramicSuperimposeNavigation?.(),this._superimposeService.clear(),this._restoreCurrentCoverageVisibilityAfterSuperimpose(),this._restoreDefaultMessageAfterSuperimpose(),e&&this._restoreViewerMediaAfterSuperimpose()}_restoreCurrentCoverageVisibilityAfterSuperimpose(){this._superimposePreviousCurrentCoverageVisible!=null&&(this.currentCoverageVisible=this._superimposePreviousCurrentCoverageVisible,this._superimposePreviousCurrentCoverageVisible=null)}_restoreViewerMediaAfterSuperimpose(){let{currentBestFeature:e,mode:t}=this;if(!e||t!=="default"&&t!==`panoramic`)return;this._restoreSuperimposeMediaTask?.abort();let n=i(async t=>{await this._loadCurrentFeatureMedia(e,{signal:t})});this._restoreSuperimposeMediaTask=n,n.promise.finally(()=>{this._restoreSuperimposeMediaTask===n&&(this._restoreSuperimposeMediaTask=null)})}_restoreDefaultMessageAfterSuperimpose(){this.displayMessage?.key===`superimposeImageDescription`&&(this.currentBestFeature&&(this.mode==="default"||this.mode===`panoramic`)?this.displayMessage=null:this.setMessage(`onLoadMessage`,`info`))}_clearSuperimposeDebounceTimeout(){this.superimposeDebounceTimeoutId!=null&&(clearTimeout(this.superimposeDebounceTimeoutId),this.superimposeDebounceTimeoutId=null)}_clearSuperimposeScheduledFrame(){this.superimposeScheduledFrameId!=null&&(cancelAnimationFrame(this.superimposeScheduledFrameId),this.superimposeScheduledFrameId=null)}_schedulePanoramicSuperimposeUpdate(){this._abortSuperimposeSchedule(),this.superimposeDebounceTimeoutId=window.setTimeout(()=>{this.superimposeDebounceTimeoutId=null,this._hasActiveSuperimposeCameraContext()&&this.mode===`panoramic`&&this._updateSuperimposedImage()},150)}_scheduleDefaultSuperimposeUpdate(){let e=this.view;if(!(e?.type===`3d`&&e)||this.superimposeScheduledFrameId)return;this._superimposeScheduleController?.abort();let t=new AbortController,{signal:n}=t,r=()=>{this._clearSuperimposeDebounceTimeout(),this._clearSuperimposeScheduledFrame(),this._superimposeScheduleController===t&&(this._superimposeScheduleController=null),n.removeEventListener(`abort`,r)};this._superimposeScheduleController=t,n.addEventListener(`abort`,r),this.superimposeScheduledFrameId=requestAnimationFrame(()=>{if(n.removeEventListener(`abort`,r),this.superimposeScheduledFrameId=null,this._superimposeScheduleController===t&&(this._superimposeScheduleController=null),n.aborted)return;let e=this.view,i=e?.type===`3d`?e:null;this._hasActiveSuperimposeCameraContext()&&i!=null&&!i.interacting&&!i.navigating&&this._updateSuperimposedImage()})}};e([D()],$.prototype,`activeLayer`,null),e([D({readOnly:!0})],$.prototype,`activeViewer`,null),e([D()],$.prototype,`activeTriangulatedViewer`,null),e([D()],$.prototype,`accuracyParametersMissing`,null),e([D()],$.prototype,`additionalFeatures`,void 0),e([D({type:a.ofType(t)})],$.prototype,`additionalCameraLocations`,void 0),e([D({type:a.ofType(t)})],$.prototype,`additionalFootprints`,void 0),e([D()],$.prototype,`areaMeasurementResult`,void 0),e([D()],$.prototype,`areaMeasurementAccuracy`,void 0),e([D()],$.prototype,`bestFeatureAngle`,void 0),e([D()],$.prototype,`bestFeatureCurrentFootprint`,void 0),e([D({type:t})],$.prototype,`bestFeatureFootprint`,void 0),e([D({type:Number})],$.prototype,`brightness`,null),e([D()],$.prototype,`cameraHeadingThreshold`,void 0),e([D()],$.prototype,`cameraPitchThreshold`,void 0),e([D()],$.prototype,`clickAction`,void 0),e([D()],$.prototype,`correctedLocationPointOnImage`,void 0),e([D()],$.prototype,`videoViewModel`,void 0),e([D()],$.prototype,`collectionId`,void 0),e([D({type:Number})],$.prototype,`contrast`,null),e([D()],$.prototype,`coverageFrustums`,void 0),e([D()],$.prototype,`coveragePolygons`,void 0),e([D()],$.prototype,`currentBestFeature`,void 0),e([D()],$.prototype,`currentBestFeatureMeasurementImage`,void 0),e([D()],$.prototype,`currentBestFeatureLocation`,void 0),e([D()],$.prototype,`currentCoverageVisible`,void 0),e([D()],$.prototype,`currentNode`,null),e([D()],$.prototype,`depthImage`,void 0),e([D()],$.prototype,`depthImageNotSupported`,null),e([D()],$.prototype,`featureCache`,void 0),e([D()],$.prototype,`videoFeatureIndex`,void 0),e([D()],$.prototype,`navigationNodes`,void 0),e([D({json:{write:!1}})],$.prototype,`determineWorkflowForFeature`,void 0),e([D({json:{write:!1}})],$.prototype,`determineWorkflowForTriangularMeasurement`,void 0),e([D()],$.prototype,`disabled`,void 0),e([D()],$.prototype,`displayMessage`,void 0),e([D()],$.prototype,`displayNewMeasurementButton`,void 0),e([D()],$.prototype,`distanceMeasurementResult`,void 0),e([D()],$.prototype,`distanceAccuracyArray`,void 0),e([D()],$.prototype,`dataCaptureLayer`,void 0),e([D({readOnly:!0})],$.prototype,`featureCount`,null),e([D()],$.prototype,`features`,void 0),e([D()],$.prototype,`groundCoordinates`,void 0),e([D()],$.prototype,`groundCoordinatesAccuracy`,void 0),e([D()],$.prototype,`groundCoordinatesAccuracyLoading`,void 0),e([D()],$.prototype,`hasPendingPanoramicNavigationViewState`,null),e([D()],$.prototype,`heightGraphic`,void 0),e([D()],$.prototype,`heightMeasurementResult`,void 0),e([D()],$.prototype,`heightMeasurementAccuracy`,void 0),e([D({readOnly:!0})],$.prototype,`imageGalleryEnabled`,null),e([D()],$.prototype,`imageGeometryField`,void 0),e([D({readOnly:!0})],$.prototype,`imageLoaded`,null),e([D()],$.prototype,`imageLocationToolState`,void 0),e([D()],$.prototype,`initialVideoMapViewExtent`,void 0),e([D({readOnly:!0})],$.prototype,`invalidCameraHeading`,null),e([D()],$.prototype,`imagePointsInView`,null),e([D()],$.prototype,`imageMeasurementViewer`,void 0),e([D()],$.prototype,`isAdditionalCoverageVisible`,void 0),e([D()],$.prototype,`isAdditionalPointSourcesVisible`,void 0),e([D()],$.prototype,`layer`,void 0),e([D()],$.prototype,`layerView`,null),e([D({readOnly:!0})],$.prototype,`layerFloorFilterClause`,null),e([D({readOnly:!0})],$.prototype,`layerTimeExtent`,null),e([D({type:Number})],$.prototype,`localPort`,void 0),e([D()],$.prototype,`locationPointOnImage`,void 0),e([D()],$.prototype,`mapImageConversionToolState`,void 0),e([D()],$.prototype,`measureType`,void 0),e([D()],$.prototype,`measurementGraphic`,void 0),e([D({readOnly:!0,value:`none`})],$.prototype,`mode`,null),e([D()],$.prototype,`navigationMode`,void 0),e([D()],$.prototype,`navigatorCurrentBestFeature`,void 0),e([D()],$.prototype,`oiObjectIdField`,void 0),e([D({type:a.ofType(t)})],$.prototype,`overlayedCameraLocations`,void 0),e([D()],$.prototype,`overlayedMapFeatures`,void 0),e([D()],$.prototype,`panoramicVideoLoaded`,null),e([D()],$.prototype,`panoramicVideoPaused`,null),e([D()],$.prototype,`pixelCoordinates`,void 0),e([D()],$.prototype,`preserveAngle`,void 0),e([D()],$.prototype,`pointSources`,void 0),e([D({readOnly:!0})],$.prototype,`popupEnabled`,null),e([D()],$.prototype,`preloadMedia`,void 0),e([D()],$.prototype,`preloadMediaSize`,void 0),e([D()],$.prototype,`previousFeatureAngle`,void 0),e([D()],$.prototype,`referencePoint`,null),e([D({readOnly:!0})],$.prototype,`sectorData`,null),e([D()],$.prototype,`selectedPoint`,void 0),e([D({type:Number})],$.prototype,`sharpness`,null),e([D()],$.prototype,`shouldShowSelectedImage`,void 0),e([D()],$.prototype,`superimposeViewEnabled`,void 0),e([D()],$.prototype,`defaultSuperimposeCameraLockEnabled`,void 0),e([D()],$.prototype,`superimposeViewSupported`,null),e([D()],$.prototype,`sketch`,void 0),e([D()],$.prototype,`sketchTriangular`,void 0),e([D()],$.prototype,`sketchTriangularGraphicsLayer`,void 0),e([D()],$.prototype,`draw`,void 0),e([D()],$.prototype,`drawAdapter`,void 0),e([D()],$.prototype,`polylineDrawAction`,void 0),e([D()],$.prototype,`scheduledFrameId`,void 0),e([D()],$.prototype,`superimposeScheduledFrameId`,void 0),e([D()],$.prototype,`superimposeDebounceTimeoutId`,void 0),e([D()],$.prototype,`sketchAdapter`,void 0),e([D({readOnly:!0})],$.prototype,`sketchGraphicsLayer`,null),e([D({readOnly:!0})],$.prototype,`state`,null),e([D({readOnly:!0})],$.prototype,`thumbnails`,null),e([D()],$.prototype,`videoExtentPoints`,null),e([D()],$.prototype,`triangularMeasurementActive`,void 0),e([D()],$.prototype,`triangulatedDistanceMeasurement`,void 0),e([D()],$.prototype,`triangulatedDistanceAccuracy`,void 0),e([D()],$.prototype,`triangulatedAreaMeasurement`,void 0),e([D()],$.prototype,`triangulatedAreaAccuracy`,void 0),e([D()],$.prototype,`triangulatedMeasurementGraphic`,void 0),e([D()],$.prototype,`triangulatedPoint`,void 0),e([D()],$.prototype,`triangulatedMeasurementAdapter`,void 0),e([D()],$.prototype,`updateFootprint`,void 0),e([D()],$.prototype,`updateVideoFootprint`,void 0),e([D()],$.prototype,`updateFootprintPanorama`,void 0),e([D()],$.prototype,`updatingTriangularMeasurementState`,void 0),e([D({value:null})],$.prototype,`view`,null),e([D()],$.prototype,`videoElement`,void 0),e([D()],$.prototype,`videoLayer`,void 0),e([D()],$.prototype,`videoMapView`,void 0),e([D()],$.prototype,`verticalFilterEnabled`,void 0),e([D()],$.prototype,`frustumSearchEnabled`,void 0),e([D()],$.prototype,`_adapter`,void 0),e([D()],$.prototype,`_defaultGraphicsLayer`,null),e([D()],$.prototype,`_highlightedFeatureHandle`,void 0),e([D()],$.prototype,`_imageViewer`,void 0),e([D()],$.prototype,`_initialCurrentCoverageUpdate`,void 0),e([D()],$.prototype,`_locationViewModel`,void 0),e([D()],$.prototype,`_measurementService`,void 0),e([D()],$.prototype,`_mediaPrefetcher`,void 0),e([D()],$.prototype,`_navigationManager`,void 0),e([D()],$.prototype,`_overlays`,void 0),e([D()],$.prototype,`_superimposePreviousCurrentCoverageVisible`,void 0),e([D()],$.prototype,`_superimposeService`,void 0),e([D({readOnly:!0})],$.prototype,`_overlaysView`,null),e([D()],$.prototype,`_panoramicVideoViewer`,void 0),e([D()],$.prototype,`_panoramicViewer`,void 0),e([D()],$.prototype,`_panoramicMeasurementViewer`,void 0),e([D()],$.prototype,`_referencePointOnGround`,void 0),e([D()],$.prototype,`_referencePointOnImage`,void 0),e([D()],$.prototype,`_referenceTransformationService`,void 0),e([D()],$.prototype,`_sectorData`,void 0),e([D()],$.prototype,`_transformationService`,void 0),e([D()],$.prototype,`_featureToSector`,void 0),e([D({readOnly:!0})],$.prototype,`_updatingHandles`,void 0),e([D()],$.prototype,`footprintExtent`,void 0),e([D()],$.prototype,`_featureChangedTask`,void 0),$=e([ne(`esri.widgets.OrientedImageryViewer.OrientedImageryViewerViewModel`)],$);const Et=$;export{Et as default};
|
|
2
|
+
import{__decorate as e}from"tslib";import t from"../../Graphic.js";import{equals as n,isSome as r}from"../../core/arrayUtils.js";import{createTask as i}from"../../core/asyncUtils.js";import a from"../../core/Collection.js";import{deprecatedProperty as o}from"../../core/deprecate.js";import s from"../../core/Error.js";import{EventedMixin as c}from"../../core/Evented.js";import{makeHandle as l}from"../../core/handleUtils.js";import{equalsShallow as u}from"../../core/lang.js";import d from"../../core/Logger.js";import{clamp as f,deg2rad as p}from"../../core/mathUtils.js";import{destroyMaybe as m,abortMaybe as h}from"../../core/maybe.js";import{EsriPromise as g}from"../../core/Promise.js";import{isAbortError as _,throwIfAborted as v,waitTick as y}from"../../core/promiseUtils.js";import b from"../../core/ReactiveMap.js";import{whenOnce as x,on as S,watch as C,syncAndInitial as w,initial as ee,when as te}from"../../core/reactiveUtils.js";import{sqlAnd as T}from"../../core/sql.js";import{getMetersPerUnitForSR as E}from"../../core/units.js";import{property as D,subclass as ne}from"../../core/accessorSupport/decorators.js";import{isSerializable as re}from"../../core/support/jsonUtils.js";import{UpdatingHandles as ie}from"../../core/support/UpdatingHandles.js";import ae from"../../geometry/Extent.js";import O from"../../geometry/Point.js";import{projectAsync as k}from"../../geometry/projectionUtils.js";import oe from"../../geometry/SpatialReference.js";import{polygonCentroidPoint as se}from"../../geometry/support/centroid.js";import{isClockwise as ce}from"../../geometry/support/coordsUtils.js";import{normalizeMapX as le}from"../../geometry/support/normalizeUtils.js";import{geographicToWebMercator as ue}from"../../geometry/support/webMercatorUtils.js";import A from"../../layers/GraphicsLayer.js";import de from"../../layers/MediaLayer.js";import{searchImages as j}from"../../layers/orientedImagery/queries.js";import{calculateSuitabilities as fe}from"../../layers/orientedImagery/core/bestImageUtils.js";import{computePolygonForInspection as pe,resizePolygon as me,checkIfFrustumContainsSelectedPoint as he,checkIfPolygonContainsSelectedPoint as ge}from"../../layers/orientedImagery/core/coverageUtils.js";import{isElevationSource as _e}from"../../layers/orientedImagery/core/ElevationSourceDefinitions.js";import{convertGeographicToWebMercator as M}from"../../layers/orientedImagery/core/utils.js";import ve from"../../layers/orientedImagery/transformations/updateElevation.js";import{getElevationSampler as ye}from"../../layers/orientedImagery/transformations/updateElevationUtils.js";import{or as be,getInitialAngle as N,convertPixelLocationToSphereVertex as xe,getUpdateElevationProps as P,adjustHorizonAngles as Se,convertOrientationToPixelLocation as Ce,getImageToWorldProperties as F}from"../../layers/orientedImagery/transformations/utils.js";import we from"../../layers/support/ExtentAndRotationGeoreference.js";import{getFloorFilterClause as Te}from"../../layers/support/floorFilterUtils.js";import Ee from"../../layers/support/VideoElement.js";import De from"../../views/MapView.js";import{distanceComparisonTolerance as Oe}from"../../views/3d/state/utils/navigationUtils.js";import ke from"../../views/draw/Draw.js";import{scale as Ae}from"../../views/draw/support/drawUtils.js";import{ViewEventPriorities as je}from"../../views/input/InputManager.js";import Me from"../PanoramicVideoViewer.js";import I from"../PanoramicViewer.js";import{defaultAngleThresholdInDegrees as L,videoMapViewConstraint as Ne,fixedImageSize as R,clockwiseDirections as Pe,videoFitScaleTolerance as Fe,videoExtent as z,invalidCameraHeading as B,sectorsInOrder as V,sampleExtent as Ie,sectorsRadii as H}from"./constants.js";import{createFeatureCoverage as U}from"./featureCoverage.js";import{isFeatureAttachment as W}from"./galleryUtils.js";import{getPanoramicImageProperties as G}from"./panoramicImageProperties.js";import{crossSymbol as K,crossSymbol3D as Le,measurementPolygonSymbol as Re,polylineSymbolPanoramic as ze,measurementPolylineSymbol as Be,cameraOverlaySymbol3D as Ve,cameraOverlaySymbol as He,diamondSymbol as q,diamondSymbol3D as J,activeSourcePointSymbol as Ue,sourcePointSymbol as We}from"./symbols.js";import{registryKeys as Y}from"./types.js";import{isNoAttachmentError as Ge,extractHorizonAnglesFromMedia as X,isDepthImage as Ke,isTifOrMrf as qe,filterOILLayerView as Je,assignElevationSampleToFeatures as Ye,filterByZ as Xe,createPanoramicMedia as Ze,createNonPanoramicMedia as Qe,isSceneView as $e,isGraphic as et,calculateSegment as tt,calculateDirection as nt}from"./utils.js";import{disableVideoZoomAndPan as rt,getUpdatedConstraints as it,getUpdatedExtentPoints as at,normalizeVideoSource as ot,isSelectedPointWithinVideoFootprint as st,isVideoPixelWithinFrame as ct}from"./videoViewerUtils.js";import lt from"./components/ImageViewer.js";import ut from"./components/NavigationNode.js";import dt from"./components/OrientedImageryVideoViewModel.js";import{NoFeatureFoundWithObjectIdError as ft}from"./navigation/errors.js";import{queryFeatureByObjectIds as pt}from"./navigation/queries.js";import{ImageMeasurementService as mt}from"./services/ImageMeasurementService.js";import ht from"./services/SuperimposeService.js";import{configureSketchTool as gt,extractFieldsFromDataCaptureLayer as _t,constructGraphicFromImageGeometry as vt}from"./support/dataCaptureUtils.js";import{removeZFromGeometry as yt,imageSpaceToPoint as Z,pointToImageSpace as bt}from"./support/geometryUtils.js";import{restorePanoramicNavigationViewState as xt,restoreDefaultNavigationViewState as St}from"./support/navigationViewStateUtils.js";import Ct from"./support/resolveMediaProps.js";import{isValidDataCaptureLayer as wt}from"./support/typeUtils.js";import Tt from"./support/VideoFeatureCache.js";const Q=()=>new s(`orientedimageryviewer:sketch-not-initialized`,`Sketch property is not initialized, call loadSketch first`);let $=class extends c(g){constructor(e){super(e),this.additionalFeatures=new a,this.additionalCameraLocations=new a,this.additionalFootprints=new a,this.areaMeasurementResult=0,this.areaMeasurementAccuracy=0,this.bestFeatureAngle=0,this.bestFeatureCurrentFootprint=null,this.bestFeatureFootprint=null,this.cameraHeadingThreshold=L,this.cameraPitchThreshold=L,this.clickAction=`hittest`,this.correctedLocationPointOnImage=null,this.videoViewModel=null,this.collectionId=null,this.coverageFrustums=new a,this.coveragePolygons=new a,this.currentBestFeature=null,this.currentBestFeatureMeasurementImage=null,this.currentBestFeatureLocation=null,this.currentCoverageVisible=!0,this.depthImage=null,this.featureCache=[],this.videoFeatureIndex=[],this.navigationNodes=new a,this.determineWorkflowForFeature=async(e,t,n)=>{let{currentBestFeature:r,selectedPoint:i}=this;if(this.emit(`popup-close`),r&&i){this.displayMessage=null,this._initialCurrentCoverageUpdate=!0;try{await this._updatePointsAndPolygons(n),await this._loadDepthImage(n),await this._loadCurrentFeatureMedia(r,n)}catch(e){_(e)||(this.loadImageError(e),d.getLogger(this).error(`#loadIImage()`,`error occured while loading image`,e))}}},this.determineWorkflowForTriangularMeasurement=async(e,t,n)=>{if(this.emit(`popup-close`),this.currentBestFeatureMeasurementImage&&this.selectedPoint)try{await this._loadMeasurementViewerImage(n)}catch(e){_(e)||(this.loadImageError(e),d.getLogger(this).error(`#loadIImage()`,`error occured while loading image`,e))}},this.disabled=!1,this.displayMessage={key:`onLoadMessage`,type:`info`},this.displayNewMeasurementButton=!0,this.distanceMeasurementResult=0,this.distanceAccuracyArray=[],this.dataCaptureLayer=null,this.features=new a,this.groundCoordinates=null,this.groundCoordinatesAccuracy=null,this.groundCoordinatesAccuracyLoading=!1,this.heightGraphic=null,this.heightMeasurementResult=0,this.heightMeasurementAccuracy=0,this.imageGeometryField=null,this.imageLocationToolState=!1,this.initialVideoMapViewExtent=null,this.imageMeasurementViewer=new lt,this.isAdditionalCoverageVisible=!1,this.isAdditionalPointSourcesVisible=!1,this.layer=null,this.localPort=null,this.locationPointOnImage=null,this.mapImageConversionToolState=!1,this.measureType=null,this.measurementGraphic=null,this.navigatorCurrentBestFeature=null,this.oiObjectIdField=null,this.overlayedCameraLocations=new a,this.overlayedMapFeatures=new b,this.pixelCoordinates=null,this.preserveAngle=`none`,this.pointSources=new a,this.preloadMedia=!1,this.preloadMediaSize=5,this.previousFeatureAngle=0,this.selectedPoint=null,this.shouldShowSelectedImage=!1,this.superimposeViewEnabled=!1,this.defaultSuperimposeCameraLockEnabled=!0,this.sketch=null,this.sketchTriangular=null,this.sketchTriangularGraphicsLayer=null,this.draw=null,this.drawAdapter=null,this.polylineDrawAction=null,this.scheduledFrameId=null,this.superimposeScheduledFrameId=null,this.superimposeDebounceTimeoutId=null,this.sketchAdapter=null,this.triangularMeasurementActive=!1,this.triangulatedDistanceMeasurement=null,this.triangulatedDistanceAccuracy=null,this.triangulatedAreaMeasurement=null,this.triangulatedAreaAccuracy=0,this.triangulatedMeasurementGraphic=null,this.triangulatedPoint=null,this.triangulatedMeasurementAdapter=null,this.updateFootprint=async(e,t,n)=>{(this.mode!=="default"||this.state===`image-loaded`)&&await this._adapter?.updateFootprint(e,t,n)},this.updateVideoFootprint=async e=>{this.mode.includes(`video`)&&this.videoElement?.content&&await this._adapter?.updateVideoFootprint(e)},this.updateFootprintPanorama=async(e,t)=>{await this._adapter?.updateFootprintPanorama(e,t)},this.updatingTriangularMeasurementState=!1,this.videoElement=null,this.videoLayer=null,this.videoMapView=new De({map:new Map,attributionVisible:!1,constraints:Ne}),this.verticalFilterEnabled=!1,this.frustumSearchEnabled=!1,this._adapter=null,this._highlightedFeatureHandle=null,this._imageViewer=new lt,this._initialCurrentCoverageUpdate=!0,this._locationViewModel=null,this._measurementService=null,this._mediaPrefetcher=null,this._navigationManager=null,this._overlays=new A({listMode:`hide`,internal:!0,elevationInfo:{mode:`absolute-height`},title:`OrentedImageryViewerViewModel overlays layer`}),this._superimposePreviousCurrentCoverageVisible=null,this._superimposeService=new ht({getMapPoint:(e,t)=>this.getMapPoint(e,t),getPanoramicTransformationState:()=>{let{imageToWorldProperties:e,mode:t,updateElevationProps:n}=this._transformationService;return t!==`panoramic`||!e?null:{imageToWorldProperties:e,updateElevationProps:n}},pointToPixel:(e,t)=>this._transformationService.pointToPixel(e,t),overlays:this._overlays,getPointAtDistance:(e,t,n)=>this._transformationService.pixelToPointAtDistance(e,t,n)}),this._panoramicVideoViewer=new Me,this._panoramicViewer=new I,this._panoramicMeasurementViewer=new I,this._referencePointOnGround=null,this._referencePointOnImage=null,this._referenceTransformationService=null,this._sectorData=null,this._transformationService=null,this._featureToSector=null,this._updatingHandles=new ie,this._clickTask=null,this._crossSymbol=null,this._cameraOverlayTask=null,this.footprintExtent=null,this._featureChangedTask=null,this._mediaPrefetchTask=null,this._navigationViewStateTask=null,this._pendingPanoramicNavigationViewState=null,this._restoreSuperimposeMediaTask=null,this._superimposeScheduleController=null,this._suitabilities=null,this._pendingDefaultNavigationViewState=null,this._transformController=new AbortController,this._updateFootprintTask=null,this._videoFeatureCache=new Tt,this.addUpdatingPromise=e=>this._updatingHandles.addPromise(e),this.filterCapturedFeatures=e=>{let t=this.currentBestFeature?.attributes.objectId,n=this.layer?.imageReferenceField;t&&e&&n&&this.overlayedMapFeatures.get(e)?.forEach(e=>{let r=e.attributes??{},i=Object.keys(r).find(e=>e.toLowerCase()===n.toLowerCase());(i?r[i]:null)!==t&&(e.visible=!e.visible)})},this.hideImageGeometry=e=>{},this.highlight=e=>{if(!this._overlaysView)return;this.removeHighlight();let t=this.additionalFootprints.find(({attributes:{imageID:t}})=>t===Number(e));this._highlightedFeatureHandle=t?this._overlaysView?.highlight(t):null},this.loadDataCaptureAdapter=async e=>{await this.loadSketch(e);let{default:t}=await import(`./adapters/sketch/DataCaptureAdapter.js`);return v(e),this.sketchAdapter=new t({viewModel:this}),this.sketchAdapter},this.loadImageFromFeature=(e,t,n)=>this._updatingHandles.addPromise(this._loadImageFromFeature(e,t,n)),this.storeImageMeasurementViewer=e=>{this.imageMeasurementViewer=e},this.storePanoramicMeasurementViewer=e=>{this._panoramicMeasurementViewer=e},this.loadImageViewer=e=>{this._imageViewer?.destroy(),this._imageViewer=e},this.loadPanoramicViewer=e=>{this._panoramicViewer?.destroy(),this._panoramicViewer=e},this.loadPanoramicVideoViewer=e=>{this._panoramicVideoViewer?.destroy(),this._panoramicVideoViewer=e},this.loadVideoViewer=e=>{this.videoMapView.container=e},this.showImageByObjectId=async(e,t)=>{let n=this.additionalFeatures.find(({attributes:t})=>t.objectId===e);if(n&&t?.selectedPoint==null)this.currentBestFeature=n;else{let{layer:n,layerFloorFilterClause:r,layerTimeExtent:i}=this;if(!n){this.setMessage(`noLayerSelected`,`info`);return}this.beforeLoad();let a=this._updatingHandles.addPromise(this._queryAndLoadByObjectId(n,e,r,i,t));try{await a,await this.selectBestFeature(e,t)}catch(t){_(t)||(d.getLogger(this).error(`oriented-imagery-viewer:show-image`,t),t.name===`NoFeatureFoundWithObjectIdError`?this.setMessage(`noFeatureFoundWithObjectId`,`error`,``,{objectId:e}):this.setMessage(`imageLoadError`,`error`,t.message))}}},this.getSectorFeatureById=e=>this._suitabilities?.find(({feature:{attributes:{objectId:t}}})=>t===e),this.getFeatureSectorById=e=>this._featureToSector?.[`${e}`],this.navigate=async(e,t)=>{let{mode:n}=this;if(n!=="default"&&n!==`panoramic`)throw new s(`NavigationError`,`Navigation is only supported in 'default' and 'panoramic' modes.`);if(this._pendingDefaultNavigationViewState=null,this._pendingPanoramicNavigationViewState=null,this._navigationManager==null||!(e=>n==="default"&&e.declaredClass.endsWith(`NavigationManager`)||n===`panoramic`&&e.declaredClass.endsWith(`NavigationManagerPanoramic`))(this._navigationManager)){m(this._navigationManager);let e=n==="default"?import(`./navigation/NavigationManager.js`):import(`./navigation/NavigationManagerPanoramic.js`);this._navigationManager=new(await e).default({viewModel:this})}return this._navigationManager.navigate(e,t)},this.removeHighlight=()=>this._highlightedFeatureHandle?.remove(),this.revealImageGeometry=e=>{},this.selectBestFeature=async(e,t)=>(v(t),this.currentBestFeature=this.features?.find(({attributes:t})=>`${t.objectId}`==`${e}`),x(()=>{switch(this.mode){case`video`:return this.state===`video-loaded`;case`panoramic-video`:return this.panoramicVideoLoaded;default:return this.state===`image-loaded`}},t)),this.toggleImageAttributes=()=>{let{currentBestFeature:e,popupEnabled:n,layer:r,view:i}=this;if(this.emit(`popup-close`),!i||!e||!n||!r)return;let{attributes:a,geometry:o}=e,s=new t({geometry:o,attributes:a.toJSON(),origin:r.graphicOrigin,sourceLayer:r});this.emit(`popup-open`,{features:[s],location:a.location.clone()})},this.updateSuitabilities=(e,t=!0)=>{e.sort((e,t)=>e.suitability-t.suitability),this._suitabilities=e;let n=this._suitabilities.map(({feature:e})=>e);this._initialCurrentCoverageUpdate=!0,this._updateFeatures(n,t),this._groupFeaturesBySectors()},this._computeOverlayImageSize=()=>{let{mode:e}=this;return e===`video`?R:e===`panoramic-video`?this._panoramicVideoViewer.imageSize:this.activeViewer?.imageSize},this._geometryToOverlayImageGeometry=async(e,t,n,r)=>{let{mode:i,videoViewModel:a,_panoramicVideoViewer:o}=this;if(i===`video`)return await a?.geometryToOverlayGeometry(e,t,r)??null;if(i===`panoramic-video`){let a={feature:t,mode:i,imageSize:n,footprintExtent:this.footprintExtent};return await this._transformationService.geometryToImageGeometryForFeature(e,a,o.horizonAngles,r)}return await this._transformationService.geometryToImageGeometry(e,r)},this._createViewClickHandle=()=>{if(this.removeHandles(Y.click),this.disabled||this.view==null)return;let e=this.mapImageConversionToolState&&(this.state===`image-loaded`||this.state===`video-loaded`&&this.mode===`video`&&this.videoViewModel?.videoPaused||this.panoramicVideoLoaded&&this.mode===`panoramic-video`&&this.panoramicVideoPaused)?this._mapImageConversionToolViewClickHandler:this._viewClickHandler;this.addHandles(this.view.on(`click`,e,je.DEFAULT),Y.click)},this._createImageClickHandle=()=>{this.removeHandles(Y.imageClick),this.videoViewModel?.syncMapImageConversionHandle();let{mapImageConversionToolState:e,mode:t,footprintExtent:n,panoramicVideoLoaded:r}=this,a=t===`panoramic-video`?this._panoramicVideoViewer:this.activeViewer,o=a?.imageSize;if(!e||t===`none`||t===`video`||!o||!n)return;let s=t===`panoramic-video`,c=this._getActiveFeatureForCurrentMode(),u=!s||r&&this.panoramicVideoPaused;if(!c||!u)return;let d=a.clickAction;this.clickAction=`pixel-location`;let f=l(()=>{this.clickAction=d}),p=null,m=S(()=>a,`pixel-location`,e=>{this.plotReferencePointOnImage(e),p?.abort(),p=i(async r=>{if(!e)return;let i=this._getActiveFeatureForCurrentMode();if(!i)return;let a={feature:i,mode:t,imageSize:o,footprintExtent:n},c=s?await this.getMapPointForFeature(e,a,{signal:r}):await this._transformationService.pixelToMapPoint(e),l=this.view?.spatialReference;c&&!be(!l,c.spatialReference.equals(l))&&(c=await k(c,l,{signal:r})),v(r),this.plotReferencePointOnGround(c)})});this.addHandles([m,f],Y.imageClick)},this._createTriangularImageClickHandle=()=>{this.removeHandles(Y.triangularImageClick),this.triangularMeasurementActive&&this.mode!==`none`&&this.currentBestFeature&&this.currentBestFeatureMeasurementImage&&this.activeTriangulatedViewer&&this.addHandles(this.activeTriangulatedViewer.imageRenderer.on(`double-click`,this._measurementImageClickHandler),Y.triangularImageClick)},this._enablePan=()=>{this.removeHandles(Y.videoPanHandles)},this._disablePan=()=>{this.removeHandles(Y.videoPanHandles),this.addHandles(rt(this.videoMapView),Y.videoPanHandles)},this._handleImageHitTestResponse=async e=>{let{layer:t,overlayedCameraLocations:n}=this;if(!t)return;let r=e.results.find(({graphic:e,graphic:{attributes:r}})=>n.includes(e)&&r&&!r[t.imageReferenceField]&&!r[t.imageGeometryField]);if(!r)return;let i=r.graphic.attributes[t.objectIdField];await this.showImageByObjectId(i)},this._loadCurrentFeatureMedia=async(e,t)=>{this.mode===`video`?await this._loadFlatVideo(e,t):this.mode===`panoramic-video`?await this._loadVideo(t):await this._loadImage(t)},this._loadFlatVideo=async(e,t)=>{this._initializeVideo(),this.videoViewModel?.playVideoFromSelectedLocation(e);let n=e.attributes.objectId;this._waitForFlatVideoAndPlotSelectedLocation(e,n,t)},this._waitForFlatVideoAndPlotSelectedLocation=async(e,t,n)=>{try{if(await x(()=>this.videoElement?.loaded===!0,n),`${this.currentBestFeature?.attributes.objectId}`!=`${t}`)return;await this.transformAndPlotSelectedLocation(n)}catch(t){_(t)||d.getLogger(this).error(`failed to plot selected point on video`,{error:t,selectedPoint:this.selectedPoint,feature:e})}},this._loadDepthImage=async e=>{let{currentBestFeature:t,layer:n,depthImageNotSupported:r}=this;if(this.depthImage?.destroy(),this.depthImage=null,!n||!t||r)return;let{depthImage:i}=t.attributes;if(!i)return;let a=(await import(`./services/DepthImageService.js`)).default;v(e),this.depthImage=new a({url:i});try{await this.depthImage.load(e)}catch(e){_(e)||(d.getLogger(this).error(`error occurred while loading depth image`,e),this.depthImage?.destroy(),this.depthImage=null)}},this._loadImage=async e=>{let{currentBestFeature:t,layer:n,mode:r}=this,i=this._pendingDefaultNavigationViewState;if(this._pendingDefaultNavigationViewState=null,this.clearGraphics(),n&&t&&r!==`none`&&r!==`video`&&r!==`panoramic-video`)try{if(await this.loadImageFromFeature(n,t,e),v(e),i)try{await this._restoreNavigationViewState(i,e)}catch(e){if(_(e))throw e;d.getLogger(this).warn(`oriented-imagery-viewer:failed-to-restore-navigation-view-state`,e)}await this.transformAndPlotSelectedLocation(e)}catch(e){_(e)||this.loadImageError(e)}},this._loadVideo=async e=>{let{currentBestFeature:t,mode:n,selectedPoint:r}=this,i=t?.attributes.imagePath;if(!t||n!==`panoramic-video`||!i)return;let{attributes:a}=t,{cameraPitch:o,cameraOrientation:s,location:c}=a,l=c.spatialReference.isWGS84&&s?.type!==4?ue(c):new O(c);try{this._panoramicVideoViewer.viewModel.video&&(this._panoramicVideoViewer.viewModel.video.pause(),this._panoramicVideoViewer.viewModel.videoPaused=!0),this._panoramicVideoViewer.videoSource=i;let t=0;l&&r&&(t=await N(l,r)-t),this._panoramicVideoViewer.pitch=o??0,this._panoramicVideoViewer.yaw=t,await this._panoramicVideoViewer.loadVideo(e),v(e)}catch(e){_(e)||this.loadImageError(e)}},this._loadImageFromFeature=async(e,t,n)=>{let{mode:r}=this;if(r!=="default"&&r!==`panoramic`)return;let i;try{i=await Ct(t.attributes,e,n),v(n)}catch(n){if(_(n))return;if(Ge(n)){d.getLogger(this).error(n),this.setMessage(`noAttachment`,`error`,`${e.objectIdField}: ${t.attributes.objectId}`);return}d.getLogger(this).error(n,{[e.objectIdField]:t.attributes.objectId,layer:e}),this.setMessage(`imageLoadError`,`error`,`query-attachments-failed:${e.objectIdField} ${t.attributes.objectId}`);return}if(!i)return;let{mediaUrl:a,datasetFormat:o,rotation:s,searchParams:c,location:l,cameraHeading:u,matrix:f,cameraPitch:p,getDataSetFormatError:m}=i,h=`${t.attributes.objectId}`;try{let i=this._mediaPrefetcher?.getCachedMedia(h);if(!i){let n=this.navigationNodes.find(e=>e.id===t.attributes.objectId);if(n){try{await this._mediaPrefetcher?.startPrefetchForNode(n,e)}catch{}i=this._mediaPrefetcher?.getCachedMedia(h)}}if(i){if(r===`panoramic`){let e=this.triangularMeasurementActive?this._panoramicMeasurementViewer:this._panoramicViewer,r=0;l&&this.selectedPoint&&(r=await N(l,this.selectedPoint)-r),await e.loadMedia(i,n),this.selectedPoint?e.set({yaw:r,pitch:p}):`viewAngle`in t.attributes&&Number.isFinite(t.attributes.viewAngle)&&e.set({yaw:t.attributes.viewAngle,pitch:p}),this.triangularMeasurementActive?await this.initializeReferenceTransformationService(n):await this.initializeTransformationService(n);return}await this._setImageSource(this.triangularMeasurementActive?this.imageMeasurementViewer:this._imageViewer,i,n),this.triangularMeasurementActive?await this.initializeReferenceTransformationService(n):await this.initializeTransformationService(n);return}}catch{}m&&d.getLogger(this).warn(`error occurred while getting dataset format`,m),r===`panoramic`?await this.loadPanoramicMediaSource({lookAt:{yaw:this.selectedPoint?await N(l,this.selectedPoint):`viewAngle`in t.attributes&&Number.isFinite(t.attributes.viewAngle)?t.attributes.viewAngle:0,pitch:p},extension:o?.toUpperCase(),url:a,cameraHeading:u,matrix:f},n):await this.loadMediaSource({datasetFormat:o?.toUpperCase(),url:a,customParameters:c,rotation:s},n),this.triangularMeasurementActive?await this.initializeReferenceTransformationService(n):await this.initializeTransformationService(n)},this._loadMeasurementViewerImage=async e=>{let{currentBestFeatureMeasurementImage:t,layer:n,mode:r}=this;if(this.imageMeasurementViewer.clearGraphics(),this._panoramicMeasurementViewer.clearGraphics(),n&&t&&r!==`none`&&r!==`video`&&r!==`panoramic-video`)try{await this.loadImageFromFeature(n,t,e),v(e)}catch(e){_(e)||this.loadImageError(e)}},this._loadMediaPrefetcher=async e=>{if(!this._mediaPrefetcher){let{default:t}=await import(`./support/MediaPrefetcher.js`);v(e),this._mediaPrefetcher=new t({maxEntries:this.preloadMediaSize*Pe.length})}return this._mediaPrefetcher},this._loadViewAdapter=async e=>{let{view:t}=this;if(this._adapter?.disableDefaultSuperimposeNavigation?.(),this._adapter?.disablePanoramicSuperimposeNavigation?.(),!t)this._adapter=null;else switch(t.type){case`2d`:{let{default:t}=await import(`./adapters/view/MapViewAdapter.js`);v(e),this._adapter=new t(this);break}case`3d`:{let{default:t}=await import(`./adapters/view/SceneViewAdapter.js`);v(e),this._adapter=new t(this);break}}},this._mapImageConversionToolViewClickHandler=e=>{if(e.stopPropagation(),e.preventDefault(),e.mapPoint){let t=e.mapPoint;t.x=le(t.x,t.spatialReference),this.plotMapPoint(e.mapPoint)}},this._measurementImageClickHandler=e=>{e.stopPropagation(),e.preventDefault();let{sketchTriangular:t,triangularMeasurementActive:n,currentBestFeatureMeasurementImage:r,triangulatedMeasurementGraphic:i}=this;t&&n&&r&&i&&t.state!==`active`&&(t.update([i],{tool:`reshape`}),this.updatingTriangularMeasurementState=!0)},this._updateInteraction=()=>{let e=this.videoMapView.extent;if(!e)return;let{minScale:t}=this.videoMapView.constraints,n=this.videoMapView.scale<t-Fe,r=it(e);n&&r?(this._enablePan(),this.videoMapView.constraints.geometry=r):n?(this._disablePan(),this.videoMapView.constraints.geometry=null):(this.initialVideoMapViewExtent&&!this.videoMapView.extent.equals(this.initialVideoMapViewExtent)&&(this.videoMapView.extent=this.initialVideoMapViewExtent),this._disablePan(),this.videoMapView.constraints.geometry=null)},this._viewClickHandler=e=>{this._clickTask?.abort(),this._clickTask=i(async t=>{let{pointerType:n,button:r,mapPoint:i}=e;if(n===`mouse`&&r!==0||!i)return;e.stopPropagation(),e.preventDefault();let{view:a,layer:o}=this;if(a){if(!o)this.setMessage(`noLayerSelected`,`info`);else{if(this.shouldShowSelectedImage){let n=a.hitTest(e,{include:[o]});this._updatingHandles.addPromise(n);let r=await n;return v(t),await this._processHitTestResults(o,r,{signal:t})}return this._updatingHandles.addPromise(this.loadBestImage(i,{signal:t}))}}})},this.plotSelectedPointOnImage=async(e,n)=>{if(await y(n),!e)return;let r=new O({...re(e)?e.toJSON():e});if(this.mode==="default")r.x-=.5,r.y=.5-r.y,r.spatialReference=this._imageViewer.imageRenderer.spatialReference.clone(),this._crossSymbol=new t({geometry:r,symbol:K}),this._imageViewer.addGraphic(this._crossSymbol,0);else if(this.mode===`video`)this._crossSymbol=this.videoViewModel?.plotSelectedPointOnVideo(r)??null;else if(this.mode===`panoramic`){let{imageSize:n,media:r}=this._panoramicViewer;if(!n||!r)return;let i=X(r),a=xe(e,...n,i);this._crossSymbol=new t({geometry:new O({x:a[0],y:a[1],z:a[2],m:a[3],spatialReference:oe.WebMercator}),symbol:Le}),this._panoramicViewer.addGraphic(this._crossSymbol,0)}},this.handleSectorClick=this.handleSectorClick.bind(this),this.searchBestImage=this.searchBestImage.bind(this),this.transformAndPlotReferencePointOnImage=this.transformAndPlotReferencePointOnImage.bind(this)}initialize(){this.addHandles([C(()=>this.view,()=>this.load(),w),C(()=>this.view?.map,(e,t)=>{t?.layers.remove(this._overlays),e?.layers.add(this._overlays)},ee),C(()=>this.view?.map?.allLayers?.length,e=>{e&&this.view?.map?.layers.reorder(this._overlays,e-1)},ee),C(()=>[this.state,this.panoramicVideoLoaded,this.mapImageConversionToolState,this.view,this.disabled,this.panoramicVideoPaused,this.videoViewModel?.videoPaused],(e,t)=>{let n=e[2];t?.[2]&&!n&&(this.plotReferencePointOnGround(null),this.clearReferencePointOnImage()),this._createViewClickHandle(),this._createImageClickHandle()},w),C(()=>[this.triangularMeasurementActive,this.currentBestFeatureMeasurementImage],()=>{this._createTriangularImageClickHandle()},w),C(()=>[this.state,this.imageLocationToolState,this.view],()=>{this._initializeMeasurementService(),this._initializeLocationViewModel()},w),C(()=>this.measureType,()=>{this.clearPreviousMeasurements(),this._initializeMeasurementService()},w),C(()=>this.bestFeatureAngle,(e,t)=>{this.previousFeatureAngle=t??0},w),C(()=>[this.superimposeViewEnabled,this.defaultSuperimposeCameraLockEnabled,this.superimposeViewSupported,this.currentBestFeature,this.mode,this.state,this.view?.type],()=>{this._shouldDisableUnsupportedSuperimposeView()?this.superimposeViewEnabled=!1:this._hasActiveSuperimposeCameraContext()?this._updateSuperimposedImage():this._resetInactiveSuperimposeState()},w),C(()=>this._getSuperimposeCameraWatchState(),()=>this._handleSuperimposeCameraChange(),w),C(()=>this.currentBestFeature,async(e,t)=>{h(this._featureChangedTask),this._featureChangedTask=i(async n=>this.determineWorkflowForFeature.apply(this,[e,t,{signal:n}])),await this._featureChangedTask.promise},{sync:!0}),C(()=>[this.currentNode,this.preloadMedia,this.navigationMode],()=>{this._mediaPrefetchTask?.abort(),this._mediaPrefetchTask=i(async e=>{this.preloadMedia&&this.navigationMode!=null?(this._mediaPrefetcher??=await this._loadMediaPrefetcher({signal:e}),v(e),this.navigationMode===`directional`?this._mediaPrefetcher.enqueueDirectionalPrefetch(this.layer,this.currentNode,this.preloadMediaSize):this._mediaPrefetcher.enqueueSequentialPrefetch(this.layer,this.currentNode,this.preloadMediaSize)):this._mediaPrefetcher?.clear()})},w),C(()=>this.currentBestFeatureMeasurementImage,(e,t)=>{h(this._featureChangedTask),t&&e!==t&&(this.triangulatedPoint=null,this.sketchTriangularGraphicsLayer?.graphics.destroyAll(),this._measurementService?.resetMeasurementVectors()),this._featureChangedTask=i(async n=>{await this.determineWorkflowForTriangularMeasurement(e,t,{signal:n}),v(n),this._reorderTriangularSketchLayer()})},w),C(()=>this.triangularMeasurementActive,(e,t)=>{t&&!e&&(this._measurementService?.resetMeasurementVectors(),this.currentBestFeatureMeasurementImage=null,this.triangulatedDistanceMeasurement=null,this.triangulatedMeasurementGraphic=null,this.triangulatedPoint=null,this.updatingTriangularMeasurementState=!1,this.triangulatedAreaMeasurement=null,this.triangulatedDistanceAccuracy=null,this.triangulatedAreaAccuracy=0,this.sketchTriangularGraphicsLayer?.graphics.destroyAll(),this.clearReferencePointOnImage(),this.imageMeasurementViewer.clearImage(),this.imageMeasurementViewer.clearGraphics(),this._panoramicMeasurementViewer.clearImage(),this._panoramicMeasurementViewer.clearGraphics())}),C(()=>this.mode,e=>{switch(this.removeHandles(Y.interactionHandles),e){case`default`:this.addHandles(C(()=>{let{state:e}=this;return e===`image-loaded`?this._imageViewer.imagePointsInView:null},e=>{e&&(h(this._updateFootprintTask),this._updateFootprintTask=i(async t=>{await this.updateFootprint(e,void 0,{signal:t})}))},{...w,equals:(e,t)=>n(e,t,u)}),Y.interactionHandles);break;case`video`:this.addHandles(C(()=>{let{footprintExtent:e,videoElement:t,bestFeatureFootprint:n}=this;if(e&&t?.loaded&&n)return{videoExtent:z,bestFeatureFootprint:n}},e=>{e?.videoExtent&&e?.bestFeatureFootprint&&(h(this._updateFootprintTask),this._updateFootprintTask=i(async t=>{let n={points:e.videoExtent,feature:void 0,scale:void 0,options:{signal:t}};await this.updateVideoFootprint(n)}))},{...w,equals:(e,t)=>n(e?.videoExtent,t?.videoExtent,u)&&e?.bestFeatureFootprint===t?.bestFeatureFootprint}),Y.interactionHandles);break;case`panoramic`:this.addHandles(C(()=>{let{currentBestFeature:e,state:t,_panoramicViewer:n}=this,{imageSize:r,vfov:i,hfov:a,pitch:o,yaw:s}=n;return!e||!r||t.includes(`loading`)||i==null||a==null||o==null||s==null?null:[i,a,s,o]},e=>{if(!e||this.state.includes(`loading`))return;let[t,n,r,a]=e;this.currentNode&&(this.currentNode.currentHeading=r,this.currentNode.currentPitch=a),h(this._updateFootprintTask),this._updateFootprintTask=i(async e=>{await this.updateFootprintPanorama({verticalFieldOfView:t,horizontalFieldOfView:n,yaw:r,pitch:a},{signal:e}),this._updateFootprintTask=null})},{equals:(e,t)=>n(e,t,u)}),Y.interactionHandles);break;case`panoramic-video`:this.addHandles(C(()=>{let{currentBestFeature:e,state:t,_panoramicVideoViewer:n}=this,{imageSize:r,vfov:i,hfov:a,pitch:o,yaw:s,viewModel:c}=n,l=c.closestFeature??e;return!l||!r||t.includes(`loading`)||i==null||a==null||o==null||s==null?null:[i,a,s,o,l]},e=>{if(!e)return;let[t,n,r,a,o]=e;h(this._updateFootprintTask),this._updateFootprintTask=i(async e=>{await this.updateFootprintPanorama({verticalFieldOfView:t,horizontalFieldOfView:n,yaw:r,pitch:a,feature:o,horizonAngles:this._panoramicVideoViewer.horizonAngles},{signal:e}),v(e),this._updateFootprintTask=null})},{equals:(e,t)=>n(e,t,u)}),Y.interactionHandles)}},w),C(()=>[this.brightness,this.contrast,this.sharpness],()=>{let{_imageViewer:e,brightness:t,contrast:n,mode:r,sharpness:i}=this;r==="default"&&(e.brightness=t,e.contrast=n,e.sharpness=i)},w),C(()=>this.activeViewer?.imageRenderer,()=>{this.sketch&&(this.sketch.view=this.activeViewer?.imageRenderer)}),C(()=>this.activeViewer,e=>{this.removeHandles(Y.hittestHandles),e&&this.addHandles(S(()=>e,`hittest-response`,this._handleImageHitTestResponse),Y.hittestHandles)}),C(()=>this.videoMapView.extent,async()=>{this._scheduleVideoInteractionUpdate();let e=this.videoViewModel?.closestFeature;e&&(h(this._updateFootprintTask),this._updateFootprintTask=i(async t=>{let n={points:this.videoExtentPoints,feature:e,options:{signal:t}};await this.updateVideoFootprint(n)}))}),C(()=>[this.videoMapView.interacting,this.videoMapView.navigating,this.videoMapView.scale],()=>{this._scheduleVideoInteractionUpdate()},{initial:!0}),te(()=>this.videoMapView.extent!=null,()=>{this.initialVideoMapViewExtent=this.videoMapView.extent},{once:!0})]),this.when().finally(()=>{this.notifyChange(`state`)})}destroy(){this._adapter?.disableDefaultSuperimposeNavigation?.(),this._adapter?.disablePanoramicSuperimposeNavigation?.(),this._abortSuperimposeSchedule(),this.currentBestFeature=null,this._updateFootprintTask=h(this._updateFootprintTask),this._clickTask=h(this._clickTask),this._cameraOverlayTask=h(this._cameraOverlayTask),this._navigationViewStateTask=h(this._navigationViewStateTask),this._restoreSuperimposeMediaTask=h(this._restoreSuperimposeMediaTask),this.coverageFrustums.destroy(),this.coveragePolygons.destroy(),this.pointSources.destroy(),this.additionalFootprints.destroy(),this.additionalCameraLocations.destroy(),this.bestFeatureFootprint=m(this.bestFeatureFootprint),this.bestFeatureCurrentFootprint=m(this.bestFeatureCurrentFootprint),this.videoViewModel=m(this.videoViewModel),this._locationViewModel=m(this._locationViewModel),this.clearSelectedPointOnViewer(),this._referencePointOnGround=m(this._referencePointOnGround),this.clearReferencePointOnImage(),this._superimposeService.destroy(),this._overlays&&this.view?.map?.remove(this._overlays),this._overlays.destroy(),this._imageViewer.destroy(),this.imageMeasurementViewer.destroy(),this._panoramicViewer.destroy(),this._panoramicVideoViewer.destroy(),this._panoramicMeasurementViewer.destroy(),this._mediaPrefetcher?.destroy(),this._videoFeatureCache.destroy()}get activeLayer(){return o(d.getLogger(this),`activeLayer`,{replacement:`layer`}),this.layer}set activeLayer(e){o(d.getLogger(this),`activeLayer`,{replacement:`layer`}),this.layer=e}get activeViewer(){let{_imageViewer:e,_panoramicViewer:t,mode:n}=this;switch(n){case`default`:return e;case`panoramic`:return t;default:return null}}get activeTriangulatedViewer(){switch(this.mode){case`default`:return this.imageMeasurementViewer;case`panoramic`:return this._panoramicMeasurementViewer;default:return null}}get accuracyParametersMissing(){let e=this.currentBestFeature?.attributes.orientationAccuracy;return!e||e.every(e=>e===0)}get brightness(){return this._get(`brightness`)??0}set brightness(e){this._set(`brightness`,f(e,-10,10))}get contrast(){return this._get(`contrast`)??0}set contrast(e){this._set(`contrast`,f(e,-10,10))}get currentNode(){let{currentBestFeature:e,navigationNodes:t}=this;return t.find(t=>t.id===e?.attributes.objectId)}get depthImageNotSupported(){if(this.currentBestFeature?.attributes.depthImage)return!Ke(this.currentBestFeature.attributes.depthImage)}get featureCount(){return this.features?.length??0}get hasPendingPanoramicNavigationViewState(){return this._pendingPanoramicNavigationViewState!=null}get imageGalleryEnabled(){let{currentBestFeature:e}=this;if(!e)return!1;let t=e.attributes.imagePath?.trim();return qe(t)||W(t)}get imageLoaded(){return o(d.getLogger(this),`imageLoaded`,{replacement:`Use OrientedImageryViewer.state === "image-loaded"`,version:`4.29`,warnOnce:!0}),this.state===`image-loaded`}get invalidCameraHeading(){return this.currentBestFeature?.attributes?.cameraHeading===B}get imagePointsInView(){let{mode:e,_imageViewer:t}=this;return e==="default"?t.imagePointsInView:null}get layerView(){let{layer:e,view:t}=this;if(e&&t)return t.allLayerViews.find(Je(e))}get layerFloorFilterClause(){let{layerView:e}=this;return e?Te(e):null}get layerTimeExtent(){return this.layerView?.timeExtent??null}get mode(){let e=this.currentBestFeature?.attributes;if(!e)return`none`;let t=e.orientedImageryType;if(t?.includes(`video`))return t.includes(`360`)?`panoramic-video`:`video`;let{horizontalFieldOfView:n,isSpherical:r}=e;return n===360||r?`panoramic`:`default`}get panoramicVideoLoaded(){let{mode:e,_panoramicVideoViewer:t}=this,{videoLoaded:n}=t.viewModel;return e===`panoramic-video`&&n===!0}get overlayGraphicsEnabled(){let{mode:e,state:t,panoramicVideoLoaded:n,videoViewModel:r,panoramicVideoPaused:i}=this;return t===`image-loaded`||e===`video`&&t===`video-loaded`&&r?.videoPaused===!0||e===`panoramic-video`&&n&&i}get panoramicVideoPaused(){return!!this._panoramicVideoViewer.viewModel.videoPaused}get popupEnabled(){return this.layer?.popupEnabled===!0}get referencePoint(){return this._referencePointOnGround?.geometry}get sectorData(){let{_sectorData:e}=this;return e?V.map(t=>e[t]):null}get sharpness(){return this._get(`sharpness`)??0}set sharpness(e){this._set(`sharpness`,f(e,0,1))}get superimposeViewSupported(){return this.mode==="default"||this.mode===`panoramic`}get sketchGraphicsLayer(){let{sketch:e}=this;return e?.layer?.type===`graphics`?e.layer:void 0}get state(){let{mode:e,_updatingHandles:{updating:t},_featureChangedTask:n,_navigationManager:r}=this;if(!this.isFulfilled()||t||n?.finished===!1||r?.navigating)return`loading`;if(this.isRejected())return`error`;if(this.displayMessage?.type===`error`)return`image-load-error`;switch(e){case`default`:return this._imageViewer.state;case`panoramic`:return this._panoramicViewer.state;case`video`:return this.videoElement?.loaded?`video-loaded`:`video-not-loaded`;case`panoramic-video`:return this.panoramicVideoLoaded?`video-loaded`:`video-not-loaded`}return`ready`}get thumbnails(){let{features:e}=this;return e?new a(e.map(({attributes:{imagePath:e,objectId:t,cameraRoll:n,imageRotation:r}})=>{let i=e?.trim();return qe(i)||W(i)?{url:i,objectId:t,rotation:(n??0)+(r??0)}:null}).filter(r)):null}get videoExtentPoints(){let e=at(this.videoMapView.extent);return e.length?e:z}set view(e){this._set(`view`,e)}get _defaultGraphicsLayer(){let e={blendMode:`source-atop`};switch(this.mode){case`panoramic`:return new A({...e,elevationInfo:{mode:`absolute-height`}});case`default`:return new A({...e});default:return}}get _overlaysView(){return this.view?.layerViews.find(({layer:e})=>e===this._overlays)}updatePanoramicSuperimposeRadiusOffset(e){this._superimposeService.updatePanoramicRadiusOffset(e)}setDefaultSuperimposeZOffsetPercentage(e){this._superimposeService.setDefaultZOffsetPercentage(e)}setFrustumSearchEnabled(e){this.frustumSearchEnabled=e}setPanoramicSuperimposeRadiusPercentage(e){this._superimposeService.setPanoramicRadiusPercentage(e)}updateDefaultSuperimposeCameraLock(e){this.defaultSuperimposeCameraLockEnabled=e,this.superimposeViewEnabled&&this.mode==="default"&&(e?this._adapter?.enableDefaultSuperimposeNavigation?.():this._adapter?.disableDefaultSuperimposeNavigation?.())}beforeLoad(e=!0){this.emit(`popup-close`),e&&(this.displayMessage=null),this._pendingDefaultNavigationViewState=null,this._pendingPanoramicNavigationViewState=null,this._abortSuperimposeSchedule(),this._adapter?.disableDefaultSuperimposeNavigation?.(),this._adapter?.disablePanoramicSuperimposeNavigation?.(),this.clearPreviousGroundLocation(),this.triangularMeasurementActive=!1,this.currentBestFeatureMeasurementImage=null,this.measureType=null,this.imageLocationToolState=!1,this.features.removeAll(),this.currentBestFeature=null,this.additionalFeatures.removeAll(),this.additionalFootprints.removeAll(),this.additionalCameraLocations.removeAll(),this.bestFeatureCurrentFootprint=m(this.bestFeatureCurrentFootprint),this._restoreSuperimposeMediaTask=h(this._restoreSuperimposeMediaTask),this._superimposeService.clear(),this._overlays?.removeAll()}async calculateLocationAccuracy(e){return this._measurementService?.calculateLocationAccuracy(e)}clearLocationPointOnImage(e=!1){this.locationPointOnImage&&!e&&(this._imageViewer.removeGraphic(this.locationPointOnImage),this._panoramicViewer.removeGraphic(this.locationPointOnImage),this.locationPointOnImage=m(this.locationPointOnImage)),this.correctedLocationPointOnImage&&=(this.imageMeasurementViewer.removeGraphic(this.correctedLocationPointOnImage),this._panoramicMeasurementViewer.removeGraphic(this.correctedLocationPointOnImage),m(this.correctedLocationPointOnImage))}clearPreviousMeasurements(){this.clearMeasurementGraphics(),this.resetMeasurementData(),this.stopMeasurement()}clearPreviousGroundLocation(){this.groundCoordinates=null,this.groundCoordinatesAccuracy=null,this.groundCoordinatesAccuracyLoading=!1,this.pixelCoordinates=null,this.clearLocationPointOnImage()}clearMeasurementGraphics(){this.measurementGraphic&&=(this.activeViewer?.removeGraphic(this.measurementGraphic),null),this.heightGraphic&&=(this.activeViewer?.removeGraphic(this.heightGraphic),null),this.triangularMeasurementActive&&this.sketchTriangularGraphicsLayer?.graphics.destroyAll()}digitizeCancel(){return this.sketch?.cancel()}digitizeCanRedo(){return this.sketch?.canRedo()??!1}digitizeCanUndo(){return this.sketch?.canUndo()??!1}digitizeComplete(){return this.sketch?.complete()}async digitizeCreate(e,t){let{sketch:n,dataCaptureLayer:r}=this;if(!n)throw Q();gt(r,e,n),await n.create(e,{...t,defaultZ:0})}digitizeDelete(){if(!this.sketch)throw Q();return this.sketch.delete()}digitizeDuplicate(){if(!this.sketch)throw Q();return this.sketch.duplicate()}digitizePlace(e,t){if(!this.sketch)throw Q();return this.sketch.place(e,t)}digitizeRedo(){if(!this.sketch)throw Q();return this.sketch.redo()}digitizeUndo(){if(!this.sketch)throw Q();return this.sketch.undo()}digitizeUpdate(e,t){if(!this.sketch)throw Q();return this.sketch.update(e,t)}filterByFootprints(e,t,n){let r=n?.filterByFrustum??!1,i=n?.skipFilter??!1,a=[],o=[],s=[];return e.forEach(e=>{let{attributes:n}=e,c=e.layer?.coveragePercent,l,{polygon:u,frustum:d}=U(n);l=u.clone(),n.isInspection&&(l=pe(n)),c&&(l=me(l,c));let{cameraHeading:f,objectId:p}=n;if(this._matchesSelectedPointFilter({skipFilter:i,selectedPoint:t,filterByFrustum:r,cameraHeading:f,attributes:n,polygon:l})){s.push(e);let t=n.location.clone();t.imageID=p,this.pointSources.push(t),f!==B&&(a.push(u),d&&o.push(d))}}),{features:s,polygons:a,frustums:o}}async deleteDataCaptureFeatures(e){let{dataCaptureLayer:t}=this;if(!t)throw new s(`orientedimageryviewer:missing-featurelayer`,`Data capture layer is not available`);return t.queryFeatures({objectIds:e,outFields:[t.objectIdField]}).then(({features:e})=>t.applyEdits({deleteFeatures:e}))}handleSectorClick(e){if(isNaN(e))return;let t=(this._sectorData?.[V[e]])?.at(0);t&&(this.triangularMeasurementActive&&this.currentBestFeature?this._updateImageMeasurementBestFeature(t):this._scheduleCurrentBestFeatureUpdate(t))}handleFeatureClick(e){let{sector:t,featureIndexInSector:n}=e;if(isNaN(n))return;let r=(this._sectorData?.[t])?.at(n);r&&(this.triangularMeasurementActive&&this.currentBestFeature?this._updateImageMeasurementBestFeature(r):this._scheduleCurrentBestFeatureUpdate(r))}load(e){return this.addResolvingPromise(this._loadViewAdapter(e).catch(e=>{if(!_(e))throw e})),this}async loadBestImage(e,t){return this.selectedPoint=M(e),this.beforeLoad(),this._fetchFeaturesWithController(e,t)}async loadHeightMeasurementAdapter(e){if(!this.drawAdapter){let{default:t}=await import(`./adapters/draw/HeightMeasurementAdapter.js`);if(v(e),this.drawAdapter=new t({viewModel:this,measurementService:this._measurementService}),!this.drawAdapter.viewModel.isResolved())return}return this.drawAdapter}loadImageError(e){d.getLogger(this).error(`oriented-imagery-viewer:load-image`,e),this.setMessage(`imageLoadError`,`error`,e.message)}async loadSketch(e){if(!this.sketch){let{default:t}=await import(`../Sketch/SketchViewModel.js`);v(e),this.sketch=new t({layer:this._defaultGraphicsLayer,view:this.activeViewer?.imageRenderer,updateOnGraphicClick:!1,defaultUpdateOptions:{reshapeOptions:{edgeOperation:`none`,shapeOperation:`none`,vertexOperation:void 0},enableMoveAllGraphics:!1,enableRotation:!1,enableScaling:!1,multipleSelectionEnabled:!1,toggleToolOnClick:!1,tool:`transform`}})}return this.sketch}async loadMeasurementAdapter(e){if(!this.sketchAdapter){let{default:t}=await import(`./adapters/sketch/MeasurementAdapter.js`);if(v(e),this.sketchAdapter=new t({viewModel:this,measurementService:this._measurementService}),!this.sketchAdapter.viewModel.isResolved())return}return this.sketchAdapter}async processFeatureResponse(e,t,n){let{features:r}=e,i=this.layer?.verticalSearchRange,a=this._shouldUseVerticalFilter(),o=this._shouldUseFrustumSearch();if(this._clearFeatureGeometries(),!this._checkFeatures(r))return;let s=r[0].attributes.location.spatialReference.equals(t.spatialReference)?t:await k(t,r[0].attributes.location.spatialReference),{features:c,polygons:l}=o?this.filterByFootprints(r,s,{filterByFrustum:!0}):this.filterByFootprints(r,s,{skipFilter:n?.skipFilter});if(!this._checkFeatures(c))return;let u=await this.processElevationSample(l,c,n);v(n),await this._updateElevationOfSelectedPointAndLocations(c,t,u),v(n),c.forEach(({attributes:e})=>{if(e.cameraHeading!==B){let{polygon:t,frustum:n}=U(e);this.coveragePolygons.add(t),n&&this.coverageFrustums.add(n)}}),Ye(c,u);let d=c;if(a&&t&&i!=null&&(d=Xe(c,t,i),!d.length)){this.setMessage(`noImageAtElevation`,`info`);return}let f=this._processSuitableFeatures(d,t);this.updateSuitabilities(f,n?.loadBestImage)}async processFeatureElevation(e,t,n){if(!t)return;let{features:r,polygons:i}=this.filterByFootprints(e,t,{skipFilter:!0});if(!r?.length)return;let a=await this.processElevationSample(i,r,n);return v(n),a}async startMeasurement(e,t){this.sketch||await this.loadSketch(t),await this.loadMeasurementAdapter(t);let{sketch:n,sketchAdapter:r,activeViewer:i,mode:a}=this;if(!n||!r||!i||a===`none`)return;if(this.displayNewMeasurementButton=!1,a===`panoramic`&&(n.defaultCreateOptions.defaultZ=0),await n.create(e),a===`panoramic`){let{drawOperation:e}=n.view.activeTool;e.constraintsEnabled=!1,e._set(`elevationDrawSurface`,null)}let o=this.activeViewer?.imageRenderer.effectiveTheme.accentColor;o&&this.sketch&&(this.sketch.polygonSymbol=Re(o),this.sketch.polylineSymbol=a===`panoramic`?ze:Be(o,2.5))}async startHeightMeasurement(){this.displayNewMeasurementButton=!1,this.draw??=new ke({view:this.activeViewer?.imageRenderer}),this.polylineDrawAction=this.draw.create(`polyline`),await this.loadHeightMeasurementAdapter()}initializeMeasurement(e){switch(this.clearMeasurementGraphics(),this.resetMeasurementData(),e){case`distance`:this.startMeasurement(`polyline`);break;case`area`:this.startMeasurement(`polygon`);break;case`height`:this.startHeightMeasurement()}}async overlayCameraLocations(e){this._cameraOverlayTask=h(this._cameraOverlayTask);let{activeViewer:n,overlayedCameraLocations:a,layer:o,mode:s,layerFloorFilterClause:c,layerTimeExtent:l,videoViewModel:u,_panoramicVideoViewer:d}=this,f=s===`video`,p=s===`panoramic-video`,m=this._getActiveFeatureForCurrentMode(),g=this._computeOverlayImageSize();if(!g||!m||!o||s===`none`||!this.overlayGraphicsEnabled)return;let{polygon:y}=U(m.attributes);if(f?u?.removeOverlayGraphics(a.toArray()):p?d.removeManyGraphics(a.toArray()):n?.removeManyGraphics(a.toArray()),a.removeAll(),!e)return;let b=i(async e=>{let{features:i}=await o.queryFeatures({where:T(`${o.objectIdField} <> ${m.attributes.objectId}`,T(o.definitionExpression,c)),geometry:y,returnGeometry:!0,outFields:[o.objectIdField],timeExtent:l},{signal:e});v(e);let h=await Promise.all(i.map(async n=>{let{attributes:r,geometry:i}=n;if(i?.type!==`point`)return null;let a=await this._geometryToOverlayImageGeometry(i,m,g,{signal:e});if(v(e),!a)return null;let o=s===`panoramic`||s===`panoramic-video`?Ve():He();return new t({attributes:r,symbol:o,geometry:a})}));v(e),m===this._getActiveFeatureForCurrentMode()&&this.overlayGraphicsEnabled&&(a.addMany(h.filter(r)),f?u?.addOverlayGraphics(a.toArray()):p?d.addManyGraphics(a.toArray()):n?.addManyGraphics(a.toArray()))});this._cameraOverlayTask=b;try{await b.promise}catch(e){if(!_(e))throw e}finally{this._cameraOverlayTask===b&&(this._cameraOverlayTask=null)}}overlayGraphicsOnImage(e,t){this.removeOverlayedGraphicsOnImage(e),this.overlayedMapFeatures.set(e,t),this.mode===`video`?this.videoViewModel?.addOverlayGraphics(t.toArray()):this.mode===`panoramic-video`?this._panoramicVideoViewer.addManyGraphics(t.toArray()):this.activeViewer?.addManyGraphics(t.toArray())}async overlayMapFeatures(e,n=!1){let{activeViewer:i,mode:o,layer:s,videoViewModel:c,_panoramicVideoViewer:l}=this,u=o===`video`,f=o===`panoramic-video`,p=this._getActiveFeatureForCurrentMode(),m=this._computeOverlayImageSize();if(!m||!p||o===`none`||!this.overlayGraphicsEnabled||!s)return;let{polygon:h}=U(p.attributes);try{let{imageGeometryField:t,oiObjectIdField:n}=_t(e,s.imageGeometryField,s.imageReferenceField);this.imageGeometryField=t.name,this.oiObjectIdField=n.name}catch(e){d.getLogger(this).warn(`oriented-imagery-viewer:overlay-map-features`,e)}let{features:g}=await e.queryFeatures({geometry:h,returnGeometry:!0,outFields:[`*`]}),_=await Promise.all(g.map(async r=>{let a=r.symbol?.clone()??e.renderer?.getSymbol(r)?.clone(),{attributes:s,geometry:h}=r,{imageGeometryField:g,oiObjectIdField:_}=this;if(g&&_&&wt(e,g,_)&&`${s[_]}`==`${p.attributes.objectId}`)try{let r=f?l.horizonAngles:X(i?.media),d=vt(s,g,e,n,m,u?`default`:o,a,r);if(!u)return d;let p=d.geometry;if(!p)return null;let h=c?.imageGeometryToOverlayGeometry(p);return h?new t({attributes:s,layer:e,symbol:d.symbol,geometry:h,visible:d.visible}):null}catch(t){d.getLogger(this).warn(`oriented-imagery-viewer:overlay-map-features`,`couldn't create graphic from attributes, geometry will be used`,{error:t,feature:r,layer:e,imageGeometryField:this.imageGeometryField,imageReferenceField:this.oiObjectIdField})}if(!h)return null;let v={feature:p,imageSize:m,footprintExtent:this.footprintExtent},y=await this._geometryToOverlayImageGeometry(h,v.feature,v.imageSize);return y?new t({attributes:s,layer:e,symbol:a,geometry:y,visible:e.visible&&n}):null})),v=new a(_.filter(r));(o!==`video`&&o!==`panoramic-video`||this.overlayGraphicsEnabled)&&this.overlayGraphicsOnImage(`${e.id}`,v)}getDepthAt(e){let{activeViewer:t,currentBestFeature:n,mode:r,state:i,depthImage:a}=this,o=t?.imageSize;if(!o||!n||r===`none`||i.includes(`loading`))return d.getLogger(this).warnOnce(`oriented-imagery-viewer:get-depth-at`,`Load an image to use depth`),null;if(!a?.loaded)return d.getLogger(this).error(`oriented-imagery-viewer:get-depth-at`,`Depth image is not loaded`),this.emit(`depth-image-service:not-loaded`),null;let s=(Array.isArray(e)?e:[e]).map(e=>a.depthAt(e,{width:o[0],height:o[1]})??null);return Array.isArray(e)?s:s[0]}getActiveSectors(){return V.filter(e=>this._sectorData?.[e]?.length)}async getPixelLocationForFeature(e,t,n){return(await this._transformationService.pointToPixelForFeature([e],t,n))[0]}async getPixelLocationsForFeature(e,t,n){return await this._transformationService.pointToPixelForFeature(e,t,n)}async _getMapPointInViewSpatialReference(e,t){let n=await this.getMapPoint(e,t),r=this.view?.spatialReference;return await k(n,r,t)}async plotMapPoint(e){this.plotReferencePoint(e);let t=this._getActiveFeatureForCurrentMode();if(t)return this.transformAndPlotReferencePointOnImage({feature:t,selectedLocation:e,options:{signal:this._transformController?.signal}})}plotReferencePointOnGround(e){this._referencePointOnGround&&(this._overlays?.remove(this._referencePointOnGround),this._referencePointOnGround.destroy()),e!=null&&(this._referencePointOnGround=new t({geometry:new O({...e.toJSON()}),symbol:q}),this.view?this._overlays?.add(this._referencePointOnGround):this.emit(`plot-ground-point`,{data:{point:this._referencePointOnGround?.geometry}}))}plotReferencePointOnImage(e){switch(this.mode){case`video`:this._plotReferencePointOnVideo(e);return;case`panoramic-video`:this._plotReferencePointOnPanoramicVideo(e);return;case`default`:this._plotReferencePointOnDefaultImage(e);return;case`panoramic`:this._plotReferencePointOnPanoramicImage(e);return}}removeAllOverlayMapFeatures(){let{mode:e}=this;this.overlayedMapFeatures.forEach(t=>{let n=t.toArray();switch(e){case`video`:this.videoViewModel?.removeOverlayGraphics(n);break;case`panoramic-video`:this._panoramicVideoViewer.removeManyGraphics(n);break;default:this.activeViewer?.removeManyGraphics(n)}}),this.overlayedMapFeatures.clear()}removeOverlayedGraphicsOnImage(e){let t=this.overlayedMapFeatures.get(e),{mode:n}=this;if(!t?.length)return;let r=t.toArray();switch(n){case`video`:this.videoViewModel?.removeOverlayGraphics(r);break;case`panoramic-video`:this._panoramicVideoViewer.removeManyGraphics(r);break;default:this.activeViewer?.removeManyGraphics(r)}this.overlayedMapFeatures.delete(e)}reset(){let{mode:e}=this;e==="default"||e===`panoramic`?this.resetImage():e===`video`?this.resetVideo():e===`panoramic-video`&&this.resetVideoPanoramic(),this.beforeLoad(!1)}resetImage(){switch(this.setMessage(`onLoadMessage`,`info`),this.mode){case`default`:this._imageViewer.clearImage(),this._imageViewer.clearGraphics();break;case`panoramic`:this._panoramicViewer.clearImage(),this._panoramicViewer.clearGraphics()}this._clickTask=h(this._clickTask)}resetVideo(){this.setMessage(`onLoadMessage`,`info`),this.videoViewModel?.resetVideoHandler(),this._overlays?.removeAll(),this.videoViewModel=null,this._videoFeatureCache.reset(),this._syncVideoFeatureCacheState(),this.currentBestFeature=null}resetVideoPanoramic(){this.setMessage(`onLoadMessage`,`info`),this._overlays?.removeAll(),this._panoramicVideoViewer.reset(),this.currentBestFeature=null}resetMeasurementData(){this.areaMeasurementResult=0,this.areaMeasurementAccuracy=0,this.distanceMeasurementResult=0,this.distanceAccuracyArray=[],this.heightMeasurementResult=0,this.heightMeasurementAccuracy=0,this.heightGraphic=null,this.triangulatedDistanceMeasurement=null,this.triangulatedDistanceAccuracy=null,this.triangulatedAreaMeasurement=null,this.triangulatedMeasurementGraphic=null,this.updatingTriangularMeasurementState=!1,this.triangulatedAreaAccuracy=0,this._measurementService?.resetMeasurementVectors()}async saveDrawing(){let{dataCaptureLayer:e,sketchAdapter:t}=this;if(!e||t?.type!==`data-capture`)return;let{pendingGraphics:n,savedGraphics:r}=t,i=n.get(e.id),a=i?.toArray();if(!i||!a?.length)return;let{addFeatureResults:o}=await this.saveDataCaptureFeatures(a),s=o.reduce((t,{objectId:n,globalId:r,error:i},o)=>{let s=a[o],{attributes:c}=s;return i?t.error.push(s):(n&&(c[e.objectIdField]=n),r&&e.globalIdField&&(c[e.globalIdField]=r),t.success.push(s)),t},{success:[],error:[]});r.addMany(s.success),i.removeAll(),i.addMany(s.error)}async saveDataCaptureFeatures(e,t){let{activeViewer:n,currentBestFeature:i,dataCaptureLayer:a,mode:o}=this;if(!n?.imageSize||!i||o===`none`||o===`video`||o===`panoramic-video`)throw new s(`orientedimageryviewer:missing-input`,`Image size, current best feature and mode are required to save data capture features`);if(!a)throw new s(`orientedimageryviewer:missing-featurelayer`,`Data capture layer is not available`);let c=await Promise.all(e.map(async e=>{let n=e.clone(),{geometry:r}=n;if(!r)return;let i=r.type,o=a.hasZ,s=a.geometryType,c=i!==s,l=(c?await import(`./transformers.js`):null)?.default[s],u=c?l?.(r):r;if(u&&(n.geometry=await this._transformationService.imageGeometryToMapGeometry(u,t),n.geometry))return o||yt(n.geometry),n})),l=c.filter(r);return a.applyEdits({addFeatures:l}).then(e=>{let{addFeatureResults:t}=e,n=0,r=c.map(e=>{let r=t[n++];return e?r:{error:new s(`orientedimageryviewer:save-unsucccessful`,`Error in saving data capture features`),objectId:null,globalId:null}});return{...e,addFeatureResults:r}})}async searchBestImage(e,t){try{let n=await j(e,t);n&&await this.processFeatureResponse(n,e.point,t)}catch(e){_(e)||(this.setMessage(`imageLoadError`,`error`,e.message),d.getLogger(this).error(`error occurred while finding best image`,e))}}selectTriangularMeasurementFeature(e){this.currentBestFeatureMeasurementImage=this.features?.find(({attributes:t})=>t.objectId===Number(e))}setAdditionalCameraLocationsVisibility(e){this.additionalCameraLocations.forEach(t=>{t.visible=e})}setAdditionalCoverageVisibility(e){this.additionalFootprints.forEach(t=>{t.visible=e})}setCurrentCoverageVisibility(e){this.bestFeatureCurrentFootprint&&(this.bestFeatureCurrentFootprint.visible=e),this.currentBestFeatureLocation&&(this.currentBestFeatureLocation.visible=e)}setMapImageConversionToolState(e){this.mapImageConversionToolState=e}setCurrentPanoramaView(e,t){this._panoramicViewer?.set({yaw:e,pitch:t})}async restorePendingPanoramicNavigationViewState(e){let t=this._pendingPanoramicNavigationViewState;this._pendingPanoramicNavigationViewState=null,this.mode===`panoramic`&&await this._restoreNavigationViewState(t,e)}async startDataCapture(e,t){let n=this.activeViewer?.imageRenderer,{oiObjectIdField:r,currentBestFeature:i}=this;if(!n||!i||!r)return;let{attributes:{objectId:o}}=i,s=this.overlayedMapFeatures.get(e.id)?.toArray()??[],c=[],l=[];for(let e of s)`${e.getAttribute(r)}`==`${o}`?c.push(e):l.push(e);this.overlayGraphicsOnImage(e.id,new a(l)),this.collectionId=e.id;let u=await this.loadSketch(t),d=await this.loadDataCaptureAdapter(t);v(t),u.addGraphics(c),d.savedGraphics.addMany(c);let f=n.ui.find(`zoom`);f.visible=!1,n.map.layers.add(this.sketchGraphicsLayer)}async stopDataCapture(e=!1){this.sketch?.cancel(),this.sketchGraphicsLayer?.removeAll(),this.sketchAdapter=m(this.sketchAdapter),this.sketch=m(this.sketch),this.collectionId=null;let{dataCaptureLayer:t}=this,n=this.activeViewer?.imageRenderer;if(!n||n.destroyed)return;n.map.layers.remove(this.sketchGraphicsLayer),e&&t&&await this.overlayMapFeatures(t,!0);let r=n.ui.find(`zoom`);r&&(r.visible=!0)}stopMeasurement(){this.draw?.reset(),this.sketch?.cancel()}async toggleAllOverlayMapFeatures(e){!e&&this.dataCaptureLayer&&(await this.stopDataCapture(!0),this.dataCaptureLayer=null),this.overlayedMapFeatures.forEach(t=>{this._toggleVisiblity(t,e)})}toggleOverlayMapFeatures(e,t,n){let r=this.overlayedMapFeatures.get(e);r&&n&&this._toggleVisiblity(r,t)}toggleSelection(e){let{sketch:t}=this;t&&(t.updateOnGraphicClick=e,t.cancel())}async transformAndPlotReferencePointOnImage(e){let{feature:t,selectedLocation:n,options:r}=e,i=!1,a=!1,o=this.mode===`video`?this.bestFeatureCurrentFootprint?.geometry:this.bestFeatureFootprint?.geometry;switch(o?.type){case`polygon`:{let e=n.spatialReference.equals(o.spatialReference)?n:await k(n,o.spatialReference);i=o.contains(e);break}case`mesh`:{let e=n.spatialReference.equals(o.spatialReference)?n:await k(n,o.spatialReference);a=o.extent.contains(e);break}}if(!i&&!a){this.clearReferencePointOnImage();return}let s=this.mode===`video`||this.mode===`panoramic-video`?await this.getPixelLocationForFeature(n,{feature:t,mode:this.mode,imageSize:R,footprintExtent:this.footprintExtent},r):await this._transformationService.pointToPixel(n,r);if(!s)this.clearReferencePointOnImage();else return v(r),this.plotReferencePointOnImage(s),{x:s.x,y:s.y}}async updateFeatureCache(e){await this._videoFeatureCache.updateIndex(e),this._syncVideoFeatureCacheState()}cacheHydratedVideoFeature(e){this._videoFeatureCache.cacheHydratedFeature(e),this._syncVideoFeatureCacheState()}getCachedVideoFeatureByOffset(e,t){return this._videoFeatureCache.getCachedFeatureByOffset(e,t)}async getVideoFeatureByOffset(e,t,n){let{layer:r}=this;if(!r)return null;let i=await this._videoFeatureCache.getFeatureByOffset({layer:r,layerFloorFilterClause:this.layerFloorFilterClause,layerTimeExtent:this.layerTimeExtent},e,t,n);return this._syncVideoFeatureCacheState(),i}_shouldUseVerticalFilter(){return!!(this.layer?.verticalSearchRange&&this.layer.hasZ&&this.verticalFilterEnabled)}_shouldUseFrustumSearch(){return!!(this.layer?.hasZ&&this.frustumSearchEnabled&&this.view?.type===`3d`)}_syncVideoFeatureCacheState(){this.featureCache=this._videoFeatureCache.featureCache,this.videoFeatureIndex=this._videoFeatureCache.videoFeatureIndex}_matchesSelectedPointFilter({skipFilter:e,selectedPoint:t,filterByFrustum:n,cameraHeading:r,attributes:i,polygon:a}){return e||!t||(n?r!==B&&he(i,t):ge(a,t))}_plotReferencePointOnVideo(e){this.state===`video-loaded`&&this.videoViewModel?.videoPaused&&(this.clearReferencePointOnImage(),this.videoViewModel.plotReferencePointOnVideo(e))}_plotReferencePointOnPanoramicVideo(e){let n=this._panoramicVideoViewer,{imageSize:r,media:i}=n.viewModel;if(!this.panoramicVideoLoaded||!this.panoramicVideoPaused||!r)return;this.clearReferencePointOnImage();let a=X(i),o=Z(e,`panoramic`,r,a);this._referencePointOnImage=new t({geometry:o,symbol:J.clone()}),n.addGraphic(this._referencePointOnImage,0)}_getActiveFeatureForCurrentMode(){switch(this.mode){case`video`:return this.videoViewModel?.closestFeature??this.currentBestFeature;case`panoramic-video`:return this._panoramicVideoViewer.viewModel.closestFeature??this.currentBestFeature;default:return this.currentBestFeature}}_plotReferencePointOnDefaultImage(e){let n=this._imageViewer,{imageSize:r}=n;if(this.state!==`image-loaded`||!r)return;this.clearReferencePointOnImage();let i=Z(e,`default`,r);this._referencePointOnImage=new t({geometry:i,symbol:q.clone()}),n.addGraphic(this._referencePointOnImage,0)}_plotReferencePointOnPanoramicImage(e){let n=this._panoramicViewer,{imageSize:r,media:i}=n;if(this.state!==`image-loaded`||!r)return;this.clearReferencePointOnImage();let a=X(i),o=Z(e,`panoramic`,r,a);this._referencePointOnImage=new t({geometry:o,symbol:J.clone()}),n.addGraphic(this._referencePointOnImage,0)}async _fetchFeatures(e,t){let{layer:n,layerFloorFilterClause:r,layerTimeExtent:i,view:a}=this;if(!a)return;if(!n){this.setMessage(`noLayerSelected`,`info`);return}e.x=le(e.x,e.spatialReference);let o=n.spatialReference.equals(e.spatialReference)?e:await k(e,n.spatialReference),s=o.spatialReference.isGeographic?ue(o):o,c=T(`1=1`,T(n.definitionExpression,r)),l=s.spatialReference.isGeographic?1:E(s.spatialReference),u={layerInstanceOrURL:n,point:s,queryParams:{where:c,maximumDistance:n.maximumDistance?n.maximumDistance/l:void 0,timeExtent:i}};return await this.searchBestImage(u,t)}async _fetchFeaturesWithController(e,t){try{await this._fetchFeatures(e,t)}catch(e){if(_(e))return;this.setMessage(`imageLoadError`,`error`),d.getLogger(this).error(`error occurred while fetching features`,e)}}_groupFeaturesBySectors(){let{_suitabilities:e,additionalFeatures:t,features:n,invalidCameraHeading:r}=this,i=n.at(0);if(!e||!t||!i||!n||r){this._sectorData=null;return}this._sectorData={};let o={};this._featureToSector=o;for(let e of V)this._sectorData[e]=new a;let s=e.map((e,t)=>({...e,featureIndex:t}));s.sort((e,t)=>e.trueSuitability-t.trueSuitability);let c=s.map(({distance:e})=>e),l=Math.max(...c);s.forEach(e=>{let{distance:t,angle:r,featureIndex:a}=e,s=t/l*H[2],c=tt(t,l),u=nt(r);if(!this._sectorData)return;let d=H[3]+s*Math.sin(r*Math.PI/180),f=H[3]+s*Math.cos(r*Math.PI/180),p,m=n.at(a),h=m===i,{cameraPitch:g}=m.attributes,_=g<5;if(h&&_)p=-90;else{let e=d-H[3],t=f-H[3],n=t/Math.sqrt(e**2+t**2),r=Math.acos(n)*180/Math.PI;(e<0&&t<0||e<0&&t>0)&&(r*=-1),p=r}let v=c===``?u:`${c}_${u}`;h&&(p===this.bestFeatureAngle?this.previousFeatureAngle=p:this.bestFeatureAngle=p,this.navigatorCurrentBestFeature=_?null:{x:d,y:f,direction:u}),o[`${m.attributes.objectId}`]=v;let y=this._sectorData[v];y.add({angle:r,featureIndex:a,x:d,y:f,objectID:m.attributes.objectId,sector:v,featureIndexInSector:y.length})})}async _initializeLocationViewModel(e){if(!this._locationViewModel){let{default:t}=await import(`./components/ImageLocationViewModel.js`);v(e),this._locationViewModel=new t({oiViewModel:this,referenceTransformationService:this._referenceTransformationService})}}_initializeMeasurementService(){this._measurementService||=new mt({transformationService:this._transformationService,referenceTransformationService:this._referenceTransformationService})}_initializeVideo(){if(!this.currentBestFeature)return;let e=ot(this.currentBestFeature.attributes.imagePath),t=ot(this.videoElement?.video);if(e&&t===e&&this.videoViewModel)return;this.videoLayer&&=(this.videoMapView.map.layers.remove(this.videoLayer),this.videoLayer.destroy(),null),this.videoViewModel=m(this.videoViewModel),this.removeHandles(Y.videoPlayerHandles),this.videoElement=new Ee({video:e??this.currentBestFeature.attributes.imagePath,georeference:new we({extent:new ae(Ie)}),autoplay:!1}),this.videoElement.content?.loop&&(this.videoElement.content.loop=!1);let n=new de({source:this.videoElement,title:this.layer?.title,copyright:this.layer?.copyright});this.videoLayer=n,n&&this.videoMapView.map.layers.add(n),this.videoViewModel=new dt({oiViewModel:this})}async getMapPoint(e,t){let n=await this._transformationService.pixelToMapPoint(Array.isArray(e)?e:[e],t);return Array.isArray(e)?n:n[0]}async getMapPointForFeature(e,t,n){let r=await this._transformationService.pixelToMapPointForFeature(Array.isArray(e)?e:[e],t,n);return Array.isArray(e)?r:r[0]}async loadPanoramicMediaSource(e,t){let{lookAt:n,...r}=e,i=Ze(r);try{await i.load(t)}catch(e){if(_(e))return;if(e.name===`unsupported-format`){this.setMessage(`unsupportedPanoramicImageryError`,`error`,void 0,{datasetFormat:i?.extension??`UNKNOWN FORMAT`});return}}let a=this.triangularMeasurementActive?this._panoramicMeasurementViewer:this._panoramicViewer;await a.loadMedia(i,t),n&&a.set(n)}async loadMediaSource(e,t){let n=Qe(e);await this._setImageSource(this.triangularMeasurementActive?this.imageMeasurementViewer:this._imageViewer,n,t)}_clearFeatureGeometries(){this.coveragePolygons.removeAll(),this.coverageFrustums.removeAll(),this.pointSources.removeAll()}_checkFeatures(e){return e?.length?!0:(this.emit(`no-image-found`),this.setMessage(`noImageError`,`error`),this.videoElement?.content?.pause(),this.currentBestFeature=null,!1)}async _getElevationSampleFromGround(e,t,n){if(!e[0])return;let{unionExecuteMany:r}=await import(`../../geometry/operators/unionOperator.js`),i=r(e);if(this._updateFootprintWithFeatures(t,i),this.view?.type===`3d`)try{return await this.view.map.ground.createElevationSampler(this.footprintExtent,n)}catch(e){if(_(e))throw e;d.getLogger(this).error(e);return}}async processElevationSample(e,t,n){let{elevationSource:r}=t[0].attributes,i=await this._getElevationSampleFromGround(e,t,n);if(this.view?.type===`3d`||i)return i;if(r&&this.footprintExtent&&_e(r))return await ye({extent:this.footprintExtent,lod:r.lod,url:r.url,rasterFunction:r.rasterFunction})}_processSuitableFeatures(e,t){return fe({features:e,selectedPoint:t,camera:$e(this.view)?this.view.camera:null,currentImage:this.currentBestFeature})}async _processHitTestResults(e,t,n){let{results:[r]}=t;if(r?.type!==`graphic`){this.beforeLoad(!1),this.emit(`no-image-found`),this.setMessage(`noImageError`,`error`);return}let i=r.graphic.getAttribute(e.objectIdField);return await this.showImageByObjectId(i,n)}async _queryAndLoadByObjectId(e,t,n,r,i){this.displayMessage=null;let{response:a}=await pt(e,t,n,r,i);if(v(i),!a?.features?.length)throw new ft(t);let{attributes:o}=a.features[0],s,c;if(s=i?.selectedPoint?M(i.selectedPoint):void 0,!s){if(o.orientedImageryType?.includes(`360`)){s=M(o.geometry);let{cameraHeading:e,farDistance:t,nearDistance:n}=o,r=[Math.sin(p(e)),Math.cos(p(e))],i=(t+n)/2;c=E(s.spatialReference),s.x+=i*r[0]/c,s.y+=i*r[1]/c,s.z=void 0}else{let e=await this.processFeatureElevation(a.features,o.geometry.clone(),i);v(i),await this._updateElevationOfSelectedPointAndLocations(a.features,o.geometry.clone(),e??void 0,i),v(i);let t=U(o).polygon,n=O.fromJSON(se(t));s=M(n),c=E(s.spatialReference)}}this.selectedPoint=s,c=E(s.spatialReference);let l={layerInstanceOrURL:e,point:s,queryParams:{where:T(T(`1=1`,T(e.definitionExpression,n)),`${e.objectIdField} <> ${t}`),maximumDistance:e.maximumDistance?e.maximumDistance/c:void 0,timeExtent:r}},u=await j(l,i);v(i);let{features:d}=u;return d.push(a.features[0]),await this.processFeatureResponse(u,s,{...i,loadBestImage:!1})}_reorderTriangularSketchLayer(){let e=this.imageMeasurementViewer.imageRenderer.map.layers?.length;this.sketchTriangularGraphicsLayer&&e&&this.imageMeasurementViewer.imageRenderer.map.layers.reorder(this.sketchTriangularGraphicsLayer,e-1)}async _setImageSource(e,t,n){e.media=t,await e.loadMedia(t,n)}async _restoreNavigationViewState(e,t){let n=e?.center?await this._transformationService.pointToPixel(e.center,t):null;if(v(t),this.mode===`panoramic`){let t=X(this._panoramicViewer.media);if(!t)return;xt({viewState:e,panoramicViewer:this._panoramicViewer,horizonAngles:t,imageCenter:n})}St({viewState:e,imageViewer:this._imageViewer,imageCenter:n})}_toggleVisiblity(e,t){e.forEach(e=>{e.visible=t})}async _updateElevationOfSelectedPointAndLocations(e,t,n,r){let{cameraHeight:i}=e[0].attributes,a=e[0].attributes.location,o=await P(a.spatialReference,a.z,i,{elevationSample:n,elevationSource:this.view?.type===`3d`||n?void 0:e[0].attributes.elevationSource,extent:this.footprintExtent},r);v(r);let[s,...c]=await ve([t,...e.map(e=>e.attributes.geometry.clone())],o);v(r),t.elevation=s.z,e.forEach((e,t)=>{e.attributes.elevation=c[t].z;let n=this.pointSources.find(t=>t.imageID===e.attributes.objectId);n&&(n.z=e.attributes.location.z)})}_updateFeatures(e,t=!0){e.length?(this.features.removeAll(),this.features.addMany(e),this.navigationNodes.removeAll(),this.navigationNodes.addMany(e.map(e=>{let{geometry:t,attributes:n}=e,{isSpherical:r,cameraHeading:i,cameraPitch:a}=n;return new ut({geometry:t,attributes:n,currentHeading:r?0:i,currentPitch:r?0:a})})),e.length>1?this.additionalFeatures.addMany(e.slice(1)):this.additionalFeatures.removeAll(),t&&(this.currentBestFeature=e[0])):(this.currentBestFeature=null,this.additionalFeatures.removeAll())}_updateFootprintWithFeatures(e,t){let n=[];for(let{attributes:{location:r}}of e)t.contains(r)||n.push([r.x,r.y]);n.sort((e,t)=>+ce([e,t])),t.addRing(n),this.footprintExtent=Ae(t.extent,2,2)}_scheduleVideoInteractionUpdate(){this.scheduledFrameId||=requestAnimationFrame(()=>{this.scheduledFrameId=null,this._updateInteraction()})}async _updatePointsAndPolygons(e){let{pointSources:n,currentBestFeature:r,currentCoverageVisible:i,isAdditionalPointSourcesVisible:a,mode:o,layer:s}=this;if(r&&(this.additionalFootprints.removeAll(),this.additionalCameraLocations.removeAll(),this.bestFeatureCurrentFootprint&&(this.bestFeatureCurrentFootprint.destroy(),this.bestFeatureCurrentFootprint=null,this.bestFeatureFootprint=null),!this.invalidCameraHeading)){await this._adapter?.createFootprints(e),v(e);for(let o of n){let n=this.view&&!this.view.spatialReference?.equals(o.spatialReference)?await k(o.clone(),this.view?.spatialReference,e):o.clone();o.imageID===r.attributes.objectId?this.currentBestFeatureLocation=new t({attributes:{imageID:o.imageID},geometry:n,symbol:Ue,visible:i}):this.additionalCameraLocations.push(new t({attributes:{imageID:o.imageID},geometry:n,symbol:We,visible:a}))}(o===`video`||o===`panoramic-video`)&&(await this.initializeTransformationService(e),s&&!this.videoFeatureIndex.length&&await this.updateFeatureCache(s),this.cacheHydratedVideoFeature(r))}}_scheduleCurrentBestFeatureUpdate(e){h(this._navigationViewStateTask);let t=i(async t=>{await this._updateCurrentBestFeature(e,{signal:t})});this._navigationViewStateTask=t,t.promise.catch(e=>{if(!_(e))throw e}).finally(()=>{this._navigationViewStateTask===t&&(this._navigationViewStateTask=null)})}async _updateCurrentBestFeature(e,t){if(!e)return;if(await this._capturePendingNavigationViewState(t),v(t),this.currentBestFeature=this.features?.at(e.featureIndex),this.mode===`video`){this.currentBestFeature&&this.videoViewModel?.playVideoFromSelectedLocation(this.currentBestFeature);return}if(this.mode===`panoramic-video`){this.currentBestFeature&&this._panoramicVideoViewer.viewModel.playPanoramicVideoFromSelectedLocation(this.currentBestFeature);return}let n=this.currentBestFeature?.attributes.cameraPitch&&this.currentBestFeature?.attributes.cameraPitch<5,r;if(n)r=-90;else{let t=e.x-H[3],n=e.y-H[3],i=n/Math.sqrt(t**2+n**2),a=Math.acos(i)*180/Math.PI;(t<0&&n<0||t<0&&n>0)&&(a*=-1),r=a}r===this.bestFeatureAngle?this.previousFeatureAngle=r:this.bestFeatureAngle=r,this.navigatorCurrentBestFeature=n?null:{x:e.x,y:e.y,direction:e.sector.includes(`_`)?e.sector.split(`_`,2)[1]:e.sector},this.mode===`panoramic`&&(await x(()=>this.state===`image-loaded`,t),v(t),await this.restorePendingPanoramicNavigationViewState(t))}async _capturePendingNavigationViewState(e){this.mode==="default"?await this._capturePendingDefaultNavigationViewState(e):this.mode===`panoramic`&&await this._capturePendingPanoramicNavigationViewState(e)}async _capturePendingDefaultNavigationViewState(e){try{let{imageSize:t,imageRenderer:n}=this._imageViewer,r=n.center;if(this.state!==`image-loaded`||!t[0]||!t[1]||!r||Math.abs(n.scale-n.constraints.minScale)<=Oe){this._pendingDefaultNavigationViewState=null;return}let i=bt(r,`default`,t),a=await this._getMapPointInViewSpatialReference(i,e);v(e),this._pendingDefaultNavigationViewState={center:a,scale:n.scale}}catch(e){this._handlePendingNavigationViewStateCaptureError(e)}}async _capturePendingPanoramicNavigationViewState(e){let t=X(this._panoramicViewer.media);if(t)try{let{fov:n,imageSize:r,pitch:i,yaw:a}=this._panoramicViewer;if(this.state!==`image-loaded`||!r||!n){this._pendingPanoramicNavigationViewState=null;return}let[o,s]=Se(a,i,t),c=Ce(o,s,r[0],r[1]),l=await this._getMapPointInViewSpatialReference(c,e);v(e),this._pendingPanoramicNavigationViewState={center:l,fov:n}}catch(e){this._handlePendingNavigationViewStateCaptureError(e)}}_handlePendingNavigationViewStateCaptureError(e){if(_(e))throw e;d.getLogger(this).warn(`oriented-imagery-viewer:failed-to-capture-navigation-view-state`,e)}_updateImageMeasurementBestFeature(e){e&&(this.currentBestFeatureMeasurementImage=this.features?.at(e.featureIndex))}clearGraphics(){this._cameraOverlayTask=h(this._cameraOverlayTask),this._imageViewer.clearGraphics(),this._panoramicViewer.clearGraphics(),this.imageMeasurementViewer.clearGraphics(),this._panoramicMeasurementViewer.clearGraphics()}clearReferencePointOnImage(){this._referencePointOnImage&&=(this._imageViewer.removeGraphic(this._referencePointOnImage),this._panoramicViewer.removeGraphic(this._referencePointOnImage),this._panoramicVideoViewer.removeGraphic(this._referencePointOnImage),m(this._referencePointOnImage)),this.videoViewModel?.clearReferencePointOnVideo()}async initializeReferenceTransformationService(e){let{currentBestFeatureMeasurementImage:t,activeTriangulatedViewer:n,mode:r}=this;if(!t||!n||!n.imageSize||r!==`panoramic`&&r!=="default")return;let{imageSize:i}=n,{attributes:a,elevationSample:o}=t,{cameraHeight:s,elevationSource:c}=a,l=a.location;l.spatialReference.isGeographic&&(l=M(l));let u={...r==="default"?F(a,i[0],i[1]):G(a,i[0],i[1]),cameraLocation:l},d=await P(l.spatialReference,l.z??0,s,{elevationSample:o,elevationSource:this.view?.type===`3d`?void 0:c,extent:this.footprintExtent},e),f=(await import(`./services/TransformationService.js`)).default,p={imageToWorldProperties:u,updateElevationProps:d,mode:r,imageSize:i,depthImageService:this.depthImage};this._referenceTransformationService=new f(p),this._locationViewModel&&(this._locationViewModel.referenceTransformationService=this._referenceTransformationService),this._measurementService&&(this._measurementService.referenceTransformationService=this._referenceTransformationService)}async initializeTransformationService(e){let{currentBestFeature:t,activeViewer:n,mode:r}=this,i=r===`video`||r===`panoramic-video`?R:n?.imageSize;if(!t||!i||r===`none`)return;let{attributes:a,elevationSample:o}=t,{cameraHeight:s,elevationSource:c}=a,l=a.location;l.spatialReference.isGeographic&&(l=M(l));let u=r==="default"||r===`video`?`default`:`panoramic`,d={...u==="default"?F(a,i[0],i[1]):G(a,i[0],i[1]),cameraLocation:l},f=await P(l.spatialReference,l.z??0,s,{elevationSample:o,elevationSource:this.view?.type===`3d`?void 0:c,extent:this.footprintExtent},e),p=(await import(`./services/TransformationService.js`)).default,m={imageToWorldProperties:d,updateElevationProps:f,mode:u,imageSize:i,depthImageService:this.depthImage};this._transformationService=new p(m),this._measurementService&&(this._measurementService.transformationService=this._transformationService)}plotReferencePoint(e){`mapPoint`in e?this.plotReferencePointOnGround(e.mapPoint):this.plotReferencePointOnGround(e)}clearSelectedPointOnViewer(){this._crossSymbol?this.mode===`video`?(this.videoViewModel?.clearSelectedPointOnVideo(),this._crossSymbol=null):(this._panoramicViewer.removeGraphic(this._crossSymbol),this._imageViewer.removeGraphic(this._crossSymbol),this.videoMapView.graphics.remove(this._crossSymbol),this._crossSymbol=m(this._crossSymbol)):this.videoViewModel?.clearSelectedPointOnVideo()}setMessage(e,t,n,r){this.displayMessage={key:e,type:t,data:n,map:r}}async transformAndPlotSelectedLocation(e){let{invalidCameraHeading:t,selectedPoint:n,activeViewer:r,videoElement:i}=this,a=this.mode===`video`?this.videoViewModel?.closestFeature??this.currentBestFeature:this.currentBestFeature;this.clearSelectedPointOnViewer();let o=this.mode===`video`?i?.loaded===!0&&this.videoViewModel?.videoPaused===!0:r?.state===`image-loaded`;if(!n||!a||!o||t||this.mode===`video`&&!await st(n,this.bestFeatureCurrentFootprint?.geometry,e))return;let s;try{if(s=this.mode===`video`?await this.getPixelLocationForFeature(n,{feature:a,mode:this.mode,imageSize:R,footprintExtent:this.footprintExtent},e):await this._transformationService.pointToPixel(n,{signal:e?.signal}),this.mode===`video`&&!ct(s))return;v(e),await this.plotSelectedPointOnImage(s,e)}catch(e){_(e)||d.getLogger(this).error(`failed to transform map point to pixel, cross symbol will not be plotted on image`,{error:e,selectedPoint:n,feature:a})}}updateCurrentCoveragePolygon(e){let{additionalFootprints:n,additionalCameraLocations:r,currentBestFeature:i,currentBestFeatureLocation:a,currentCoverageVisible:o,selectedPoint:s,view:c}=this;if(!i)return;let{attributes:{objectId:l}}=i;if(this._initialCurrentCoverageUpdate){if(this._overlays?.removeAll(),this._initialCurrentCoverageUpdate=!1,this.bestFeatureCurrentFootprint=m(this.bestFeatureCurrentFootprint),e&&!this.invalidCameraHeading&&(e.visible=o,this.bestFeatureCurrentFootprint=e),c){let e=[...n,...r,a].filter(et);s&&(this.bestFeatureCurrentFootprint&&e.splice(-2,0,this.bestFeatureCurrentFootprint),e.push(new t({geometry:s.clone(),symbol:K.clone(),attributes:{imageID:l}}))),this._overlays.graphics.addMany(e)}}else if(c){if(this.invalidCameraHeading){this._superimposeService.clear();return}this.bestFeatureCurrentFootprint&&=(this._overlays?.remove(this.bestFeatureCurrentFootprint),m(this.bestFeatureCurrentFootprint));let t=this.bestFeatureCurrentFootprint&&this._overlays?this._overlays.graphics.indexOf(this.bestFeatureCurrentFootprint):-1;e&&(this.bestFeatureCurrentFootprint=e,e.visible=this.currentCoverageVisible,this._overlays?.graphics.add(this.bestFeatureCurrentFootprint,t>=0?t:this._overlays.graphics.length-1))}}_updateSuperimposedImage(){if(!this._hasActiveSuperimposeCameraContext())return;let e=this.mode===`panoramic`?this._panoramicViewer:null,{currentBestFeature:t,defaultSuperimposeCameraLockEnabled:n,layer:r,mode:i,view:a,state:o,superimposeViewEnabled:s,superimposeViewSupported:c,activeViewer:l,depthImage:u}=this,d=this.coverageFrustums.find(({imageID:e})=>e===t?.attributes.objectId);this._superimposeService.update({activeImageSize:l?.imageSize||void 0,adapter:this._adapter,currentBestFeature:t,currentBestFeatureFrustum:d,defaultSuperimposeCameraLockEnabled:n,depthImageLoaded:u?.loaded??!1,layer:r,mode:i,panoramicCamera:e?.camera,state:o,superimposeViewEnabled:s&&c,view:a}),this.setMessage(`superimposeImageDescription`,`info`),this._superimposePreviousCurrentCoverageVisible??=this.currentCoverageVisible,this.currentCoverageVisible=!1}_getSuperimposeCameraWatchState(){let e=(this.view?.type===`3d`?this.view:null)?.camera;return[this.superimposeViewEnabled,this.superimposeViewSupported,this.mode,this.state,this.view?.type,this.view?.interacting,this.view?.navigating,e?.heading,e?.tilt,e?.fov,e?.position.x,e?.position.y,e?.position.z]}_handleSuperimposeCameraChange(){let e=this.view,t=e?.type===`3d`?e:null;this._hasActiveSuperimposeCameraContext()?this.mode===`panoramic`?this._schedulePanoramicSuperimposeUpdate():!t||t.interacting||t.navigating?this._abortSuperimposeSchedule():this._scheduleDefaultSuperimposeUpdate():this._abortSuperimposeSchedule()}_shouldDisableUnsupportedSuperimposeView(){return this.superimposeViewEnabled&&this.mode===`panoramic`&&!this.superimposeViewSupported}_hasActiveSuperimposeCameraContext(){return(this.mode==="default"||this.mode===`panoramic`)&&this.superimposeViewEnabled&&this.superimposeViewSupported&&this.state===`image-loaded`&&this.view?.type===`3d`&&!!this.view.camera}_abortSuperimposeSchedule(){this._superimposeScheduleController?.abort(),this._superimposeScheduleController=null,this._clearSuperimposeDebounceTimeout(),this._clearSuperimposeScheduledFrame()}_resetInactiveSuperimposeState(){let e=this._superimposePreviousCurrentCoverageVisible!=null;this._abortSuperimposeSchedule(),this._adapter?.disableDefaultSuperimposeNavigation?.(),this._adapter?.disablePanoramicSuperimposeNavigation?.(),this._superimposeService.clear(),this._restoreCurrentCoverageVisibilityAfterSuperimpose(),this._restoreDefaultMessageAfterSuperimpose(),e&&this._restoreViewerMediaAfterSuperimpose()}_restoreCurrentCoverageVisibilityAfterSuperimpose(){this._superimposePreviousCurrentCoverageVisible!=null&&(this.currentCoverageVisible=this._superimposePreviousCurrentCoverageVisible,this._superimposePreviousCurrentCoverageVisible=null)}_restoreViewerMediaAfterSuperimpose(){let{currentBestFeature:e,mode:t}=this;if(!e||t!=="default"&&t!==`panoramic`)return;this._restoreSuperimposeMediaTask?.abort();let n=i(async t=>{await this._loadCurrentFeatureMedia(e,{signal:t})});this._restoreSuperimposeMediaTask=n,n.promise.finally(()=>{this._restoreSuperimposeMediaTask===n&&(this._restoreSuperimposeMediaTask=null)})}_restoreDefaultMessageAfterSuperimpose(){this.displayMessage?.key===`superimposeImageDescription`&&(this.currentBestFeature&&(this.mode==="default"||this.mode===`panoramic`)?this.displayMessage=null:this.setMessage(`onLoadMessage`,`info`))}_clearSuperimposeDebounceTimeout(){this.superimposeDebounceTimeoutId!=null&&(clearTimeout(this.superimposeDebounceTimeoutId),this.superimposeDebounceTimeoutId=null)}_clearSuperimposeScheduledFrame(){this.superimposeScheduledFrameId!=null&&(cancelAnimationFrame(this.superimposeScheduledFrameId),this.superimposeScheduledFrameId=null)}_schedulePanoramicSuperimposeUpdate(){this._abortSuperimposeSchedule(),this.superimposeDebounceTimeoutId=window.setTimeout(()=>{this.superimposeDebounceTimeoutId=null,this._hasActiveSuperimposeCameraContext()&&this.mode===`panoramic`&&this._updateSuperimposedImage()},150)}_scheduleDefaultSuperimposeUpdate(){let e=this.view;if(!(e?.type===`3d`&&e)||this.superimposeScheduledFrameId)return;this._superimposeScheduleController?.abort();let t=new AbortController,{signal:n}=t,r=()=>{this._clearSuperimposeDebounceTimeout(),this._clearSuperimposeScheduledFrame(),this._superimposeScheduleController===t&&(this._superimposeScheduleController=null),n.removeEventListener(`abort`,r)};this._superimposeScheduleController=t,n.addEventListener(`abort`,r),this.superimposeScheduledFrameId=requestAnimationFrame(()=>{if(n.removeEventListener(`abort`,r),this.superimposeScheduledFrameId=null,this._superimposeScheduleController===t&&(this._superimposeScheduleController=null),n.aborted)return;let e=this.view,i=e?.type===`3d`?e:null;this._hasActiveSuperimposeCameraContext()&&i!=null&&!i.interacting&&!i.navigating&&this._updateSuperimposedImage()})}};e([D()],$.prototype,`activeLayer`,null),e([D({readOnly:!0})],$.prototype,`activeViewer`,null),e([D()],$.prototype,`activeTriangulatedViewer`,null),e([D()],$.prototype,`accuracyParametersMissing`,null),e([D()],$.prototype,`additionalFeatures`,void 0),e([D({type:a.ofType(t)})],$.prototype,`additionalCameraLocations`,void 0),e([D({type:a.ofType(t)})],$.prototype,`additionalFootprints`,void 0),e([D()],$.prototype,`areaMeasurementResult`,void 0),e([D()],$.prototype,`areaMeasurementAccuracy`,void 0),e([D()],$.prototype,`bestFeatureAngle`,void 0),e([D()],$.prototype,`bestFeatureCurrentFootprint`,void 0),e([D({type:t})],$.prototype,`bestFeatureFootprint`,void 0),e([D({type:Number})],$.prototype,`brightness`,null),e([D()],$.prototype,`cameraHeadingThreshold`,void 0),e([D()],$.prototype,`cameraPitchThreshold`,void 0),e([D()],$.prototype,`clickAction`,void 0),e([D()],$.prototype,`correctedLocationPointOnImage`,void 0),e([D()],$.prototype,`videoViewModel`,void 0),e([D()],$.prototype,`collectionId`,void 0),e([D({type:Number})],$.prototype,`contrast`,null),e([D()],$.prototype,`coverageFrustums`,void 0),e([D()],$.prototype,`coveragePolygons`,void 0),e([D()],$.prototype,`currentBestFeature`,void 0),e([D()],$.prototype,`currentBestFeatureMeasurementImage`,void 0),e([D()],$.prototype,`currentBestFeatureLocation`,void 0),e([D()],$.prototype,`currentCoverageVisible`,void 0),e([D()],$.prototype,`currentNode`,null),e([D()],$.prototype,`depthImage`,void 0),e([D()],$.prototype,`depthImageNotSupported`,null),e([D()],$.prototype,`featureCache`,void 0),e([D()],$.prototype,`videoFeatureIndex`,void 0),e([D()],$.prototype,`navigationNodes`,void 0),e([D({json:{write:!1}})],$.prototype,`determineWorkflowForFeature`,void 0),e([D({json:{write:!1}})],$.prototype,`determineWorkflowForTriangularMeasurement`,void 0),e([D()],$.prototype,`disabled`,void 0),e([D()],$.prototype,`displayMessage`,void 0),e([D()],$.prototype,`displayNewMeasurementButton`,void 0),e([D()],$.prototype,`distanceMeasurementResult`,void 0),e([D()],$.prototype,`distanceAccuracyArray`,void 0),e([D()],$.prototype,`dataCaptureLayer`,void 0),e([D({readOnly:!0})],$.prototype,`featureCount`,null),e([D()],$.prototype,`features`,void 0),e([D()],$.prototype,`groundCoordinates`,void 0),e([D()],$.prototype,`groundCoordinatesAccuracy`,void 0),e([D()],$.prototype,`groundCoordinatesAccuracyLoading`,void 0),e([D()],$.prototype,`hasPendingPanoramicNavigationViewState`,null),e([D()],$.prototype,`heightGraphic`,void 0),e([D()],$.prototype,`heightMeasurementResult`,void 0),e([D()],$.prototype,`heightMeasurementAccuracy`,void 0),e([D({readOnly:!0})],$.prototype,`imageGalleryEnabled`,null),e([D()],$.prototype,`imageGeometryField`,void 0),e([D({readOnly:!0})],$.prototype,`imageLoaded`,null),e([D()],$.prototype,`imageLocationToolState`,void 0),e([D()],$.prototype,`initialVideoMapViewExtent`,void 0),e([D({readOnly:!0})],$.prototype,`invalidCameraHeading`,null),e([D()],$.prototype,`imagePointsInView`,null),e([D()],$.prototype,`imageMeasurementViewer`,void 0),e([D()],$.prototype,`isAdditionalCoverageVisible`,void 0),e([D()],$.prototype,`isAdditionalPointSourcesVisible`,void 0),e([D()],$.prototype,`layer`,void 0),e([D()],$.prototype,`layerView`,null),e([D({readOnly:!0})],$.prototype,`layerFloorFilterClause`,null),e([D({readOnly:!0})],$.prototype,`layerTimeExtent`,null),e([D({type:Number})],$.prototype,`localPort`,void 0),e([D()],$.prototype,`locationPointOnImage`,void 0),e([D()],$.prototype,`mapImageConversionToolState`,void 0),e([D()],$.prototype,`measureType`,void 0),e([D()],$.prototype,`measurementGraphic`,void 0),e([D({readOnly:!0,value:`none`})],$.prototype,`mode`,null),e([D()],$.prototype,`navigationMode`,void 0),e([D()],$.prototype,`navigatorCurrentBestFeature`,void 0),e([D()],$.prototype,`oiObjectIdField`,void 0),e([D({type:a.ofType(t)})],$.prototype,`overlayedCameraLocations`,void 0),e([D()],$.prototype,`overlayedMapFeatures`,void 0),e([D()],$.prototype,`panoramicVideoLoaded`,null),e([D()],$.prototype,`panoramicVideoPaused`,null),e([D()],$.prototype,`pixelCoordinates`,void 0),e([D()],$.prototype,`preserveAngle`,void 0),e([D()],$.prototype,`pointSources`,void 0),e([D({readOnly:!0})],$.prototype,`popupEnabled`,null),e([D()],$.prototype,`preloadMedia`,void 0),e([D()],$.prototype,`preloadMediaSize`,void 0),e([D()],$.prototype,`previousFeatureAngle`,void 0),e([D()],$.prototype,`referencePoint`,null),e([D({readOnly:!0})],$.prototype,`sectorData`,null),e([D()],$.prototype,`selectedPoint`,void 0),e([D({type:Number})],$.prototype,`sharpness`,null),e([D()],$.prototype,`shouldShowSelectedImage`,void 0),e([D()],$.prototype,`superimposeViewEnabled`,void 0),e([D()],$.prototype,`defaultSuperimposeCameraLockEnabled`,void 0),e([D()],$.prototype,`superimposeViewSupported`,null),e([D()],$.prototype,`sketch`,void 0),e([D()],$.prototype,`sketchTriangular`,void 0),e([D()],$.prototype,`sketchTriangularGraphicsLayer`,void 0),e([D()],$.prototype,`draw`,void 0),e([D()],$.prototype,`drawAdapter`,void 0),e([D()],$.prototype,`polylineDrawAction`,void 0),e([D()],$.prototype,`scheduledFrameId`,void 0),e([D()],$.prototype,`superimposeScheduledFrameId`,void 0),e([D()],$.prototype,`superimposeDebounceTimeoutId`,void 0),e([D()],$.prototype,`sketchAdapter`,void 0),e([D({readOnly:!0})],$.prototype,`sketchGraphicsLayer`,null),e([D({readOnly:!0})],$.prototype,`state`,null),e([D({readOnly:!0})],$.prototype,`thumbnails`,null),e([D()],$.prototype,`videoExtentPoints`,null),e([D()],$.prototype,`triangularMeasurementActive`,void 0),e([D()],$.prototype,`triangulatedDistanceMeasurement`,void 0),e([D()],$.prototype,`triangulatedDistanceAccuracy`,void 0),e([D()],$.prototype,`triangulatedAreaMeasurement`,void 0),e([D()],$.prototype,`triangulatedAreaAccuracy`,void 0),e([D()],$.prototype,`triangulatedMeasurementGraphic`,void 0),e([D()],$.prototype,`triangulatedPoint`,void 0),e([D()],$.prototype,`triangulatedMeasurementAdapter`,void 0),e([D()],$.prototype,`updateFootprint`,void 0),e([D()],$.prototype,`updateVideoFootprint`,void 0),e([D()],$.prototype,`updateFootprintPanorama`,void 0),e([D()],$.prototype,`updatingTriangularMeasurementState`,void 0),e([D({value:null})],$.prototype,`view`,null),e([D()],$.prototype,`videoElement`,void 0),e([D()],$.prototype,`videoLayer`,void 0),e([D()],$.prototype,`videoMapView`,void 0),e([D()],$.prototype,`verticalFilterEnabled`,void 0),e([D()],$.prototype,`frustumSearchEnabled`,void 0),e([D()],$.prototype,`_adapter`,void 0),e([D()],$.prototype,`_defaultGraphicsLayer`,null),e([D()],$.prototype,`_highlightedFeatureHandle`,void 0),e([D()],$.prototype,`_imageViewer`,void 0),e([D()],$.prototype,`_initialCurrentCoverageUpdate`,void 0),e([D()],$.prototype,`_locationViewModel`,void 0),e([D()],$.prototype,`_measurementService`,void 0),e([D()],$.prototype,`_mediaPrefetcher`,void 0),e([D()],$.prototype,`_navigationManager`,void 0),e([D()],$.prototype,`_overlays`,void 0),e([D()],$.prototype,`_superimposePreviousCurrentCoverageVisible`,void 0),e([D()],$.prototype,`_superimposeService`,void 0),e([D({readOnly:!0})],$.prototype,`_overlaysView`,null),e([D()],$.prototype,`_panoramicVideoViewer`,void 0),e([D()],$.prototype,`_panoramicViewer`,void 0),e([D()],$.prototype,`_panoramicMeasurementViewer`,void 0),e([D()],$.prototype,`_referencePointOnGround`,void 0),e([D()],$.prototype,`_referencePointOnImage`,void 0),e([D()],$.prototype,`_referenceTransformationService`,void 0),e([D()],$.prototype,`_sectorData`,void 0),e([D()],$.prototype,`_transformationService`,void 0),e([D()],$.prototype,`_featureToSector`,void 0),e([D({readOnly:!0})],$.prototype,`_updatingHandles`,void 0),e([D()],$.prototype,`footprintExtent`,void 0),e([D()],$.prototype,`_featureChangedTask`,void 0),$=e([ne(`esri.widgets.OrientedImageryViewer.OrientedImageryViewerViewModel`)],$);const Et=$;export{Et as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import e from"../../request.js";import t from"../../core/Error.js";import{deg2rad as n}from"../../core/mathUtils.js";import{throwIfAborted as r}from"../../core/promiseUtils.js";import{getPathExtension as i}from"../../core/urlUtils.js";import{rotatePixel as a}from"../../layers/orientedImagery/transformations/utils.js";import{imageGalleryThumbnailSize as o}from"./constants.js";import{validateTifOrMrfExtension as s}from"./utils.js";import{getDatasetFormat as c}from"./support/urlUtils.js";const l=e=>e===`FA`,u=async(e,n,r)=>{let i=new(await(import(`../../rest/support/AttachmentQuery.js`).then(e=>e.default)))({objectIds:[n]}),a=(await e.queryAttachments(i,r))[`${n}`]?.[0],o=a?.url;if(!o)throw new t(`NoAttachmentError`,`no attachments found`,{[e.objectIdField]:n,layer:e});return{datasetFormat:a.contentType.split(
|
|
2
|
+
import e from"../../request.js";import t from"../../core/Error.js";import{deg2rad as n}from"../../core/mathUtils.js";import{throwIfAborted as r}from"../../core/promiseUtils.js";import{getPathExtension as i}from"../../core/urlUtils.js";import{rotatePixel as a}from"../../layers/orientedImagery/transformations/utils.js";import{imageGalleryThumbnailSize as o}from"./constants.js";import{validateTifOrMrfExtension as s}from"./utils.js";import{getDatasetFormat as c}from"./support/urlUtils.js";const l=e=>e===`FA`,u=async(e,n,r)=>{let i=new(await(import(`../../rest/support/AttachmentQuery.js`).then(e=>e.default)))({objectIds:[n]}),a=(await e.queryAttachments(i,r))[`${n}`]?.[0],o=a?.url;if(!o)throw new t(`NoAttachmentError`,`no attachments found`,{[e.objectIdField]:n,layer:e});return{datasetFormat:a.contentType.split(`/`,2)[1].toUpperCase(),url:o}};async function d(e,t){let n=typeof e==`string`,r=n?e:e.url,{pathname:a,searchParams:o,origin:s}=new URL(r),l=n?i(a):e.datasetFormat;l||=await c(r);let u=await(await import(`../../layers/raster/datasets/RasterFactory.js`).then(e=>e.default)).open({ioConfig:{customFetchParameters:Object.fromEntries(o),skipMapInfo:!0},datasetFormat:l?.toUpperCase(),url:`${s}${a}`,signal:t?.signal});return u?f(u,{signal:t?.signal}):null}async function f(e,t){let{level:n,offset:i,size:a}=p(e),{pixelBlock:o}=await e.fetchRawPixels(n,i,a,t);return r(t),o}function p(e){let{storageInfo:t,width:n,height:r}=e.rasterInfo,{maximumPyramidLevel:i,pyramidScalingFactor:a}=t,o=a??2;return{level:i,offset:{x:0,y:0},size:{width:Math.ceil(n/o**i),height:Math.ceil(r/o**i)}}}async function m(n,r,i){if(!n)throw new t(`NoLayerError`,`No layer provided, cannot load image from attachment`,{layer:n,objectId:r});let{datasetFormat:a,url:c}=await u(n,+r,i);return s(a)?await d({datasetFormat:a,url:c},i):(await e(c,{...i,useQueue:!0,responseType:`image`,query:{w:o}})).data}function h(e,t,n=0){let{height:r,width:i}=e;t.width=i,t.height=r;let a=t.getContext(`2d`);if(!a)return;let o=g(e,t,a);o.getContext(`2d`)&&(n>0?_(a,o,i,r,n):a.drawImage(o,0,0))}function g(e,t,n){let r=document.createElement(`canvas`),i=r.getContext(`2d`);if(e instanceof HTMLImageElement)r.width=e.width,r.height=e.height,i?.drawImage(e,0,0);else{let a=n.createImageData(t.width,t.height);a&&(a.data.set(e.getAsRGBA()),r.width=a.width,r.height=a.height,i?.putImageData(a,0,0))}return r}function _(e,t,r,i,o){let s=n(o),c=[a(0,0,s),a(r,0,s),a(r,i,s),a(0,i,s)],l=Math.max(...c.map(e=>e[0]))-Math.min(...c.map(e=>e[0])),u=Math.max(...c.map(e=>e[1]))-Math.min(...c.map(e=>e[1])),d=Math.min(r/l,i/u);e.save(),e.clearRect(0,0,r,i),e.translate(r/2,i/2),e.rotate(s),e.scale(d,d),e.drawImage(t,-r/2,-i/2,r,i),e.restore()}export{u as getImageSourceFromAttachment,d as getThumbnailPixelBlock,l as isFeatureAttachment,m as loadImageForAttachment,h as renderImageWithRotation};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import e from"../../../Graphic.js";import{createTask as t}from"../../../core/asyncUtils.js";import n from"../../../core/Collection.js";import{destroyMaybe as r}from"../../../core/maybe.js";import{throwIfAborted as i}from"../../../core/promiseUtils.js";import a from"../../../geometry/Mesh.js";import{projectAsync as o}from"../../../geometry/projectionUtils.js";import s from"../../../geometry/support/MeshComponent.js";import c from"../../../geometry/support/MeshMaterial.js";import l from"../../../geometry/support/MeshTexture.js";import u from"../../../geometry/support/MeshVertexAttributes.js";import{imageToWorldPanoramic as d}from"../../../layers/orientedImagery/transformations/imageToWorld.js";import f from"../../../symbols/FillSymbol3DLayer.js";import p from"../../../symbols/MeshSymbol3D.js";import{calculateUpdatedWmsf as m}from"../imageMeasurementUtils.js";import{validateTifOrMrfExtension as h}from"../utils.js";import g from"../support/resolveMediaProps.js";import{computeDefaultAreaOfInterest as _,getBaseRasterLevel as v,computePanoramicAreasOfInterest as y,applySphereMeshOffsetInMeters as b,getRasterFetchParameters as x,getRasterLevelSize as S,getViewDependentRasterLevel as C,clampRasterLevelForTextureSize as w,createSuperimposeGridVertexAttributes as T,createSuperimposeSamplePixels as E}from"../support/superimposeUtils.js";const D=[255,255,255,255];class O{constructor(e){this._properties=e,this._cachedBaseTexture=null,this._cachedPanoramicRadiusObjectId=null,this._defaultGraphicProperties=null,this._defaultZOffsetPercentage=50,this._defaultCameraFeature=null,this._graphics=[],this._panoramicRadiusOffsetInMeters=0,this._panoramicRadiusOffsetPercentage=50,this._panoramicRadiusOffsetRangeInMeters=0,this._panoramicNavigationFeature=null,this._rasterTextureCacheFeature=null,this._rasterTextureFetchCache=new Map,this._task=null}clear(){this._destroyGraphics(this._graphics,!0),this._cachedBaseTexture=null,this._cachedPanoramicRadiusObjectId=null,this._defaultGraphicProperties=null,this._defaultZOffsetPercentage=50,this._defaultCameraFeature=null,this._graphics=[],this._panoramicRadiusOffsetInMeters=0,this._panoramicRadiusOffsetPercentage=50,this._panoramicRadiusOffsetRangeInMeters=0,this._panoramicNavigationFeature=null,this._rasterTextureCacheFeature=null,this._rasterTextureFetchCache.clear()}destroy(){this._task=this._task?.abort()??null,this.clear()}update(e){this._task?.abort(),this._task=t(async t=>{if(!this._canUpdate(e)){this._resetInactiveState(e.adapter);return}let n=!1,r=[];try{this._resetRasterTextureCacheIfNeeded(e.currentBestFeature);let a=await this._resolveMedia(e,t);if(!a||({graphics:r}=await this._createGraphics(e,a,t),!r.length))return;await this._updateDefaultCameraIfNeeded(e,t),await this._updateNavigation(e,t),e.mode===`panoramic`&&await this._applyPersistentPanoramicRadiusOffset(r,e.currentBestFeature,e.view,t),i(t),this._replaceGraphics(r,e.mode),n=!0}finally{n||this._destroyGraphics(r,!1)}})}_canUpdate(e){return e.superimposeViewEnabled&&e.state===`image-loaded`&&e.view?.type===`3d`&&!!e.currentBestFeature&&!!e.layer&&[`default`,`panoramic`].includes(e.mode)}_resetInactiveState(e){e?.disableDefaultSuperimposeNavigation?.(),e?.disablePanoramicSuperimposeNavigation?.(),this.clear()}async _updateDefaultCameraIfNeeded(e,t){let{activeImageSize:n,currentBestFeature:r,mode:a}=e;if(n&&r&&a==="default"&&this._shouldUpdateDefaultCamera(a,r)){let a=[{x:n[0]/2,y:n[1]/2}],o=this._resolveDefaultSuperimposeDistance(r,this._defaultZOffsetPercentage)??r.attributes.farDistance,[s]=typeof o==`number`&&o>0?await this._properties.getPointAtDistance(a,o,{signal:t}):await this._properties.getMapPoint(a,{signal:t});i(t),await e.adapter?.updateDefaultSuperimposeCamera?.({currentBestFeature:r,target:s??null},{signal:t}),i(t),this._defaultCameraFeature=r}}async _resolveMedia(e,t){let{currentBestFeature:n,layer:r,mode:a,view:o}=e;if(!n||!r||!o||a!=="default"&&a!==`panoramic`)return null;let s=await g(n.attributes,r,{signal:t});if(i(t),!s?.mediaUrl)return null;if(!h(s.datasetFormat))return this._resolveNonRasterMedia(s);let c=await this._resolveRasterMedia(s,o,t);if(!c)return null;switch(a){case`default`:{let n=await this._resolveDefaultAreaOfInterest(e,s,t);return this._resolveDefaultRasterMedia(c,n,o,t)}case`panoramic`:return this._resolvePanoramicRasterMedia(c,e,t)}}_resolveNonRasterMedia(e){return{areaOfInterest:null,textureUrl:this._resolveTextureUrl(e)}}async _resolveDefaultAreaOfInterest(e,t,n){let{activeImageSize:r,currentBestFeature:a,mode:o,view:s}=e;if(o!=="default"||!r||!a||!s||!h(t.datasetFormat))return null;let c=await _(a,s,r,this._properties.pointToPixel,{signal:n});return i(n),c}async _resolveRasterMedia(e,t,n){let r=await this._loadRaster(e,{signal:n});if(i(n),!r)return null;let a=v(r,t),o=this._cachedBaseTexture;if(!o){let e=await this._createRasterTexture(r,null,a,{signal:n});i(n),e&&(o=e,this._cachedBaseTexture=e)}return o?{baseLevel:a,baseTexture:o,raster:r}:null}async _resolveDefaultRasterMedia(e,t,n,r){let{baseLevel:a,baseTexture:o,raster:s}=e;if(!t)return{areaOfInterest:null,baseTexture:o,raster:s,texture:o};let c=v(s,n,t),l=await this._createCompositedDefaultRasterTexture(s,t,c,a,{signal:r});return i(r),{areaOfInterest:t,baseTexture:o,overlayTexture:l,raster:s,texture:l??o}}async _resolvePanoramicRasterMedia(e,t,n){let{activeImageSize:r,currentBestFeature:a,view:o}=t,{baseTexture:s,raster:c}=e;if(!r||!a||!o)return{areaOfInterest:null,baseTexture:s,panoramicAreasOfInterest:void 0,raster:c,texture:s};let l=await y(a,o,r,this._properties.pointToPixel,{signal:n});i(n);let u=await this._createPanoramicRasterTexture(c,a,o,r,l,{signal:n})??s;return i(n),{areaOfInterest:null,baseTexture:s,panoramicAreasOfInterest:l,raster:c,texture:u}}async _createGraphics(e,t,n){switch(e.mode){case`default`:return this._createDefaultGraphics(e,t,n);case`panoramic`:return this._createPanoramicGraphics(e,t,n)}return{graphics:[]}}async _createDefaultGraphics(e,t,n){let r=await this._createAndDrapeDefaultGraphic(e,n,{texture:t.texture,textureUrl:t.textureUrl});return{graphics:r?[r]:[]}}async _createAndDrapeDefaultGraphic(e,t,n){let{activeImageSize:r,currentBestFeature:a,depthImageLoaded:o,view:s}=e,{areaOfInterest:c,texture:l,textureUrl:u}=n;if(!r||s?.type!==`3d`||!a)return null;let d=await this._createDefaultGraphic({areaOfInterest:c,currentBestFeature:a,depthImageLoaded:o,imageSize:r,signal:t,texture:l,textureUrl:u,view:s});if(!d)return null;let f=await this._resolveDefaultMeshPosition(d,r,s,a,c,t,100),p=await this._resolveDefaultMeshPosition(d,r,s,a,c,t,0);return i(t),this._defaultGraphicProperties={areaOfInterest:c??null,currentBestFeature:a,farPosition:p??(d.geometry?.type===`mesh`?d.geometry.vertexAttributes.position.slice():new Float64Array),imageSize:r,nearPosition:f,view:s},d}async _createPanoramicGraphics(e,t,n){let r=await this._createPanoramicSuperimposeGraphic(e,t,n,null);return{graphics:r?[r]:[]}}async _createPanoramicSuperimposeGraphic(e,t,n,r){let{activeImageSize:i,currentBestFeature:a,view:o}=e;return o?this._createPanoramicGraphic({areaOfInterest:r,currentBestFeature:a??void 0,imageSize:i,signal:n,texture:t.texture,textureUrl:t.textureUrl,view:o}):null}async _updateNavigation(e,t){let{currentBestFeature:n,mode:r,view:i}=e;if(n&&i&&i.type===`3d`)switch(r){case`default`:this._updateDefaultNavigation(e);return;case`panoramic`:await this._updatePanoramicNavigation(e,n,i,t);return}}_updateDefaultNavigation(e){this._updateDefaultSuperimposeNavigation(e.adapter,e.defaultSuperimposeCameraLockEnabled)}async _updatePanoramicNavigation(e,t,n,r){e.adapter?.disableDefaultSuperimposeNavigation?.();let a=t===this._panoramicNavigationFeature?n.camera:e.panoramicCamera??n.camera;a&&this._shouldUpdatePanoramicCamera(e.mode,t)&&(e.adapter?.disablePanoramicSuperimposeNavigation?.(),await e.adapter?.updatePanoramicSuperimposeCamera?.({camera:a,currentBestFeature:t},{signal:r}),i(r)),this._panoramicNavigationFeature=t}_replaceGraphics(e,t){if(t===`panoramic`&&this._updatePanoramicGraphicInPlace(e))return;let n=this._graphics;this._graphics=e,this._properties.overlays.addMany(e),this._destroyGraphics(n,!0)}_updatePanoramicGraphicInPlace(e){if(this._graphics.length!==1||e.length!==1)return!1;let t=this._graphics[0],n=e[0];return!t||!n?!1:(t.geometry=n.geometry,t.symbol=n.symbol,t.visible=n.visible,n.geometry=null,n.symbol=null,r(n),!0)}_destroyGraphics(e,t){e.length&&(t&&this._properties.overlays.removeMany(e),e.forEach(e=>r(e)))}_updateDefaultSuperimposeNavigation(e,t=!0){t?e?.enableDefaultSuperimposeNavigation?.():e?.disableDefaultSuperimposeNavigation?.(),this._panoramicNavigationFeature&&e?.disablePanoramicSuperimposeNavigation?.(),this._panoramicNavigationFeature=null}_shouldUpdateDefaultCamera(e,t){return e==="default"&&t!==this._defaultCameraFeature}_shouldUpdatePanoramicCamera(e,t){return e===`panoramic`&&t!==this._panoramicNavigationFeature}setDefaultZOffsetPercentage(e){this._defaultZOffsetPercentage=Math.max(0,Math.min(100,e)),this._defaultGraphicProperties&&this._graphics.length===1&&this._rebuildDefaultGraphicForPercentage(this._defaultZOffsetPercentage)}setPanoramicRadiusPercentage(e){let t=Math.max(0,Math.min(100,e)),n=this._panoramicRadiusOffsetRangeInMeters*t/100,r=n-this._panoramicRadiusOffsetInMeters;this._panoramicRadiusOffsetPercentage=t,this._panoramicRadiusOffsetInMeters=n,this._applyPanoramicRadiusOffset(this._graphics,r)}updatePanoramicRadiusOffset(e){e!==0&&(this._panoramicRadiusOffsetInMeters+=e,this._applyPanoramicRadiusOffset(this._graphics,e))}_applyPanoramicRadiusOffset(e,t){t!==0&&e.forEach(e=>{let n=e.geometry;n?.type===`mesh`&&b(n,{radiusOffset:t,minimumRadiusInMeters:10})})}async _applyPersistentPanoramicRadiusOffset(e,t,n,r){this._panoramicRadiusOffsetRangeInMeters=await this._resolvePanoramicRadiusOffsetRangeInMeters(t,n,r),this._panoramicRadiusOffsetInMeters=this._panoramicRadiusOffsetRangeInMeters*this._panoramicRadiusOffsetPercentage/100,this._applyPanoramicRadiusOffset(e,this._panoramicRadiusOffsetInMeters)}_rebuildDefaultGraphicForPercentage(e){let t=this._defaultGraphicProperties,[n]=this._graphics;if(!t||!n||n.geometry?.type!==`mesh`)return;let r=this._createDefaultMeshForPercentage(t,n.geometry,e);r&&(this._applyDefaultMeshAppearance(r,n.geometry),n.geometry=r)}_createDefaultMeshForPercentage(e,t,n){let{farPosition:r,nearPosition:i,view:o}=e;if(!i||i.length!==r.length)return null;let c=new Float64Array(r.length),l=n/100;for(let e=0;e<r.length;e+=1)c[e]=r[e]+(i[e]-r[e])*l;let d=t.vertexAttributes.uv,f=t.components;return!d||!f||f.some(e=>!e.faces)?null:new a({vertexAttributes:new u({position:c,uv:d.slice()}),components:f.map(e=>new s({faces:e.faces.slice()})),spatialReference:o.spatialReference.clone()})}_resolveDefaultSuperimposeDistance(e,t){let n=e.attributes.farDistance,r=Math.max(0,e.attributes.nearDistance??n);if(n>0&&r>=0)return n+(r-n)*t/100}async _resolvePanoramicRadiusOffsetRangeInMeters(e,t,n){let r=e.attributes.objectId;if(this._cachedPanoramicRadiusObjectId!==r){let a=e.attributes.farDistance,s=Math.max(10,e.attributes.nearDistance??a);if(!(a>0)||!(s>=0))return this._cachedPanoramicRadiusObjectId=r,this._panoramicRadiusOffsetRangeInMeters=0,0;let c=e.attributes.location,l=c.spatialReference.equals(t.spatialReference)?c:await o(c,t.spatialReference,{signal:n});if(i(n),!l)return this._cachedPanoramicRadiusObjectId=r,this._panoramicRadiusOffsetRangeInMeters=0,0;let u=l.spatialReference.isWebMercator?m(l.y):1;this._cachedPanoramicRadiusObjectId=r,this._panoramicRadiusOffsetRangeInMeters=(s-a)*u}return this._panoramicRadiusOffsetRangeInMeters}_resolveTextureUrl(e){let t=new URL(e.mediaUrl);return Object.entries(e.searchParams).forEach(([e,n])=>{t.searchParams.has(e)||t.searchParams.set(e,n)}),t.toString()}_resetRasterTextureCacheIfNeeded(e){e&&e!==this._rasterTextureCacheFeature&&(this._cachedBaseTexture=null,this._rasterTextureFetchCache.clear(),this._rasterTextureCacheFeature=e)}_createImageDataFromPixelBlock(e){return new ImageData(e.getAsRGBA(),e.width,e.height)}_copyImageData(e,t,n,r,i=e.width,a=e.height){let o=e.data,s=t.data,c=e.width,l=e.height,u=t.width,d=t.height;for(let e=0;e<a;e+=1){let t=r+e;if(t<0||t>=d)continue;let f=Math.min(l-1,Math.floor(e*l/a));for(let e=0;e<i;e+=1){let r=n+e;if(r<0||r>=u)continue;let a=Math.min(c-1,Math.floor(e*c/i)),l=(f*c+a)*4,d=(t*u+r)*4;s[d]=o[l],s[d+1]=o[l+1],s[d+2]=o[l+2],s[d+3]=o[l+3]}}}_copyImageDataRegion(e,t,n,r,i,a,o,s){let c=e.data,l=t.data,u=e.width,d=t.width;for(let e=0;e<s;e+=1)for(let t=0;t<o;t+=1){let o=((r+e)*u+(n+t))*4,s=((a+e)*d+(i+t))*4;l[s]=c[o],l[s+1]=c[o+1],l[s+2]=c[o+2],l[s+3]=c[o+3]}}async _fetchRasterTextureAtLevel(e,t,n,r){let{offset:a,size:o}=x(e,t,n),s=this._createRasterTextureExtent(a,o),c=this._createRasterTextureLevelCacheKey(e,t),l=this._getOrCreateRasterTextureLevelCache(c),u=this._getUncoveredRasterTextureExtents(s,l.patches);for(let n of u){let a=this._createRasterTextureExtentCacheKey(n),o=l.inflight.get(a);o||(o=this._fetchRasterTexturePatch(e,t,n,r),l.inflight.set(a,o));try{let e=await o;i(r),e&&l.patches.push(e)}finally{l.inflight.delete(a)}}return this._composeRasterTextureFromCachedPatches(s,l.patches)}_getOrCreateRasterTextureLevelCache(e){let t=this._rasterTextureFetchCache.get(e);return t||(t={inflight:new Map,patches:[]},this._rasterTextureFetchCache.set(e,t)),t}_createRasterTextureLevelCacheKey(e,t){return[e.url,e.rasterInfo.width,e.rasterInfo.height,t].join(`:`)}_createRasterTextureExtentCacheKey(e){return[e.xmin,e.ymin,e.xmax,e.ymax].join(`:`)}_createRasterTextureExtent(e,t){return{xmin:e.x,ymin:e.y,xmax:e.x+t.width,ymax:e.y+t.height}}_getUncoveredRasterTextureExtents(e,t){let n=[e];for(let e of t)if(n=n.flatMap(t=>this._subtractRasterTextureExtent(t,e.extent)),!n.length)break;return n}_subtractRasterTextureExtent(e,t){let n=this._intersectRasterTextureExtents(e,t);if(!n)return[e];let r=[];return e.ymin<n.ymin&&r.push({xmin:e.xmin,ymin:e.ymin,xmax:e.xmax,ymax:n.ymin}),n.ymax<e.ymax&&r.push({xmin:e.xmin,ymin:n.ymax,xmax:e.xmax,ymax:e.ymax}),e.xmin<n.xmin&&r.push({xmin:e.xmin,ymin:n.ymin,xmax:n.xmin,ymax:n.ymax}),n.xmax<e.xmax&&r.push({xmin:n.xmax,ymin:n.ymin,xmax:e.xmax,ymax:n.ymax}),r.filter(({xmin:e,ymin:t,xmax:n,ymax:r})=>n>e&&r>t)}_intersectRasterTextureExtents(e,t){let n=Math.max(e.xmin,t.xmin),r=Math.max(e.ymin,t.ymin),i=Math.min(e.xmax,t.xmax),a=Math.min(e.ymax,t.ymax);return i>n&&a>r?{xmin:n,ymin:r,xmax:i,ymax:a}:null}async _fetchRasterTexturePatch(e,t,n,r){let{pixelBlock:a}=await e.fetchRawPixels(t,{x:n.xmin,y:n.ymin},{width:n.xmax-n.xmin,height:n.ymax-n.ymin},r);if(i(r),a)return{extent:n,imageData:this._createImageDataFromPixelBlock(a)}}_composeRasterTextureFromCachedPatches(e,t){let n=t.filter(t=>this._intersectRasterTextureExtents(e,t.extent));if(!n.length)return;let r=new ImageData(e.xmax-e.xmin,e.ymax-e.ymin);for(let t of n){let n=this._intersectRasterTextureExtents(e,t.extent);n&&this._copyImageDataRegion(t.imageData,r,n.xmin-t.extent.xmin,n.ymin-t.extent.ymin,n.xmin-e.xmin,n.ymin-e.ymin,n.xmax-n.xmin,n.ymax-n.ymin)}return r}async _loadRaster(e,t){let{loadRaster:n}=await import(`../../PanoramicViewer/utils.js`),r=await n(this._resolveTextureUrl(e),t);return i(t),r}async _createCompositedDefaultRasterTexture(e,t,n,r,a){let{pyramidScalingFactor:o}=e.rasterInfo.storageInfo,s=o??2,c=S(e.rasterInfo.width,e.rasterInfo.height,n,s),u=await this._fetchRasterTextureAtLevel(e,r,null,a);if(i(a),!u)return;let d=await this._fetchRasterTextureAtLevel(e,n,t,a);if(i(a),!d)return new l({data:u});let f=new ImageData(c.width,c.height);this._copyImageData(u,f,0,0,c.width,c.height);let p=s**n,{x:m,y:h}=this._resolveRasterDrawOrigin(t,p);return this._copyImageData(d,f,m,h),new l({data:f})}async _createRasterTexture(e,t,n,r){let{maximumPyramidLevel:i}=e.rasterInfo.storageInfo,a=await this._fetchRasterTextureAtLevel(e,n??i,t,r);if(a)return new l({data:a})}async _createPanoramicRasterTexture(e,t,n,r,a,o){if(a??=await y(t,n,r,this._properties.pointToPixel,o),i(o),!a?.length)return this._createRasterTexture(e,null,void 0,o);let{baseLevel:s,level:c,scalingFactor:l}=this._resolvePanoramicRasterLevels(e,n,a);return s<=c?this._createRasterTexture(e,null,c,o):this._createCompositedPanoramicRasterTexture(e,a,{baseLevel:s,level:c,scalingFactor:l},o)}_resolvePanoramicRasterLevels(e,t,n){let{maximumPyramidLevel:r,pyramidScalingFactor:i}=e.rasterInfo.storageInfo,a=n.reduce((n,r)=>Math.min(n,C(e,t,r)),r),o=w(e,a),s=i??2;return{baseLevel:Math.min(r,o+2),level:o,scalingFactor:s}}async _createCompositedPanoramicRasterTexture(e,t,n,r){let{baseLevel:a,level:o,scalingFactor:s}=n,c=S(e.rasterInfo.width,e.rasterInfo.height,o,s),u=await this._fetchRasterTextureAtLevel(e,a,null,r);if(i(r),!u)return;let d=new ImageData(c.width,c.height);this._copyImageData(u,d,0,0,c.width,c.height);let f=s**o;for(let n of t){let t=await this._fetchRasterTextureAtLevel(e,o,n,r);if(i(r),!t)continue;let{x:a,y:s}=this._resolveRasterDrawOrigin(n,f);this._copyImageData(t,d,a,s)}return new l({data:d})}_resolveRasterDrawOrigin(e,t){return{x:Math.max(0,Math.floor(e.xmin/t)),y:Math.max(0,Math.floor(e.ymin/t))}}async _createGridMesh(e,t,n,r,c,l,d){if(t.type!==`3d`)return null;let f=await Promise.all(r.map(e=>e.spatialReference.equals(t.spatialReference)?e:o(e,t.spatialReference,d)));if(i(d),f.some(e=>!e))return null;let{faces:p,position:m,uv:h}=T(f,e,n,c);return l?.forEach((t,n)=>{let r=n*2;h[r]=t.x/e[0],h[r+1]=t.y/e[1]}),new a({vertexAttributes:new u({position:m,uv:h}),components:[new s({faces:p})],spatialReference:t.spatialReference.clone()})}async _createFootprintMesh(e,t,n,r,a,o){if(t.type!==`3d`)return null;let s=n?.attributes.farDistance,c=E(e,r),l=a??s,u=typeof l==`number`&&l>0?await this._properties.getPointAtDistance(c,l,o):await this._properties.getMapPoint(c,o);return i(o),this._createGridMesh(e,t,r,u)}async _resolveDefaultMeshPosition(e,t,n,r,a,o,s){let c=e.geometry;if(c?.type===`mesh`&&s===this._defaultZOffsetPercentage)return c.vertexAttributes.position.slice();let l=this._resolveDefaultSuperimposeDistance(r,s),u=await this._createFootprintMesh(t,n,r,a,l,{signal:o});return i(o),u?.vertexAttributes.position.slice()??null}async _createPanoramicGraphic(t){let{areaOfInterest:r,imageSize:i,signal:a,texture:o,textureUrl:s,view:u}=t;if(!o&&!s)throw Error(`Missing texture URL or texture data.`);if(!i)return null;let d=await this._createPanoramicMesh(i,u,r,t.currentBestFeature,a);if(!d)return null;let m=d.vertexAttributes.position,h=[];for(let e=0;e<m.length;e+=3)h.push(...D);d.vertexAttributes.color=new Uint8Array(h);let g=new c({colorTexture:o??new l({url:s})});return d.components?.forEach(e=>{e.shading=`source`,e.material=g}),new e({geometry:d,symbol:new p({symbolLayers:new n([new f({})])})})}async _createPanoramicMesh(e,t,n,r,a){if(t.type!==`3d`||!r)return null;let{attributes:o}=r,{farDistance:s}=o;if(typeof s!=`number`||!(s>0))return null;let c=E(e,n,128),l=this._properties.getPanoramicTransformationState?.();if(!l)return null;let{imageToWorldProperties:u,updateElevationProps:f}=l,p=await d(c.map(e=>({...e,depth:s??u.farDistance})),u,f);return i(a),this._createGridMesh(e,t,n,p,128,c)}async _createDefaultGraphic(t){let{texture:r,textureUrl:i}=t;if(!r&&!i)throw Error(`Missing texture URL or texture data.`);if(!t.imageSize)return null;let a=t.currentBestFeature?this._resolveDefaultSuperimposeDistance(t.currentBestFeature,this._defaultZOffsetPercentage):void 0,o=await this._createFootprintMesh(t.imageSize,t.view,t.currentBestFeature,t.areaOfInterest,a,{signal:t.signal});return o?(this._applyDefaultMeshAppearance(o,r??new l({url:i})),new e({geometry:o,symbol:new p({symbolLayers:new n([new f({})])})})):null}_applyDefaultMeshAppearance(e,t){let n=e.vertexAttributes.position,r=[];for(let e=0;e<n.length;e+=3)r.push(...D);e.vertexAttributes.color=new Uint8Array(r);let i=t instanceof a?t.components?.[0]?.material??null:new c({colorTexture:t});e.components?.forEach((e,n)=>{e.shading=`source`,e.material=t instanceof a?t.components?.[n]?.material??i:i})}}export{O as default};
|
|
2
|
+
import e from"../../../Graphic.js";import{createTask as t}from"../../../core/asyncUtils.js";import n from"../../../core/Collection.js";import{destroyMaybe as r}from"../../../core/maybe.js";import{throwIfAborted as i}from"../../../core/promiseUtils.js";import a from"../../../geometry/Mesh.js";import{projectAsync as o}from"../../../geometry/projectionUtils.js";import s from"../../../geometry/support/MeshComponent.js";import c from"../../../geometry/support/MeshMaterial.js";import l from"../../../geometry/support/MeshTexture.js";import u from"../../../geometry/support/MeshVertexAttributes.js";import{imageToWorldPanoramic as d}from"../../../layers/orientedImagery/transformations/imageToWorld.js";import f from"../../../symbols/FillSymbol3DLayer.js";import p from"../../../symbols/MeshSymbol3D.js";import{calculateUpdatedWmsf as m}from"../imageMeasurementUtils.js";import{validateTifOrMrfExtension as h}from"../utils.js";import g from"../support/resolveMediaProps.js";import{computeDefaultAreaOfInterest as _,getBaseRasterLevel as v,computePanoramicAreasOfInterest as y,applySphereMeshOffsetInMeters as b,getRasterFetchParameters as x,getRasterLevelSize as S,getViewDependentRasterLevel as C,clampRasterLevelForTextureSize as w,createSuperimposeGridVertexAttributes as T,createSuperimposeSamplePixels as E}from"../support/superimposeUtils.js";const D=[255,255,255,255];class O{constructor(e){this._properties=e,this._cachedBaseTexture=null,this._cachedPanoramicRadiusObjectId=null,this._defaultGraphicProperties=null,this._defaultZOffsetPercentage=50,this._defaultCameraFeature=null,this._graphics=[],this._panoramicRadiusOffsetInMeters=0,this._panoramicRadiusOffsetPercentage=50,this._panoramicRadiusOffsetRangeInMeters=0,this._panoramicNavigationFeature=null,this._rasterTextureCacheFeature=null,this._rasterTextureFetchCache=new Map,this._task=null}clear(){this._destroyGraphics(this._graphics,!0),this._cachedBaseTexture=null,this._cachedPanoramicRadiusObjectId=null,this._defaultGraphicProperties=null,this._defaultZOffsetPercentage=50,this._defaultCameraFeature=null,this._graphics=[],this._panoramicRadiusOffsetInMeters=0,this._panoramicRadiusOffsetPercentage=50,this._panoramicRadiusOffsetRangeInMeters=0,this._panoramicNavigationFeature=null,this._rasterTextureCacheFeature=null,this._rasterTextureFetchCache.clear()}destroy(){this._task=this._task?.abort()??null,this.clear()}update(e){this._task?.abort(),this._task=t(async t=>{if(!this._canUpdate(e)){this._resetInactiveState(e.adapter);return}let n=!1,r=[];try{this._resetRasterTextureCacheIfNeeded(e.currentBestFeature);let a=await this._resolveMedia(e,t);if(!a||({graphics:r}=await this._createGraphics(e,a,t),!r.length))return;await this._updateDefaultCameraIfNeeded(e,t),await this._updateNavigation(e,t),e.mode===`panoramic`&&await this._applyPersistentPanoramicRadiusOffset(r,e.currentBestFeature,e.view,t),i(t),this._replaceGraphics(r,e.mode),n=!0}finally{n||this._destroyGraphics(r,!1)}})}_canUpdate(e){return e.superimposeViewEnabled&&e.state===`image-loaded`&&e.view?.type===`3d`&&!!e.currentBestFeature&&!!e.layer&&[`default`,`panoramic`].includes(e.mode)}_resetInactiveState(e){e?.disableDefaultSuperimposeNavigation?.(),e?.disablePanoramicSuperimposeNavigation?.(),this.clear()}async _updateDefaultCameraIfNeeded(e,t){let{activeImageSize:n,currentBestFeature:r,mode:a}=e;if(n&&r&&a==="default"&&this._shouldUpdateDefaultCamera(a,r)){let a=[{x:n[0]/2,y:n[1]/2}],o=this._resolveDefaultSuperimposeDistance(r,this._defaultZOffsetPercentage)??r.attributes.farDistance,[s]=typeof o==`number`&&o>0?await this._properties.getPointAtDistance(a,o,{signal:t}):await this._properties.getMapPoint(a,{signal:t});i(t),await e.adapter?.updateDefaultSuperimposeCamera?.({currentBestFeature:r,target:s??null},{signal:t}),i(t),this._defaultCameraFeature=r}}async _resolveMedia(e,t){let{currentBestFeature:n,layer:r,mode:a,view:o}=e;if(!n||!r||!o||a!=="default"&&a!==`panoramic`)return null;let s=await g(n.attributes,r,{signal:t});if(i(t),!s?.mediaUrl)return null;if(!h(s.datasetFormat))return this._resolveNonRasterMedia(s);let c=await this._resolveRasterMedia(s,o,t);if(!c)return null;switch(a){case`default`:{let n=await this._resolveDefaultAreaOfInterest(e,s,t);return this._resolveDefaultRasterMedia(c,n,o,t)}case`panoramic`:return this._resolvePanoramicRasterMedia(c,e,t)}}_resolveNonRasterMedia(e){return{areaOfInterest:null,textureUrl:this._resolveTextureUrl(e)}}async _resolveDefaultAreaOfInterest(e,t,n){let{activeImageSize:r,currentBestFeature:a,mode:o,view:s}=e;if(o!=="default"||!r||!a||!s||!h(t.datasetFormat))return null;let c=await _(a,s,r,this._properties.pointToPixel,{signal:n});return i(n),c}async _resolveRasterMedia(e,t,n){let r=await this._loadRaster(e,{signal:n});if(i(n),!r)return null;let a=v(r,t),o=this._cachedBaseTexture;if(!o){let e=await this._createRasterTexture(r,null,a,{signal:n});i(n),e&&(o=e,this._cachedBaseTexture=e)}return o?{baseLevel:a,baseTexture:o,raster:r}:null}async _resolveDefaultRasterMedia(e,t,n,r){let{baseLevel:a,baseTexture:o,raster:s}=e;if(!t)return{areaOfInterest:null,baseTexture:o,raster:s,texture:o};let c=v(s,n,t),l=await this._createCompositedDefaultRasterTexture(s,t,c,a,{signal:r});return i(r),{areaOfInterest:t,baseTexture:o,overlayTexture:l,raster:s,texture:l??o}}async _resolvePanoramicRasterMedia(e,t,n){let{activeImageSize:r,currentBestFeature:a,view:o}=t,{baseTexture:s,raster:c}=e;if(!r||!a||!o)return{areaOfInterest:null,baseTexture:s,panoramicAreasOfInterest:void 0,raster:c,texture:s};let l=await y(a,o,r,this._properties.pointToPixel,{signal:n});i(n);let u=await this._createPanoramicRasterTexture(c,a,o,r,l,{signal:n})??s;return i(n),{areaOfInterest:null,baseTexture:s,panoramicAreasOfInterest:l,raster:c,texture:u}}async _createGraphics(e,t,n){switch(e.mode){case`default`:return this._createDefaultGraphics(e,t,n);case`panoramic`:return this._createPanoramicGraphics(e,t,n)}return{graphics:[]}}async _createDefaultGraphics(e,t,n){let r=await this._createAndDrapeDefaultGraphic(e,n,{texture:t.texture,textureUrl:t.textureUrl});return{graphics:r?[r]:[]}}async _createAndDrapeDefaultGraphic(e,t,n){let{activeImageSize:r,currentBestFeature:a,depthImageLoaded:o,view:s}=e,{areaOfInterest:c,texture:l,textureUrl:u}=n;if(!r||s?.type!==`3d`||!a)return null;let d=await this._createDefaultGraphic({areaOfInterest:c,currentBestFeature:a,depthImageLoaded:o,imageSize:r,signal:t,texture:l,textureUrl:u,view:s});if(!d)return null;let f=await this._resolveDefaultMeshPosition(d,r,s,a,c,t,100),p=await this._resolveDefaultMeshPosition(d,r,s,a,c,t,0);return i(t),this._defaultGraphicProperties={areaOfInterest:c??null,currentBestFeature:a,farPosition:p??(d.geometry?.type===`mesh`?d.geometry.vertexAttributes.position.slice():new Float64Array),imageSize:r,nearPosition:f,view:s},d}async _createPanoramicGraphics(e,t,n){let r=await this._createPanoramicSuperimposeGraphic(e,t,n,null);return{graphics:r?[r]:[]}}async _createPanoramicSuperimposeGraphic(e,t,n,r){let{activeImageSize:i,currentBestFeature:a,view:o}=e;return o?this._createPanoramicGraphic({areaOfInterest:r,currentBestFeature:a??void 0,imageSize:i,signal:n,texture:t.texture,textureUrl:t.textureUrl,view:o}):null}async _updateNavigation(e,t){let{currentBestFeature:n,mode:r,view:i}=e;if(n&&i&&i.type===`3d`)switch(r){case`default`:this._updateDefaultNavigation(e);return;case`panoramic`:await this._updatePanoramicNavigation(e,n,i,t);return}}_updateDefaultNavigation(e){this._updateDefaultSuperimposeNavigation(e.adapter,e.defaultSuperimposeCameraLockEnabled)}async _updatePanoramicNavigation(e,t,n,r){e.adapter?.disableDefaultSuperimposeNavigation?.();let a=t===this._panoramicNavigationFeature?n.camera:e.panoramicCamera??n.camera;a&&this._shouldUpdatePanoramicCamera(e.mode,t)&&(e.adapter?.disablePanoramicSuperimposeNavigation?.(),await e.adapter?.updatePanoramicSuperimposeCamera?.({camera:a,currentBestFeature:t},{signal:r}),i(r)),this._panoramicNavigationFeature=t}_replaceGraphics(e,t){if(t===`panoramic`&&this._updatePanoramicGraphicInPlace(e))return;let n=this._graphics;this._graphics=e,this._properties.overlays.addMany(e),this._destroyGraphics(n,!0)}_updatePanoramicGraphicInPlace(e){if(this._graphics.length!==1||e.length!==1)return!1;let t=this._graphics[0],n=e[0];return!t||!n?!1:(t.geometry=n.geometry,t.symbol=n.symbol,t.visible=n.visible,n.geometry=null,n.symbol=null,r(n),!0)}_destroyGraphics(e,t){e.length&&(t&&this._properties.overlays.removeMany(e),e.forEach(e=>r(e)))}_updateDefaultSuperimposeNavigation(e,t=!0){t?e?.enableDefaultSuperimposeNavigation?.():e?.disableDefaultSuperimposeNavigation?.(),this._panoramicNavigationFeature&&e?.disablePanoramicSuperimposeNavigation?.(),this._panoramicNavigationFeature=null}_shouldUpdateDefaultCamera(e,t){return e==="default"&&t!==this._defaultCameraFeature}_shouldUpdatePanoramicCamera(e,t){return e===`panoramic`&&t!==this._panoramicNavigationFeature}setDefaultZOffsetPercentage(e){this._defaultZOffsetPercentage=Math.max(0,Math.min(100,e)),this._defaultGraphicProperties&&this._graphics.length===1&&this._rebuildDefaultGraphicForPercentage(this._defaultZOffsetPercentage)}setPanoramicRadiusPercentage(e){let t=Math.max(0,Math.min(100,e)),n=this._panoramicRadiusOffsetRangeInMeters*t/100,r=n-this._panoramicRadiusOffsetInMeters;this._panoramicRadiusOffsetPercentage=t,this._panoramicRadiusOffsetInMeters=n,this._applyPanoramicRadiusOffset(this._graphics,r)}updatePanoramicRadiusOffset(e){e!==0&&(this._panoramicRadiusOffsetInMeters+=e,this._applyPanoramicRadiusOffset(this._graphics,e))}_applyPanoramicRadiusOffset(e,t){t!==0&&e.forEach(e=>{let n=e.geometry;n?.type===`mesh`&&b(n,{radiusOffset:t,minimumRadiusInMeters:10})})}async _applyPersistentPanoramicRadiusOffset(e,t,n,r){this._panoramicRadiusOffsetRangeInMeters=await this._resolvePanoramicRadiusOffsetRangeInMeters(t,n,r),this._panoramicRadiusOffsetInMeters=this._panoramicRadiusOffsetRangeInMeters*this._panoramicRadiusOffsetPercentage/100,this._applyPanoramicRadiusOffset(e,this._panoramicRadiusOffsetInMeters)}_rebuildDefaultGraphicForPercentage(e){let t=this._defaultGraphicProperties,[n]=this._graphics;if(!t||!n||n.geometry?.type!==`mesh`)return;let r=this._createDefaultMeshForPercentage(t,n.geometry,e);r&&(this._applyDefaultMeshAppearance(r,n.geometry),n.geometry=r)}_createDefaultMeshForPercentage(e,t,n){let{farPosition:r,nearPosition:i,view:o}=e;if(!i||i.length!==r.length)return null;let c=new Float64Array(r.length),l=n/100;for(let e=0;e<r.length;e+=1)c[e]=r[e]+(i[e]-r[e])*l;let d=t.vertexAttributes.uv,f=t.components;return!d||!f||f.some(e=>!e.faces)?null:new a({vertexAttributes:new u({position:c,uv:d.slice()}),components:f.map(e=>new s({faces:e.faces.slice()})),spatialReference:o.spatialReference.clone()})}_resolveDefaultSuperimposeDistance(e,t){let n=e.attributes.farDistance,r=Math.max(0,e.attributes.nearDistance??n);if(n>0&&r>=0)return n+(r-n)*t/100}async _resolvePanoramicRadiusOffsetRangeInMeters(e,t,n){let r=e.attributes.objectId;if(this._cachedPanoramicRadiusObjectId!==r){let a=e.attributes.farDistance,s=Math.max(10,e.attributes.nearDistance??a);if(!(a>0)||!(s>=0))return this._cachedPanoramicRadiusObjectId=r,this._panoramicRadiusOffsetRangeInMeters=0,0;let c=e.attributes.location,l=c.spatialReference.equals(t.spatialReference)?c:await o(c,t.spatialReference,{signal:n});if(i(n),!l)return this._cachedPanoramicRadiusObjectId=r,this._panoramicRadiusOffsetRangeInMeters=0,0;let u=l.spatialReference.isWebMercator?m(l.y):1;this._cachedPanoramicRadiusObjectId=r,this._panoramicRadiusOffsetRangeInMeters=(s-a)*u}return this._panoramicRadiusOffsetRangeInMeters}_resolveTextureUrl(e){let t=new URL(e.mediaUrl);return Object.entries(e.searchParams).forEach(([e,n])=>{t.searchParams.has(e)||t.searchParams.set(e,n)}),t.href}_resetRasterTextureCacheIfNeeded(e){e&&e!==this._rasterTextureCacheFeature&&(this._cachedBaseTexture=null,this._rasterTextureFetchCache.clear(),this._rasterTextureCacheFeature=e)}_createImageDataFromPixelBlock(e){return new ImageData(e.getAsRGBA(),e.width,e.height)}_copyImageData(e,t,n,r,i=e.width,a=e.height){let o=e.data,s=t.data,c=e.width,l=e.height,u=t.width,d=t.height;for(let e=0;e<a;e+=1){let t=r+e;if(t<0||t>=d)continue;let f=Math.min(l-1,Math.floor(e*l/a));for(let e=0;e<i;e+=1){let r=n+e;if(r<0||r>=u)continue;let a=Math.min(c-1,Math.floor(e*c/i)),l=(f*c+a)*4,d=(t*u+r)*4;s[d]=o[l],s[d+1]=o[l+1],s[d+2]=o[l+2],s[d+3]=o[l+3]}}}_copyImageDataRegion(e,t,n,r,i,a,o,s){let c=e.data,l=t.data,u=e.width,d=t.width;for(let e=0;e<s;e+=1)for(let t=0;t<o;t+=1){let o=((r+e)*u+(n+t))*4,s=((a+e)*d+(i+t))*4;l[s]=c[o],l[s+1]=c[o+1],l[s+2]=c[o+2],l[s+3]=c[o+3]}}async _fetchRasterTextureAtLevel(e,t,n,r){let{offset:a,size:o}=x(e,t,n),s=this._createRasterTextureExtent(a,o),c=this._createRasterTextureLevelCacheKey(e,t),l=this._getOrCreateRasterTextureLevelCache(c),u=this._getUncoveredRasterTextureExtents(s,l.patches);for(let n of u){let a=this._createRasterTextureExtentCacheKey(n),o=l.inflight.get(a);o||(o=this._fetchRasterTexturePatch(e,t,n,r),l.inflight.set(a,o));try{let e=await o;i(r),e&&l.patches.push(e)}finally{l.inflight.delete(a)}}return this._composeRasterTextureFromCachedPatches(s,l.patches)}_getOrCreateRasterTextureLevelCache(e){let t=this._rasterTextureFetchCache.get(e);return t||(t={inflight:new Map,patches:[]},this._rasterTextureFetchCache.set(e,t)),t}_createRasterTextureLevelCacheKey(e,t){return[e.url,e.rasterInfo.width,e.rasterInfo.height,t].join(`:`)}_createRasterTextureExtentCacheKey(e){return[e.xmin,e.ymin,e.xmax,e.ymax].join(`:`)}_createRasterTextureExtent(e,t){return{xmin:e.x,ymin:e.y,xmax:e.x+t.width,ymax:e.y+t.height}}_getUncoveredRasterTextureExtents(e,t){let n=[e];for(let e of t)if(n=n.flatMap(t=>this._subtractRasterTextureExtent(t,e.extent)),!n.length)break;return n}_subtractRasterTextureExtent(e,t){let n=this._intersectRasterTextureExtents(e,t);if(!n)return[e];let r=[];return e.ymin<n.ymin&&r.push({xmin:e.xmin,ymin:e.ymin,xmax:e.xmax,ymax:n.ymin}),n.ymax<e.ymax&&r.push({xmin:e.xmin,ymin:n.ymax,xmax:e.xmax,ymax:e.ymax}),e.xmin<n.xmin&&r.push({xmin:e.xmin,ymin:n.ymin,xmax:n.xmin,ymax:n.ymax}),n.xmax<e.xmax&&r.push({xmin:n.xmax,ymin:n.ymin,xmax:e.xmax,ymax:n.ymax}),r.filter(({xmin:e,ymin:t,xmax:n,ymax:r})=>n>e&&r>t)}_intersectRasterTextureExtents(e,t){let n=Math.max(e.xmin,t.xmin),r=Math.max(e.ymin,t.ymin),i=Math.min(e.xmax,t.xmax),a=Math.min(e.ymax,t.ymax);return i>n&&a>r?{xmin:n,ymin:r,xmax:i,ymax:a}:null}async _fetchRasterTexturePatch(e,t,n,r){let{pixelBlock:a}=await e.fetchRawPixels(t,{x:n.xmin,y:n.ymin},{width:n.xmax-n.xmin,height:n.ymax-n.ymin},r);if(i(r),a)return{extent:n,imageData:this._createImageDataFromPixelBlock(a)}}_composeRasterTextureFromCachedPatches(e,t){let n=t.filter(t=>this._intersectRasterTextureExtents(e,t.extent));if(!n.length)return;let r=new ImageData(e.xmax-e.xmin,e.ymax-e.ymin);for(let t of n){let n=this._intersectRasterTextureExtents(e,t.extent);n&&this._copyImageDataRegion(t.imageData,r,n.xmin-t.extent.xmin,n.ymin-t.extent.ymin,n.xmin-e.xmin,n.ymin-e.ymin,n.xmax-n.xmin,n.ymax-n.ymin)}return r}async _loadRaster(e,t){let{loadRaster:n}=await import(`../../PanoramicViewer/utils.js`),r=await n(this._resolveTextureUrl(e),t);return i(t),r}async _createCompositedDefaultRasterTexture(e,t,n,r,a){let{pyramidScalingFactor:o}=e.rasterInfo.storageInfo,s=o??2,c=S(e.rasterInfo.width,e.rasterInfo.height,n,s),u=await this._fetchRasterTextureAtLevel(e,r,null,a);if(i(a),!u)return;let d=await this._fetchRasterTextureAtLevel(e,n,t,a);if(i(a),!d)return new l({data:u});let f=new ImageData(c.width,c.height);this._copyImageData(u,f,0,0,c.width,c.height);let p=s**n,{x:m,y:h}=this._resolveRasterDrawOrigin(t,p);return this._copyImageData(d,f,m,h),new l({data:f})}async _createRasterTexture(e,t,n,r){let{maximumPyramidLevel:i}=e.rasterInfo.storageInfo,a=await this._fetchRasterTextureAtLevel(e,n??i,t,r);if(a)return new l({data:a})}async _createPanoramicRasterTexture(e,t,n,r,a,o){if(a??=await y(t,n,r,this._properties.pointToPixel,o),i(o),!a?.length)return this._createRasterTexture(e,null,void 0,o);let{baseLevel:s,level:c,scalingFactor:l}=this._resolvePanoramicRasterLevels(e,n,a);return s<=c?this._createRasterTexture(e,null,c,o):this._createCompositedPanoramicRasterTexture(e,a,{baseLevel:s,level:c,scalingFactor:l},o)}_resolvePanoramicRasterLevels(e,t,n){let{maximumPyramidLevel:r,pyramidScalingFactor:i}=e.rasterInfo.storageInfo,a=n.reduce((n,r)=>Math.min(n,C(e,t,r)),r),o=w(e,a),s=i??2;return{baseLevel:Math.min(r,o+2),level:o,scalingFactor:s}}async _createCompositedPanoramicRasterTexture(e,t,n,r){let{baseLevel:a,level:o,scalingFactor:s}=n,c=S(e.rasterInfo.width,e.rasterInfo.height,o,s),u=await this._fetchRasterTextureAtLevel(e,a,null,r);if(i(r),!u)return;let d=new ImageData(c.width,c.height);this._copyImageData(u,d,0,0,c.width,c.height);let f=s**o;for(let n of t){let t=await this._fetchRasterTextureAtLevel(e,o,n,r);if(i(r),!t)continue;let{x:a,y:s}=this._resolveRasterDrawOrigin(n,f);this._copyImageData(t,d,a,s)}return new l({data:d})}_resolveRasterDrawOrigin(e,t){return{x:Math.max(0,Math.floor(e.xmin/t)),y:Math.max(0,Math.floor(e.ymin/t))}}async _createGridMesh(e,t,n,r,c,l,d){if(t.type!==`3d`)return null;let f=await Promise.all(r.map(e=>e.spatialReference.equals(t.spatialReference)?e:o(e,t.spatialReference,d)));if(i(d),f.some(e=>!e))return null;let{faces:p,position:m,uv:h}=T(f,e,n,c);return l?.forEach((t,n)=>{let r=n*2;h[r]=t.x/e[0],h[r+1]=t.y/e[1]}),new a({vertexAttributes:new u({position:m,uv:h}),components:[new s({faces:p})],spatialReference:t.spatialReference.clone()})}async _createFootprintMesh(e,t,n,r,a,o){if(t.type!==`3d`)return null;let s=n?.attributes.farDistance,c=E(e,r),l=a??s,u=typeof l==`number`&&l>0?await this._properties.getPointAtDistance(c,l,o):await this._properties.getMapPoint(c,o);return i(o),this._createGridMesh(e,t,r,u)}async _resolveDefaultMeshPosition(e,t,n,r,a,o,s){let c=e.geometry;if(c?.type===`mesh`&&s===this._defaultZOffsetPercentage)return c.vertexAttributes.position.slice();let l=this._resolveDefaultSuperimposeDistance(r,s),u=await this._createFootprintMesh(t,n,r,a,l,{signal:o});return i(o),u?.vertexAttributes.position.slice()??null}async _createPanoramicGraphic(t){let{areaOfInterest:r,imageSize:i,signal:a,texture:o,textureUrl:s,view:u}=t;if(!o&&!s)throw Error(`Missing texture URL or texture data.`);if(!i)return null;let d=await this._createPanoramicMesh(i,u,r,t.currentBestFeature,a);if(!d)return null;let m=d.vertexAttributes.position,h=[];for(let e=0;e<m.length;e+=3)h.push(...D);d.vertexAttributes.color=new Uint8Array(h);let g=new c({colorTexture:o??new l({url:s})});return d.components?.forEach(e=>{e.shading=`source`,e.material=g}),new e({geometry:d,symbol:new p({symbolLayers:new n([new f({})])})})}async _createPanoramicMesh(e,t,n,r,a){if(t.type!==`3d`||!r)return null;let{attributes:o}=r,{farDistance:s}=o;if(typeof s!=`number`||!(s>0))return null;let c=E(e,n,128),l=this._properties.getPanoramicTransformationState?.();if(!l)return null;let{imageToWorldProperties:u,updateElevationProps:f}=l,p=await d(c.map(e=>({...e,depth:s??u.farDistance})),u,f);return i(a),this._createGridMesh(e,t,n,p,128,c)}async _createDefaultGraphic(t){let{texture:r,textureUrl:i}=t;if(!r&&!i)throw Error(`Missing texture URL or texture data.`);if(!t.imageSize)return null;let a=t.currentBestFeature?this._resolveDefaultSuperimposeDistance(t.currentBestFeature,this._defaultZOffsetPercentage):void 0,o=await this._createFootprintMesh(t.imageSize,t.view,t.currentBestFeature,t.areaOfInterest,a,{signal:t.signal});return o?(this._applyDefaultMeshAppearance(o,r??new l({url:i})),new e({geometry:o,symbol:new p({symbolLayers:new n([new f({})])})})):null}_applyDefaultMeshAppearance(e,t){let n=e.vertexAttributes.position,r=[];for(let e=0;e<n.length;e+=3)r.push(...D);e.vertexAttributes.color=new Uint8Array(r);let i=t instanceof a?t.components?.[0]?.material??null:new c({colorTexture:t});e.components?.forEach((e,n)=>{e.shading=`source`,e.material=t instanceof a?t.components?.[n]?.material??i:i})}}export{O as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import e from"../../../request.js";const t=/\.(\w+)$/;function n(e){let n=new URL(e).pathname.match(t);return!n||n.length<2?null:n[1].toUpperCase()}const r=async(t,n)=>{let r=(await e(t,{...n,method:`head`}))?.getHeader?.(`Content-Type`);return r?r.split(
|
|
2
|
+
import e from"../../../request.js";const t=/\.(\w+)$/;function n(e){let n=new URL(e).pathname.match(t);return!n||n.length<2?null:n[1].toUpperCase()}const r=async(t,n)=>{let r=(await e(t,{...n,method:`head`}))?.getHeader?.(`Content-Type`);return r?r.split(`/`,2)[1]:null};export{r as getDatasetFormat,n as guessExtensionFromURI};
|