@arcgis/core 5.1.0-next.12 → 5.1.0-next.14

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.
Files changed (258) hide show
  1. package/applications/Components/SketchTooltipControls.d.ts +3 -2
  2. package/applications/Components/SketchTooltipControls.js +1 -1
  3. package/assets/esri/core/workers/RemoteClient.js +1 -1
  4. package/assets/esri/core/workers/chunks/0184b4c0c92c76c60ab2.js +1 -0
  5. package/assets/esri/core/workers/chunks/{56a296cb5c1ae1ea5ab2.js → 08616877b58b518e7461.js} +1 -1
  6. package/assets/esri/core/workers/chunks/089cef7124173a5cd5f9.js +1 -0
  7. package/assets/esri/core/workers/chunks/{4d438627dd3509f65d5a.js → 0baa0d66003d23cc76a7.js} +1 -1
  8. package/assets/esri/core/workers/chunks/0e216f0075fd531c3a2b.js +1 -0
  9. package/assets/esri/core/workers/chunks/{d5314786df52b6be5307.js → 0e6ffb02a929130ddb50.js} +1 -1
  10. package/assets/esri/core/workers/chunks/{ae0a555b047b11aa68eb.js → 1219b588f983b4f35033.js} +1 -1
  11. package/assets/esri/core/workers/chunks/{41fe4d8fe97388498f73.js → 13512a23655258fa77f4.js} +1 -1
  12. package/assets/esri/core/workers/chunks/{ee34f14bbfe619b85a80.js → 13e913aa5f5113fceb16.js} +1 -1
  13. package/assets/esri/core/workers/chunks/{d621cdd0aef6d77986f0.js → 1469e6d1d0d4e310b8f8.js} +1 -1
  14. package/assets/esri/core/workers/chunks/{b9e90875943703486227.js → 15ba0296403dd4152b88.js} +1 -1
  15. package/assets/esri/core/workers/chunks/{7595c52b1647f092c61a.js → 16abc548724e428c325a.js} +1 -1
  16. package/assets/esri/core/workers/chunks/{dddcae86e434d93b10c0.js → 189e22df73414a1a3989.js} +1 -1
  17. package/assets/esri/core/workers/chunks/{90aeef17af12cfbecb36.js → 1d124a55f6804be19e09.js} +1 -1
  18. package/assets/esri/core/workers/chunks/{63831996ad82bd3b1ca9.js → 1e29a114c1cfe21121c4.js} +1 -1
  19. package/assets/esri/core/workers/chunks/{153a9d087e0fe7072af4.js → 1ede5fa7a16839ed9444.js} +1 -1
  20. package/assets/esri/core/workers/chunks/{6b1e1fb4e9010873c171.js → 1f30558e3ad6ac68bdb8.js} +1 -1
  21. package/assets/esri/core/workers/chunks/{9c06b803912fcafa7f52.js → 24dd404612c35f6a3fc3.js} +1 -1
  22. package/assets/esri/core/workers/chunks/{b6e155b42a4a423139e7.js → 27d1f8279df34d8b15b5.js} +1 -1
  23. package/assets/esri/core/workers/chunks/{401af6d07c9f458ae067.js → 2c69d8bb1c950b95278d.js} +1 -1
  24. package/assets/esri/core/workers/chunks/{22d12c309af9c19a1a48.js → 2c7e5b78d94e5850537b.js} +1 -1
  25. package/assets/esri/core/workers/chunks/{120a5fa9b46084cd0c45.js → 2d376f82cdf020e1fca9.js} +1 -1
  26. package/assets/esri/core/workers/chunks/{8c321c6bc344544ebb51.js → 2d52b137ee64469a46b2.js} +1 -1
  27. package/assets/esri/core/workers/chunks/2d67ab4927a968d5c8d4.js +1 -0
  28. package/assets/esri/core/workers/chunks/{5b3f2bad61a0d993bf16.js → 2e63e18df96e5a2461de.js} +1 -1
  29. package/assets/esri/core/workers/chunks/{d4da3abbd3d88cd63cb9.js → 454150571b5b664b576a.js} +1 -1
  30. package/assets/esri/core/workers/chunks/4740d319f233b7f528fe.js +1 -0
  31. package/assets/esri/core/workers/chunks/{78ce6fcb72e97d3dc087.js → 499d594dc0d282dfe777.js} +1 -1
  32. package/assets/esri/core/workers/chunks/49d58bacb5b397246978.js +1 -0
  33. package/assets/esri/core/workers/chunks/4ba4aa6c75e3f8950e65.js +1 -0
  34. package/assets/esri/core/workers/chunks/{61ce373f00a0cad113ed.js → 4f2c29168c9de0b08741.js} +1 -1
  35. package/assets/esri/core/workers/chunks/{5789898948cc0da78b8b.js → 552e5c413828e181f89a.js} +1 -1
  36. package/assets/esri/core/workers/chunks/{5210bde0a05ab172ab28.js → 59f955c7d6b0589e7cc6.js} +1 -1
  37. package/assets/esri/core/workers/chunks/{5fe0bed2a0a9f8eadb28.js → 5a347b1d87eb6f710136.js} +1 -1
  38. package/assets/esri/core/workers/chunks/5b97cdeb5949822fbef3.js +1 -0
  39. package/assets/esri/core/workers/chunks/{aa748cdeab2db5eb9d45.js → 5cd614f50e8925eeeaf4.js} +1 -1
  40. package/assets/esri/core/workers/chunks/{178c91fabf4a87bbb50b.js → 620d7cd0b0885122aa0f.js} +1 -1
  41. package/assets/esri/core/workers/chunks/6321680c8070dffa3b6c.js +1 -0
  42. package/assets/esri/core/workers/chunks/6997b4d5bcc9c4755375.js +1 -0
  43. package/assets/esri/core/workers/chunks/{b79cceeee3ed46f218a0.js → 69ab42b965bccc3bad4f.js} +1 -1
  44. package/assets/esri/core/workers/chunks/{bb4c75479cfea67cf8a2.js → 6af14a0217077d9ab47f.js} +1 -1
  45. package/assets/esri/core/workers/chunks/{672542d0435fbfd0647c.js → 6b3d8280a24f7a3aac40.js} +1 -1
  46. package/assets/esri/core/workers/chunks/{3d78e9b3c97c0ce21d16.js → 7017c2e621236c7a7da4.js} +1 -1
  47. package/assets/esri/core/workers/chunks/7407a1e0cef508116a0b.js +1 -0
  48. package/assets/esri/core/workers/chunks/{da188d0e22ba1639928e.js → 75907e5d009b71ce723b.js} +1 -1
  49. package/assets/esri/core/workers/chunks/{1ab4289195f5e46c6fe8.js → 78936c591fd49ff955a9.js} +1 -1
  50. package/assets/esri/core/workers/chunks/{f0b8de5b3cfbe9223df6.js → 796f5265747ce8be910e.js} +1 -1
  51. package/assets/esri/core/workers/chunks/{ac62411b9b4cf85a4722.js → 7a037fbfd91dd22e3bf0.js} +1 -1
  52. package/assets/esri/core/workers/chunks/{50661f65a9c191f528bc.js → 7ee7529fcbd0d169047c.js} +1 -1
  53. package/assets/esri/core/workers/chunks/7f60309d211c49721265.js +1 -0
  54. package/assets/esri/core/workers/chunks/7f9b0ef7f9b3f3fd3df9.js +1 -0
  55. package/assets/esri/core/workers/chunks/804c31973f7d116523cb.js +1 -0
  56. package/assets/esri/core/workers/chunks/{82a446e8befe9d29c8f0.js → 822a115c7d718e4e3d2b.js} +1 -1
  57. package/assets/esri/core/workers/chunks/{6789ddaa61e6d8f20d04.js → 8eea620f770576d18809.js} +1 -1
  58. package/assets/esri/core/workers/chunks/{10c4f5afe14c0addc418.js → 9332db133a0925d522fe.js} +1 -1
  59. package/assets/esri/core/workers/chunks/{bc87890d00d6dba979b2.js → 99c9f35a29f9f6c9e4ce.js} +1 -1
  60. package/assets/esri/core/workers/chunks/{455fbddd814e4681f0c0.js → a5e91cf150f6cf6a5d2a.js} +1 -1
  61. package/assets/esri/core/workers/chunks/{948ce2c199973f793651.js → a60a84c8c45f6d03443f.js} +1 -1
  62. package/assets/esri/core/workers/chunks/{eb4a2dc5efdb873a7f25.js → aef2832902b270f1a594.js} +1 -1
  63. package/assets/esri/core/workers/chunks/{b5fc0a2480a229e8891a.js → b5f291e8ed7f7cac158d.js} +1 -1
  64. package/assets/esri/core/workers/chunks/bd05e68b00b9878d0266.js +1 -0
  65. package/assets/esri/core/workers/chunks/{9a43065e51df9c21c9fa.js → bdb4f216ae8881b98604.js} +1 -1
  66. package/assets/esri/core/workers/chunks/c080e189764d8bb9cf25.js +1 -0
  67. package/assets/esri/core/workers/chunks/{bf9b2aa2e67ca746ec7c.js → c15f0769a64863cccef0.js} +1 -1
  68. package/assets/esri/core/workers/chunks/{a5d3dcb490686430c81d.js → c53048b0f153b251d792.js} +1 -1
  69. package/assets/esri/core/workers/chunks/c6e0ada6f2ad74fddfec.js +1 -0
  70. package/assets/esri/core/workers/chunks/cf09408cb7729126caae.js +1 -0
  71. package/assets/esri/core/workers/chunks/e0565849281ffbe8269e.js +1 -0
  72. package/assets/esri/core/workers/chunks/e1ba6f857ca12f154e77.js +1 -0
  73. package/assets/esri/core/workers/chunks/{4ef60a76eeca20bcafb1.js → e4f1e584f89ffb86206b.js} +1 -1
  74. package/assets/esri/core/workers/chunks/{2889e782ed81bb05b9e5.js → e508f8e707eb3207cfcc.js} +1 -1
  75. package/assets/esri/core/workers/chunks/{2216264b22a605a0f1ce.js → e60684918100666bb892.js} +1 -1
  76. package/assets/esri/core/workers/chunks/{4550b7620932cd6de20e.js → e94448b371cd17d7a472.js} +1 -1
  77. package/assets/esri/core/workers/chunks/{bb8530ade7c40a1ed7c4.js → eb9e913fe0dfcc71cf92.js} +1 -1
  78. package/assets/esri/core/workers/chunks/ede1d1cc2f315a34f4ca.js +1 -0
  79. package/assets/esri/core/workers/chunks/{a5bd7e5d71cffde68f89.js → ee89564d11c077169b31.js} +1 -1
  80. package/assets/esri/core/workers/chunks/{b3cc7f6d953bfbc3a70d.js → f62e37863a549f72093c.js} +1 -1
  81. package/assets/esri/core/workers/chunks/fc98b8351be567d3eb62.js +1 -0
  82. package/assets/esri/core/workers/chunks/fd5a5b05a1551cdb8c87.js +1 -0
  83. package/assets/esri/core/workers/chunks/fda0f4469d9cda637af4.js +1 -0
  84. package/assets/esri/core/workers/chunks/{554f389f99db430b309c.js → ff961bb6d29ab3fe129d.js} +1 -1
  85. package/assets/esri/themes/base/widgets/_Attribution.scss +4 -2
  86. package/assets/esri/themes/base/widgets/_FeatureTable.scss +1 -0
  87. package/assets/esri/themes/base/widgets/_Grid.scss +8 -1
  88. package/assets/esri/themes/dark/main.css +1 -1
  89. package/assets/esri/themes/light/main.css +1 -1
  90. package/assets/esri/themes/light/view.css +1 -1
  91. package/config.js +1 -1
  92. package/core/Logger.js +1 -1
  93. package/core/deprecate.js +1 -1
  94. package/core/has.js +1 -1
  95. package/core/types.d.ts +5 -0
  96. package/core/workers/workerFactory.js +1 -1
  97. package/editing/sharedTemplates/executor/builders/radialLines.js +1 -1
  98. package/editing/sharedTemplates/executor/builders/support/shapeUtils.js +1 -1
  99. package/geometry/projectionUtils.js +1 -1
  100. package/geometry/support/curves/curveUtils.js +1 -1
  101. package/kernel.js +1 -1
  102. package/layers/ImageryLayer.d.ts +1 -1
  103. package/layers/MapImageLayer.d.ts +1 -1
  104. package/layers/TileLayer.d.ts +1 -1
  105. package/layers/WebTileLayer.d.ts +1 -1
  106. package/layers/graphics/data/QueryEngineResult.js +1 -1
  107. package/layers/graphics/data/SnappingCandidate.js +1 -1
  108. package/layers/orientedImagery/transformations/imageToWorld.js +1 -1
  109. package/layers/orientedImagery/transformations/utils.js +1 -1
  110. package/layers/orientedImagery/transformations/worldToImage.js +1 -1
  111. package/layers/raster/datasets/ImageServerRaster.js +1 -1
  112. package/layers/support/ControlPointsGeoreference.d.ts +2 -2
  113. package/layers/support/ControlPointsGeoreference.js +1 -1
  114. package/layers/support/CornersGeoreference.d.ts +2 -2
  115. package/layers/support/CornersGeoreference.js +1 -1
  116. package/layers/support/ExtentAndRotationGeoreference.d.ts +2 -2
  117. package/layers/support/ExtentAndRotationGeoreference.js +1 -1
  118. package/layers/support/GeoreferenceBaseMixin.js +2 -0
  119. package/layers/support/mediaUtils.js +1 -1
  120. package/layers/support/relativeTimeQueryUtils.js +1 -1
  121. package/layers/support/serviceCapabilitiesUtils.js +1 -1
  122. package/package.json +1 -1
  123. package/renderers/DotDensityRenderer.d.ts +43 -0
  124. package/renderers/DotDensityRenderer.js +1 -1
  125. package/rest/featureService/FeatureService.js +1 -1
  126. package/rest/print.js +1 -1
  127. package/rest/query/operations/pbfFlatFeatureSet.js +1 -1
  128. package/support/basemapUtils.js +1 -1
  129. package/support/revision.js +1 -1
  130. package/symbols/ExtrudeSymbol3DLayer.d.ts +20 -10
  131. package/symbols/FillSymbol3DLayer.d.ts +36 -16
  132. package/symbols/ObjectSymbol3DLayer.d.ts +28 -6
  133. package/symbols/PathSymbol3DLayer.d.ts +18 -6
  134. package/symbols/cim/CIMSymbolHelper.js +1 -1
  135. package/symbols/cim/rasterizingUtils.js +1 -1
  136. package/symbols/support/Symbol3DEmissive.d.ts +9 -9
  137. package/symbols/support/Symbol3DMaterial.d.ts +8 -8
  138. package/time/TimeExtent.d.ts +1 -1
  139. package/views/2d/engine/webgl/OverlayMultipoint.js +1 -1
  140. package/views/2d/engine/webgl/shaders/sources/shaderRepository.js +1 -1
  141. package/views/2d/interactive/SnappingVisualizer2D.js +1 -1
  142. package/views/2d/layers/features/layerAdapters/CatalogFootprintLayerAdapter.js +1 -1
  143. package/views/2d/layers/features/layerAdapters/FeatureLayerAdapter.js +1 -1
  144. package/views/2d/layers/features/layerAdapters/InMemoryLayerAdapter.js +1 -1
  145. package/views/2d/layers/features/layerAdapters/KnowledgeGraphSublayerAdapter.js +1 -1
  146. package/views/2d/layers/features/layerAdapters/OGCFeatureLayerAdapter.js +1 -1
  147. package/views/2d/layers/features/layerAdapters/OrientedImageryLayerAdapter.js +1 -1
  148. package/views/2d/layers/features/layerAdapters/SubtypeGroupLayerAdapter.js +1 -1
  149. package/views/2d/layers/features/sources/FeatureSourceQueryInfo.js +1 -1
  150. package/views/2d/layers/features/sources/strategies/FeaturePagedTileLoadStrategy.js +1 -1
  151. package/views/2d/layers/features/sources/strategies/FeatureSnapshotLoadStrategy.js +1 -1
  152. package/views/2d/layers/features/support/FeatureSetReaderPBF.js +1 -1
  153. package/views/2d/layers/features/support/FeatureSetReaderPBFHeader.js +1 -1
  154. package/views/2d/layers/support/RouteLayerWaypointVisualization.js +1 -1
  155. package/views/3d/analysis/ShadowCast/ShadowCastTooltip.js +1 -1
  156. package/views/3d/analysis/VolumeMeasurement/VolumeMeasurementCutFillController.js +1 -1
  157. package/views/3d/analysis/VolumeMeasurement/VolumeMeasurementCutFillVisualization.js +1 -1
  158. package/views/3d/layers/graphics/Graphics3DPolygonFillSymbolLayer.js +1 -1
  159. package/views/3d/layers/support/featureTileQuery3D.js +1 -1
  160. package/views/3d/support/pointsOfInterest/CameraOnSurface.js +1 -1
  161. package/views/3d/webgl-engine/collections/Component/Material/ComponentMaterial.js +1 -1
  162. package/views/3d/webgl-engine/materials/ColorMaterial.js +1 -1
  163. package/views/3d/webgl-engine/materials/PatternMaterial.js +1 -1
  164. package/views/3d/webgl-engine/materials/renderers/VaoWriter.js +1 -1
  165. package/views/3d/webgl-engine/shaders/ColorMaterialTechniqueConfiguration.js +1 -1
  166. package/views/3d/webgl-engine/shaders/PatternTechniqueConfiguration.js +1 -1
  167. package/views/Attribution.js +1 -1
  168. package/views/DOMContainer.js +1 -1
  169. package/views/LinkChartView.d.ts +1 -1
  170. package/views/MapView.d.ts +1 -1
  171. package/views/SceneView.d.ts +1 -1
  172. package/views/SelectionManager.d.ts +242 -0
  173. package/views/View.d.ts +1 -1
  174. package/views/input/types.d.ts +1 -1
  175. package/views/interactive/keybindings.js +1 -1
  176. package/views/interactive/snapping/candidates/EdgeSnappingCandidate.js +1 -1
  177. package/views/interactive/snapping/featureSources/GraphicsSnappingSource.js +1 -1
  178. package/views/interactive/snapping/featureSources/queryEngineUtils.js +1 -1
  179. package/views/interactive/snapping/featureSources/snappingCandidateElevationAlignment.js +1 -1
  180. package/views/interactive/snapping/featureSources/snappingCandidateElevationFilter.js +1 -1
  181. package/views/interactive/snapping/hints/LineSnappingHint.js +1 -1
  182. package/views/layers/FeatureLikeLayerView.js +1 -1
  183. package/views/layers/support/WhereClauseVisitor.js +1 -1
  184. package/views/selection/types.d.ts +140 -0
  185. package/views/support/selectionUtils.js +1 -1
  186. package/views/ui/DefaultUI.d.ts +5 -12
  187. package/views/ui/DefaultUI.js +1 -1
  188. package/views/ui/types.d.ts +1 -1
  189. package/webscene/Glow.d.ts +5 -0
  190. package/webscene/SunLighting.d.ts +20 -2
  191. package/webscene/VirtualLighting.d.ts +20 -2
  192. package/widgets/Attribution/AttributionViewModel.d.ts +1 -1
  193. package/widgets/Attribution.d.ts +1 -1
  194. package/widgets/BatchAttributeForm/expressions/ExpressionsManager.js +1 -1
  195. package/widgets/BatchAttributeForm/expressions/ExpressionsModel.js +1 -1
  196. package/widgets/BatchAttributeForm/inputs/FieldInput.d.ts +1 -1
  197. package/widgets/BatchAttributeForm/inputs/InputBase.js +1 -1
  198. package/widgets/BatchAttributeForm/inputs/TextElementInput.d.ts +2 -11
  199. package/widgets/BatchAttributeForm/inputs/TextElementInput.js +1 -1
  200. package/widgets/BatchAttributeForm/inputs/support/inputUtils.js +1 -1
  201. package/widgets/BatchAttributeForm/inputs/support/textElementInputUtils.js +2 -0
  202. package/widgets/BatchAttributeForm/templates/TextElementTemplate.js +1 -1
  203. package/widgets/BatchAttributeForm/templates/support/constants.js +2 -0
  204. package/widgets/BatchAttributeForm/templates/support/createBatchFormTemplate.js +1 -1
  205. package/widgets/BatchAttributeForm/templates/support/hashElementTemplate.js +1 -1
  206. package/widgets/BatchAttributeForm/templates/support/textElementTemplateUtils.js +2 -0
  207. package/widgets/Editor/components/Settings.js +1 -1
  208. package/widgets/FeatureTable/FeatureTableViewModel.d.ts +1 -1
  209. package/widgets/FeatureTable/FeatureTableViewModel.js +1 -1
  210. package/widgets/FeatureTable.d.ts +9 -3
  211. package/widgets/FeatureTable.js +1 -1
  212. package/widgets/Features/FeaturesViewModel.js +1 -1
  213. package/widgets/OrientedImageryViewer/OrientedImageryViewerViewModel.js +1 -1
  214. package/widgets/OrientedImageryViewer/adapters/sketch/DataCaptureAdapter.js +1 -1
  215. package/widgets/OrientedImageryViewer/adapters/view/MapViewAdapter.js +1 -1
  216. package/widgets/OrientedImageryViewer/adapters/view/SceneViewAdapter.js +1 -1
  217. package/widgets/OrientedImageryViewer/services/TransformationService.js +1 -1
  218. package/widgets/OrientedImageryViewer/support/dataCaptureUtils.js +1 -1
  219. package/widgets/OrientedImageryViewer/support/geometryUtils.js +1 -1
  220. package/widgets/OrientedImageryViewer/support/urlUtils.js +1 -1
  221. package/widgets/OrientedImageryViewer/utils.js +1 -1
  222. package/widgets/OrientedImageryViewer.js +1 -1
  223. package/widgets/PanoramicViewer/PanoramicViewerViewModel.js +1 -1
  224. package/widgets/PanoramicViewer/support/PanoramicMedia.js +1 -1
  225. package/widgets/Print/PrintViewModel.js +1 -1
  226. package/widgets/Sketch.js +1 -1
  227. package/widgets/TimeSlider/TimeSliderViewModel.d.ts +1 -2
  228. package/widgets/TimeSlider.d.ts +5 -6
  229. package/widgets/support/SketchTooltipControls.js +1 -1
  230. package/assets/esri/core/workers/chunks/0485ae33a8b327974751.js +0 -1
  231. package/assets/esri/core/workers/chunks/0c8a676599821b9871c2.js +0 -1
  232. package/assets/esri/core/workers/chunks/2b7615cccbaeda1649f3.js +0 -1
  233. package/assets/esri/core/workers/chunks/2f0ea91afc9aa8ee9cad.js +0 -1
  234. package/assets/esri/core/workers/chunks/3a850b5e847b6b0ea53f.js +0 -1
  235. package/assets/esri/core/workers/chunks/449cf6ae6b6e6c2795e5.js +0 -1
  236. package/assets/esri/core/workers/chunks/529dbf16ffbbd39f3fa2.js +0 -1
  237. package/assets/esri/core/workers/chunks/58cf3d35771b87bd74e5.js +0 -1
  238. package/assets/esri/core/workers/chunks/652bb1b53782cdd3103c.js +0 -1
  239. package/assets/esri/core/workers/chunks/6acab23acf3b044f5215.js +0 -1
  240. package/assets/esri/core/workers/chunks/6c2a7bac3f8e32c83292.js +0 -1
  241. package/assets/esri/core/workers/chunks/6d26e5368e8952003669.js +0 -1
  242. package/assets/esri/core/workers/chunks/7cb6ccee9bcef449caea.js +0 -1
  243. package/assets/esri/core/workers/chunks/8235b8267489e1213ce8.js +0 -1
  244. package/assets/esri/core/workers/chunks/879e8439a513cb333b61.js +0 -1
  245. package/assets/esri/core/workers/chunks/956237a2baa30760c256.js +0 -1
  246. package/assets/esri/core/workers/chunks/98c3b7d8db53f0b12642.js +0 -1
  247. package/assets/esri/core/workers/chunks/a027da22acdaa6d6baa3.js +0 -1
  248. package/assets/esri/core/workers/chunks/b60337c471e2b855d02a.js +0 -1
  249. package/assets/esri/core/workers/chunks/bd1bbf1820e12d7a27f6.js +0 -1
  250. package/assets/esri/core/workers/chunks/c546c49960eace69d20a.js +0 -1
  251. package/assets/esri/core/workers/chunks/c88101cb8301f095d037.js +0 -1
  252. package/assets/esri/core/workers/chunks/c9067667290e93407dd7.js +0 -1
  253. package/assets/esri/core/workers/chunks/e4eb14952b7660feecc7.js +0 -1
  254. package/assets/esri/core/workers/chunks/e71d08c6f545c2c70174.js +0 -1
  255. package/assets/esri/core/workers/chunks/f347dee99faa9ee5eef1.js +0 -1
  256. package/layers/support/GeoreferenceBase.d.ts +0 -4
  257. package/layers/support/GeoreferenceBase.js +0 -2
  258. package/widgets/BatchAttributeForm/inputs/support/textInputElementUtils.js +0 -2
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import t from"../../Graphic.js";import{equals as i,isSome as r}from"../../core/arrayUtils.js";import{createTask as a}from"../../core/asyncUtils.js";import s from"../../core/Collection.js";import{deprecatedProperty as o}from"../../core/deprecate.js";import n from"../../core/Error.js";import{EventedMixin as l}from"../../core/Evented.js";import{makeHandle as c}from"../../core/handleUtils.js";import{equalsShallow as h}from"../../core/lang.js";import d from"../../core/Logger.js";import{clamp as u}from"../../core/mathUtils.js";import{destroyMaybe as p,abortMaybe as m}from"../../core/maybe.js";import{EsriPromise as g}from"../../core/Promise.js";import{isAbortError as y,throwIfAborted as v,waitTick as f}from"../../core/promiseUtils.js";import w from"../../core/ReactiveMap.js";import{whenOnce as F,on as _,watch as b,syncAndInitial as M,initial as I}from"../../core/reactiveUtils.js";import{sqlAnd as V}from"../../core/sql.js";import{getMetersPerUnitForSR as S}from"../../core/units.js";import{property as P,subclass as A}from"../../core/accessorSupport/decorators.js";import{isSerializable as C}from"../../core/support/jsonUtils.js";import{UpdatingHandles as k}from"../../core/support/UpdatingHandles.js";import L from"../../geometry/Extent.js";import G from"../../geometry/Point.js";import{projectAsync as T}from"../../geometry/projectionUtils.js";import j from"../../geometry/SpatialReference.js";import{polygonCentroidPoint as O}from"../../geometry/support/centroid.js";import{isClockwise as B}from"../../geometry/support/coordsUtils.js";import{normalizeMapX as E}from"../../geometry/support/normalizeUtils.js";import{geographicToWebMercator as R}from"../../geometry/support/webMercatorUtils.js";import H from"../../layers/GraphicsLayer.js";import x from"../../layers/MediaLayer.js";import{searchImages as D,getSortedLayerFeatures as z}from"../../layers/orientedImagery/queries.js";import{calculateSuitabilities as N}from"../../layers/orientedImagery/core/bestImageUtils.js";import{createCoveragePolygon as U,computePolygonForInspection as q,resizePolygon as $,checkIfPolygonContainsSelectedPoint as W}from"../../layers/orientedImagery/core/coverageUtils.js";import{isElevationSource as J}from"../../layers/orientedImagery/core/ElevationSourceDefinitions.js";import{getMetersPerUnitOfSR as Z,convertGeographicToWebMercator as K}from"../../layers/orientedImagery/core/utils.js";import Q from"../../layers/orientedImagery/transformations/updateElevation.js";import{getElevationSampler as X}from"../../layers/orientedImagery/transformations/updateElevationUtils.js";import{or as Y,getInitialAngle as ee,convertPixelToHeadingPitch as te,getUpdateElevationProps as ie,getImageToWorldProperties as re,getImageToWorldPanoramicProperties as ae,convertHeadingPitchToSphereVertex as se}from"../../layers/orientedImagery/transformations/utils.js";import oe from"../../layers/support/ExtentAndRotationGeoreference.js";import{getFloorFilterClause as ne}from"../../layers/support/floorFilterUtils.js";import le from"../../layers/support/VideoElement.js";import ce from"../../views/MapView.js";import he from"../../views/draw/Draw.js";import{scale as de}from"../../views/draw/support/drawUtils.js";import{ViewEventPriorities as ue}from"../../views/input/InputManager.js";import pe from"../PanoramicVideoViewer.js";import me from"../PanoramicViewer.js";import{defaultAngleThresholdInDegrees as ge,videoMapViewConstraint as ye,clockwiseDirections as ve,videoExtent as fe,invalidCameraHeading as we,sectorsInOrder as Fe,sampleExtent as _e,sectorsRadii as be,fixedImageSize as Me}from"./constants.js";import{isFeatureAttachment as Ie}from"./galleryUtils.js";import{crossSymbol as Ve,crossSymbol3D as Se,measurementPolygonSymbol as Pe,polylineSymbolPanoramic as Ae,measurementPolylineSymbol as Ce,cameraOverlaySymbol3D as ke,cameraOverlaySymbol as Le,diamondSymbol as Ge,diamondSymbol3D as Te,activeSourcePointSymbol as je,sourcePointSymbol as Oe}from"./symbols.js";import{registryKeys as Be}from"./types.js";import{isNoAttachmentError as Ee,isTifOrMrf as Re,filterOILLayerView as He,assignElevationSampleToFeatures as xe,filterByZ as De,createPanoramicMedia as ze,createNonPanoramicMedia as Ne,isSceneView as Ue,isGraphic as qe,calculateSegment as $e,calculateDirection as We}from"./utils.js";import Je from"./components/ImageViewer.js";import Ze from"./components/NavigationNode.js";import Ke from"./components/OrientedImageryVideoViewModel.js";import{NoFeatureFoundWithObjectIdError as Qe}from"./navigation/errors.js";import{queryFeatureByObjectIds as Xe}from"./navigation/queries.js";import{ImageMeasurementService as Ye}from"./services/ImageMeasurementService.js";import{configureSketchTool as et,extractFieldsFromDataCaptureLayer as tt,constructGraphicFromImageGeometry as it}from"./support/dataCaptureUtils.js";import{imageSpaceToPoint as rt,removeZFromGeometry as at}from"./support/geometryUtils.js";import st from"./support/resolveMediaProps.js";import{isValidDataCaptureLayer as ot}from"./support/typeUtils.js";const nt=()=>new n("orientedimageryviewer:sketch-not-initialized","Sketch property is not initialized, call loadSketch first");let lt=class extends(l(g)){constructor(e){super(e),this.additionalFeatures=new s,this.additionalCameraLocations=new s,this.additionalFootprints=new s,this.areaMeasurementResult=0,this.areaMeasurementAccuracy=0,this.bestFeatureAngle=0,this.bestFeatureCurrentFootprint=null,this.bestFeatureFootprint=null,this.cameraHeadingThreshold=ge,this.cameraPitchThreshold=ge,this.clickAction="hittest",this.correctedLocationPointOnImage=null,this.videoViewModel=null,this.collectionId=null,this.coverageFrustums=new s,this.coveragePolygons=new s,this.currentBestFeature=null,this.currentBestFeatureMeasurementImage=null,this.currentBestFeatureLocation=null,this.currentCoverageVisible=!0,this.depthImage=null,this.featureCache=[],this.navigationNodes=new s,this.determineWorkflowForFeature=async(e,t,i)=>{const{currentBestFeature:r,selectedPoint:a}=this;if(this.emit("popup-close"),r&&a){this._initialCurrentCoverageUpdate=!0,this._updateGroundElevation=!0;try{await this._updatePointsAndPolygons(i),await this._loadDepthImage(i),await this._loadImage(i)}catch(s){y(s)||(this.loadImageError(s),d.getLogger(this).error("#loadIImage()","error occured while loading image",s))}}},this.determineWorkflowForTriangularMeasurement=async(e,t,i)=>{if(this.emit("popup-close"),this.currentBestFeatureMeasurementImage&&this.selectedPoint)try{await this._loadMeasurementViewerImage(i)}catch(r){y(r)||(this.loadImageError(r),d.getLogger(this).error("#loadIImage()","error occured while loading image",r))}},this.disabled=!1,this.displayMessage={key:"onLoadMessage",type:"info"},this.displayNewMeasurementButton=!0,this.distanceMeasurementResult=0,this.distanceAccuracyArray=[],this.dataCaptureLayer=null,this.features=new s,this.groundCoordinates=null,this.groundCoordinatesAccuracy=null,this.heightGraphic=null,this.heightMeasurementResult=0,this.heightMeasurementAccuracy=0,this.imageGeometryField=null,this.imageLocationToolState=!1,this.imageMeasurementViewer=new Je,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 s,this.overlayedMapFeatures=new w,this.pixelCoordinates=null,this.preserveAngle="none",this.pointSources=new s,this.preloadMedia=!1,this.preloadMediaSize=5,this.previousFeatureAngle=0,this.selectedPoint=null,this.shouldShowSelectedImage=!1,this.sketch=null,this.sketchTriangular=null,this.sketchTriangularGraphicsLayer=null,this.draw=null,this.drawAdapter=null,this.polylineDrawAction=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,i)=>{"default"===this.mode&&"image-loaded"!==this.state||await(this._adapter?.updateFootprint(e,t,i))},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 ce({map:new Map,constraints:ye}),this.verticalFilterEnabled=!1,this._adapter=null,this._highlightedFeatureHandle=null,this._imageViewer=new Je,this._initialCurrentCoverageUpdate=!0,this._locationViewModel=null,this._measurementService=null,this._mediaPrefetcher=null,this._navigationManager=null,this._overlays=new H({listMode:"hide",internal:!0,elevationInfo:{mode:"absolute-height"},title:"OrentedImageryViewerViewModel overlays layer"}),this._panoramicVideoViewer=new pe,this._panoramicViewer=new me,this._panoramicMeasurementViewer=new me,this._referencePointOnGround=null,this._referencePointOnImage=null,this._referenceTransformationService=null,this._sectorData=null,this._transformationService=null,this._featureToSector=null,this._updatingHandles=new k,this._clickTask=null,this._crossSymbol=null,this.footprintExtent=null,this._featureChangedTask=null,this._mediaPrefetchTask=null,this._suitabilities=null,this._transformController=new AbortController,this._updateFootprintTask=null,this._updateGroundElevation=!1,this.addUpdatingPromise=e=>this._updatingHandles.addPromise(e),this.filterCapturedFeatures=e=>{const t=this.currentBestFeature?.attributes.objectId,i=this.layer?.imageReferenceField;if(!t||!e||!i)return;const r=this.overlayedMapFeatures.get(e);r?.forEach(e=>{const r=e.attributes??{},a=Object.keys(r).find(e=>e.toLowerCase()===i.toLowerCase());(a?r[a]:null)!==t&&(e.visible=!e.visible)})},this.hideImageGeometry=e=>{},this.highlight=e=>{if(!this._overlaysView)return;this.removeHighlight();const 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);const t=import("./adapters/sketch/DataCaptureAdapter.js"),{default:i}=await t;return v(e),this.sketchAdapter=new i({viewModel:this}),this.sketchAdapter},this.loadImageFromFeature=(e,t,i)=>this._updatingHandles.addPromise(this._loadImageFromFeature(e,t,i)),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)=>{const i=this.additionalFeatures.find(({attributes:t})=>t.objectId===e);if(i)this.currentBestFeature=i;else{const{layer:i,layerFloorFilterClause:a}=this;if(!i)return void this.setMessage("noLayerSelected","info");this.beforeLoad();const s=this._updatingHandles.addPromise(this._queryAndLoadByObjectId(i,e,a,t));try{await s,await this.selectBestFeature(e,t)}catch(r){y(r)||(d.getLogger(this).error("oriented-imagery-viewer:show-image",r),"NoFeatureFoundWithObjectIdError"===r.name?this.setMessage("noFeatureFoundWithObjectId","error","",{objectId:e}):this.setMessage("imageLoadError","error",r.message))}}},this.getSectorFeatureById=e=>this._suitabilities?.find(({feature:{attributes:{objectId:t}}})=>t===e),this.getFeatureSectorById=e=>this._featureToSector?.[`${e}`],this.navigate=async(e,t)=>{const{mode:i}=this;if("default"!==i&&"panoramic"!==i)throw new n("NavigationError","Navigation is only supported in 'default' and 'panoramic' modes.");const r=e=>"default"===i&&e.declaredClass.endsWith("NavigationManager")||"panoramic"===i&&e.declaredClass.endsWith("NavigationManagerPanoramic");if(null==this._navigationManager||!r(this._navigationManager)){p(this._navigationManager);const e="default"===i?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}`),F(()=>"image-loaded"===this.state,t)),this.toggleImageAttributes=()=>{const{currentBestFeature:e,popupEnabled:i,layer:r,view:a}=this;if(this.emit("popup-close"),!(a&&e&&i&&r))return;const{attributes:s,geometry:o}=e,n=new t({geometry:o,attributes:s.toJSON(),origin:r});this.emit("popup-open",{features:[n],location:s.location.clone()})},this.updateSuitabilities=(e,t=!0)=>{e.sort((e,t)=>e.suitability-t.suitability),this._suitabilities=e;const i=this._suitabilities.map(({feature:e})=>e);this._initialCurrentCoverageUpdate=!0,this._updateFeatures(i,t),this._groupFeaturesBySectors()},this._createViewClickHandle=()=>{if(this.removeHandles(Be.click),this.disabled||null==this.view)return;const e=this.mapImageConversionToolState&&"image-loaded"===this.state?this._mapImageConversionToolViewClickHandler:this._viewClickHandler;this.addHandles(this.view.on("click",e,ue.DEFAULT),Be.click)},this._createImageClickHandle=()=>{this.removeHandles(Be.imageClick);const{mapImageConversionToolState:e,mode:t,activeViewer:i,currentBestFeature:r,footprintExtent:s}=this,o=i?.imageSize;if(!(e&&"none"!==t&&o&&s&&r))return;const n=i.clickAction;this.clickAction="pixel-location";const l=c(()=>{this.clickAction=n});let h=null;const d=_(()=>i,"pixel-location",e=>{this.plotReferencePointOnImage(e),h?.abort(),h=a(async t=>{if(!e)return;const i=await this._transformationService.pixelToMapPoint(e).then(e=>{const t=this.view?.spatialReference;return Y(!t,e.spatialReference.equals(t))?e:T(e,t)});v(t),this.plotReferencePointOnGround(i)})});this.addHandles([d,l],Be.imageClick)},this._createTriangularImageClickHandle=()=>{this.removeHandles(Be.triangularImageClick),this.triangularMeasurementActive&&"none"!==this.mode&&this.currentBestFeature&&this.currentBestFeatureMeasurementImage&&this.activeTriangulatedViewer&&this.addHandles(this.activeTriangulatedViewer.imageRenderer.on("double-click",this._measurementImageClickHandler),Be.triangularImageClick)},this._handleImageHitTestResponse=async e=>{const{layer:t,overlayedCameraLocations:i}=this;if(!t)return;const r=e.results.find(({graphic:e,graphic:{attributes:r}})=>i.includes(e)&&r&&!r[t.imageReferenceField]&&!r[t.imageGeometryField]);if(!r)return;const a=r.graphic.attributes[t.objectIdField];await this.showImageByObjectId(a)},this._loadDepthImage=async e=>{const{currentBestFeature:t,layer:i,depthImageNotSupported:r}=this;if(this.depthImage?.destroy(),this.depthImage=null,!i||!t||r)return;const{depthImage:a}=t.attributes;if(!a)return;const s=(await import("./services/DepthImageService.js")).default;v(e),this.depthImage=new s({url:a});try{await this.depthImage.load(e)}catch(o){y(o)||(d.getLogger(this).error("error occurred while loading depth image",o),this.depthImage?.destroy(),this.depthImage=null)}},this._loadImage=async e=>{const{currentBestFeature:t,layer:i,mode:r}=this;if(this.clearGraphics(),i&&t&&"none"!==r&&"video"!==r&&"panoramic-video"!==r)try{await this.loadImageFromFeature(i,t,e),v(e),await this.transformAndPlotSelectedLocation(e)}catch(a){y(a)||this.loadImageError(a)}},this._loadVideo=async e=>{const{currentBestFeature:t,mode:i,selectedPoint:r}=this,a=t?.attributes.imagePath;if(!t||"panoramic-video"!==i||!a)return;const{attributes:s}=t,{cameraPitch:o,cameraOrientation:n,location:l}=s,c=l.spatialReference.isWGS84&&4!==n?.type?R(l):new G(l);try{this._panoramicVideoViewer.viewModel.video&&this._panoramicVideoViewer.viewModel.video.pause(),this._panoramicVideoViewer.videoSource=a;let t=0;c&&r&&(t=await ee(c,r)-t),this._panoramicVideoViewer.pitch=o??0,this._panoramicVideoViewer.yaw=t,await this._panoramicVideoViewer.loadVideo(e),v(e)}catch(h){y(h)||this.loadImageError(h)}},this._loadImageFromFeature=async(e,t,i)=>{const{mode:r}=this;if("default"!==r&&"panoramic"!==r)return;let a;try{a=await st(t.attributes,e,i),v(i)}catch(f){if(y(f))return;return Ee(f)?(d.getLogger(this).error(f),void this.setMessage("noAttachment","error",`${e.objectIdField}: ${t.attributes.objectId}`)):(d.getLogger(this).error(f,{[e.objectIdField]:t.attributes.objectId,layer:e}),void this.setMessage("imageLoadError","error",`query-attachments-failed:${e.objectIdField} ${t.attributes.objectId}`))}if(!a)return;const{mediaUrl:s,datasetFormat:o,rotation:n,searchParams:l,location:c,cameraHeading:h,matrix:u,cameraPitch:p,getDataSetFormatError:m}=a,g=`${t.attributes.objectId}`;try{let a=this._mediaPrefetcher?.getCachedMedia(g);if(!a){const i=this.navigationNodes.find(e=>e.id===t.attributes.objectId);if(i){try{await(this._mediaPrefetcher?.startPrefetchForNode(i,e))}catch(w){}a=this._mediaPrefetcher?.getCachedMedia(g)}}if(a){if("panoramic"===r){const e=this.triangularMeasurementActive?this._panoramicMeasurementViewer:this._panoramicViewer;let r=0;return c&&this.selectedPoint&&(r=await ee(c,this.selectedPoint)-r),await e.loadMedia(a,i),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}),void(this.triangularMeasurementActive?await this.initializeReferenceTransformationService(i):await this.initializeTransformationService(i))}return await this._setImageSource(this.triangularMeasurementActive?this.imageMeasurementViewer:this._imageViewer,a,i),void(this.triangularMeasurementActive?await this.initializeReferenceTransformationService(i):await this.initializeTransformationService(i))}}catch(w){}m&&d.getLogger(this).warn("error occurred while getting dataset format",m),"panoramic"===r?await this.loadPanoramicMediaSource({lookAt:{yaw:this.selectedPoint?await ee(c,this.selectedPoint):"viewAngle"in t.attributes&&Number.isFinite(t.attributes.viewAngle)?t.attributes.viewAngle:0,pitch:p},extension:o?.toUpperCase(),url:s,cameraHeading:h,matrix:u},i):await this.loadMediaSource({datasetFormat:o?.toUpperCase(),url:s,customParameters:l,rotation:n},i),this.triangularMeasurementActive?await this.initializeReferenceTransformationService(i):await this.initializeTransformationService(i)},this._loadMeasurementViewerImage=async e=>{const{currentBestFeatureMeasurementImage:t,layer:i,mode:r}=this;if(this.imageMeasurementViewer.clearGraphics(),this._panoramicMeasurementViewer.clearGraphics(),i&&t&&"none"!==r&&"video"!==r&&"panoramic-video"!==r)try{await this.loadImageFromFeature(i,t,e),v(e)}catch(a){y(a)||this.loadImageError(a)}},this._loadMediaPrefetcher=async e=>{if(!this._mediaPrefetcher){const{default:t}=await import("./support/MediaPrefetcher.js");v(e),this._mediaPrefetcher=new t({maxEntries:this.preloadMediaSize*ve.length})}return this._mediaPrefetcher},this._loadViewAdapter=async e=>{const{view:t}=this;if(t)switch(t.type){case"2d":{const{default:t}=await import("./adapters/view/MapViewAdapter.js");v(e),this._adapter=new t(this);break}case"3d":{const{default:t}=await import("./adapters/view/SceneViewAdapter.js");v(e),this._adapter=new t(this);break}}else this._adapter=null},this._mapImageConversionToolViewClickHandler=e=>{if(e.stopPropagation(),e.preventDefault(),e.mapPoint){const t=e.mapPoint;t.x=E(t.x,t.spatialReference),this.plotMapPoint(e.mapPoint)}},this._measurementImageClickHandler=e=>{e.stopPropagation(),e.preventDefault();const{sketchTriangular:t,triangularMeasurementActive:i,currentBestFeatureMeasurementImage:r,triangulatedMeasurementGraphic:a}=this;t&&i&&r&&a&&"active"!==t.state&&(t.update([a],{tool:"reshape"}),this.updatingTriangularMeasurementState=!0)},this._viewClickHandler=e=>{this._clickTask?.abort(),this._clickTask=a(async t=>{const{pointerType:i,button:r,mapPoint:a}=e;if("mouse"===i&&0!==r||!a)return;e.stopPropagation(),e.preventDefault();const{view:s,layer:o}=this;if(s&&o){if(this.shouldShowSelectedImage){const i=s.hitTest(e,{include:[o]});this._updatingHandles.addPromise(i);const r=await i;return v(t),await this._processHitTestResults(o,r,{signal:t})}return this._updatingHandles.addPromise(this.loadBestImage(a,{signal:t}))}})},this.plotSelectedPointOnImage=async(e,i)=>{if(await f(i),!e)return;const r=new G({...C(e)?e.toJSON():e});if("default"===this.mode)r.x-=.5,r.y=.5-r.y,r.spatialReference=this._imageViewer.imageRenderer.spatialReference.clone(),this._crossSymbol=new t({geometry:r,symbol:Ve}),this._imageViewer.addGraphic(this._crossSymbol,0);else if("panoramic"===this.mode){const{imageSize:i}=this._panoramicViewer;if(!i)return;const[r,a]=i,{heading:s,pitch:o}=te(e,r,a),n=se(s,o);this._crossSymbol=new t({geometry:new G(n,j.WebMercator),symbol:Se}),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([b(()=>this.view,()=>this.load(),M),b(()=>this.view?.map,(e,t)=>{t?.layers.remove(this._overlays),e?.layers.add(this._overlays)},I),b(()=>this.view?.map?.allLayers?.length,e=>{e&&this.view?.map?.layers.reorder(this._overlays,e-1)},I),b(()=>[this.state,this.mapImageConversionToolState,this.view,this.disabled],()=>{this._createViewClickHandle(),this._createImageClickHandle()},M),b(()=>[this.triangularMeasurementActive,this.currentBestFeatureMeasurementImage],()=>{this._createTriangularImageClickHandle()},M),b(()=>[this.state,this.imageLocationToolState,this.view],()=>{this._initializeMeasurementService(),this._initializeLocationViewModel()},M),b(()=>this.measureType,()=>{this.clearPreviousMeasurements(),this._initializeMeasurementService()},M),b(()=>this.bestFeatureAngle,(e,t)=>{this.previousFeatureAngle=t??0},M),b(()=>this.currentBestFeature,async(e,t)=>{m(this._featureChangedTask),this._featureChangedTask=a(async i=>this.determineWorkflowForFeature.apply(this,[e,t,{signal:i}])),await this._featureChangedTask.promise},{sync:!0}),b(()=>[this.currentNode,this.preloadMedia,this.navigationMode],()=>{this._mediaPrefetchTask?.abort(),this._mediaPrefetchTask=a(async e=>{this.preloadMedia&&null!=this.navigationMode?(this._mediaPrefetcher??=await this._loadMediaPrefetcher({signal:e}),v(e),"directional"===this.navigationMode?this._mediaPrefetcher.enqueueDirectionalPrefetch(this.layer,this.currentNode,this.preloadMediaSize):this._mediaPrefetcher.enqueueSequentialPrefetch(this.layer,this.currentNode,this.preloadMediaSize)):this._mediaPrefetcher?.clear()})},M),b(()=>this.currentBestFeatureMeasurementImage,(e,t)=>{m(this._featureChangedTask),t&&e!==t&&(this.triangulatedPoint=null,this.sketchTriangularGraphicsLayer?.graphics.destroyAll(),this._measurementService?.resetMeasurementVectors()),this._featureChangedTask=a(async i=>{await this.determineWorkflowForTriangularMeasurement(e,t,{signal:i}),v(i),this._reorderTriangularSketchLayer()})},M),b(()=>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())}),b(()=>this.mode,e=>{switch(this.removeHandles(Be.interactionHandles),e){case"default":this.addHandles(b(()=>{const{state:e}=this;return"image-loaded"===e?this._imageViewer.imagePointsInView:null},e=>{e&&(m(this._updateFootprintTask),this._updateFootprintTask=a(async t=>{await this.updateFootprint(e,void 0,{signal:t})}))},{...M,equals:(e,t)=>i(e,t,h)}),Be.interactionHandles);break;case"video":this.addHandles(b(()=>{const{footprintExtent:e,videoElement:t,bestFeatureFootprint:i}=this;if(e&&t?.loaded&&i)return{videoExtent:fe,bestFeatureFootprint:i}},e=>{e?.videoExtent&&e?.bestFeatureFootprint&&(m(this._updateFootprintTask),this._updateFootprintTask=a(async t=>{const i={points:e.videoExtent,feature:void 0,scale:void 0,options:{signal:t}};await this.updateVideoFootprint(i)}))},{...M,equals:(e,t)=>i(e?.videoExtent,t?.videoExtent,h)&&e?.bestFeatureFootprint===t?.bestFeatureFootprint}),Be.interactionHandles);break;case"panoramic":this.addHandles(b(()=>{const{currentBestFeature:e,state:t,_panoramicViewer:i}=this,{imageSize:r,vfov:a,hfov:s,pitch:o,yaw:n}=i;return e&&r&&!t.includes("loading")&&null!=a&&null!=s&&null!=o&&null!=n?[a,s,n,o]:null},e=>{if(!e||this.state.includes("loading"))return;const[t,i,r,s]=e;this.currentNode&&(this.currentNode.currentHeading=r,this.currentNode.currentPitch=s),m(this._updateFootprintTask),this._updateFootprintTask=a(async e=>{await this.updateFootprintPanorama({verticalFieldOfView:t,horizontalFieldOfView:i,yaw:r,pitch:s},{signal:e}),this._updateFootprintTask=null})},{equals:(e,t)=>i(e,t,h)}),Be.interactionHandles);break;case"panoramic-video":this.addHandles(b(()=>{const{currentBestFeature:e,state:t,_panoramicVideoViewer:i}=this,{imageSize:r,vfov:a,hfov:s,pitch:o,yaw:n,viewModel:l}=i,c=l.closestFeature??e;return c&&r&&!t.includes("loading")&&null!=a&&null!=s&&null!=o&&null!=n?[a,s,n,o,c]:null},e=>{if(!e)return;const[t,i,r,s,o]=e;m(this._updateFootprintTask),this._updateFootprintTask=a(async e=>{await this.updateFootprintPanorama({verticalFieldOfView:t,horizontalFieldOfView:i,yaw:r,pitch:s,feature:o},{signal:e}),v(e),this._updateFootprintTask=null})},{equals:(e,t)=>i(e,t,h)}),Be.interactionHandles)}},M),b(()=>[this.brightness,this.contrast,this.sharpness],()=>{const{_imageViewer:e,brightness:t,contrast:i,mode:r,sharpness:a}=this;"default"===r&&(e.brightness=t,e.contrast=i,e.sharpness=a)},M),b(()=>this.activeViewer?.imageRenderer,()=>{this.sketch&&(this.sketch.view=this.activeViewer?.imageRenderer)}),b(()=>this.activeViewer,e=>{this.removeHandles(Be.hittestHandles),e&&this.addHandles(_(()=>e,"hittest-response",this._handleImageHitTestResponse),Be.hittestHandles)}),b(()=>[this.videoMapView.scale,this.videoViewModel?.videoScale],async([e,t])=>{const i=this.videoViewModel?.closestFeature;if(!t||!e||!i)return;const r=e/t;m(this._updateFootprintTask),this._updateFootprintTask=a(async e=>{const t={points:fe,feature:i,scale:r,options:{signal:e}};await this.updateVideoFootprint(t)})})]),this.when().finally(()=>{this.notifyChange("state")})}destroy(){this.currentBestFeature=null,this._updateFootprintTask=m(this._updateFootprintTask),this._clickTask=m(this._clickTask),this.coverageFrustums.destroy(),this.coveragePolygons.destroy(),this.pointSources.destroy(),this.additionalFootprints.destroy(),this.additionalCameraLocations.destroy(),this.bestFeatureFootprint=p(this.bestFeatureFootprint),this.bestFeatureCurrentFootprint=p(this.bestFeatureCurrentFootprint),this.videoViewModel=p(this.videoViewModel),this._locationViewModel=p(this._locationViewModel),this._crossSymbol=p(this._crossSymbol),this._referencePointOnGround=p(this._referencePointOnGround),this._referencePointOnImage=p(this._referencePointOnImage),this._overlays&&this.view?.map?.remove(this._overlays),this._overlays.destroy(),this._imageViewer.destroy(),this.imageMeasurementViewer.destroy(),this._panoramicViewer.destroy(),this._panoramicMeasurementViewer.destroy(),this._mediaPrefetcher?.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(){const{_imageViewer:e,_panoramicViewer:t,mode:i}=this;switch(i){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(){return this.layer?.orientationAccuracy?.every(e=>0===e)??!0}get brightness(){return this._get("brightness")??0}set brightness(e){this._set("brightness",u(e,-10,10))}get contrast(){return this._get("contrast")??0}set contrast(e){this._set("contrast",u(e,-10,10))}get currentNode(){const{currentBestFeature:e,navigationNodes:t}=this;return t.find(t=>t.id===e?.attributes.objectId)}get depthImageNotSupported(){if(this.currentBestFeature?.attributes.depthImage)return!Re(this.currentBestFeature.attributes.depthImage)}get featureCount(){return this.features?.length??0}get imageGalleryEnabled(){const{currentBestFeature:e}=this;if(!e)return!1;const t=e.attributes.imagePath?.trim();return Re(t)||Ie(t)}get imageLoaded(){return o(d.getLogger(this),"imageLoaded",{replacement:'Use OrientedImageryViewer.state === "image-loaded"',version:"4.29",warnOnce:!0}),"image-loaded"===this.state}get invalidCameraHeading(){return this.currentBestFeature?.attributes?.cameraHeading===we}get imagePointsInView(){const{mode:e,_imageViewer:t}=this;return"default"===e?t.imagePointsInView:null}get layerView(){const{layer:e,view:t}=this;if(e&&t)return t.allLayerViews.find(He(e))}get layerFloorFilterClause(){const{layerView:e}=this;return e?ne(e):null}get mode(){const e=this.currentBestFeature?.attributes;if(!e)return"none";const t=e.orientedImageryType;if(t?.includes("video"))return t.includes("360")?"panoramic-video":"video";const{horizontalFieldOfView:i,isSpherical:r}=e;return 360===i||r?"panoramic":"default"}get panoramicVideoLoaded(){const{mode:e,_panoramicVideoViewer:t}=this,{videoLoaded:i}=t.viewModel;return("panoramic-video"===e&&!0===i)??!1}get popupEnabled(){return!0===this.layer?.popupEnabled}get referencePoint(){return this._referencePointOnGround?.geometry}get sectorData(){const{_sectorData:e}=this;return e?Fe.map(t=>e[t]):null}get sharpness(){return this._get("sharpness")??0}set sharpness(e){this._set("sharpness",u(e,0,1))}get sketchGraphicsLayer(){const{sketch:e}=this;return"graphics"===e?.layer?.type?e.layer:void 0}get state(){const{mode:e,_updatingHandles:{updating:t},_featureChangedTask:i}=this;if(!this.isFulfilled()||t||!1===i?.finished)return"loading";if(this.isRejected())return"error";if("error"===this.displayMessage?.type)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"}return"ready"}get thumbnails(){const{features:e}=this;return e?new s(e.map(({attributes:{imagePath:e,objectId:t,cameraRoll:i,imageRotation:r}})=>{const a=e?.trim();return Re(a)||Ie(a)?{url:a,objectId:t,rotation:(i??0)+(r??0)}:null}).filter(r)):null}set view(e){this._set("view",e)}get _defaultGraphicsLayer(){const e={blendMode:"source-atop"};switch(this.mode){case"panoramic":return new H({...e,elevationInfo:{mode:"absolute-height"}});case"default":return new H({...e});default:return}}get _overlaysView(){return this.view?.layerViews.find(({layer:e})=>e===this._overlays)}beforeLoad(e=!0){this.emit("popup-close"),e&&(this.displayMessage=null),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=p(this.bestFeatureCurrentFootprint),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=p(this.locationPointOnImage)),this.correctedLocationPointOnImage&&(this.imageMeasurementViewer.removeGraphic(this.correctedLocationPointOnImage),this._panoramicMeasurementViewer.removeGraphic(this.correctedLocationPointOnImage),this.correctedLocationPointOnImage=p(this.correctedLocationPointOnImage))}clearPreviousMeasurements(){this.clearMeasurementGraphics(),this.resetMeasurementData(),this.stopMeasurement()}clearPreviousGroundLocation(){this.groundCoordinates=null,this.groundCoordinatesAccuracy=null,this.pixelCoordinates=null,this.clearLocationPointOnImage()}clearMeasurementGraphics(){this.measurementGraphic&&(this.activeViewer?.removeGraphic(this.measurementGraphic),this.measurementGraphic=null),this.heightGraphic&&(this.activeViewer?.removeGraphic(this.heightGraphic),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){const{sketch:i,dataCaptureLayer:r}=this;if(!i)throw nt();et(r,e,i),await i.create(e,{...t,defaultZ:0})}digitizeDelete(){if(!this.sketch)throw nt();return this.sketch.delete()}digitizeDuplicate(){if(!this.sketch)throw nt();return this.sketch.duplicate()}digitizePlace(e,t){if(!this.sketch)throw nt();return this.sketch.place(e,t)}digitizeRedo(){if(!this.sketch)throw nt();return this.sketch.redo()}digitizeUndo(){if(!this.sketch)throw nt();return this.sketch.undo()}digitizeUpdate(e,t){if(!this.sketch)throw nt();return this.sketch.update(e,t)}filterByFootprints(e,t,i=!1){const r=[],a=[],s=[];return e.forEach(e=>{const{layer:{coveragePercent:o},attributes:n}=e;let l;const{polygon:c,frustum:h}=U(n);if(l=c.clone(),n.isInspection&&(l=q(n)),o&&(l=$(l,o)),i||!t||W(l,t)){s.push(e);const{geometry:t,objectId:i,cameraHeight:o,cameraHeading:l}=n,d=t.clone();d.z=o/Z(t.spatialReference),d.imageID=i,this.pointSources.push(d),l!==we&&(r.push(c),h&&a.push(h))}}),{features:s,polygons:r,frustums:a}}async deleteDataCaptureFeatures(e){const{dataCaptureLayer:t}=this;if(!t)throw new n("orientedimageryviewer:missing-featurelayer","Data capture layer is not available");return t.queryFeatures({objectIds:e}).then(({features:e})=>t.applyEdits({deleteFeatures:e}))}handleSectorClick(e){if(isNaN(e))return;const t=this._sectorData?.[Fe[e]],i=t?.at(0);i&&(this.triangularMeasurementActive&&this.currentBestFeature?this._updateImageMeasurementBestFeature(i):this._updateCurrentBestFeature(i))}handleFeatureClick(e){const{sector:t,featureIndexInSector:i}=e;if(isNaN(i))return;const r=this._sectorData?.[t],a=r?.at(i);a&&(this.triangularMeasurementActive&&this.currentBestFeature?this._updateImageMeasurementBestFeature(a):this._updateCurrentBestFeature(a))}load(e){return this.addResolvingPromise(this._loadViewAdapter(e).catch(e=>{if(!y(e))throw e})),this}async loadBestImage(e,t){return this.selectedPoint=K(e),this.beforeLoad(),this._fetchFeaturesWithController(e,t)}async loadHeightMeasurementAdapter(e){if(!this.drawAdapter){const t=import("./adapters/draw/HeightMeasurementAdapter.js"),{default:i}=await t;if(v(e),this.drawAdapter=new i({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){const t=import("../Sketch/SketchViewModel.js"),{default:i}=await t;v(e),this.sketch=new i({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){const t=import("./adapters/sketch/MeasurementAdapter.js"),{default:i}=await t;if(v(e),this.sketchAdapter=new i({viewModel:this,measurementService:this._measurementService}),!this.sketchAdapter.viewModel.isResolved())return}return this.sketchAdapter}async processFeatureResponse(e,t,i){const{features:r}=e;if(this._clearFeatureGeometries(),!this._checkFeatures(r))return;const{features:a,polygons:s,frustums:o}=this.filterByFootprints(r,t,i?.skipFilter);if(!this._checkFeatures(a))return;this.coveragePolygons.addMany(s),this.coverageFrustums.addMany(o);const n=await this.processElevationSample(s,a,i);v(i),await this._updateElevationOfSelectedPointAndLocations(a,t,n),v(i),xe(a,n);let l=a;if(this.layer?.verticalSearchRange&&this.layer.hasZ&&this.verticalFilterEnabled&&(l=De(a,t,this.layer.verticalSearchRange),!l.length))return void this.setMessage("noImageAtElevation","info");const c=this._processSuitableFeatures(l,t);this.updateSuitabilities(c,i?.loadBestImage)}async processFeatureElevation(e,t,i){if(!t)return;const{features:r,polygons:a}=this.filterByFootprints(e,t,!0);if(!r?.length)return;const s=await this.processElevationSample(a,r,i);return v(i),s}async startMeasurement(e,t){this.sketch||await this.loadSketch(t),await this.loadMeasurementAdapter(t);const{sketch:i,sketchAdapter:r,activeViewer:a,mode:s}=this;if(!i||!r||!a||"none"===s)return;if(this.displayNewMeasurementButton=!1,"panoramic"===s&&(i.defaultCreateOptions.defaultZ=0),await i.create(e),"panoramic"===s){const{drawOperation:e}=i.view.activeTool;e.constraintsEnabled=!1,e._set("elevationDrawSurface",null)}const o=this.activeViewer?.imageRenderer.effectiveTheme.accentColor;o&&this.sketch&&(this.sketch.polygonSymbol=Pe(o),this.sketch.polylineSymbol="panoramic"===s?Ae:Ce(o,2.5))}async startHeightMeasurement(){this.displayNewMeasurementButton=!1,this.draw??=new he({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){const{activeViewer:i,currentBestFeature:r,overlayedCameraLocations:a,layer:s,mode:o,state:n,layerFloorFilterClause:l}=this,c=i?.imageSize;if(!c||!r||!s||"default"!==o&&"panoramic"!==o||n.includes("loading"))return;const{polygon:h}=U(r.attributes);if(i.removeManyGraphics(a.toArray()),a.removeAll(),e){const{features:e}=await s.queryFeatures({where:V(`${s.objectIdField} <> ${r.attributes.objectId}`,V(s.definitionExpression,l)),geometry:h,returnGeometry:!0,outFields:[s.objectIdField]}),n=await Promise.all(e.map(async e=>{const{attributes:i,geometry:r}=e,a=await this._transformationService.pointToImageGeometry(r),s="panoramic"===o?ke():Le();return new t({attributes:i,symbol:s,geometry:a})}));a.addMany(n),i.addManyGraphics(a.toArray())}}overlayGraphicsOnImage(e,t){this.removeOverlayedGraphicsOnImage(e),this.overlayedMapFeatures.set(e,t),this.activeViewer?.addManyGraphics(t.toArray())}async overlayMapFeatures(e,i=!1){const{activeViewer:r,currentBestFeature:a,mode:o,state:n,layer:l}=this,c=r?.imageSize;if(!c||!a||"none"===o||"video"===o||"panoramic-video"===o||n.includes("loading")||!l)return;const{polygon:h}=U(a.attributes);try{const{imageGeometryField:t,oiObjectIdField:i}=tt(e,l.imageGeometryField,l.imageReferenceField);this.imageGeometryField=t.name,this.oiObjectIdField=i.name}catch(m){d.getLogger(this).warn("oriented-imagery-viewer:overlay-map-features",m)}const{features:u}=await e.queryFeatures({geometry:h,returnGeometry:!0,outFields:["*"]}),p=new s(await Promise.all(u.map(async r=>{const s=r.symbol?.clone()??e.renderer?.getSymbol(r)?.clone(),{attributes:n,geometry:l}=r,{imageGeometryField:h,oiObjectIdField:u}=this;if(h&&u&&ot(e,h,u)&&`${n[u]}`==`${a.attributes.objectId}`)try{return it(n,h,e,i,c,o,s)}catch(m){d.getLogger(this).warn("oriented-imagery-viewer:overlay-map-features","couldn't create graphic from attributes, geometry will be used",{error:m,feature:r,layer:e,imageGeometryField:this.imageGeometryField,imageReferenceField:this.oiObjectIdField})}const p=await this._transformationService.geometryToImageGeometry(l);return new t({attributes:n,layer:e,symbol:s,geometry:p,visible:e.visible&&i})})));this.overlayGraphicsOnImage(`${e.id}`,p)}getDepthAt(e){const{activeViewer:t,currentBestFeature:i,mode:r,state:a,depthImage:s}=this,o=t?.imageSize;if(!o||!i||"none"===r||a.includes("loading"))return d.getLogger(this).warnOnce("oriented-imagery-viewer:get-depth-at","Load an image to use depth"),null;if(!s?.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;const n=(Array.isArray(e)?e:[e]).map(e=>s.depthAt(e,{width:o[0],height:o[1]})??null);return Array.isArray(e)?n:n[0]}getActiveSectors(){return Fe.filter(e=>this._sectorData?.[e]?.length)}async plotMapPoint(e){return this.plotReferencePoint(e),this.transformAndPlotReferencePointOnImage({feature:this.currentBestFeature,selectedLocation:e,options:{signal:this._transformController?.signal}})}plotReferencePointOnGround(e){this._referencePointOnGround&&(this._overlays?.remove(this._referencePointOnGround),this._referencePointOnGround.destroy()),null!=e&&(this._referencePointOnGround=new t({geometry:new G({...e.toJSON()}),symbol:Ge}),this.view?this._overlays?.add(this._referencePointOnGround):this.emit("plot-ground-point",{data:{point:this._referencePointOnGround?.geometry}}))}plotReferencePointOnImage(e){const{state:i,mode:r,activeViewer:a}=this;if("image-loaded"!==i||!a?.imageSize||"default"!==r&&"panoramic"!==r)return;this.clearReferencePointOnImage();const s=rt(e,r,a.imageSize);this._referencePointOnImage=new t({geometry:s,symbol:"panoramic"===r?Te.clone():Ge.clone()}),a.addGraphic(this._referencePointOnImage,0)}removeAllOverlayMapFeatures(){this.overlayedMapFeatures.forEach(e=>{this._imageViewer.removeManyGraphics(e.toArray())}),this.overlayedMapFeatures.clear()}removeOverlayedGraphicsOnImage(e){const t=this.overlayedMapFeatures.get(e);t?.length&&(this.activeViewer?.removeManyGraphics(t.toArray()),this.overlayedMapFeatures.delete(e))}reset(){const{mode:e}=this;"default"===e||"panoramic"===e?this.resetImage():"video"===e?this.resetVideo():"panoramic-video"===e&&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.clearGraphics()}this._clickTask=m(this._clickTask)}resetVideo(){this.setMessage("onLoadMessage","info"),this.videoViewModel?.resetVideoHandler(),this._overlays?.removeAll(),this.videoViewModel=null,this.featureCache=[],this.currentBestFeature=null}resetVideoPanoramic(){this.setMessage("onLoadMessage","info"),this._overlays?.removeAll(),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(){const{dataCaptureLayer:e,sketchAdapter:t}=this;if(!e||"data-capture"!==t?.type)return;const{pendingGraphics:i,savedGraphics:r}=t,a=i.get(e.id),s=a?.toArray();if(!a||!s?.length)return;const{addFeatureResults:o}=await this.saveDataCaptureFeatures(s),n=o.reduce((t,{objectId:i,globalId:r,error:a},o)=>{const n=s[o],{attributes:l}=n;return a?t.error.push(n):(i&&(l[e.objectIdField]=i),r&&e.globalIdField&&(l[e.globalIdField]=r),t.success.push(n)),t},{success:[],error:[]});r.addMany(n.success),a.removeAll(),a.addMany(n.error)}async saveDataCaptureFeatures(e,t){const{activeViewer:i,currentBestFeature:a,dataCaptureLayer:s,mode:o}=this,l=i?.imageSize;if(!l||!a||"none"===o||"video"===o||"panoramic-video"===o)throw new n("orientedimageryviewer:missing-input","Image size, current best feature and mode are required to save data capture features");if(!s)throw new n("orientedimageryviewer:missing-featurelayer","Data capture layer is not available");const c=await Promise.all(e.map(async e=>{const i=e.clone(),{geometry:r}=i;if(!r)return;const a=r.type,o=s.hasZ,n=s.geometryType,l=a!==n,c=l?await import("./transformers.js"):null,h=c?.default[n],d=l?h?.(r):r;return d&&(i.geometry=await this._transformationService.imageGeometryToMapGeometry(d,t),i.geometry)?(o||at(i.geometry),i):void 0})),h=c.filter(r);return s.applyEdits({addFeatures:h}).then(e=>{const{addFeatureResults:t}=e;let i=0;const r=c.map(e=>{const r=t[i++];return e?r:{error:new n("orientedimageryviewer:save-unsucccessful","Error in saving data capture features"),objectId:null,globalId:null}});return{...e,addFeatureResults:r}})}async searchBestImage(e,t){try{const i=await D(e,t);i&&await this.processFeatureResponse(i,e.point,t)}catch(i){y(i)||(this.setMessage("imageLoadError","error",i.message),d.getLogger(this).error("error occurred while finding best image",i))}}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 startDataCapture(e,t){const i=this.activeViewer?.imageRenderer,{oiObjectIdField:r,currentBestFeature:a}=this;if(!i||!a||!r)return;const{attributes:{objectId:o}}=a,n=this.overlayedMapFeatures.get(e.id)?.toArray()??[],l=[],c=[];for(const s of n)`${s.getAttribute(r)}`==`${o}`?l.push(s):c.push(s);this.overlayGraphicsOnImage(e.id,new s(c)),this.collectionId=e.id;const h=await this.loadSketch(t),d=await this.loadDataCaptureAdapter(t);v(t),h.addGraphics(l),d.savedGraphics.addMany(l);i.ui.find("zoom").visible=!1,i.map.layers.add(this.sketchGraphicsLayer)}async stopDataCapture(e=!1){this.sketch?.cancel(),this.sketchGraphicsLayer?.removeAll(),this.sketchAdapter=p(this.sketchAdapter),this.sketch=p(this.sketch),this.collectionId=null;const{dataCaptureLayer:t}=this,i=this.activeViewer?.imageRenderer;if(!i||i.destroyed)return;i.map.layers.remove(this.sketchGraphicsLayer),e&&t&&await this.overlayMapFeatures(t,!0);const r=i.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,i){const r=this.overlayedMapFeatures.get(e);r&&i&&this._toggleVisiblity(r,t)}toggleSelection(e){const{sketch:t}=this;t&&(t.updateOnGraphicClick=e,t.cancel())}async transformAndPlotReferencePointOnImage(e){const{selectedLocation:t,options:i}=e;let r=!1,a=!1;const s=this.bestFeatureFootprint?.geometry;switch(s?.type){case"polygon":{const e=t.spatialReference.equals(s.spatialReference)?t:await T(t,s.spatialReference);r=s.contains(e);break}case"mesh":{const e=t.spatialReference.equals(s.spatialReference)?t:await T(t,s.spatialReference);a=s.extent.contains(e);break}}if(!r&&!a)return void this.clearReferencePointOnImage();const o=await this._transformationService.pointToPixel(t,i);if(o)return v(i),this.plotReferencePointOnImage(o),{x:o.x,y:o.y};this.clearReferencePointOnImage()}async updateFeatureCache(e,t){const i=await z(e,t);i.features?.length&&(this.featureCache=i.features)}async _fetchFeatures(e,t){const{layer:i,layerFloorFilterClause:r,view:a}=this;if(!a||!i)return;e.x=E(e.x,e.spatialReference);const s=i.spatialReference.equals(e.spatialReference)?e:await T(e,i.spatialReference),o=s.spatialReference.isGeographic?R(s):s,n=V("1=1",V(i.definitionExpression,r)),l=o.spatialReference.isGeographic?1:S(o.spatialReference),c={layerInstanceOrURL:i,point:o,queryParams:{where:n,maximumDistance:i.maximumDistance?i.maximumDistance/l:void 0,timeExtent:a?.timeExtent}};return await this.searchBestImage(c,t)}async _fetchFeaturesWithController(e,t){try{await this._fetchFeatures(e,t)}catch(i){if(y(i))return;this.setMessage("imageLoadError","error"),d.getLogger(this).error("error occurred while fetching features",i)}}_groupFeaturesBySectors(){const{_suitabilities:e,additionalFeatures:t,features:i,invalidCameraHeading:r}=this,a=i.at(0);if(!e||!t||!a||!i||r)return void(this._sectorData=null);this._sectorData={};const o={};this._featureToSector=o;for(const h of Fe)this._sectorData[h]=new s;const n=e.map((e,t)=>({...e,featureIndex:t}));n.sort((e,t)=>e.trueSuitability-t.trueSuitability);const l=n.map(({distance:e})=>e),c=Math.max(...l);n.forEach(e=>{const{distance:t,angle:r,featureIndex:s}=e,n=t/c*be[2],l=$e(t,c),h=We(r);if(!this._sectorData)return;const d=be[3]+n*Math.sin(r*Math.PI/180),u=be[3]+n*Math.cos(r*Math.PI/180);let p;const m=i.at(s),g=m===a,{cameraPitch:y}=m.attributes,v=y<5;if(g&&v)p=-90;else{const e=d-be[3],t=u-be[3],i=t/Math.sqrt(e**2+t**2);let r=180*Math.acos(i)/Math.PI;(e<0&&t<0||e<0&&t>0)&&(r*=-1),p=r}const f=""===l?h:`${l}_${h}`;g&&(p===this.bestFeatureAngle?this.previousFeatureAngle=p:this.bestFeatureAngle=p,this.navigatorCurrentBestFeature=v?null:{x:d,y:u,direction:h}),o[`${m.attributes.objectId}`]=f;const w=this._sectorData[f];w.add({angle:r,featureIndex:s,x:d,y:u,objectID:m.attributes.objectId,sector:f,featureIndexInSector:w.length})})}async _initializeLocationViewModel(e){if(!this._locationViewModel){const t=import("./components/ImageLocationViewModel.js"),{default:i}=await t;v(e),this._locationViewModel=new i({oiViewModel:this,referenceTransformationService:this._referenceTransformationService})}}_initializeMeasurementService(){this._measurementService||(this._measurementService=new Ye({transformationService:this._transformationService,referenceTransformationService:this._referenceTransformationService}))}_initializeVideo(){if(this.videoElement||!this.currentBestFeature)return;this.removeHandles(Be.videoPlayerHandles),this.videoElement=new le({video:this.currentBestFeature.attributes.imagePath,georeference:new oe({extent:new L(_e)}),autoplay:!1}),this.videoElement.content?.loop&&(this.videoElement.content.loop=!1);const e=new x({source:this.videoElement,title:this.layer?.title,copyright:this.layer?.copyright});this.videoLayer=e,e&&this.videoMapView.map.layers.add(e),this.videoViewModel=new Ke({oiViewModel:this})}async getMapPoint(e,t){const i=await this._transformationService.pixelToMapPoint(Array.isArray(e)?e:[e],t);return Array.isArray(e)?i:i[0]}async getMapPointForFeature(e,t,i){const r=await this._transformationService.pixelToMapPointForFeature(Array.isArray(e)?e:[e],t,i);return Array.isArray(e)?r:r[0]}async loadPanoramicMediaSource(e,t){const{lookAt:i,...r}=e,a=ze(r);try{await a.load(t)}catch(o){if(y(o))return;"unsupported-type"===o.name&&this.setMessage("unsupportedPanoramicImageryError","error",void 0,{extension:a?.extension??"UNKNOWN FORMAT"})}const s=this.triangularMeasurementActive?this._panoramicMeasurementViewer:this._panoramicViewer;await s.loadMedia(a,t),i&&s.set(i)}async loadMediaSource(e,t){const i=Ne(e);await this._setImageSource(this.triangularMeasurementActive?this.imageMeasurementViewer:this._imageViewer,i,t)}_clearFeatureGeometries(){this.coveragePolygons.removeAll(),this.coverageFrustums.removeAll(),this.pointSources.removeAll()}_checkFeatures(e){return!!e?.length||(this.setMessage("noImageError","error"),this.videoElement?.content?.pause(),this.currentBestFeature=null,!1)}async _getElevationSampleFromGround(e,t,i){if(!e[0])return;const r=(await import("../../geometry/operators/unionOperator.js")).executeMany(e);if(this._updateFootprintWithFeatures(t,r),"3d"===this.view?.type)try{return await this.view.map.ground.createElevationSampler(this.footprintExtent,i)}catch(a){y(a)||d.getLogger(this).error(a)}}async processElevationSample(e,t,i){const{elevationSource:r}=t[0].attributes,a=await this._getElevationSampleFromGround(e,t,i);return a||(r&&this.footprintExtent&&J(r)?await X({extent:this.footprintExtent,lod:r.lod,url:r.url,rasterFunction:r.rasterFunction}):void 0)}_processSuitableFeatures(e,t){return N({features:e,selectedPoint:t,camera:Ue(this.view)?this.view.camera:null,currentImage:this.currentBestFeature})}async _processHitTestResults(e,t,i){const{results:[r]}=t;if("graphic"!==r?.type)return void this.setMessage("noImageError","error");const a=r.graphic.getAttribute(e.objectIdField);return await this.showImageByObjectId(a,i)}async _queryAndLoadByObjectId(e,t,i,r){this.displayMessage=null;const{response:a}=await Xe(e,t,i,r);if(v(r),!a?.features?.length)throw new Qe(t);const s=U(a.features[0].attributes).polygon,o=G.fromJSON(O(s)),n=K(o),l=S(n.spatialReference);this.selectedPoint=n;const c={layerInstanceOrURL:e,point:n,queryParams:{where:V(V("1=1",V(e.definitionExpression,i)),`${e.objectIdField} <> ${t}`),maximumDistance:e.maximumDistance?e.maximumDistance/l:void 0}},h=await D(c,r);v(r);const{features:d}=h;return d.push(a.features[0]),await this.processFeatureResponse(h,n,{...r,loadBestImage:!1})}_reorderTriangularSketchLayer(){const e=this.imageMeasurementViewer.imageRenderer.map.layers?.length;this.sketchTriangularGraphicsLayer&&e&&this.imageMeasurementViewer.imageRenderer.map.layers.reorder(this.sketchTriangularGraphicsLayer,e-1)}async _setImageSource(e,t,i){e.media=t,await e.loadMedia(t,i)}_toggleVisiblity(e,t){e.forEach(e=>{e.visible=t})}async _updateElevationOfSelectedPointAndLocations(e,t,i,r){const{location:a,cameraHeight:s}=e[0].attributes,o=await ie(a.spatialReference,a.z,s,{elevationSample:i,elevationSource:i?void 0:e[0].attributes.elevationSource,extent:this.footprintExtent},r);v(r);const[n,...l]=await Q([t,...e.map(e=>e.attributes.geometry.clone())],o);v(r),t.elevation=n.z,e.forEach((e,t)=>{e.attributes.elevation=l[t].z})}_updateFeatures(e,t=!0){if(!e.length)return this.currentBestFeature=null,void this.additionalFeatures.removeAll();this.features.removeAll(),this.features.addMany(e),this.navigationNodes.removeAll(),this.navigationNodes.addMany(e.map(e=>{const{geometry:t,attributes:i}=e,{isSpherical:r,cameraHeading:a,cameraPitch:s}=i;return new Ze({geometry:t,attributes:i,currentHeading:r?0:a,currentPitch:r?0:s})})),e.length>1?this.additionalFeatures.addMany(e.slice(1)):this.additionalFeatures.removeAll(),this._updateGroundElevation=!0,t&&(this.currentBestFeature=e[0]),"video"===this.mode&&(this._initializeVideo(),this.videoElement?.loaded&&this.videoViewModel?.playVideoFromSelectedLocation(e[0])),"panoramic-video"===this.mode&&this._loadVideo()}_updateFootprintWithFeatures(e,t){const i=[];for(const{attributes:{geometry:r}}of e)t.contains(r)||i.push([r.x,r.y]);i.sort((e,t)=>+B([e,t])),t.addRing(i),this.footprintExtent=de(t.extent,2,2)}async _updatePointsAndPolygons(e){const{pointSources:i,currentBestFeature:r,currentCoverageVisible:a,isAdditionalPointSourcesVisible:s,mode:o,layer:n}=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(const o of i){const i=this.view&&!this.view.spatialReference?.equals(o.spatialReference)?await T(o.clone(),this.view?.spatialReference,e):o.clone();o.imageID===r.attributes.objectId?this.currentBestFeatureLocation=new t({attributes:{imageID:o.imageID},geometry:i,symbol:je,visible:a}):this.additionalCameraLocations.push(new t({attributes:{imageID:o.imageID},geometry:i,symbol:Oe,visible:s}))}"video"!==o&&"panoramic-video"!==o||(await this.initializeTransformationService(e),n&&!this.featureCache.length&&await this.updateFeatureCache(n,r.geometry.spatialReference))}}_updateCurrentBestFeature(e){if(!e)return;if(this.currentBestFeature=this.features?.at(e.featureIndex),"video"===this.mode)return void(this.currentBestFeature&&this.videoViewModel?.playVideoFromSelectedLocation(this.currentBestFeature));if("panoramic-video"===this.mode)return void(this.currentBestFeature&&this._panoramicVideoViewer.viewModel.playPanoramicVideoFromSelectedLocation(this.currentBestFeature));const t=this.currentBestFeature?.attributes.cameraPitch&&this.currentBestFeature?.attributes.cameraPitch<5;let i;if(t)i=-90;else{const t=e.x-be[3],r=e.y-be[3],a=r/Math.sqrt(t**2+r**2);let s=180*Math.acos(a)/Math.PI;(t<0&&r<0||t<0&&r>0)&&(s*=-1),i=s}i===this.bestFeatureAngle?this.previousFeatureAngle=i:this.bestFeatureAngle=i,this.navigatorCurrentBestFeature=t?null:{x:e.x,y:e.y,direction:e.sector.includes("_")?e.sector.split("_")[1]:e.sector}}_updateImageMeasurementBestFeature(e){e&&(this.currentBestFeatureMeasurementImage=this.features?.at(e.featureIndex))}clearGraphics(){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._referencePointOnImage=p(this._referencePointOnImage))}async initializeReferenceTransformationService(e){const{currentBestFeatureMeasurementImage:t,activeTriangulatedViewer:i,mode:r}=this;if(!t||!i||!i.imageSize||"panoramic"!==r&&"default"!==r)return;const{imageSize:a}=i,{attributes:s,elevationSample:o}=t,{location:{spatialReference:n,z:l},cameraHeight:c,elevationSource:h}=s;let d=s.location;d.spatialReference.isGeographic&&(d=K(d));const u="default"===r?re(s,a[0],a[1]):ae(s,a[0],a[1]),p=await ie(n,l??0,c,{elevationSample:o,elevationSource:h,extent:this.footprintExtent},e),m=(await import("./services/TransformationService.js")).default,g={imageToWorldProperties:u,updateElevationProps:p,mode:r,imageSize:a,depthImageService:this.depthImage};this._referenceTransformationService=new m(g),this._locationViewModel&&(this._locationViewModel.referenceTransformationService=this._referenceTransformationService),this._measurementService&&(this._measurementService.referenceTransformationService=this._referenceTransformationService)}async initializeTransformationService(e){const{currentBestFeature:t,activeViewer:i,mode:r}=this,a="video"===r||"panoramic-video"===r?Me:i?.imageSize;if(!t||!a||"none"===r)return;const{attributes:s,elevationSample:o}=t,{location:{spatialReference:n,z:l},cameraHeight:c,elevationSource:h}=s;let d=s.location;d.spatialReference.isGeographic&&(d=K(d));const u="default"===r||"video"===r?"default":"panoramic",p={..."default"===u?re(s,a[0],a[1]):ae(s,a[0],a[1]),cameraLocation:d},m=await ie(n,l??0,c,{elevationSample:o,elevationSource:h,extent:this.footprintExtent},e),g=(await import("./services/TransformationService.js")).default,y={imageToWorldProperties:p,updateElevationProps:m,mode:u,imageSize:a,depthImageService:this.depthImage};this._transformationService=new g(y),this._measurementService&&(this._measurementService.transformationService=this._transformationService)}plotReferencePoint(e){"mapPoint"in e?this.plotReferencePointOnGround(e.mapPoint):this.plotReferencePointOnGround(e)}setMessage(e,t,i,r){this.displayMessage={key:e,type:t,data:i,map:r}}async transformAndPlotSelectedLocation(e){const{currentBestFeature:t,invalidCameraHeading:i,selectedPoint:r,activeViewer:a}=this;if(this._crossSymbol&&(this._panoramicViewer.removeGraphic(this._crossSymbol),this._imageViewer.removeGraphic(this._crossSymbol),this._crossSymbol=p(this._crossSymbol)),!r||!t||"image-loaded"!==a?.state||i)return;let s;try{s=await this._transformationService.pointToPixel(r,{signal:e?.signal}),v(e),await this.plotSelectedPointOnImage(s,e)}catch(o){y(o)||d.getLogger(this).error("failed to transform map point to pixel, cross symbol will not be plotted on image",{error:o,selectedPoint:r,feature:t})}}updateCurrentCoveragePolygon(e){const{additionalFootprints:i,additionalCameraLocations:r,currentBestFeature:a,currentBestFeatureLocation:s,currentCoverageVisible:o,selectedPoint:n,view:l,_adapter:c,mode:h}=this;if(!a)return;const{attributes:{objectId:d},elevationSample:u}=a;if(this._initialCurrentCoverageUpdate){if(this._overlays?.removeAll(),this._initialCurrentCoverageUpdate=!1,this.bestFeatureCurrentFootprint=p(this.bestFeatureCurrentFootprint),e&&!this.invalidCameraHeading&&(e.visible=o,this.bestFeatureCurrentFootprint=e),l){const e=[...i,...r,s].filter(qe);"3d"===l?.type&&u&&c?.updateGroundElevation&&(this._updateGroundElevation&&c.updateGroundElevation(e),"panoramic"===h&&c.updateGroundElevation([this.bestFeatureCurrentFootprint])),this._updateGroundElevation=!1,n&&(e.splice(-2,0,this.bestFeatureCurrentFootprint),e.push(new t({geometry:n.clone(),symbol:Ve.clone(),attributes:{imageID:d}}))),this._overlays.graphics.addMany(e)}}else if(l){if(this.invalidCameraHeading)return;this.bestFeatureCurrentFootprint&&(this._overlays?.remove(this.bestFeatureCurrentFootprint),this.bestFeatureCurrentFootprint=p(this.bestFeatureCurrentFootprint));const t=this.bestFeatureCurrentFootprint&&this._overlays?this._overlays.graphics.indexOf(this.bestFeatureCurrentFootprint):-1;e&&(this.bestFeatureCurrentFootprint=e,"3d"===l?.type&&u&&c?.updateGroundElevation&&"panoramic"===h&&c.updateGroundElevation([e]),e.visible=this.currentCoverageVisible,this._overlays?.graphics.add(this.bestFeatureCurrentFootprint,t>=0?t:this._overlays.graphics.length-1))}}};e([P()],lt.prototype,"activeLayer",null),e([P({readOnly:!0})],lt.prototype,"activeViewer",null),e([P()],lt.prototype,"activeTriangulatedViewer",null),e([P()],lt.prototype,"accuracyParametersMissing",null),e([P()],lt.prototype,"additionalFeatures",void 0),e([P({type:s.ofType(t)})],lt.prototype,"additionalCameraLocations",void 0),e([P({type:s.ofType(t)})],lt.prototype,"additionalFootprints",void 0),e([P()],lt.prototype,"areaMeasurementResult",void 0),e([P()],lt.prototype,"areaMeasurementAccuracy",void 0),e([P()],lt.prototype,"bestFeatureAngle",void 0),e([P()],lt.prototype,"bestFeatureCurrentFootprint",void 0),e([P({type:t})],lt.prototype,"bestFeatureFootprint",void 0),e([P({type:Number})],lt.prototype,"brightness",null),e([P()],lt.prototype,"cameraHeadingThreshold",void 0),e([P()],lt.prototype,"cameraPitchThreshold",void 0),e([P()],lt.prototype,"clickAction",void 0),e([P()],lt.prototype,"correctedLocationPointOnImage",void 0),e([P()],lt.prototype,"videoViewModel",void 0),e([P()],lt.prototype,"collectionId",void 0),e([P({type:Number})],lt.prototype,"contrast",null),e([P()],lt.prototype,"coverageFrustums",void 0),e([P()],lt.prototype,"coveragePolygons",void 0),e([P()],lt.prototype,"currentBestFeature",void 0),e([P()],lt.prototype,"currentBestFeatureMeasurementImage",void 0),e([P()],lt.prototype,"currentBestFeatureLocation",void 0),e([P()],lt.prototype,"currentCoverageVisible",void 0),e([P()],lt.prototype,"currentNode",null),e([P()],lt.prototype,"depthImage",void 0),e([P()],lt.prototype,"depthImageNotSupported",null),e([P()],lt.prototype,"featureCache",void 0),e([P()],lt.prototype,"navigationNodes",void 0),e([P({json:{write:!1}})],lt.prototype,"determineWorkflowForFeature",void 0),e([P({json:{write:!1}})],lt.prototype,"determineWorkflowForTriangularMeasurement",void 0),e([P()],lt.prototype,"disabled",void 0),e([P()],lt.prototype,"displayMessage",void 0),e([P()],lt.prototype,"displayNewMeasurementButton",void 0),e([P()],lt.prototype,"distanceMeasurementResult",void 0),e([P()],lt.prototype,"distanceAccuracyArray",void 0),e([P()],lt.prototype,"dataCaptureLayer",void 0),e([P({readOnly:!0})],lt.prototype,"featureCount",null),e([P()],lt.prototype,"features",void 0),e([P()],lt.prototype,"groundCoordinates",void 0),e([P()],lt.prototype,"groundCoordinatesAccuracy",void 0),e([P()],lt.prototype,"heightGraphic",void 0),e([P()],lt.prototype,"heightMeasurementResult",void 0),e([P()],lt.prototype,"heightMeasurementAccuracy",void 0),e([P({readOnly:!0})],lt.prototype,"imageGalleryEnabled",null),e([P()],lt.prototype,"imageGeometryField",void 0),e([P({readOnly:!0})],lt.prototype,"imageLoaded",null),e([P()],lt.prototype,"imageLocationToolState",void 0),e([P({readOnly:!0})],lt.prototype,"invalidCameraHeading",null),e([P()],lt.prototype,"imagePointsInView",null),e([P()],lt.prototype,"imageMeasurementViewer",void 0),e([P()],lt.prototype,"isAdditionalCoverageVisible",void 0),e([P()],lt.prototype,"isAdditionalPointSourcesVisible",void 0),e([P()],lt.prototype,"layer",void 0),e([P()],lt.prototype,"layerView",null),e([P({readOnly:!0})],lt.prototype,"layerFloorFilterClause",null),e([P({type:Number})],lt.prototype,"localPort",void 0),e([P()],lt.prototype,"locationPointOnImage",void 0),e([P()],lt.prototype,"mapImageConversionToolState",void 0),e([P()],lt.prototype,"measureType",void 0),e([P()],lt.prototype,"measurementGraphic",void 0),e([P({readOnly:!0,value:"none"})],lt.prototype,"mode",null),e([P()],lt.prototype,"navigationMode",void 0),e([P()],lt.prototype,"navigatorCurrentBestFeature",void 0),e([P()],lt.prototype,"oiObjectIdField",void 0),e([P({type:s.ofType(t)})],lt.prototype,"overlayedCameraLocations",void 0),e([P()],lt.prototype,"overlayedMapFeatures",void 0),e([P()],lt.prototype,"panoramicVideoLoaded",null),e([P()],lt.prototype,"pixelCoordinates",void 0),e([P()],lt.prototype,"preserveAngle",void 0),e([P()],lt.prototype,"pointSources",void 0),e([P({readOnly:!0})],lt.prototype,"popupEnabled",null),e([P()],lt.prototype,"preloadMedia",void 0),e([P()],lt.prototype,"preloadMediaSize",void 0),e([P()],lt.prototype,"previousFeatureAngle",void 0),e([P()],lt.prototype,"referencePoint",null),e([P({readOnly:!0})],lt.prototype,"sectorData",null),e([P()],lt.prototype,"selectedPoint",void 0),e([P({type:Number})],lt.prototype,"sharpness",null),e([P()],lt.prototype,"shouldShowSelectedImage",void 0),e([P()],lt.prototype,"sketch",void 0),e([P()],lt.prototype,"sketchTriangular",void 0),e([P()],lt.prototype,"sketchTriangularGraphicsLayer",void 0),e([P()],lt.prototype,"draw",void 0),e([P()],lt.prototype,"drawAdapter",void 0),e([P()],lt.prototype,"polylineDrawAction",void 0),e([P()],lt.prototype,"sketchAdapter",void 0),e([P({readOnly:!0})],lt.prototype,"sketchGraphicsLayer",null),e([P({readOnly:!0})],lt.prototype,"state",null),e([P({readOnly:!0})],lt.prototype,"thumbnails",null),e([P()],lt.prototype,"triangularMeasurementActive",void 0),e([P()],lt.prototype,"triangulatedDistanceMeasurement",void 0),e([P()],lt.prototype,"triangulatedDistanceAccuracy",void 0),e([P()],lt.prototype,"triangulatedAreaMeasurement",void 0),e([P()],lt.prototype,"triangulatedAreaAccuracy",void 0),e([P()],lt.prototype,"triangulatedMeasurementGraphic",void 0),e([P()],lt.prototype,"triangulatedPoint",void 0),e([P()],lt.prototype,"triangulatedMeasurementAdapter",void 0),e([P()],lt.prototype,"updateFootprint",void 0),e([P()],lt.prototype,"updateVideoFootprint",void 0),e([P()],lt.prototype,"updateFootprintPanorama",void 0),e([P()],lt.prototype,"updatingTriangularMeasurementState",void 0),e([P({value:null})],lt.prototype,"view",null),e([P()],lt.prototype,"videoElement",void 0),e([P()],lt.prototype,"videoLayer",void 0),e([P()],lt.prototype,"videoMapView",void 0),e([P()],lt.prototype,"verticalFilterEnabled",void 0),e([P()],lt.prototype,"_adapter",void 0),e([P()],lt.prototype,"_defaultGraphicsLayer",null),e([P()],lt.prototype,"_highlightedFeatureHandle",void 0),e([P()],lt.prototype,"_imageViewer",void 0),e([P()],lt.prototype,"_initialCurrentCoverageUpdate",void 0),e([P()],lt.prototype,"_locationViewModel",void 0),e([P()],lt.prototype,"_measurementService",void 0),e([P()],lt.prototype,"_mediaPrefetcher",void 0),e([P()],lt.prototype,"_navigationManager",void 0),e([P()],lt.prototype,"_overlays",void 0),e([P({readOnly:!0})],lt.prototype,"_overlaysView",null),e([P()],lt.prototype,"_panoramicVideoViewer",void 0),e([P()],lt.prototype,"_panoramicViewer",void 0),e([P()],lt.prototype,"_panoramicMeasurementViewer",void 0),e([P()],lt.prototype,"_referencePointOnGround",void 0),e([P()],lt.prototype,"_referencePointOnImage",void 0),e([P()],lt.prototype,"_referenceTransformationService",void 0),e([P()],lt.prototype,"_sectorData",void 0),e([P()],lt.prototype,"_transformationService",void 0),e([P()],lt.prototype,"_featureToSector",void 0),e([P({readOnly:!0})],lt.prototype,"_updatingHandles",void 0),e([P()],lt.prototype,"footprintExtent",void 0),e([P()],lt.prototype,"_featureChangedTask",void 0),lt=e([A("esri.widgets.OrientedImageryViewer.OrientedImageryViewerViewModel")],lt);const ct=lt;export{ct as default};
2
+ import{__decorate as e}from"tslib";import t from"../../Graphic.js";import{equals as i,isSome as r}from"../../core/arrayUtils.js";import{createTask as a}from"../../core/asyncUtils.js";import s from"../../core/Collection.js";import{deprecatedProperty as o}from"../../core/deprecate.js";import n from"../../core/Error.js";import{EventedMixin as l}from"../../core/Evented.js";import{makeHandle as c}from"../../core/handleUtils.js";import{equalsShallow as h}from"../../core/lang.js";import d from"../../core/Logger.js";import{clamp as u}from"../../core/mathUtils.js";import{destroyMaybe as p,abortMaybe as m}from"../../core/maybe.js";import{EsriPromise as g}from"../../core/Promise.js";import{isAbortError as y,throwIfAborted as v,waitTick as f}from"../../core/promiseUtils.js";import w from"../../core/ReactiveMap.js";import{whenOnce as F,on as _,watch as b,syncAndInitial as M,initial as I}from"../../core/reactiveUtils.js";import{sqlAnd as V}from"../../core/sql.js";import{getMetersPerUnitForSR as S}from"../../core/units.js";import{property as P,subclass as A}from"../../core/accessorSupport/decorators.js";import{isSerializable as C}from"../../core/support/jsonUtils.js";import{UpdatingHandles as k}from"../../core/support/UpdatingHandles.js";import L from"../../geometry/Extent.js";import G from"../../geometry/Point.js";import{projectAsync as T}from"../../geometry/projectionUtils.js";import j from"../../geometry/SpatialReference.js";import{polygonCentroidPoint as O}from"../../geometry/support/centroid.js";import{isClockwise as B}from"../../geometry/support/coordsUtils.js";import{normalizeMapX as E}from"../../geometry/support/normalizeUtils.js";import{geographicToWebMercator as R}from"../../geometry/support/webMercatorUtils.js";import H from"../../layers/GraphicsLayer.js";import x from"../../layers/MediaLayer.js";import{searchImages as D,getSortedLayerFeatures as z}from"../../layers/orientedImagery/queries.js";import{calculateSuitabilities as N}from"../../layers/orientedImagery/core/bestImageUtils.js";import{createCoveragePolygon as U,computePolygonForInspection as q,resizePolygon as $,checkIfPolygonContainsSelectedPoint as W}from"../../layers/orientedImagery/core/coverageUtils.js";import{isElevationSource as J}from"../../layers/orientedImagery/core/ElevationSourceDefinitions.js";import{getMetersPerUnitOfSR as Z,convertGeographicToWebMercator as K}from"../../layers/orientedImagery/core/utils.js";import Q from"../../layers/orientedImagery/transformations/updateElevation.js";import{getElevationSampler as X}from"../../layers/orientedImagery/transformations/updateElevationUtils.js";import{or as Y,getInitialAngle as ee,convertPixelLocationToSphereVertex as te,getUpdateElevationProps as ie,getImageToWorldProperties as re,getImageToWorldPanoramicProperties as ae}from"../../layers/orientedImagery/transformations/utils.js";import se from"../../layers/support/ExtentAndRotationGeoreference.js";import{getFloorFilterClause as oe}from"../../layers/support/floorFilterUtils.js";import ne from"../../layers/support/VideoElement.js";import le from"../../views/MapView.js";import ce from"../../views/draw/Draw.js";import{scale as he}from"../../views/draw/support/drawUtils.js";import{ViewEventPriorities as de}from"../../views/input/InputManager.js";import ue from"../PanoramicVideoViewer.js";import pe from"../PanoramicViewer.js";import{defaultAngleThresholdInDegrees as me,videoMapViewConstraint as ge,clockwiseDirections as ye,videoExtent as ve,invalidCameraHeading as fe,sectorsInOrder as we,sampleExtent as Fe,sectorsRadii as _e,fixedImageSize as be}from"./constants.js";import{isFeatureAttachment as Me}from"./galleryUtils.js";import{crossSymbol as Ie,crossSymbol3D as Ve,measurementPolygonSymbol as Se,polylineSymbolPanoramic as Pe,measurementPolylineSymbol as Ae,cameraOverlaySymbol3D as Ce,cameraOverlaySymbol as ke,diamondSymbol as Le,diamondSymbol3D as Ge,activeSourcePointSymbol as Te,sourcePointSymbol as je}from"./symbols.js";import{registryKeys as Oe}from"./types.js";import{isNoAttachmentError as Be,extractHorizonAnglesFromMedia as Ee,isTifOrMrf as Re,filterOILLayerView as He,assignElevationSampleToFeatures as xe,filterByZ as De,createPanoramicMedia as ze,createNonPanoramicMedia as Ne,isSceneView as Ue,isGraphic as qe,calculateSegment as $e,calculateDirection as We}from"./utils.js";import Je from"./components/ImageViewer.js";import Ze from"./components/NavigationNode.js";import Ke from"./components/OrientedImageryVideoViewModel.js";import{NoFeatureFoundWithObjectIdError as Qe}from"./navigation/errors.js";import{queryFeatureByObjectIds as Xe}from"./navigation/queries.js";import{ImageMeasurementService as Ye}from"./services/ImageMeasurementService.js";import{configureSketchTool as et,extractFieldsFromDataCaptureLayer as tt,constructGraphicFromImageGeometry as it}from"./support/dataCaptureUtils.js";import{imageSpaceToPoint as rt,removeZFromGeometry as at}from"./support/geometryUtils.js";import st from"./support/resolveMediaProps.js";import{isValidDataCaptureLayer as ot}from"./support/typeUtils.js";const nt=()=>new n("orientedimageryviewer:sketch-not-initialized","Sketch property is not initialized, call loadSketch first");let lt=class extends(l(g)){constructor(e){super(e),this.additionalFeatures=new s,this.additionalCameraLocations=new s,this.additionalFootprints=new s,this.areaMeasurementResult=0,this.areaMeasurementAccuracy=0,this.bestFeatureAngle=0,this.bestFeatureCurrentFootprint=null,this.bestFeatureFootprint=null,this.cameraHeadingThreshold=me,this.cameraPitchThreshold=me,this.clickAction="hittest",this.correctedLocationPointOnImage=null,this.videoViewModel=null,this.collectionId=null,this.coverageFrustums=new s,this.coveragePolygons=new s,this.currentBestFeature=null,this.currentBestFeatureMeasurementImage=null,this.currentBestFeatureLocation=null,this.currentCoverageVisible=!0,this.depthImage=null,this.featureCache=[],this.navigationNodes=new s,this.determineWorkflowForFeature=async(e,t,i)=>{const{currentBestFeature:r,selectedPoint:a}=this;if(this.emit("popup-close"),r&&a){this._initialCurrentCoverageUpdate=!0,this._updateGroundElevation=!0;try{await this._updatePointsAndPolygons(i),await this._loadDepthImage(i),await this._loadImage(i)}catch(s){y(s)||(this.loadImageError(s),d.getLogger(this).error("#loadIImage()","error occured while loading image",s))}}},this.determineWorkflowForTriangularMeasurement=async(e,t,i)=>{if(this.emit("popup-close"),this.currentBestFeatureMeasurementImage&&this.selectedPoint)try{await this._loadMeasurementViewerImage(i)}catch(r){y(r)||(this.loadImageError(r),d.getLogger(this).error("#loadIImage()","error occured while loading image",r))}},this.disabled=!1,this.displayMessage={key:"onLoadMessage",type:"info"},this.displayNewMeasurementButton=!0,this.distanceMeasurementResult=0,this.distanceAccuracyArray=[],this.dataCaptureLayer=null,this.features=new s,this.groundCoordinates=null,this.groundCoordinatesAccuracy=null,this.heightGraphic=null,this.heightMeasurementResult=0,this.heightMeasurementAccuracy=0,this.imageGeometryField=null,this.imageLocationToolState=!1,this.imageMeasurementViewer=new Je,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 s,this.overlayedMapFeatures=new w,this.pixelCoordinates=null,this.preserveAngle="none",this.pointSources=new s,this.preloadMedia=!1,this.preloadMediaSize=5,this.previousFeatureAngle=0,this.selectedPoint=null,this.shouldShowSelectedImage=!1,this.sketch=null,this.sketchTriangular=null,this.sketchTriangularGraphicsLayer=null,this.draw=null,this.drawAdapter=null,this.polylineDrawAction=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,i)=>{"default"===this.mode&&"image-loaded"!==this.state||await(this._adapter?.updateFootprint(e,t,i))},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 le({map:new Map,constraints:ge}),this.verticalFilterEnabled=!1,this._adapter=null,this._highlightedFeatureHandle=null,this._imageViewer=new Je,this._initialCurrentCoverageUpdate=!0,this._locationViewModel=null,this._measurementService=null,this._mediaPrefetcher=null,this._navigationManager=null,this._overlays=new H({listMode:"hide",internal:!0,elevationInfo:{mode:"absolute-height"},title:"OrentedImageryViewerViewModel overlays layer"}),this._panoramicVideoViewer=new ue,this._panoramicViewer=new pe,this._panoramicMeasurementViewer=new pe,this._referencePointOnGround=null,this._referencePointOnImage=null,this._referenceTransformationService=null,this._sectorData=null,this._transformationService=null,this._featureToSector=null,this._updatingHandles=new k,this._clickTask=null,this._crossSymbol=null,this.footprintExtent=null,this._featureChangedTask=null,this._mediaPrefetchTask=null,this._suitabilities=null,this._transformController=new AbortController,this._updateFootprintTask=null,this._updateGroundElevation=!1,this.addUpdatingPromise=e=>this._updatingHandles.addPromise(e),this.filterCapturedFeatures=e=>{const t=this.currentBestFeature?.attributes.objectId,i=this.layer?.imageReferenceField;if(!t||!e||!i)return;const r=this.overlayedMapFeatures.get(e);r?.forEach(e=>{const r=e.attributes??{},a=Object.keys(r).find(e=>e.toLowerCase()===i.toLowerCase());(a?r[a]:null)!==t&&(e.visible=!e.visible)})},this.hideImageGeometry=e=>{},this.highlight=e=>{if(!this._overlaysView)return;this.removeHighlight();const 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);const t=import("./adapters/sketch/DataCaptureAdapter.js"),{default:i}=await t;return v(e),this.sketchAdapter=new i({viewModel:this}),this.sketchAdapter},this.loadImageFromFeature=(e,t,i)=>this._updatingHandles.addPromise(this._loadImageFromFeature(e,t,i)),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)=>{const i=this.additionalFeatures.find(({attributes:t})=>t.objectId===e);if(i)this.currentBestFeature=i;else{const{layer:i,layerFloorFilterClause:a}=this;if(!i)return void this.setMessage("noLayerSelected","info");this.beforeLoad();const s=this._updatingHandles.addPromise(this._queryAndLoadByObjectId(i,e,a,t));try{await s,await this.selectBestFeature(e,t)}catch(r){y(r)||(d.getLogger(this).error("oriented-imagery-viewer:show-image",r),"NoFeatureFoundWithObjectIdError"===r.name?this.setMessage("noFeatureFoundWithObjectId","error","",{objectId:e}):this.setMessage("imageLoadError","error",r.message))}}},this.getSectorFeatureById=e=>this._suitabilities?.find(({feature:{attributes:{objectId:t}}})=>t===e),this.getFeatureSectorById=e=>this._featureToSector?.[`${e}`],this.navigate=async(e,t)=>{const{mode:i}=this;if("default"!==i&&"panoramic"!==i)throw new n("NavigationError","Navigation is only supported in 'default' and 'panoramic' modes.");const r=e=>"default"===i&&e.declaredClass.endsWith("NavigationManager")||"panoramic"===i&&e.declaredClass.endsWith("NavigationManagerPanoramic");if(null==this._navigationManager||!r(this._navigationManager)){p(this._navigationManager);const e="default"===i?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}`),F(()=>"image-loaded"===this.state,t)),this.toggleImageAttributes=()=>{const{currentBestFeature:e,popupEnabled:i,layer:r,view:a}=this;if(this.emit("popup-close"),!(a&&e&&i&&r))return;const{attributes:s,geometry:o}=e,n=new t({geometry:o,attributes:s.toJSON(),origin:r.graphicOrigin});this.emit("popup-open",{features:[n],location:s.location.clone()})},this.updateSuitabilities=(e,t=!0)=>{e.sort((e,t)=>e.suitability-t.suitability),this._suitabilities=e;const i=this._suitabilities.map(({feature:e})=>e);this._initialCurrentCoverageUpdate=!0,this._updateFeatures(i,t),this._groupFeaturesBySectors()},this._createViewClickHandle=()=>{if(this.removeHandles(Oe.click),this.disabled||null==this.view)return;const e=this.mapImageConversionToolState&&"image-loaded"===this.state?this._mapImageConversionToolViewClickHandler:this._viewClickHandler;this.addHandles(this.view.on("click",e,de.DEFAULT),Oe.click)},this._createImageClickHandle=()=>{this.removeHandles(Oe.imageClick);const{mapImageConversionToolState:e,mode:t,activeViewer:i,currentBestFeature:r,footprintExtent:s}=this,o=i?.imageSize;if(!(e&&"none"!==t&&o&&s&&r))return;const n=i.clickAction;this.clickAction="pixel-location";const l=c(()=>{this.clickAction=n});let h=null;const d=_(()=>i,"pixel-location",e=>{this.plotReferencePointOnImage(e),h?.abort(),h=a(async t=>{if(!e)return;const i=await this._transformationService.pixelToMapPoint(e).then(e=>{const t=this.view?.spatialReference;return Y(!t,e.spatialReference.equals(t))?e:T(e,t)});v(t),this.plotReferencePointOnGround(i)})});this.addHandles([d,l],Oe.imageClick)},this._createTriangularImageClickHandle=()=>{this.removeHandles(Oe.triangularImageClick),this.triangularMeasurementActive&&"none"!==this.mode&&this.currentBestFeature&&this.currentBestFeatureMeasurementImage&&this.activeTriangulatedViewer&&this.addHandles(this.activeTriangulatedViewer.imageRenderer.on("double-click",this._measurementImageClickHandler),Oe.triangularImageClick)},this._handleImageHitTestResponse=async e=>{const{layer:t,overlayedCameraLocations:i}=this;if(!t)return;const r=e.results.find(({graphic:e,graphic:{attributes:r}})=>i.includes(e)&&r&&!r[t.imageReferenceField]&&!r[t.imageGeometryField]);if(!r)return;const a=r.graphic.attributes[t.objectIdField];await this.showImageByObjectId(a)},this._loadDepthImage=async e=>{const{currentBestFeature:t,layer:i,depthImageNotSupported:r}=this;if(this.depthImage?.destroy(),this.depthImage=null,!i||!t||r)return;const{depthImage:a}=t.attributes;if(!a)return;const s=(await import("./services/DepthImageService.js")).default;v(e),this.depthImage=new s({url:a});try{await this.depthImage.load(e)}catch(o){y(o)||(d.getLogger(this).error("error occurred while loading depth image",o),this.depthImage?.destroy(),this.depthImage=null)}},this._loadImage=async e=>{const{currentBestFeature:t,layer:i,mode:r}=this;if(this.clearGraphics(),i&&t&&"none"!==r&&"video"!==r&&"panoramic-video"!==r)try{await this.loadImageFromFeature(i,t,e),v(e),await this.transformAndPlotSelectedLocation(e)}catch(a){y(a)||this.loadImageError(a)}},this._loadVideo=async e=>{const{currentBestFeature:t,mode:i,selectedPoint:r}=this,a=t?.attributes.imagePath;if(!t||"panoramic-video"!==i||!a)return;const{attributes:s}=t,{cameraPitch:o,cameraOrientation:n,location:l}=s,c=l.spatialReference.isWGS84&&4!==n?.type?R(l):new G(l);try{this._panoramicVideoViewer.viewModel.video&&this._panoramicVideoViewer.viewModel.video.pause(),this._panoramicVideoViewer.videoSource=a;let t=0;c&&r&&(t=await ee(c,r)-t),this._panoramicVideoViewer.pitch=o??0,this._panoramicVideoViewer.yaw=t,await this._panoramicVideoViewer.loadVideo(e),v(e)}catch(h){y(h)||this.loadImageError(h)}},this._loadImageFromFeature=async(e,t,i)=>{const{mode:r}=this;if("default"!==r&&"panoramic"!==r)return;let a;try{a=await st(t.attributes,e,i),v(i)}catch(f){if(y(f))return;return Be(f)?(d.getLogger(this).error(f),void this.setMessage("noAttachment","error",`${e.objectIdField}: ${t.attributes.objectId}`)):(d.getLogger(this).error(f,{[e.objectIdField]:t.attributes.objectId,layer:e}),void this.setMessage("imageLoadError","error",`query-attachments-failed:${e.objectIdField} ${t.attributes.objectId}`))}if(!a)return;const{mediaUrl:s,datasetFormat:o,rotation:n,searchParams:l,location:c,cameraHeading:h,matrix:u,cameraPitch:p,getDataSetFormatError:m}=a,g=`${t.attributes.objectId}`;try{let a=this._mediaPrefetcher?.getCachedMedia(g);if(!a){const i=this.navigationNodes.find(e=>e.id===t.attributes.objectId);if(i){try{await(this._mediaPrefetcher?.startPrefetchForNode(i,e))}catch(w){}a=this._mediaPrefetcher?.getCachedMedia(g)}}if(a){if("panoramic"===r){const e=this.triangularMeasurementActive?this._panoramicMeasurementViewer:this._panoramicViewer;let r=0;return c&&this.selectedPoint&&(r=await ee(c,this.selectedPoint)-r),await e.loadMedia(a,i),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}),void(this.triangularMeasurementActive?await this.initializeReferenceTransformationService(i):await this.initializeTransformationService(i))}return await this._setImageSource(this.triangularMeasurementActive?this.imageMeasurementViewer:this._imageViewer,a,i),void(this.triangularMeasurementActive?await this.initializeReferenceTransformationService(i):await this.initializeTransformationService(i))}}catch(w){}m&&d.getLogger(this).warn("error occurred while getting dataset format",m),"panoramic"===r?await this.loadPanoramicMediaSource({lookAt:{yaw:this.selectedPoint?await ee(c,this.selectedPoint):"viewAngle"in t.attributes&&Number.isFinite(t.attributes.viewAngle)?t.attributes.viewAngle:0,pitch:p},extension:o?.toUpperCase(),url:s,cameraHeading:h,matrix:u},i):await this.loadMediaSource({datasetFormat:o?.toUpperCase(),url:s,customParameters:l,rotation:n},i),this.triangularMeasurementActive?await this.initializeReferenceTransformationService(i):await this.initializeTransformationService(i)},this._loadMeasurementViewerImage=async e=>{const{currentBestFeatureMeasurementImage:t,layer:i,mode:r}=this;if(this.imageMeasurementViewer.clearGraphics(),this._panoramicMeasurementViewer.clearGraphics(),i&&t&&"none"!==r&&"video"!==r&&"panoramic-video"!==r)try{await this.loadImageFromFeature(i,t,e),v(e)}catch(a){y(a)||this.loadImageError(a)}},this._loadMediaPrefetcher=async e=>{if(!this._mediaPrefetcher){const{default:t}=await import("./support/MediaPrefetcher.js");v(e),this._mediaPrefetcher=new t({maxEntries:this.preloadMediaSize*ye.length})}return this._mediaPrefetcher},this._loadViewAdapter=async e=>{const{view:t}=this;if(t)switch(t.type){case"2d":{const{default:t}=await import("./adapters/view/MapViewAdapter.js");v(e),this._adapter=new t(this);break}case"3d":{const{default:t}=await import("./adapters/view/SceneViewAdapter.js");v(e),this._adapter=new t(this);break}}else this._adapter=null},this._mapImageConversionToolViewClickHandler=e=>{if(e.stopPropagation(),e.preventDefault(),e.mapPoint){const t=e.mapPoint;t.x=E(t.x,t.spatialReference),this.plotMapPoint(e.mapPoint)}},this._measurementImageClickHandler=e=>{e.stopPropagation(),e.preventDefault();const{sketchTriangular:t,triangularMeasurementActive:i,currentBestFeatureMeasurementImage:r,triangulatedMeasurementGraphic:a}=this;t&&i&&r&&a&&"active"!==t.state&&(t.update([a],{tool:"reshape"}),this.updatingTriangularMeasurementState=!0)},this._viewClickHandler=e=>{this._clickTask?.abort(),this._clickTask=a(async t=>{const{pointerType:i,button:r,mapPoint:a}=e;if("mouse"===i&&0!==r||!a)return;e.stopPropagation(),e.preventDefault();const{view:s,layer:o}=this;if(s&&o){if(this.shouldShowSelectedImage){const i=s.hitTest(e,{include:[o]});this._updatingHandles.addPromise(i);const r=await i;return v(t),await this._processHitTestResults(o,r,{signal:t})}return this._updatingHandles.addPromise(this.loadBestImage(a,{signal:t}))}})},this.plotSelectedPointOnImage=async(e,i)=>{if(await f(i),!e)return;const r=new G({...C(e)?e.toJSON():e});if("default"===this.mode)r.x-=.5,r.y=.5-r.y,r.spatialReference=this._imageViewer.imageRenderer.spatialReference.clone(),this._crossSymbol=new t({geometry:r,symbol:Ie}),this._imageViewer.addGraphic(this._crossSymbol,0);else if("panoramic"===this.mode){const{imageSize:i,media:r}=this._panoramicViewer;if(!i||!r)return;const a=Ee(r),s=te(e,...i,a);this._crossSymbol=new t({geometry:new G(s,j.WebMercator),symbol:Ve}),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([b(()=>this.view,()=>this.load(),M),b(()=>this.view?.map,(e,t)=>{t?.layers.remove(this._overlays),e?.layers.add(this._overlays)},I),b(()=>this.view?.map?.allLayers?.length,e=>{e&&this.view?.map?.layers.reorder(this._overlays,e-1)},I),b(()=>[this.state,this.mapImageConversionToolState,this.view,this.disabled],()=>{this._createViewClickHandle(),this._createImageClickHandle()},M),b(()=>[this.triangularMeasurementActive,this.currentBestFeatureMeasurementImage],()=>{this._createTriangularImageClickHandle()},M),b(()=>[this.state,this.imageLocationToolState,this.view],()=>{this._initializeMeasurementService(),this._initializeLocationViewModel()},M),b(()=>this.measureType,()=>{this.clearPreviousMeasurements(),this._initializeMeasurementService()},M),b(()=>this.bestFeatureAngle,(e,t)=>{this.previousFeatureAngle=t??0},M),b(()=>this.currentBestFeature,async(e,t)=>{m(this._featureChangedTask),this._featureChangedTask=a(async i=>this.determineWorkflowForFeature.apply(this,[e,t,{signal:i}])),await this._featureChangedTask.promise},{sync:!0}),b(()=>[this.currentNode,this.preloadMedia,this.navigationMode],()=>{this._mediaPrefetchTask?.abort(),this._mediaPrefetchTask=a(async e=>{this.preloadMedia&&null!=this.navigationMode?(this._mediaPrefetcher??=await this._loadMediaPrefetcher({signal:e}),v(e),"directional"===this.navigationMode?this._mediaPrefetcher.enqueueDirectionalPrefetch(this.layer,this.currentNode,this.preloadMediaSize):this._mediaPrefetcher.enqueueSequentialPrefetch(this.layer,this.currentNode,this.preloadMediaSize)):this._mediaPrefetcher?.clear()})},M),b(()=>this.currentBestFeatureMeasurementImage,(e,t)=>{m(this._featureChangedTask),t&&e!==t&&(this.triangulatedPoint=null,this.sketchTriangularGraphicsLayer?.graphics.destroyAll(),this._measurementService?.resetMeasurementVectors()),this._featureChangedTask=a(async i=>{await this.determineWorkflowForTriangularMeasurement(e,t,{signal:i}),v(i),this._reorderTriangularSketchLayer()})},M),b(()=>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())}),b(()=>this.mode,e=>{switch(this.removeHandles(Oe.interactionHandles),e){case"default":this.addHandles(b(()=>{const{state:e}=this;return"image-loaded"===e?this._imageViewer.imagePointsInView:null},e=>{e&&(m(this._updateFootprintTask),this._updateFootprintTask=a(async t=>{await this.updateFootprint(e,void 0,{signal:t})}))},{...M,equals:(e,t)=>i(e,t,h)}),Oe.interactionHandles);break;case"video":this.addHandles(b(()=>{const{footprintExtent:e,videoElement:t,bestFeatureFootprint:i}=this;if(e&&t?.loaded&&i)return{videoExtent:ve,bestFeatureFootprint:i}},e=>{e?.videoExtent&&e?.bestFeatureFootprint&&(m(this._updateFootprintTask),this._updateFootprintTask=a(async t=>{const i={points:e.videoExtent,feature:void 0,scale:void 0,options:{signal:t}};await this.updateVideoFootprint(i)}))},{...M,equals:(e,t)=>i(e?.videoExtent,t?.videoExtent,h)&&e?.bestFeatureFootprint===t?.bestFeatureFootprint}),Oe.interactionHandles);break;case"panoramic":this.addHandles(b(()=>{const{currentBestFeature:e,state:t,_panoramicViewer:i}=this,{imageSize:r,vfov:a,hfov:s,pitch:o,yaw:n}=i;return e&&r&&!t.includes("loading")&&null!=a&&null!=s&&null!=o&&null!=n?[a,s,n,o]:null},e=>{if(!e||this.state.includes("loading"))return;const[t,i,r,s]=e;this.currentNode&&(this.currentNode.currentHeading=r,this.currentNode.currentPitch=s),m(this._updateFootprintTask),this._updateFootprintTask=a(async e=>{await this.updateFootprintPanorama({verticalFieldOfView:t,horizontalFieldOfView:i,yaw:r,pitch:s},{signal:e}),this._updateFootprintTask=null})},{equals:(e,t)=>i(e,t,h)}),Oe.interactionHandles);break;case"panoramic-video":this.addHandles(b(()=>{const{currentBestFeature:e,state:t,_panoramicVideoViewer:i}=this,{imageSize:r,vfov:a,hfov:s,pitch:o,yaw:n,viewModel:l}=i,c=l.closestFeature??e;return c&&r&&!t.includes("loading")&&null!=a&&null!=s&&null!=o&&null!=n?[a,s,n,o,c]:null},e=>{if(!e)return;const[t,i,r,s,o]=e;m(this._updateFootprintTask),this._updateFootprintTask=a(async e=>{await this.updateFootprintPanorama({verticalFieldOfView:t,horizontalFieldOfView:i,yaw:r,pitch:s,feature:o},{signal:e}),v(e),this._updateFootprintTask=null})},{equals:(e,t)=>i(e,t,h)}),Oe.interactionHandles)}},M),b(()=>[this.brightness,this.contrast,this.sharpness],()=>{const{_imageViewer:e,brightness:t,contrast:i,mode:r,sharpness:a}=this;"default"===r&&(e.brightness=t,e.contrast=i,e.sharpness=a)},M),b(()=>this.activeViewer?.imageRenderer,()=>{this.sketch&&(this.sketch.view=this.activeViewer?.imageRenderer)}),b(()=>this.activeViewer,e=>{this.removeHandles(Oe.hittestHandles),e&&this.addHandles(_(()=>e,"hittest-response",this._handleImageHitTestResponse),Oe.hittestHandles)}),b(()=>[this.videoMapView.scale,this.videoViewModel?.videoScale],async([e,t])=>{const i=this.videoViewModel?.closestFeature;if(!t||!e||!i)return;const r=e/t;m(this._updateFootprintTask),this._updateFootprintTask=a(async e=>{const t={points:ve,feature:i,scale:r,options:{signal:e}};await this.updateVideoFootprint(t)})})]),this.when().finally(()=>{this.notifyChange("state")})}destroy(){this.currentBestFeature=null,this._updateFootprintTask=m(this._updateFootprintTask),this._clickTask=m(this._clickTask),this.coverageFrustums.destroy(),this.coveragePolygons.destroy(),this.pointSources.destroy(),this.additionalFootprints.destroy(),this.additionalCameraLocations.destroy(),this.bestFeatureFootprint=p(this.bestFeatureFootprint),this.bestFeatureCurrentFootprint=p(this.bestFeatureCurrentFootprint),this.videoViewModel=p(this.videoViewModel),this._locationViewModel=p(this._locationViewModel),this._crossSymbol=p(this._crossSymbol),this._referencePointOnGround=p(this._referencePointOnGround),this._referencePointOnImage=p(this._referencePointOnImage),this._overlays&&this.view?.map?.remove(this._overlays),this._overlays.destroy(),this._imageViewer.destroy(),this.imageMeasurementViewer.destroy(),this._panoramicViewer.destroy(),this._panoramicMeasurementViewer.destroy(),this._mediaPrefetcher?.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(){const{_imageViewer:e,_panoramicViewer:t,mode:i}=this;switch(i){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(){return this.layer?.orientationAccuracy?.every(e=>0===e)??!0}get brightness(){return this._get("brightness")??0}set brightness(e){this._set("brightness",u(e,-10,10))}get contrast(){return this._get("contrast")??0}set contrast(e){this._set("contrast",u(e,-10,10))}get currentNode(){const{currentBestFeature:e,navigationNodes:t}=this;return t.find(t=>t.id===e?.attributes.objectId)}get depthImageNotSupported(){if(this.currentBestFeature?.attributes.depthImage)return!Re(this.currentBestFeature.attributes.depthImage)}get featureCount(){return this.features?.length??0}get imageGalleryEnabled(){const{currentBestFeature:e}=this;if(!e)return!1;const t=e.attributes.imagePath?.trim();return Re(t)||Me(t)}get imageLoaded(){return o(d.getLogger(this),"imageLoaded",{replacement:'Use OrientedImageryViewer.state === "image-loaded"',version:"4.29",warnOnce:!0}),"image-loaded"===this.state}get invalidCameraHeading(){return this.currentBestFeature?.attributes?.cameraHeading===fe}get imagePointsInView(){const{mode:e,_imageViewer:t}=this;return"default"===e?t.imagePointsInView:null}get layerView(){const{layer:e,view:t}=this;if(e&&t)return t.allLayerViews.find(He(e))}get layerFloorFilterClause(){const{layerView:e}=this;return e?oe(e):null}get mode(){const e=this.currentBestFeature?.attributes;if(!e)return"none";const t=e.orientedImageryType;if(t?.includes("video"))return t.includes("360")?"panoramic-video":"video";const{horizontalFieldOfView:i,isSpherical:r}=e;return 360===i||r?"panoramic":"default"}get panoramicVideoLoaded(){const{mode:e,_panoramicVideoViewer:t}=this,{videoLoaded:i}=t.viewModel;return("panoramic-video"===e&&!0===i)??!1}get popupEnabled(){return!0===this.layer?.popupEnabled}get referencePoint(){return this._referencePointOnGround?.geometry}get sectorData(){const{_sectorData:e}=this;return e?we.map(t=>e[t]):null}get sharpness(){return this._get("sharpness")??0}set sharpness(e){this._set("sharpness",u(e,0,1))}get sketchGraphicsLayer(){const{sketch:e}=this;return"graphics"===e?.layer?.type?e.layer:void 0}get state(){const{mode:e,_updatingHandles:{updating:t},_featureChangedTask:i}=this;if(!this.isFulfilled()||t||!1===i?.finished)return"loading";if(this.isRejected())return"error";if("error"===this.displayMessage?.type)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"}return"ready"}get thumbnails(){const{features:e}=this;return e?new s(e.map(({attributes:{imagePath:e,objectId:t,cameraRoll:i,imageRotation:r}})=>{const a=e?.trim();return Re(a)||Me(a)?{url:a,objectId:t,rotation:(i??0)+(r??0)}:null}).filter(r)):null}set view(e){this._set("view",e)}get _defaultGraphicsLayer(){const e={blendMode:"source-atop"};switch(this.mode){case"panoramic":return new H({...e,elevationInfo:{mode:"absolute-height"}});case"default":return new H({...e});default:return}}get _overlaysView(){return this.view?.layerViews.find(({layer:e})=>e===this._overlays)}beforeLoad(e=!0){this.emit("popup-close"),e&&(this.displayMessage=null),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=p(this.bestFeatureCurrentFootprint),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=p(this.locationPointOnImage)),this.correctedLocationPointOnImage&&(this.imageMeasurementViewer.removeGraphic(this.correctedLocationPointOnImage),this._panoramicMeasurementViewer.removeGraphic(this.correctedLocationPointOnImage),this.correctedLocationPointOnImage=p(this.correctedLocationPointOnImage))}clearPreviousMeasurements(){this.clearMeasurementGraphics(),this.resetMeasurementData(),this.stopMeasurement()}clearPreviousGroundLocation(){this.groundCoordinates=null,this.groundCoordinatesAccuracy=null,this.pixelCoordinates=null,this.clearLocationPointOnImage()}clearMeasurementGraphics(){this.measurementGraphic&&(this.activeViewer?.removeGraphic(this.measurementGraphic),this.measurementGraphic=null),this.heightGraphic&&(this.activeViewer?.removeGraphic(this.heightGraphic),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){const{sketch:i,dataCaptureLayer:r}=this;if(!i)throw nt();et(r,e,i),await i.create(e,{...t,defaultZ:0})}digitizeDelete(){if(!this.sketch)throw nt();return this.sketch.delete()}digitizeDuplicate(){if(!this.sketch)throw nt();return this.sketch.duplicate()}digitizePlace(e,t){if(!this.sketch)throw nt();return this.sketch.place(e,t)}digitizeRedo(){if(!this.sketch)throw nt();return this.sketch.redo()}digitizeUndo(){if(!this.sketch)throw nt();return this.sketch.undo()}digitizeUpdate(e,t){if(!this.sketch)throw nt();return this.sketch.update(e,t)}filterByFootprints(e,t,i=!1){const r=[],a=[],s=[];return e.forEach(e=>{const{layer:{coveragePercent:o},attributes:n}=e;let l;const{polygon:c,frustum:h}=U(n);if(l=c.clone(),n.isInspection&&(l=q(n)),o&&(l=$(l,o)),i||!t||W(l,t)){s.push(e);const{geometry:t,objectId:i,cameraHeight:o,cameraHeading:l}=n,d=t.clone();d.z=o/Z(t.spatialReference),d.imageID=i,this.pointSources.push(d),l!==fe&&(r.push(c),h&&a.push(h))}}),{features:s,polygons:r,frustums:a}}async deleteDataCaptureFeatures(e){const{dataCaptureLayer:t}=this;if(!t)throw new n("orientedimageryviewer:missing-featurelayer","Data capture layer is not available");return t.queryFeatures({objectIds:e}).then(({features:e})=>t.applyEdits({deleteFeatures:e}))}handleSectorClick(e){if(isNaN(e))return;const t=this._sectorData?.[we[e]],i=t?.at(0);i&&(this.triangularMeasurementActive&&this.currentBestFeature?this._updateImageMeasurementBestFeature(i):this._updateCurrentBestFeature(i))}handleFeatureClick(e){const{sector:t,featureIndexInSector:i}=e;if(isNaN(i))return;const r=this._sectorData?.[t],a=r?.at(i);a&&(this.triangularMeasurementActive&&this.currentBestFeature?this._updateImageMeasurementBestFeature(a):this._updateCurrentBestFeature(a))}load(e){return this.addResolvingPromise(this._loadViewAdapter(e).catch(e=>{if(!y(e))throw e})),this}async loadBestImage(e,t){return this.selectedPoint=K(e),this.beforeLoad(),this._fetchFeaturesWithController(e,t)}async loadHeightMeasurementAdapter(e){if(!this.drawAdapter){const t=import("./adapters/draw/HeightMeasurementAdapter.js"),{default:i}=await t;if(v(e),this.drawAdapter=new i({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){const t=import("../Sketch/SketchViewModel.js"),{default:i}=await t;v(e),this.sketch=new i({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){const t=import("./adapters/sketch/MeasurementAdapter.js"),{default:i}=await t;if(v(e),this.sketchAdapter=new i({viewModel:this,measurementService:this._measurementService}),!this.sketchAdapter.viewModel.isResolved())return}return this.sketchAdapter}async processFeatureResponse(e,t,i){const{features:r}=e;if(this._clearFeatureGeometries(),!this._checkFeatures(r))return;const{features:a,polygons:s,frustums:o}=this.filterByFootprints(r,t,i?.skipFilter);if(!this._checkFeatures(a))return;this.coveragePolygons.addMany(s),this.coverageFrustums.addMany(o);const n=await this.processElevationSample(s,a,i);v(i),await this._updateElevationOfSelectedPointAndLocations(a,t,n),v(i),xe(a,n);let l=a;if(this.layer?.verticalSearchRange&&this.layer.hasZ&&this.verticalFilterEnabled&&(l=De(a,t,this.layer.verticalSearchRange),!l.length))return void this.setMessage("noImageAtElevation","info");const c=this._processSuitableFeatures(l,t);this.updateSuitabilities(c,i?.loadBestImage)}async processFeatureElevation(e,t,i){if(!t)return;const{features:r,polygons:a}=this.filterByFootprints(e,t,!0);if(!r?.length)return;const s=await this.processElevationSample(a,r,i);return v(i),s}async startMeasurement(e,t){this.sketch||await this.loadSketch(t),await this.loadMeasurementAdapter(t);const{sketch:i,sketchAdapter:r,activeViewer:a,mode:s}=this;if(!i||!r||!a||"none"===s)return;if(this.displayNewMeasurementButton=!1,"panoramic"===s&&(i.defaultCreateOptions.defaultZ=0),await i.create(e),"panoramic"===s){const{drawOperation:e}=i.view.activeTool;e.constraintsEnabled=!1,e._set("elevationDrawSurface",null)}const o=this.activeViewer?.imageRenderer.effectiveTheme.accentColor;o&&this.sketch&&(this.sketch.polygonSymbol=Se(o),this.sketch.polylineSymbol="panoramic"===s?Pe:Ae(o,2.5))}async startHeightMeasurement(){this.displayNewMeasurementButton=!1,this.draw??=new ce({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){const{activeViewer:i,currentBestFeature:r,overlayedCameraLocations:a,layer:s,mode:o,state:n,layerFloorFilterClause:l}=this,c=i?.imageSize;if(!c||!r||!s||"default"!==o&&"panoramic"!==o||n.includes("loading"))return;const{polygon:h}=U(r.attributes);if(i.removeManyGraphics(a.toArray()),a.removeAll(),e){const{features:e}=await s.queryFeatures({where:V(`${s.objectIdField} <> ${r.attributes.objectId}`,V(s.definitionExpression,l)),geometry:h,returnGeometry:!0,outFields:[s.objectIdField]}),n=await Promise.all(e.map(async e=>{const{attributes:i,geometry:r}=e,a=await this._transformationService.pointToImageGeometry(r),s="panoramic"===o?Ce():ke();return new t({attributes:i,symbol:s,geometry:a})}));a.addMany(n),i.addManyGraphics(a.toArray())}}overlayGraphicsOnImage(e,t){this.removeOverlayedGraphicsOnImage(e),this.overlayedMapFeatures.set(e,t),this.activeViewer?.addManyGraphics(t.toArray())}async overlayMapFeatures(e,i=!1){const{activeViewer:r,currentBestFeature:a,mode:o,state:n,layer:l}=this,c=r?.imageSize;if(!c||!a||"none"===o||"video"===o||"panoramic-video"===o||n.includes("loading")||!l)return;const{polygon:h}=U(a.attributes);try{const{imageGeometryField:t,oiObjectIdField:i}=tt(e,l.imageGeometryField,l.imageReferenceField);this.imageGeometryField=t.name,this.oiObjectIdField=i.name}catch(m){d.getLogger(this).warn("oriented-imagery-viewer:overlay-map-features",m)}const{features:u}=await e.queryFeatures({geometry:h,returnGeometry:!0,outFields:["*"]}),p=new s(await Promise.all(u.map(async s=>{const n=s.symbol?.clone()??e.renderer?.getSymbol(s)?.clone(),{attributes:l,geometry:h}=s,{imageGeometryField:u,oiObjectIdField:p}=this;if(u&&p&&ot(e,u,p)&&`${l[p]}`==`${a.attributes.objectId}`)try{const t=Ee(r?.media);return it(l,u,e,i,c,o,n,t)}catch(m){d.getLogger(this).warn("oriented-imagery-viewer:overlay-map-features","couldn't create graphic from attributes, geometry will be used",{error:m,feature:s,layer:e,imageGeometryField:this.imageGeometryField,imageReferenceField:this.oiObjectIdField})}const g=await this._transformationService.geometryToImageGeometry(h);return new t({attributes:l,layer:e,symbol:n,geometry:g,visible:e.visible&&i})})));this.overlayGraphicsOnImage(`${e.id}`,p)}getDepthAt(e){const{activeViewer:t,currentBestFeature:i,mode:r,state:a,depthImage:s}=this,o=t?.imageSize;if(!o||!i||"none"===r||a.includes("loading"))return d.getLogger(this).warnOnce("oriented-imagery-viewer:get-depth-at","Load an image to use depth"),null;if(!s?.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;const n=(Array.isArray(e)?e:[e]).map(e=>s.depthAt(e,{width:o[0],height:o[1]})??null);return Array.isArray(e)?n:n[0]}getActiveSectors(){return we.filter(e=>this._sectorData?.[e]?.length)}async plotMapPoint(e){return this.plotReferencePoint(e),this.transformAndPlotReferencePointOnImage({feature:this.currentBestFeature,selectedLocation:e,options:{signal:this._transformController?.signal}})}plotReferencePointOnGround(e){this._referencePointOnGround&&(this._overlays?.remove(this._referencePointOnGround),this._referencePointOnGround.destroy()),null!=e&&(this._referencePointOnGround=new t({geometry:new G({...e.toJSON()}),symbol:Le}),this.view?this._overlays?.add(this._referencePointOnGround):this.emit("plot-ground-point",{data:{point:this._referencePointOnGround?.geometry}}))}plotReferencePointOnImage(e){const{state:i,mode:r,activeViewer:a}=this;if("image-loaded"!==i||!a?.imageSize||"default"!==r&&"panoramic"!==r)return;this.clearReferencePointOnImage();const s=Ee(a.media),o=rt(e,r,a.imageSize,s);this._referencePointOnImage=new t({geometry:o,symbol:"panoramic"===r?Ge.clone():Le.clone()}),a.addGraphic(this._referencePointOnImage,0)}removeAllOverlayMapFeatures(){this.overlayedMapFeatures.forEach(e=>{this._imageViewer.removeManyGraphics(e.toArray())}),this.overlayedMapFeatures.clear()}removeOverlayedGraphicsOnImage(e){const t=this.overlayedMapFeatures.get(e);t?.length&&(this.activeViewer?.removeManyGraphics(t.toArray()),this.overlayedMapFeatures.delete(e))}reset(){const{mode:e}=this;"default"===e||"panoramic"===e?this.resetImage():"video"===e?this.resetVideo():"panoramic-video"===e&&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.clearGraphics()}this._clickTask=m(this._clickTask)}resetVideo(){this.setMessage("onLoadMessage","info"),this.videoViewModel?.resetVideoHandler(),this._overlays?.removeAll(),this.videoViewModel=null,this.featureCache=[],this.currentBestFeature=null}resetVideoPanoramic(){this.setMessage("onLoadMessage","info"),this._overlays?.removeAll(),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(){const{dataCaptureLayer:e,sketchAdapter:t}=this;if(!e||"data-capture"!==t?.type)return;const{pendingGraphics:i,savedGraphics:r}=t,a=i.get(e.id),s=a?.toArray();if(!a||!s?.length)return;const{addFeatureResults:o}=await this.saveDataCaptureFeatures(s),n=o.reduce((t,{objectId:i,globalId:r,error:a},o)=>{const n=s[o],{attributes:l}=n;return a?t.error.push(n):(i&&(l[e.objectIdField]=i),r&&e.globalIdField&&(l[e.globalIdField]=r),t.success.push(n)),t},{success:[],error:[]});r.addMany(n.success),a.removeAll(),a.addMany(n.error)}async saveDataCaptureFeatures(e,t){const{activeViewer:i,currentBestFeature:a,dataCaptureLayer:s,mode:o}=this,l=i?.imageSize;if(!l||!a||"none"===o||"video"===o||"panoramic-video"===o)throw new n("orientedimageryviewer:missing-input","Image size, current best feature and mode are required to save data capture features");if(!s)throw new n("orientedimageryviewer:missing-featurelayer","Data capture layer is not available");const c=await Promise.all(e.map(async e=>{const i=e.clone(),{geometry:r}=i;if(!r)return;const a=r.type,o=s.hasZ,n=s.geometryType,l=a!==n,c=l?await import("./transformers.js"):null,h=c?.default[n],d=l?h?.(r):r;return d&&(i.geometry=await this._transformationService.imageGeometryToMapGeometry(d,t),i.geometry)?(o||at(i.geometry),i):void 0})),h=c.filter(r);return s.applyEdits({addFeatures:h}).then(e=>{const{addFeatureResults:t}=e;let i=0;const r=c.map(e=>{const r=t[i++];return e?r:{error:new n("orientedimageryviewer:save-unsucccessful","Error in saving data capture features"),objectId:null,globalId:null}});return{...e,addFeatureResults:r}})}async searchBestImage(e,t){try{const i=await D(e,t);i&&await this.processFeatureResponse(i,e.point,t)}catch(i){y(i)||(this.setMessage("imageLoadError","error",i.message),d.getLogger(this).error("error occurred while finding best image",i))}}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 startDataCapture(e,t){const i=this.activeViewer?.imageRenderer,{oiObjectIdField:r,currentBestFeature:a}=this;if(!i||!a||!r)return;const{attributes:{objectId:o}}=a,n=this.overlayedMapFeatures.get(e.id)?.toArray()??[],l=[],c=[];for(const s of n)`${s.getAttribute(r)}`==`${o}`?l.push(s):c.push(s);this.overlayGraphicsOnImage(e.id,new s(c)),this.collectionId=e.id;const h=await this.loadSketch(t),d=await this.loadDataCaptureAdapter(t);v(t),h.addGraphics(l),d.savedGraphics.addMany(l);i.ui.find("zoom").visible=!1,i.map.layers.add(this.sketchGraphicsLayer)}async stopDataCapture(e=!1){this.sketch?.cancel(),this.sketchGraphicsLayer?.removeAll(),this.sketchAdapter=p(this.sketchAdapter),this.sketch=p(this.sketch),this.collectionId=null;const{dataCaptureLayer:t}=this,i=this.activeViewer?.imageRenderer;if(!i||i.destroyed)return;i.map.layers.remove(this.sketchGraphicsLayer),e&&t&&await this.overlayMapFeatures(t,!0);const r=i.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,i){const r=this.overlayedMapFeatures.get(e);r&&i&&this._toggleVisiblity(r,t)}toggleSelection(e){const{sketch:t}=this;t&&(t.updateOnGraphicClick=e,t.cancel())}async transformAndPlotReferencePointOnImage(e){const{selectedLocation:t,options:i}=e;let r=!1,a=!1;const s=this.bestFeatureFootprint?.geometry;switch(s?.type){case"polygon":{const e=t.spatialReference.equals(s.spatialReference)?t:await T(t,s.spatialReference);r=s.contains(e);break}case"mesh":{const e=t.spatialReference.equals(s.spatialReference)?t:await T(t,s.spatialReference);a=s.extent.contains(e);break}}if(!r&&!a)return void this.clearReferencePointOnImage();const o=await this._transformationService.pointToPixel(t,i);if(o)return v(i),this.plotReferencePointOnImage(o),{x:o.x,y:o.y};this.clearReferencePointOnImage()}async updateFeatureCache(e,t){const i=await z(e,t);i.features?.length&&(this.featureCache=i.features)}async _fetchFeatures(e,t){const{layer:i,layerFloorFilterClause:r,view:a}=this;if(!a||!i)return;e.x=E(e.x,e.spatialReference);const s=i.spatialReference.equals(e.spatialReference)?e:await T(e,i.spatialReference),o=s.spatialReference.isGeographic?R(s):s,n=V("1=1",V(i.definitionExpression,r)),l=o.spatialReference.isGeographic?1:S(o.spatialReference),c={layerInstanceOrURL:i,point:o,queryParams:{where:n,maximumDistance:i.maximumDistance?i.maximumDistance/l:void 0,timeExtent:a?.timeExtent}};return await this.searchBestImage(c,t)}async _fetchFeaturesWithController(e,t){try{await this._fetchFeatures(e,t)}catch(i){if(y(i))return;this.setMessage("imageLoadError","error"),d.getLogger(this).error("error occurred while fetching features",i)}}_groupFeaturesBySectors(){const{_suitabilities:e,additionalFeatures:t,features:i,invalidCameraHeading:r}=this,a=i.at(0);if(!e||!t||!a||!i||r)return void(this._sectorData=null);this._sectorData={};const o={};this._featureToSector=o;for(const h of we)this._sectorData[h]=new s;const n=e.map((e,t)=>({...e,featureIndex:t}));n.sort((e,t)=>e.trueSuitability-t.trueSuitability);const l=n.map(({distance:e})=>e),c=Math.max(...l);n.forEach(e=>{const{distance:t,angle:r,featureIndex:s}=e,n=t/c*_e[2],l=$e(t,c),h=We(r);if(!this._sectorData)return;const d=_e[3]+n*Math.sin(r*Math.PI/180),u=_e[3]+n*Math.cos(r*Math.PI/180);let p;const m=i.at(s),g=m===a,{cameraPitch:y}=m.attributes,v=y<5;if(g&&v)p=-90;else{const e=d-_e[3],t=u-_e[3],i=t/Math.sqrt(e**2+t**2);let r=180*Math.acos(i)/Math.PI;(e<0&&t<0||e<0&&t>0)&&(r*=-1),p=r}const f=""===l?h:`${l}_${h}`;g&&(p===this.bestFeatureAngle?this.previousFeatureAngle=p:this.bestFeatureAngle=p,this.navigatorCurrentBestFeature=v?null:{x:d,y:u,direction:h}),o[`${m.attributes.objectId}`]=f;const w=this._sectorData[f];w.add({angle:r,featureIndex:s,x:d,y:u,objectID:m.attributes.objectId,sector:f,featureIndexInSector:w.length})})}async _initializeLocationViewModel(e){if(!this._locationViewModel){const t=import("./components/ImageLocationViewModel.js"),{default:i}=await t;v(e),this._locationViewModel=new i({oiViewModel:this,referenceTransformationService:this._referenceTransformationService})}}_initializeMeasurementService(){this._measurementService||(this._measurementService=new Ye({transformationService:this._transformationService,referenceTransformationService:this._referenceTransformationService}))}_initializeVideo(){if(this.videoElement||!this.currentBestFeature)return;this.removeHandles(Oe.videoPlayerHandles),this.videoElement=new ne({video:this.currentBestFeature.attributes.imagePath,georeference:new se({extent:new L(Fe)}),autoplay:!1}),this.videoElement.content?.loop&&(this.videoElement.content.loop=!1);const e=new x({source:this.videoElement,title:this.layer?.title,copyright:this.layer?.copyright});this.videoLayer=e,e&&this.videoMapView.map.layers.add(e),this.videoViewModel=new Ke({oiViewModel:this})}async getMapPoint(e,t){const i=await this._transformationService.pixelToMapPoint(Array.isArray(e)?e:[e],t);return Array.isArray(e)?i:i[0]}async getMapPointForFeature(e,t,i){const r=await this._transformationService.pixelToMapPointForFeature(Array.isArray(e)?e:[e],t,i);return Array.isArray(e)?r:r[0]}async loadPanoramicMediaSource(e,t){const{lookAt:i,...r}=e,a=ze(r);try{await a.load(t)}catch(o){if(y(o))return;if("unsupported-format"===o.name)return void this.setMessage("unsupportedPanoramicImageryError","error",void 0,{datasetFormat:a?.extension??"UNKNOWN FORMAT"})}const s=this.triangularMeasurementActive?this._panoramicMeasurementViewer:this._panoramicViewer;await s.loadMedia(a,t),i&&s.set(i)}async loadMediaSource(e,t){const i=Ne(e);await this._setImageSource(this.triangularMeasurementActive?this.imageMeasurementViewer:this._imageViewer,i,t)}_clearFeatureGeometries(){this.coveragePolygons.removeAll(),this.coverageFrustums.removeAll(),this.pointSources.removeAll()}_checkFeatures(e){return!!e?.length||(this.setMessage("noImageError","error"),this.videoElement?.content?.pause(),this.currentBestFeature=null,!1)}async _getElevationSampleFromGround(e,t,i){if(!e[0])return;const r=(await import("../../geometry/operators/unionOperator.js")).executeMany(e);if(this._updateFootprintWithFeatures(t,r),"3d"===this.view?.type)try{return await this.view.map.ground.createElevationSampler(this.footprintExtent,i)}catch(a){y(a)||d.getLogger(this).error(a)}}async processElevationSample(e,t,i){const{elevationSource:r}=t[0].attributes,a=await this._getElevationSampleFromGround(e,t,i);return a||(r&&this.footprintExtent&&J(r)?await X({extent:this.footprintExtent,lod:r.lod,url:r.url,rasterFunction:r.rasterFunction}):void 0)}_processSuitableFeatures(e,t){return N({features:e,selectedPoint:t,camera:Ue(this.view)?this.view.camera:null,currentImage:this.currentBestFeature})}async _processHitTestResults(e,t,i){const{results:[r]}=t;if("graphic"!==r?.type)return void this.setMessage("noImageError","error");const a=r.graphic.getAttribute(e.objectIdField);return await this.showImageByObjectId(a,i)}async _queryAndLoadByObjectId(e,t,i,r){this.displayMessage=null;const{response:a}=await Xe(e,t,i,r);if(v(r),!a?.features?.length)throw new Qe(t);const s=U(a.features[0].attributes).polygon,o=G.fromJSON(O(s)),n=K(o),l=S(n.spatialReference);this.selectedPoint=n;const c={layerInstanceOrURL:e,point:n,queryParams:{where:V(V("1=1",V(e.definitionExpression,i)),`${e.objectIdField} <> ${t}`),maximumDistance:e.maximumDistance?e.maximumDistance/l:void 0}},h=await D(c,r);v(r);const{features:d}=h;return d.push(a.features[0]),await this.processFeatureResponse(h,n,{...r,loadBestImage:!1})}_reorderTriangularSketchLayer(){const e=this.imageMeasurementViewer.imageRenderer.map.layers?.length;this.sketchTriangularGraphicsLayer&&e&&this.imageMeasurementViewer.imageRenderer.map.layers.reorder(this.sketchTriangularGraphicsLayer,e-1)}async _setImageSource(e,t,i){e.media=t,await e.loadMedia(t,i)}_toggleVisiblity(e,t){e.forEach(e=>{e.visible=t})}async _updateElevationOfSelectedPointAndLocations(e,t,i,r){const{location:a,cameraHeight:s}=e[0].attributes,o=await ie(a.spatialReference,a.z,s,{elevationSample:i,elevationSource:i?void 0:e[0].attributes.elevationSource,extent:this.footprintExtent},r);v(r);const[n,...l]=await Q([t,...e.map(e=>e.attributes.geometry.clone())],o);v(r),t.elevation=n.z,e.forEach((e,t)=>{e.attributes.elevation=l[t].z})}_updateFeatures(e,t=!0){if(!e.length)return this.currentBestFeature=null,void this.additionalFeatures.removeAll();this.features.removeAll(),this.features.addMany(e),this.navigationNodes.removeAll(),this.navigationNodes.addMany(e.map(e=>{const{geometry:t,attributes:i}=e,{isSpherical:r,cameraHeading:a,cameraPitch:s}=i;return new Ze({geometry:t,attributes:i,currentHeading:r?0:a,currentPitch:r?0:s})})),e.length>1?this.additionalFeatures.addMany(e.slice(1)):this.additionalFeatures.removeAll(),this._updateGroundElevation=!0,t&&(this.currentBestFeature=e[0]),"video"===this.mode&&(this._initializeVideo(),this.videoElement?.loaded&&this.videoViewModel?.playVideoFromSelectedLocation(e[0])),"panoramic-video"===this.mode&&this._loadVideo()}_updateFootprintWithFeatures(e,t){const i=[];for(const{attributes:{geometry:r}}of e)t.contains(r)||i.push([r.x,r.y]);i.sort((e,t)=>+B([e,t])),t.addRing(i),this.footprintExtent=he(t.extent,2,2)}async _updatePointsAndPolygons(e){const{pointSources:i,currentBestFeature:r,currentCoverageVisible:a,isAdditionalPointSourcesVisible:s,mode:o,layer:n}=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(const o of i){const i=this.view&&!this.view.spatialReference?.equals(o.spatialReference)?await T(o.clone(),this.view?.spatialReference,e):o.clone();o.imageID===r.attributes.objectId?this.currentBestFeatureLocation=new t({attributes:{imageID:o.imageID},geometry:i,symbol:Te,visible:a}):this.additionalCameraLocations.push(new t({attributes:{imageID:o.imageID},geometry:i,symbol:je,visible:s}))}"video"!==o&&"panoramic-video"!==o||(await this.initializeTransformationService(e),n&&!this.featureCache.length&&await this.updateFeatureCache(n,r.geometry.spatialReference))}}_updateCurrentBestFeature(e){if(!e)return;if(this.currentBestFeature=this.features?.at(e.featureIndex),"video"===this.mode)return void(this.currentBestFeature&&this.videoViewModel?.playVideoFromSelectedLocation(this.currentBestFeature));if("panoramic-video"===this.mode)return void(this.currentBestFeature&&this._panoramicVideoViewer.viewModel.playPanoramicVideoFromSelectedLocation(this.currentBestFeature));const t=this.currentBestFeature?.attributes.cameraPitch&&this.currentBestFeature?.attributes.cameraPitch<5;let i;if(t)i=-90;else{const t=e.x-_e[3],r=e.y-_e[3],a=r/Math.sqrt(t**2+r**2);let s=180*Math.acos(a)/Math.PI;(t<0&&r<0||t<0&&r>0)&&(s*=-1),i=s}i===this.bestFeatureAngle?this.previousFeatureAngle=i:this.bestFeatureAngle=i,this.navigatorCurrentBestFeature=t?null:{x:e.x,y:e.y,direction:e.sector.includes("_")?e.sector.split("_")[1]:e.sector}}_updateImageMeasurementBestFeature(e){e&&(this.currentBestFeatureMeasurementImage=this.features?.at(e.featureIndex))}clearGraphics(){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._referencePointOnImage=p(this._referencePointOnImage))}async initializeReferenceTransformationService(e){const{currentBestFeatureMeasurementImage:t,activeTriangulatedViewer:i,mode:r}=this;if(!t||!i||!i.imageSize||"panoramic"!==r&&"default"!==r)return;const{imageSize:a}=i,{attributes:s,elevationSample:o}=t,{location:{spatialReference:n,z:l},cameraHeight:c,elevationSource:h}=s;let d=s.location;d.spatialReference.isGeographic&&(d=K(d));const u="default"===r?re(s,a[0],a[1]):ae(s,a[0],a[1]),p=await ie(n,l??0,c,{elevationSample:o,elevationSource:h,extent:this.footprintExtent},e),m=(await import("./services/TransformationService.js")).default,g={imageToWorldProperties:u,updateElevationProps:p,mode:r,imageSize:a,depthImageService:this.depthImage};this._referenceTransformationService=new m(g),this._locationViewModel&&(this._locationViewModel.referenceTransformationService=this._referenceTransformationService),this._measurementService&&(this._measurementService.referenceTransformationService=this._referenceTransformationService)}async initializeTransformationService(e){const{currentBestFeature:t,activeViewer:i,mode:r}=this,a="video"===r||"panoramic-video"===r?be:i?.imageSize;if(!t||!a||"none"===r)return;const{attributes:s,elevationSample:o}=t,{location:{spatialReference:n,z:l},cameraHeight:c,elevationSource:h}=s;let d=s.location;d.spatialReference.isGeographic&&(d=K(d));const u="default"===r||"video"===r?"default":"panoramic",p={..."default"===u?re(s,a[0],a[1]):ae(s,a[0],a[1]),cameraLocation:d},m=await ie(n,l??0,c,{elevationSample:o,elevationSource:h,extent:this.footprintExtent},e),g=(await import("./services/TransformationService.js")).default,y={imageToWorldProperties:p,updateElevationProps:m,mode:u,imageSize:a,depthImageService:this.depthImage};this._transformationService=new g(y),this._measurementService&&(this._measurementService.transformationService=this._transformationService)}plotReferencePoint(e){"mapPoint"in e?this.plotReferencePointOnGround(e.mapPoint):this.plotReferencePointOnGround(e)}setMessage(e,t,i,r){this.displayMessage={key:e,type:t,data:i,map:r}}async transformAndPlotSelectedLocation(e){const{currentBestFeature:t,invalidCameraHeading:i,selectedPoint:r,activeViewer:a}=this;if(this._crossSymbol&&(this._panoramicViewer.removeGraphic(this._crossSymbol),this._imageViewer.removeGraphic(this._crossSymbol),this._crossSymbol=p(this._crossSymbol)),!r||!t||"image-loaded"!==a?.state||i)return;let s;try{s=await this._transformationService.pointToPixel(r,{signal:e?.signal}),v(e),await this.plotSelectedPointOnImage(s,e)}catch(o){y(o)||d.getLogger(this).error("failed to transform map point to pixel, cross symbol will not be plotted on image",{error:o,selectedPoint:r,feature:t})}}updateCurrentCoveragePolygon(e){const{additionalFootprints:i,additionalCameraLocations:r,currentBestFeature:a,currentBestFeatureLocation:s,currentCoverageVisible:o,selectedPoint:n,view:l,_adapter:c,mode:h}=this;if(!a)return;const{attributes:{objectId:d},elevationSample:u}=a;if(this._initialCurrentCoverageUpdate){if(this._overlays?.removeAll(),this._initialCurrentCoverageUpdate=!1,this.bestFeatureCurrentFootprint=p(this.bestFeatureCurrentFootprint),e&&!this.invalidCameraHeading&&(e.visible=o,this.bestFeatureCurrentFootprint=e),l){const e=[...i,...r,s].filter(qe);"3d"===l?.type&&u&&c?.updateGroundElevation&&(this._updateGroundElevation&&c.updateGroundElevation(e),"panoramic"===h&&c.updateGroundElevation([this.bestFeatureCurrentFootprint])),this._updateGroundElevation=!1,n&&(e.splice(-2,0,this.bestFeatureCurrentFootprint),e.push(new t({geometry:n.clone(),symbol:Ie.clone(),attributes:{imageID:d}}))),this._overlays.graphics.addMany(e)}}else if(l){if(this.invalidCameraHeading)return;this.bestFeatureCurrentFootprint&&(this._overlays?.remove(this.bestFeatureCurrentFootprint),this.bestFeatureCurrentFootprint=p(this.bestFeatureCurrentFootprint));const t=this.bestFeatureCurrentFootprint&&this._overlays?this._overlays.graphics.indexOf(this.bestFeatureCurrentFootprint):-1;e&&(this.bestFeatureCurrentFootprint=e,"3d"===l?.type&&u&&c?.updateGroundElevation&&"panoramic"===h&&c.updateGroundElevation([e]),e.visible=this.currentCoverageVisible,this._overlays?.graphics.add(this.bestFeatureCurrentFootprint,t>=0?t:this._overlays.graphics.length-1))}}};e([P()],lt.prototype,"activeLayer",null),e([P({readOnly:!0})],lt.prototype,"activeViewer",null),e([P()],lt.prototype,"activeTriangulatedViewer",null),e([P()],lt.prototype,"accuracyParametersMissing",null),e([P()],lt.prototype,"additionalFeatures",void 0),e([P({type:s.ofType(t)})],lt.prototype,"additionalCameraLocations",void 0),e([P({type:s.ofType(t)})],lt.prototype,"additionalFootprints",void 0),e([P()],lt.prototype,"areaMeasurementResult",void 0),e([P()],lt.prototype,"areaMeasurementAccuracy",void 0),e([P()],lt.prototype,"bestFeatureAngle",void 0),e([P()],lt.prototype,"bestFeatureCurrentFootprint",void 0),e([P({type:t})],lt.prototype,"bestFeatureFootprint",void 0),e([P({type:Number})],lt.prototype,"brightness",null),e([P()],lt.prototype,"cameraHeadingThreshold",void 0),e([P()],lt.prototype,"cameraPitchThreshold",void 0),e([P()],lt.prototype,"clickAction",void 0),e([P()],lt.prototype,"correctedLocationPointOnImage",void 0),e([P()],lt.prototype,"videoViewModel",void 0),e([P()],lt.prototype,"collectionId",void 0),e([P({type:Number})],lt.prototype,"contrast",null),e([P()],lt.prototype,"coverageFrustums",void 0),e([P()],lt.prototype,"coveragePolygons",void 0),e([P()],lt.prototype,"currentBestFeature",void 0),e([P()],lt.prototype,"currentBestFeatureMeasurementImage",void 0),e([P()],lt.prototype,"currentBestFeatureLocation",void 0),e([P()],lt.prototype,"currentCoverageVisible",void 0),e([P()],lt.prototype,"currentNode",null),e([P()],lt.prototype,"depthImage",void 0),e([P()],lt.prototype,"depthImageNotSupported",null),e([P()],lt.prototype,"featureCache",void 0),e([P()],lt.prototype,"navigationNodes",void 0),e([P({json:{write:!1}})],lt.prototype,"determineWorkflowForFeature",void 0),e([P({json:{write:!1}})],lt.prototype,"determineWorkflowForTriangularMeasurement",void 0),e([P()],lt.prototype,"disabled",void 0),e([P()],lt.prototype,"displayMessage",void 0),e([P()],lt.prototype,"displayNewMeasurementButton",void 0),e([P()],lt.prototype,"distanceMeasurementResult",void 0),e([P()],lt.prototype,"distanceAccuracyArray",void 0),e([P()],lt.prototype,"dataCaptureLayer",void 0),e([P({readOnly:!0})],lt.prototype,"featureCount",null),e([P()],lt.prototype,"features",void 0),e([P()],lt.prototype,"groundCoordinates",void 0),e([P()],lt.prototype,"groundCoordinatesAccuracy",void 0),e([P()],lt.prototype,"heightGraphic",void 0),e([P()],lt.prototype,"heightMeasurementResult",void 0),e([P()],lt.prototype,"heightMeasurementAccuracy",void 0),e([P({readOnly:!0})],lt.prototype,"imageGalleryEnabled",null),e([P()],lt.prototype,"imageGeometryField",void 0),e([P({readOnly:!0})],lt.prototype,"imageLoaded",null),e([P()],lt.prototype,"imageLocationToolState",void 0),e([P({readOnly:!0})],lt.prototype,"invalidCameraHeading",null),e([P()],lt.prototype,"imagePointsInView",null),e([P()],lt.prototype,"imageMeasurementViewer",void 0),e([P()],lt.prototype,"isAdditionalCoverageVisible",void 0),e([P()],lt.prototype,"isAdditionalPointSourcesVisible",void 0),e([P()],lt.prototype,"layer",void 0),e([P()],lt.prototype,"layerView",null),e([P({readOnly:!0})],lt.prototype,"layerFloorFilterClause",null),e([P({type:Number})],lt.prototype,"localPort",void 0),e([P()],lt.prototype,"locationPointOnImage",void 0),e([P()],lt.prototype,"mapImageConversionToolState",void 0),e([P()],lt.prototype,"measureType",void 0),e([P()],lt.prototype,"measurementGraphic",void 0),e([P({readOnly:!0,value:"none"})],lt.prototype,"mode",null),e([P()],lt.prototype,"navigationMode",void 0),e([P()],lt.prototype,"navigatorCurrentBestFeature",void 0),e([P()],lt.prototype,"oiObjectIdField",void 0),e([P({type:s.ofType(t)})],lt.prototype,"overlayedCameraLocations",void 0),e([P()],lt.prototype,"overlayedMapFeatures",void 0),e([P()],lt.prototype,"panoramicVideoLoaded",null),e([P()],lt.prototype,"pixelCoordinates",void 0),e([P()],lt.prototype,"preserveAngle",void 0),e([P()],lt.prototype,"pointSources",void 0),e([P({readOnly:!0})],lt.prototype,"popupEnabled",null),e([P()],lt.prototype,"preloadMedia",void 0),e([P()],lt.prototype,"preloadMediaSize",void 0),e([P()],lt.prototype,"previousFeatureAngle",void 0),e([P()],lt.prototype,"referencePoint",null),e([P({readOnly:!0})],lt.prototype,"sectorData",null),e([P()],lt.prototype,"selectedPoint",void 0),e([P({type:Number})],lt.prototype,"sharpness",null),e([P()],lt.prototype,"shouldShowSelectedImage",void 0),e([P()],lt.prototype,"sketch",void 0),e([P()],lt.prototype,"sketchTriangular",void 0),e([P()],lt.prototype,"sketchTriangularGraphicsLayer",void 0),e([P()],lt.prototype,"draw",void 0),e([P()],lt.prototype,"drawAdapter",void 0),e([P()],lt.prototype,"polylineDrawAction",void 0),e([P()],lt.prototype,"sketchAdapter",void 0),e([P({readOnly:!0})],lt.prototype,"sketchGraphicsLayer",null),e([P({readOnly:!0})],lt.prototype,"state",null),e([P({readOnly:!0})],lt.prototype,"thumbnails",null),e([P()],lt.prototype,"triangularMeasurementActive",void 0),e([P()],lt.prototype,"triangulatedDistanceMeasurement",void 0),e([P()],lt.prototype,"triangulatedDistanceAccuracy",void 0),e([P()],lt.prototype,"triangulatedAreaMeasurement",void 0),e([P()],lt.prototype,"triangulatedAreaAccuracy",void 0),e([P()],lt.prototype,"triangulatedMeasurementGraphic",void 0),e([P()],lt.prototype,"triangulatedPoint",void 0),e([P()],lt.prototype,"triangulatedMeasurementAdapter",void 0),e([P()],lt.prototype,"updateFootprint",void 0),e([P()],lt.prototype,"updateVideoFootprint",void 0),e([P()],lt.prototype,"updateFootprintPanorama",void 0),e([P()],lt.prototype,"updatingTriangularMeasurementState",void 0),e([P({value:null})],lt.prototype,"view",null),e([P()],lt.prototype,"videoElement",void 0),e([P()],lt.prototype,"videoLayer",void 0),e([P()],lt.prototype,"videoMapView",void 0),e([P()],lt.prototype,"verticalFilterEnabled",void 0),e([P()],lt.prototype,"_adapter",void 0),e([P()],lt.prototype,"_defaultGraphicsLayer",null),e([P()],lt.prototype,"_highlightedFeatureHandle",void 0),e([P()],lt.prototype,"_imageViewer",void 0),e([P()],lt.prototype,"_initialCurrentCoverageUpdate",void 0),e([P()],lt.prototype,"_locationViewModel",void 0),e([P()],lt.prototype,"_measurementService",void 0),e([P()],lt.prototype,"_mediaPrefetcher",void 0),e([P()],lt.prototype,"_navigationManager",void 0),e([P()],lt.prototype,"_overlays",void 0),e([P({readOnly:!0})],lt.prototype,"_overlaysView",null),e([P()],lt.prototype,"_panoramicVideoViewer",void 0),e([P()],lt.prototype,"_panoramicViewer",void 0),e([P()],lt.prototype,"_panoramicMeasurementViewer",void 0),e([P()],lt.prototype,"_referencePointOnGround",void 0),e([P()],lt.prototype,"_referencePointOnImage",void 0),e([P()],lt.prototype,"_referenceTransformationService",void 0),e([P()],lt.prototype,"_sectorData",void 0),e([P()],lt.prototype,"_transformationService",void 0),e([P()],lt.prototype,"_featureToSector",void 0),e([P({readOnly:!0})],lt.prototype,"_updatingHandles",void 0),e([P()],lt.prototype,"footprintExtent",void 0),e([P()],lt.prototype,"_featureChangedTask",void 0),lt=e([A("esri.widgets.OrientedImageryViewer.OrientedImageryViewerViewModel")],lt);const ct=lt;export{ct as default};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import t from"../../../../core/Accessor.js";import i from"../../../../core/Collection.js";import r from"../../../../core/ReactiveMap.js";import{property as a,subclass as o}from"../../../../core/accessorSupport/decorators.js";import{SketchHandlerMixin as s}from"../../mixins/SketchHandlerMixin.js";import{mapSpaceToImageSpace as c}from"../../support/dataCaptureUtils.js";let p=class extends(s(t)){constructor(e){super(e),this.savedGraphics=new i,this.type="data-capture",this.pendingGraphics=new r}get collectionId(){return this.viewModel.collectionId}handleCreate(e){const{state:t,graphic:i,tool:r}=e,a=i?.geometry;if("complete"!==t||!i||!a)return;const{collectionId:o,viewModel:{dataCaptureLayer:s,currentBestFeature:c,imageGeometryField:p,oiObjectIdField:n,activeViewer:l,mode:h},pendingGraphics:u}=this,m=l?.imageSize;c&&p&&o&&n&&s&&m&&"none"!==h&&"video"!==h&&"panoramic-video"!==h&&(d(i,a,p,n,c,u,o,m,h,s),this.viewModel.emit("after-data-capture-complete",{pendingGraphics:u.get(o)?.toArray()??null}),this.viewModel.sketch?.create(r))}handleDelete(e){const{dataCaptureLayer:t}=this.viewModel;if(!t)return;const{graphics:i}=e;this.pendingGraphics.get(t.id)?.removeMany(i),this.savedGraphics.removeMany(i),this.viewModel.deleteDataCaptureFeatures(n(i,t.objectIdField))}handleDestroy(){const{dataCaptureLayer:e}=this.viewModel;e&&(this.viewModel.stopDataCapture(),this.savedGraphics.removeAll(),this.pendingGraphics=null)}handleUpdate(e){const{toolEventInfo:t,state:i,graphics:r}=e;if(t)this.viewModel.sketch?.undo();else switch(i){case"complete":this.viewModel.emit("deselect-data-capture-features",{graphics:r});break;case"start":this.viewModel.emit("select-data-capture-features",{graphics:r})}}};function d(e,t,r,a,o,s,p,d,n,l){e.origin=l,e.attributes=e.attributes??{},e.attributes[r]=btoa(JSON.stringify({geometry:c(t.clone(),n,d).toJSON()})),e.attributes[a]=o.attributes.objectId,s.has(p)||s.set(p,new i);s.get(p).add(e)}function n(e,t){return e.map(({attributes:e})=>t?e[t]:null).filter(Boolean)}e([a()],p.prototype,"collectionId",null),e([a()],p.prototype,"savedGraphics",void 0),e([a()],p.prototype,"type",void 0),e([a()],p.prototype,"pendingGraphics",void 0),p=e([o("esri.widgets.OrientedImageryViewer.adapters.sketch.DataCaptureAdapter")],p);const l=p;export{l as default};
2
+ import{__decorate as e}from"tslib";import t from"../../../../core/Accessor.js";import i from"../../../../core/Collection.js";import r from"../../../../core/ReactiveMap.js";import{property as a,subclass as o}from"../../../../core/accessorSupport/decorators.js";import{extractHorizonAnglesFromMedia as s}from"../../utils.js";import{SketchHandlerMixin as c}from"../../mixins/SketchHandlerMixin.js";import{mapSpaceToImageSpace as p}from"../../support/dataCaptureUtils.js";let d=class extends(c(t)){constructor(e){super(e),this.savedGraphics=new i,this.type="data-capture",this.pendingGraphics=new r}get collectionId(){return this.viewModel.collectionId}handleCreate(e){const{state:t,graphic:i,tool:r}=e,a=i?.geometry;if("complete"!==t||!i||!a)return;const{collectionId:o,viewModel:{dataCaptureLayer:c,currentBestFeature:p,imageGeometryField:d,oiObjectIdField:l,activeViewer:h,mode:u},pendingGraphics:m}=this,g=h?.imageSize,v=h?.media;if(!(p&&d&&o&&l&&c&&g&&("default"===u||"panoramic"===u)))return;n(i,a,d,l,p,m,o,g,u,c,s(v)),this.viewModel.emit("after-data-capture-complete",{pendingGraphics:m.get(o)?.toArray()??null}),this.viewModel.sketch?.create(r)}handleDelete(e){const{dataCaptureLayer:t}=this.viewModel;if(!t)return;const{graphics:i}=e;this.pendingGraphics.get(t.id)?.removeMany(i),this.savedGraphics.removeMany(i),this.viewModel.deleteDataCaptureFeatures(l(i,t.objectIdField))}handleDestroy(){const{dataCaptureLayer:e}=this.viewModel;e&&(this.viewModel.stopDataCapture(),this.savedGraphics.removeAll(),this.pendingGraphics=null)}handleUpdate(e){const{toolEventInfo:t,state:i,graphics:r}=e;if(t)this.viewModel.sketch?.undo();else switch(i){case"complete":this.viewModel.emit("deselect-data-capture-features",{graphics:r});break;case"start":this.viewModel.emit("select-data-capture-features",{graphics:r})}}};function n(e,t,r,a,o,s,c,d,n,l,h){e.origin=l?.graphicOrigin??l,e.attributes=e.attributes??{},e.attributes[r]=btoa(JSON.stringify({geometry:p(t.clone(),n,d,h).toJSON()})),e.attributes[a]=o.attributes.objectId,s.has(c)||s.set(c,new i);s.get(c).add(e)}function l(e,t){return e.map(({attributes:e})=>t?e[t]:null).filter(Boolean)}e([a()],d.prototype,"collectionId",null),e([a()],d.prototype,"savedGraphics",void 0),e([a()],d.prototype,"type",void 0),e([a()],d.prototype,"pendingGraphics",void 0),d=e([o("esri.widgets.OrientedImageryViewer.adapters.sketch.DataCaptureAdapter")],d);const h=d;export{h as default};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import e from"../../../../Graphic.js";import{isSome as t}from"../../../../core/arrayUtils.js";import i from"../../../../core/Logger.js";import{waitTick as o,throwIfAborted as r,isAbortError as a}from"../../../../core/promiseUtils.js";import s from"../../../../geometry/Polygon.js";import{projectAsync as n}from"../../../../geometry/projectionUtils.js";import{e as l}from"../../../../chunks/centroidOperator.js";import{convertOrientationToPixelLocation as p}from"../../../../layers/orientedImagery/transformations/utils.js";import{fixedImageSize as c}from"../../constants.js";import{activePolygonSymbol as u,polygonSymbol as d}from"../../symbols.js";class g{constructor(g){this.viewModel=g,this.createFootprints=async t=>{await o(t);const{coveragePolygons:i,currentBestFeature:r,isAdditionalCoverageVisible:a}=this.viewModel;for(const o of i)o?.imageID===r.attributes.objectId?this.viewModel.bestFeatureFootprint=new e({attributes:{imageID:o?.imageID},geometry:o,symbol:u,visible:!1}):this.viewModel.additionalFootprints.push(new e({attributes:{imageID:o?.imageID},geometry:o,symbol:d.clone(),visible:a}))},this.updateFootprint=async(o,l,p)=>{const{activeViewer:d,mode:g,currentBestFeature:m,currentCoverageVisible:v,footprintExtent:f}=this.viewModel,w=l??m;if(m&&("video"===g?c:d?.imageSize)&&f&&w)try{const i=await this.viewModel.getMapPoint(o);r(p);const a=i.filter(t);if(!a.length)return;const l=[a.map(({x:e,y:t})=>[e,t,1])];l[0].push(l[0][0]);const c=new s({rings:l,spatialReference:a[0].spatialReference}),d=this.viewModel.view?.spatialReference.equals(c.spatialReference)?c:await n(c,this.viewModel.view.spatialReference,p);this.viewModel.updateCurrentCoveragePolygon(new e({geometry:d,attributes:{imageID:w.attributes.objectId},symbol:u,visible:v}))}catch(h){a(h)||i.getLogger(this.viewModel).error("update-footprint",h)}else this.viewModel.updateCurrentCoveragePolygon(null)},this.updateVideoFootprint=async o=>{const{points:p,feature:d,scale:g,options:m}=o,{activeViewer:v,mode:f,currentBestFeature:w,currentCoverageVisible:h,footprintExtent:y}=this.viewModel,M="video"===f?c:v?.imageSize,b=d??w;if(w&&M&&y&&b&&"none"!==f)try{const i={feature:b,mode:f,imageSize:M,footprintExtent:y},o=await this.viewModel.getMapPointForFeature(p,i,m);r(m);const a=o.filter(t);if(!a.length)return;const c=[a.map(({x:e,y:t})=>[e,t,1])];c[0].push(c[0][0]);let d=new s({rings:c,spatialReference:a[0].spatialReference});if(g){const e=d.spatialReference,t=l(d),i=d.rings.map(e=>e.map(([e,i])=>[t.x+(e-t.x)*g,t.y+(i-t.y)*g]));d=new s({rings:i,spatialReference:e})}const v=this.viewModel.view?.spatialReference.equals(d.spatialReference)?d:await n(d,this.viewModel.view.spatialReference,m);this.viewModel.updateCurrentCoveragePolygon(new e({geometry:v,attributes:{imageID:b.attributes.objectId},symbol:u,visible:h}))}catch(C){a(C)||i.getLogger(this.viewModel).error("update-footprint",C)}else this.viewModel.updateCurrentCoveragePolygon(null)},this.updateFootprintPanorama=async(t,i)=>{const{horizontalFieldOfView:o,pitch:a,verticalFieldOfView:l,yaw:d,feature:g}=t,{activeViewer:m,currentBestFeature:v,currentCoverageVisible:f,footprintExtent:w,mode:h}=this.viewModel,y="video"===h||"panoramic-video"===h?c:m?.imageSize,M=g??v;if(!M||!y||!w||"none"===h)return void this.viewModel.updateCurrentCoveragePolygon(null);const{cameraPitch:b,objectId:C}=M.attributes;if(a+b-l/2>180)return void this.viewModel.updateCurrentCoveragePolygon(null);const F=[],R=l/2,P=o/2,j=a-R,I=b+j,x=b+(a+R);if(I>180)return void this.viewModel.updateCurrentCoveragePolygon(null);const V=j<0,D=[-P,R],z=[P,R],E=[P,-R],S=[-P,-R];if(I<180&&x>180){F.push(V?E:S);const e=Math.floor(o/5),t=o/e;for(let i=0;i<=e;i++)F.push([i*t-P,90-a]);F.push(V?S:E)}x<180&&(F.push(D,z),V?F.push(S,E):F.push(E,S));const B=F.map(([e,t])=>p(d+e,a+t,y[0],y[1])),q={feature:M,mode:h,imageSize:y,footprintExtent:w},L=g?await this.viewModel.getMapPointForFeature(B,q):await this.viewModel.getMapPoint(B);r(i);const O=[L.map(({x:e,y:t})=>[e,t,1])];O[0].push(O[0][0]);const U=new s({rings:O,spatialReference:L[0].spatialReference}),k=this.viewModel.view?.spatialReference.equals(U.spatialReference)?U:await n(U,this.viewModel.view.spatialReference,i);this.viewModel.updateCurrentCoveragePolygon(new e({geometry:k,attributes:{imageID:C},symbol:u.clone(),visible:f}))}}}export{g as default};
2
+ import e from"../../../../Graphic.js";import{isSome as t}from"../../../../core/arrayUtils.js";import i from"../../../../core/Logger.js";import{waitTick as o,throwIfAborted as r,isAbortError as a}from"../../../../core/promiseUtils.js";import s from"../../../../geometry/Polygon.js";import{projectAsync as n}from"../../../../geometry/projectionUtils.js";import{e as l}from"../../../../chunks/centroidOperator.js";import{adjustHorizonAngles as p,convertOrientationToPixelLocation as c}from"../../../../layers/orientedImagery/transformations/utils.js";import{fixedImageSize as u}from"../../constants.js";import{activePolygonSymbol as d,polygonSymbol as m}from"../../symbols.js";import{extractHorizonAnglesFromMedia as g}from"../../utils.js";class v{constructor(v){this.viewModel=v,this.createFootprints=async t=>{await o(t);const{coveragePolygons:i,currentBestFeature:r,isAdditionalCoverageVisible:a}=this.viewModel;for(const o of i)o?.imageID===r.attributes.objectId?this.viewModel.bestFeatureFootprint=new e({attributes:{imageID:o?.imageID},geometry:o,symbol:d,visible:!1}):this.viewModel.additionalFootprints.push(new e({attributes:{imageID:o?.imageID},geometry:o,symbol:m.clone(),visible:a}))},this.updateFootprint=async(o,l,p)=>{const{activeViewer:c,mode:m,currentBestFeature:g,currentCoverageVisible:v,footprintExtent:f}=this.viewModel,w=l??g;if(g&&("video"===m?u:c?.imageSize)&&f&&w)try{const i=await this.viewModel.getMapPoint(o);r(p);const a=i.filter(t);if(!a.length)return;const l=[a.map(({x:e,y:t})=>[e,t,1])];l[0].push(l[0][0]);const c=new s({rings:l,spatialReference:a[0].spatialReference}),u=this.viewModel.view?.spatialReference.equals(c.spatialReference)?c:await n(c,this.viewModel.view.spatialReference,p);this.viewModel.updateCurrentCoveragePolygon(new e({geometry:u,attributes:{imageID:w.attributes.objectId},symbol:d,visible:v}))}catch(h){a(h)||i.getLogger(this.viewModel).error("update-footprint",h)}else this.viewModel.updateCurrentCoveragePolygon(null)},this.updateVideoFootprint=async o=>{const{points:p,feature:c,scale:m,options:g}=o,{activeViewer:v,mode:f,currentBestFeature:w,currentCoverageVisible:h,footprintExtent:y}=this.viewModel,M="video"===f?u:v?.imageSize,b=c??w;if(w&&M&&y&&b&&"none"!==f)try{const i={feature:b,mode:f,imageSize:M,footprintExtent:y},o=await this.viewModel.getMapPointForFeature(p,i,g);r(g);const a=o.filter(t);if(!a.length)return;const c=[a.map(({x:e,y:t})=>[e,t,1])];c[0].push(c[0][0]);let u=new s({rings:c,spatialReference:a[0].spatialReference});if(m){const e=u.spatialReference,t=l(u),i=u.rings.map(e=>e.map(([e,i])=>[t.x+(e-t.x)*m,t.y+(i-t.y)*m]));u=new s({rings:i,spatialReference:e})}const v=this.viewModel.view?.spatialReference.equals(u.spatialReference)?u:await n(u,this.viewModel.view.spatialReference,g);this.viewModel.updateCurrentCoveragePolygon(new e({geometry:v,attributes:{imageID:b.attributes.objectId},symbol:d,visible:h}))}catch(C){a(C)||i.getLogger(this.viewModel).error("update-footprint",C)}else this.viewModel.updateCurrentCoveragePolygon(null)},this.updateFootprintPanorama=async(t,i)=>{const{horizontalFieldOfView:o,pitch:a,verticalFieldOfView:l,yaw:m,feature:v}=t,{activeViewer:f,currentBestFeature:w,currentCoverageVisible:h,footprintExtent:y,mode:M}=this.viewModel,b="video"===M||"panoramic-video"===M?u:f?.imageSize,C=v??w;if(!C||!b||!y||"none"===M)return void this.viewModel.updateCurrentCoveragePolygon(null);const{cameraPitch:F,objectId:R}=C.attributes;if(a+F-l/2>180)return void this.viewModel.updateCurrentCoveragePolygon(null);const j=[],P=l/2,I=o/2,x=a-P,V=a+P;if(x>90)return void this.viewModel.updateCurrentCoveragePolygon(null);const D=x<0,z=[-I,P],E=[I,P],S=[I,-P],B=[-I,-P];if(x<90&&V>90){j.push(D?S:B);const e=Math.floor(o/5),t=o/e;for(let i=0;i<=e;i++)j.push([i*t-I,90-a]);j.push(D?B:S)}V<90&&(j.push(z,E),D?j.push(B,S):j.push(S,B));const q=g(f?.media),L=j.map(([e,t])=>{const i=a+t,o=m+e,r=q?p(o,i,q):[o,i];return{...c(r[0],r[1],b[0],b[1]),heading:o,pitch:i}}),O={feature:C,mode:M,imageSize:b,footprintExtent:y},U=v?await this.viewModel.getMapPointForFeature(L,O):await this.viewModel.getMapPoint(L);r(i);const k=[U.map(({x:e,y:t})=>[e,t,1])];k[0].push(k[0][0]);const A=new s({rings:k,spatialReference:U[0].spatialReference}),G=this.viewModel.view?.spatialReference.equals(A.spatialReference)?A:await n(A,this.viewModel.view.spatialReference,i);this.viewModel.updateCurrentCoveragePolygon(new e({geometry:G,attributes:{imageID:R},symbol:d.clone(),visible:h}))}}}export{v as default};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import e from"../../../../Graphic.js";import{isSome as t}from"../../../../core/arrayUtils.js";import{throwIfAborted as i,waitTick as a}from"../../../../core/promiseUtils.js";import o from"../../../../geometry/Mesh.js";import r from"../../../../geometry/Point.js";import{projectAsync as n}from"../../../../geometry/projectionUtils.js";import s from"../../../../geometry/support/MeshVertexAttributes.js";import{projectVertices as l,updateFrustum as c,createCoveragePolygon as p}from"../../../../layers/orientedImagery/core/coverageUtils.js";import{getMetersPerUnitOfSR as u}from"../../../../layers/orientedImagery/core/utils.js";import{fixedImageSize as m}from"../../constants.js";import{activeFrustumSymbol as d,additionalFrustumSymbol as f}from"../../symbols.js";class v{constructor(r){this.viewModel=r,this._updateBestFeatureFootprintElevation=!1,this._updatedElevationSampler=null,this.createFootprints=async a=>{const{coverageFrustums:r,currentBestFeature:c,isAdditionalCoverageVisible:p,view:u}=this.viewModel,m=r.filter(t);for(const t of m){let r=t.clone();if(!u.spatialReference.equals(r.spatialReference)){const{components:e,spatialReference:t,origin:c,vertexAttributes:p,vertexSpace:m}=r;if("local"===m.type){const e=await n(c,u.spatialReference,a);i(a),r.centerAt(e)}else{const n=p.position,c=Float64Array.from(await l([...n],t.clone(),u.spatialReference.clone(),a));i(a),r=new o({vertexAttributes:new s({position:c}),components:e,spatialReference:u.spatialReference.clone()})}}t.imageID===c.attributes.objectId?(this._updateBestFeatureFootprintElevation=!0,this.viewModel.bestFeatureFootprint=new e({attributes:{imageID:t.imageID},geometry:r,symbol:d.clone(),visible:!1})):this.viewModel.additionalFootprints.push(new e({attributes:{imageID:t.imageID},geometry:r,symbol:f.clone(),visible:p}))}},this.updateFootprint=async(a,o,r)=>{const{bestFeatureFootprint:s,currentBestFeature:l,activeViewer:p,footprintExtent:u,view:f,mode:v}=this.viewModel,y="video"===v?m:p?.imageSize,b=o??l;if(!(l&&s?.geometry&&y&&u&&b&&f?.spatialReference))return void this.viewModel.updateCurrentCoveragePolygon(null);const{attributes:{cameraHeight:F,location:R,cameraPitch:M,horizontalFieldOfView:S,verticalFieldOfView:E,cameraRoll:x},elevationSample:A}=b;let V=null;if(o&&(this._updatedElevationSampler=l.elevationSample,V=await h(o,f.spatialReference),this._updatedElevationSampler)){const e=this._updatedElevationSampler?.extent,t=o.attributes.geometry;if(e&&!e.contains(t)){const e=this.viewModel.selectedPoint;if(!e)return;e.x=o.geometry.x,e.y=o.geometry.y;const t=await this.viewModel.processFeatureElevation([o],e);t&&(this._updatedElevationSampler=t)}const[i]=g([V],this._updatedElevationSampler,o);i&&(V=i)}A&&this._updateBestFeatureFootprintElevation&&(this.updateGroundElevation([s]),this._updateBestFeatureFootprintElevation=!1);const P=R.toArray(),I=o&&V?V:s,{vertexAttributes:{position:_},spatialReference:j}=I.geometry,z=await w(_,j,R.spatialReference),C=await this.viewModel.getMapPoint(a);i(r);let O=C.filter(t);if(!O.length)return;O[0].spatialReference.equals(R.spatialReference)||(O=await Promise.all(O.map(async e=>{const t=await n(e,R.spatialReference,r);return i(r),t})));const B=await c(a.map(({x:e,y:t})=>[e,t]),O.map(e=>e.toArray()),{cameraHeight:F,cameraLocation:P,cameraPitch:M,frustumVertices:z,horizontalFieldOfView:S,imageHeight:y[1],imageWidth:y[0],inSRS:{wkid:R.spatialReference.wkid},outSRS:{wkid:f.spatialReference.wkid},verticalFieldOfView:E,cameraRoll:x??0,options:r});this.viewModel.updateCurrentCoveragePolygon(new e({attributes:{imageID:b.attributes.objectId},geometry:B,symbol:d.clone(),visible:this.viewModel.currentCoverageVisible}))},this.updateVideoFootprint=async a=>{const{points:o,feature:r,scale:s,options:l}=a,{bestFeatureFootprint:p,currentBestFeature:u,activeViewer:f,footprintExtent:v,view:b,mode:F}=this.viewModel,R="video"===F?m:f?.imageSize,M=r??u;if(!(u&&p?.geometry&&R&&v&&M&&b?.spatialReference&&"none"!==F))return void this.viewModel.updateCurrentCoveragePolygon(null);const{attributes:{cameraHeight:S,location:E,cameraPitch:x,horizontalFieldOfView:A,verticalFieldOfView:V,cameraRoll:P},elevationSample:I}=M;let _=null;if(r&&(this._updatedElevationSampler=u.elevationSample,_=await h(r,b.spatialReference),this._updatedElevationSampler)){const e=this._updatedElevationSampler?.extent,t=r.attributes.geometry;if(e&&!e.contains(t)){const e=this.viewModel.selectedPoint;if(!e)return;e.x=r.geometry.x,e.y=r.geometry.y;const t=await this.viewModel.processFeatureElevation([r],e);t&&(this._updatedElevationSampler=t)}const[i]=g([_],this._updatedElevationSampler,r);i&&(_=i)}I&&this._updateBestFeatureFootprintElevation&&(this.updateGroundElevation([p]),this._updateBestFeatureFootprintElevation=!1);const j=E.toArray(),z=r&&_?_:p,{vertexAttributes:{position:C},spatialReference:O}=z.geometry,B=await w(C,O,E.spatialReference),k={feature:M,mode:F,imageSize:R,footprintExtent:v},D=await this.viewModel.getMapPointForFeature(o,k,l);i(l);let H=D.filter(t);if(!H.length)return;H[0].spatialReference.equals(E.spatialReference)||(H=await Promise.all(H.map(async e=>{const t=await n(e,E.spatialReference,l);return i(l),t})));const q=await c(o.map(({x:e,y:t})=>[e,t]),H.map(e=>e.toArray()),{cameraHeight:S,cameraLocation:j,cameraPitch:x,frustumVertices:B,horizontalFieldOfView:A,imageHeight:R[1],imageWidth:R[0],inSRS:{wkid:E.spatialReference.wkid},outSRS:{wkid:b.spatialReference.wkid},verticalFieldOfView:V,cameraRoll:P??0,options:l});if(s&&q){const e=y(q);q.scale(s,{origin:e})}this.viewModel.updateCurrentCoveragePolygon(new e({attributes:{imageID:M.attributes.objectId},geometry:q,symbol:d.clone(),visible:this.viewModel.currentCoverageVisible}))},this.updateFootprintPanorama=async(t,i)=>{await a(i);const{horizontalFieldOfView:o,pitch:r,verticalFieldOfView:s,yaw:l,feature:c}=t,u=c?.clone()??this.viewModel.currentBestFeature?.clone();if(!u)return;const{attributes:m}=u;m.orientedImageryType=null,m.cameraHeading=(l+m.cameraHeading)%360,m.cameraPitch=r,m.horizontalFieldOfView=o,m.verticalFieldOfView=s,m.cameraRoll=0;const{frustum:f}=p(m);if(!f)return void this.viewModel.updateCurrentCoveragePolygon(null);const v=this.viewModel.view?.spatialReference.equals(f.spatialReference)?f.clone():await n(f.clone(),this.viewModel.view?.spatialReference,i);this.viewModel.updateCurrentCoveragePolygon(new e({attributes:{imageID:m.objectId},geometry:v,symbol:d.clone(),visible:this.viewModel.currentCoverageVisible}))}}updateGroundElevation(e){const{geometry:t,attributes:{elevation:i}}=this.viewModel.currentBestFeature,a=(i??0)*u(t.spatialReference);e.forEach(e=>{const{geometry:t}=e;switch(t?.type){case"mesh":{const{vertexAttributes:{position:e}}=t,i=Math.floor(e.length/3);for(let o=0;o<i;o+=1)e[3*o+2]+=a/u(t.spatialReference);break}case"point":t.z=(t.z??0)+a/u(t.spatialReference)}})}}async function w(e,t,i,a){return Float64Array.from((await Promise.all(e.reduce((e,t,i)=>{const a=Math.floor(i/3);return e[a]=e[a]??[],e[a].push(t),e},new Array).map(async e=>(await n(new r(e,t),i,a)).toArray()))).flat())}const h=async(t,a,r)=>{const{frustum:c}=p(t.attributes);let u=c.clone();if(!a.equals(u.spatialReference)){const{components:e,spatialReference:t,origin:a,vertexAttributes:c,vertexSpace:p}=u;if("local"===p.type){const e=await n(a,t,r);i(r),u.centerAt(e)}else{const a=c.position,n=Float64Array.from(await l([...a],t.clone(),t.clone(),r));i(r),u=new o({vertexAttributes:new s({position:n}),components:e,spatialReference:t.clone()})}}return new e({attributes:{imageID:c.imageID},geometry:u,symbol:d.clone(),visible:!1})},g=(e,t,i)=>{const{geometry:a}=i,o=t.queryElevation(a);for(const r of e){const{geometry:e}=r;switch(e?.type){case"mesh":{const{vertexAttributes:{position:t}}=e,i=Math.floor(t.length/3);for(let e=0;e<i;e++)t[3*e+2]+=o?.z??0;break}case"point":e.z=(e.z??0)+(o?.z??0)}}return e},y=e=>{const t=e.vertexAttributes.position;let i=0,a=0,o=0;const n=t.length/3;for(let r=0;r<t.length;r+=3)i+=t[r],a+=t[r+1],o+=t[r+2];return new r({x:i/n,y:a/n,z:o/n,spatialReference:e.spatialReference})};export{v as default};
2
+ import e from"../../../../Graphic.js";import{isSome as t}from"../../../../core/arrayUtils.js";import{throwIfAborted as i,waitTick as a}from"../../../../core/promiseUtils.js";import o from"../../../../geometry/Mesh.js";import r from"../../../../geometry/Point.js";import{projectAsync as n}from"../../../../geometry/projectionUtils.js";import s from"../../../../geometry/support/MeshVertexAttributes.js";import{projectVertices as l,updateFrustum as c,createCoveragePolygon as p}from"../../../../layers/orientedImagery/core/coverageUtils.js";import{getMetersPerUnitOfSR as u}from"../../../../layers/orientedImagery/core/utils.js";import{fixedImageSize as m}from"../../constants.js";import{activeFrustumSymbol as d,additionalFrustumSymbol as f}from"../../symbols.js";class v{constructor(r){this.viewModel=r,this._updateBestFeatureFootprintElevation=!1,this._updatedElevationSampler=null,this.createFootprints=async a=>{const{coverageFrustums:r,currentBestFeature:c,isAdditionalCoverageVisible:p,view:u}=this.viewModel,m=r.filter(t);for(const t of m){let r=t.clone();if(!u.spatialReference.equals(r.spatialReference)){const{components:e,spatialReference:t,origin:c,vertexAttributes:p,vertexSpace:m}=r;if("local"===m.type){const e=await n(c,u.spatialReference,a);i(a),r.centerAt(e)}else{const n=p.position,c=Float64Array.from(await l([...n],t.clone(),u.spatialReference.clone(),a));i(a),r=new o({vertexAttributes:new s({position:c}),components:e,spatialReference:u.spatialReference.clone()})}}t.imageID===c.attributes.objectId?(this._updateBestFeatureFootprintElevation=!0,this.viewModel.bestFeatureFootprint=new e({attributes:{imageID:t.imageID},geometry:r,symbol:d.clone(),visible:!1})):this.viewModel.additionalFootprints.push(new e({attributes:{imageID:t.imageID},geometry:r,symbol:f.clone(),visible:p}))}},this.updateFootprint=async(a,o,r)=>{const{bestFeatureFootprint:s,currentBestFeature:l,activeViewer:p,footprintExtent:u,view:f,mode:v}=this.viewModel,y="video"===v?m:p?.imageSize,b=o??l;if(!(l&&s?.geometry&&y&&u&&b&&f?.spatialReference))return void this.viewModel.updateCurrentCoveragePolygon(null);const{attributes:{cameraHeight:F,location:R,cameraPitch:M,horizontalFieldOfView:S,verticalFieldOfView:E,cameraRoll:x},elevationSample:A}=b;let V=null;if(o&&(this._updatedElevationSampler=l.elevationSample,V=await h(o,f.spatialReference),this._updatedElevationSampler)){const e=this._updatedElevationSampler?.extent,t=o.attributes.geometry;if(e&&!e.contains(t)){const e=this.viewModel.selectedPoint;if(!e)return;e.x=o.geometry.x,e.y=o.geometry.y;const t=await this.viewModel.processFeatureElevation([o],e);t&&(this._updatedElevationSampler=t)}const[i]=g([V],this._updatedElevationSampler,o);i&&(V=i)}A&&this._updateBestFeatureFootprintElevation&&(this.updateGroundElevation([s]),this._updateBestFeatureFootprintElevation=!1);const P=R.toArray(),I=o&&V?V:s,{vertexAttributes:{position:_},spatialReference:j}=I.geometry,z=await w(_,j,R.spatialReference),C=await this.viewModel.getMapPoint(a);i(r);let O=C.filter(t);if(!O.length)return;O[0].spatialReference.equals(R.spatialReference)||(O=await Promise.all(O.map(async e=>{const t=await n(e,R.spatialReference,r);return i(r),t})));const B=await c(a.map(({x:e,y:t})=>[e,t]),O.map(e=>e.toArray()),{cameraHeight:F,cameraLocation:P,cameraPitch:M,frustumVertices:z,horizontalFieldOfView:S,imageHeight:y[1],imageWidth:y[0],inSRS:{wkid:R.spatialReference.wkid},outSRS:{wkid:f.spatialReference.wkid},verticalFieldOfView:E,cameraRoll:x??0,options:r});this.viewModel.updateCurrentCoveragePolygon(new e({attributes:{imageID:b.attributes.objectId},geometry:B,symbol:d.clone(),visible:this.viewModel.currentCoverageVisible}))},this.updateVideoFootprint=async a=>{const{points:o,feature:r,scale:s,options:l}=a,{bestFeatureFootprint:p,currentBestFeature:u,activeViewer:f,footprintExtent:v,view:b,mode:F}=this.viewModel,R="video"===F?m:f?.imageSize,M=r??u;if(!(u&&p?.geometry&&R&&v&&M&&b?.spatialReference&&"none"!==F))return void this.viewModel.updateCurrentCoveragePolygon(null);const{attributes:{cameraHeight:S,location:E,cameraPitch:x,horizontalFieldOfView:A,verticalFieldOfView:V,cameraRoll:P},elevationSample:I}=M;let _=null;if(r&&(this._updatedElevationSampler=u.elevationSample,_=await h(r,b.spatialReference),this._updatedElevationSampler)){const e=this._updatedElevationSampler?.extent,t=r.attributes.geometry;if(e&&!e.contains(t)){const e=this.viewModel.selectedPoint;if(!e)return;e.x=r.geometry.x,e.y=r.geometry.y;const t=await this.viewModel.processFeatureElevation([r],e);t&&(this._updatedElevationSampler=t)}const[i]=g([_],this._updatedElevationSampler,r);i&&(_=i)}I&&this._updateBestFeatureFootprintElevation&&(this.updateGroundElevation([p]),this._updateBestFeatureFootprintElevation=!1);const j=E.toArray(),z=r&&_?_:p,{vertexAttributes:{position:C},spatialReference:O}=z.geometry,B=await w(C,O,E.spatialReference),k={feature:M,mode:F,imageSize:R,footprintExtent:v},D=await this.viewModel.getMapPointForFeature(o,k,l);i(l);let H=D.filter(t);if(!H.length)return;H[0].spatialReference.equals(E.spatialReference)||(H=await Promise.all(H.map(async e=>{const t=await n(e,E.spatialReference,l);return i(l),t})));const q=await c(o.map(({x:e,y:t})=>[e,t]),H.map(e=>e.toArray()),{cameraHeight:S,cameraLocation:j,cameraPitch:x,frustumVertices:B,horizontalFieldOfView:A,imageHeight:R[1],imageWidth:R[0],inSRS:{wkid:E.spatialReference.wkid},outSRS:{wkid:b.spatialReference.wkid},verticalFieldOfView:V,cameraRoll:P??0,options:l});if(s&&q){const e=y(q);q.scale(s,{origin:e})}this.viewModel.updateCurrentCoveragePolygon(new e({attributes:{imageID:M.attributes.objectId},geometry:q,symbol:d.clone(),visible:this.viewModel.currentCoverageVisible}))},this.updateFootprintPanorama=async(t,i)=>{await a(i);const{horizontalFieldOfView:o,pitch:r,verticalFieldOfView:s,yaw:l,feature:c}=t,u=c?.clone()??this.viewModel.currentBestFeature?.clone();if(!u)return;const{attributes:m}=u;m.orientedImageryType=null,m.cameraHeading=l,m.cameraPitch=r,m.horizontalFieldOfView=o,m.verticalFieldOfView=s,m.cameraRoll=0;const{frustum:f}=p(m);if(!f)return void this.viewModel.updateCurrentCoveragePolygon(null);const v=this.viewModel.view?.spatialReference.equals(f.spatialReference)?f.clone():await n(f.clone(),this.viewModel.view?.spatialReference,i);this.viewModel.updateCurrentCoveragePolygon(new e({attributes:{imageID:m.objectId},geometry:v,symbol:d.clone(),visible:this.viewModel.currentCoverageVisible}))}}updateGroundElevation(e){const{geometry:t,attributes:{elevation:i}}=this.viewModel.currentBestFeature,a=(i??0)*u(t.spatialReference);e.forEach(e=>{const{geometry:t}=e;switch(t?.type){case"mesh":{const{vertexAttributes:{position:e}}=t,i=Math.floor(e.length/3);for(let o=0;o<i;o+=1)e[3*o+2]+=a/u(t.spatialReference);break}case"point":t.z=(t.z??0)+a/u(t.spatialReference)}})}}async function w(e,t,i,a){return Float64Array.from((await Promise.all(e.reduce((e,t,i)=>{const a=Math.floor(i/3);return e[a]=e[a]??[],e[a].push(t),e},new Array).map(async e=>(await n(new r(e,t),i,a)).toArray()))).flat())}const h=async(t,a,r)=>{const{frustum:c}=p(t.attributes);let u=c.clone();if(!a.equals(u.spatialReference)){const{components:e,spatialReference:t,origin:a,vertexAttributes:c,vertexSpace:p}=u;if("local"===p.type){const e=await n(a,t,r);i(r),u.centerAt(e)}else{const a=c.position,n=Float64Array.from(await l([...a],t.clone(),t.clone(),r));i(r),u=new o({vertexAttributes:new s({position:n}),components:e,spatialReference:t.clone()})}}return new e({attributes:{imageID:c.imageID},geometry:u,symbol:d.clone(),visible:!1})},g=(e,t,i)=>{const{geometry:a}=i,o=t.queryElevation(a);for(const r of e){const{geometry:e}=r;switch(e?.type){case"mesh":{const{vertexAttributes:{position:t}}=e,i=Math.floor(t.length/3);for(let e=0;e<i;e++)t[3*e+2]+=o?.z??0;break}case"point":e.z=(e.z??0)+(o?.z??0)}}return e},y=e=>{const t=e.vertexAttributes.position;let i=0,a=0,o=0;const n=t.length/3;for(let r=0;r<t.length;r+=3)i+=t[r],a+=t[r+1],o+=t[r+2];return new r({x:i/n,y:a/n,z:o/n,spatialReference:e.spatialReference})};export{v as default};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import t from"../../../core/Accessor.js";import{throwIfAborted as a}from"../../../core/promiseUtils.js";import{property as o}from"../../../core/accessorSupport/decorators/property.js";import{subclass as i}from"../../../core/accessorSupport/decorators/subclass.js";import r from"../../../geometry/Multipoint.js";import s from"../../../geometry/Point.js";import n from"../../../geometry/Polygon.js";import m from"../../../geometry/Polyline.js";import{projectAsync as p}from"../../../geometry/projectionUtils.js";import l from"../../../geometry/SpatialReference.js";import{imageToWorld as c,imageToWorldPanoramic as y}from"../../../layers/orientedImagery/transformations/imageToWorld.js";import g from"../../../layers/orientedImagery/transformations/updateElevation.js";import{getUpdateElevationProps as h,getImageToWorldProperties as f,getImageToWorldPanoramicProperties as u,pointToArray as d}from"../../../layers/orientedImagery/transformations/utils.js";import{worldToImagePanoramic as w,worldToImage as T}from"../../../layers/orientedImagery/transformations/worldToImage.js";import{imageSpaceToPoint as P,pointToImageSpace as S}from"../support/geometryUtils.js";let x=class extends t{constructor(e){super(e),this.mode="default"}async pixelToMapPoint(e,t){const{imageToWorldProperties:o,updateElevationProps:i,mode:r}=this,s=Array.isArray(e)?e:[e];await(this.depthImageService?.load(t)),a(t);const n=await Promise.all(s.map(async e=>{e.depth=await(this.depthImageService?.depthAt(e,{width:this.imageSize?.[0]??0,height:this.imageSize?.[1]??0}))}));if(await Promise.all(n),a(t),"default"===r){const r=await c(s,o,i);return a(t),Array.isArray(e)?r:r[0]}const m=await y(s,o,i);return a(t),Array.isArray(e)?m:m[0]}async pixelToMapPointForFeature(e,t,o){const{feature:i,mode:r,imageSize:s,footprintExtent:n}=t,{elevationSample:m,attributes:g}=i,{elevationSource:d,location:w,cameraHeight:T}=g;let P=w.clone();P.spatialReference.isGeographic&&(P=await p(P,l.WebMercator));const S=await h(w.spatialReference,w.z??0,T,{elevationSample:m,elevationSource:d,extent:n});let x;"elevationSample"in S&&(i.elevationSample=S.elevationSample);const G=Array.isArray(e)?e:[e];await(this.depthImageService?.load(o)),a(o);const M=await Promise.all(G.map(async e=>{e.depth=this.depthImageService?.depthAt(e,{width:s?.[0]??0,height:s?.[1]??0})}));if(await Promise.all(M),a(o),"default"===r||"video"===r){const e=f(g,s[0],s[1]);x=await c(G,{...e,cameraLocation:P},S)}else{const e=u(g,s[0],s[1]);x=await y(G,{...e,cameraLocation:P},S)}return Array.isArray(e)?x:x[0]}async pointToPixel(e,t){const{imageToWorldProperties:o,updateElevationProps:i,mode:r}=this;if(!i||!o)throw new Error("updateElevationProps and imageToWorldProperties are required to perform pointToPixel operation.");const s=Array.isArray(e)?e:[e],{spatialReference:n}=o.cameraLocation,m=await Promise.all(s.map(async e=>{let o=e;return e.hasZ||(o=await g(e,i,t)),o.spatialReference.equals(n)||(o=await p(o,n,t)),a(t),o}));let l;return a(t),l="panoramic"===r?w(m,o):T(m,o),a(t),Array.isArray(e)?l:l[0]}async pointToImageGeometry(e,t){const o=await this.pointToPixel(e,t);return a(t),P(o,this.mode,this.imageSize)}async polygonToImageGeometry(e,t){const o=await Promise.all(e.rings.map(async o=>{const i=o.map(t=>new s({x:t[0],y:t[1],z:t[2],spatialReference:e.spatialReference})),r=await this.pointToPixel(i,t);return a(t),r.map(e=>d(P(e,this.mode,this.imageSize)))}));return a(t),n.fromJSON({rings:o,spatialReference:l.WebMercator})}async polylineToImageGeometry(e,t){const o=await Promise.all(e.paths.map(async o=>{const i=o.map(t=>new s({x:t[0],y:t[1],z:t[2],spatialReference:e.spatialReference})),r=await this.pointToPixel(i,t);return a(t),r.map(e=>d(P(e,this.mode,this.imageSize)))}));return a(t),m.fromJSON({paths:o,spatialReference:l.WebMercator})}async multipointToImageGeometry(e,t){const o=e.points.map(t=>new s({x:t[0],y:t[1],z:t[2],spatialReference:e.spatialReference})),i=await this.pointToPixel(o,t);a(t);const n=i.map(e=>d(P(e,this.mode,this.imageSize)));return a(t),r.fromJSON({points:n,spatialReference:l.WebMercator})}async extentToImageGeometry(e,t){const o=n.fromExtent(e),i=await this.polygonToImageGeometry(o,t);return a(t),i.extent}async geometryToImageGeometry(e,t){switch(e.type){case"point":return await this.pointToImageGeometry(e,t);case"polygon":return await this.polygonToImageGeometry(e,t);case"polyline":return await this.polylineToImageGeometry(e,t);case"multipoint":return await this.multipointToImageGeometry(e,t);case"extent":return await this.extentToImageGeometry(e,t);default:return null}}async imagePointToMapGeometry(e,t){const o=S(e,this.mode,this.imageSize),i=await this.pixelToMapPoint(o,t);return a(t),i}async imagePolygonToMapGeometry(e,t){const o=await Promise.all(e.rings.map(async a=>{const o=a.map(t=>new s({x:t[0],y:t[1],z:t[2],spatialReference:e.spatialReference})).map(e=>S(e,this.mode,this.imageSize));return await this.pixelToMapPoint(o,t)}));return a(t),n.fromJSON({rings:o,spatialReference:o[0][0].spatialReference})}async imagePolylineToMapGeometry(e,t){const o=await Promise.all(e.paths.map(async a=>{const o=a.map(t=>new s({x:t[0],y:t[1],z:t[2],spatialReference:e.spatialReference})).map(e=>S(e,this.mode,this.imageSize));return await this.pixelToMapPoint(o,t)}));return a(t),m.fromJSON({paths:o,spatialReference:o[0][0].spatialReference})}async imageMultipointToMapGeometry(e,t){const o=e.points.map(t=>new s({x:t[0],y:t[1],z:t[2],spatialReference:e.spatialReference})).map(e=>S(e,this.mode,this.imageSize)),i=await this.pixelToMapPoint(o,t);return a(t),r.fromJSON({points:i.map(e=>[e.x,e.y,e.z]),spatialReference:i[0].spatialReference})}async imageExtentToMapGeometry(e,t){const o=n.fromExtent(e),i=await this.imagePolygonToMapGeometry(o,t);a(t);const r=await this.imageGeometryToMapGeometry(i,t);return a(t),r.extent}async imageGeometryToMapGeometry(e,t){switch(e.type){case"point":return await this.imagePointToMapGeometry(e,t);case"polygon":return await this.imagePolygonToMapGeometry(e,t);case"polyline":return await this.imagePolylineToMapGeometry(e,t);case"multipoint":return await this.imageMultipointToMapGeometry(e,t);case"extent":return await this.imageExtentToMapGeometry(e,t);default:return null}}};e([o()],x.prototype,"mode",void 0),e([o()],x.prototype,"imageToWorldProperties",void 0),e([o()],x.prototype,"updateElevationProps",void 0),e([o()],x.prototype,"depthImageService",void 0),e([o()],x.prototype,"imageSize",void 0),x=e([i("esri.widgets.OrientedImageryViewer.services.TransformationService")],x);const G=x;export{G as default};
2
+ import{__decorate as e}from"tslib";import t from"../../../core/Accessor.js";import{throwIfAborted as a}from"../../../core/promiseUtils.js";import{property as o}from"../../../core/accessorSupport/decorators/property.js";import{subclass as i}from"../../../core/accessorSupport/decorators/subclass.js";import r from"../../../geometry/Multipoint.js";import s from"../../../geometry/Point.js";import n from"../../../geometry/Polygon.js";import m from"../../../geometry/Polyline.js";import{projectAsync as p}from"../../../geometry/projectionUtils.js";import l from"../../../geometry/SpatialReference.js";import{imageToWorld as c,imageToWorldPanoramic as y}from"../../../layers/orientedImagery/transformations/imageToWorld.js";import h from"../../../layers/orientedImagery/transformations/updateElevation.js";import{getUpdateElevationProps as g,getImageToWorldProperties as f,getImageToWorldPanoramicProperties as u,pointToArray as d}from"../../../layers/orientedImagery/transformations/utils.js";import{worldToImagePanoramic as w,worldToImage as T}from"../../../layers/orientedImagery/transformations/worldToImage.js";import{imageSpaceToPoint as P,pointToImageSpace as S}from"../support/geometryUtils.js";let x=class extends t{constructor(e){super(e),this.mode="default"}get horizonAngles(){if("panoramic"!==this.mode)return;const{horizonPitch:e,horizonRoll:t,horizonYaw:a}=this.imageToWorldProperties;return[e,t,a]}async pixelToMapPoint(e,t){const{imageToWorldProperties:o,updateElevationProps:i,mode:r}=this,s=Array.isArray(e)?e:[e];await(this.depthImageService?.load(t)),a(t);const n=await Promise.all(s.map(async e=>{e.depth=await(this.depthImageService?.depthAt(e,{width:this.imageSize?.[0]??0,height:this.imageSize?.[1]??0}))}));if(await Promise.all(n),a(t),"default"===r){const r=await c(s,o,i);return a(t),Array.isArray(e)?r:r[0]}const m=await y(s,o,i);return a(t),Array.isArray(e)?m:m[0]}async pixelToMapPointForFeature(e,t,o){const{feature:i,mode:r,imageSize:s,footprintExtent:n}=t,{elevationSample:m,attributes:h}=i,{elevationSource:d,location:w,cameraHeight:T}=h;let P=w.clone();P.spatialReference.isGeographic&&(P=await p(P,l.WebMercator));const S=await g(w.spatialReference,w.z??0,T,{elevationSample:m,elevationSource:d,extent:n});let x;"elevationSample"in S&&(i.elevationSample=S.elevationSample);const z=Array.isArray(e)?e:[e];await(this.depthImageService?.load(o)),a(o);const G=await Promise.all(z.map(async e=>{e.depth=this.depthImageService?.depthAt(e,{width:s?.[0]??0,height:s?.[1]??0})}));if(await Promise.all(G),a(o),"default"===r||"video"===r){const e=f(h,s[0],s[1]);x=await c(z,{...e,cameraLocation:P},S)}else{const e=u(h,s[0],s[1]);x=await y(z,{...e,cameraLocation:P},S)}return Array.isArray(e)?x:x[0]}async pointToPixel(e,t){const{imageToWorldProperties:o,updateElevationProps:i,mode:r}=this;if(!i||!o)throw new Error("updateElevationProps and imageToWorldProperties are required to perform pointToPixel operation.");const s=Array.isArray(e)?e:[e],{spatialReference:n}=o.cameraLocation,m=await Promise.all(s.map(async e=>{let o=e;return e.hasZ||(o=await h(e,i,t)),o.spatialReference.equals(n)||(o=await p(o,n,t)),a(t),o}));let l;return a(t),l="panoramic"===r?w(m,o):T(m,o),a(t),Array.isArray(e)?l:l[0]}async pointToImageGeometry(e,t){const o=await this.pointToPixel(e,t);return a(t),P(o,this.mode,this.imageSize,this.horizonAngles)}async polygonToImageGeometry(e,t){const o=await Promise.all(e.rings.map(async o=>{const i=o.map(t=>new s({x:t[0],y:t[1],z:t[2],spatialReference:e.spatialReference})),r=await this.pointToPixel(i,t);return a(t),r.map(e=>d(P(e,this.mode,this.imageSize,this.horizonAngles)))}));return a(t),n.fromJSON({rings:o,spatialReference:l.WebMercator})}async polylineToImageGeometry(e,t){const o=await Promise.all(e.paths.map(async o=>{const i=o.map(t=>new s({x:t[0],y:t[1],z:t[2],spatialReference:e.spatialReference})),r=await this.pointToPixel(i,t);return a(t),r.map(e=>d(P(e,this.mode,this.imageSize,this.horizonAngles)))}));return a(t),m.fromJSON({paths:o,spatialReference:l.WebMercator})}async multipointToImageGeometry(e,t){const o=e.points.map(t=>new s({x:t[0],y:t[1],z:t[2],spatialReference:e.spatialReference})),i=await this.pointToPixel(o,t);a(t);const n=i.map(e=>d(P(e,this.mode,this.imageSize,this.horizonAngles)));return a(t),r.fromJSON({points:n,spatialReference:l.WebMercator})}async extentToImageGeometry(e,t){const o=n.fromExtent(e),i=await this.polygonToImageGeometry(o,t);return a(t),i.extent}async geometryToImageGeometry(e,t){switch(e.type){case"point":return await this.pointToImageGeometry(e,t);case"polygon":return await this.polygonToImageGeometry(e,t);case"polyline":return await this.polylineToImageGeometry(e,t);case"multipoint":return await this.multipointToImageGeometry(e,t);case"extent":return await this.extentToImageGeometry(e,t);default:return null}}async imagePointToMapGeometry(e,t){const o=S(e,this.mode,this.imageSize,this.horizonAngles),i=await this.pixelToMapPoint(o,t);return a(t),i}async imagePolygonToMapGeometry(e,t){const o=await Promise.all(e.rings.map(async a=>{const o=a.map(t=>new s({x:t[0],y:t[1],z:t[2],spatialReference:e.spatialReference})).map(e=>S(e,this.mode,this.imageSize,this.horizonAngles));return await this.pixelToMapPoint(o,t)}));return a(t),n.fromJSON({rings:o.map(e=>e.map(d)),spatialReference:o[0][0].spatialReference})}async imagePolylineToMapGeometry(e,t){const o=await Promise.all(e.paths.map(async a=>{const o=a.map(t=>new s({x:t[0],y:t[1],z:t[2],spatialReference:e.spatialReference})).map(e=>S(e,this.mode,this.imageSize,this.horizonAngles));return await this.pixelToMapPoint(o,t)}));return a(t),m.fromJSON({paths:o.map(e=>e.map(d)),spatialReference:o[0][0].spatialReference})}async imageMultipointToMapGeometry(e,t){const o=e.points.map(t=>new s({x:t[0],y:t[1],z:t[2],spatialReference:e.spatialReference})).map(e=>S(e,this.mode,this.imageSize,this.horizonAngles)),i=await this.pixelToMapPoint(o,t);return a(t),r.fromJSON({points:i.map(e=>[e.x,e.y,e.z]),spatialReference:i[0].spatialReference})}async imageExtentToMapGeometry(e,t){const o=n.fromExtent(e),i=await this.imagePolygonToMapGeometry(o,t);a(t);const r=await this.imageGeometryToMapGeometry(i,t);return a(t),r.extent}async imageGeometryToMapGeometry(e,t){switch(e.type){case"point":return await this.imagePointToMapGeometry(e,t);case"polygon":return await this.imagePolygonToMapGeometry(e,t);case"polyline":return await this.imagePolylineToMapGeometry(e,t);case"multipoint":return await this.imageMultipointToMapGeometry(e,t);case"extent":return await this.imageExtentToMapGeometry(e,t);default:return null}}};e([o()],x.prototype,"mode",void 0),e([o()],x.prototype,"imageToWorldProperties",void 0),e([o()],x.prototype,"updateElevationProps",void 0),e([o()],x.prototype,"depthImageService",void 0),e([o()],x.prototype,"imageSize",void 0),e([o()],x.prototype,"horizonAngles",null),x=e([i("esri.widgets.OrientedImageryViewer.services.TransformationService")],x);const z=x;export{z as default};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import e from"../../../Graphic.js";import t from"../../../core/Error.js";import n from"../../../geometry/Polygon.js";import{fromJSON as r}from"../../../geometry/support/jsonUtils.js";import{convertPixelLocationToSphereVertex as a,convertSphereVertexToPixelLocation as i}from"../../../layers/orientedImagery/transformations/utils.js";import{defaultImageGeometryField as o,defaultOIObjectIDField as s}from"../constants.js";import{createGraphicSymbol as m,dataCaptureFeatureSymbol as p}from"../symbols.js";import{checkNameOrAlias as y}from"./typeUtils.js";function c(e,t,n){if(!e)return;const{renderer:r}=e,a=p(t),i=r?"symbol"in r?r.symbol:"defaultSymbol"in r?r.defaultSymbol:r.getSymbol():null,o=a(i?.color);n[`${t}Symbol`]=(t===e.geometryType?i:null)??o}function l(e,n,r){const a=e.fields.find(({name:e,alias:t,type:r})=>y(n?.length?n:o,e,t)&&"blob"===r),i=e.fields.find(({name:e,alias:t})=>y(r?.length?r:s,e,t));if(!a||!i)throw new t("orientedimageryviewer:invalid-data-capture-layer","Data capture layer is not configured correctly.",{layer:e,imageGeometryField:a,oiObjectIdField:i});return{imageGeometryField:a,oiObjectIdField:i}}function x(n,r,a,i,o,s,p){let y=u(n,r);if(!y)throw new t("orientedimageryviewer:invalid-geometry","InvalidGeometry");return y=d(y,s,o),new e({attributes:n,layer:a,symbol:m(y.type,a.geometryType,p),geometry:y,visible:a.visible&&i})}function u(e,t){const{geometry:n}=JSON.parse(atob(e[t]));return r(n)}function b(e,t,n){switch(t){case"default":return f(e);case"panoramic":return g(e,n)}}function f(e){switch(e.type){case"point":e.x+=.5,e.y=.5-e.y;break;case"polyline":e.paths=e.paths.map(e=>e.map(([e,t])=>[e+.5,.5-t]));break;case"polygon":e.rings=e.rings.map(e=>e.map(([e,t])=>[e+.5,.5-t]));break;case"multipoint":e.points=e.points.map(([e,t])=>[e+.5,.5-t]);break;case"extent":e.xmin+=.5,e.xmax+=.5,e.ymin=.5-e.ymin,e.ymax=.5-e.ymax}return e}function g(e,t){switch(e.type){case"point":{const{x:n,y:r}=i(e,t[0],t[1]);e.x=n,e.y=r,delete e.z;break}case"polyline":e.paths=e.paths.map(e=>e.map(e=>{const{x:n,y:r}=i({x:e[0],y:e[1],z:e[2]},t[0],t[1]);return[n,r]}));break;case"polygon":e.rings=e.rings.map(e=>e.map(e=>{const{x:n,y:r}=i({x:e[0],y:e[1],z:e[2]},t[0],t[1]);return[n,r]}));break;case"multipoint":e.points=e.points.map(e=>{const{x:n,y:r}=i({x:e[0],y:e[1],z:e[2]},t[0],t[1]);return[n,r]});break;case"extent":{const{xmin:r,xmax:a,ymin:i,ymax:o}=g(n.fromExtent(e),t).extent;e.xmax=a,e.xmin=r,e.ymax=o,e.ymin=i;break}}return e}function d(e,t,n){switch(t){case"default":return h(e);case"panoramic":return k(e,n)}}function h(e){switch(e.type){case"point":e.x-=.5,e.y=.5-e.y;break;case"polyline":e.paths=e.paths.map(e=>e.map(([e,t])=>[e-.5,.5-t]));break;case"polygon":e.rings=e.rings.map(e=>e.map(([e,t])=>[e-.5,.5-t]));break;case"multipoint":e.points=e.points.map(([e,t])=>[e-.5,.5-t]);break;case"extent":e.xmin-=.5,e.xmax-=.5,e.ymin=.5-e.ymin,e.ymax=.5-e.ymax}return e}function k(e,t){switch(e.type){case"point":{const[n,r,i]=a(e,t[0],t[1]);e.x=n,e.y=r,e.z=i;break}case"polyline":e.paths=e.paths.map(e=>e.map(e=>{const[n,r,i]=a({x:e[0],y:e[1]},t[0],t[1]);return[n,r,i]}));break;case"polygon":e.rings=e.rings.map(e=>e.map(e=>{const[n,r,i]=a({x:e[0],y:e[1]},t[0],t[1]);return[n,r,i]}));break;case"multipoint":e.points=e.points.map(e=>{const[n,r,i]=a({x:e[0],y:e[1]},t[0],t[1]);return[n,r,i]});break;case"extent":{const{xmin:r,xmax:a,ymin:i,ymax:o}=k(n.fromExtent(e),t).extent;e.xmax=a,e.xmin=r,e.ymax=o,e.ymin=i}}return e}export{c as configureSketchTool,x as constructGraphicFromImageGeometry,l as extractFieldsFromDataCaptureLayer,b as mapSpaceToImageSpace,f as mapSpaceToImageSpaceDefault,g as mapSpaceToImageSpacePanoramic,u as parseAndExtractField,d as pixelToMapSpace,h as pixelToMapSpaceDefault,k as pixelToMapSpacePanoramic};
2
+ import e from"../../../Graphic.js";import t from"../../../core/Error.js";import n from"../../../geometry/Polygon.js";import{fromJSON as r}from"../../../geometry/support/jsonUtils.js";import{convertPixelLocationToSphereVertex as a,convertSphereVertexToPixelLocation as i}from"../../../layers/orientedImagery/transformations/utils.js";import{defaultImageGeometryField as o,defaultOIObjectIDField as s}from"../constants.js";import{createGraphicSymbol as m,dataCaptureFeatureSymbol as p}from"../symbols.js";import{checkNameOrAlias as y}from"./typeUtils.js";function c(e,t,n){if(!e)return;const{renderer:r}=e,a=p(t),i=r?"symbol"in r?r.symbol:"defaultSymbol"in r?r.defaultSymbol:r.getSymbol():null,o=a(i?.color);n[`${t}Symbol`]=(t===e.geometryType?i:null)??o}function l(e,n,r){const a=e.fields.find(({name:e,alias:t,type:r})=>y(n?.length?n:o,e,t)&&"blob"===r),i=e.fields.find(({name:e,alias:t})=>y(r?.length?r:s,e,t));if(!a||!i)throw new t("orientedimageryviewer:invalid-data-capture-layer","Data capture layer is not configured correctly.",{layer:e,imageGeometryField:a,oiObjectIdField:i});return{imageGeometryField:a,oiObjectIdField:i}}function x(n,r,a,i,o,s,p,y){let c=u(n,r);if(!c)throw new t("orientedimageryviewer:invalid-geometry","InvalidGeometry");return c=d(c,s,o,y),new e({attributes:n,layer:a,symbol:m(c.type,a.geometryType,p),geometry:c,visible:a.visible&&i})}function u(e,t){const{geometry:n}=JSON.parse(atob(e[t]));return r(n)}function b(e,t,n,r){switch(t){case"default":return f(e);case"panoramic":return g(e,n,r)}}function f(e){switch(e.type){case"point":e.x+=.5,e.y=.5-e.y;break;case"polyline":e.paths=e.paths.map(e=>e.map(([e,t])=>[e+.5,.5-t]));break;case"polygon":e.rings=e.rings.map(e=>e.map(([e,t])=>[e+.5,.5-t]));break;case"multipoint":e.points=e.points.map(([e,t])=>[e+.5,.5-t]);break;case"extent":e.xmin+=.5,e.xmax+=.5,e.ymin=.5-e.ymin,e.ymax=.5-e.ymax}return e}function g(e,t,r){switch(e.type){case"point":{const{x:n,y:a}=i(e,...t,r);e.x=n,e.y=a,delete e.z;break}case"polyline":e.paths=e.paths.map(e=>e.map(e=>{const{x:n,y:a}=i({x:e[0],y:e[1],z:e[2]},...t,r);return[n,a]}));break;case"polygon":e.rings=e.rings.map(e=>e.map(e=>{const{x:n,y:a}=i({x:e[0],y:e[1],z:e[2]},...t,r);return[n,a]}));break;case"multipoint":e.points=e.points.map(e=>{const{x:n,y:a}=i({x:e[0],y:e[1],z:e[2]},...t,r);return[n,a]});break;case"extent":{const{xmin:a,xmax:i,ymin:o,ymax:s}=g(n.fromExtent(e),t,r).extent;e.xmax=i,e.xmin=a,e.ymax=s,e.ymin=o;break}}return e}function d(e,t,n,r){switch(t){case"default":return h(e);case"panoramic":return k(e,n,r)}}function h(e){switch(e.type){case"point":e.x-=.5,e.y=.5-e.y;break;case"polyline":e.paths=e.paths.map(e=>e.map(([e,t])=>[e-.5,.5-t]));break;case"polygon":e.rings=e.rings.map(e=>e.map(([e,t])=>[e-.5,.5-t]));break;case"multipoint":e.points=e.points.map(([e,t])=>[e-.5,.5-t]);break;case"extent":e.xmin-=.5,e.xmax-=.5,e.ymin=.5-e.ymin,e.ymax=.5-e.ymax}return e}function k(e,t,r){switch(e.type){case"point":{const[n,i,o]=a(e,...t,r);e.x=n,e.y=i,e.z=o;break}case"polyline":e.paths=e.paths.map(e=>e.map(e=>{const[n,i,o]=a({x:e[0],y:e[1]},...t,r);return[n,i,o]}));break;case"polygon":e.rings=e.rings.map(e=>e.map(e=>{const[n,i,o]=a({x:e[0],y:e[1]},...t,r);return[n,i,o]}));break;case"multipoint":e.points=e.points.map(e=>{const[n,i,o]=a({x:e[0],y:e[1]},...t,r);return[n,i,o]});break;case"extent":{const{xmin:a,xmax:i,ymin:o,ymax:s}=k(n.fromExtent(e),t,r).extent;e.xmax=i,e.xmin=a,e.ymax=s,e.ymin=o}}return e}export{c as configureSketchTool,x as constructGraphicFromImageGeometry,l as extractFieldsFromDataCaptureLayer,b as mapSpaceToImageSpace,f as mapSpaceToImageSpaceDefault,g as mapSpaceToImageSpacePanoramic,u as parseAndExtractField,d as pixelToMapSpace,h as pixelToMapSpaceDefault,k as pixelToMapSpacePanoramic};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import e from"../../../geometry/Point.js";import n from"../../../geometry/SpatialReference.js";import{convertPixelLocationToSphereVertex as t,convertSphereVertexToPixelLocation as r}from"../../../layers/orientedImagery/transformations/utils.js";function o(r,o){const[a,i]=o;return new e(t(r,a,i),n.WebMercator)}function a(e){return{x:e.x-.5,y:.5-e.y}}function i(t){return new e({...a(t),spatialReference:n.WebMercator})}function s(e,n,t){switch(n){case"default":return i(e);case"panoramic":return o(e,t);default:throw new Error(`Unsupported image mode: ${n}`)}}function c(e){return{x:e.x+.5,y:.5-e.y}}function p(e,n){const[t,o]=n;return r({x:e.x,y:e.y,z:e.z},t,o)}function m(e,n,t){return"panoramic"===n?p(e,t):c(e)}function u(e){if(e&&"hasZ"in e&&e.hasZ)switch(e.type){case"point":e.z=void 0;break;case"polyline":e.paths=e.paths.map(e=>e.map(e=>3===e.length?[e[0],e[1]]:e));break;case"polygon":e.rings=e.rings.map(e=>e.map(e=>3===e.length?[e[0],e[1]]:e));break;case"multipoint":e.points=e.points.map(e=>3===e.length?[e[0],e[1]]:e);break;case"extent":e.zmax=void 0,e.zmin=void 0}}export{i as imageSpaceTo2DPoint,o as imageSpaceTo3DPoint,s as imageSpaceToPoint,a as pixelTo2D,m as pointToImageSpace,u as removeZFromGeometry,c as toImageSpace,p as toImageSpace3D};
2
+ import e from"../../../geometry/Point.js";import n from"../../../geometry/SpatialReference.js";import{convertPixelLocationToSphereVertex as t,convertSphereVertexToPixelLocation as r}from"../../../layers/orientedImagery/transformations/utils.js";function o(r,o,a){const[i,s]=o;return new e(t(r,i,s,a),n.WebMercator)}function a(e){return{x:e.x-.5,y:.5-e.y}}function i(t){return new e({...a(t),spatialReference:n.WebMercator})}function s(e,n,t,r){switch(n){case"default":return i(e);case"panoramic":return o(e,t,r);default:throw new Error(`Unsupported image mode: ${n}`)}}function c(e){return{x:e.x+.5,y:.5-e.y}}function p(e,n,t){const[o,a]=n;return r({x:e.x,y:e.y,z:e.z},o,a,t)}function m(e,n,t,r){return"panoramic"===n?p(e,t,r):c(e)}function u(e){if(e&&"hasZ"in e&&e.hasZ)switch(e.type){case"point":e.z=void 0;break;case"polyline":e.paths=e.paths.map(e=>e.map(e=>3===e.length?[e[0],e[1]]:e));break;case"polygon":e.rings=e.rings.map(e=>e.map(e=>3===e.length?[e[0],e[1]]:e));break;case"multipoint":e.points=e.points.map(e=>3===e.length?[e[0],e[1]]:e);break;case"extent":e.zmax=void 0,e.zmin=void 0}}export{i as imageSpaceTo2DPoint,o as imageSpaceTo3DPoint,s as imageSpaceToPoint,a as pixelTo2D,m as pointToImageSpace,u as removeZFromGeometry,c as toImageSpace,p as toImageSpace3D};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import t from"../../../request.js";const e=/\.(\w+)$/;function n(t){const n=t.match(e);return!n||n.length<2?null:n[1].toUpperCase()}const o=async(e,n)=>{const o=await t(e,{...n,method:"head"}),r=o?.getHeader?.("Content-Type");return r?r.split("/")[1]:null};export{o as getDatasetFormat,n as guessExtensionFromURI};
2
+ import t from"../../../request.js";const e=/\.(\w+)$/;function n(t){const n=new URL(t).pathname.match(e);return!n||n.length<2?null:n[1].toUpperCase()}const o=async(e,n)=>{const o=await t(e,{...n,method:"head"}),r=o?.getHeader?.("Content-Type");return r?r.split("/")[1]:null};export{o as getDatasetFormat,n as guessExtensionFromURI};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import r from"../../core/Logger.js";import{sectorsRadii as t}from"./constants.js";import n from"./support/NonPanoramicMedia.js";import e from"../PanoramicViewer/support/PanoramicMedia.js";function i(r){return"3d"===r?.type}function o(r){return"esri.Graphic"===r?.declaredClass}function a(r){return/(tiff|tif|mrf)$/i.test(r??"")}function u(r){if(!r)return!1;if(!URL.canParse(r))return!1;const{pathname:t}=new URL(r);return/.*\.(tiff|tif|mrf)$/i.test(t??"")}function f(r){return Math.abs(r)>=135?"WEST":r<-45&&r>-135?"SOUTH":r<=45?"EAST":"NORTH"}function s(r,n){const e=r/n*t[2];return e<=t[0]?"NEAR":e<=t[1]?"":"FAR"}function c(r){return r&&r.url&&r.datasetFormat?r:null}function m(r){return"string"==typeof r&&r.length?r:c(r)}const p=r=>t=>t.layer===r;function g(r){return"NoAttachmentError"===r?.name}const l=r=>`${r}:missing-property`,d=(r,t)=>`Property ${t} is missing in ${r}`,h=(t="esri.widgets.OrientedImageryViewer",n)=>{throw r.getLogger(t).error(n),n};function y(r,t){0!==t&&(r.xmin/=t,r.xmax*=t,r.ymin/=t,r.ymax*=t)}function w(r,t){t&&r.forEach(r=>{r.elevationSample=t})}function x(r){return new e(r)}function E(r){return new n(r)}function P(r,t,n){return n?r.filter(({attributes:{location:r}})=>Math.abs((r.z??0)-(t.z??0))<n):r}export{w as assignElevationSampleToFeatures,f as calculateDirection,s as calculateSegment,m as castImageSource,c as castURLWithDatasetFormat,E as createNonPanoramicMedia,x as createPanoramicMedia,P as filterByZ,p as filterOILLayerView,d as getMissingPropertyErrorMessage,l as getMissingPropertyErrorName,o as isGraphic,g as isNoAttachmentError,i as isSceneView,u as isTifOrMrf,h as logAndThrow,y as scaleExtent,a as validateTifOrMrfExtension};
2
+ import r from"../../core/Logger.js";import{sectorsRadii as n}from"./constants.js";import t from"./support/NonPanoramicMedia.js";import e from"../PanoramicViewer/support/PanoramicMedia.js";function i(r){return"3d"===r?.type}function o(r){return"esri.Graphic"===r?.declaredClass}function a(r){return/(tiff|tif|mrf)$/i.test(r??"")}function u(r){if(!r)return!1;if(!URL.canParse(r))return!1;const{pathname:n}=new URL(r);return/.*\.(tiff|tif|mrf)$/i.test(n??"")}function c(r){return Math.abs(r)>=135?"WEST":r<-45&&r>-135?"SOUTH":r<=45?"EAST":"NORTH"}function s(r,t){const e=r/t*n[2];return e<=n[0]?"NEAR":e<=n[1]?"":"FAR"}function f(r){return r&&r.url&&r.datasetFormat?r:null}function m(r){return"string"==typeof r&&r.length?r:f(r)}const p=r=>n=>n.layer===r;function l(r){return"NoAttachmentError"===r?.name}const d=r=>`${r}:missing-property`,g=(r,n)=>`Property ${n} is missing in ${r}`,h=(n="esri.widgets.OrientedImageryViewer",t)=>{throw r.getLogger(n).error(t),t};function w(r,n){0!==n&&(r.xmin/=n,r.xmax*=n,r.ymin/=n,r.ymax*=n)}function y(r,n){n&&r.forEach(r=>{r.elevationSample=n})}function P(r){return new e(r)}function R(r){return new t(r)}function x(r,n,t){return t?r.filter(({attributes:{location:r}})=>Math.abs((r.z??0)-(n.z??0))<t):r}function z(r){return!!r&&"esri.widgets.PanoramicViewer.support.PanoramicMedia"===r.declaredClass}function E(r){if(!z(r))return;const{horizonPitch:n,horizonRoll:t,horizonYaw:e}=r;return[n,t,e]}export{y as assignElevationSampleToFeatures,c as calculateDirection,s as calculateSegment,m as castImageSource,f as castURLWithDatasetFormat,R as createNonPanoramicMedia,P as createPanoramicMedia,E as extractHorizonAnglesFromMedia,x as filterByZ,p as filterOILLayerView,g as getMissingPropertyErrorMessage,d as getMissingPropertyErrorName,o as isGraphic,l as isNoAttachmentError,z as isPanoramicMedia,i as isSceneView,u as isTifOrMrf,h as logAndThrow,w as scaleExtent,a as validateTifOrMrfExtension};