@arcgis/core 4.32.0-next.20250121 → 4.32.0-next.20250122

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 (279) hide show
  1. package/WebLinkChart.js +1 -1
  2. package/arcade/treeAnalysis.js +1 -1
  3. package/assets/esri/core/t9n/Units_ar.json +1 -1
  4. package/assets/esri/core/t9n/Units_bg.json +1 -1
  5. package/assets/esri/core/t9n/Units_bs.json +1 -1
  6. package/assets/esri/core/t9n/Units_ca.json +1 -1
  7. package/assets/esri/core/t9n/Units_cs.json +1 -1
  8. package/assets/esri/core/t9n/Units_da.json +1 -1
  9. package/assets/esri/core/t9n/Units_de.json +1 -1
  10. package/assets/esri/core/t9n/Units_el.json +1 -1
  11. package/assets/esri/core/t9n/Units_es.json +1 -1
  12. package/assets/esri/core/t9n/Units_et.json +1 -1
  13. package/assets/esri/core/t9n/Units_fi.json +1 -1
  14. package/assets/esri/core/t9n/Units_fr.json +1 -1
  15. package/assets/esri/core/t9n/Units_he.json +1 -1
  16. package/assets/esri/core/t9n/Units_hr.json +1 -1
  17. package/assets/esri/core/t9n/Units_hu.json +1 -1
  18. package/assets/esri/core/t9n/Units_id.json +1 -1
  19. package/assets/esri/core/t9n/Units_it.json +1 -1
  20. package/assets/esri/core/t9n/Units_ja.json +1 -1
  21. package/assets/esri/core/t9n/Units_ko.json +1 -1
  22. package/assets/esri/core/t9n/Units_lt.json +1 -1
  23. package/assets/esri/core/t9n/Units_lv.json +1 -1
  24. package/assets/esri/core/t9n/Units_nl.json +1 -1
  25. package/assets/esri/core/t9n/Units_no.json +1 -1
  26. package/assets/esri/core/t9n/Units_pl.json +1 -1
  27. package/assets/esri/core/t9n/Units_pt-BR.json +1 -1
  28. package/assets/esri/core/t9n/Units_pt-PT.json +1 -1
  29. package/assets/esri/core/t9n/Units_ro.json +1 -1
  30. package/assets/esri/core/t9n/Units_ru.json +1 -1
  31. package/assets/esri/core/t9n/Units_sk.json +1 -1
  32. package/assets/esri/core/t9n/Units_sl.json +1 -1
  33. package/assets/esri/core/t9n/Units_sr.json +1 -1
  34. package/assets/esri/core/t9n/Units_sv.json +1 -1
  35. package/assets/esri/core/t9n/Units_th.json +1 -1
  36. package/assets/esri/core/t9n/Units_tr.json +1 -1
  37. package/assets/esri/core/t9n/Units_uk.json +1 -1
  38. package/assets/esri/core/t9n/Units_vi.json +1 -1
  39. package/assets/esri/core/t9n/Units_zh-CN.json +1 -1
  40. package/assets/esri/core/t9n/Units_zh-HK.json +1 -1
  41. package/assets/esri/core/t9n/Units_zh-TW.json +1 -1
  42. package/assets/esri/core/workers/RemoteClient.js +1 -1
  43. package/assets/esri/core/workers/chunks/03b94362ed2a45ee5ea3.js +1 -0
  44. package/assets/esri/core/workers/chunks/0446f2ffad255cd40272.js +1 -0
  45. package/assets/esri/core/workers/chunks/059119f1731c2103c91c.js +1 -0
  46. package/assets/esri/core/workers/chunks/05e58286f8015dba6768.js +1 -0
  47. package/assets/esri/core/workers/chunks/060414956bf316529c48.js +1 -0
  48. package/assets/esri/core/workers/chunks/{f8e188af5608293d5b2b.js → 07bff9e742f3e5877f3f.js} +1 -1
  49. package/assets/esri/core/workers/chunks/{6400f39a965900f66ce7.js → 083c73428945fb3d4558.js} +1 -1
  50. package/assets/esri/core/workers/chunks/0d3154b90bc3fd7e6b4c.js +1 -0
  51. package/assets/esri/core/workers/chunks/0ec2ae595fa22998ffea.js +1 -0
  52. package/assets/esri/core/workers/chunks/{105dcc7b7284b1e965b7.js → 15c5b1dd8f398f641f6e.js} +1 -1
  53. package/assets/esri/core/workers/chunks/163451124c66a7a0bcdc.js +1 -0
  54. package/assets/esri/core/workers/chunks/17cc6638a510da164f58.js +1 -0
  55. package/assets/esri/core/workers/chunks/1e3ab66d0e8a7f160f33.js +1 -0
  56. package/assets/esri/core/workers/chunks/1e9349411af082ec03d0.js +1 -0
  57. package/assets/esri/core/workers/chunks/1eb47cfca815ac432cf5.js +1 -0
  58. package/assets/esri/core/workers/chunks/{82266ca8002554198208.js → 20e7fae0c173807ba9a2.js} +1 -1
  59. package/assets/esri/core/workers/chunks/{af0b0a7eedebcf99d05d.js → 2118e9ffb24178ed7f59.js} +1 -1
  60. package/assets/esri/core/workers/chunks/21c12edc0632eb911e73.js +1 -0
  61. package/assets/esri/core/workers/chunks/21c3882a282a4755e032.js +1 -0
  62. package/assets/esri/core/workers/chunks/{435c037ccba71f1e22d3.js → 2488a0da3be64b0a26f4.js} +1 -1
  63. package/assets/esri/core/workers/chunks/254fbd8055ae7a0bb393.js +1 -0
  64. package/assets/esri/core/workers/chunks/2d55eb8059a532ffcc56.js +1 -0
  65. package/assets/esri/core/workers/chunks/3034df78da56fe1c0535.js +1 -0
  66. package/assets/esri/core/workers/chunks/32a96ef30f4608f377d6.js +1 -0
  67. package/assets/esri/core/workers/chunks/{97d66b0d0ff1132966de.js → 33b2f59c2ec10b2a1034.js} +1 -1
  68. package/assets/esri/core/workers/chunks/402de76b5de05615e111.js +1 -0
  69. package/assets/esri/core/workers/chunks/{17726b0ab1bf66185d66.js → 40efcdf03c5224e6c4f7.js} +1 -1
  70. package/assets/esri/core/workers/chunks/424c7788a708abbf9299.js +1 -0
  71. package/assets/esri/core/workers/chunks/484d99910d110830df76.js +1 -0
  72. package/assets/esri/core/workers/chunks/{9970e0e74cf2877a7ffc.js → 486969dba1dc99402172.js} +2 -2
  73. package/assets/esri/core/workers/chunks/{02b2175132c9720bc756.js → 48f4ba1a5bb692903d06.js} +1 -1
  74. package/assets/esri/core/workers/chunks/4d7bd2bbe9045a2fee7a.js +1 -0
  75. package/assets/esri/core/workers/chunks/{decd316936df1ad3fa65.js → 50b538c93696de5eda97.js} +1 -1
  76. package/assets/esri/core/workers/chunks/{de00150030003de05146.js → 52aea8a4f292a66f5cfa.js} +1 -1
  77. package/assets/esri/core/workers/chunks/56f0eb9802f5cf9ad0d9.js +1 -0
  78. package/assets/esri/core/workers/chunks/57ddd64f0c22274d87e0.js +1 -0
  79. package/assets/esri/core/workers/chunks/5b5be7eb139b153934f5.js +1 -0
  80. package/assets/esri/core/workers/chunks/{4af0674fabfc965f1660.js → 5b876743865ef91b5648.js} +1 -1
  81. package/assets/esri/core/workers/chunks/62b88350892198de5055.js +1 -0
  82. package/assets/esri/core/workers/chunks/{206194cf069ad4bcc3ad.js → 6adf4f3d807f1af1c7c1.js} +1 -1
  83. package/assets/esri/core/workers/chunks/6b1285db2d6695a87553.js +1 -0
  84. package/assets/esri/core/workers/chunks/6c425e1041bdeef32832.js +1 -0
  85. package/assets/esri/core/workers/chunks/6eb829a7959df2269b0e.js +1 -0
  86. package/assets/esri/core/workers/chunks/765b4aefce7c11bbcb1f.js +1 -0
  87. package/assets/esri/core/workers/chunks/{6d17488396583d83d9be.js → 79a265dc21e29d3fd888.js} +1 -1
  88. package/assets/esri/core/workers/chunks/7a9e1696dc6120df15b0.js +1 -0
  89. package/assets/esri/core/workers/chunks/7ae1f26ded268099f429.js +1 -0
  90. package/assets/esri/core/workers/chunks/7bf08823f861628144a1.js +1 -0
  91. package/assets/esri/core/workers/chunks/7e4d72279cc599b7029c.js +1 -0
  92. package/assets/esri/core/workers/chunks/{ee5f43fbe4c2cc199e64.js → 8434cd16effc5efbf1bd.js} +1 -1
  93. package/assets/esri/core/workers/chunks/86149b4a5a148744c7d1.js +1 -0
  94. package/assets/esri/core/workers/chunks/{2779cf112299b612a73a.js → 875cb81f143ff8fe03b5.js} +1 -1
  95. package/assets/esri/core/workers/chunks/885814ef0e34c01a589f.js +1 -0
  96. package/assets/esri/core/workers/chunks/{e610dd938d30f75778bc.js → 8be2d16663a238de9438.js} +1 -1
  97. package/assets/esri/core/workers/chunks/91d5cb094a7051abb6c5.js +1 -0
  98. package/assets/esri/core/workers/chunks/93ba76749746871357e7.js +314 -0
  99. package/assets/esri/core/workers/chunks/991c597f27daa67158c5.js +1 -0
  100. package/assets/esri/core/workers/chunks/9bd22cdf6eb158555906.js +1 -0
  101. package/assets/esri/core/workers/chunks/{33eebe5cb22a03ae90c8.js → 9c88ce9b0020b6f9a37a.js} +1 -1
  102. package/assets/esri/core/workers/chunks/9df7bffadbe0b4aad442.js +1 -0
  103. package/assets/esri/core/workers/chunks/a0a056698f8227210f49.js +1 -0
  104. package/assets/esri/core/workers/chunks/a1cdd09968e11d95c701.js +1 -0
  105. package/assets/esri/core/workers/chunks/a28cb975974b99540432.js +1 -0
  106. package/assets/esri/core/workers/chunks/a29958273958c3e3e932.js +1 -0
  107. package/assets/esri/core/workers/chunks/{98da074899c82f0ded0b.js → af224962edae72b002fa.js} +1 -1
  108. package/assets/esri/core/workers/chunks/af2ed4c8ac238b932d89.js +1 -0
  109. package/assets/esri/core/workers/chunks/af75107f207b2ba01bb4.js +1 -0
  110. package/assets/esri/core/workers/chunks/b1661e6c76ef0800ffd6.js +1 -0
  111. package/assets/esri/core/workers/chunks/b42ecc7c3eb2fd8d1308.js +1 -0
  112. package/assets/esri/core/workers/chunks/b44cf0e4c2f93408cabc.js +1 -0
  113. package/assets/esri/core/workers/chunks/b846052b6f80ad6ada89.js +1 -0
  114. package/assets/esri/core/workers/chunks/{399e67ccb69a5b206354.js → c1fd87af3129873369fd.js} +1 -1
  115. package/assets/esri/core/workers/chunks/c473756f8785ab868ba5.js +1 -0
  116. package/assets/esri/core/workers/chunks/c5368ca97b7f7261967a.js +1 -0
  117. package/assets/esri/core/workers/chunks/c685991c9a30f7435933.js +1 -0
  118. package/assets/esri/core/workers/chunks/ca5bd71bc2c1b1b3f9d9.js +1 -0
  119. package/assets/esri/core/workers/chunks/ce1c89b5a10fb5a7bb49.js +1 -0
  120. package/assets/esri/core/workers/chunks/d45ff061bf71b73e9f26.js +1 -0
  121. package/assets/esri/core/workers/chunks/d4760e583dfac95dc8a1.js +1 -0
  122. package/assets/esri/core/workers/chunks/de2ca2dc1b5d62c0d82e.js +1 -0
  123. package/assets/esri/core/workers/chunks/dfa4be2e07cc4c0938b0.js +1 -0
  124. package/assets/esri/core/workers/chunks/e067cef3b3ac3af49b88.js +1 -0
  125. package/assets/esri/core/workers/chunks/e2775bcceb62fd0df41b.js +1 -0
  126. package/assets/esri/core/workers/chunks/{c81204ae663e58c7b689.js → e63ff8d57fd771413488.js} +1 -1
  127. package/assets/esri/core/workers/chunks/e9993d4f2bfdc434fbcc.js +1 -0
  128. package/assets/esri/core/workers/chunks/{54c149f90bf94b797b36.js → ed30f46236da29c15430.js} +1 -1
  129. package/assets/esri/core/workers/chunks/f016205a8f1fb665d6dd.js +1 -0
  130. package/assets/esri/core/workers/chunks/f02119812ec852edda57.js +1 -0
  131. package/assets/esri/core/workers/chunks/f272070f0878cd3e39a4.js +1 -0
  132. package/assets/esri/core/workers/chunks/f2cf05fbbb51d657d300.js +1 -0
  133. package/assets/esri/core/workers/chunks/{e4f4ad67d778dea5b956.js → f4f6f4933ca58438d7bc.js} +1 -1
  134. package/assets/esri/core/workers/chunks/fdc3d97510c6d43a8882.js +1 -0
  135. package/assets/esri/core/workers/chunks/fef135e55706d84d1947.js +1 -0
  136. package/assets/esri/core/workers/chunks/ff4107b4fd3d3ce24e84.js +1 -0
  137. package/assets/esri/libs/lyr3d/lyr3DMain.wasm +0 -0
  138. package/assets/esri/libs/lyr3d/lyr3DWorker.wasm +0 -0
  139. package/assets/esri/rest/knowledgeGraph/wasmInterface/arcgis-knowledge-client-core-simd.wasm +0 -0
  140. package/assets/esri/rest/knowledgeGraph/wasmInterface/arcgis-knowledge-client-core.wasm +0 -0
  141. package/assets/esri/themes/base/widgets/_OrientedImageryViewer.scss +24 -0
  142. package/assets/esri/themes/base/widgets/_UtilityNetworkTrace.scss +49 -24
  143. package/assets/esri/themes/dark/main.css +1 -1
  144. package/assets/esri/themes/light/main.css +1 -1
  145. package/assets/esri/themes/light/view.css +1 -1
  146. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer.json +1 -1
  147. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_en.json +1 -1
  148. package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace.json +1 -1
  149. package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_en.json +1 -1
  150. package/chunks/arcgis-knowledge-client-core-simd.js +1 -1
  151. package/chunks/arcgis-knowledge-client-core.js +1 -1
  152. package/chunks/lyr3DMain.js +1 -1
  153. package/chunks/lyr3DWorker.js +1 -1
  154. package/editing/sharedTemplates/SharedTemplate.js +1 -1
  155. package/editing/sharedTemplates/SharedTemplateMetadata.d.ts +4 -0
  156. package/editing/sharedTemplates/SharedTemplateMetadata.js +1 -1
  157. package/editing/templateUtils.js +5 -0
  158. package/geometry/operators/projectOperator.d.ts +4 -0
  159. package/geometry/operators/shapePreservingProjectOperator.d.ts +4 -0
  160. package/geometry/operators/support/GeographicTransformation.d.ts +4 -0
  161. package/geometry/operators/support/GeographicTransformation.js +1 -1
  162. package/geometry/operators/support/GeographicTransformationStep.d.ts +4 -0
  163. package/geometry/operators/support/geographicTransformationUtils.d.ts +4 -0
  164. package/geometry/support/GeographicTransformation.d.ts +2 -2
  165. package/geometry/support/GeographicTransformationStep.d.ts +2 -2
  166. package/interfaces.d.ts +522 -53
  167. package/layers/ILyr3DWasmPerSceneView.js +1 -1
  168. package/layers/LinkChartLayer.js +1 -1
  169. package/layers/Lyr3DWasmPerSceneView.js +1 -1
  170. package/networks/support/utils.js +1 -1
  171. package/package.json +1 -1
  172. package/rest/featureService/FeatureService.js +1 -1
  173. package/rest/knowledgeGraph/toolService/findPaths/CIMFilteredFindPathsConfiguration.d.ts +4 -0
  174. package/rest/knowledgeGraph/toolService/findPaths/CIMFilteredFindPathsConfiguration.js +5 -0
  175. package/rest/knowledgeGraph/toolService/findPaths/CIMFilteredFindPathsEntity.d.ts +4 -0
  176. package/rest/knowledgeGraph/toolService/findPaths/CIMFilteredFindPathsEntity.js +5 -0
  177. package/rest/knowledgeGraph/toolService/findPaths/CIMFilteredFindPathsPathFilter.d.ts +4 -0
  178. package/rest/knowledgeGraph/toolService/findPaths/CIMFilteredFindPathsPathFilter.js +5 -0
  179. package/rest/knowledgeGraph/toolService/findPaths/CIMKGTraversalDirection.d.ts +4 -0
  180. package/rest/knowledgeGraph/toolService/findPaths/CIMKGTraversalDirection.js +5 -0
  181. package/rest/knowledgeGraph/toolService/findPaths/FindPathsToolSettings.d.ts +4 -0
  182. package/rest/knowledgeGraph/toolService/findPaths/FindPathsToolSettings.js +5 -0
  183. package/rest/knowledgeGraphService.js +1 -1
  184. package/support/revision.js +1 -1
  185. package/undoredo/support/Services.js +1 -1
  186. package/views/3d/layers/IntegratedMesh3DTilesLayerView3D.js +1 -1
  187. package/views/3d/layers/Lyr3DWasm.js +1 -1
  188. package/widgets/Editor/CreateFeaturesWorkflow.js +1 -1
  189. package/widgets/Editor/UpdateWorkflow.js +1 -1
  190. package/widgets/Editor/workflowUtils.js +1 -1
  191. package/widgets/FeatureForm/FeatureFormUtilityNetworkAssociations/FeatureFormUtilityNetworkAssociationList.js +1 -1
  192. package/widgets/FeatureForm/UtilityNetworkAssociationInput.js +1 -1
  193. package/widgets/FeatureTemplates/FeatureTemplatesViewModel.js +1 -1
  194. package/widgets/FeatureTemplates/TemplateItem.js +1 -1
  195. package/widgets/FeatureTemplates/featureTemplatesUtils.js +1 -1
  196. package/widgets/FeatureTemplates.js +1 -1
  197. package/widgets/LayerList/LayerListItem.js +1 -1
  198. package/widgets/Locate.js +1 -1
  199. package/widgets/OrientedImageryViewer/OrientedImageryViewerViewModel.js +1 -1
  200. package/widgets/OrientedImageryViewer/OrientedImageryViewerVisibleElements.js +1 -1
  201. package/widgets/OrientedImageryViewer/adapters/sketch/MeasurementAdapter.js +1 -1
  202. package/widgets/OrientedImageryViewer/components/ImageAreaMeasurement.js +5 -0
  203. package/widgets/OrientedImageryViewer/components/ImageDistanceMeasurement.js +5 -0
  204. package/widgets/OrientedImageryViewer/components/ImageMeasurement.js +5 -0
  205. package/widgets/OrientedImageryViewer/css.js +1 -1
  206. package/widgets/OrientedImageryViewer/imageMeasurementUtils.js +1 -1
  207. package/widgets/OrientedImageryViewer.js +1 -1
  208. package/widgets/UtilityNetworkTrace/UtilityNetworkTraceFeature.js +5 -0
  209. package/widgets/UtilityNetworkTrace/UtilityNetworkTraceFeaturesDrillIn.js +5 -0
  210. package/widgets/UtilityNetworkTrace/UtilityNetworkTraceViewModel.js +1 -1
  211. package/widgets/UtilityNetworkTrace.js +1 -1
  212. package/widgets/support/UtilityNetworkAssociations/UtilityNetworkAssociationList.js +1 -1
  213. package/widgets/support/UtilityNetworkAssociations/UtilityNetworkAssociationsViewModel.js +1 -1
  214. package/assets/esri/core/workers/chunks/0651586dc7bd2e8b34db.js +0 -1
  215. package/assets/esri/core/workers/chunks/077070295499b9bfabb6.js +0 -1
  216. package/assets/esri/core/workers/chunks/090cfc7f088a729afd47.js +0 -1
  217. package/assets/esri/core/workers/chunks/0d387baa64a89f88b1de.js +0 -1
  218. package/assets/esri/core/workers/chunks/134de9fa142129a43b1e.js +0 -1
  219. package/assets/esri/core/workers/chunks/16fa0a5f73ab67a8d3e4.js +0 -1
  220. package/assets/esri/core/workers/chunks/1797f62e9bf8f1ac8d13.js +0 -1
  221. package/assets/esri/core/workers/chunks/182722e2fe0a35c4d8db.js +0 -1
  222. package/assets/esri/core/workers/chunks/1b3215f3290fb2f07ab8.js +0 -1
  223. package/assets/esri/core/workers/chunks/1f4dd96aacf8c40a1120.js +0 -1
  224. package/assets/esri/core/workers/chunks/22748779ca94eda44de5.js +0 -1
  225. package/assets/esri/core/workers/chunks/2427a01678f3d9fbf30b.js +0 -1
  226. package/assets/esri/core/workers/chunks/33a13544b9e5f4f20bce.js +0 -1
  227. package/assets/esri/core/workers/chunks/423329432fbf007c620b.js +0 -1
  228. package/assets/esri/core/workers/chunks/467bd3c0da9518a0058b.js +0 -1
  229. package/assets/esri/core/workers/chunks/4c1d11a91291b28a73be.js +0 -1
  230. package/assets/esri/core/workers/chunks/51fbbd082ca78e4417d9.js +0 -1
  231. package/assets/esri/core/workers/chunks/5c05c899f7e6f764fedd.js +0 -1
  232. package/assets/esri/core/workers/chunks/6c1470dc0bd4389d1a2d.js +0 -1
  233. package/assets/esri/core/workers/chunks/6e804ee2d96d4de85a5f.js +0 -1
  234. package/assets/esri/core/workers/chunks/712f0dd46932c544df68.js +0 -1
  235. package/assets/esri/core/workers/chunks/71e88c90e9f9a9bddcd8.js +0 -1
  236. package/assets/esri/core/workers/chunks/74ba752dfab8ea5b6d2a.js +0 -314
  237. package/assets/esri/core/workers/chunks/79903647d4ed16d9a402.js +0 -1
  238. package/assets/esri/core/workers/chunks/7b4880b2dc6b01d70ccc.js +0 -1
  239. package/assets/esri/core/workers/chunks/7c98e4fcba1dc24eb788.js +0 -1
  240. package/assets/esri/core/workers/chunks/7d0fc25ce1f74adcfeb6.js +0 -1
  241. package/assets/esri/core/workers/chunks/8249351daa45ca82ca0c.js +0 -1
  242. package/assets/esri/core/workers/chunks/87ddc3d5d751d565cd97.js +0 -1
  243. package/assets/esri/core/workers/chunks/88bb55bca76f978c0aa3.js +0 -1
  244. package/assets/esri/core/workers/chunks/89198ca24466d939e4e8.js +0 -1
  245. package/assets/esri/core/workers/chunks/8cda8dbd95f0a78063a8.js +0 -1
  246. package/assets/esri/core/workers/chunks/8e0e5183c88a45fbfd8e.js +0 -1
  247. package/assets/esri/core/workers/chunks/90eea0c2435bb5d10460.js +0 -1
  248. package/assets/esri/core/workers/chunks/93c1541241f92fc07eaa.js +0 -1
  249. package/assets/esri/core/workers/chunks/964f2897794d8d71dcb7.js +0 -1
  250. package/assets/esri/core/workers/chunks/976daa00d35ee7f27a26.js +0 -1
  251. package/assets/esri/core/workers/chunks/99b4f146d0f1661a217c.js +0 -1
  252. package/assets/esri/core/workers/chunks/aa96a05b94ae642c1c9f.js +0 -1
  253. package/assets/esri/core/workers/chunks/b0055e7b2e840d478de8.js +0 -1
  254. package/assets/esri/core/workers/chunks/b1bf8ad629a6b8f4489a.js +0 -1
  255. package/assets/esri/core/workers/chunks/b1e3448ba51557ff6c13.js +0 -1
  256. package/assets/esri/core/workers/chunks/b30046a40bcfbec8abe4.js +0 -1
  257. package/assets/esri/core/workers/chunks/b538d02706a25bbbe2d0.js +0 -1
  258. package/assets/esri/core/workers/chunks/c436a112a3119ceabebf.js +0 -1
  259. package/assets/esri/core/workers/chunks/c690268f48bc84778b23.js +0 -1
  260. package/assets/esri/core/workers/chunks/c8a09db652389f0d254d.js +0 -1
  261. package/assets/esri/core/workers/chunks/c8a645601d041f411060.js +0 -1
  262. package/assets/esri/core/workers/chunks/cb3b7f83b3efb315bd14.js +0 -1
  263. package/assets/esri/core/workers/chunks/cdc5e4cd1214362e752a.js +0 -1
  264. package/assets/esri/core/workers/chunks/da5fc368eb5b3592d05e.js +0 -1
  265. package/assets/esri/core/workers/chunks/dae7e8357936466482fe.js +0 -1
  266. package/assets/esri/core/workers/chunks/dd935b6335c674b6f596.js +0 -1
  267. package/assets/esri/core/workers/chunks/ddd20894b5107b76b815.js +0 -1
  268. package/assets/esri/core/workers/chunks/df4d7f100222ea671730.js +0 -1
  269. package/assets/esri/core/workers/chunks/eb256e8488e341c4a6f2.js +0 -1
  270. package/assets/esri/core/workers/chunks/ebc0094355504ec09fb8.js +0 -1
  271. package/assets/esri/core/workers/chunks/f1b63f092e239f84b849.js +0 -1
  272. package/assets/esri/core/workers/chunks/f2126b79f41dc62cc576.js +0 -1
  273. package/assets/esri/core/workers/chunks/f3e0b0f07a622fcdd6ae.js +0 -1
  274. package/assets/esri/core/workers/chunks/f581aec77accce7411e0.js +0 -1
  275. package/assets/esri/core/workers/chunks/f877bcbd277a28154d82.js +0 -1
  276. package/assets/esri/core/workers/chunks/fa1c68f2ffcdff7986b6.js +0 -1
  277. package/assets/esri/core/workers/chunks/feeb36ffdffb227c4353.js +0 -1
  278. package/widgets/support/templateUtils.js +0 -5
  279. /package/assets/esri/core/workers/chunks/{9970e0e74cf2877a7ffc.js.LICENSE.txt → 486969dba1dc99402172.js.LICENSE.txt} +0 -0
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.32/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../chunks/tslib.es6.js";import{property as t}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/Logger.js";import"../../core/RandomLCG.js";import{subclass as i}from"../../core/accessorSupport/decorators/subclass.js";import{isLayerFromCatalog as n,isCatalogSublayer as o}from"../../layers/catalog/catalogUtils.js";import{getActionIcon as s,getActionStyles as a}from"../../support/actions/actionUtils.js";import l from"../Widget.js";import{getStatusIcon as r,getVisibilityIcon as c,listItemHasChildren as d,areChildrenHidden as p,canSortSublayers as m,getSingleAction as u,getItem as g}from"./support/layerListUtils.js";import{loadCalciteComponents as y}from"../support/componentsUtils.js";import{tsx as h}from"../support/jsxFactory.js";import{setFocus as b}from"../support/widgetUtils.js";var v;let _=v=class extends l{constructor(e){super(e),this.dragEnabled=!1,this.listModeDisabled=!1,this.parent=null,this.parentTitles=null,this.viewModel=null,this._onActionMenuOpen=e=>{this.item.actionsOpen=e.currentTarget.open},this._setTooltipReference=e=>{this.onTooltipReferenceChange?.(this.item.layer?.uid,e)},this._removeTooltipReference=()=>{this.onTooltipReferenceChange?.(this.item.layer?.uid,null)}}loadDependencies(){return y({"action-group":()=>import("@esri/calcite-components/dist/components/calcite-action-group"),"action-menu":()=>import("@esri/calcite-components/dist/components/calcite-action-menu"),action:()=>import("@esri/calcite-components/dist/components/calcite-action"),icon:()=>import("@esri/calcite-components/dist/components/calcite-icon"),"list-item":()=>import("@esri/calcite-components/dist/components/calcite-list-item"),list:()=>import("@esri/calcite-components/dist/components/calcite-list"),notice:()=>import("@esri/calcite-components/dist/components/calcite-notice")})}render(){const e=this.parentTitles??[],{_title:t,item:i,activeItem:n,selectionMode:o,selectedItems:s,messages:a,parent:l,css:r}=this,c="visibleAtCurrentTimeExtent"in i&&"layerInvisibleAtTime"in a&&!i.visibleAtCurrentTimeExtent?`${t} (${a.layerInvisibleAtTime})`:"visibleAtCurrentScale"in i&&"layerInvisibleAtScale"in a&&!i.visibleAtCurrentScale?`${t} (${a.layerInvisibleAtScale})`:t,d="parent"in i&&"catalog"===i.parent?.layer?.type,{layer:p}=i,m="visibleAtCurrentScale"in i&&!i.visibleAtCurrentScale||"visibleAtCurrentTimeExtent"in i&&!i.visibleAtCurrentTimeExtent;return h("calcite-list-item",{afterCreate:e=>this._focusSelectedDragEl(e,i),afterUpdate:e=>this._focusSelectedDragEl(e,i),class:this.classes(r.item,"itemActive"in r&&{[r.itemActive]:n===i}),"data-item":i,"data-layer-id":p?.id,dragDisabled:!i.sortable||d,id:p?.uid,key:`list-item-${p?.uid}`,label:t,metadata:{parentTitles:e,_title:t},open:"open"in i&&i.open,selected:"none"!==o&&s.includes(i),title:c,unavailable:m,value:p?.uid,onCalciteListItemSelect:e=>"visible"in i&&this._handleCalciteListItemSelect(e,i,l),onCalciteListItemToggle:e=>"open"in i&&this._handleCalciteListItemToggle(e,i)},this._renderedCatalogFootprintIcon,this._renderedCatalogDynamicIcon,this._renderedItemStatus,this._renderedItemToggle,this._renderedCatalogSelectNode,this._renderedItemTemporaryIcon,this._renderedChildList,this._renderedItemMessage,this._renderedPanel,this._renderedPanelAction,this._renderedActions)}get _title(){const{messages:e}=this;return this.item.title||("untitledTable"in e?e.untitledTable:e.untitledLayer)}get _renderedItemStatus(){const{item:e,parent:t,visibleElements:i,css:n}=this;if(!i.statusIndicators)return null;const{publishing:o}=e,s="updating"in e&&e.updating&&!t,a="connectionStatus"in e?e.connectionStatus:void 0,l=!!a;return h("calcite-icon",{class:this.classes(n.statusIndicator,{[n.publishing]:o},"updating"in n&&{[n.updating]:s},"connectionStatus"in n&&{[n.connectionStatus]:l},"connectionStatusConnected"in n&&{[n.connectionStatusConnected]:l&&"connected"===a}),icon:r({connectionStatus:a,publishing:o}),key:"layer-item-status",scale:"s",slot:"content-end"})}get _renderedItemTemporaryIcon(){const{item:e,visibleElements:t,css:i}=this,{layer:o}=e,s="temporaryLayerIndicators"in t&&t.temporaryLayerIndicators,a="temporaryTableIndicators"in t&&t.temporaryTableIndicators,l=o&&"persistenceEnabled"in o&&(n(o)||!o.persistenceEnabled);return(s||a)&&l?h("calcite-icon",{class:i.itemTemporaryIcon,icon:"temporary",key:"temporary-icon",scale:"s",slot:"content-start",title:this.messages.temporary}):null}get _renderedItemToggle(){const{item:e,parent:t,messages:i,visibilityAppearance:n,css:o}=this;if(!("visible"in e&&"layerVisibility"in i&&"visibleToggle"in o&&n))return null;const{visible:s}=e,a=t?.visibilityMode;if("inherited"===a)return null;const l=c({visible:s,exclusive:"exclusive"===a,visibilityAppearance:n}),r="checkbox"===n,d=i.layerVisibility;return h("calcite-action",{appearance:"transparent",class:o.visibleToggle,icon:r?l:void 0,key:"visibility-toggle",onclick:()=>this._toggleVisibility(e,t),scale:"s",slot:r?"actions-start":"actions-end",text:d,title:d},r?null:h("calcite-icon",{class:this.classes({[o.visibleIcon]:"exclusive"!==a&&s}),icon:l,scale:"s"}))}get _renderedPanel(){const{panel:e}=this.item;return!e?.open||e.disabled||e.flowEnabled?null:h("div",{class:this.css.itemContentBottom,key:`content-panel-${e.uid}`,slot:"content-bottom"},e.render())}get _renderedPanelAction(){const{panel:e}=this.item;if(!e?.visible)return null;const{open:t,title:i,disabled:n}=e;return h("calcite-action",{active:t,appearance:"transparent",disabled:n,icon:s(e),key:`action-${e.uid}`,onclick:()=>this._togglePanel(e),scale:"s",slot:"actions-end",text:i??"",title:i??void 0},this._renderFallbackIcon(e))}get _renderedActions(){switch(this._actionsCount){case 0:return null;case 1:return this._singleAction;default:return this._renderedActionMenu}}get _renderedActionMenu(){const{item:e,messagesCommon:t}=this,i=t.options;return h("calcite-action-menu",{appearance:"transparent",key:"item-action-menu",label:t.menu,open:e.actionsOpen,overlayPositioning:"fixed",placement:"bottom-end",scale:"s",slot:"actions-end",onCalciteActionMenuOpen:this._onActionMenuOpen},h("calcite-action",{appearance:"transparent",icon:"ellipsis",scale:"s",slot:"trigger",text:i,title:i}),this._renderedActionMenuContent)}get _renderedActionMenuContent(){return this._filteredSections.toArray().map((e=>h("calcite-action-group",{key:`action-section-${e.uid}`},e.toArray().map((e=>this._renderAction({action:e,textEnabled:!0}))))))}get _renderedCatalogFootprintIcon(){const{css:e}=this,t=this.item.layer,i="catalog-footprint"===t?.type,n="sublayer"===t?.type&&o(t,"footprints");return"itemCatalogIcon"in e&&(i||n)?h("calcite-icon",{class:e.itemCatalogIcon,icon:"footprint",key:"footprint",scale:"s",slot:"content-start"}):null}get _renderedCatalogDynamicIcon(){const{css:e}=this,t=this.item.layer,i="catalog-dynamic-group"===t?.type,n="sublayer"===t?.type&&o(t,"layers-in-view");return"itemCatalogIcon"in e&&(i||n)?h("calcite-icon",{class:e.itemCatalogIcon,icon:"catalog-dataset",key:"catalog-dataset",scale:"s",slot:"content-start"}):null}get _renderedCatalogSelectNode(){const{_title:e,item:t,visibleElements:i}=this;if(!("visible"in t))return;const{layer:n}=t,o="catalog-dynamic-group"===n?.type;return"catalogLayerList"in i&&i.catalogLayerList&&o?h("calcite-action",{appearance:"transparent",disabled:!n.visible,icon:"chevron-right",iconFlipRtl:!0,onclick:()=>this._triggerOnCatalogOpen(t),scale:"s",slot:"actions-end",text:e}):null}get _renderedChildList(){const{dragEnabled:e,item:t,rootGroupUid:i,listModeDisabled:n,selectionMode:o,displayMode:s}=this;if(!("visible"in t))return;const a=[...this.parentTitles??[],t.title],{children:l,layer:r}=t,c="catalog-dynamic-group"!==r?.type&&d(t),u=!n&&p(r),g="group"===r?.type;return c||!u&&!c&&e&&g?h("calcite-list",{canPull:e=>!!this.canMove&&this.canMove(e,"pull"),canPut:e=>!!this.canMove&&this.canMove(e,"put"),"data-item":t,"data-layer-type":i,displayMode:s,dragEnabled:!!e&&(t.childrenSortable&&m(t)),group:g?i:`${i}-${r?.uid}`,key:`child-list-${r?.uid}`,label:t.title,selectionAppearance:"border",selectionMode:o},l?.filter((e=>!e.hidden&&(this.visibleElements.errors||!e.error))).toArray().map((e=>this._renderItem(e,t,a))),this._renderedTablesItem):null}get _hasTables(){const{layerTablesEnabled:e}=this,t=this.item.layer;if(!e||!t)return!1;switch(t.type){case"knowledge-graph":return e.includes(t.type)&&!!t.tables?.length;case"map-image":case"tile":return e.includes(t.type)&&!!t.subtables?.length;default:return!1}}get _renderedTablesItem(){const{item:e,messages:t,css:i}=this,{layer:n}=e;return"itemTableIcon"in i&&"visible"in e&&"tables"in t&&this._hasTables?h("calcite-list-item",{class:i.item,"data-layer-id":n?.id,dragDisabled:!0,key:`list-item-table-list-tables-${n?.uid}`,title:t.tables,onCalciteListItemSelect:()=>this._triggerOnTablesOpen(e)},h("calcite-icon",{class:i.itemTableIcon,icon:"table",scale:"s",slot:"content-start"}),h("calcite-icon",{flipRtl:!0,icon:"chevron-right",scale:"s",slot:"content-end"})):null}get _renderedItemMessage(){const{item:e,messages:t,css:i}=this;return e.error?h("div",{class:i.itemMessage,key:"esri-layer-list__error",slot:"content-bottom"},h("calcite-notice",{icon:"exclamation-mark-triangle",kind:"warning",open:!0,scale:"s",width:"full"},h("div",{slot:"message"},"tableError"in t?t.tableError:t.layerError))):"incompatible"in e&&e.incompatible&&"layerIncompatible"in t?h("div",{class:i.itemMessage,key:"esri-layer-list__incompatible",slot:"content-bottom"},h("calcite-notice",{afterCreate:this._setTooltipReference,afterRemoved:this._removeTooltipReference,bind:this,icon:"exclamation-mark-triangle",kind:"warning",open:!0,scale:"s",tabIndex:0,width:"full"},h("div",{slot:"message"},t.layerIncompatible))):null}get _singleAction(){return this._renderAction({action:u(this._filteredSections),textEnabled:!1})}get _filteredSections(){return this.item.actionsSections.map((e=>e.filter((e=>e.visible))))}get _actionsCount(){return this.item.actionsSections.reduce(((e,t)=>e+t.length),0)}_renderAction(e){const{item:t}=this,{action:i,textEnabled:n}=e;if(!i)return null;const{active:o,disabled:a,title:l,type:r,indicator:c}=i;return h("calcite-action",{active:"toggle"===r&&i.value,appearance:"transparent","data-action-id":i.id,disabled:a,icon:s(i),indicator:c,key:`action-${i.uid}`,loading:o,onclick:()=>this._triggerAction(t,i),scale:"s",slot:n?void 0:"actions-end",text:l??"",textEnabled:n,title:l??void 0},this._renderFallbackIcon(i))}_renderFallbackIcon(e){const{css:t}=this,{className:i,icon:n}=e;if(n)return null;const o="image"in e?e.image:void 0,s={[t.itemActionIcon]:!!i,[t.itemActionImage]:!!o};return i&&(s[i]=!0),o||i?h("span",{"aria-hidden":"true",class:this.classes(t.itemActionIcon,s),key:"icon",styles:a(o)}):null}_renderItem(e,t,i=[]){return h(v,{activeItem:this.activeItem,canMove:this.canMove,css:this.css,displayMode:this.displayMode,dragEnabled:this.dragEnabled,item:e,key:`layerListItem-${e.layer?.uid}`,layerTablesEnabled:this.layerTablesEnabled,listModeDisabled:this.listModeDisabled,messages:this.messages,messagesCommon:this.messagesCommon,parent:t,parentTitles:i,rootGroupUid:this.rootGroupUid,selectedDragItemLayerUid:this.selectedDragItemLayerUid,selectedItems:this.selectedItems,selectionMode:this.selectionMode,visibilityAppearance:this.visibilityAppearance,visibleElements:this.visibleElements,onAction:this.onAction,onCatalogOpen:this.onCatalogOpen,onPanelOpen:this.onPanelOpen,onSelectedDragItemLayerUidChange:this.onSelectedDragItemLayerUidChange,onTablesOpen:this.onTablesOpen,onTooltipReferenceChange:this.onTooltipReferenceChange})}_triggerAction(e,t){t&&e&&("toggle"===t.type&&(t.value=!t.value),this.onAction(t,e))}_triggerOnTablesOpen(e){e&&this.onTablesOpen&&this.onTablesOpen(e)}_triggerOnCatalogOpen(e){e&&this.onCatalogOpen?.(e)}_focusSelectedDragEl(e,t){this.selectedDragItemLayerUid===t.layer?.uid&&(b(e),this.onSelectedDragItemLayerUidChange?.(null))}_handleCalciteListItemToggle(e,t){e.stopPropagation(),t.open=e.target.open}_handleCalciteListItemSelect(e,t,i){g(e.target)===t&&"none"===this.selectionMode&&"inherited"!==i?.visibilityMode&&this._toggleVisibility(t,i)}_togglePanel(e){e.open=!e.open,e.open&&this.onPanelOpen()}_toggleVisibility(e,t){if(!e)return;const i=t?.visibilityMode;"exclusive"===i&&e.visible||(e.visible=!e.visible)}};_.vnodeSelector="calcite-list-item",e([t()],_.prototype,"activeItem",void 0),e([t()],_.prototype,"canMove",void 0),e([t()],_.prototype,"css",void 0),e([t()],_.prototype,"displayMode",void 0),e([t()],_.prototype,"dragEnabled",void 0),e([t()],_.prototype,"item",void 0),e([t()],_.prototype,"layerTablesEnabled",void 0),e([t()],_.prototype,"listModeDisabled",void 0),e([t()],_.prototype,"messages",void 0),e([t()],_.prototype,"messagesCommon",void 0),e([t()],_.prototype,"onAction",void 0),e([t()],_.prototype,"onPanelOpen",void 0),e([t()],_.prototype,"onCatalogOpen",void 0),e([t()],_.prototype,"onTablesOpen",void 0),e([t()],_.prototype,"onSelectedDragItemLayerUidChange",void 0),e([t()],_.prototype,"onTooltipReferenceChange",void 0),e([t()],_.prototype,"parent",void 0),e([t()],_.prototype,"parentTitles",void 0),e([t()],_.prototype,"rootGroupUid",void 0),e([t()],_.prototype,"selectionMode",void 0),e([t()],_.prototype,"selectedItems",void 0),e([t()],_.prototype,"selectedDragItemLayerUid",void 0),e([t()],_.prototype,"visibleElements",void 0),e([t()],_.prototype,"visibilityAppearance",void 0),e([t()],_.prototype,"_title",null),e([t()],_.prototype,"_renderedItemStatus",null),e([t()],_.prototype,"_renderedItemTemporaryIcon",null),e([t()],_.prototype,"_renderedItemToggle",null),e([t()],_.prototype,"_renderedPanel",null),e([t()],_.prototype,"_renderedPanelAction",null),e([t()],_.prototype,"_renderedActions",null),e([t()],_.prototype,"_renderedActionMenu",null),e([t()],_.prototype,"_renderedActionMenuContent",null),e([t()],_.prototype,"_renderedCatalogFootprintIcon",null),e([t()],_.prototype,"_renderedCatalogDynamicIcon",null),e([t()],_.prototype,"_renderedCatalogSelectNode",null),e([t()],_.prototype,"_renderedChildList",null),e([t()],_.prototype,"_hasTables",null),e([t()],_.prototype,"_renderedTablesItem",null),e([t()],_.prototype,"_renderedItemMessage",null),e([t()],_.prototype,"_singleAction",null),e([t()],_.prototype,"_filteredSections",null),e([t()],_.prototype,"_actionsCount",null),_=v=e([i("esri.widgets.LayerList.LayerListItem")],_);const I=_;export{I as default};
5
+ import{_ as e}from"../../chunks/tslib.es6.js";import{property as t}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/Logger.js";import"../../core/RandomLCG.js";import{subclass as i}from"../../core/accessorSupport/decorators/subclass.js";import{isLayerFromCatalog as n,isCatalogSublayer as o}from"../../layers/catalog/catalogUtils.js";import{getActionIcon as s,getActionStyles as a}from"../../support/actions/actionUtils.js";import l from"../Widget.js";import{getStatusIcon as r,getVisibilityIcon as c,listItemHasChildren as d,areChildrenHidden as p,canSortSublayers as m,getSingleAction as u,getItem as g}from"./support/layerListUtils.js";import{loadCalciteComponents as y}from"../support/componentsUtils.js";import{tsx as h}from"../support/jsxFactory.js";import{setFocus as b}from"../support/widgetUtils.js";var v;let _=v=class extends l{constructor(e){super(e),this.dragEnabled=!1,this.listModeDisabled=!1,this.parent=null,this.parentTitles=null,this.viewModel=null,this._onActionMenuOpen=e=>{this.item.actionsOpen=e.currentTarget.open},this._setTooltipReference=e=>{this.onTooltipReferenceChange?.(this.item.layer?.uid,e)},this._removeTooltipReference=()=>{this.onTooltipReferenceChange?.(this.item.layer?.uid,null)}}loadDependencies(){return y({"action-group":()=>import("@esri/calcite-components/dist/components/calcite-action-group"),"action-menu":()=>import("@esri/calcite-components/dist/components/calcite-action-menu"),action:()=>import("@esri/calcite-components/dist/components/calcite-action"),icon:()=>import("@esri/calcite-components/dist/components/calcite-icon"),"list-item":()=>import("@esri/calcite-components/dist/components/calcite-list-item"),list:()=>import("@esri/calcite-components/dist/components/calcite-list"),notice:()=>import("@esri/calcite-components/dist/components/calcite-notice")})}render(){const e=this.parentTitles??[],{_title:t,item:i,activeItem:n,selectionMode:o,selectedItems:s,messages:a,parent:l,css:r}=this,c="visibleAtCurrentTimeExtent"in i&&"layerInvisibleAtTime"in a&&!i.visibleAtCurrentTimeExtent?`${t} (${a.layerInvisibleAtTime})`:"visibleAtCurrentScale"in i&&"layerInvisibleAtScale"in a&&!i.visibleAtCurrentScale?`${t} (${a.layerInvisibleAtScale})`:t,d="parent"in i&&"catalog"===i.parent?.layer?.type,{layer:p}=i,m="visibleAtCurrentScale"in i&&!i.visibleAtCurrentScale||"visibleAtCurrentTimeExtent"in i&&!i.visibleAtCurrentTimeExtent;return h("calcite-list-item",{afterCreate:e=>this._focusSelectedDragEl(e,i),afterUpdate:e=>this._focusSelectedDragEl(e,i),class:this.classes(r.item,"itemActive"in r&&{[r.itemActive]:n===i}),"data-item":i,"data-layer-id":p?.id,dragDisabled:!i.sortable||d,id:p?.uid,key:`list-item-${p?.uid}`,label:t,metadata:{parentTitles:e,_title:t},open:"open"in i&&i.open,selected:"none"!==o&&s.includes(i),title:c,unavailable:m,value:p?.uid,onCalciteListItemSelect:e=>"visible"in i&&this._handleCalciteListItemSelect(e,i,l),onCalciteListItemToggle:e=>"open"in i&&this._handleCalciteListItemToggle(e,i)},this._renderedCatalogFootprintIcon,this._renderedCatalogDynamicIcon,this._renderedItemStatus,this._renderedItemToggle,this._renderedCatalogSelectNode,this._renderedItemTemporaryIcon,this._renderedChildList,this._renderedItemMessage,this._renderedPanel,this._renderedPanelAction,this._renderedActions)}get _title(){const{messages:e}=this;return this.item.title||("untitledTable"in e?e.untitledTable:e.untitledLayer)}get _renderedItemStatus(){const{item:e,parent:t,visibleElements:i,css:n}=this;if(!i.statusIndicators)return null;const{publishing:o}=e,s="updating"in e&&e.updating&&!t,a="connectionStatus"in e?e.connectionStatus:void 0,l=!!a;return h("calcite-icon",{class:this.classes(n.statusIndicator,{[n.publishing]:o},"updating"in n&&{[n.updating]:s},"connectionStatus"in n&&{[n.connectionStatus]:l},"connectionStatusConnected"in n&&{[n.connectionStatusConnected]:l&&"connected"===a}),icon:r({connectionStatus:a,publishing:o}),key:"layer-item-status",scale:"s",slot:"content-end"})}get _renderedItemTemporaryIcon(){const{item:e,visibleElements:t,css:i}=this,{layer:o}=e,s="temporaryLayerIndicators"in t&&t.temporaryLayerIndicators,a="temporaryTableIndicators"in t&&t.temporaryTableIndicators,l=o&&"persistenceEnabled"in o&&(n(o)||!o.persistenceEnabled);return(s||a)&&l?h("calcite-icon",{class:i.itemTemporaryIcon,icon:"temporary",key:"temporary-icon",scale:"s",slot:"content-start",title:this.messages.temporary}):null}get _renderedItemToggle(){const{item:e,parent:t,messages:i,visibilityAppearance:n,css:o}=this;if(!("visible"in e&&"layerVisibility"in i&&"visibleToggle"in o&&n))return null;const{visible:s}=e,a=t?.visibilityMode;if("inherited"===a)return null;const l=c({visible:s,exclusive:"exclusive"===a,visibilityAppearance:n}),r="checkbox"===n,d=i.layerVisibility;return h("calcite-action",{appearance:"transparent",class:o.visibleToggle,icon:r?l:void 0,key:"visibility-toggle",onclick:()=>this._toggleVisibility(e,t),scale:"s",slot:r?"actions-start":"actions-end",text:d,title:d},r?null:h("calcite-icon",{class:this.classes({[o.visibleIcon]:"exclusive"!==a&&s}),icon:l,scale:"s"}))}get _renderedPanel(){const{panel:e}=this.item;return!e?.open||e.disabled||e.flowEnabled?null:h("div",{class:this.css.itemContentBottom,key:`content-panel-${e.uid}`,slot:"content-bottom"},e.render())}get _renderedPanelAction(){const{panel:e}=this.item;if(!e?.visible)return null;const{open:t,title:i,disabled:n}=e;return h("calcite-action",{active:t,appearance:"transparent",disabled:n,icon:s(e),key:`action-${e.uid}`,onclick:()=>this._togglePanel(e),scale:"s",slot:"actions-end",text:i??"",title:i??void 0},this._renderFallbackIcon(e))}get _renderedActions(){switch(this._actionsCount){case 0:return null;case 1:return this._singleAction;default:return this._renderedActionMenu}}get _renderedActionMenu(){const{item:e,messagesCommon:t}=this,i=t.options;return h("calcite-action-menu",{appearance:"transparent",key:"item-action-menu",label:t.menu,open:e.actionsOpen,overlayPositioning:"fixed",placement:"bottom-end",scale:"s",slot:"actions-end",onCalciteActionMenuOpen:this._onActionMenuOpen},h("calcite-action",{appearance:"transparent",icon:"ellipsis",scale:"s",slot:"trigger",text:i,title:i}),this._renderedActionMenuContent)}get _renderedActionMenuContent(){return this._filteredSections.toArray().map((e=>h("calcite-action-group",{key:`action-section-${e.uid}`},e.toArray().map((e=>this._renderAction({action:e,textEnabled:!0}))))))}get _renderedCatalogFootprintIcon(){const{css:e}=this,t=this.item.layer,i="catalog-footprint"===t?.type,n="sublayer"===t?.type&&o(t,"footprints");return"itemCatalogIcon"in e&&(i||n)?h("calcite-icon",{class:e.itemCatalogIcon,icon:"footprint",key:"footprint",scale:"s",slot:"content-start"}):null}get _renderedCatalogDynamicIcon(){const{css:e}=this,t=this.item.layer,i="catalog-dynamic-group"===t?.type,n="sublayer"===t?.type&&o(t,"layers-in-view");return"itemCatalogIcon"in e&&(i||n)?h("calcite-icon",{class:e.itemCatalogIcon,icon:"catalog-dataset",key:"catalog-dataset",scale:"s",slot:"content-start"}):null}get _renderedCatalogSelectNode(){const{_title:e,item:t,visibleElements:i}=this;if(!("visible"in t))return;const{layer:n}=t,o="catalog-dynamic-group"===n?.type;return"catalogLayerList"in i&&i.catalogLayerList&&o?h("calcite-action",{appearance:"transparent",disabled:!n.visible,icon:"chevron-right",iconFlipRtl:!0,onclick:()=>this._triggerOnCatalogOpen(t),scale:"s",slot:"actions-end",text:e}):null}get _renderedChildList(){const{dragEnabled:e,item:t,rootGroupUid:i,listModeDisabled:n,selectionMode:o,displayMode:s}=this;if(!("visible"in t))return;const a=[...this.parentTitles??[],t.title],{children:l,layer:r}=t,c="catalog-dynamic-group"!==r?.type&&d(t),u=!n&&p(r),g="group"===r?.type;return c||!u&&!c&&e&&g?h("calcite-list",{canPull:e=>!!this.canMove&&this.canMove(e,"pull"),canPut:e=>!!this.canMove&&this.canMove(e,"put"),"data-item":t,"data-layer-type":i,displayMode:s,dragEnabled:!!e&&(t.childrenSortable&&m(t)),group:g?i:`${i}-${r?.uid}`,key:`child-list-${r?.uid}`,label:t.title,selectionAppearance:"border",selectionMode:o},l?.filter((e=>!e.hidden&&(this.visibleElements.errors||!e.error))).toArray().map((e=>this._renderItem(e,t,a))),this._renderedTablesItem):null}get _hasTables(){const{layerTablesEnabled:e}=this,t=this.item.layer;if(!e||!t)return!1;switch(t.type){case"knowledge-graph":return e.includes(t.type)&&!!t.tables?.length;case"map-image":case"tile":return e.includes(t.type)&&!!t.subtables?.length;default:return!1}}get _renderedTablesItem(){const{item:e,messages:t,css:i}=this,{layer:n}=e;return"itemTableIcon"in i&&"visible"in e&&"tables"in t&&this._hasTables?h("calcite-list-item",{class:i.item,"data-layer-id":n?.id,dragDisabled:!0,key:`list-item-table-list-tables-${n?.uid}`,label:t.tables,title:t.tables,onCalciteListItemSelect:()=>this._triggerOnTablesOpen(e)},h("calcite-icon",{class:i.itemTableIcon,icon:"table",scale:"s",slot:"content-start"}),h("calcite-icon",{flipRtl:!0,icon:"chevron-right",scale:"s",slot:"content-end"})):null}get _renderedItemMessage(){const{item:e,messages:t,css:i}=this;return e.error?h("div",{class:i.itemMessage,key:"esri-layer-list__error",slot:"content-bottom"},h("calcite-notice",{icon:"exclamation-mark-triangle",kind:"warning",open:!0,scale:"s",width:"full"},h("div",{slot:"message"},"tableError"in t?t.tableError:t.layerError))):"incompatible"in e&&e.incompatible&&"layerIncompatible"in t?h("div",{class:i.itemMessage,key:"esri-layer-list__incompatible",slot:"content-bottom"},h("calcite-notice",{afterCreate:this._setTooltipReference,afterRemoved:this._removeTooltipReference,bind:this,icon:"exclamation-mark-triangle",kind:"warning",open:!0,scale:"s",tabIndex:0,width:"full"},h("div",{slot:"message"},t.layerIncompatible))):null}get _singleAction(){return this._renderAction({action:u(this._filteredSections),textEnabled:!1})}get _filteredSections(){return this.item.actionsSections.map((e=>e.filter((e=>e.visible))))}get _actionsCount(){return this.item.actionsSections.reduce(((e,t)=>e+t.length),0)}_renderAction(e){const{item:t}=this,{action:i,textEnabled:n}=e;if(!i)return null;const{active:o,disabled:a,title:l,type:r,indicator:c}=i;return h("calcite-action",{active:"toggle"===r&&i.value,appearance:"transparent","data-action-id":i.id,disabled:a,icon:s(i),indicator:c,key:`action-${i.uid}`,loading:o,onclick:()=>this._triggerAction(t,i),scale:"s",slot:n?void 0:"actions-end",text:l??"",textEnabled:n,title:l??void 0},this._renderFallbackIcon(i))}_renderFallbackIcon(e){const{css:t}=this,{className:i,icon:n}=e;if(n)return null;const o="image"in e?e.image:void 0,s={[t.itemActionIcon]:!!i,[t.itemActionImage]:!!o};return i&&(s[i]=!0),o||i?h("span",{"aria-hidden":"true",class:this.classes(t.itemActionIcon,s),key:"icon",styles:a(o)}):null}_renderItem(e,t,i=[]){return h(v,{activeItem:this.activeItem,canMove:this.canMove,css:this.css,displayMode:this.displayMode,dragEnabled:this.dragEnabled,item:e,key:`layerListItem-${e.layer?.uid}`,layerTablesEnabled:this.layerTablesEnabled,listModeDisabled:this.listModeDisabled,messages:this.messages,messagesCommon:this.messagesCommon,parent:t,parentTitles:i,rootGroupUid:this.rootGroupUid,selectedDragItemLayerUid:this.selectedDragItemLayerUid,selectedItems:this.selectedItems,selectionMode:this.selectionMode,visibilityAppearance:this.visibilityAppearance,visibleElements:this.visibleElements,onAction:this.onAction,onCatalogOpen:this.onCatalogOpen,onPanelOpen:this.onPanelOpen,onSelectedDragItemLayerUidChange:this.onSelectedDragItemLayerUidChange,onTablesOpen:this.onTablesOpen,onTooltipReferenceChange:this.onTooltipReferenceChange})}_triggerAction(e,t){t&&e&&("toggle"===t.type&&(t.value=!t.value),this.onAction(t,e))}_triggerOnTablesOpen(e){e&&this.onTablesOpen&&this.onTablesOpen(e)}_triggerOnCatalogOpen(e){e&&this.onCatalogOpen?.(e)}_focusSelectedDragEl(e,t){this.selectedDragItemLayerUid===t.layer?.uid&&(b(e),this.onSelectedDragItemLayerUidChange?.(null))}_handleCalciteListItemToggle(e,t){e.stopPropagation(),t.open=e.target.open}_handleCalciteListItemSelect(e,t,i){g(e.target)===t&&"none"===this.selectionMode&&"inherited"!==i?.visibilityMode&&this._toggleVisibility(t,i)}_togglePanel(e){e.open=!e.open,e.open&&this.onPanelOpen()}_toggleVisibility(e,t){if(!e)return;const i=t?.visibilityMode;"exclusive"===i&&e.visible||(e.visible=!e.visible)}};_.vnodeSelector="calcite-list-item",e([t()],_.prototype,"activeItem",void 0),e([t()],_.prototype,"canMove",void 0),e([t()],_.prototype,"css",void 0),e([t()],_.prototype,"displayMode",void 0),e([t()],_.prototype,"dragEnabled",void 0),e([t()],_.prototype,"item",void 0),e([t()],_.prototype,"layerTablesEnabled",void 0),e([t()],_.prototype,"listModeDisabled",void 0),e([t()],_.prototype,"messages",void 0),e([t()],_.prototype,"messagesCommon",void 0),e([t()],_.prototype,"onAction",void 0),e([t()],_.prototype,"onPanelOpen",void 0),e([t()],_.prototype,"onCatalogOpen",void 0),e([t()],_.prototype,"onTablesOpen",void 0),e([t()],_.prototype,"onSelectedDragItemLayerUidChange",void 0),e([t()],_.prototype,"onTooltipReferenceChange",void 0),e([t()],_.prototype,"parent",void 0),e([t()],_.prototype,"parentTitles",void 0),e([t()],_.prototype,"rootGroupUid",void 0),e([t()],_.prototype,"selectionMode",void 0),e([t()],_.prototype,"selectedItems",void 0),e([t()],_.prototype,"selectedDragItemLayerUid",void 0),e([t()],_.prototype,"visibleElements",void 0),e([t()],_.prototype,"visibilityAppearance",void 0),e([t()],_.prototype,"_title",null),e([t()],_.prototype,"_renderedItemStatus",null),e([t()],_.prototype,"_renderedItemTemporaryIcon",null),e([t()],_.prototype,"_renderedItemToggle",null),e([t()],_.prototype,"_renderedPanel",null),e([t()],_.prototype,"_renderedPanelAction",null),e([t()],_.prototype,"_renderedActions",null),e([t()],_.prototype,"_renderedActionMenu",null),e([t()],_.prototype,"_renderedActionMenuContent",null),e([t()],_.prototype,"_renderedCatalogFootprintIcon",null),e([t()],_.prototype,"_renderedCatalogDynamicIcon",null),e([t()],_.prototype,"_renderedCatalogSelectNode",null),e([t()],_.prototype,"_renderedChildList",null),e([t()],_.prototype,"_hasTables",null),e([t()],_.prototype,"_renderedTablesItem",null),e([t()],_.prototype,"_renderedItemMessage",null),e([t()],_.prototype,"_singleAction",null),e([t()],_.prototype,"_filteredSections",null),e([t()],_.prototype,"_actionsCount",null),_=v=e([i("esri.widgets.LayerList.LayerListItem")],_);const I=_;export{I as default};
package/widgets/Locate.js CHANGED
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.32/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../chunks/tslib.es6.js";import{property as o}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/Logger.js";import"../core/RandomLCG.js";import{subclass as t}from"../core/accessorSupport/decorators/subclass.js";import i from"./Widget.js";import s from"./Locate/LocateViewModel.js";import{loadCalciteComponents as r}from"./support/componentsUtils.js";import{globalCss as l}from"./support/globalCss.js";import"./support/widgetUtils.js";import{messageBundle as n}from"./support/decorators/messageBundle.js";import{vmEvent as a}from"./support/decorators/vmEvent.js";import{tsx as c}from"./support/jsxFactory.js";const p={base:"esri-locate"};let d=class extends i{constructor(e,o){super(e,o),this.messages=null,this.messagesCommon=null,this.viewModel=new s,this._locate=()=>{const{viewModel:e}=this;"locating"===e.state?e.cancelLocate():e.locate().catch((()=>{}))}}loadDependencies(){return r({button:()=>import("@esri/calcite-components/dist/components/calcite-button"),loader:()=>import("@esri/calcite-components/dist/components/calcite-loader"),tooltip:()=>import("@esri/calcite-components/dist/components/calcite-tooltip")})}get geolocationOptions(){return this.viewModel.geolocationOptions}set geolocationOptions(e){this.viewModel.geolocationOptions=e}get goToLocationEnabled(){return this.viewModel.goToLocationEnabled}set goToLocationEnabled(e){this.viewModel.goToLocationEnabled=e}get goToOverride(){return this.viewModel.goToOverride}set goToOverride(e){this.viewModel.goToOverride=e}get graphic(){return this.viewModel.graphic}set graphic(e){this.viewModel.graphic=e}get icon(){return"gps-off"}set icon(e){this._overrideIfSome("icon",e)}get label(){return this.messages?.widgetLabel??""}set label(e){this._overrideIfSome("label",e)}get popupEnabled(){return this.viewModel.popupEnabled}set popupEnabled(e){this.viewModel.popupEnabled=e}get scale(){return this.viewModel.scale}set scale(e){this.viewModel.scale=e}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}cancelLocate(){this.viewModel.cancelLocate()}locate(){return this.viewModel.locate()}render(){const{viewModel:e,icon:o}=this,{state:t}=e,i="locating"===t,s=i?this.messagesCommon.cancel:this.messages.title,r="feature-unsupported"===t,n=this._localizeError(this.viewModel?.error);return c("div",{class:this.classes(p.base,l.widget)},!r&&c("calcite-button",{class:l.widgetButton,disabled:"disabled"===t,iconStart:i?void 0:o,kind:"neutral",label:s,onclick:this._locate,title:s},i?c("calcite-loader",{inline:!0,label:""}):null),n?c("calcite-tooltip",{open:!0,overlayPositioning:"fixed",referenceElement:this.container},n):null)}_localizeError(e){return e instanceof GeolocationPositionError?e.code===GeolocationPositionError.PERMISSION_DENIED?this.messages?.permissionError:e.code===GeolocationPositionError.TIMEOUT?this.messages?.timeoutError:this.messages?.positionUnavailable:e instanceof Error?e.message:void 0}};e([o()],d.prototype,"geolocationOptions",null),e([o()],d.prototype,"goToLocationEnabled",null),e([o()],d.prototype,"goToOverride",null),e([o()],d.prototype,"graphic",null),e([o()],d.prototype,"icon",null),e([o()],d.prototype,"label",null),e([o(),n("esri/widgets/Locate/t9n/Locate")],d.prototype,"messages",void 0),e([o(),n("esri/t9n/common")],d.prototype,"messagesCommon",void 0),e([o()],d.prototype,"popupEnabled",null),e([o()],d.prototype,"scale",null),e([o()],d.prototype,"view",null),e([o({type:s}),a(["locate","locate-error"])],d.prototype,"viewModel",void 0),d=e([t("esri.widgets.Locate")],d);const m=d;export{m as default};
5
+ import{_ as e}from"../chunks/tslib.es6.js";import{property as o}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/Logger.js";import"../core/RandomLCG.js";import{subclass as t}from"../core/accessorSupport/decorators/subclass.js";import i from"./Widget.js";import s from"./Locate/LocateViewModel.js";import{loadCalciteComponents as r}from"./support/componentsUtils.js";import{globalCss as l}from"./support/globalCss.js";import"./support/widgetUtils.js";import{messageBundle as n}from"./support/decorators/messageBundle.js";import{vmEvent as a}from"./support/decorators/vmEvent.js";import{tsx as c}from"./support/jsxFactory.js";const p={base:"esri-locate"};let d=class extends i{constructor(e,o){super(e,o),this.messages=null,this.messagesCommon=null,this.viewModel=new s,this._locate=()=>{const{viewModel:e}=this;"locating"===e.state?e.cancelLocate():e.locate().catch((()=>{}))}}loadDependencies(){return r({button:()=>import("@esri/calcite-components/dist/components/calcite-button"),loader:()=>import("@esri/calcite-components/dist/components/calcite-loader"),tooltip:()=>import("@esri/calcite-components/dist/components/calcite-tooltip")})}get geolocationOptions(){return this.viewModel.geolocationOptions}set geolocationOptions(e){this.viewModel.geolocationOptions=e}get goToLocationEnabled(){return this.viewModel.goToLocationEnabled}set goToLocationEnabled(e){this.viewModel.goToLocationEnabled=e}get goToOverride(){return this.viewModel.goToOverride}set goToOverride(e){this.viewModel.goToOverride=e}get graphic(){return this.viewModel.graphic}set graphic(e){this.viewModel.graphic=e}get icon(){return"gps-off"}set icon(e){this._overrideIfSome("icon",e)}get label(){return this.messages?.widgetLabel??""}set label(e){this._overrideIfSome("label",e)}get popupEnabled(){return this.viewModel.popupEnabled}set popupEnabled(e){this.viewModel.popupEnabled=e}get scale(){return this.viewModel.scale}set scale(e){this.viewModel.scale=e}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}cancelLocate(){this.viewModel.cancelLocate()}locate(){return this.viewModel.locate()}render(){const{viewModel:e,icon:o}=this,{state:t}=e,i="locating"===t,s=i?this.messagesCommon.cancel:this.messages.title,r="feature-unsupported"===t,n=this._localizeError(this.viewModel?.error);return c("div",{class:this.classes(p.base,l.widget)},!r&&c("calcite-button",{class:l.widgetButton,disabled:"disabled"===t,iconStart:i?void 0:o,kind:"neutral",label:s,onclick:this._locate,title:s},i?c("calcite-loader",{inline:!0,label:""}):null),n?c("calcite-tooltip",{open:!0,overlayPositioning:"fixed",placement:this._getPlacement(),referenceElement:this.container},n):null)}_getPlacement(){const{container:e,view:o}=this,t=e&&o?o.ui.getPosition(e):null;if(!t||"manual"===t)return"auto";const[i,s]=t.split("-");return`${"right"===s?"left":"right"}-${"bottom"===i?"end":"start"}`}_localizeError(e){return e instanceof GeolocationPositionError?e.code===GeolocationPositionError.PERMISSION_DENIED?this.messages?.permissionError:e.code===GeolocationPositionError.TIMEOUT?this.messages?.timeoutError:this.messages?.positionUnavailable:e instanceof Error?e.message:void 0}};e([o()],d.prototype,"geolocationOptions",null),e([o()],d.prototype,"goToLocationEnabled",null),e([o()],d.prototype,"goToOverride",null),e([o()],d.prototype,"graphic",null),e([o()],d.prototype,"icon",null),e([o()],d.prototype,"label",null),e([o(),n("esri/widgets/Locate/t9n/Locate")],d.prototype,"messages",void 0),e([o(),n("esri/t9n/common")],d.prototype,"messagesCommon",void 0),e([o()],d.prototype,"popupEnabled",null),e([o()],d.prototype,"scale",null),e([o()],d.prototype,"view",null),e([o({type:s}),a(["locate","locate-error"])],d.prototype,"viewModel",void 0),d=e([t("esri.widgets.Locate")],d);const m=d;export{m as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.32/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../chunks/tslib.es6.js";import"../../geometry.js";import t from"../../Graphic.js";import"../../symbols.js";import{isSome as i,equals 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 l from"../../core/Evented.js";import c from"../../core/JSONSupport.js";import{equalsShallow as h}from"../../core/lang.js";import p from"../../core/Logger.js";import{clamp as u}from"../../core/mathUtils.js";import{abortMaybe as d,destroyMaybe as m}from"../../core/maybe.js";import g from"../../core/Promise.js";import{isAbortError as y,throwIfAborted as f,waitTick as v}from"../../core/promiseUtils.js";import w from"../../core/ReactiveMap.js";import{on as b,watch as F,syncAndInitial as _,initial as P}from"../../core/reactiveUtils.js";import{sqlAnd as I}from"../../core/sql.js";import{getMetersPerUnitForSR as S}from"../../core/unitUtils.js";import{property as C}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import{subclass as k}from"../../core/accessorSupport/decorators/subclass.js";import{UpdatingHandles as V}from"../../core/support/UpdatingHandles.js";import{union as A}from"../../geometry/geometryEngineAsync.js";import{projectWithZConversion as M}from"../../geometry/projection.js";import{isClockwise as R}from"../../geometry/support/coordsUtils.js";import{geographicToWebMercator as O}from"../../geometry/support/webMercatorUtils.js";import j from"../../layers/GraphicsLayer.js";import{searchImages as L}from"../../layers/orientedImagery/queries.js";import{calculateSuitabilities as z}from"../../layers/orientedImagery/core/bestImageUtils.js";import{createCoveragePolygon as B,computePolygonForInspection as G,resizePolygon as x,checkIfPolygonContainsSelectedPoint as E}from"../../layers/orientedImagery/core/coverageUtils.js";import{isConstantElevation as H,isElevationSource as T}from"../../layers/orientedImagery/core/ElevationSourceDefinitions.js";import{imageToWorld as D,imageToWorldPanoramic as U}from"../../layers/orientedImagery/transformations/imageToWorld.js";import N from"../../layers/orientedImagery/transformations/updateElevation.js";import{getElevationSampler as W}from"../../layers/orientedImagery/transformations/updateElevationUtils.js";import{getInitialAngle as q,convertPixelToHeadingPitch as $,getImageToWorldProperties as J,getUpdateElevationProps as Z,isElevationSampler as K,pointToArray as Q,getImageToWorldPanoramicProperties as X,getWorldToImageProperties as Y,convertHeadingPitchToSphereVertex as ee,or as te}from"../../layers/orientedImagery/transformations/utils.js";import{worldToImagePanoramic as ie,worldToImage as re}from"../../layers/orientedImagery/transformations/worldToImage.js";import{getFloorFilterClause as ae}from"../../layers/support/floorFilterUtils.js";import se from"../../rest/support/AttachmentQuery.js";import{scale as oe}from"../../views/draw/support/drawUtils.js";import{ViewEventPriorities as ne}from"../../views/input/InputManager.js";import le from"../PanoramicViewer.js";import{invalidCameraHeading as ce,sectorsInOrder as he,sectorsRadii as pe}from"./constants.js";import{crossSymbol as ue,crossSymbol3D as de,measurementPolygonSymbol as me,measurementPolylineSymbol as ge,sourcePointSymbol as ye,diamondSymbol as fe,diamondSymbol3D as ve,activeSourcePointSymbol as we}from"./symbols.js";import{isNoAttachmentError as be,getContentType as Fe,isTifOrMrf as _e,filterOILLayerView as Pe,isSceneView as Ie,isGraphic as Se,calculateSegment as Ce,calculateDirection as ke}from"./utils.js";import Ve from"./components/ImageViewer.js";import Ae from"../../geometry/Point.js";import Me from"../../geometry/SpatialReference.js";import Re from"../../symbols/SimpleLineSymbol.js";import Oe from"../../geometry/Multipoint.js";import je from"../../geometry/Polyline.js";import Le from"../../geometry/Polygon.js";const ze={click:"view-click",imageClick:"image-click",interactionHandles:"interaction-handles",footprintHandles:"footprint-handles",sketchHandles:"sketch-handles"},Be=new Set(["JPG","JPEG"]),Ge=/\.(\w+)$/,xe=e=>"FA"===e,Ee=()=>new n("orientedimageryviewer:sketch-not-initialized","Sketch property is not initialized, call loadSketch first");let He=class extends(l.EventedMixin(g)){constructor(e){super(e),this.additionalFeatures=new s,this.additionalCameraLocations=new s,this.additionalFootprints=new s,this.areaMeasurementResult=0,this.bestFeatureAngle=0,this.bestFeatureCurrentFootprint=null,this.bestFeatureFootprint=null,this.conversionProps=null,this.coverageFrustums=new s,this.coveragePolygons=new s,this.currentBestFeature=null,this.currentBestFeatureLocation=null,this.currentCoverageVisible=!0,this.determineWorkflowForFeature=async(e,t,i)=>{const{currentBestFeature:r,selectedPoint:a,view:s}=this;if(s?.closePopup(),r&&a){this._initialCurrentCoverageUpdate=!0;try{await this._updatePointsAndPolygons(i),await this._loadImage(i)}catch(o){y(o)||(this.loadImageError(o),p.getLogger(this).error("#loadIImage()","error occured while loading image",o))}}},this.disabled=!1,this.displayMessage={key:"onLoadMessage",type:"info"},this.displayNewMeasurementButton=!0,this.displayNewAreaMeasurementButton=!0,this.distanceMeasurementResult=0,this.digitizationLayer=null,this.features=new s,this.isAdditionalCoverageVisible=!1,this.isAdditionalPointSourcesVisible=!1,this.layer=null,this.localPort=null,this.mapImageConversionToolState=!1,this.navigatorCurrentBestFeature=null,this.overlayedCameraLocations=new s,this.overlayedMapFeatures=new w,this.pointSources=new s,this.previousFeatureAngle=0,this.selectedPoint=null,this.shouldShowSelectedImage=!1,this.sketch=null,this.sketchAdapter=null,this.updateFootprint=async(e,t)=>{"image-loaded"===this.state&&await(this._adapter?.updateFootprint(e,t))},this.updateFootprintPanorama=async(e,t)=>{await(this._adapter?.updateFootprintPanorama(e,t))},this._adapter=null,this._highlightedFeatureHandle=null,this._imageViewer=new Ve,this._initialCurrentCoverageUpdate=!0,this._overlays=new j({listMode:"hide",internal:!0,elevationInfo:{mode:"absolute-height"}}),this._panoramicViewer=new le,this._referencePointOnGround=null,this._referencePointOnImage=null,this._sectorData=null,this._updatingHandles=new V,this._clickTask=null,this._crossSymbol=null,this.footprintExtent=null,this._featureChangedTask=null,this._openPopupTask=null,this._suitabilities=null,this._transformController=new AbortController,this._updateFootprintTask=null,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.loadDigitizationAdapter=async e=>{const{sketchAdapter:t}=this;if(await this.loadSketch(e),"digitization"===t?.type)return t;const i=import("./adapters/sketch/DigitizationAdapter.js");this._updatingHandles.addPromise(i);const{default:r}=await i;return f(e),this.sketchAdapter=new r({viewModel:this}),this.sketchAdapter},this.loadImageFromSource=async(e,t)=>this._updatingHandles.addPromise(this._loadImageFromSourceInternal(e,t)),this.loadImageViewer=e=>{this._imageViewer.container=e},this.loadPanoramicViewer=e=>{this._panoramicViewer.container=e},this.removeHighlight=()=>this._highlightedFeatureHandle?.remove(),this.revealImageGeometry=e=>{},this.startDigitization=e=>{},this.stopDigitization=e=>{},this.toggleImageAttributes=()=>{d(this._openPopupTask),this._openPopupTask=a((async e=>{const{currentBestFeature:i,popupEnabled:r,layer:a,view:s}=this;if(s?.closePopup(),!(s&&i&&r&&a))return;const{attributes:o,geometry:n}=i,l=new t({geometry:n,attributes:o.toJSON(),layer:a});f(e),await s.openPopup({features:[l],location:o.location.clone()})}))},this._createViewClickHandle=()=>{if(this.removeHandles(ze.click),"disabled"===this.state||null==this.view)return;const e=this.mapImageConversionToolState&&"image-loaded"===this.state?this._mapImageConversionToolViewClickHandler:this._viewClickHandler;this.addHandles(this.view.on("click",e,ne.WIDGET),ze.click)},this._createImageClickHandle=()=>{this.removeHandles(ze.imageClick);const{mapImageConversionToolState:e,mode:t,activeViewer:i,currentBestFeature:r,footprintExtent:s}=this,o=i?.imageSize;if(!(e&&"none"!==t&&o&&s&&r))return;i.clickAction="pixel-location";let n=null;const l=b((()=>i),"pixel-location",(e=>{this.plotReferencePointOnImage(e),n?.abort(),n=a((async i=>{if(!e)return;const a=await this.getMapPoint(e,{feature:r,imageSize:o,mode:t}).then((e=>{const t=this.view?.spatialReference;return te(!t,e.spatialReference.equals(t))?e:M(e,t)}));f(i),this.plotReferencePointOnGround(a)}))}));this.addHandles(l,ze.imageClick)},this._getImageSourceFromAttachment=async(e,t,i)=>{const r=new se({objectIds:[t]}),a=await e.queryAttachments(r,i),s=a[`${t}`]?.[0],o=s?.url;if(!o)throw new n("NoAttachmentError","no attachments found",{[e.objectIdField]:t,layer:e});return{datasetFormat:s.contentType.split("/")[1].toUpperCase(),url:o}},this._loadImage=async e=>{const{currentBestFeature:t,layer:i,mode:r}=this;if(this.clearGraphics(),!i||!t||"none"===r)return;const{attributes:a}=t,{imagePath:s,imageRotation:o,cameraHeading:n,cameraRoll:l,cameraPitch:c,objectId:h,cameraOrientation:u,location:d}=a,m=(l??0)+(o??0),g=d.spatialReference.isWGS84&&4!==u?.type?O(d):new Ae(d);let v=s;if(xe(s))try{v=await this._getImageSourceFromAttachment(i,h,e)}catch(w){if(y(w))return;return be(w)?(p.getLogger(this).error(w),void this.setMessage("noAttachment","error",`${i.objectIdField}: ${h}`)):(p.getLogger(this).error(w,{[i.objectIdField]:h,layer:i}),void this.setMessage("imageLoadError","error",`query-attachments-failed:${i.objectIdField} ${h}`))}try{await this.loadImageFromSource(v,{imageRotation:m,options:e,pitch:c,yaw:n,mode:r,cameraLocation:g}),f(e),await this.transformAndPlotSelectedLocation(e)}catch(w){y(w)||this.loadImageError(w)}},this._loadImageFromSourceInternal=async(e,t)=>{const{mode:i,imageRotation:r,options:a}=t,s="string"==typeof e,o=s?e:e.url,{pathname:n,searchParams:l}=new URL(o);let c=s?n.match(Ge)?.[1]:e.datasetFormat;if(!c){const e=await Fe(o,{...t.options});c=e?.split("/")[1]??"UNKNOWN FORMAT"}switch(i){case"default":this._imageViewer.imageSource={datasetFormat:c.toUpperCase(),url:o.split("?")[0]},this._imageViewer.customParameters=Object.fromEntries(l),this._imageViewer.imageRotation=r??0,await this._imageViewer.loadImage(a);break;case"panoramic":if(Be.has(c.toUpperCase())){const{selectedPoint:e}=this,{pitch:i,yaw:r,cameraLocation:s,viewAngle:n}=t;this._panoramicViewer.imageSource=o;let l=r??0;"number"==typeof n?l=n-l:s&&e&&(l=await q(s,e)-l),this._panoramicViewer.pitch=i??0,this._panoramicViewer.yaw=l,await this._panoramicViewer.loadImage(a)}else this.setMessage("unsupportedPanoramicImageryError","error",void 0,{datasetFormat:c});break}},this._loadViewAdapter=async e=>{const{view:t}=this;if(t)switch(t.type){case"2d":{const{default:t}=await import("./adapters/view/MapViewAdapter.js");f(e),this._adapter=new t(this);break}case"3d":{const{default:t}=await import("./adapters/view/SceneViewAdapter.js");f(e),this._adapter=new t(this);break}}else this._adapter=null},this._mapImageConversionToolViewClickHandler=e=>{e.stopPropagation(),e.preventDefault(),e.mapPoint&&this.plotMapPoint(e.mapPoint)},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(),this._updatingHandles.addPromise(this.loadBestImage(a,{signal:t}))}))},this.plotSelectedPointOnImage=async(e,i)=>{if(await v(i),!e)return;const r=new Ae({...c.isSerializable(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:ue}),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}=$(e,r,a),n=ee(s,o);this._crossSymbol=new t({geometry:new Ae(n,Me.WebMercator),symbol:de}),this._panoramicViewer.addGraphic(this._crossSymbol,0)}},this.handleSectorClick=this.handleSectorClick.bind(this),this.searchBestImage=this.searchBestImage.bind(this),this.transformAndPlotReferencePointOnImage=this.transformAndPlotReferencePointOnImage.bind(this),this.updateSuitabilities=this.updateSuitabilities.bind(this),this.selectBestFeature=this.selectBestFeature.bind(this)}initialize(){this.addHandles([F((()=>this.view),(()=>{this.load()}),_),F((()=>this.view?.map),((e,t)=>{t?.layers.remove(this._overlays),e?.layers.add(this._overlays)}),P),F((()=>this.view?.map?.allLayers?.length),(e=>{e&&this.view?.map?.layers.reorder(this._overlays,e-1)}),P),F((()=>[this.state,this.mapImageConversionToolState,this.view]),(()=>{this._createViewClickHandle(),this._createImageClickHandle()}),_),F((()=>this.bestFeatureAngle),((e,t)=>{this.previousFeatureAngle=t??0}),_),F((()=>this.currentBestFeature),(async(e,t)=>{d(this._featureChangedTask),this._featureChangedTask=a((async i=>this.determineWorkflowForFeature.apply(this,[e,t,{signal:i}]))),await this._featureChangedTask.promise}),{sync:!0}),F((()=>this.mode),(e=>{switch(this.removeHandles(ze.interactionHandles),e){case"default":this.addHandles(F((()=>this._imageViewer.imagePointsInView),(e=>{e&&(d(this._updateFootprintTask),this._updateFootprintTask=a((async t=>{await this.updateFootprint(e,{signal:t})})))}),{..._,equals:(e,t)=>r(e,t,h)}),ze.interactionHandles);break;case"panoramic":this.addHandles(F((()=>{const{currentBestFeature:e,state:t}=this,{imageSize:i,vfov:r,hfov:a,pitch:s,yaw:o}=this._panoramicViewer;return e&&i&&"image-loading"!==t?[r,a,o,s]:null}),(e=>{if(!e||"image-loading"===this.state)return;const[t,i,r,s]=e;d(this._updateFootprintTask),this._updateFootprintTask=a((async e=>{await this.updateFootprintPanorama({verticalFieldOfView:t,horizontalFieldOfView:i,yaw:r,pitch:s},{signal:e})}))}),{..._,equals:(e,t)=>r(e,t,h)}),ze.interactionHandles)}}),_),F((()=>[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)}),_),F((()=>this.activeViewer?.imageRenderer),(()=>{this.sketch&&(this.sketch.view=this.activeViewer?.imageRenderer)}))]),this.when().finally((()=>{this.notifyChange("state")}))}destroy(){this._updateFootprintTask=d(this._updateFootprintTask),this._clickTask=d(this._clickTask),this.coverageFrustums.destroy(),this.coveragePolygons.destroy(),this.pointSources.destroy(),this.additionalFootprints.destroy(),this.additionalCameraLocations.destroy(),this.bestFeatureFootprint=m(this.bestFeatureFootprint),this.bestFeatureCurrentFootprint=m(this.bestFeatureCurrentFootprint),this._crossSymbol=m(this._crossSymbol),this._referencePointOnGround=m(this._referencePointOnGround),this._referencePointOnImage=m(this._referencePointOnImage),this._overlays&&this.view?.map?.remove(this._overlays),this._overlays.destroy(),this._imageViewer.destroy(),this._panoramicViewer.destroy()}get activeLayer(){return o(p.getLogger(this),"activeLayer",{replacement:"layer"}),this.layer}set activeLayer(e){o(p.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 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 featureCount(){return this.features?.length??0}get imageGalleryEnabled(){return _e(this.currentBestFeature?.attributes.imagePath.trim())}get imageLoaded(){return o(p.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===ce}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(Pe(e))}get layerFloorFilterClause(){const{layerView:e}=this;return e?ae(e):null}get mode(){const e=this.currentBestFeature?.attributes;if(!e)return"none";const{horizontalFieldOfView:t,isSpherical:i}=e;return 360===t||i?"panoramic":"default"}get popupEnabled(){return!0===this.layer?.popupEnabled}get referencePoint(){return this._referencePointOnGround?.geometry}get sectorData(){const{_sectorData:e}=this;return e?he.map((t=>e[t])):null}get sharpness(){return this._get("sharpness")??0}set sharpness(e){this._set("sharpness",u(e,0,1))}get sketchGraphicsLayer(){return this.sketch?.layer}get state(){const{mode:e,disabled:t}=this;if(t)return"disabled";if(!this.isFulfilled())return"loading";if(this.isRejected())return"error";if(this._updatingHandles.updating)return"image-loading";if("error"===this.displayMessage?.type)return"image-load-error";switch(e){case"default":return this._imageViewer.state;case"panoramic":return this._panoramicViewer.state}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 _e(a)?{url:a,objectId:t,rotation:(i??0)+(r??0)}:null})).filter(i)):null}set view(e){this._set("view",e)}get _overlaysView(){return this.view?.layerViews.find((({layer:e})=>e===this._overlays))}digitizeCancel(){return this.sketch?.cancel()}digitizeCanRedo(){return this.sketch?.canRedo()??!1}digitizeCanUndo(){return this.sketch?.canUndo()??!1}digitizeComplete(){return this.sketch?.complete()}digitizeCreate(e,t){const{sketch:i}=this;return i?i.create(e,t):Promise.reject(Ee())}async digitizeDelete(){if(!this.sketch)throw Ee();return this.sketch.delete()}digitizeDuplicate(){if(!this.sketch)throw Ee();return this.sketch.duplicate()}digitizePlace(e,t){if(!this.sketch)throw Ee();return this.sketch.place(e,t)}digitizeRedo(){if(!this.sketch)throw Ee();return this.sketch.redo()}digitizeUndo(){if(!this.sketch)throw Ee();return this.sketch.undo()}digitizeUpdate(e,t){if(!this.sketch)throw Ee();return this.sketch.update(e,t)}filterByFootprints(e,t){const i=[],r=[],a=[];return e.forEach((e=>{const{layer:{coveragePercent:s},attributes:o}=e;let n;const l=S(e.geometry.spatialReference);o.cameraHeight/=l,o.farDistance/=l,o.nearDistance/=l,H(o.elevationSource)&&(o.elevationSource.constantElevation/=l);const{polygon:c,frustum:h}=B(o);if(n=c.clone(),o.isInspection&&(n=G(o)),s&&(n=x(n,s)),E(n,t)){a.push(e);const{geometry:t,objectId:s,cameraHeight:n,cameraHeading:l}=o,p=t.clone();p.z=n,p.imageID=s,this.pointSources.push(p),l!==ce&&(i.push(c),h&&r.push(h))}})),{features:a,polygons:i,frustums:r}}getMeasurementProperties(){const{currentBestFeature:e,activeViewer:t}=this;if(!e||!t?.imageSize)return;const{elevationSample:i,attributes:r}=e,{elevationSource:a,cameraHeight:s}=r,o=J(r,t.imageSize[0],t.imageSize[1]);let n=o.cameraLocation;return(n.spatialReference.isGeographic?M(n,Me.WebMercator):Promise.resolve(n)).then((e=>(n=e,Z((n.z??0)-s,{elevationSample:i,elevationSource:a,extent:this.footprintExtent})))).then((t=>("elevationSample"in t&&K(t.elevationSample)&&(e.elevationSample=t.elevationSample),{...o,cameraLocation:n,updateElevationProps:t})))}async deleteDigitizedFeatures(e){const{digitizationLayer:t}=this;if(!t)throw new n("Digitization 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?.[he[e]];t?.length&&this._updateCurrentBestFeature(t.at(0))}handleFeatureClick(e){const{sector:t,featureIndexInSector:i}=e;if(isNaN(i))return;const r=this._sectorData?.[t];r?.length&&this._updateCurrentBestFeature(r.at(i))}async load(e){return this.addResolvingPromise(this._loadViewAdapter(e).catch((e=>{if(!y(e))throw e}))),this}async loadBestImage(e,t){return this.view?.closePopup(),this.displayMessage=null,this.selectedPoint=e.spatialReference.isGeographic?O(e):e.clone(),this.features.removeAll(),this.currentBestFeature=null,this.additionalFeatures.removeAll(),this.additionalFootprints.removeAll(),this.additionalCameraLocations.removeAll(),this.bestFeatureCurrentFootprint=m(this.bestFeatureCurrentFootprint),this._overlays?.removeAll(),this._fetchFeaturesWithController(e,t)}loadImageError(e){p.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");this._updatingHandles.addPromise(t);const{default:i}=await t;f(e),this.sketch=new i({layer:new j,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 loadSketchAdapter(e){if(!this.sketchAdapter){const t=import("./adapters/sketch/MeasurementAdapter.js");this._updatingHandles.addPromise(t);const{default:i}=await t;if(f(e),this.sketchAdapter=new i({viewModel:this}),!this.sketchAdapter.viewModel.isResolved())return}if(this.sketch&&this.sketchAdapter){const e=this.activeViewer?.imageRenderer.effectiveTheme.accentColor;e&&this.sketch&&(this.sketch.polygonSymbol=me(e),this.sketch.polylineSymbol=ge(e))}return this.sketchAdapter}async overlayCameraLocations(e){const{activeViewer:i,currentBestFeature:r,overlayedCameraLocations:a,layer:s,mode:o,state:n}=this,l=i?.imageSize;if(!l||!r||!s||"none"===o||n.includes("loading"))return;const{polygon:c}=B(r.attributes);if(i.removeManyGraphics(a.toArray()),a.removeAll(),e){const{features:e}=await s.queryFeatures({where:`${s.objectIdField} <> ${r.attributes.objectId}`,geometry:c,returnGeometry:!0,outFields:[s.objectIdField]}),n=await Promise.all(e.map((async e=>{const{attributes:i,geometry:a}=e,s=await this.getPixels(a,{feature:r,imageSize:l,mode:o}),n=ye.clone();return n.outline=new Re({color:[0,0,0],width:1}),new t({attributes:i,symbol:n,geometry:s})})));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,r=!1){const{activeViewer:a,currentBestFeature:o,mode:n,state:l}=this,c=a?.imageSize;if(!c||!o||"none"===n||l.includes("loading"))return;const{polygon:h}=B(o.attributes),{features:p}=await e.queryFeatures({geometry:h,returnGeometry:!0,outFields:[e.objectIdField]}),u=new s((await Promise.all(p.map((async i=>{const{attributes:a,geometry:s}=i,l=i.symbol?.clone()??e.renderer?.getSymbol(i)?.clone();switch(s?.type){case"point":{const i=await this.getPixels(s,{feature:o,imageSize:c,mode:n});return new t({attributes:a,layer:e,symbol:l,geometry:i,visible:e.visible&&r})}case"polygon":{const{rings:i,spatialReference:h}=s,p=i.map((e=>e.map((([e,t,i])=>new Ae({x:e,y:t,z:i,spatialReference:h}))))),u=await Promise.all(p.map((async e=>this.getPixels(e,{feature:o,imageSize:c,mode:n}).then((e=>e.map(Q))))));return new t({attributes:a,layer:e,symbol:l,geometry:new Le({rings:u,spatialReference:Me.WebMercator}),visible:e.visible&&r})}case"polyline":{const{paths:i,spatialReference:h}=s,p=i.map((e=>e.map((([e,t,i])=>new Ae({x:e,y:t,z:i,spatialReference:h}))))),u=await Promise.all(p.map((async e=>this.getPixels(e,{feature:o,imageSize:c,mode:n}).then((e=>e.map(Q))))));return new t({attributes:a,layer:e,symbol:l,geometry:new je({paths:u,spatialReference:Me.WebMercator}),visible:e.visible&&r})}case"multipoint":{const{points:i,spatialReference:h}=s,p=i.map((([e,t,i])=>new Ae({x:e,y:t,z:i,spatialReference:h}))),u=await this.getPixels(p,{feature:o,imageSize:c,mode:n}).then((e=>e.map(Q)));return new t({attributes:a,layer:e,symbol:l,geometry:new Oe({points:u,spatialReference:Me.WebMercator}),visible:e.visible&&r})}}return null})))).filter(i));this.overlayGraphicsOnImage(`${e.id}`,u)}async getPixels(e,t){const{imageSize:i,mode:r}=t,a=(await this.worldToImage(Array.isArray(e)?e:[e])).map((e=>{if("default"===r)return new Ae({x:e.x-.5,y:.5-e.y,spatialReference:Me.WebMercator});const[t,a]=i,{heading:s,pitch:o}=$(e,t,a),n=ee(s,o);return new Ae(n,Me.WebMercator)}));return Array.isArray(e)?a:a[0]}async getMapPoint(e,t){const{feature:i,mode:r,imageSize:a}=t,{elevationSample:s,attributes:o}=i,{elevationSource:n,location:l,elevation:c,cameraHeight:h}=o;let p=l.clone();p.spatialReference.isGeographic&&(p=await M(p,Me.WebMercator));const u=await Z(c??(l.z??0)-h,{elevationSample:s,elevationSource:n,extent:this.footprintExtent});let d;if("elevationSample"in u&&K(u.elevationSample)&&(i.elevationSample=u.elevationSample),"default"===r){const t=J(o,a[0],a[1]);d=await D(Array.isArray(e)?e:[e],{...t,cameraLocation:p},u)}else{const t=X(o,a[0],a[1]);d=await U(Array.isArray(e)?e:[e],{...t,cameraLocation:p},u)}return Array.isArray(e)?d:d[0]}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 Ae({...e.toJSON()}),symbol:fe}),this.view?this._overlays?.add(this._referencePointOnGround):this.emit("plot-ground-point",{data:{point:this._referencePointOnGround?.geometry}}))}plotReferencePointOnImage(e){if("image-loaded"===this.state)switch(this.clearReferencePointOnImage(),this.mode){case"default":{const i=c.isSerializable(e)?e.toJSON():e;i.x-=.5,i.y=.5-i.y,this._referencePointOnImage=new t({geometry:new Ae({spatialReference:this._imageViewer.imageRenderer.spatialReference.clone(),...i}),symbol:fe}),this._imageViewer.addGraphic(this._referencePointOnImage,0);break}case"panoramic":{const{imageSize:i}=this._panoramicViewer;if(!i)return;const[r,a]=i,{heading:s,pitch:o}=$(e,r,a),n=ee(s,o);this._referencePointOnImage=new t({geometry:new Ae(n,Me.WebMercator),symbol:ve}),this._panoramicViewer.addGraphic(this._referencePointOnImage,0);break}}}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))}resetImage(){switch(this.setMessage("onLoadMessage","info"),this.mode){case"default":this._imageViewer.clearImage(),this._imageViewer.clearGraphics();break;case"panoramic":this._panoramicViewer.clearGraphics()}this._clickTask=d(this._clickTask)}async saveDigitizedFeatures(e){const{activeViewer:t,currentBestFeature:r,digitizationLayer:a,mode:s}=this,o=t?.imageSize;if(!o||!r||!s)throw new n("Image size, current best feature and mode are required to save digitized features");if(!a)throw new n("Digitization layer is not available");const l=await Promise.all(e.map((async e=>{const t=e.clone(),{geometry:i}=t;if(i)if(i.type===a.geometryType)switch(i.type){case"point":return t.geometry=await this.getMapPoint({x:i.x+.5,y:.5-i.y},{feature:r,imageSize:o,mode:s}),t;case"polygon":{const e=await Promise.all(i.rings.map((async e=>this.getMapPoint(e.map((([e,t])=>({x:e+.5,y:.5-t}))),{feature:r,imageSize:o,mode:s}))));return t.geometry=new Le({spatialReference:e[0][0].spatialReference,hasZ:!0,rings:e.map((e=>e.map(Q)))}),t}case"polyline":{const e=await Promise.all(i.paths.map((async e=>this.getMapPoint(e.map((([e,t])=>({x:e+.5,y:.5-t}))),{feature:r,imageSize:o,mode:s}))));return t.geometry=new je({spatialReference:e[0][0].spatialReference,hasZ:!0,paths:e.map((e=>e.map(Q)))}),t}case"mesh":case"multipoint":return void p.getLogger(this).warn("saveDigitizedFeatures:unsupported geometry type",{message:"only point, polygon, polyline are supported for digitization",geometryType:i.type,graphic:t})}else p.getLogger(this).warn("saveDigitizedFeatures:geometry type mismatch",{expected:a.geometryType,actual:i.type,graphic:t})}))),c=l.filter(i);return a.applyEdits({addFeatures:c}).then((e=>{const{addFeatureResults:t}=e;let i=0;const r=l.map((e=>{const r=t[i++];return e?r:{error:new n("Error in saving digitized features"),objectId:null,globalId:null}}));return{...e,addFeatureResults:r}}))}async searchBestImage(e,t){try{const i=await L(e,t);i&&await this._processFeatureResponse(i,e.point,{signal:t?.signal})}catch(i){y(i)||(this.setMessage("imageLoadError","error",i.message),p.getLogger(this).error("error occurred while finding best image",i))}}selectBestFeature(e){this.currentBestFeature=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}toggleAllOverlayMapFeatures(e){this.overlayedMapFeatures.forEach((t=>{this._toggleVisiblity(t,e)}))}toggleOverlayMapFeatures(e,t){const i=this.overlayedMapFeatures.get(e);i&&this._toggleVisiblity(i,t)}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 M(t,s.spatialReference);r=s.contains(e);break}case"mesh":{const e=t.spatialReference.equals(s.spatialReference)?t:await M(t,s.spatialReference);a=s.extent.contains(e);break}}if(!r&&!a)return void this.clearReferencePointOnImage();const o=await this.worldToImage(t,i);if(o)return f(i),this.plotReferencePointOnImage(o),{x:o.x,y:o.y};this.clearReferencePointOnImage()}updateSuitabilities(e){e.sort(((e,t)=>e.suitability-t.suitability)),this._suitabilities=e;const t=this._suitabilities.map((({feature:e})=>e));this._initialCurrentCoverageUpdate=!0,this._updateFeatures(t),this._groupFeaturesBySectors()}async _fetchFeatures(e,t){if(!this.view)return;const i=this.layer;if(i){const r={include:i},a=this.view.toScreen(e);if(!a)return;const s=await this.view.hitTest(a,r);return this._processHitTestResults(i,s,t)}}async _fetchFeaturesWithController(e,t){try{await this._fetchFeatures(e,t)}catch(i){if(y(i))return;this.setMessage("imageLoadError","error"),p.getLogger(this).error("error occurred while fetching features",i)}}_groupFeaturesBySectors(){const{_suitabilities:e,additionalFeatures:t,currentBestFeature:i,features:r,invalidCameraHeading:a}=this;if(!e||!t||!i||!r||a)return void(this._sectorData=null);this._sectorData={};for(const c of he)this._sectorData[c]=new s;const o=e.map(((e,t)=>({...e,featureIndex:t})));o.sort(((e,t)=>e.trueSuitability-t.trueSuitability));const n=o.map((({distance:e})=>e)),l=Math.max(...n);o.forEach((e=>{const{distance:t,angle:i,featureIndex:a}=e,s=t/l*pe[2],o=Ce(t,l),n=ke(i);if(!this._sectorData)return;const c=pe[3]+s*Math.sin(i*Math.PI/180),h=pe[3]+s*Math.cos(i*Math.PI/180);let p;const u=r.at(a),d=u===this.currentBestFeature,m=this.currentBestFeature?.attributes.cameraPitch&&this.currentBestFeature?.attributes.cameraPitch<5;if(d&&m)p=-90;else{const e=c-pe[3],t=h-pe[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 g=""===o?n:`${o}_${n}`;d&&(p===this.bestFeatureAngle?this.previousFeatureAngle=p:this.bestFeatureAngle=p,this.navigatorCurrentBestFeature=m?null:{x:c,y:h,direction:n});const y=this._sectorData[g];y.add({angle:i,featureIndex:a,x:c,y:h,objectID:u.attributes.objectId,sector:g,featureIndexInSector:y.length})}))}async _processFeatureResponse(e,t,i){const{features:r}=e;if(!r?.length)return this.setMessage("noImageError","error"),void(this.currentBestFeature=null);this.coveragePolygons.removeAll(),this.coverageFrustums.removeAll(),this.pointSources.removeAll();const{features:a,polygons:s,frustums:o}=this.filterByFootprints(r,t);if(!a.length)return this.setMessage("noImageError","error"),void(this.currentBestFeature=null);let n;if(this.coveragePolygons.addMany(s),this.coverageFrustums.addMany(o),s[0]){let e=new Le({spatialReference:s[0].spatialReference});for(const i of s)e=await A(e,i);const t=[];for(const{geometry:i}of a)e.contains(i)||t.push([i.x,i.y]);if(t.sort(((e,t)=>+R([e,t]))),e.addRing(t),this.footprintExtent=oe(e.extent,2,2),this.view?.supportsGround)try{n=await this.view.map.ground.createElevationSampler(this.footprintExtent,i)}catch(l){y(l)||p.getLogger(this).error(l)}}if((n||a[0].attributes.elevationSource)&&this.footprintExtent){const e=a[0].attributes.elevationSource;T(e)&&!n&&(n=await W({extent:this.footprintExtent,lod:e.lod,url:e.url,rasterFunction:e.rasterFunction}));const i=await Z((a[0].attributes.location.z??0)-a[0].attributes.cameraHeight,{elevationSample:n,elevationSource:e,extent:this.footprintExtent}),[r,...s]=await N([t,...a.map((e=>e.attributes.geometry.clone()))],i);a[0].elevationSample=n??i.elevationSample,t.elevation=r.z,a.forEach(((e,t)=>{e.attributes.elevation=s[t].z}))}a[0].elevationSample&&a.forEach((e=>{e.elevationSample=a[0].elevationSample})),this._suitabilities=z({features:a,selectedPoint:t,camera:Ie(this.view)?this.view.camera:null,currentImage:this.currentBestFeature}),this.updateSuitabilities(this._suitabilities)}async _processHitTestResults(e,t,i){const{screenPoint:r,results:[a]}=t,s="graphic"===a?.type&&this.shouldShowSelectedImage,o=a?.mapPoint??this.view?.toMap(r);if(!o)return;const{layerFloorFilterClause:n}=this,l=e.spatialReference.equals(o.spatialReference)?o:await M(o,e.spatialReference),c=I("1=1",I(e.definitionExpression,n)),h=l.spatialReference.isGeographic?1:S(l.spatialReference),p={layerInstanceOrURL:e,point:l,queryParams:{where:c,maximumDistance:e.maximumDistance?e.maximumDistance/h:void 0,objectIds:s?[a.graphic.getAttribute(e.objectIdField)]:void 0}};await this.searchBestImage(p,i)}_toggleVisiblity(e,t){e.forEach((e=>{e.visible=t}))}_updateFeatures(e){if(!e.length)return this.currentBestFeature=null,void this.additionalFeatures.removeAll();this.features.removeAll(),this.features.addMany(e),e.length>1?this.additionalFeatures.addMany(e.slice(1)):this.additionalFeatures.removeAll(),this.currentBestFeature=e[0]}async _updatePointsAndPolygons(e){const{pointSources:i,currentBestFeature:r,currentCoverageVisible:a,isAdditionalPointSourcesVisible:s}=this;if(r&&(this.additionalFootprints.removeAll(),this.additionalCameraLocations.removeAll(),this.bestFeatureCurrentFootprint&&(this.bestFeatureCurrentFootprint.destroy(),this.bestFeatureCurrentFootprint=null,this.bestFeatureFootprint=null),!this.invalidCameraHeading)){await(this._adapter?.createFootprints(e)),f(e);for(const e of i)e.imageID===r.attributes.objectId?this.currentBestFeatureLocation=new t({attributes:{imageID:e.imageID},geometry:e,symbol:we,visible:a}):this.additionalCameraLocations.push(new t({attributes:{imageID:e.imageID},geometry:e,symbol:ye,visible:s}))}}_updateCurrentBestFeature(e){if(!e)return;this.currentBestFeature=this.features?.at(e.featureIndex);const t=this.currentBestFeature?.attributes.cameraPitch&&this.currentBestFeature?.attributes.cameraPitch<5;let i;if(t)i=-90;else{const t=e.x-pe[3],r=e.y-pe[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}}clearGraphics(){this._imageViewer.clearGraphics(),this._panoramicViewer.clearGraphics()}clearReferencePointOnImage(){this._referencePointOnImage&&(this._imageViewer.removeGraphic(this._referencePointOnImage),this._panoramicViewer.removeGraphic(this._referencePointOnImage),this._referencePointOnImage=m(this._referencePointOnImage))}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,state:a}=this;if(this._crossSymbol&&(this._panoramicViewer.removeGraphic(this._crossSymbol),this._imageViewer.removeGraphic(this._crossSymbol),this._crossSymbol=m(this._crossSymbol)),!r||!t||"image-loaded"!==a||i)return;let s;try{s=await this.worldToImage(r,e),f(e),await this.plotSelectedPointOnImage(s,e)}catch(o){y(o)||p.getLogger(this).error("failed to transform map point to pixel, cross symbol will not be plotted on image",{error:o,selectedPoint:r,feature:t})}}async worldToImage(e,t){const{footprintExtent:i}=this,{imageSize:r}=this.activeViewer;if("none"===this.mode||!this.currentBestFeature||!r||!i)return;const{attributes:{location:a,elevationSource:s,cameraHeading:o,elevation:n,cameraHeight:l},elevationSample:c}=this.currentBestFeature;let h=a.clone();const p=await Z(n??(a.z??0)-l,{elevationSample:c,elevationSource:s});this.currentBestFeature.elevationSample=p.elevationSample;const u=Array.isArray(e)?e:[e];let d,m=await Promise.all(u.map((e=>new Promise((t=>{if(!e.hasZ)return t(N(e,p));t(e)})))));if(a.spatialReference.isGeographic&&(h=await M(h,Me.WebMercator,t)),m=await Promise.all(m.map((async e=>h.spatialReference.equals(e.spatialReference)?e:await M(e,h.spatialReference,t)))),f(t),"panoramic"===this.mode)d=ie(m,{imageHeight:r[1],imageWidth:r[0],cameraHeading:o,cameraLocation:h});else{const e=Y(this.currentBestFeature.attributes,r[0],r[1]);d=re(m,{...e,cameraLocation:h})}return Array.isArray(e)?d:d[0]}updateCurrentCoveragePolygon(e){const{additionalFootprints:i,additionalCameraLocations:r,currentBestFeature:a,currentBestFeatureLocation:s,currentCoverageVisible:o,selectedPoint:n,view:l,_adapter:c}=this,{attributes:{objectId:h},elevationSample:p}=a;if(this._initialCurrentCoverageUpdate){if(this._overlays?.removeAll(),this._initialCurrentCoverageUpdate=!1,this.bestFeatureCurrentFootprint=m(this.bestFeatureCurrentFootprint),e&&!this.invalidCameraHeading&&(e.visible=o,this.bestFeatureCurrentFootprint=e),l){const e=[...i,...r,this.bestFeatureCurrentFootprint,s].filter(Se);l.supportsGround&&p&&c?.updateGroundElevation&&c.updateGroundElevation(e,p),n&&e.push(new t({geometry:n.clone(),symbol:ue.clone(),attributes:{imageID:h}})),this._overlays.graphics.addMany(e)}}else if(l){if(this.invalidCameraHeading)return;this.bestFeatureCurrentFootprint&&(this._overlays?.remove(this.bestFeatureCurrentFootprint),this.bestFeatureCurrentFootprint=m(this.bestFeatureCurrentFootprint));const t=this.bestFeatureCurrentFootprint&&this._overlays?this._overlays.graphics.indexOf(this.bestFeatureCurrentFootprint):-1;e&&(this.bestFeatureCurrentFootprint=e,l?.supportsGround&&p&&c?.updateGroundElevation&&c.updateGroundElevation([e],p),e.visible=this.currentCoverageVisible,this._overlays?.graphics.add(this.bestFeatureCurrentFootprint,t>=0?t:this._overlays.graphics.length-1))}}};e([C()],He.prototype,"activeLayer",null),e([C({readOnly:!0})],He.prototype,"activeViewer",null),e([C()],He.prototype,"additionalFeatures",void 0),e([C({type:s.ofType(t)})],He.prototype,"additionalCameraLocations",void 0),e([C({type:s.ofType(t)})],He.prototype,"additionalFootprints",void 0),e([C()],He.prototype,"areaMeasurementResult",void 0),e([C()],He.prototype,"bestFeatureAngle",void 0),e([C()],He.prototype,"bestFeatureCurrentFootprint",void 0),e([C({type:t})],He.prototype,"bestFeatureFootprint",void 0),e([C({type:Number})],He.prototype,"brightness",null),e([C({type:Number})],He.prototype,"contrast",null),e([C()],He.prototype,"conversionProps",void 0),e([C()],He.prototype,"coverageFrustums",void 0),e([C()],He.prototype,"coveragePolygons",void 0),e([C()],He.prototype,"currentBestFeature",void 0),e([C()],He.prototype,"currentBestFeatureLocation",void 0),e([C()],He.prototype,"currentCoverageVisible",void 0),e([C({json:{write:!1}})],He.prototype,"determineWorkflowForFeature",void 0),e([C()],He.prototype,"disabled",void 0),e([C()],He.prototype,"displayMessage",void 0),e([C()],He.prototype,"displayNewMeasurementButton",void 0),e([C()],He.prototype,"displayNewAreaMeasurementButton",void 0),e([C()],He.prototype,"distanceMeasurementResult",void 0),e([C()],He.prototype,"digitizationLayer",void 0),e([C({readOnly:!0})],He.prototype,"featureCount",null),e([C()],He.prototype,"features",void 0),e([C({readOnly:!0})],He.prototype,"imageGalleryEnabled",null),e([C({readOnly:!0})],He.prototype,"imageLoaded",null),e([C({readOnly:!0})],He.prototype,"invalidCameraHeading",null),e([C()],He.prototype,"imagePointsInView",null),e([C()],He.prototype,"isAdditionalCoverageVisible",void 0),e([C()],He.prototype,"isAdditionalPointSourcesVisible",void 0),e([C()],He.prototype,"layer",void 0),e([C()],He.prototype,"layerView",null),e([C({readOnly:!0})],He.prototype,"layerFloorFilterClause",null),e([C({type:Number})],He.prototype,"localPort",void 0),e([C()],He.prototype,"mapImageConversionToolState",void 0),e([C({readOnly:!0,value:"none"})],He.prototype,"mode",null),e([C()],He.prototype,"navigatorCurrentBestFeature",void 0),e([C({type:s.ofType(t)})],He.prototype,"overlayedCameraLocations",void 0),e([C()],He.prototype,"overlayedMapFeatures",void 0),e([C()],He.prototype,"pointSources",void 0),e([C({readOnly:!0})],He.prototype,"popupEnabled",null),e([C()],He.prototype,"previousFeatureAngle",void 0),e([C()],He.prototype,"referencePoint",null),e([C({readOnly:!0})],He.prototype,"sectorData",null),e([C()],He.prototype,"selectedPoint",void 0),e([C({type:Number})],He.prototype,"sharpness",null),e([C()],He.prototype,"shouldShowSelectedImage",void 0),e([C()],He.prototype,"sketch",void 0),e([C()],He.prototype,"sketchAdapter",void 0),e([C({readOnly:!0})],He.prototype,"sketchGraphicsLayer",null),e([C({readOnly:!0})],He.prototype,"state",null),e([C({readOnly:!0})],He.prototype,"thumbnails",null),e([C()],He.prototype,"updateFootprint",void 0),e([C()],He.prototype,"updateFootprintPanorama",void 0),e([C({value:null})],He.prototype,"view",null),e([C()],He.prototype,"_adapter",void 0),e([C()],He.prototype,"_highlightedFeatureHandle",void 0),e([C()],He.prototype,"_imageViewer",void 0),e([C()],He.prototype,"_initialCurrentCoverageUpdate",void 0),e([C()],He.prototype,"_overlays",void 0),e([C({readOnly:!0})],He.prototype,"_overlaysView",null),e([C()],He.prototype,"_panoramicViewer",void 0),e([C()],He.prototype,"_referencePointOnGround",void 0),e([C()],He.prototype,"_referencePointOnImage",void 0),e([C()],He.prototype,"_sectorData",void 0),e([C({readOnly:!0})],He.prototype,"_updatingHandles",void 0),e([C()],He.prototype,"footprintExtent",void 0),He=e([k("esri.widgets.OrientedImageryViewer.OrientedImageryViewerViewModel")],He);const Te=He;export{Te as default};
5
+ import{_ as e}from"../../chunks/tslib.es6.js";import"../../geometry.js";import t from"../../Graphic.js";import"../../symbols.js";import{isSome as i,equals 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 l from"../../core/Evented.js";import c from"../../core/JSONSupport.js";import{equalsShallow as h}from"../../core/lang.js";import u from"../../core/Logger.js";import{clamp as p}from"../../core/mathUtils.js";import{abortMaybe as m,destroyMaybe as d}from"../../core/maybe.js";import g from"../../core/Promise.js";import{isAbortError as y,throwIfAborted as f,waitTick as v}from"../../core/promiseUtils.js";import w from"../../core/ReactiveMap.js";import{on as b,watch as F,syncAndInitial as _,initial as P}from"../../core/reactiveUtils.js";import{sqlAnd as S}from"../../core/sql.js";import{getMetersPerUnitForSR as I}from"../../core/unitUtils.js";import{property as k}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import{subclass as C}from"../../core/accessorSupport/decorators/subclass.js";import{UpdatingHandles as M}from"../../core/support/UpdatingHandles.js";import{union as A}from"../../geometry/geometryEngineAsync.js";import{projectWithZConversion as V}from"../../geometry/projection.js";import{isClockwise as R}from"../../geometry/support/coordsUtils.js";import{geographicToWebMercator as O}from"../../geometry/support/webMercatorUtils.js";import j from"../../layers/GraphicsLayer.js";import{searchImages as z}from"../../layers/orientedImagery/queries.js";import{calculateSuitabilities as G}from"../../layers/orientedImagery/core/bestImageUtils.js";import{createCoveragePolygon as L,computePolygonForInspection as B,resizePolygon as x,checkIfPolygonContainsSelectedPoint as E}from"../../layers/orientedImagery/core/coverageUtils.js";import{isConstantElevation as H,isElevationSource as T}from"../../layers/orientedImagery/core/ElevationSourceDefinitions.js";import{imageToWorld as D,imageToWorldPanoramic as U}from"../../layers/orientedImagery/transformations/imageToWorld.js";import N from"../../layers/orientedImagery/transformations/updateElevation.js";import{getElevationSampler as W}from"../../layers/orientedImagery/transformations/updateElevationUtils.js";import{getInitialAngle as q,convertPixelToHeadingPitch as $,getImageToWorldProperties as J,getUpdateElevationProps as Z,isElevationSampler as K,pointToArray as Q,getImageToWorldPanoramicProperties as X,getWorldToImageProperties as Y,convertHeadingPitchToSphereVertex as ee,or as te}from"../../layers/orientedImagery/transformations/utils.js";import{worldToImagePanoramic as ie,worldToImage as re}from"../../layers/orientedImagery/transformations/worldToImage.js";import{getFloorFilterClause as ae}from"../../layers/support/floorFilterUtils.js";import se from"../../rest/support/AttachmentQuery.js";import{scale as oe}from"../../views/draw/support/drawUtils.js";import{ViewEventPriorities as ne}from"../../views/input/InputManager.js";import le from"../PanoramicViewer.js";import{invalidCameraHeading as ce,sectorsInOrder as he,sectorsRadii as ue}from"./constants.js";import{pixelAreaMeasurement2D as pe,pixelDistanceMeasurement2D as me}from"./imageMeasurementUtils.js";import{crossSymbol as de,crossSymbol3D as ge,measurementPolygonSymbol as ye,measurementPolylineSymbol as fe,sourcePointSymbol as ve,diamondSymbol as we,diamondSymbol3D as be,activeSourcePointSymbol as Fe}from"./symbols.js";import{isNoAttachmentError as _e,getContentType as Pe,isTifOrMrf as Se,filterOILLayerView as Ie,isSceneView as ke,isGraphic as Ce,calculateSegment as Me,calculateDirection as Ae}from"./utils.js";import Ve from"./components/ImageViewer.js";import Re from"../../geometry/Point.js";import Oe from"../../geometry/SpatialReference.js";import je from"../../symbols/SimpleLineSymbol.js";import ze from"../../geometry/Multipoint.js";import Ge from"../../geometry/Polyline.js";import Le from"../../geometry/Polygon.js";const Be={click:"view-click",imageClick:"image-click",interactionHandles:"interaction-handles",footprintHandles:"footprint-handles",sketchHandles:"sketch-handles"},xe=new Set(["JPG","JPEG"]),Ee=/\.(\w+)$/,He=e=>"FA"===e,Te=()=>new n("orientedimageryviewer:sketch-not-initialized","Sketch property is not initialized, call loadSketch first");let De=class extends(l.EventedMixin(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.conversionProps=null,this.coverageFrustums=new s,this.coveragePolygons=new s,this.currentBestFeature=null,this.currentBestFeatureLocation=null,this.currentCoverageVisible=!0,this.determineWorkflowForFeature=async(e,t,i)=>{const{currentBestFeature:r,selectedPoint:a,view:s}=this;if(s?.closePopup(),r&&a){this._initialCurrentCoverageUpdate=!0;try{await this._updatePointsAndPolygons(i),await this._loadImage(i)}catch(o){y(o)||(this.loadImageError(o),u.getLogger(this).error("#loadIImage()","error occured while loading image",o))}}},this.disabled=!1,this.displayMessage={key:"onLoadMessage",type:"info"},this.displayNewMeasurementButton=!0,this.distanceMeasurementResult=0,this.distanceAccuracyArray=[],this.digitizationLayer=null,this.features=new s,this.isAdditionalCoverageVisible=!1,this.isAdditionalPointSourcesVisible=!1,this.layer=null,this.localPort=null,this.mapImageConversionToolState=!1,this.measureType=null,this.measurementGraphic=null,this.navigatorCurrentBestFeature=null,this.overlayedCameraLocations=new s,this.overlayedMapFeatures=new w,this.pointSources=new s,this.previousFeatureAngle=0,this.selectedPoint=null,this.shouldShowSelectedImage=!1,this.sketch=null,this.sketchAdapter=null,this.updateFootprint=async(e,t)=>{"image-loaded"===this.state&&await(this._adapter?.updateFootprint(e,t))},this.updateFootprintPanorama=async(e,t)=>{await(this._adapter?.updateFootprintPanorama(e,t))},this._adapter=null,this._highlightedFeatureHandle=null,this._imageViewer=new Ve,this._initialCurrentCoverageUpdate=!0,this._overlays=new j({listMode:"hide",internal:!0,elevationInfo:{mode:"absolute-height"}}),this._panoramicViewer=new le,this._referencePointOnGround=null,this._referencePointOnImage=null,this._sectorData=null,this._updatingHandles=new M,this._clickTask=null,this._crossSymbol=null,this.footprintExtent=null,this._featureChangedTask=null,this._openPopupTask=null,this._suitabilities=null,this._transformController=new AbortController,this._updateFootprintTask=null,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.loadDigitizationAdapter=async e=>{const{sketchAdapter:t}=this;if(await this.loadSketch(e),"digitization"===t?.type)return t;const i=import("./adapters/sketch/DigitizationAdapter.js");this._updatingHandles.addPromise(i);const{default:r}=await i;return f(e),this.sketchAdapter=new r({viewModel:this}),this.sketchAdapter},this.loadImageFromSource=async(e,t)=>this._updatingHandles.addPromise(this._loadImageFromSourceInternal(e,t)),this.loadImageViewer=e=>{this._imageViewer.container=e},this.loadPanoramicViewer=e=>{this._panoramicViewer.container=e},this.removeHighlight=()=>this._highlightedFeatureHandle?.remove(),this.revealImageGeometry=e=>{},this.startDigitization=e=>{},this.stopDigitization=e=>{},this.toggleImageAttributes=()=>{m(this._openPopupTask),this._openPopupTask=a((async e=>{const{currentBestFeature:i,popupEnabled:r,layer:a,view:s}=this;if(s?.closePopup(),!(s&&i&&r&&a))return;const{attributes:o,geometry:n}=i,l=new t({geometry:n,attributes:o.toJSON(),layer:a});f(e),await s.openPopup({features:[l],location:o.location.clone()})}))},this._createViewClickHandle=()=>{if(this.removeHandles(Be.click),"disabled"===this.state||null==this.view)return;const e=this.mapImageConversionToolState&&"image-loaded"===this.state?this._mapImageConversionToolViewClickHandler:this._viewClickHandler;this.addHandles(this.view.on("click",e,ne.WIDGET),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;i.clickAction="pixel-location";let n=null;const l=b((()=>i),"pixel-location",(e=>{this.plotReferencePointOnImage(e),n?.abort(),n=a((async i=>{if(!e)return;const a=await this.getMapPoint(e,{feature:r,imageSize:o,mode:t}).then((e=>{const t=this.view?.spatialReference;return te(!t,e.spatialReference.equals(t))?e:V(e,t)}));f(i),this.plotReferencePointOnGround(a)}))}));this.addHandles(l,Be.imageClick)},this._getImageSourceFromAttachment=async(e,t,i)=>{const r=new se({objectIds:[t]}),a=await e.queryAttachments(r,i),s=a[`${t}`]?.[0],o=s?.url;if(!o)throw new n("NoAttachmentError","no attachments found",{[e.objectIdField]:t,layer:e});return{datasetFormat:s.contentType.split("/")[1].toUpperCase(),url:o}},this._loadImage=async e=>{const{currentBestFeature:t,layer:i,mode:r}=this;if(this.clearGraphics(),!i||!t||"none"===r)return;const{attributes:a}=t,{imagePath:s,imageRotation:o,cameraHeading:n,cameraRoll:l,cameraPitch:c,objectId:h,cameraOrientation:p,location:m}=a,d=(l??0)+(o??0),g=m.spatialReference.isWGS84&&4!==p?.type?O(m):new Re(m);let v=s;if(He(s))try{v=await this._getImageSourceFromAttachment(i,h,e)}catch(w){if(y(w))return;return _e(w)?(u.getLogger(this).error(w),void this.setMessage("noAttachment","error",`${i.objectIdField}: ${h}`)):(u.getLogger(this).error(w,{[i.objectIdField]:h,layer:i}),void this.setMessage("imageLoadError","error",`query-attachments-failed:${i.objectIdField} ${h}`))}try{await this.loadImageFromSource(v,{imageRotation:d,options:e,pitch:c,yaw:n,mode:r,cameraLocation:g}),f(e),await this.transformAndPlotSelectedLocation(e)}catch(w){y(w)||this.loadImageError(w)}},this._loadImageFromSourceInternal=async(e,t)=>{const{mode:i,imageRotation:r,options:a}=t,s="string"==typeof e,o=s?e:e.url,{pathname:n,searchParams:l}=new URL(o);let c=s?n.match(Ee)?.[1]:e.datasetFormat;if(!c){const e=await Pe(o,{...t.options});c=e?.split("/")[1]??"UNKNOWN FORMAT"}switch(i){case"default":this._imageViewer.imageSource={datasetFormat:c.toUpperCase(),url:o.split("?")[0]},this._imageViewer.customParameters=Object.fromEntries(l),this._imageViewer.imageRotation=r??0,await this._imageViewer.loadImage(a);break;case"panoramic":if(xe.has(c.toUpperCase())){const{selectedPoint:e}=this,{pitch:i,yaw:r,cameraLocation:s,viewAngle:n}=t;this._panoramicViewer.imageSource=o;let l=r??0;"number"==typeof n?l=n-l:s&&e&&(l=await q(s,e)-l),this._panoramicViewer.pitch=i??0,this._panoramicViewer.yaw=l,await this._panoramicViewer.loadImage(a)}else this.setMessage("unsupportedPanoramicImageryError","error",void 0,{datasetFormat:c});break}},this._loadViewAdapter=async e=>{const{view:t}=this;if(t)switch(t.type){case"2d":{const{default:t}=await import("./adapters/view/MapViewAdapter.js");f(e),this._adapter=new t(this);break}case"3d":{const{default:t}=await import("./adapters/view/SceneViewAdapter.js");f(e),this._adapter=new t(this);break}}else this._adapter=null},this._mapImageConversionToolViewClickHandler=e=>{e.stopPropagation(),e.preventDefault(),e.mapPoint&&this.plotMapPoint(e.mapPoint)},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(),this._updatingHandles.addPromise(this.loadBestImage(a,{signal:t}))}))},this.plotSelectedPointOnImage=async(e,i)=>{if(await v(i),!e)return;const r=new Re({...c.isSerializable(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:de}),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}=$(e,r,a),n=ee(s,o);this._crossSymbol=new t({geometry:new Re(n,Oe.WebMercator),symbol:ge}),this._panoramicViewer.addGraphic(this._crossSymbol,0)}},this.handleSectorClick=this.handleSectorClick.bind(this),this.searchBestImage=this.searchBestImage.bind(this),this.transformAndPlotReferencePointOnImage=this.transformAndPlotReferencePointOnImage.bind(this),this.updateSuitabilities=this.updateSuitabilities.bind(this),this.selectBestFeature=this.selectBestFeature.bind(this)}initialize(){this.addHandles([F((()=>this.view),(()=>{this.load()}),_),F((()=>this.view?.map),((e,t)=>{t?.layers.remove(this._overlays),e?.layers.add(this._overlays)}),P),F((()=>this.view?.map?.allLayers?.length),(e=>{e&&this.view?.map?.layers.reorder(this._overlays,e-1)}),P),F((()=>[this.state,this.mapImageConversionToolState,this.view]),(()=>{this._createViewClickHandle(),this._createImageClickHandle()}),_),F((()=>[this.measureType]),((e,t)=>{(!e[0]&&t?.[0]||e[0]!==t?.[0])&&("area"===t?.[0]?this.clearPreviousMeasurements("area",!1):"distance"===t?.[0]&&this.clearPreviousMeasurements("distance",!1))}),P),F((()=>this.bestFeatureAngle),((e,t)=>{this.previousFeatureAngle=t??0}),_),F((()=>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}),F((()=>this.mode),(e=>{switch(this.removeHandles(Be.interactionHandles),e){case"default":this.addHandles(F((()=>this._imageViewer.imagePointsInView),(e=>{e&&(m(this._updateFootprintTask),this._updateFootprintTask=a((async t=>{await this.updateFootprint(e,{signal:t})})))}),{..._,equals:(e,t)=>r(e,t,h)}),Be.interactionHandles);break;case"panoramic":this.addHandles(F((()=>{const{currentBestFeature:e,state:t}=this,{imageSize:i,vfov:r,hfov:a,pitch:s,yaw:o}=this._panoramicViewer;return e&&i&&"image-loading"!==t?[r,a,o,s]:null}),(e=>{if(!e||"image-loading"===this.state)return;const[t,i,r,s]=e;m(this._updateFootprintTask),this._updateFootprintTask=a((async e=>{await this.updateFootprintPanorama({verticalFieldOfView:t,horizontalFieldOfView:i,yaw:r,pitch:s},{signal:e})}))}),{..._,equals:(e,t)=>r(e,t,h)}),Be.interactionHandles)}}),_),F((()=>[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)}),_),F((()=>this.activeViewer?.imageRenderer),(()=>{this.sketch&&(this.sketch.view=this.activeViewer?.imageRenderer)}))]),this.when().finally((()=>{this.notifyChange("state")}))}destroy(){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=d(this.bestFeatureFootprint),this.bestFeatureCurrentFootprint=d(this.bestFeatureCurrentFootprint),this._crossSymbol=d(this._crossSymbol),this._referencePointOnGround=d(this._referencePointOnGround),this._referencePointOnImage=d(this._referencePointOnImage),this._overlays&&this.view?.map?.remove(this._overlays),this._overlays.destroy(),this._imageViewer.destroy(),this._panoramicViewer.destroy()}get activeLayer(){return o(u.getLogger(this),"activeLayer",{replacement:"layer"}),this.layer}set activeLayer(e){o(u.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 brightness(){return this._get("brightness")??0}set brightness(e){this._set("brightness",p(e,-10,10))}get contrast(){return this._get("contrast")??0}set contrast(e){this._set("contrast",p(e,-10,10))}get featureCount(){return this.features?.length??0}get imageGalleryEnabled(){return Se(this.currentBestFeature?.attributes.imagePath.trim())}get imageLoaded(){return o(u.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===ce}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(Ie(e))}get layerFloorFilterClause(){const{layerView:e}=this;return e?ae(e):null}get mode(){const e=this.currentBestFeature?.attributes;if(!e)return"none";const{horizontalFieldOfView:t,isSpherical:i}=e;return 360===t||i?"panoramic":"default"}get popupEnabled(){return!0===this.layer?.popupEnabled}get referencePoint(){return this._referencePointOnGround?.geometry}get sectorData(){const{_sectorData:e}=this;return e?he.map((t=>e[t])):null}get sharpness(){return this._get("sharpness")??0}set sharpness(e){this._set("sharpness",p(e,0,1))}get sketchGraphicsLayer(){return this.sketch?.layer}get state(){const{mode:e,disabled:t}=this;if(t)return"disabled";if(!this.isFulfilled())return"loading";if(this.isRejected())return"error";if(this._updatingHandles.updating)return"image-loading";if("error"===this.displayMessage?.type)return"image-load-error";switch(e){case"default":return this._imageViewer.state;case"panoramic":return this._panoramicViewer.state}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 Se(a)?{url:a,objectId:t,rotation:(i??0)+(r??0)}:null})).filter(i)):null}set view(e){this._set("view",e)}get _overlaysView(){return this.view?.layerViews.find((({layer:e})=>e===this._overlays))}async calculateAreaMeasurement(e,t){if(e.length<3||!this.currentBestFeature||!this.activeViewer?.imageSize)return null;const i=await this.getMeasurementProperties();return f(t),i?await pe(e,i,!0):null}async calculateAreaAccuracy(e,t){if(e.length<3||!this.currentBestFeature||!this.activeViewer?.imageSize)return null;const i=await this.getMeasurementProperties();if(f(t),!i)return null;const r=await pe(e,i,!0);f(t);const a=r?.area;if(!r||!a)return null;const s=this.generateCombinations(i);if(!s)return null;const o=s.map((t=>pe(e,t,!0))),n=await Promise.all(o);let l=0;for(const c of n){if(!c)return null;const e=Math.abs(c.area-a);e>l&&(l=e)}return l}async calculateDistanceMeasurement(e,t){if(e.length<2||!this.currentBestFeature||!this.activeViewer?.imageSize)return null;const i=await this.getMeasurementProperties();return f(t),i?await me([e.at(0),e.at(-1)],i,!0):null}async calculateDistanceAccuracy(e,t){if(e.length<2||!this.currentBestFeature||!this.activeViewer?.imageSize)return null;const i=await this.getMeasurementProperties();if(f(t),!i)return null;const r=await me([e.at(0),e.at(-1)],i,!0);f(t);const a=this.generateCombinations(i);if(!a)return null;const s=a.map((async t=>{const i=await me([e.at(0),e.at(-1)],t,!0);return i?Math.abs(i-r):null})),o=(await Promise.all(s)).filter((e=>null!==e));if(0===o.length)return null;return Math.max(...o)}async calculateAccuracy(e,t,i){if("area"===t&&e.length<3||"distance"===t&&e.length<2||!this.currentBestFeature||!this.activeViewer?.imageSize)return null;const r=await this.getMeasurementProperties();if(f(i),!r)return null;const a="area"===t?await pe(e,r,!0):await me([e.at(0),e.at(-1)],r,!0);f(i);const s=this.generateCombinations(r);if(!s)return null;const o=s.map((async r=>{const s="area"===t?await pe(e,r,!0):await me([e.at(0),e.at(-1)],r,!0);if(f(i),s&&a){if("area"===t){const e="number"!=typeof s?s.area:null;return e?Math.abs(e-a.area):null}return Math.abs(s-a)}return null})),n=await Promise.all(o);f(i);const l=n.filter((e=>null!==e));if(0===l.length)return null;return Math.max(...l.map((e=>e)))}clearPreviousMeasurements(e,t=!0){t&&(this.measureType=null),"area"===e?this.resetMeasurementData("area"):"distance"===e&&this.resetMeasurementData("distance"),this.clearMeasurementGraphics(),this.stopMeasurement()}clearMeasurementGraphics(){this.measurementGraphic&&(this.activeViewer?.removeGraphic(this.measurementGraphic),this.measurementGraphic=null)}copyToClipboard(e){navigator.clipboard.writeText(e).catch((e=>{u.getLogger(this).error("copy-to-clipboard:measurement-result",e)}))}digitizeCancel(){return this.sketch?.cancel()}digitizeCanRedo(){return this.sketch?.canRedo()??!1}digitizeCanUndo(){return this.sketch?.canUndo()??!1}digitizeComplete(){return this.sketch?.complete()}digitizeCreate(e,t){const{sketch:i}=this;return i?i.create(e,t):Promise.reject(Te())}async digitizeDelete(){if(!this.sketch)throw Te();return this.sketch.delete()}digitizeDuplicate(){if(!this.sketch)throw Te();return this.sketch.duplicate()}digitizePlace(e,t){if(!this.sketch)throw Te();return this.sketch.place(e,t)}digitizeRedo(){if(!this.sketch)throw Te();return this.sketch.redo()}digitizeUndo(){if(!this.sketch)throw Te();return this.sketch.undo()}digitizeUpdate(e,t){if(!this.sketch)throw Te();return this.sketch.update(e,t)}filterByFootprints(e,t){const i=[],r=[],a=[];return e.forEach((e=>{const{layer:{coveragePercent:s},attributes:o}=e;let n;const l=I(e.geometry.spatialReference);o.cameraHeight/=l,o.farDistance/=l,o.nearDistance/=l,H(o.elevationSource)&&(o.elevationSource.constantElevation/=l);const{polygon:c,frustum:h}=L(o);if(n=c.clone(),o.isInspection&&(n=B(o)),s&&(n=x(n,s)),E(n,t)){a.push(e);const{geometry:t,objectId:s,cameraHeight:n,cameraHeading:l}=o,u=t.clone();u.z=n,u.imageID=s,this.pointSources.push(u),l!==ce&&(i.push(c),h&&r.push(h))}})),{features:a,polygons:i,frustums:r}}generateCombinations(e){const{cameraPitch:t,cameraRoll:i,cameraLocation:r}=e,{x:a,y:s,z:o,spatialReference:n}=r;if(this.layer?.orientationAccuracy.every((e=>0===e))||!this.layer?.orientationAccuracy)return null;const[l,c,,h,u]=this.layer.orientationAccuracy,p=[-h,0,h],m=[-u,0,u],d=[-l,0,l],g=[-c,0,c],y=[];for(const f of p)for(const r of m)for(const l of d)for(const c of d)for(const h of g){const u={...e};u.cameraPitch=t+f,u.cameraRoll=i+r,u.cameraLocation=new Re({x:a+l,y:s+c,z:o?o+h:0,spatialReference:{wkid:n.wkid}}),y.push(u)}return y}getMeasurementProperties(){const{currentBestFeature:e,activeViewer:t}=this;if(!e||!t?.imageSize)return;const{elevationSample:i,attributes:r}=e,{elevationSource:a,cameraHeight:s}=r,o=J(r,t.imageSize[0],t.imageSize[1]);let n=o.cameraLocation;return(n.spatialReference.isGeographic?V(n,Oe.WebMercator):Promise.resolve(n)).then((e=>(n=e,Z((n.z??0)-s,{elevationSample:i,elevationSource:a,extent:this.footprintExtent})))).then((t=>("elevationSample"in t&&K(t.elevationSample)&&(e.elevationSample=t.elevationSample),{...o,cameraLocation:n,updateElevationProps:t})))}async deleteDigitizedFeatures(e){const{digitizationLayer:t}=this;if(!t)throw new n("Digitization 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?.[he[e]];t?.length&&this._updateCurrentBestFeature(t.at(0))}handleFeatureClick(e){const{sector:t,featureIndexInSector:i}=e;if(isNaN(i))return;const r=this._sectorData?.[t];r?.length&&this._updateCurrentBestFeature(r.at(i))}async load(e){return this.addResolvingPromise(this._loadViewAdapter(e).catch((e=>{if(!y(e))throw e}))),this}async loadBestImage(e,t){return this.view?.closePopup(),this.displayMessage=null,this.selectedPoint=e.spatialReference.isGeographic?O(e):e.clone(),this.features.removeAll(),this.currentBestFeature=null,this.additionalFeatures.removeAll(),this.additionalFootprints.removeAll(),this.additionalCameraLocations.removeAll(),this.bestFeatureCurrentFootprint=d(this.bestFeatureCurrentFootprint),this._overlays?.removeAll(),this._fetchFeaturesWithController(e,t)}loadImageError(e){u.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");this._updatingHandles.addPromise(t);const{default:i}=await t;f(e),this.sketch=new i({layer:new j,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 loadSketchAdapter(e){if("panoramic"!==this.mode){if(!this.sketchAdapter){const t=import("./adapters/sketch/MeasurementAdapter.js");this._updatingHandles.addPromise(t);const{default:i}=await t;if(f(e),this.sketchAdapter=new i({viewModel:this}),!this.sketchAdapter.viewModel.isResolved())return}return this.sketchAdapter}}newMeasurement(e){switch(this.clearMeasurementGraphics(),this.resetMeasurementData(e),e){case"distance":this.startMeasurement("polyline");break;case"area":this.startMeasurement("polygon")}}async startMeasurement(e,t){if("panoramic"===this.mode)return;if(await this.loadSketch(),await this.loadSketchAdapter(t),!this.sketch||!this.sketchAdapter)return;this.displayNewMeasurementButton=!1,this.sketch.create(e);const i=this.activeViewer?.imageRenderer.effectiveTheme.accentColor;i&&this.sketch&&(this.sketch.polygonSymbol=ye(i),this.sketch.polylineSymbol=fe(i))}stopMeasurement(){this.sketch&&this.sketchAdapter&&this.sketch.cancel()}async overlayCameraLocations(e){const{activeViewer:i,currentBestFeature:r,overlayedCameraLocations:a,layer:s,mode:o,state:n}=this,l=i?.imageSize;if(!l||!r||!s||"none"===o||n.includes("loading"))return;const{polygon:c}=L(r.attributes);if(i.removeManyGraphics(a.toArray()),a.removeAll(),e){const{features:e}=await s.queryFeatures({where:`${s.objectIdField} <> ${r.attributes.objectId}`,geometry:c,returnGeometry:!0,outFields:[s.objectIdField]}),n=await Promise.all(e.map((async e=>{const{attributes:i,geometry:a}=e,s=await this.getPixels(a,{feature:r,imageSize:l,mode:o}),n=ve.clone();return n.outline=new je({color:[0,0,0],width:1}),new t({attributes:i,symbol:n,geometry:s})})));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,r=!1){const{activeViewer:a,currentBestFeature:o,mode:n,state:l}=this,c=a?.imageSize;if(!c||!o||"none"===n||l.includes("loading"))return;const{polygon:h}=L(o.attributes),{features:u}=await e.queryFeatures({geometry:h,returnGeometry:!0,outFields:[e.objectIdField]}),p=new s((await Promise.all(u.map((async i=>{const{attributes:a,geometry:s}=i,l=i.symbol?.clone()??e.renderer?.getSymbol(i)?.clone();switch(s?.type){case"point":{const i=await this.getPixels(s,{feature:o,imageSize:c,mode:n});return new t({attributes:a,layer:e,symbol:l,geometry:i,visible:e.visible&&r})}case"polygon":{const{rings:i,spatialReference:h}=s,u=i.map((e=>e.map((([e,t,i])=>new Re({x:e,y:t,z:i,spatialReference:h}))))),p=await Promise.all(u.map((async e=>this.getPixels(e,{feature:o,imageSize:c,mode:n}).then((e=>e.map(Q))))));return new t({attributes:a,layer:e,symbol:l,geometry:new Le({rings:p,spatialReference:Oe.WebMercator}),visible:e.visible&&r})}case"polyline":{const{paths:i,spatialReference:h}=s,u=i.map((e=>e.map((([e,t,i])=>new Re({x:e,y:t,z:i,spatialReference:h}))))),p=await Promise.all(u.map((async e=>this.getPixels(e,{feature:o,imageSize:c,mode:n}).then((e=>e.map(Q))))));return new t({attributes:a,layer:e,symbol:l,geometry:new Ge({paths:p,spatialReference:Oe.WebMercator}),visible:e.visible&&r})}case"multipoint":{const{points:i,spatialReference:h}=s,u=i.map((([e,t,i])=>new Re({x:e,y:t,z:i,spatialReference:h}))),p=await this.getPixels(u,{feature:o,imageSize:c,mode:n}).then((e=>e.map(Q)));return new t({attributes:a,layer:e,symbol:l,geometry:new ze({points:p,spatialReference:Oe.WebMercator}),visible:e.visible&&r})}}return null})))).filter(i));this.overlayGraphicsOnImage(`${e.id}`,p)}async getPixels(e,t){const{imageSize:i,mode:r}=t,a=(await this.worldToImage(Array.isArray(e)?e:[e])).map((e=>{if("default"===r)return new Re({x:e.x-.5,y:.5-e.y,spatialReference:Oe.WebMercator});const[t,a]=i,{heading:s,pitch:o}=$(e,t,a),n=ee(s,o);return new Re(n,Oe.WebMercator)}));return Array.isArray(e)?a:a[0]}async getMapPoint(e,t){const{feature:i,mode:r,imageSize:a}=t,{elevationSample:s,attributes:o}=i,{elevationSource:n,location:l,elevation:c,cameraHeight:h}=o;let u=l.clone();u.spatialReference.isGeographic&&(u=await V(u,Oe.WebMercator));const p=await Z(c??(l.z??0)-h,{elevationSample:s,elevationSource:n,extent:this.footprintExtent});let m;if("elevationSample"in p&&K(p.elevationSample)&&(i.elevationSample=p.elevationSample),"default"===r){const t=J(o,a[0],a[1]);m=await D(Array.isArray(e)?e:[e],{...t,cameraLocation:u},p)}else{const t=X(o,a[0],a[1]);m=await U(Array.isArray(e)?e:[e],{...t,cameraLocation:u},p)}return Array.isArray(e)?m:m[0]}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 Re({...e.toJSON()}),symbol:we}),this.view?this._overlays?.add(this._referencePointOnGround):this.emit("plot-ground-point",{data:{point:this._referencePointOnGround?.geometry}}))}plotReferencePointOnImage(e){if("image-loaded"===this.state)switch(this.clearReferencePointOnImage(),this.mode){case"default":{const i=c.isSerializable(e)?e.toJSON():e;i.x-=.5,i.y=.5-i.y,this._referencePointOnImage=new t({geometry:new Re({spatialReference:this._imageViewer.imageRenderer.spatialReference.clone(),...i}),symbol:we}),this._imageViewer.addGraphic(this._referencePointOnImage,0);break}case"panoramic":{const{imageSize:i}=this._panoramicViewer;if(!i)return;const[r,a]=i,{heading:s,pitch:o}=$(e,r,a),n=ee(s,o);this._referencePointOnImage=new t({geometry:new Re(n,Oe.WebMercator),symbol:be}),this._panoramicViewer.addGraphic(this._referencePointOnImage,0);break}}}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))}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)}resetMeasurementData(e){switch(e){case"area":this.areaMeasurementResult=0,this.areaMeasurementAccuracy=0;break;case"distance":this.distanceMeasurementResult=0,this.distanceAccuracyArray=[]}}async saveDigitizedFeatures(e){const{activeViewer:t,currentBestFeature:r,digitizationLayer:a,mode:s}=this,o=t?.imageSize;if(!o||!r||!s)throw new n("Image size, current best feature and mode are required to save digitized features");if(!a)throw new n("Digitization layer is not available");const l=await Promise.all(e.map((async e=>{const t=e.clone(),{geometry:i}=t;if(i)if(i.type===a.geometryType)switch(i.type){case"point":return t.geometry=await this.getMapPoint({x:i.x+.5,y:.5-i.y},{feature:r,imageSize:o,mode:s}),t;case"polygon":{const e=await Promise.all(i.rings.map((async e=>this.getMapPoint(e.map((([e,t])=>({x:e+.5,y:.5-t}))),{feature:r,imageSize:o,mode:s}))));return t.geometry=new Le({spatialReference:e[0][0].spatialReference,hasZ:!0,rings:e.map((e=>e.map(Q)))}),t}case"polyline":{const e=await Promise.all(i.paths.map((async e=>this.getMapPoint(e.map((([e,t])=>({x:e+.5,y:.5-t}))),{feature:r,imageSize:o,mode:s}))));return t.geometry=new Ge({spatialReference:e[0][0].spatialReference,hasZ:!0,paths:e.map((e=>e.map(Q)))}),t}case"mesh":case"multipoint":return void u.getLogger(this).warn("saveDigitizedFeatures:unsupported geometry type",{message:"only point, polygon, polyline are supported for digitization",geometryType:i.type,graphic:t})}else u.getLogger(this).warn("saveDigitizedFeatures:geometry type mismatch",{expected:a.geometryType,actual:i.type,graphic:t})}))),c=l.filter(i);return a.applyEdits({addFeatures:c}).then((e=>{const{addFeatureResults:t}=e;let i=0;const r=l.map((e=>{const r=t[i++];return e?r:{error:new n("Error in saving digitized features"),objectId:null,globalId:null}}));return{...e,addFeatureResults:r}}))}async searchBestImage(e,t){try{const i=await z(e,t);i&&await this._processFeatureResponse(i,e.point,{signal:t?.signal})}catch(i){y(i)||(this.setMessage("imageLoadError","error",i.message),u.getLogger(this).error("error occurred while finding best image",i))}}selectBestFeature(e){this.currentBestFeature=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}toggleAllOverlayMapFeatures(e){this.overlayedMapFeatures.forEach((t=>{this._toggleVisiblity(t,e)}))}toggleOverlayMapFeatures(e,t){const i=this.overlayedMapFeatures.get(e);i&&this._toggleVisiblity(i,t)}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 V(t,s.spatialReference);r=s.contains(e);break}case"mesh":{const e=t.spatialReference.equals(s.spatialReference)?t:await V(t,s.spatialReference);a=s.extent.contains(e);break}}if(!r&&!a)return void this.clearReferencePointOnImage();const o=await this.worldToImage(t,i);if(o)return f(i),this.plotReferencePointOnImage(o),{x:o.x,y:o.y};this.clearReferencePointOnImage()}updateSuitabilities(e){e.sort(((e,t)=>e.suitability-t.suitability)),this._suitabilities=e;const t=this._suitabilities.map((({feature:e})=>e));this._initialCurrentCoverageUpdate=!0,this._updateFeatures(t),this._groupFeaturesBySectors()}async _fetchFeatures(e,t){if(!this.view)return;const i=this.layer;if(i){const r={include:i},a=this.view.toScreen(e);if(!a)return;const s=await this.view.hitTest(a,r);return this._processHitTestResults(i,s,t)}}async _fetchFeaturesWithController(e,t){try{await this._fetchFeatures(e,t)}catch(i){if(y(i))return;this.setMessage("imageLoadError","error"),u.getLogger(this).error("error occurred while fetching features",i)}}_groupFeaturesBySectors(){const{_suitabilities:e,additionalFeatures:t,currentBestFeature:i,features:r,invalidCameraHeading:a}=this;if(!e||!t||!i||!r||a)return void(this._sectorData=null);this._sectorData={};for(const c of he)this._sectorData[c]=new s;const o=e.map(((e,t)=>({...e,featureIndex:t})));o.sort(((e,t)=>e.trueSuitability-t.trueSuitability));const n=o.map((({distance:e})=>e)),l=Math.max(...n);o.forEach((e=>{const{distance:t,angle:i,featureIndex:a}=e,s=t/l*ue[2],o=Me(t,l),n=Ae(i);if(!this._sectorData)return;const c=ue[3]+s*Math.sin(i*Math.PI/180),h=ue[3]+s*Math.cos(i*Math.PI/180);let u;const p=r.at(a),m=p===this.currentBestFeature,d=this.currentBestFeature?.attributes.cameraPitch&&this.currentBestFeature?.attributes.cameraPitch<5;if(m&&d)u=-90;else{const e=c-ue[3],t=h-ue[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),u=r}const g=""===o?n:`${o}_${n}`;m&&(u===this.bestFeatureAngle?this.previousFeatureAngle=u:this.bestFeatureAngle=u,this.navigatorCurrentBestFeature=d?null:{x:c,y:h,direction:n});const y=this._sectorData[g];y.add({angle:i,featureIndex:a,x:c,y:h,objectID:p.attributes.objectId,sector:g,featureIndexInSector:y.length})}))}async _processFeatureResponse(e,t,i){const{features:r}=e;if(!r?.length)return this.setMessage("noImageError","error"),void(this.currentBestFeature=null);this.coveragePolygons.removeAll(),this.coverageFrustums.removeAll(),this.pointSources.removeAll();const{features:a,polygons:s,frustums:o}=this.filterByFootprints(r,t);if(!a.length)return this.setMessage("noImageError","error"),void(this.currentBestFeature=null);let n;if(this.coveragePolygons.addMany(s),this.coverageFrustums.addMany(o),s[0]){let e=new Le({spatialReference:s[0].spatialReference});for(const i of s)e=await A(e,i);const t=[];for(const{geometry:i}of a)e.contains(i)||t.push([i.x,i.y]);if(t.sort(((e,t)=>+R([e,t]))),e.addRing(t),this.footprintExtent=oe(e.extent,2,2),this.view?.supportsGround)try{n=await this.view.map.ground.createElevationSampler(this.footprintExtent,i)}catch(l){y(l)||u.getLogger(this).error(l)}}if((n||a[0].attributes.elevationSource)&&this.footprintExtent){const e=a[0].attributes.elevationSource;T(e)&&!n&&(n=await W({extent:this.footprintExtent,lod:e.lod,url:e.url,rasterFunction:e.rasterFunction}));const i=await Z((a[0].attributes.location.z??0)-a[0].attributes.cameraHeight,{elevationSample:n,elevationSource:e,extent:this.footprintExtent}),[r,...s]=await N([t,...a.map((e=>e.attributes.geometry.clone()))],i);a[0].elevationSample=n??i.elevationSample,t.elevation=r.z,a.forEach(((e,t)=>{e.attributes.elevation=s[t].z}))}a[0].elevationSample&&a.forEach((e=>{e.elevationSample=a[0].elevationSample})),this._suitabilities=G({features:a,selectedPoint:t,camera:ke(this.view)?this.view.camera:null,currentImage:this.currentBestFeature}),this.updateSuitabilities(this._suitabilities)}async _processHitTestResults(e,t,i){const{screenPoint:r,results:[a]}=t,s="graphic"===a?.type&&this.shouldShowSelectedImage,o=a?.mapPoint??this.view?.toMap(r);if(!o)return;const{layerFloorFilterClause:n}=this,l=e.spatialReference.equals(o.spatialReference)?o:await V(o,e.spatialReference),c=S("1=1",S(e.definitionExpression,n)),h=l.spatialReference.isGeographic?1:I(l.spatialReference),u={layerInstanceOrURL:e,point:l,queryParams:{where:c,maximumDistance:e.maximumDistance?e.maximumDistance/h:void 0,objectIds:s?[a.graphic.getAttribute(e.objectIdField)]:void 0}};await this.searchBestImage(u,i)}_toggleVisiblity(e,t){e.forEach((e=>{e.visible=t}))}_updateFeatures(e){if(!e.length)return this.currentBestFeature=null,void this.additionalFeatures.removeAll();this.features.removeAll(),this.features.addMany(e),e.length>1?this.additionalFeatures.addMany(e.slice(1)):this.additionalFeatures.removeAll(),this.currentBestFeature=e[0]}async _updatePointsAndPolygons(e){const{pointSources:i,currentBestFeature:r,currentCoverageVisible:a,isAdditionalPointSourcesVisible:s}=this;if(r&&(this.additionalFootprints.removeAll(),this.additionalCameraLocations.removeAll(),this.bestFeatureCurrentFootprint&&(this.bestFeatureCurrentFootprint.destroy(),this.bestFeatureCurrentFootprint=null,this.bestFeatureFootprint=null),!this.invalidCameraHeading)){await(this._adapter?.createFootprints(e)),f(e);for(const e of i)e.imageID===r.attributes.objectId?this.currentBestFeatureLocation=new t({attributes:{imageID:e.imageID},geometry:e,symbol:Fe,visible:a}):this.additionalCameraLocations.push(new t({attributes:{imageID:e.imageID},geometry:e,symbol:ve,visible:s}))}}_updateCurrentBestFeature(e){if(!e)return;this.currentBestFeature=this.features?.at(e.featureIndex);const t=this.currentBestFeature?.attributes.cameraPitch&&this.currentBestFeature?.attributes.cameraPitch<5;let i;if(t)i=-90;else{const t=e.x-ue[3],r=e.y-ue[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}}clearGraphics(){this._imageViewer.clearGraphics(),this._panoramicViewer.clearGraphics()}clearReferencePointOnImage(){this._referencePointOnImage&&(this._imageViewer.removeGraphic(this._referencePointOnImage),this._panoramicViewer.removeGraphic(this._referencePointOnImage),this._referencePointOnImage=d(this._referencePointOnImage))}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,state:a}=this;if(this._crossSymbol&&(this._panoramicViewer.removeGraphic(this._crossSymbol),this._imageViewer.removeGraphic(this._crossSymbol),this._crossSymbol=d(this._crossSymbol)),!r||!t||"image-loaded"!==a||i)return;let s;try{s=await this.worldToImage(r,e),f(e),await this.plotSelectedPointOnImage(s,e)}catch(o){y(o)||u.getLogger(this).error("failed to transform map point to pixel, cross symbol will not be plotted on image",{error:o,selectedPoint:r,feature:t})}}async worldToImage(e,t){const{footprintExtent:i}=this,{imageSize:r}=this.activeViewer;if("none"===this.mode||!this.currentBestFeature||!r||!i)return;const{attributes:{location:a,elevationSource:s,cameraHeading:o,elevation:n,cameraHeight:l},elevationSample:c}=this.currentBestFeature;let h=a.clone();const u=await Z(n??(a.z??0)-l,{elevationSample:c,elevationSource:s});this.currentBestFeature.elevationSample=u.elevationSample;const p=Array.isArray(e)?e:[e];let m,d=await Promise.all(p.map((e=>new Promise((t=>{if(!e.hasZ)return t(N(e,u));t(e)})))));if(a.spatialReference.isGeographic&&(h=await V(h,Oe.WebMercator,t)),d=await Promise.all(d.map((async e=>h.spatialReference.equals(e.spatialReference)?e:await V(e,h.spatialReference,t)))),f(t),"panoramic"===this.mode)m=ie(d,{imageHeight:r[1],imageWidth:r[0],cameraHeading:o,cameraLocation:h});else{const e=Y(this.currentBestFeature.attributes,r[0],r[1]);m=re(d,{...e,cameraLocation:h})}return Array.isArray(e)?m:m[0]}updateCurrentCoveragePolygon(e){const{additionalFootprints:i,additionalCameraLocations:r,currentBestFeature:a,currentBestFeatureLocation:s,currentCoverageVisible:o,selectedPoint:n,view:l,_adapter:c}=this,{attributes:{objectId:h},elevationSample:u}=a;if(this._initialCurrentCoverageUpdate){if(this._overlays?.removeAll(),this._initialCurrentCoverageUpdate=!1,this.bestFeatureCurrentFootprint=d(this.bestFeatureCurrentFootprint),e&&!this.invalidCameraHeading&&(e.visible=o,this.bestFeatureCurrentFootprint=e),l){const e=[...i,...r,this.bestFeatureCurrentFootprint,s].filter(Ce);l.supportsGround&&u&&c?.updateGroundElevation&&c.updateGroundElevation(e,u),n&&e.push(new t({geometry:n.clone(),symbol:de.clone(),attributes:{imageID:h}})),this._overlays.graphics.addMany(e)}}else if(l){if(this.invalidCameraHeading)return;this.bestFeatureCurrentFootprint&&(this._overlays?.remove(this.bestFeatureCurrentFootprint),this.bestFeatureCurrentFootprint=d(this.bestFeatureCurrentFootprint));const t=this.bestFeatureCurrentFootprint&&this._overlays?this._overlays.graphics.indexOf(this.bestFeatureCurrentFootprint):-1;e&&(this.bestFeatureCurrentFootprint=e,l?.supportsGround&&u&&c?.updateGroundElevation&&c.updateGroundElevation([e],u),e.visible=this.currentCoverageVisible,this._overlays?.graphics.add(this.bestFeatureCurrentFootprint,t>=0?t:this._overlays.graphics.length-1))}}};e([k()],De.prototype,"activeLayer",null),e([k({readOnly:!0})],De.prototype,"activeViewer",null),e([k()],De.prototype,"additionalFeatures",void 0),e([k({type:s.ofType(t)})],De.prototype,"additionalCameraLocations",void 0),e([k({type:s.ofType(t)})],De.prototype,"additionalFootprints",void 0),e([k()],De.prototype,"areaMeasurementResult",void 0),e([k()],De.prototype,"areaMeasurementAccuracy",void 0),e([k()],De.prototype,"bestFeatureAngle",void 0),e([k()],De.prototype,"bestFeatureCurrentFootprint",void 0),e([k({type:t})],De.prototype,"bestFeatureFootprint",void 0),e([k({type:Number})],De.prototype,"brightness",null),e([k({type:Number})],De.prototype,"contrast",null),e([k()],De.prototype,"conversionProps",void 0),e([k()],De.prototype,"coverageFrustums",void 0),e([k()],De.prototype,"coveragePolygons",void 0),e([k()],De.prototype,"currentBestFeature",void 0),e([k()],De.prototype,"currentBestFeatureLocation",void 0),e([k()],De.prototype,"currentCoverageVisible",void 0),e([k({json:{write:!1}})],De.prototype,"determineWorkflowForFeature",void 0),e([k()],De.prototype,"disabled",void 0),e([k()],De.prototype,"displayMessage",void 0),e([k()],De.prototype,"displayNewMeasurementButton",void 0),e([k()],De.prototype,"distanceMeasurementResult",void 0),e([k()],De.prototype,"distanceAccuracyArray",void 0),e([k()],De.prototype,"digitizationLayer",void 0),e([k({readOnly:!0})],De.prototype,"featureCount",null),e([k()],De.prototype,"features",void 0),e([k({readOnly:!0})],De.prototype,"imageGalleryEnabled",null),e([k({readOnly:!0})],De.prototype,"imageLoaded",null),e([k({readOnly:!0})],De.prototype,"invalidCameraHeading",null),e([k()],De.prototype,"imagePointsInView",null),e([k()],De.prototype,"isAdditionalCoverageVisible",void 0),e([k()],De.prototype,"isAdditionalPointSourcesVisible",void 0),e([k()],De.prototype,"layer",void 0),e([k()],De.prototype,"layerView",null),e([k({readOnly:!0})],De.prototype,"layerFloorFilterClause",null),e([k({type:Number})],De.prototype,"localPort",void 0),e([k()],De.prototype,"mapImageConversionToolState",void 0),e([k()],De.prototype,"measureType",void 0),e([k()],De.prototype,"measurementGraphic",void 0),e([k({readOnly:!0,value:"none"})],De.prototype,"mode",null),e([k()],De.prototype,"navigatorCurrentBestFeature",void 0),e([k({type:s.ofType(t)})],De.prototype,"overlayedCameraLocations",void 0),e([k()],De.prototype,"overlayedMapFeatures",void 0),e([k()],De.prototype,"pointSources",void 0),e([k({readOnly:!0})],De.prototype,"popupEnabled",null),e([k()],De.prototype,"previousFeatureAngle",void 0),e([k()],De.prototype,"referencePoint",null),e([k({readOnly:!0})],De.prototype,"sectorData",null),e([k()],De.prototype,"selectedPoint",void 0),e([k({type:Number})],De.prototype,"sharpness",null),e([k()],De.prototype,"shouldShowSelectedImage",void 0),e([k()],De.prototype,"sketch",void 0),e([k()],De.prototype,"sketchAdapter",void 0),e([k({readOnly:!0})],De.prototype,"sketchGraphicsLayer",null),e([k({readOnly:!0})],De.prototype,"state",null),e([k({readOnly:!0})],De.prototype,"thumbnails",null),e([k()],De.prototype,"updateFootprint",void 0),e([k()],De.prototype,"updateFootprintPanorama",void 0),e([k({value:null})],De.prototype,"view",null),e([k()],De.prototype,"_adapter",void 0),e([k()],De.prototype,"_highlightedFeatureHandle",void 0),e([k()],De.prototype,"_imageViewer",void 0),e([k()],De.prototype,"_initialCurrentCoverageUpdate",void 0),e([k()],De.prototype,"_overlays",void 0),e([k({readOnly:!0})],De.prototype,"_overlaysView",null),e([k()],De.prototype,"_panoramicViewer",void 0),e([k()],De.prototype,"_referencePointOnGround",void 0),e([k()],De.prototype,"_referencePointOnImage",void 0),e([k()],De.prototype,"_sectorData",void 0),e([k({readOnly:!0})],De.prototype,"_updatingHandles",void 0),e([k()],De.prototype,"footprintExtent",void 0),De=e([C("esri.widgets.OrientedImageryViewer.OrientedImageryViewerViewModel")],De);const Ue=De;export{Ue as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.32/esri/copyright.txt for details.
4
4
  */
5
- import{_ as o}from"../../chunks/tslib.es6.js";import e from"../../core/Accessor.js";import{deprecatedProperty as t}from"../../core/deprecate.js";import n from"../../core/Logger.js";import{property as l}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/RandomLCG.js";import{subclass as r}from"../../core/accessorSupport/decorators/subclass.js";let a=class extends e{constructor(){super(...arguments),this.additionalFootprintToggle=!0,this.additionalCameraLocationsToggle=!0,this.currentFootprintToggle=!0,this.imageEnhancement=!0,this.imageGallery=!0,this.imageOverlays=!0,this.mapImageConversionTool=!0,this.menu=!0,this.navigationTool=!0,this.digitization=!0,this.title=!0,this.showPopupsAction=!0}get coverageMenu(){return t(n.getLogger(this),"coverageMenu",{replacement:"menu"}),this.menu}set coverageMenu(o){t(n.getLogger(this),"coverageMenu",{replacement:"menu"}),this.menu=o}};o([l({type:Boolean,nonNullable:!0})],a.prototype,"additionalFootprintToggle",void 0),o([l({type:Boolean,nonNullable:!0})],a.prototype,"additionalCameraLocationsToggle",void 0),o([l({type:Boolean,nonNullable:!0})],a.prototype,"currentFootprintToggle",void 0),o([l({type:Boolean,nonNullable:!0})],a.prototype,"coverageMenu",null),o([l({type:Boolean,nonNullable:!0})],a.prototype,"imageEnhancement",void 0),o([l({type:Boolean,nonNullable:!0})],a.prototype,"imageGallery",void 0),o([l({type:Boolean,nonNullable:!0})],a.prototype,"imageOverlays",void 0),o([l({type:Boolean,nonNullable:!0})],a.prototype,"mapImageConversionTool",void 0),o([l({type:Boolean,nonNullable:!0})],a.prototype,"menu",void 0),o([l({type:Boolean,nonNullable:!0})],a.prototype,"navigationTool",void 0),o([l({type:Boolean,nonNullable:!0})],a.prototype,"digitization",void 0),o([l({type:Boolean,nonNullable:!0})],a.prototype,"title",void 0),o([l({type:Boolean,nonNullable:!0})],a.prototype,"showPopupsAction",void 0),a=o([r("esri.widgets.OrientedImageryViewer.OrientedImageryViewerVisibleElements")],a);const i=a;export{i as default};
5
+ import{_ as o}from"../../chunks/tslib.es6.js";import e from"../../core/Accessor.js";import{deprecatedProperty as t}from"../../core/deprecate.js";import n from"../../core/Logger.js";import{property as l}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/RandomLCG.js";import{subclass as r}from"../../core/accessorSupport/decorators/subclass.js";let a=class extends e{constructor(){super(...arguments),this.additionalFootprintToggle=!0,this.additionalCameraLocationsToggle=!0,this.currentFootprintToggle=!0,this.imageEnhancement=!0,this.imageGallery=!0,this.imageOverlays=!0,this.measurementTools=!0,this.mapImageConversionTool=!0,this.menu=!0,this.navigationTool=!0,this.digitization=!0,this.title=!0,this.showPopupsAction=!0}get coverageMenu(){return t(n.getLogger(this),"coverageMenu",{replacement:"menu"}),this.menu}set coverageMenu(o){t(n.getLogger(this),"coverageMenu",{replacement:"menu"}),this.menu=o}};o([l({type:Boolean,nonNullable:!0})],a.prototype,"additionalFootprintToggle",void 0),o([l({type:Boolean,nonNullable:!0})],a.prototype,"additionalCameraLocationsToggle",void 0),o([l({type:Boolean,nonNullable:!0})],a.prototype,"currentFootprintToggle",void 0),o([l({type:Boolean,nonNullable:!0})],a.prototype,"coverageMenu",null),o([l({type:Boolean,nonNullable:!0})],a.prototype,"imageEnhancement",void 0),o([l({type:Boolean,nonNullable:!0})],a.prototype,"imageGallery",void 0),o([l({type:Boolean,nonNullable:!0})],a.prototype,"imageOverlays",void 0),o([l({type:Boolean,nonNullable:!0})],a.prototype,"measurementTools",void 0),o([l({type:Boolean,nonNullable:!0})],a.prototype,"mapImageConversionTool",void 0),o([l({type:Boolean,nonNullable:!0})],a.prototype,"menu",void 0),o([l({type:Boolean,nonNullable:!0})],a.prototype,"navigationTool",void 0),o([l({type:Boolean,nonNullable:!0})],a.prototype,"digitization",void 0),o([l({type:Boolean,nonNullable:!0})],a.prototype,"title",void 0),o([l({type:Boolean,nonNullable:!0})],a.prototype,"showPopupsAction",void 0),a=o([r("esri.widgets.OrientedImageryViewer.OrientedImageryViewerVisibleElements")],a);const i=a;export{i as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.32/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../../chunks/tslib.es6.js";import{createTask as t}from"../../../../core/asyncUtils.js";import s from"../../../../core/Promise.js";import{throwIfAborted as a}from"../../../../core/promiseUtils.js";import{property as r}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/Logger.js";import"../../../../core/RandomLCG.js";import{subclass as i}from"../../../../core/accessorSupport/decorators/subclass.js";import{load as n}from"../../../../geometry/projection.js";import{pixelAreaMeasurement2D as o,pixelDistanceMeasurement2D as l}from"../../imageMeasurementUtils.js";import{SketchHandlerMixin as c}from"../../mixins/SketchHandlerMixin.js";let u=[],h=[],m=0,p=class extends(c(s)){constructor(e){super(e),this.type="measurement",this.measurementArray=[],this.pixelMeasurement=0,this.pixelAreaMeasurement=0,this.polygonVertices=[],this._calculationTask=null,this._distanceCalculation=0,this._areaCalculation=null}initialize(){this.addResolvingPromise(n())}async handleCreate(e){const t=e.toolEventInfo;switch(e.tool){case"polyline":this.handlePolylineEvents(e,t);break;case"polygon":this.handlePolygonEvents(e,t)}}handleDelete(e){this.resetDistanceMeasurements(),this.resetAreaMeasurements()}handleDestroy(){this.resetDistanceMeasurements(),this.resetAreaMeasurements()}async calculateAreaMeasurement(e,t){if(e.length<3||!this.viewModel.currentBestFeature||!this.viewModel.activeViewer?.imageSize)return null;a(t);const s=await this.viewModel.getMeasurementProperties();return s?await o(e,s,!0):null}async calculateDistanceMeasurement(e){if(this.measurementArray.length<2||!this.viewModel.currentBestFeature||!this.viewModel.activeViewer?.imageSize)return null;a(e);const t=await this.viewModel.getMeasurementProperties();return t?await l([this.measurementArray.at(0),this.measurementArray.at(-1)],t,!0):null}cursorUpdatePolylineHandler(e){this.measurementArray.push(e.coordinates);const t=h.reduce(((e,t)=>e+t),0)+this.pixelMeasurement;this.viewModel.distanceMeasurementResult=t}async cursorUpdatePolygonHandler(e){const t=e.coordinates;if(u=[...this.polygonVertices],u.push(t),u.length<3||!this.viewModel.currentBestFeature||!this.viewModel.activeViewer?.imageSize)return;const s=u[0];u=u.filter(((e,t)=>0===t||t===u.length-1||JSON.stringify(e)!==JSON.stringify(s)));const a=await this._getAreaFromTask(u);a?.area&&a?.perimeter&&(m=a.area)}async handlePolylineEvents(e,t){switch("cancel"===e.state&&(this.resetDistanceMeasurements(),this.viewModel.distanceMeasurementResult=0),t?.type){case"cursor-update":this.cursorUpdatePolylineHandler(t);break;case"vertex-add":this.vertexUpdatePolylineHandler()}const s=await this._getDistanceFromTask();this.pixelMeasurement=s??this.pixelMeasurement}async handlePolygonEvents(e,t){if("cancel"===e.state)return this.resetAreaMeasurements(),void(this.viewModel.areaMeasurementResult=0);switch(t?.type){case"vertex-add":await this.vertexAddPolygonHandler(t);break;case"cursor-update":await this.cursorUpdatePolygonHandler(t)}this.viewModel.areaMeasurementResult=m>0?m:this.pixelAreaMeasurement}async vertexAddPolygonHandler(e){const t=e.added,s=t[t.length-1];if(!Array.isArray(s))return;if(this.polygonVertices.push(s),this.polygonVertices.length<3||!this.viewModel.currentBestFeature||!this.viewModel.activeViewer?.imageSize)return;const a=this.polygonVertices[0];this.polygonVertices=this.polygonVertices.filter(((e,t)=>0===t||t===this.polygonVertices.length-1||JSON.stringify(e)!==JSON.stringify(a)));const r=await this._getAreaFromTask(this.polygonVertices);if(!r?.area||!r?.perimeter)return;const{area:i}=r;this.pixelAreaMeasurement=i}vertexUpdatePolylineHandler(){this.measurementArray=this.measurementArray.slice(-1);const e=h.reduce(((e,t)=>e+t),0)+this.pixelMeasurement;this.viewModel.distanceMeasurementResult=e,this.pixelMeasurement>0&&h.push(this.pixelMeasurement)}resetDistanceMeasurements(){this.measurementArray=[],this.pixelMeasurement=0,h=[],this.viewModel.displayNewMeasurementButton=!0}resetAreaMeasurements(){this.polygonVertices=[],this.pixelAreaMeasurement=0,m=0,this.viewModel.displayNewAreaMeasurementButton=!0}async _getAreaFromTask(e){return this._calculationTask?.abort(),this._calculationTask=t((async t=>{this._areaCalculation=null;const s=await this.calculateAreaMeasurement(e,t);a(t),this._areaCalculation=s})),await this._calculationTask.promise,this._areaCalculation}async _getDistanceFromTask(){return this._calculationTask?.abort(),this._calculationTask=t((async e=>{this._distanceCalculation=0;const t=await this.calculateDistanceMeasurement(e);a(e),this._distanceCalculation=t})),await this._calculationTask.promise,this._distanceCalculation}};e([r()],p.prototype,"type",void 0),e([r()],p.prototype,"measurementArray",void 0),e([r()],p.prototype,"pixelMeasurement",void 0),e([r()],p.prototype,"pixelAreaMeasurement",void 0),e([r()],p.prototype,"polygonVertices",void 0),p=e([i("esri.widgets.OrientedImageryViewer.adapters.sketch.MeasurementAdapter")],p);const d=p;export{d as default};
5
+ import{_ as e}from"../../../../chunks/tslib.es6.js";import{createTask as t}from"../../../../core/asyncUtils.js";import a from"../../../../core/Promise.js";import{throwIfAborted as s}from"../../../../core/promiseUtils.js";import{property as i}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/Logger.js";import"../../../../core/RandomLCG.js";import{subclass as r}from"../../../../core/accessorSupport/decorators/subclass.js";import{load as n}from"../../../../geometry/projection.js";import{SketchHandlerMixin as o}from"../../mixins/SketchHandlerMixin.js";let c=[],l=[],u=0,h=class extends(o(a)){constructor(e){super(e),this.type="measurement",this.measurementArray=[],this.pixelMeasurement=0,this.pixelAreaMeasurement=0,this.polygonVertices=[],this._calculationTask=null,this._distanceCalculation=0,this._areaCalculation=null}initialize(){this.addResolvingPromise(n())}async handleCreate(e){const t=e.toolEventInfo;switch(e.tool){case"polyline":this.handlePolylineEvents(e,t);break;case"polygon":this.handlePolygonEvents(e,t)}}handleDelete(e){this.resetDistanceMeasurements(),this.resetAreaMeasurements()}handleDestroy(){this.resetDistanceMeasurements(),this.resetAreaMeasurements()}cursorUpdatePolylineHandler(e){this.measurementArray.push(e.coordinates);const t=l.reduce(((e,t)=>e+t),0)+this.pixelMeasurement;this.viewModel.distanceMeasurementResult=t}async cursorUpdatePolygonHandler(e){const t=e.coordinates;if(c=[...this.polygonVertices],c.push(t),c.length<3||!this.viewModel.currentBestFeature||!this.viewModel.activeViewer?.imageSize)return;const a=c[0];c=c.filter(((e,t)=>0===t||t===c.length-1||JSON.stringify(e)!==JSON.stringify(a)));const s=await this._getAreaFromTask(c);s?.area&&s?.perimeter&&(u=s.area)}async handlePolylineEvents(e,t){const a=this.viewModel.layer?.orientationAccuracy.some((e=>0!==e));if("cancel"===e.state)return this.resetDistanceMeasurements(),this.viewModel.distanceMeasurementResult=0,this.viewModel.distanceAccuracyArray=[],void(this.viewModel.displayNewMeasurementButton=!0);if("complete"===e.state&&e.graphic)return this.viewModel.activeViewer?.addGraphic(e.graphic),this.viewModel.measurementGraphic=e.graphic,void this.resetDistanceMeasurements();switch(t?.type){case"cursor-update":this.cursorUpdatePolylineHandler(t);break;case"vertex-add":if(this.measurementArray.length&&a){const e=await this._getAccuracyFromTask();e&&this.viewModel.distanceAccuracyArray.push(e)}this.vertexUpdatePolylineHandler()}const s=await this._getDistanceFromTask();this.pixelMeasurement=s??this.pixelMeasurement}async handlePolygonEvents(e,t){const a=this.viewModel.layer?.orientationAccuracy.some((e=>0!==e));if("cancel"===e.state)return this.resetAreaMeasurements(),this.viewModel.areaMeasurementResult=0,this.viewModel.areaMeasurementAccuracy=0,void(this.viewModel.displayNewMeasurementButton=!0);if("complete"===e.state&&e.graphic)return this.viewModel.activeViewer?.addGraphic(e.graphic),this.viewModel.measurementGraphic=e.graphic,void this.resetAreaMeasurements();switch(t?.type){case"vertex-add":await this.vertexAddPolygonHandler(t,a);break;case"cursor-update":await this.cursorUpdatePolygonHandler(t)}this.viewModel.areaMeasurementResult=u>0?u:this.pixelAreaMeasurement}async vertexAddPolygonHandler(e,t){const a=e.added,s=a[a.length-1];if(!Array.isArray(s))return;if(this.polygonVertices.push(s),this.polygonVertices.length<3||!this.viewModel.currentBestFeature||!this.viewModel.activeViewer?.imageSize)return;if(t){const e=await this._getAreaAccuracyFromTask(this.polygonVertices);this.viewModel.areaMeasurementAccuracy=e&&e>this.viewModel.areaMeasurementAccuracy?e:this.viewModel.areaMeasurementAccuracy}const i=this.polygonVertices[0];this.polygonVertices=this.polygonVertices.filter(((e,t)=>0===t||t===this.polygonVertices.length-1||JSON.stringify(e)!==JSON.stringify(i)));const r=await this._getAreaFromTask(this.polygonVertices);if(!r?.area||!r?.perimeter)return;const{area:n}=r;this.pixelAreaMeasurement=n}vertexUpdatePolylineHandler(){this.measurementArray=this.measurementArray.slice(-1);const e=l.reduce(((e,t)=>e+t),0)+this.pixelMeasurement;this.viewModel.distanceMeasurementResult=e,this.pixelMeasurement>0&&l.push(this.pixelMeasurement)}resetDistanceMeasurements(){this.measurementArray=[],this.pixelMeasurement=0,l=[]}resetAreaMeasurements(){this.polygonVertices=[],this.pixelAreaMeasurement=0,u=0}async _getAreaFromTask(e){return this._calculationTask?.abort(),this._calculationTask=t((async t=>{this._areaCalculation=null;const a=await this.viewModel.calculateAreaMeasurement(e,t);s(t),this._areaCalculation=a})),await this._calculationTask.promise,this._areaCalculation}async _getDistanceFromTask(){return this._calculationTask?.abort(),this._calculationTask=t((async e=>{this._distanceCalculation=0;const t=await this.viewModel.calculateDistanceMeasurement(this.measurementArray,e);s(e),this._distanceCalculation=t})),await this._calculationTask.promise,this._distanceCalculation}async _getAccuracyFromTask(){return this._calculationTask?.abort(),this._calculationTask=t((async e=>{this._distanceCalculation=0;const t=await this.viewModel.calculateAccuracy(this.measurementArray,"distance",e);s(e),this._distanceCalculation=t})),await this._calculationTask.promise,this._distanceCalculation}async _getAreaAccuracyFromTask(e){return this._calculationTask?.abort(),this._calculationTask=t((async t=>{this._distanceCalculation=0;const a=await this.viewModel.calculateAccuracy(e,"area",t);s(t),this._distanceCalculation=a})),await this._calculationTask.promise,this._distanceCalculation}};e([i()],h.prototype,"type",void 0),e([i()],h.prototype,"measurementArray",void 0),e([i()],h.prototype,"pixelMeasurement",void 0),e([i()],h.prototype,"pixelAreaMeasurement",void 0),e([i()],h.prototype,"polygonVertices",void 0),h=e([r("esri.widgets.OrientedImageryViewer.adapters.sketch.MeasurementAdapter")],h);const m=h;export{m as default};
@@ -0,0 +1,5 @@
1
+ /*
2
+ All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
+ See https://js.arcgis.com/4.32/esri/copyright.txt for details.
4
+ */
5
+ import{_ as e}from"../../../chunks/tslib.es6.js";import{measurementAreaUnits as t}from"../../../core/unitUtils.js";import"../../../core/Logger.js";import"../../../core/has.js";import"../../../core/RandomLCG.js";import"../../../core/Error.js";import{subclass as a}from"../../../core/accessorSupport/decorators/subclass.js";import{css as s}from"../css.js";import c from"./ImageMeasurement.js";import{loadCalciteComponents as r}from"../../support/componentsUtils.js";import{tsx as o}from"../../support/jsxFactory.js";import{UnitSelect as n}from"../../support/UnitSelect.js";let i=class extends c{constructor(e){super(e)}loadDependencies(){return r({action:()=>import("@esri/calcite-components/dist/components/calcite-action"),panel:()=>import("@esri/calcite-components/dist/components/calcite-panel"),button:()=>import("@esri/calcite-components/dist/components/calcite-button"),table:()=>import("@esri/calcite-components/dist/components/calcite-table"),icon:()=>import("@esri/calcite-components/dist/components/calcite-icon"),"table-row":()=>import("@esri/calcite-components/dist/components/calcite-table-row"),"table-header":()=>import("@esri/calcite-components/dist/components/calcite-table-header"),"table-cell":()=>import("@esri/calcite-components/dist/components/calcite-table-cell")})}render(){const{oiViewModel:{displayNewMeasurementButton:e,areaMeasurementResult:a},pixelAreaMeasurementUnit:c,messages:r}=this;return o("calcite-panel",{class:s.measurementResults,key:"measurement-result-container-area"},!e&&!a&&o("div",{class:s.measurementDisplay,key:"measurement-result-area"},r.startMeasurement),o("calcite-button",{class:s.measurementsButton,onclick:()=>this.oiViewModel.newMeasurement("area")},r.newMeasurement),a?o("div",{class:s.measurementsBar},o(n,{options:t,selectLabel:"",value:c,onChange:e=>this.handleAreaMeasurementUnitChange(e)}),a?o("calcite-action",{bind:this,icon:"copy-to-clipboard",onclick:()=>this.copyMeasurementResult("area"),scale:"s",text:""}):null):null,a?o("calcite-table",{bordered:!0,caption:"Measurement Table",class:s.measurementsTable,scale:"s"},o("calcite-table-row",{slot:"table-header"},o("calcite-table-header",{alignment:"center",heading:r.value}),o("calcite-table-header",{alignment:"center",heading:r.accuracy})),o("calcite-table-row",null,o("calcite-table-cell",{alignment:"center"},this.getConvertedAreaString("measurement")),o("calcite-table-cell",{alignment:"center"},this.oiViewModel.areaMeasurementAccuracy?this.getAccuracy("area"):o("calcite-icon",{icon:"hourglass-active",scale:"s"})))):null)}};i=e([a("esri.widgets.OrientedImageryViewer.components.ImageAreaMeasurement")],i);const l=i;export{l as default};
@@ -0,0 +1,5 @@
1
+ /*
2
+ All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
+ See https://js.arcgis.com/4.32/esri/copyright.txt for details.
4
+ */
5
+ import{_ as e}from"../../../chunks/tslib.es6.js";import{measurementLengthUnits as t}from"../../../core/unitUtils.js";import"../../../core/Logger.js";import"../../../core/has.js";import"../../../core/RandomLCG.js";import"../../../core/Error.js";import{subclass as s}from"../../../core/accessorSupport/decorators/subclass.js";import{css as c}from"../css.js";import a from"./ImageMeasurement.js";import{loadCalciteComponents as n}from"../../support/componentsUtils.js";import{tsx as i}from"../../support/jsxFactory.js";import{UnitSelect as o}from"../../support/UnitSelect.js";let r=class extends a{constructor(e){super(e)}loadDependencies(){return n({action:()=>import("@esri/calcite-components/dist/components/calcite-action"),panel:()=>import("@esri/calcite-components/dist/components/calcite-panel"),button:()=>import("@esri/calcite-components/dist/components/calcite-button"),table:()=>import("@esri/calcite-components/dist/components/calcite-table"),icon:()=>import("@esri/calcite-components/dist/components/calcite-icon"),"table-row":()=>import("@esri/calcite-components/dist/components/calcite-table-row"),"table-header":()=>import("@esri/calcite-components/dist/components/calcite-table-header"),"table-cell":()=>import("@esri/calcite-components/dist/components/calcite-table-cell")})}render(){const{oiViewModel:{displayNewMeasurementButton:e,distanceMeasurementResult:s},pixelMeasurementUnit:a,messages:n}=this;return i("calcite-panel",{class:c.measurementResults,key:"measurement-result-container-distance"},!e&&!s&&i("div",{class:c.measurementDisplay,key:"measurement-result-distance"},n.startMeasurement),i("calcite-button",{class:c.measurementsButton,onclick:()=>this.oiViewModel.newMeasurement("distance")},n.newMeasurement),s?i("div",{class:c.measurementsBar},i(o,{options:t,selectLabel:"",value:a,onChange:e=>this.handleDistanceMeasurementUnitChange(e)}),s?i("calcite-action",{bind:this,icon:"copy-to-clipboard",onclick:()=>this.copyMeasurementResult("distance"),scale:"s",text:""}):null):null,s?i("calcite-table",{bordered:!0,caption:"Measurement Table",class:c.measurementsTable,scale:"s"},i("calcite-table-row",{slot:"table-header"},i("calcite-table-header",{alignment:"center",heading:n.value}),i("calcite-table-header",{alignment:"center",heading:n.accuracy})),i("calcite-table-row",null,i("calcite-table-cell",{alignment:"center"},this.getConvertedDistanceString("measurement")),i("calcite-table-cell",{alignment:"center"},this.oiViewModel.distanceAccuracyArray.length?this.getAccuracy("distance"):i("calcite-icon",{icon:"hourglass-active",scale:"s"})))):null)}};r=e([s("esri.widgets.OrientedImageryViewer.components.ImageDistanceMeasurement")],r);const l=r;export{l as default};
@@ -0,0 +1,5 @@
1
+ /*
2
+ All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
+ See https://js.arcgis.com/4.32/esri/copyright.txt for details.
4
+ */
5
+ import{_ as e}from"../../../chunks/tslib.es6.js";import"../../../intl.js";import t from"../../../core/Identifiable.js";import{property as r}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as s}from"../../../core/accessorSupport/decorators/subclass.js";import a from"../../Widget.js";import{getConvertedArea as i,getConvertedDistance as n}from"../imageMeasurementUtils.js";import{substitute as c}from"../../../intl/substitute.js";let o=class extends(t.IdentifiableMixin(a)){constructor(e){super(e),this.messages=null,this.pixelMeasurementUnit="meters",this.pixelAreaMeasurementUnit="square-meters"}copyMeasurementResult(e){let t,r;switch(e){case"area":t={measurement:this.getConvertedAreaString("measurement"),accuracy:this.getConvertedAreaString("accuracy")},r="{measurement} ± {accuracy}";break;case"distance":t={measurement:this.getConvertedDistanceString("measurement"),accuracy:this.getConvertedDistanceString("accuracy")},r="{measurement} ± {accuracy}"}const s=c(r,t);this.oiViewModel.copyToClipboard(s)}getAccuracy(e){let t,r;switch(e){case"area":return t={accuracy:this.getConvertedAreaString("accuracy")},r="± {accuracy}",c(r,t);case"distance":return t={accuracy:this.getConvertedDistanceString("accuracy")},r="± {accuracy}",c(r,t)}}getConvertedAreaString(e){const{oiViewModel:t,measurementUnitMessages:r,pixelAreaMeasurementUnit:s,messages:a}=this;return i(e,t.areaMeasurementResult,t.areaMeasurementAccuracy,r,s,a.startMeasurement)}getConvertedDistanceString(e){const{oiViewModel:t,measurementUnitMessages:r,pixelMeasurementUnit:s,messages:a}=this;return n(e,t.distanceMeasurementResult,t.distanceAccuracyArray,r,s,a.startMeasurement)}handleDistanceMeasurementUnitChange(e){this.pixelMeasurementUnit=e}handleAreaMeasurementUnitChange(e){this.pixelAreaMeasurementUnit=e}};e([r()],o.prototype,"messages",void 0),e([r()],o.prototype,"measurementUnitMessages",void 0),e([r()],o.prototype,"pixelMeasurementUnit",void 0),e([r()],o.prototype,"pixelAreaMeasurementUnit",void 0),e([r()],o.prototype,"oiViewModel",void 0),o=e([s("esri.widgets.OrientedImageryViewer.components.ImageMeasurement")],o);const m=o;export{m as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.32/esri/copyright.txt for details.
4
4
  */
5
- const e="esri-oriented-imagery-viewer",o=`${e}__carousel`,a=`${e}__image-enhancement`,t=`${e}__navigation`,r="--oi-navigation-tool-rotation-from",n="--oi-navigation-tool-rotation-to",i=`${e}__image-overlays`,s={alert:`${e}__alert`,addCoverage:`${e}__body-additional-coverage`,addExpPoints:`${e}__body-additional-camera-locations`,body:`${e}__body`,carousel:`${e}__carousel`,carouselContainer:`${o}-container`,carouselContent:`${o}-content`,carouselItem:`${o}-item`,carouselItemWrapper:`${o}-item-wrapper`,close:`${e}__close`,currentCoverage:`${e}__body-current-coverage`,feature:`${t}-feature`,footprint:`${e}__body-footprint`,imageEnhancementToolContainer:`${a}-tool-container`,imageEnhancementTools:`${a}-tools`,imageEnhancementWrapper:`${a}-wrapper`,imageOverlays:i,imageOverlaysContainer:`${i}-container`,imageOverlaysNoResult:`${i}-no-result`,imageOverlaysIncreasedHeight:`${i}-increased-height`,imageOverlaysLayerList:`${i}-layer-list`,messageBox:`${e}__message-box`,navigationPathOffset0:`${t}-feature-path-stop-offset-0`,navigationPathOffset1:`${t}-feature-path-stop-offset-1`,navigationWrapper:`${t}-wrapper`,navigationZoomed:`${t}-wrapper--zoomed`,north:`${t}-pointer-north`,outerSector:`${t}-sector-outer`,overlaysSwitch:`${i}-switch`,pointer:`${t}-pointer`,rotateWithAnimation:`${t}-animate`,sector:`${t}-sector`,sectorCross:`${t}-sector-cross`,sectorDisabled:`${t}-sector-disabled`,sectorEnabled:`${t}-sector-enabled`,sectorSeparator:`${t}-sector-separator`,selectedFeaturePath:`${t}-feature-path`,submenu:`${e}__submenu`,viewer:`${e}__viewer`,viewerHidden:`${e}__viewer--hidden`,viewerContainer:`${e}__viewer-container`};export{o as carousel,s as css,a as imageEnhancement,t as navigation,r as navigationToolRotationFrom,n as navigationToolRotationTo,e as root};
5
+ const e="esri-oriented-imagery-viewer",a=`${e}__carousel`,t=`${e}__image-enhancement`,r=`${e}__navigation`,o="--oi-navigation-tool-rotation-from",n="--oi-navigation-tool-rotation-to",s=`${e}__image-overlays`,i={alert:`${e}__alert`,addCoverage:`${e}__body-additional-coverage`,addExpPoints:`${e}__body-additional-camera-locations`,body:`${e}__body`,carousel:`${e}__carousel`,carouselContainer:`${a}-container`,carouselContent:`${a}-content`,carouselItem:`${a}-item`,carouselItemWrapper:`${a}-item-wrapper`,close:`${e}__close`,currentCoverage:`${e}__body-current-coverage`,feature:`${r}-feature`,footprint:`${e}__body-footprint`,imageEnhancementToolContainer:`${t}-tool-container`,imageEnhancementTools:`${t}-tools`,imageEnhancementWrapper:`${t}-wrapper`,imageOverlays:s,imageOverlaysContainer:`${s}-container`,imageOverlaysNoResult:`${s}-no-result`,imageOverlaysIncreasedHeight:`${s}-increased-height`,imageOverlaysLayerList:`${s}-layer-list`,measurementResults:`${e}__measurement-results`,measurementsBar:`${e}__measurements-bar`,measurementsButton:`${e}__measurements-button`,measurementsTable:`${e}__measurements-table`,measurementDisplay:`${e}__measurement-display`,messageBox:`${e}__message-box`,navigationPathOffset0:`${r}-feature-path-stop-offset-0`,navigationPathOffset1:`${r}-feature-path-stop-offset-1`,navigationWrapper:`${r}-wrapper`,navigationZoomed:`${r}-wrapper--zoomed`,north:`${r}-pointer-north`,outerSector:`${r}-sector-outer`,overlaysSwitch:`${s}-switch`,pointer:`${r}-pointer`,rotateWithAnimation:`${r}-animate`,sector:`${r}-sector`,sectorCross:`${r}-sector-cross`,sectorDisabled:`${r}-sector-disabled`,sectorEnabled:`${r}-sector-enabled`,sectorSeparator:`${r}-sector-separator`,selectedFeaturePath:`${r}-feature-path`,submenu:`${e}__submenu`,viewer:`${e}__viewer`,viewerHidden:`${e}__viewer--hidden`,viewerContainer:`${e}__viewer-container`};export{a as carousel,i as css,t as imageEnhancement,r as navigation,o as navigationToolRotationFrom,n as navigationToolRotationTo,e as root};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.32/esri/copyright.txt for details.
4
4
  */
5
- import"../../geometry.js";import{geodesicDensify as e,simplify as r,planarLength as t,planarArea as n,geodesicLength as o,geodesicArea as s}from"../../geometry/geometryEngine.js";import{project as i}from"../../geometry/projection.js";import{isSupported as a,geodesicLengths as m,geodesicAreas as c}from"../../geometry/support/geodesicUtils.js";import{imageToWorld as u}from"../../layers/orientedImagery/transformations/imageToWorld.js";import p from"../../geometry/Polyline.js";import f from"../../geometry/Polygon.js";import l from"../../geometry/SpatialReference.js";const y=1e5;async function g(e,r,t=!1){if(e.length<3)return null;const n=W(e,t),o=await d(n,r),s=o.map((({x:e,y:r})=>[e,r]));e.push(e[0]),s.push(s[0]);const i=o[0].spatialReference,a=new p({paths:[s],spatialReference:i}),m=new f({rings:[s],spatialReference:i});return i.isGeographic?h(i,a,m):i.isWebMercator?w(a,m):R(a,m)}async function j(e,r,t=!1){const n=W(e,t);return x(q(await d(n,r)))}function h(t,n,o){if(a(t)){const e=m([n],"meters")[0];return{area:c([o],"square-meters")[0],perimeter:e}}const s=l.WGS84,u=i(n,s),p=i(o,s);let f=e(p,y);if(f=r(f),!f)return null;const g=m([u],"meters")[0];return{area:c([f],"square-meters")[0],perimeter:g}}function R(e,o){const s=r(o);if(!s)return null;const i=t(e,"meters");return{area:n(s,"square-meters"),perimeter:i}}function w(t,n){let i=e(n,y,"meters");if(i=r(i),!i)return null;const a=o(t,"meters");return{area:s(i,"square-meters"),perimeter:a}}function W(e,r){return e.map((e=>({x:r?.5+e[0]:e[0],y:r?.5-e[1]:e[1]})))}async function d(e,r){const{updateElevationProps:t,...n}=r;return await u(e,n,t)}function q(e){const r=e.map((e=>[e.x,e.y])),t=e[0].spatialReference;return new p({paths:[r],spatialReference:t})}function x(e){const r=e.spatialReference;if(r.isGeographic){if(a(r))return m([e],"meters")[0];const t=i(e,l.WGS84);return m([t],"meters")[0]}return r.isWebMercator?o(e,"meters"):t(e,"meters")}export{g as pixelAreaMeasurement2D,j as pixelDistanceMeasurement2D};
5
+ import"../../geometry.js";import{formatLength as e,formatArea as r}from"../../core/quantityFormatUtils.js";import{createLength as t,createArea as n}from"../../core/quantityUtils.js";import{geodesicDensify as o,simplify as s,planarLength as i,planarArea as a,geodesicLength as m,geodesicArea as c}from"../../geometry/geometryEngine.js";import{project as u}from"../../geometry/projection.js";import{isSupported as f,geodesicLengths as p,geodesicAreas as l}from"../../geometry/support/geodesicUtils.js";import{imageToWorld as y}from"../../layers/orientedImagery/transformations/imageToWorld.js";import g from"../../geometry/Polyline.js";import j from"../../geometry/Polygon.js";import d from"../../geometry/SpatialReference.js";const h=1e5;async function q(e,r,t=!1){if(e.length<3)return null;const n=G(e,t),o=await v(n,r),s=o.map((({x:e,y:r})=>[e,r]));e.push(e[0]),s.push(s[0]);const i=o[0].spatialReference,a=new g({paths:[s],spatialReference:i}),m=new j({rings:[s],spatialReference:i});return i.isGeographic?w(i,a,m):i.isWebMercator?x(a,m):W(a,m)}async function R(e,r,t=!1){const n=G(e,t);return S(P(await v(n,r)))}function w(e,r,t){if(f(e)){const e=p([r],"meters")[0];return{area:l([t],"square-meters")[0],perimeter:e}}const n=d.WGS84,i=u(r,n),a=u(t,n);let m=o(a,h);if(m=s(m),!m)return null;const c=p([i],"meters")[0];return{area:l([m],"square-meters")[0],perimeter:c}}function W(e,r){const t=s(r);if(!t)return null;const n=i(e,"meters");return{area:a(t,"square-meters"),perimeter:n}}function x(e,r){let t=o(r,h,"meters");if(t=s(t),!t)return null;const n=m(e,"meters");return{area:c(t,"square-meters"),perimeter:n}}function G(e,r){return e.map((e=>({x:r?.5+e[0]:e[0],y:r?.5-e[1]:e[1]})))}async function v(e,r){const{updateElevationProps:t,...n}=r;return await y(e,n,t)}function P(e){const r=e.map((e=>[e.x,e.y])),t=e[0].spatialReference;return new g({paths:[r],spatialReference:t})}function S(e){const r=e.spatialReference;if(r.isGeographic){if(f(r))return p([e],"meters")[0];const t=u(e,d.WGS84);return p([t],"meters")[0]}return r.isWebMercator?m(e,"meters"):i(e,"meters")}function U(r,n,o,s,i,a){const m="measurement"===r?n:o.reduce(((e,r)=>e+r),0);if(!i||!m)return a;const c="accuracy"===r?6:void 0;return e(s,t(m,"meters"),i,c)||null}function b(e,t,o,s,i,a){const m="measurement"===e?t:o;if(!i||!m)return a;const c="accuracy"===e?6:void 0;return r(s,n(m,"square-meters"),i,c)||null}export{b as getConvertedArea,U as getConvertedDistance,q as pixelAreaMeasurement2D,R as pixelDistanceMeasurement2D};