@arcgis/core 5.2.0-next.80 → 5.2.0-next.81

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 (464) hide show
  1. package/applications/Components/imageryUtils.d.ts +5 -3
  2. package/assets/esri/core/workers/RemoteClient.js +1 -1
  3. package/assets/esri/core/workers/chunks/004966b5bf60a8a80b8c.js +1 -0
  4. package/assets/esri/core/workers/chunks/03cf74b2e488eb144ad5.js +1 -0
  5. package/assets/esri/core/workers/chunks/055802283f7e01ee87fb.js +1 -0
  6. package/assets/esri/core/workers/chunks/06df9ce870360cda06c7.js +1 -0
  7. package/assets/esri/core/workers/chunks/{08ec5461af74356e7570.js → 075eb62465edb9cbf907.js} +1 -1
  8. package/assets/esri/core/workers/chunks/09f0805b32e6cab980e6.js +1 -0
  9. package/assets/esri/core/workers/chunks/{5fe9eea35ddb428efd8b.js → 0b26c01a1190e8fd63fb.js} +1 -1
  10. package/assets/esri/core/workers/chunks/0fd7590e545864f5fff4.js +1 -0
  11. package/assets/esri/core/workers/chunks/{b9d1bb106737a05290e1.js → 104d74bc36c28c519396.js} +1 -1
  12. package/assets/esri/core/workers/chunks/14be79c4cc6137c7db95.js +1 -0
  13. package/assets/esri/core/workers/chunks/{ef47a5da641cb0d33fdf.js → 197a6d561f77ac74283a.js} +1 -1
  14. package/assets/esri/core/workers/chunks/{e4e5a171a4874c5af4a4.js → 1a7d2912c8eac8c83c70.js} +1 -1
  15. package/assets/esri/core/workers/chunks/{b9c61b20bbc91cb63036.js → 1c3861297f65ee1ca5d0.js} +1 -1
  16. package/assets/esri/core/workers/chunks/1d1cfe0bee506d34268e.js +1 -0
  17. package/assets/esri/core/workers/chunks/1ed6a8bb415999c4e8a6.js +1 -0
  18. package/assets/esri/core/workers/chunks/2161cf64601f28bbe72d.js +1 -0
  19. package/assets/esri/core/workers/chunks/218ddad849745d652a28.js +1 -0
  20. package/assets/esri/core/workers/chunks/{5b70295da76d9227f64b.js → 22c477147421e68f7f00.js} +1 -1
  21. package/assets/esri/core/workers/chunks/24944b625ed8dcd904f0.js +1 -0
  22. package/assets/esri/core/workers/chunks/25696c194457e42b3bdc.js +1 -0
  23. package/assets/esri/core/workers/chunks/25f6d5604a7959afd5a5.js +1 -0
  24. package/assets/esri/core/workers/chunks/{c1e5ffe9a251be5a0744.js → 278760d194203dd27fc3.js} +1 -1
  25. package/assets/esri/core/workers/chunks/28b576663ed4570ec825.js +1 -0
  26. package/assets/esri/core/workers/chunks/{841c81c280114412c95b.js → 2a4c91b006de1ceba539.js} +1 -1
  27. package/assets/esri/core/workers/chunks/2b299aec2a758bcd9731.js +1 -0
  28. package/assets/esri/core/workers/chunks/2b79b376b0d60d2f0d5c.js +1 -0
  29. package/assets/esri/core/workers/chunks/{b084829a3fd709dc47a8.js → 2d683ac4a993ec5fd6f6.js} +1 -1
  30. package/assets/esri/core/workers/chunks/2f3525df00fb265661fc.js +1 -0
  31. package/assets/esri/core/workers/chunks/{a8ec5b85c2fa6fb4f391.js → 30b40ee875d46e6fde02.js} +1 -1
  32. package/assets/esri/core/workers/chunks/31b3744f71750e512d4e.js +1 -0
  33. package/assets/esri/core/workers/chunks/3239c7994019f15e261d.js +1 -0
  34. package/assets/esri/core/workers/chunks/{d520d407043bc52e5410.js → 3336ad383c184dd07bb3.js} +1 -1
  35. package/assets/esri/core/workers/chunks/36265e5f6d396eadf0be.js +1 -0
  36. package/assets/esri/core/workers/chunks/{0ae0483b72f5e8d00d55.js → 3715d6b295016eeb5031.js} +1 -1
  37. package/assets/esri/core/workers/chunks/37a121316d114999ac70.js +1 -0
  38. package/assets/esri/core/workers/chunks/37fb38db03cb39e3c342.js +1 -0
  39. package/assets/esri/core/workers/chunks/3851ebf3548e2763b24f.js +1 -0
  40. package/assets/esri/core/workers/chunks/{9230ad807020fc2bbf8e.js → 388b71211a0ad5cbd6b9.js} +1 -1
  41. package/assets/esri/core/workers/chunks/3a4b117af89dab5153eb.js +1 -0
  42. package/assets/esri/core/workers/chunks/3a9ef47122e10cecd3a4.js +1 -0
  43. package/assets/esri/core/workers/chunks/3adba34224cba869a39c.js +1 -0
  44. package/assets/esri/core/workers/chunks/40b842d055b87e442156.js +1 -0
  45. package/assets/esri/core/workers/chunks/40ebe69b08ea54e0e780.js +1 -0
  46. package/assets/esri/core/workers/chunks/{c37b28f200b704ae6002.js → 4239d64f067417e0643c.js} +1 -1
  47. package/assets/esri/core/workers/chunks/453c69879f4b82ba13a1.js +1 -0
  48. package/assets/esri/core/workers/chunks/{bd88228f781a0399d8bd.js → 49e37f653b81f9e4f7cc.js} +1 -1
  49. package/assets/esri/core/workers/chunks/4a537054c99cbc492715.js +1 -0
  50. package/assets/esri/core/workers/chunks/4a6158994a8cc8b8664f.js +1 -0
  51. package/assets/esri/core/workers/chunks/4c15551e33a3c6cda61d.js +1 -0
  52. package/assets/esri/core/workers/chunks/4c5200e22b8a723f53f9.js +1 -0
  53. package/assets/esri/core/workers/chunks/{2bcb7e43578124538c3c.js → 4d672110aee304692f60.js} +1 -1
  54. package/assets/esri/core/workers/chunks/{fb12d3c63fcac8391e06.js → 4eaa93859ceec1b38530.js} +1 -1
  55. package/assets/esri/core/workers/chunks/4f36596280142be1c666.js +1 -0
  56. package/assets/esri/core/workers/chunks/50e6e43ea98cb0d05d91.js +1 -0
  57. package/assets/esri/core/workers/chunks/{8e374ce47256a567ae11.js → 519745cf844c76452a46.js} +1 -1
  58. package/assets/esri/core/workers/chunks/{3b14ed3184743df336a6.js → 53d80202b5f43542d45b.js} +1 -1
  59. package/assets/esri/core/workers/chunks/{345510a95e893fa8040a.js → 540a3685e614bb006744.js} +1 -1
  60. package/assets/esri/core/workers/chunks/54524cc4328f31d8c25d.js +1 -0
  61. package/assets/esri/core/workers/chunks/5515005e8893bd551aaf.js +1 -0
  62. package/assets/esri/core/workers/chunks/{eee1fd629619021ea279.js → 56a6c7abfb4d88ea1bb5.js} +1 -1
  63. package/assets/esri/core/workers/chunks/{24729603dcdbd95fd01e.js → 578904043e873424904c.js} +1 -1
  64. package/assets/esri/core/workers/chunks/58d10928959ae1e2e8d9.js +1 -0
  65. package/assets/esri/core/workers/chunks/59f0a2bd40b033ce77e4.js +1 -0
  66. package/assets/esri/core/workers/chunks/5a67bd724aa7fcdebe16.js +1 -0
  67. package/assets/esri/core/workers/chunks/{087bd698b80ca0cea71e.js → 5aadfd11df6618883c5d.js} +1 -1
  68. package/assets/esri/core/workers/chunks/{1f888f026b004447772c.js → 5c9a398e659ecd427fb5.js} +1 -1
  69. package/assets/esri/core/workers/chunks/{e421dee5d8b030e79ffb.js → 5d50a030bf9f4e94f69d.js} +1 -1
  70. package/assets/esri/core/workers/chunks/6065caa7981cef255277.js +1 -0
  71. package/assets/esri/core/workers/chunks/61190c833791f0833a39.js +1 -0
  72. package/assets/esri/core/workers/chunks/61312d3b5477ed9d87d9.js +2 -0
  73. package/assets/esri/core/workers/chunks/61f230e50787abbfc8ba.js +1 -0
  74. package/assets/esri/core/workers/chunks/6270acb7545be2c5126f.js +1 -0
  75. package/assets/esri/core/workers/chunks/{f3bbebedad51f776bb98.js → 62992c3d98c20f611b7b.js} +1 -1
  76. package/assets/esri/core/workers/chunks/{ac87be2210f868524996.js → 629f60ee49e0dcfb7165.js} +1 -1
  77. package/assets/esri/core/workers/chunks/645d5db85f84b1f19b59.js +1 -0
  78. package/assets/esri/core/workers/chunks/{913fb883455aeac8582b.js → 694216224d5fd3a8956d.js} +1 -1
  79. package/assets/esri/core/workers/chunks/6c372d85b5783dd2a793.js +1 -0
  80. package/assets/esri/core/workers/chunks/{702b2381acf4d1f90094.js → 6f08c8a1e8e3ffd0a96a.js} +1 -1
  81. package/assets/esri/core/workers/chunks/6f4ee60e89d154e7b1c4.js +1 -0
  82. package/assets/esri/core/workers/chunks/{c29df43817278f674707.js → 7028671ffdaafe2725bc.js} +1 -1
  83. package/assets/esri/core/workers/chunks/{40693ee558a1eb1e93f4.js → 70c371c9f133ab9f7925.js} +1 -1
  84. package/assets/esri/core/workers/chunks/7230d74ef720431cc75e.js +1 -0
  85. package/assets/esri/core/workers/chunks/73a8a3baf0fed803ef4f.js +1 -0
  86. package/assets/esri/core/workers/chunks/74cd17aca5f7e0caac90.js +1 -0
  87. package/assets/esri/core/workers/chunks/{4d7a3b3aaf876da0891b.js → 76e6d894c33221369895.js} +1 -1
  88. package/assets/esri/core/workers/chunks/7833a82d5bac2aed565e.js +1 -0
  89. package/assets/esri/core/workers/chunks/7a05f5b0848dd11d2f4f.js +1 -0
  90. package/assets/esri/core/workers/chunks/{4c82f5f23004f905a18f.js → 7b605ed92e65083da35f.js} +1 -1
  91. package/assets/esri/core/workers/chunks/7eb94fc75926bc739233.js +1 -0
  92. package/assets/esri/core/workers/chunks/{67ebde34377f98d17cda.js → 8006ffa263fb8016afdb.js} +1 -1
  93. package/assets/esri/core/workers/chunks/809349086117f199b7a5.js +1 -0
  94. package/assets/esri/core/workers/chunks/82da6d98bd4980a3d454.js +1 -0
  95. package/assets/esri/core/workers/chunks/82e62a54b350e7a325f7.js +1 -0
  96. package/assets/esri/core/workers/chunks/836c458a7eb96391cfda.js +1 -0
  97. package/assets/esri/core/workers/chunks/851a5a0262dc8dcb67eb.js +1 -0
  98. package/assets/esri/core/workers/chunks/856dba96332509fb1d7a.js +2 -0
  99. package/assets/esri/core/workers/chunks/{d7b6985984071e78c764.js → 86035e46777ed896c658.js} +1 -1
  100. package/assets/esri/core/workers/chunks/88d6a7ebded4d359deb0.js +1 -0
  101. package/assets/esri/core/workers/chunks/{38660a8cc3623c854d88.js → 89df303abcbc0167e4d2.js} +1 -1
  102. package/assets/esri/core/workers/chunks/8cfe817299eb16cb2664.js +1 -0
  103. package/assets/esri/core/workers/chunks/8d16d53643dd8d489c25.js +1 -0
  104. package/assets/esri/core/workers/chunks/{619aa1381296172ff47b.js → 8e19b2ce9868a9a08da0.js} +1 -1
  105. package/assets/esri/core/workers/chunks/8ea28a4b1afe8bb2d313.js +1 -0
  106. package/assets/esri/core/workers/chunks/8fff4a41a54d39db470a.js +1 -0
  107. package/assets/esri/core/workers/chunks/{fe71a0604f0928113419.js → 958e161634b5bfd50625.js} +1 -1
  108. package/assets/esri/core/workers/chunks/95b9eaf7a49eeb17e62f.js +1 -0
  109. package/assets/esri/core/workers/chunks/95ff342e5c29bf91a765.js +1 -0
  110. package/assets/esri/core/workers/chunks/97162bbbedb02e42d0b8.js +1 -0
  111. package/assets/esri/core/workers/chunks/973440553c9e058b0132.js +1 -0
  112. package/assets/esri/core/workers/chunks/{680dd7b7638465eb33de.js → 98739b6e7904045edbab.js} +1 -1
  113. package/assets/esri/core/workers/chunks/9a5894e8ebdf0e97b98f.js +1 -0
  114. package/assets/esri/core/workers/chunks/9aa41d098eeda01ded3a.js +1 -0
  115. package/assets/esri/core/workers/chunks/9bd4cda90daf90189bfc.js +1 -0
  116. package/assets/esri/core/workers/chunks/{315031323e11a18154e3.js → 9c04233d18a9585b5bfe.js} +1 -1
  117. package/assets/esri/core/workers/chunks/9c17bfbfc347ac289b6e.js +1 -0
  118. package/assets/esri/core/workers/chunks/9c7afe90495766bba37f.js +1 -0
  119. package/assets/esri/core/workers/chunks/{69b9a327f23e052fced7.js → 9d5d7289a9e23efc7f73.js} +1 -1
  120. package/assets/esri/core/workers/chunks/9e49a6ce4a133476092f.js +1 -0
  121. package/assets/esri/core/workers/chunks/9e840a71906c4deef776.js +1 -0
  122. package/assets/esri/core/workers/chunks/a1bf2111fee455b16e6a.js +29 -0
  123. package/assets/esri/core/workers/chunks/{910c93bbbf8113a4a51f.js → a2a231a671ff578b7b01.js} +1 -1
  124. package/assets/esri/core/workers/chunks/{e9e4b27ba06a29e6340c.js → a3cbd3e983e21f40b253.js} +1 -1
  125. package/assets/esri/core/workers/chunks/{16929524565a677db4dc.js → a406a41a2f117247f1ef.js} +1 -1
  126. package/assets/esri/core/workers/chunks/a4b63162615a485b08dc.js +1 -0
  127. package/assets/esri/core/workers/chunks/a9e944f28bd573c8230d.js +1 -0
  128. package/assets/esri/core/workers/chunks/{6c982779d6d47ec99899.js → b0a9a770b735440846cd.js} +1 -1
  129. package/assets/esri/core/workers/chunks/b2d6fd436981c890152f.js +1 -0
  130. package/assets/esri/core/workers/chunks/b3034fbcbe77ef9e7c20.js +1 -0
  131. package/assets/esri/core/workers/chunks/b3081c0b037abc49d09b.js +1 -0
  132. package/assets/esri/core/workers/chunks/b4b4fe06364bea9b0750.js +1 -0
  133. package/assets/esri/core/workers/chunks/b661aae7e3ce955a783e.js +1 -0
  134. package/assets/esri/core/workers/chunks/{75fc0b1db8e2e3fd2458.js → b8548eb7680abeaf3cd1.js} +1 -1
  135. package/assets/esri/core/workers/chunks/b9db8d059c2ea39518e7.js +1 -0
  136. package/assets/esri/core/workers/chunks/ba8777844fef6ed3ac2b.js +1 -0
  137. package/assets/esri/core/workers/chunks/ba99a650ea64f5024185.js +1 -0
  138. package/assets/esri/core/workers/chunks/bbfd2b4af8e498b61af9.js +1 -0
  139. package/assets/esri/core/workers/chunks/{24006cea112d657f053a.js → bc30c0de6dcb106b24a1.js} +1 -1
  140. package/assets/esri/core/workers/chunks/bf5831a7c12b1e42c669.js +1 -0
  141. package/assets/esri/core/workers/chunks/bfac0f47e81055585002.js +1 -0
  142. package/assets/esri/core/workers/chunks/bfd532e33800755b1f48.js +1 -0
  143. package/assets/esri/core/workers/chunks/c30b6bbabd05e4976fba.js +1 -0
  144. package/assets/esri/core/workers/chunks/c336f300fe6100e36592.js +1 -0
  145. package/assets/esri/core/workers/chunks/c5853fbb975e169c44c5.js +1 -0
  146. package/assets/esri/core/workers/chunks/c71368cd64f240da1743.js +1 -0
  147. package/assets/esri/core/workers/chunks/c899457f19b749516275.js +1 -0
  148. package/assets/esri/core/workers/chunks/c9653a15324ca53d50e7.js +1 -0
  149. package/assets/esri/core/workers/chunks/{9937920e7993814d0b2c.js → ca695ab000a1e8765d69.js} +1 -1
  150. package/assets/esri/core/workers/chunks/{b792857a178da2dd77d6.js → cc419e1c5c1dee7ec972.js} +1 -1
  151. package/assets/esri/core/workers/chunks/{2ce845c990bb4d701362.js → cc817c9d3f8e8f8c56e4.js} +1 -1
  152. package/assets/esri/core/workers/chunks/ce81f29134ab3971bd54.js +1 -0
  153. package/assets/esri/core/workers/chunks/cf6799fd008d0d7016f7.js +1 -0
  154. package/assets/esri/core/workers/chunks/cfcb258b7e464f219434.js +1 -0
  155. package/assets/esri/core/workers/chunks/d0aaa4ad7f76f577f117.js +1 -0
  156. package/assets/esri/core/workers/chunks/{ac59218847e5ef4c4160.js → d0e00f0bb7b9435e170d.js} +1 -1
  157. package/assets/esri/core/workers/chunks/{33e293836f5d28dc5d62.js → d13eeff678972a245d5d.js} +1 -1
  158. package/assets/esri/core/workers/chunks/d1aa87d846a884492b47.js +1 -0
  159. package/assets/esri/core/workers/chunks/{7529c0fcfb83998e63db.js → d1baf17f3219f70106f7.js} +1 -1
  160. package/assets/esri/core/workers/chunks/{2b3f76e03b7a28fc4453.js → d2448e26e19005ef9ab2.js} +1 -1
  161. package/assets/esri/core/workers/chunks/{0179949495c87466b428.js → d3a183d90f1ccc8da2bb.js} +10 -10
  162. package/assets/esri/core/workers/chunks/d433bfa2abf2ca8239ba.js +1 -0
  163. package/assets/esri/core/workers/chunks/d4b78d11a5ce4320a29a.js +1 -0
  164. package/assets/esri/core/workers/chunks/d4cc8eef64b8c84217a5.js +1 -0
  165. package/assets/esri/core/workers/chunks/d62a5a33a24418a3e283.js +1 -0
  166. package/assets/esri/core/workers/chunks/{2740f755c3a322cbd477.js → d672c2a1c8eddd235171.js} +1 -1
  167. package/assets/esri/core/workers/chunks/d845f2115848b56c0369.js +1 -0
  168. package/assets/esri/core/workers/chunks/d8b38c196b06e801c4e6.js +1 -0
  169. package/assets/esri/core/workers/chunks/da6134c7883531f21afe.js +1 -0
  170. package/assets/esri/core/workers/chunks/dbc36b85413fae52b56d.js +1 -0
  171. package/assets/esri/core/workers/chunks/{cada52d719c35d40958a.js → dbca32f0e0c2c2e2ccf3.js} +1 -1
  172. package/assets/esri/core/workers/chunks/dcec7fc66385c12ecdf0.js +1 -0
  173. package/assets/esri/core/workers/chunks/dd9af4ddefa0b998aa4b.js +1 -0
  174. package/assets/esri/core/workers/chunks/e2473de49189d93714d3.js +1 -0
  175. package/assets/esri/core/workers/chunks/e2ceddd6bcdabec77cc7.js +1 -0
  176. package/assets/esri/core/workers/chunks/e3eab61815ef1c521a6c.js +1 -0
  177. package/assets/esri/core/workers/chunks/e63f94c8097555b266ad.js +2 -0
  178. package/assets/esri/core/workers/chunks/e72fa08b0bd324514a0e.js +1 -0
  179. package/assets/esri/core/workers/chunks/e8a9a686a3c23afc9d1f.js +1 -0
  180. package/assets/esri/core/workers/chunks/eca0736953a20cfc64ad.js +2 -0
  181. package/assets/esri/core/workers/chunks/efaa455beeefbf97a4c5.js +1 -0
  182. package/assets/esri/core/workers/chunks/efd176c5ac35f313e7a2.js +1 -0
  183. package/assets/esri/core/workers/chunks/f16b6cd6b325eb600e82.js +1 -0
  184. package/assets/esri/core/workers/chunks/f1d0208c6b09c1c4b248.js +1 -0
  185. package/assets/esri/core/workers/chunks/f1fa377e8fa53b02876f.js +1 -0
  186. package/assets/esri/core/workers/chunks/f2d99f693a590f384315.js +1 -0
  187. package/assets/esri/core/workers/chunks/f57e5e7d0748d9a370f7.js +1 -0
  188. package/assets/esri/core/workers/chunks/f71a3fe5f30aa782193a.js +1 -0
  189. package/assets/esri/core/workers/chunks/{b9bdb1f05e904c3655e4.js → f834aa732c3f06525089.js} +1 -1
  190. package/assets/esri/core/workers/chunks/f9e9e79f78be32e5d475.js +1 -0
  191. package/assets/esri/core/workers/chunks/fa7a6906598d1002abfd.js +1 -0
  192. package/assets/esri/core/workers/chunks/{ebb722118a220c92efc3.js → fae32c9ce811934b6a64.js} +1 -1
  193. package/assets/esri/core/workers/chunks/fb86b334bfca4670dcfa.js +1 -0
  194. package/assets/esri/core/workers/chunks/fbb0b2f4ec0ba458ddeb.js +1 -0
  195. package/assets/esri/core/workers/chunks/{2d1ae18a28491b00091d.js → fbcc346fa603d6edac98.js} +1 -1
  196. package/assets/esri/core/workers/chunks/{1ef28d4457c8c943ad19.js → fbede01a363895b6381f.js} +1 -1
  197. package/assets/esri/core/workers/chunks/{073f1d5f89875c6aefb1.js → fc1aeea22f8c9d63864a.js} +1 -1
  198. package/assets/esri/core/workers/chunks/fc2234e0d202631f3abf.js +2 -0
  199. package/assets/esri/core/workers/chunks/fcb943c3b31b1bf62e65.js +2 -0
  200. package/assets/esri/core/workers/chunks/{8a3289e15e0ce92e3813.js → fe335441ea233cb0fad5.js} +1 -1
  201. package/assets/esri/core/workers/chunks/ffe2cbfea38b92a231d6.js +1 -0
  202. package/chunks/Bufferer-CclWhXVb.js +1 -1
  203. package/chunks/Distance2DCalculator-DjIp2uQi.js +1 -1
  204. package/chunks/EmissionComposite.glsl.js +1 -1
  205. package/chunks/Envelope.js +1 -1
  206. package/chunks/GaussianSplat.glsl.js +8 -8
  207. package/chunks/GaussianSplatDepth.glsl.js +4 -4
  208. package/chunks/GeodeticDistanceCalculator-zRp89-dW.js +1 -1
  209. package/chunks/GeodeticUtils.js +1 -1
  210. package/chunks/Geometry.js +1 -1
  211. package/chunks/MultiPathImpl.js +1 -1
  212. package/chunks/OperatorCrosses.js +1 -1
  213. package/chunks/OperatorCut.js +1 -1
  214. package/chunks/OperatorGeodesicBuffer.js +1 -1
  215. package/chunks/OperatorGeodeticArea.js +1 -1
  216. package/chunks/OperatorGeodeticDensifyByLength.js +1 -1
  217. package/chunks/OperatorGeodeticLength.js +1 -1
  218. package/chunks/OperatorGraphicBuffer.js +1 -1
  219. package/chunks/OperatorIntegrate.js +1 -1
  220. package/chunks/OperatorIntersects.js +1 -1
  221. package/chunks/OperatorMultiPartToSinglePart.js +1 -1
  222. package/chunks/OperatorOverlaps.js +1 -1
  223. package/chunks/OperatorProject.js +1 -1
  224. package/chunks/OperatorProximity.js +1 -1
  225. package/chunks/OperatorProximityGeodesic.js +1 -1
  226. package/chunks/OperatorShapePreservingLength.js +1 -1
  227. package/chunks/OperatorShapePreservingProject.js +1 -1
  228. package/chunks/OperatorSimplifyOGC.js +1 -1
  229. package/chunks/OperatorTouches.js +1 -1
  230. package/chunks/OperatorWithin.js +1 -1
  231. package/chunks/Point2D.js +1 -1
  232. package/chunks/ProjectionTransformation.js +1 -1
  233. package/chunks/SideCalculator2D-DX0718xq.js +1 -1
  234. package/chunks/SpatialReference.js +1 -1
  235. package/chunks/UnitFactory.js +2 -0
  236. package/chunks/containsOperator.js +1 -1
  237. package/chunks/disjointOperator.js +1 -1
  238. package/chunks/equalsOperator.js +1 -1
  239. package/chunks/relateOperator.js +1 -1
  240. package/config.js +1 -1
  241. package/geometry/operators/containsOperator.js +1 -1
  242. package/geometry/operators/disjointOperator.js +1 -1
  243. package/geometry/operators/gx/geodeticUtils.js +1 -1
  244. package/geometry/operators/gx/operatorAutoComplete.js +1 -1
  245. package/geometry/operators/gx/operatorBuffer.js +1 -1
  246. package/geometry/operators/gx/operatorDifference.js +1 -1
  247. package/geometry/operators/gx/operatorGeodesicBuffer.js +1 -1
  248. package/geometry/operators/gx/operatorGeodeticArea.js +1 -1
  249. package/geometry/operators/gx/operatorGeodeticDensify.js +1 -1
  250. package/geometry/operators/gx/operatorGeodeticDistance.js +1 -1
  251. package/geometry/operators/gx/operatorGeodeticLength.js +1 -1
  252. package/geometry/operators/gx/operatorIntersection.js +1 -1
  253. package/geometry/operators/gx/operatorLabelPoint.js +1 -1
  254. package/geometry/operators/gx/operatorLinesToPolygons.js +1 -1
  255. package/geometry/operators/gx/operatorPolygonOverlay.js +1 -1
  256. package/geometry/operators/gx/operatorProject.js +1 -1
  257. package/geometry/operators/gx/operatorProximityGeodesic.js +1 -1
  258. package/geometry/operators/gx/operatorShapePreservingProject.js +1 -1
  259. package/geometry/operators/gx/operatorSimplify.js +1 -1
  260. package/geometry/operators/gx/operatorSinglePartToMultiPart.js +1 -1
  261. package/geometry/operators/gx/operatorSymmetricDifference.js +1 -1
  262. package/geometry/operators/gx/operatorUnion.js +1 -1
  263. package/geometry/operators/json/containsOperator.js +1 -1
  264. package/geometry/operators/json/disjointOperator.js +1 -1
  265. package/geometry/operators/projectOperator.js +1 -1
  266. package/geometry/operators/reshapeOperator.js +1 -1
  267. package/geometry/operators/support/geographicTransformationUtils.js +1 -1
  268. package/geometry/operators/support/initNoPeFactory.js +1 -1
  269. package/geometry/operators/support/jsonConverter.js +1 -1
  270. package/geometry/operators/support/projectionTransformation.js +1 -1
  271. package/geometry/projection/projectionUtilsState.js +2 -0
  272. package/geometry/projectionUtils.js +1 -1
  273. package/geometry/support/geometryUtils.js +1 -1
  274. package/kernel.js +1 -1
  275. package/layers/raster/datasets/MRFRaster.js +1 -1
  276. package/layers/raster/formats/JpgPlus.js +1 -1
  277. package/layers/raster/formats/RasterCodec.js +1 -1
  278. package/layers/raster/types.d.ts +65 -0
  279. package/package.json +2 -2
  280. package/support/revision.js +1 -1
  281. package/symbols/cim/cimAnalyzer.js +1 -1
  282. package/symbols/cim/effects/EffectRadial.js +1 -1
  283. package/views/2d/engine/vectorTiles/decluttering/SymbolRepository.js +1 -1
  284. package/views/2d/engine/webgl/mesh/templates/segmentUtils.js +1 -1
  285. package/views/2d/engine/webgl/shaderGraph/techniques/fill/FillMeshWriter.js +1 -1
  286. package/views/2d/engine/webgl/shaderGraph/techniques/fill/GradientFillMeshWriter.js +1 -1
  287. package/views/2d/engine/webgl/shaderGraph/techniques/line/LineMeshWriter.js +1 -1
  288. package/views/2d/engine/webgl/shaderGraph/techniques/mesh/MeshWriter.js +1 -1
  289. package/views/2d/layers/features/schema/processor/symbols/ComplexSymbolSchema.js +1 -1
  290. package/views/3d/GroundView3D.js +1 -1
  291. package/views/3d/layers/I3SMeshView3D.js +1 -1
  292. package/views/3d/layers/IntegratedMesh3DTilesLayerView3D.js +1 -1
  293. package/views/3d/layers/IntegratedMeshLayerView3D.js +1 -1
  294. package/views/3d/layers/graphics/Graphics3DFrustumVisibility.js +1 -1
  295. package/views/3d/state/controllers/PinchAndPanControllerGlobal.js +1 -1
  296. package/views/3d/state/controllers/PinchAndPanControllerLocal.js +1 -1
  297. package/views/3d/state/controllers/RotateController.js +1 -1
  298. package/views/3d/state/controllers/ZoomControllerGlobal.js +1 -1
  299. package/views/3d/state/controllers/ZoomControllerLocal.js +1 -1
  300. package/views/3d/state/controllers/ZoomStepControllerLocal.js +1 -1
  301. package/views/3d/state/helpers/SceneIntersectionHelper.js +1 -1
  302. package/views/3d/support/QualityProfile.js +1 -1
  303. package/views/3d/support/QualitySettings.js +1 -1
  304. package/views/3d/support/gaussianSplatting/GaussianSplatFadeHelper.js +1 -1
  305. package/views/3d/terrain/PlanarPatch.js +1 -1
  306. package/views/3d/terrain/Tile.js +1 -1
  307. package/views/3d/webgl-engine/lib/BasisUtil.js +1 -1
  308. package/views/3d/webgl-engine/lib/EmissionComposite.glsl.js +1 -1
  309. package/views/3d/webgl-engine/lib/EmissionComposite.js +1 -1
  310. package/views/3d/webgl-engine/lib/EmissionCompositeTechnique.js +1 -1
  311. package/views/3d/webgl-engine/lib/GaussianSplatRenderUtils.js +1 -1
  312. package/views/3d/webgl-engine/lib/GaussianSplatRenderer.js +1 -1
  313. package/views/3d/webgl-engine/shaders/GaussianSplatDepthPolicy.js +1 -1
  314. package/views/3d/webgl-engine/shaders/GaussianSplatPass.glsl.js +50 -22
  315. package/views/analysis/ElevationProfile/ElevationProfileController.js +1 -1
  316. package/views/support/GroundElevationSampler.js +1 -1
  317. package/widgets/BatchAttributeForm/expressions/ExpressionsManager.js +1 -1
  318. package/widgets/BatchAttributeForm/expressions/expressionUtils.js +1 -1
  319. package/widgets/ElevationProfile/ElevationProfileViewModel.js +1 -1
  320. package/widgets/OrientedImageryViewer/OrientedImageryViewerViewModel.js +1 -1
  321. package/widgets/OrientedImageryViewer/components/ImageLocationViewModel.js +1 -1
  322. package/widgets/OrientedImageryViewer/components/ImageLocationWidget.js +1 -1
  323. package/widgets/OrientedImageryViewer.js +1 -1
  324. package/assets/esri/core/workers/chunks/04105d83556409489835.js +0 -1
  325. package/assets/esri/core/workers/chunks/05b6b2c0b76afb100e33.js +0 -1
  326. package/assets/esri/core/workers/chunks/0909816f13d25cacf250.js +0 -1
  327. package/assets/esri/core/workers/chunks/0933203eee15ea50e123.js +0 -1
  328. package/assets/esri/core/workers/chunks/0b18de5147d76b68896f.js +0 -1
  329. package/assets/esri/core/workers/chunks/0d9d33f29124d464a4cb.js +0 -1
  330. package/assets/esri/core/workers/chunks/0d9fe49812554e7d7ba7.js +0 -1
  331. package/assets/esri/core/workers/chunks/0da5b27b070ab780f8b3.js +0 -1
  332. package/assets/esri/core/workers/chunks/0e333aced8b23aa49a0e.js +0 -1
  333. package/assets/esri/core/workers/chunks/0eaa8265a4cd64297545.js +0 -1
  334. package/assets/esri/core/workers/chunks/1142f8e9c80207d6bdae.js +0 -1
  335. package/assets/esri/core/workers/chunks/118ccfa2d685764752ee.js +0 -1
  336. package/assets/esri/core/workers/chunks/12a64eca4c571926d9d4.js +0 -1
  337. package/assets/esri/core/workers/chunks/1642fa1263d8f4a45101.js +0 -1
  338. package/assets/esri/core/workers/chunks/16a04fc184728d66e6e1.js +0 -1
  339. package/assets/esri/core/workers/chunks/18e0e993c0c39c962e61.js +0 -1
  340. package/assets/esri/core/workers/chunks/19233d0016e5b154c5ce.js +0 -1
  341. package/assets/esri/core/workers/chunks/1a467da4c0b33f655199.js +0 -1
  342. package/assets/esri/core/workers/chunks/1ac8a7a129ba33e05a24.js +0 -1
  343. package/assets/esri/core/workers/chunks/1d92d53186debd52e753.js +0 -1
  344. package/assets/esri/core/workers/chunks/1dba93abe84d30f05d8d.js +0 -1
  345. package/assets/esri/core/workers/chunks/2033e6d42453e4e67048.js +0 -1
  346. package/assets/esri/core/workers/chunks/20b54e7872d967f3be32.js +0 -1
  347. package/assets/esri/core/workers/chunks/2501d9459f6d14c797e5.js +0 -1
  348. package/assets/esri/core/workers/chunks/253c231b5a52f1d2d3a5.js +0 -1
  349. package/assets/esri/core/workers/chunks/257f1e8316877f611e11.js +0 -1
  350. package/assets/esri/core/workers/chunks/28924f31f5ba8ebdc60a.js +0 -1
  351. package/assets/esri/core/workers/chunks/28b09fe50b855a1d8a3f.js +0 -1
  352. package/assets/esri/core/workers/chunks/2b0558c1716425974563.js +0 -2
  353. package/assets/esri/core/workers/chunks/2e7c830b5b1fe406169f.js +0 -1
  354. package/assets/esri/core/workers/chunks/2f4ed8a63d57636a4ebe.js +0 -1
  355. package/assets/esri/core/workers/chunks/393f79843d5a78c1cc37.js +0 -1
  356. package/assets/esri/core/workers/chunks/3958d92c737b3a2a3bc2.js +0 -1
  357. package/assets/esri/core/workers/chunks/3978f00a03e97645b276.js +0 -1
  358. package/assets/esri/core/workers/chunks/3b5c5356353f1a2303a0.js +0 -1
  359. package/assets/esri/core/workers/chunks/40e48b720d89cd067892.js +0 -1
  360. package/assets/esri/core/workers/chunks/436d51b9f1b1b5abc4bc.js +0 -1
  361. package/assets/esri/core/workers/chunks/44a786aba84918f2b247.js +0 -1
  362. package/assets/esri/core/workers/chunks/463747a822499dd933ef.js +0 -1
  363. package/assets/esri/core/workers/chunks/484b251fbcbffcb58323.js +0 -1
  364. package/assets/esri/core/workers/chunks/495f90fe3d0ad32bb82d.js +0 -1
  365. package/assets/esri/core/workers/chunks/49a3888bf9e2481642ac.js +0 -1
  366. package/assets/esri/core/workers/chunks/4ce57dd39075e8fb357c.js +0 -1
  367. package/assets/esri/core/workers/chunks/5459ba8fdeb2370bb52b.js +0 -1
  368. package/assets/esri/core/workers/chunks/55924fb0de05e727f5e3.js +0 -1
  369. package/assets/esri/core/workers/chunks/55dda957c79fb285185f.js +0 -1
  370. package/assets/esri/core/workers/chunks/56e6d8c4a9ed893ce951.js +0 -1
  371. package/assets/esri/core/workers/chunks/57159bcac86d660dcceb.js +0 -1
  372. package/assets/esri/core/workers/chunks/58026fc30d8a0ded4102.js +0 -1
  373. package/assets/esri/core/workers/chunks/5eb29f0068f1c839d05e.js +0 -1
  374. package/assets/esri/core/workers/chunks/5f553da48d0ccbbfcd3c.js +0 -2
  375. package/assets/esri/core/workers/chunks/5fb76575575fe8cfb1f0.js +0 -1
  376. package/assets/esri/core/workers/chunks/6072c63a5da4366e9942.js +0 -1
  377. package/assets/esri/core/workers/chunks/626a715fdec93e188e0c.js +0 -1
  378. package/assets/esri/core/workers/chunks/6525c925bb91facb3575.js +0 -1
  379. package/assets/esri/core/workers/chunks/6529b5cc3ac6baa29fff.js +0 -2
  380. package/assets/esri/core/workers/chunks/65d1e338612e59063eba.js +0 -1
  381. package/assets/esri/core/workers/chunks/66e60351aacbd162775f.js +0 -1
  382. package/assets/esri/core/workers/chunks/694371f51c52a7a94da4.js +0 -1
  383. package/assets/esri/core/workers/chunks/69b0dcd7bcd8ec42e2c3.js +0 -1
  384. package/assets/esri/core/workers/chunks/7260e63252fa5452dc22.js +0 -1
  385. package/assets/esri/core/workers/chunks/72eb0ac55026a4f5d6a7.js +0 -1
  386. package/assets/esri/core/workers/chunks/79429c8be5da85713200.js +0 -1
  387. package/assets/esri/core/workers/chunks/79c0a966f7d11d3c217f.js +0 -1
  388. package/assets/esri/core/workers/chunks/7b470d6ad182548b9e95.js +0 -1
  389. package/assets/esri/core/workers/chunks/7b862a074816c099b9ff.js +0 -1
  390. package/assets/esri/core/workers/chunks/7baa363b3b0a442a63d2.js +0 -1
  391. package/assets/esri/core/workers/chunks/7d8eb4dbea1916320f74.js +0 -1
  392. package/assets/esri/core/workers/chunks/7ddf9b2718dd047f15e6.js +0 -1
  393. package/assets/esri/core/workers/chunks/835af7b4fd92cb4e7af0.js +0 -1
  394. package/assets/esri/core/workers/chunks/8566449c39eba55147f5.js +0 -1
  395. package/assets/esri/core/workers/chunks/864691186c449ca2c3db.js +0 -1
  396. package/assets/esri/core/workers/chunks/88d5541679e77117bf03.js +0 -1
  397. package/assets/esri/core/workers/chunks/88fd698b940dadcc6dc5.js +0 -1
  398. package/assets/esri/core/workers/chunks/894ebc64b698e5d7604b.js +0 -1
  399. package/assets/esri/core/workers/chunks/8be707044d992ef5f1d8.js +0 -1
  400. package/assets/esri/core/workers/chunks/8c1bddc88cc5f4251021.js +0 -1
  401. package/assets/esri/core/workers/chunks/8eecc6df6511c8830f5d.js +0 -1
  402. package/assets/esri/core/workers/chunks/8f0d4aec8bd3cbfefc40.js +0 -1
  403. package/assets/esri/core/workers/chunks/8fea514aada1195c8f30.js +0 -1
  404. package/assets/esri/core/workers/chunks/94bf7f0da6ad3f7ea277.js +0 -1
  405. package/assets/esri/core/workers/chunks/987594539981483a7c5e.js +0 -1
  406. package/assets/esri/core/workers/chunks/995a433936fc90d41634.js +0 -2
  407. package/assets/esri/core/workers/chunks/9bbff8237540409610b3.js +0 -1
  408. package/assets/esri/core/workers/chunks/9e1392a0c608a13ab036.js +0 -1
  409. package/assets/esri/core/workers/chunks/9f1211d2267fb7673c4d.js +0 -1
  410. package/assets/esri/core/workers/chunks/a486d99f9879f94151ba.js +0 -1
  411. package/assets/esri/core/workers/chunks/a50421fe79f264ae3619.js +0 -1
  412. package/assets/esri/core/workers/chunks/a5c115fc53edb52ce1de.js +0 -1
  413. package/assets/esri/core/workers/chunks/a739e617fc461014ad1f.js +0 -1
  414. package/assets/esri/core/workers/chunks/aa21031c8f12ca438eaa.js +0 -1
  415. package/assets/esri/core/workers/chunks/ad27689b231e282b7620.js +0 -1
  416. package/assets/esri/core/workers/chunks/aed16c3e26652960ad3f.js +0 -1
  417. package/assets/esri/core/workers/chunks/af6e8c961fd768fa7be3.js +0 -1
  418. package/assets/esri/core/workers/chunks/b3a1a93c6dc9247cb048.js +0 -1
  419. package/assets/esri/core/workers/chunks/b4abf82b8ac974a55ae1.js +0 -1
  420. package/assets/esri/core/workers/chunks/b8cd81d8fcc78d272130.js +0 -1
  421. package/assets/esri/core/workers/chunks/b9a1046ca2cd0cca5da5.js +0 -1
  422. package/assets/esri/core/workers/chunks/b9d6f89f9b8e9d1bc787.js +0 -1
  423. package/assets/esri/core/workers/chunks/bab5f4b2424b487b87ac.js +0 -1
  424. package/assets/esri/core/workers/chunks/c02b3b8b71205f6ce290.js +0 -1
  425. package/assets/esri/core/workers/chunks/c17dda6fadb8bfad0d51.js +0 -1
  426. package/assets/esri/core/workers/chunks/c21212c356f65244e34e.js +0 -1
  427. package/assets/esri/core/workers/chunks/c374e5d5980db74c4aca.js +0 -1
  428. package/assets/esri/core/workers/chunks/c6bf17b5ff6ec4b980a1.js +0 -1
  429. package/assets/esri/core/workers/chunks/c99dcc17fbd7acd2ad2e.js +0 -1
  430. package/assets/esri/core/workers/chunks/ce481eeb27ea9c1782ae.js +0 -1
  431. package/assets/esri/core/workers/chunks/cec1c87eb3749276ced4.js +0 -1
  432. package/assets/esri/core/workers/chunks/cef02ed3942c010da2e8.js +0 -29
  433. package/assets/esri/core/workers/chunks/cfdbc48f58433a3d5fc3.js +0 -1
  434. package/assets/esri/core/workers/chunks/d456520e4b119a2816b6.js +0 -1
  435. package/assets/esri/core/workers/chunks/d8da31bfe2bc4174e5aa.js +0 -1
  436. package/assets/esri/core/workers/chunks/da1c9257793c2817f40f.js +0 -1
  437. package/assets/esri/core/workers/chunks/dc0c3109b7558b4fe016.js +0 -1
  438. package/assets/esri/core/workers/chunks/ddd8f6154e265dbb6f9f.js +0 -1
  439. package/assets/esri/core/workers/chunks/de601f0d5a2a282d2efd.js +0 -1
  440. package/assets/esri/core/workers/chunks/e227eb44cd139fe2bc1b.js +0 -1
  441. package/assets/esri/core/workers/chunks/e2ddfc96ddba92302e0c.js +0 -1
  442. package/assets/esri/core/workers/chunks/e61ab8ef30bbe788b9d7.js +0 -1
  443. package/assets/esri/core/workers/chunks/e89e6eea380ca2c13b64.js +0 -1
  444. package/assets/esri/core/workers/chunks/e9d352d030dcad1619a6.js +0 -1
  445. package/assets/esri/core/workers/chunks/eb95464bd017fb839510.js +0 -1
  446. package/assets/esri/core/workers/chunks/ed4ac5568dc2815b066d.js +0 -1
  447. package/assets/esri/core/workers/chunks/ed564358cc7b3ee463a3.js +0 -1
  448. package/assets/esri/core/workers/chunks/ee63c693f2539f3bfa17.js +0 -2
  449. package/assets/esri/core/workers/chunks/ef2e0a014c982d9c7ca4.js +0 -1
  450. package/assets/esri/core/workers/chunks/ef9489d1dccb817460bb.js +0 -2
  451. package/assets/esri/core/workers/chunks/f086c6d229fb34a9d7f9.js +0 -1
  452. package/assets/esri/core/workers/chunks/f35e749bb5be39880cbe.js +0 -1
  453. package/assets/esri/core/workers/chunks/f4bc563c71c478d3912f.js +0 -1
  454. package/assets/esri/core/workers/chunks/f6150b51a9430691a040.js +0 -1
  455. package/assets/esri/core/workers/chunks/f6f7d885b4d6080e3f58.js +0 -1
  456. package/assets/esri/core/workers/chunks/f95870bb4d8e4e13e69e.js +0 -1
  457. package/assets/esri/core/workers/chunks/fa59f10ed0f182a2a7f3.js +0 -1
  458. package/assets/esri/core/workers/chunks/fc9065d0cd6285fe0f0d.js +0 -1
  459. /package/assets/esri/core/workers/chunks/{ee63c693f2539f3bfa17.js.LICENSE.txt → 61312d3b5477ed9d87d9.js.LICENSE.txt} +0 -0
  460. /package/assets/esri/core/workers/chunks/{6529b5cc3ac6baa29fff.js.LICENSE.txt → 856dba96332509fb1d7a.js.LICENSE.txt} +0 -0
  461. /package/assets/esri/core/workers/chunks/{995a433936fc90d41634.js.LICENSE.txt → e63f94c8097555b266ad.js.LICENSE.txt} +0 -0
  462. /package/assets/esri/core/workers/chunks/{5f553da48d0ccbbfcd3c.js.LICENSE.txt → eca0736953a20cfc64ad.js.LICENSE.txt} +0 -0
  463. /package/assets/esri/core/workers/chunks/{ef9489d1dccb817460bb.js.LICENSE.txt → fc2234e0d202631f3abf.js.LICENSE.txt} +0 -0
  464. /package/assets/esri/core/workers/chunks/{2b0558c1716425974563.js.LICENSE.txt → fcb943c3b31b1bf62e65.js.LICENSE.txt} +0 -0
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import t from"../../Graphic.js";import{equals as i,isSome as r}from"../../core/arrayUtils.js";import{createTask as a}from"../../core/asyncUtils.js";import o from"../../core/Collection.js";import{deprecatedProperty as s}from"../../core/deprecate.js";import n from"../../core/Error.js";import{EventedMixin as l}from"../../core/Evented.js";import{makeHandle as d}from"../../core/handleUtils.js";import{equalsShallow as c}from"../../core/lang.js";import u from"../../core/Logger.js";import{clamp as h}from"../../core/mathUtils.js";import{destroyMaybe as p,abortMaybe as m}from"../../core/maybe.js";import{EsriPromise as g}from"../../core/Promise.js";import{isAbortError as v,throwIfAborted as y,waitTick as f}from"../../core/promiseUtils.js";import w from"../../core/ReactiveMap.js";import{whenOnce as _,on as F,watch as b,syncAndInitial as M,initial as V,when as S}from"../../core/reactiveUtils.js";import{sqlAnd as I}from"../../core/sql.js";import{getMetersPerUnitForSR as P}from"../../core/units.js";import{property as C,subclass as A}from"../../core/accessorSupport/decorators.js";import{isSerializable as k}from"../../core/support/jsonUtils.js";import{UpdatingHandles as O}from"../../core/support/UpdatingHandles.js";import T from"../../geometry/Extent.js";import L from"../../geometry/Point.js";import{projectAsync as G}from"../../geometry/projectionUtils.js";import E from"../../geometry/SpatialReference.js";import{polygonCentroidPoint as j}from"../../geometry/support/centroid.js";import{isClockwise as x}from"../../geometry/support/coordsUtils.js";import{normalizeMapX as R}from"../../geometry/support/normalizeUtils.js";import{geographicToWebMercator as B}from"../../geometry/support/webMercatorUtils.js";import D from"../../layers/GraphicsLayer.js";import H from"../../layers/MediaLayer.js";import{searchImages as z,getSortedLayerFeatures as N}from"../../layers/orientedImagery/queries.js";import{calculateSuitabilities as U}from"../../layers/orientedImagery/core/bestImageUtils.js";import{createCoveragePolygon as q,computePolygonForInspection as W,resizePolygon as $,checkIfPolygonContainsSelectedPoint as Z}from"../../layers/orientedImagery/core/coverageUtils.js";import{isElevationSource as J}from"../../layers/orientedImagery/core/ElevationSourceDefinitions.js";import{getMetersPerUnitOfSR as K,convertGeographicToWebMercator as Q}from"../../layers/orientedImagery/core/utils.js";import X from"../../layers/orientedImagery/transformations/updateElevation.js";import{getElevationSampler as Y}from"../../layers/orientedImagery/transformations/updateElevationUtils.js";import{or as ee,getInitialAngle as te,convertPixelLocationToSphereVertex as ie,getUpdateElevationProps as re,getImageToWorldProperties as ae,getImageToWorldPanoramicProperties as oe}from"../../layers/orientedImagery/transformations/utils.js";import se from"../../layers/support/ExtentAndRotationGeoreference.js";import{getFloorFilterClause as ne}from"../../layers/support/floorFilterUtils.js";import le from"../../layers/support/VideoElement.js";import de from"../../views/MapView.js";import ce from"../../views/draw/Draw.js";import{scale as ue}from"../../views/draw/support/drawUtils.js";import{ViewEventPriorities as he}from"../../views/input/InputManager.js";import pe from"../PanoramicVideoViewer.js";import me from"../PanoramicViewer.js";import{defaultAngleThresholdInDegrees as ge,videoMapViewConstraint as ve,fixedImageSize as ye,clockwiseDirections as fe,videoFitScaleTolerance as we,videoExtent as _e,invalidCameraHeading as Fe,sectorsInOrder as be,sampleExtent as Me,sectorsRadii as Ve}from"./constants.js";import{isFeatureAttachment as Se}from"./galleryUtils.js";import{crossSymbol as Ie,crossSymbol3D as Pe,measurementPolygonSymbol as Ce,polylineSymbolPanoramic as Ae,measurementPolylineSymbol as ke,cameraOverlaySymbol3D as Oe,cameraOverlaySymbol as Te,diamondSymbol as Le,diamondSymbol3D as Ge,activeSourcePointSymbol as Ee,sourcePointSymbol as je}from"./symbols.js";import{registryKeys as xe}from"./types.js";import{isNoAttachmentError as Re,extractHorizonAnglesFromMedia as Be,isTifOrMrf as De,filterOILLayerView as He,assignElevationSampleToFeatures as ze,filterByZ as Ne,createPanoramicMedia as Ue,createNonPanoramicMedia as qe,isSceneView as We,isGraphic as $e,calculateSegment as Ze,calculateDirection as Je}from"./utils.js";import{disableVideoZoomAndPan as Ke,getUpdatedConstraints as Qe,getUpdatedExtentPoints as Xe,isSelectedPointWithinVideoFootprint as Ye,isVideoPixelWithinFrame as et}from"./videoViewerUtils.js";import tt from"./components/ImageViewer.js";import it from"./components/NavigationNode.js";import rt from"./components/OrientedImageryVideoViewModel.js";import{NoFeatureFoundWithObjectIdError as at}from"./navigation/errors.js";import{queryFeatureByObjectIds as ot}from"./navigation/queries.js";import{ImageMeasurementService as st}from"./services/ImageMeasurementService.js";import nt from"./services/SuperimposeService.js";import{configureSketchTool as lt,extractFieldsFromDataCaptureLayer as dt,constructGraphicFromImageGeometry as ct}from"./support/dataCaptureUtils.js";import{removeZFromGeometry as ut,imageSpaceToPoint as ht}from"./support/geometryUtils.js";import pt from"./support/resolveMediaProps.js";import{isValidDataCaptureLayer as mt}from"./support/typeUtils.js";const gt=()=>new n("orientedimageryviewer:sketch-not-initialized","Sketch property is not initialized, call loadSketch first");let vt=class extends(l(g)){constructor(e){super(e),this.additionalFeatures=new o,this.additionalCameraLocations=new o,this.additionalFootprints=new o,this.areaMeasurementResult=0,this.areaMeasurementAccuracy=0,this.bestFeatureAngle=0,this.bestFeatureCurrentFootprint=null,this.bestFeatureFootprint=null,this.cameraHeadingThreshold=ge,this.cameraPitchThreshold=ge,this.clickAction="hittest",this.correctedLocationPointOnImage=null,this.videoViewModel=null,this.collectionId=null,this.coverageFrustums=new o,this.coveragePolygons=new o,this.currentBestFeature=null,this.currentBestFeatureMeasurementImage=null,this.currentBestFeatureLocation=null,this.currentCoverageVisible=!0,this.depthImage=null,this.featureCache=[],this.navigationNodes=new o,this.determineWorkflowForFeature=async(e,t,i)=>{const{currentBestFeature:r,selectedPoint:a}=this;if(this.emit("popup-close"),r&&a){this.displayMessage=null,this._initialCurrentCoverageUpdate=!0,this._updateGroundElevation=!0;try{await this._updatePointsAndPolygons(i),await this._loadDepthImage(i),await this._loadCurrentFeatureMedia(r,i)}catch(o){v(o)||(this.loadImageError(o),u.getLogger(this).error("#loadIImage()","error occured while loading image",o))}}},this.determineWorkflowForTriangularMeasurement=async(e,t,i)=>{if(this.emit("popup-close"),this.currentBestFeatureMeasurementImage&&this.selectedPoint)try{await this._loadMeasurementViewerImage(i)}catch(r){v(r)||(this.loadImageError(r),u.getLogger(this).error("#loadIImage()","error occured while loading image",r))}},this.disabled=!1,this.displayMessage={key:"onLoadMessage",type:"info"},this.displayNewMeasurementButton=!0,this.distanceMeasurementResult=0,this.distanceAccuracyArray=[],this.dataCaptureLayer=null,this.features=new o,this.groundCoordinates=null,this.groundCoordinatesAccuracy=null,this.heightGraphic=null,this.heightMeasurementResult=0,this.heightMeasurementAccuracy=0,this.imageGeometryField=null,this.imageLocationToolState=!1,this.initialVideoMapViewExtent=null,this.imageMeasurementViewer=new tt,this.isAdditionalCoverageVisible=!1,this.isAdditionalPointSourcesVisible=!1,this.layer=null,this.localPort=null,this.locationPointOnImage=null,this.mapImageConversionToolState=!1,this.measureType=null,this.measurementGraphic=null,this.navigatorCurrentBestFeature=null,this.oiObjectIdField=null,this.overlayedCameraLocations=new o,this.overlayedMapFeatures=new w,this.pixelCoordinates=null,this.preserveAngle="none",this.pointSources=new o,this.preloadMedia=!1,this.preloadMediaSize=5,this.previousFeatureAngle=0,this.selectedPoint=null,this.shouldShowSelectedImage=!1,this.superimposeViewEnabled=!1,this.defaultSuperimposeCameraLockEnabled=!0,this.sketch=null,this.sketchTriangular=null,this.sketchTriangularGraphicsLayer=null,this.draw=null,this.drawAdapter=null,this.polylineDrawAction=null,this.scheduledFrameId=null,this.superimposeScheduledFrameId=null,this.superimposeDebounceTimeoutId=null,this.sketchAdapter=null,this.triangularMeasurementActive=!1,this.triangulatedDistanceMeasurement=null,this.triangulatedDistanceAccuracy=null,this.triangulatedAreaMeasurement=null,this.triangulatedAreaAccuracy=0,this.triangulatedMeasurementGraphic=null,this.triangulatedPoint=null,this.triangulatedMeasurementAdapter=null,this.updateFootprint=async(e,t,i)=>{"default"===this.mode&&"image-loaded"!==this.state||await(this._adapter?.updateFootprint(e,t,i))},this.updateVideoFootprint=async e=>{this.mode.includes("video")&&this.videoElement?.content&&await(this._adapter?.updateVideoFootprint(e))},this.updateFootprintPanorama=async(e,t)=>{await(this._adapter?.updateFootprintPanorama(e,t))},this.updatingTriangularMeasurementState=!1,this.videoElement=null,this.videoLayer=null,this.videoMapView=new de({map:new Map,constraints:ve}),this.verticalFilterEnabled=!1,this._adapter=null,this._highlightedFeatureHandle=null,this._imageViewer=new tt,this._initialCurrentCoverageUpdate=!0,this._locationViewModel=null,this._measurementService=null,this._mediaPrefetcher=null,this._navigationManager=null,this._overlays=new D({listMode:"hide",internal:!0,elevationInfo:{mode:"absolute-height"},title:"OrentedImageryViewerViewModel overlays layer"}),this._superimposePreviousCurrentCoverageVisible=null,this._superimposeService=new nt({getMapPoint:(e,t)=>this.getMapPoint(e,t),getPanoramicTransformationState:()=>{const{imageToWorldProperties:e,mode:t,updateElevationProps:i}=this._transformationService;return"panoramic"===t&&e?{imageToWorldProperties:e,updateElevationProps:i}:null},pointToPixel:(e,t)=>this._transformationService.pointToPixel(e,t),overlays:this._overlays,getPointAtDistance:(e,t,i)=>this._transformationService.pixelToPointAtDistance(e,t,i)}),this._panoramicVideoViewer=new pe,this._panoramicViewer=new me,this._panoramicMeasurementViewer=new me,this._referencePointOnGround=null,this._referencePointOnImage=null,this._referenceTransformationService=null,this._sectorData=null,this._transformationService=null,this._featureToSector=null,this._updatingHandles=new O,this._clickTask=null,this._crossSymbol=null,this.footprintExtent=null,this._featureChangedTask=null,this._mediaPrefetchTask=null,this._restoreSuperimposeMediaTask=null,this._superimposeScheduleController=null,this._suitabilities=null,this._transformController=new AbortController,this._updateFootprintTask=null,this._updateGroundElevation=!1,this.addUpdatingPromise=e=>this._updatingHandles.addPromise(e),this.filterCapturedFeatures=e=>{const t=this.currentBestFeature?.attributes.objectId,i=this.layer?.imageReferenceField;if(!t||!e||!i)return;const r=this.overlayedMapFeatures.get(e);r?.forEach(e=>{const r=e.attributes??{},a=Object.keys(r).find(e=>e.toLowerCase()===i.toLowerCase());(a?r[a]:null)!==t&&(e.visible=!e.visible)})},this.hideImageGeometry=e=>{},this.highlight=e=>{if(!this._overlaysView)return;this.removeHighlight();const t=this.additionalFootprints.find(({attributes:{imageID:t}})=>t===Number(e));this._highlightedFeatureHandle=t?this._overlaysView?.highlight(t):null},this.loadDataCaptureAdapter=async e=>{await this.loadSketch(e);const t=import("./adapters/sketch/DataCaptureAdapter.js"),{default:i}=await t;return y(e),this.sketchAdapter=new i({viewModel:this}),this.sketchAdapter},this.loadImageFromFeature=(e,t,i)=>this._updatingHandles.addPromise(this._loadImageFromFeature(e,t,i)),this.storeImageMeasurementViewer=e=>{this.imageMeasurementViewer=e},this.storePanoramicMeasurementViewer=e=>{this._panoramicMeasurementViewer=e},this.loadImageViewer=e=>{this._imageViewer?.destroy(),this._imageViewer=e},this.loadPanoramicViewer=e=>{this._panoramicViewer?.destroy(),this._panoramicViewer=e},this.loadPanoramicVideoViewer=e=>{this._panoramicVideoViewer?.destroy(),this._panoramicVideoViewer=e},this.loadVideoViewer=e=>{this.videoMapView.container=e},this.showImageByObjectId=async(e,t)=>{const i=this.additionalFeatures.find(({attributes:t})=>t.objectId===e);if(i)this.currentBestFeature=i;else{const{layer:i,layerFloorFilterClause:a,layerTimeExtent:o}=this;if(!i)return void this.setMessage("noLayerSelected","info");this.beforeLoad();const s=this._updatingHandles.addPromise(this._queryAndLoadByObjectId(i,e,a,o,t));try{await s,await this.selectBestFeature(e,t)}catch(r){v(r)||(u.getLogger(this).error("oriented-imagery-viewer:show-image",r),"NoFeatureFoundWithObjectIdError"===r.name?this.setMessage("noFeatureFoundWithObjectId","error","",{objectId:e}):this.setMessage("imageLoadError","error",r.message))}}},this.getSectorFeatureById=e=>this._suitabilities?.find(({feature:{attributes:{objectId:t}}})=>t===e),this.getFeatureSectorById=e=>this._featureToSector?.[`${e}`],this.navigate=async(e,t)=>{const{mode:i}=this;if("default"!==i&&"panoramic"!==i)throw new n("NavigationError","Navigation is only supported in 'default' and 'panoramic' modes.");const r=e=>"default"===i&&e.declaredClass.endsWith("NavigationManager")||"panoramic"===i&&e.declaredClass.endsWith("NavigationManagerPanoramic");if(null==this._navigationManager||!r(this._navigationManager)){p(this._navigationManager);const e="default"===i?import("./navigation/NavigationManager.js"):import("./navigation/NavigationManagerPanoramic.js");this._navigationManager=new(await e).default({viewModel:this})}return this._navigationManager.navigate(e,t)},this.removeHighlight=()=>this._highlightedFeatureHandle?.remove(),this.revealImageGeometry=e=>{},this.selectBestFeature=async(e,t)=>(y(t),this.currentBestFeature=this.features?.find(({attributes:t})=>`${t.objectId}`==`${e}`),_(()=>{switch(this.mode){case"video":return"video-loaded"===this.state;case"panoramic-video":return this.panoramicVideoLoaded;default:return"image-loaded"===this.state}},t)),this.toggleImageAttributes=()=>{const{currentBestFeature:e,popupEnabled:i,layer:r,view:a}=this;if(this.emit("popup-close"),!(a&&e&&i&&r))return;const{attributes:o,geometry:s}=e,n=new t({geometry:s,attributes:o.toJSON(),origin:r.graphicOrigin,sourceLayer:r});this.emit("popup-open",{features:[n],location:o.location.clone()})},this.updateSuitabilities=(e,t=!0)=>{e.sort((e,t)=>e.suitability-t.suitability),this._suitabilities=e;const i=this._suitabilities.map(({feature:e})=>e);this._initialCurrentCoverageUpdate=!0,this._updateFeatures(i,t),this._groupFeaturesBySectors()},this._computeOverlayImageSize=()=>{const{mode:e}=this;return"video"===e?ye:"panoramic-video"===e?this._panoramicVideoViewer.imageSize:this.activeViewer?.imageSize},this._geometryToOverlayImageGeometry=async(e,t,i)=>{const{mode:r,videoViewModel:a,_panoramicVideoViewer:o}=this;if("video"===r)return await(a?.geometryToOverlayGeometry(e,t))??null;if("panoramic-video"===r){const a={feature:t,mode:r,imageSize:i,footprintExtent:this.footprintExtent};return await this._transformationService.geometryToImageGeometryForFeature(e,a,o.horizonAngles)}return await this._transformationService.geometryToImageGeometry(e)},this._createViewClickHandle=()=>{if(this.removeHandles(xe.click),this.disabled||null==this.view)return;const e=this.mapImageConversionToolState&&("image-loaded"===this.state||"video-loaded"===this.state&&"video"===this.mode&&!!this.videoViewModel?.videoPaused||this.panoramicVideoLoaded&&"panoramic-video"===this.mode&&this.panoramicVideoPaused)?this._mapImageConversionToolViewClickHandler:this._viewClickHandler;this.addHandles(this.view.on("click",e,he.DEFAULT),xe.click)},this._createImageClickHandle=()=>{this.removeHandles(xe.imageClick),this.videoViewModel?.syncMapImageConversionHandle();const{mapImageConversionToolState:e,mode:t,footprintExtent:i,panoramicVideoLoaded:r}=this,o="panoramic-video"===t?this._panoramicVideoViewer:this.activeViewer,s=o?.imageSize;if(!e||"none"===t||"video"===t||!s||!i)return;const n="panoramic-video"===t,l=this._getActiveFeatureForCurrentMode(),c=!n||r&&this.panoramicVideoPaused;if(!l||!c)return;const u=o.clickAction;this.clickAction="pixel-location";const h=d(()=>{this.clickAction=u});let p=null;const m=F(()=>o,"pixel-location",e=>{this.plotReferencePointOnImage(e),p?.abort(),p=a(async r=>{if(!e)return;const a=this._getActiveFeatureForCurrentMode();if(!a)return;const o={feature:a,mode:t,imageSize:s,footprintExtent:i};let l=n?await this.getMapPointForFeature(e,o,{signal:r}):await this._transformationService.pixelToMapPoint(e);const d=this.view?.spatialReference;l&&!ee(!d,l.spatialReference.equals(d))&&(l=await G(l,d,{signal:r})),y(r),this.plotReferencePointOnGround(l)})});this.addHandles([m,h],xe.imageClick)},this._createTriangularImageClickHandle=()=>{this.removeHandles(xe.triangularImageClick),this.triangularMeasurementActive&&"none"!==this.mode&&this.currentBestFeature&&this.currentBestFeatureMeasurementImage&&this.activeTriangulatedViewer&&this.addHandles(this.activeTriangulatedViewer.imageRenderer.on("double-click",this._measurementImageClickHandler),xe.triangularImageClick)},this._enablePan=()=>{this.removeHandles(xe.videoPanHandles)},this._disablePan=()=>{this.removeHandles(xe.videoPanHandles),this.addHandles(Ke(this.videoMapView),xe.videoPanHandles)},this._handleImageHitTestResponse=async e=>{const{layer:t,overlayedCameraLocations:i}=this;if(!t)return;const r=e.results.find(({graphic:e,graphic:{attributes:r}})=>i.includes(e)&&r&&!r[t.imageReferenceField]&&!r[t.imageGeometryField]);if(!r)return;const a=r.graphic.attributes[t.objectIdField];await this.showImageByObjectId(a)},this._loadCurrentFeatureMedia=async(e,t)=>{"video"!==this.mode?"panoramic-video"!==this.mode?await this._loadImage(t):await this._loadVideo(t):await this._loadFlatVideo(e,t)},this._loadFlatVideo=async(e,t)=>{this._initializeVideo(),this.videoViewModel?.playVideoFromSelectedLocation(e);const i=e.attributes.objectId;this._waitForFlatVideoAndPlotSelectedLocation(e,i,t)},this._waitForFlatVideoAndPlotSelectedLocation=async(e,t,i)=>{try{if(await _(()=>!0===this.videoElement?.loaded,i),`${this.currentBestFeature?.attributes.objectId}`!=`${t}`)return;await this.transformAndPlotSelectedLocation(i)}catch(r){v(r)||u.getLogger(this).error("failed to plot selected point on video",{error:r,selectedPoint:this.selectedPoint,feature:e})}},this._loadDepthImage=async e=>{const{currentBestFeature:t,layer:i,depthImageNotSupported:r}=this;if(this.depthImage?.destroy(),this.depthImage=null,!i||!t||r)return;const{depthImage:a}=t.attributes;if(!a)return;const o=(await(import("./services/DepthImageService.js"))).default;y(e),this.depthImage=new o({url:a});try{await this.depthImage.load(e)}catch(s){v(s)||(u.getLogger(this).error("error occurred while loading depth image",s),this.depthImage?.destroy(),this.depthImage=null)}},this._loadImage=async e=>{const{currentBestFeature:t,layer:i,mode:r}=this;if(this.clearGraphics(),i&&t&&"none"!==r&&"video"!==r&&"panoramic-video"!==r)try{await this.loadImageFromFeature(i,t,e),y(e),await this.transformAndPlotSelectedLocation(e)}catch(a){v(a)||this.loadImageError(a)}},this._loadVideo=async e=>{const{currentBestFeature:t,mode:i,selectedPoint:r}=this,a=t?.attributes.imagePath;if(!t||"panoramic-video"!==i||!a)return;const{attributes:o}=t,{cameraPitch:s,cameraOrientation:n,location:l}=o,d=l.spatialReference.isWGS84&&4!==n?.type?B(l):new L(l);try{this._panoramicVideoViewer.viewModel.video&&(this._panoramicVideoViewer.viewModel.video.pause(),this._panoramicVideoViewer.viewModel.videoPaused=!0),this._panoramicVideoViewer.videoSource=a;let t=0;d&&r&&(t=await te(d,r)-t),this._panoramicVideoViewer.pitch=s??0,this._panoramicVideoViewer.yaw=t,await this._panoramicVideoViewer.loadVideo(e),y(e)}catch(c){v(c)||this.loadImageError(c)}},this._loadImageFromFeature=async(e,t,i)=>{const{mode:r}=this;if("default"!==r&&"panoramic"!==r)return;let a;try{a=await pt(t.attributes,e,i),y(i)}catch(f){if(v(f))return;return Re(f)?(u.getLogger(this).error(f),void this.setMessage("noAttachment","error",`${e.objectIdField}: ${t.attributes.objectId}`)):(u.getLogger(this).error(f,{[e.objectIdField]:t.attributes.objectId,layer:e}),void this.setMessage("imageLoadError","error",`query-attachments-failed:${e.objectIdField} ${t.attributes.objectId}`))}if(!a)return;const{mediaUrl:o,datasetFormat:s,rotation:n,searchParams:l,location:d,cameraHeading:c,matrix:h,cameraPitch:p,getDataSetFormatError:m}=a,g=`${t.attributes.objectId}`;try{let a=this._mediaPrefetcher?.getCachedMedia(g);if(!a){const i=this.navigationNodes.find(e=>e.id===t.attributes.objectId);if(i){try{await(this._mediaPrefetcher?.startPrefetchForNode(i,e))}catch(w){}a=this._mediaPrefetcher?.getCachedMedia(g)}}if(a){if("panoramic"===r){const e=this.triangularMeasurementActive?this._panoramicMeasurementViewer:this._panoramicViewer;let r=0;return d&&this.selectedPoint&&(r=await te(d,this.selectedPoint)-r),await e.loadMedia(a,i),this.selectedPoint?e.set({yaw:r,pitch:p}):"viewAngle"in t.attributes&&Number.isFinite(t.attributes.viewAngle)&&e.set({yaw:t.attributes.viewAngle,pitch:p}),void(this.triangularMeasurementActive?await this.initializeReferenceTransformationService(i):await this.initializeTransformationService(i))}return await this._setImageSource(this.triangularMeasurementActive?this.imageMeasurementViewer:this._imageViewer,a,i),void(this.triangularMeasurementActive?await this.initializeReferenceTransformationService(i):await this.initializeTransformationService(i))}}catch(w){}m&&u.getLogger(this).warn("error occurred while getting dataset format",m),"panoramic"===r?await this.loadPanoramicMediaSource({lookAt:{yaw:this.selectedPoint?await te(d,this.selectedPoint):"viewAngle"in t.attributes&&Number.isFinite(t.attributes.viewAngle)?t.attributes.viewAngle:0,pitch:p},extension:s?.toUpperCase(),url:o,cameraHeading:c,matrix:h},i):await this.loadMediaSource({datasetFormat:s?.toUpperCase(),url:o,customParameters:l,rotation:n},i),this.triangularMeasurementActive?await this.initializeReferenceTransformationService(i):await this.initializeTransformationService(i)},this._loadMeasurementViewerImage=async e=>{const{currentBestFeatureMeasurementImage:t,layer:i,mode:r}=this;if(this.imageMeasurementViewer.clearGraphics(),this._panoramicMeasurementViewer.clearGraphics(),i&&t&&"none"!==r&&"video"!==r&&"panoramic-video"!==r)try{await this.loadImageFromFeature(i,t,e),y(e)}catch(a){v(a)||this.loadImageError(a)}},this._loadMediaPrefetcher=async e=>{if(!this._mediaPrefetcher){const{default:t}=await(import("./support/MediaPrefetcher.js"));y(e),this._mediaPrefetcher=new t({maxEntries:this.preloadMediaSize*fe.length})}return this._mediaPrefetcher},this._loadViewAdapter=async e=>{const{view:t}=this;if(this._adapter?.disableDefaultSuperimposeNavigation?.(),this._adapter?.disablePanoramicSuperimposeNavigation?.(),t)switch(t.type){case"2d":{const{default:t}=await(import("./adapters/view/MapViewAdapter.js"));y(e),this._adapter=new t(this);break}case"3d":{const{default:t}=await(import("./adapters/view/SceneViewAdapter.js"));y(e),this._adapter=new t(this);break}}else this._adapter=null},this._mapImageConversionToolViewClickHandler=e=>{if(e.stopPropagation(),e.preventDefault(),e.mapPoint){const t=e.mapPoint;t.x=R(t.x,t.spatialReference),this.plotMapPoint(e.mapPoint)}},this._measurementImageClickHandler=e=>{e.stopPropagation(),e.preventDefault();const{sketchTriangular:t,triangularMeasurementActive:i,currentBestFeatureMeasurementImage:r,triangulatedMeasurementGraphic:a}=this;t&&i&&r&&a&&"active"!==t.state&&(t.update([a],{tool:"reshape"}),this.updatingTriangularMeasurementState=!0)},this._updateInteraction=()=>{const e=this.videoMapView.extent;if(!e)return;const{minScale:t}=this.videoMapView.constraints,i=this.videoMapView.scale<t-we,r=Qe(e);i&&!!r?(this._enablePan(),this.videoMapView.constraints.geometry=r):i?(this._disablePan(),this.videoMapView.constraints.geometry=null):(this.initialVideoMapViewExtent&&!this.videoMapView.extent.equals(this.initialVideoMapViewExtent)&&(this.videoMapView.extent=this.initialVideoMapViewExtent),this._disablePan(),this.videoMapView.constraints.geometry=null)},this._viewClickHandler=e=>{this._clickTask?.abort(),this._clickTask=a(async t=>{const{pointerType:i,button:r,mapPoint:a}=e;if("mouse"===i&&0!==r||!a)return;e.stopPropagation(),e.preventDefault();const{view:o,layer:s}=this;if(o){if(s){if(this.shouldShowSelectedImage){const i=o.hitTest(e,{include:[s]});this._updatingHandles.addPromise(i);const r=await i;return y(t),await this._processHitTestResults(s,r,{signal:t})}return this._updatingHandles.addPromise(this.loadBestImage(a,{signal:t}))}this.setMessage("noLayerSelected","info")}})},this.plotSelectedPointOnImage=async(e,i)=>{if(await f(i),!e)return;const r=new L({...k(e)?e.toJSON():e});if("default"===this.mode)r.x-=.5,r.y=.5-r.y,r.spatialReference=this._imageViewer.imageRenderer.spatialReference.clone(),this._crossSymbol=new t({geometry:r,symbol:Ie}),this._imageViewer.addGraphic(this._crossSymbol,0);else if("video"===this.mode)this._crossSymbol=this.videoViewModel?.plotSelectedPointOnVideo(r)??null;else if("panoramic"===this.mode){const{imageSize:i,media:r}=this._panoramicViewer;if(!i||!r)return;const a=Be(r),o=ie(e,...i,a);this._crossSymbol=new t({geometry:new L(o,E.WebMercator),symbol:Pe}),this._panoramicViewer.addGraphic(this._crossSymbol,0)}},this.handleSectorClick=this.handleSectorClick.bind(this),this.searchBestImage=this.searchBestImage.bind(this),this.transformAndPlotReferencePointOnImage=this.transformAndPlotReferencePointOnImage.bind(this)}initialize(){this.addHandles([b(()=>this.view,()=>this.load(),M),b(()=>this.view?.map,(e,t)=>{t?.layers.remove(this._overlays),e?.layers.add(this._overlays)},V),b(()=>this.view?.map?.allLayers?.length,e=>{e&&this.view?.map?.layers.reorder(this._overlays,e-1)},V),b(()=>[this.state,this.panoramicVideoLoaded,this.mapImageConversionToolState,this.view,this.disabled,this.panoramicVideoPaused,this.videoViewModel?.videoPaused],(e,t)=>{const i=e[2],r=t?.[2];r&&!i&&(this.plotReferencePointOnGround(null),this.clearReferencePointOnImage()),this._createViewClickHandle(),this._createImageClickHandle()},M),b(()=>[this.triangularMeasurementActive,this.currentBestFeatureMeasurementImage],()=>{this._createTriangularImageClickHandle()},M),b(()=>[this.state,this.imageLocationToolState,this.view],()=>{this._initializeMeasurementService(),this._initializeLocationViewModel()},M),b(()=>this.measureType,()=>{this.clearPreviousMeasurements(),this._initializeMeasurementService()},M),b(()=>this.bestFeatureAngle,(e,t)=>{this.previousFeatureAngle=t??0},M),b(()=>[this.superimposeViewEnabled,this.defaultSuperimposeCameraLockEnabled,this.superimposeViewSupported,this.currentBestFeature,this.mode,this.state,this.view?.type],()=>{this._shouldDisableUnsupportedSuperimposeView()?this.superimposeViewEnabled=!1:this._hasActiveSuperimposeCameraContext()?this._updateSuperimposedImage():this._resetInactiveSuperimposeState()},M),b(()=>this._getSuperimposeCameraWatchState(),()=>this._handleSuperimposeCameraChange(),M),b(()=>this.currentBestFeature,async(e,t)=>{m(this._featureChangedTask),this._featureChangedTask=a(async i=>this.determineWorkflowForFeature.apply(this,[e,t,{signal:i}])),await this._featureChangedTask.promise},{sync:!0}),b(()=>[this.currentNode,this.preloadMedia,this.navigationMode],()=>{this._mediaPrefetchTask?.abort(),this._mediaPrefetchTask=a(async e=>{this.preloadMedia&&null!=this.navigationMode?(this._mediaPrefetcher??=await this._loadMediaPrefetcher({signal:e}),y(e),"directional"===this.navigationMode?this._mediaPrefetcher.enqueueDirectionalPrefetch(this.layer,this.currentNode,this.preloadMediaSize):this._mediaPrefetcher.enqueueSequentialPrefetch(this.layer,this.currentNode,this.preloadMediaSize)):this._mediaPrefetcher?.clear()})},M),b(()=>this.currentBestFeatureMeasurementImage,(e,t)=>{m(this._featureChangedTask),t&&e!==t&&(this.triangulatedPoint=null,this.sketchTriangularGraphicsLayer?.graphics.destroyAll(),this._measurementService?.resetMeasurementVectors()),this._featureChangedTask=a(async i=>{await this.determineWorkflowForTriangularMeasurement(e,t,{signal:i}),y(i),this._reorderTriangularSketchLayer()})},M),b(()=>this.triangularMeasurementActive,(e,t)=>{t&&!e&&(this._measurementService?.resetMeasurementVectors(),this.currentBestFeatureMeasurementImage=null,this.triangulatedDistanceMeasurement=null,this.triangulatedMeasurementGraphic=null,this.triangulatedPoint=null,this.updatingTriangularMeasurementState=!1,this.triangulatedAreaMeasurement=null,this.triangulatedDistanceAccuracy=null,this.triangulatedAreaAccuracy=0,this.sketchTriangularGraphicsLayer?.graphics.destroyAll(),this.clearReferencePointOnImage(),this.imageMeasurementViewer.clearImage(),this.imageMeasurementViewer.clearGraphics(),this._panoramicMeasurementViewer.clearImage(),this._panoramicMeasurementViewer.clearGraphics())}),b(()=>this.mode,e=>{switch(this.removeHandles(xe.interactionHandles),e){case"default":this.addHandles(b(()=>{const{state:e}=this;return"image-loaded"===e?this._imageViewer.imagePointsInView:null},e=>{e&&(m(this._updateFootprintTask),this._updateFootprintTask=a(async t=>{await this.updateFootprint(e,void 0,{signal:t})}))},{...M,equals:(e,t)=>i(e,t,c)}),xe.interactionHandles);break;case"video":this.addHandles(b(()=>{const{footprintExtent:e,videoElement:t,bestFeatureFootprint:i}=this;if(e&&t?.loaded&&i)return{videoExtent:_e,bestFeatureFootprint:i}},e=>{e?.videoExtent&&e?.bestFeatureFootprint&&(m(this._updateFootprintTask),this._updateFootprintTask=a(async t=>{const i={points:e.videoExtent,feature:void 0,scale:void 0,options:{signal:t}};await this.updateVideoFootprint(i)}))},{...M,equals:(e,t)=>i(e?.videoExtent,t?.videoExtent,c)&&e?.bestFeatureFootprint===t?.bestFeatureFootprint}),xe.interactionHandles);break;case"panoramic":this.addHandles(b(()=>{const{currentBestFeature:e,state:t,_panoramicViewer:i}=this,{imageSize:r,vfov:a,hfov:o,pitch:s,yaw:n}=i;return e&&r&&!t.includes("loading")&&null!=a&&null!=o&&null!=s&&null!=n?[a,o,n,s]:null},e=>{if(!e||this.state.includes("loading"))return;const[t,i,r,o]=e;this.currentNode&&(this.currentNode.currentHeading=r,this.currentNode.currentPitch=o),m(this._updateFootprintTask),this._updateFootprintTask=a(async e=>{await this.updateFootprintPanorama({verticalFieldOfView:t,horizontalFieldOfView:i,yaw:r,pitch:o},{signal:e}),this._updateFootprintTask=null})},{equals:(e,t)=>i(e,t,c)}),xe.interactionHandles);break;case"panoramic-video":this.addHandles(b(()=>{const{currentBestFeature:e,state:t,_panoramicVideoViewer:i}=this,{imageSize:r,vfov:a,hfov:o,pitch:s,yaw:n,viewModel:l}=i,d=l.closestFeature??e;return d&&r&&!t.includes("loading")&&null!=a&&null!=o&&null!=s&&null!=n?[a,o,n,s,d]:null},e=>{if(!e)return;const[t,i,r,o,s]=e;m(this._updateFootprintTask),this._updateFootprintTask=a(async e=>{await this.updateFootprintPanorama({verticalFieldOfView:t,horizontalFieldOfView:i,yaw:r,pitch:o,feature:s,horizonAngles:this._panoramicVideoViewer.horizonAngles},{signal:e}),y(e),this._updateFootprintTask=null})},{equals:(e,t)=>i(e,t,c)}),xe.interactionHandles)}},M),b(()=>[this.brightness,this.contrast,this.sharpness],()=>{const{_imageViewer:e,brightness:t,contrast:i,mode:r,sharpness:a}=this;"default"===r&&(e.brightness=t,e.contrast=i,e.sharpness=a)},M),b(()=>this.activeViewer?.imageRenderer,()=>{this.sketch&&(this.sketch.view=this.activeViewer?.imageRenderer)}),b(()=>this.activeViewer,e=>{this.removeHandles(xe.hittestHandles),e&&this.addHandles(F(()=>e,"hittest-response",this._handleImageHitTestResponse),xe.hittestHandles)}),b(()=>this.videoMapView.extent,async()=>{this._scheduleVideoInteractionUpdate();const e=this.videoViewModel?.closestFeature;e&&(m(this._updateFootprintTask),this._updateFootprintTask=a(async t=>{const i={points:this.videoExtentPoints,feature:e,options:{signal:t}};await this.updateVideoFootprint(i)}))}),b(()=>[this.videoMapView.interacting,this.videoMapView.navigating,this.videoMapView.scale],()=>{this._scheduleVideoInteractionUpdate()},{initial:!0}),S(()=>null!=this.videoMapView.extent,()=>{this.initialVideoMapViewExtent=this.videoMapView.extent},{once:!0})]),this.when().finally(()=>{this.notifyChange("state")})}destroy(){this._adapter?.disableDefaultSuperimposeNavigation?.(),this._adapter?.disablePanoramicSuperimposeNavigation?.(),this._abortSuperimposeSchedule(),this.currentBestFeature=null,this._updateFootprintTask=m(this._updateFootprintTask),this._clickTask=m(this._clickTask),this._restoreSuperimposeMediaTask=m(this._restoreSuperimposeMediaTask),this.coverageFrustums.destroy(),this.coveragePolygons.destroy(),this.pointSources.destroy(),this.additionalFootprints.destroy(),this.additionalCameraLocations.destroy(),this.bestFeatureFootprint=p(this.bestFeatureFootprint),this.bestFeatureCurrentFootprint=p(this.bestFeatureCurrentFootprint),this.videoViewModel=p(this.videoViewModel),this._locationViewModel=p(this._locationViewModel),this.clearSelectedPointOnViewer(),this._referencePointOnGround=p(this._referencePointOnGround),this.clearReferencePointOnImage(),this._superimposeService.destroy(),this._overlays&&this.view?.map?.remove(this._overlays),this._overlays.destroy(),this._imageViewer.destroy(),this.imageMeasurementViewer.destroy(),this._panoramicViewer.destroy(),this._panoramicMeasurementViewer.destroy(),this._mediaPrefetcher?.destroy()}get activeLayer(){return s(u.getLogger(this),"activeLayer",{replacement:"layer"}),this.layer}set activeLayer(e){s(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 activeTriangulatedViewer(){switch(this.mode){case"default":return this.imageMeasurementViewer;case"panoramic":return this._panoramicMeasurementViewer;default:return null}}get accuracyParametersMissing(){return this.layer?.orientationAccuracy?.every(e=>0===e)??!0}get brightness(){return this._get("brightness")??0}set brightness(e){this._set("brightness",h(e,-10,10))}get contrast(){return this._get("contrast")??0}set contrast(e){this._set("contrast",h(e,-10,10))}get currentNode(){const{currentBestFeature:e,navigationNodes:t}=this;return t.find(t=>t.id===e?.attributes.objectId)}get depthImageNotSupported(){if(this.currentBestFeature?.attributes.depthImage)return!De(this.currentBestFeature.attributes.depthImage)}get featureCount(){return this.features?.length??0}get imageGalleryEnabled(){const{currentBestFeature:e}=this;if(!e)return!1;const t=e.attributes.imagePath?.trim();return De(t)||Se(t)}get imageLoaded(){return s(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===Fe}get imagePointsInView(){const{mode:e,_imageViewer:t}=this;return"default"===e?t.imagePointsInView:null}get layerView(){const{layer:e,view:t}=this;if(e&&t)return t.allLayerViews.find(He(e))}get layerFloorFilterClause(){const{layerView:e}=this;return e?ne(e):null}get layerTimeExtent(){return this.layerView?.timeExtent??null}get mode(){const e=this.currentBestFeature?.attributes;if(!e)return"none";const t=e.orientedImageryType;if(t?.includes("video"))return t.includes("360")?"panoramic-video":"video";const{horizontalFieldOfView:i,isSpherical:r}=e;return 360===i||r?"panoramic":"default"}get panoramicVideoLoaded(){const{mode:e,_panoramicVideoViewer:t}=this,{videoLoaded:i}=t.viewModel;return("panoramic-video"===e&&!0===i)??!1}get overlayGraphicsEnabled(){const{mode:e,state:t,panoramicVideoLoaded:i,videoViewModel:r,panoramicVideoPaused:a}=this;return"image-loaded"===t||"video"===e&&"video-loaded"===t&&!0===r?.videoPaused||"panoramic-video"===e&&i&&a}get panoramicVideoPaused(){return!!this._panoramicVideoViewer.viewModel.videoPaused}get popupEnabled(){return!0===this.layer?.popupEnabled}get referencePoint(){return this._referencePointOnGround?.geometry}get sectorData(){const{_sectorData:e}=this;return e?be.map(t=>e[t]):null}get sharpness(){return this._get("sharpness")??0}set sharpness(e){this._set("sharpness",h(e,0,1))}get superimposeViewSupported(){return"default"===this.mode||"panoramic"===this.mode}get sketchGraphicsLayer(){const{sketch:e}=this;return"graphics"===e?.layer?.type?e.layer:void 0}get state(){const{mode:e,_updatingHandles:{updating:t},_featureChangedTask:i,_navigationManager:r}=this;if(!this.isFulfilled()||t||!1===i?.finished||r?.navigating)return"loading";if(this.isRejected())return"error";if("error"===this.displayMessage?.type)return"image-load-error";switch(e){case"default":return this._imageViewer.state;case"panoramic":return this._panoramicViewer.state;case"video":return this.videoElement?.loaded?"video-loaded":"video-not-loaded"}return"ready"}get thumbnails(){const{features:e}=this;return e?new o(e.map(({attributes:{imagePath:e,objectId:t,cameraRoll:i,imageRotation:r}})=>{const a=e?.trim();return De(a)||Se(a)?{url:a,objectId:t,rotation:(i??0)+(r??0)}:null}).filter(r)):null}get videoExtentPoints(){const e=Xe(this.videoMapView.extent);return e.length?e:_e}set view(e){this._set("view",e)}get _defaultGraphicsLayer(){const e={blendMode:"source-atop"};switch(this.mode){case"panoramic":return new D({...e,elevationInfo:{mode:"absolute-height"}});case"default":return new D({...e});default:return}}get _overlaysView(){return this.view?.layerViews.find(({layer:e})=>e===this._overlays)}updatePanoramicSuperimposeRadiusOffset(e){this._superimposeService.updatePanoramicRadiusOffset(e)}setDefaultSuperimposeZOffsetPercentage(e){this._superimposeService.setDefaultZOffsetPercentage(e)}setPanoramicSuperimposeRadiusPercentage(e){this._superimposeService.setPanoramicRadiusPercentage(e)}updateDefaultSuperimposeCameraLock(e){this.defaultSuperimposeCameraLockEnabled=e,this.superimposeViewEnabled&&"default"===this.mode&&(e?this._adapter?.enableDefaultSuperimposeNavigation?.():this._adapter?.disableDefaultSuperimposeNavigation?.())}beforeLoad(e=!0){this.emit("popup-close"),e&&(this.displayMessage=null),this._abortSuperimposeSchedule(),this._adapter?.disableDefaultSuperimposeNavigation?.(),this._adapter?.disablePanoramicSuperimposeNavigation?.(),this.clearPreviousGroundLocation(),this.triangularMeasurementActive=!1,this.currentBestFeatureMeasurementImage=null,this.measureType=null,this.imageLocationToolState=!1,this.features.removeAll(),this.currentBestFeature=null,this.additionalFeatures.removeAll(),this.additionalFootprints.removeAll(),this.additionalCameraLocations.removeAll(),this.bestFeatureCurrentFootprint=p(this.bestFeatureCurrentFootprint),this._restoreSuperimposeMediaTask=m(this._restoreSuperimposeMediaTask),this._superimposeService.clear(),this._overlays?.removeAll()}async calculateLocationAccuracy(e){return this._measurementService?.calculateLocationAccuracy(e)}clearLocationPointOnImage(e=!1){this.locationPointOnImage&&!e&&(this._imageViewer.removeGraphic(this.locationPointOnImage),this._panoramicViewer.removeGraphic(this.locationPointOnImage),this.locationPointOnImage=p(this.locationPointOnImage)),this.correctedLocationPointOnImage&&(this.imageMeasurementViewer.removeGraphic(this.correctedLocationPointOnImage),this._panoramicMeasurementViewer.removeGraphic(this.correctedLocationPointOnImage),this.correctedLocationPointOnImage=p(this.correctedLocationPointOnImage))}clearPreviousMeasurements(){this.clearMeasurementGraphics(),this.resetMeasurementData(),this.stopMeasurement()}clearPreviousGroundLocation(){this.groundCoordinates=null,this.groundCoordinatesAccuracy=null,this.pixelCoordinates=null,this.clearLocationPointOnImage()}clearMeasurementGraphics(){this.measurementGraphic&&(this.activeViewer?.removeGraphic(this.measurementGraphic),this.measurementGraphic=null),this.heightGraphic&&(this.activeViewer?.removeGraphic(this.heightGraphic),this.heightGraphic=null),this.triangularMeasurementActive&&this.sketchTriangularGraphicsLayer?.graphics.destroyAll()}digitizeCancel(){return this.sketch?.cancel()}digitizeCanRedo(){return this.sketch?.canRedo()??!1}digitizeCanUndo(){return this.sketch?.canUndo()??!1}digitizeComplete(){return this.sketch?.complete()}async digitizeCreate(e,t){const{sketch:i,dataCaptureLayer:r}=this;if(!i)throw gt();lt(r,e,i),await i.create(e,{...t,defaultZ:0})}digitizeDelete(){if(!this.sketch)throw gt();return this.sketch.delete()}digitizeDuplicate(){if(!this.sketch)throw gt();return this.sketch.duplicate()}digitizePlace(e,t){if(!this.sketch)throw gt();return this.sketch.place(e,t)}digitizeRedo(){if(!this.sketch)throw gt();return this.sketch.redo()}digitizeUndo(){if(!this.sketch)throw gt();return this.sketch.undo()}digitizeUpdate(e,t){if(!this.sketch)throw gt();return this.sketch.update(e,t)}filterByFootprints(e,t,i=!1){const r=[],a=[],o=[];return e.forEach(e=>{const{layer:{coveragePercent:s},attributes:n}=e;let l;const{polygon:d,frustum:c}=q(n);if(l=d.clone(),n.isInspection&&(l=W(n)),s&&(l=$(l,s)),i||!t||Z(l,t)){o.push(e);const{geometry:t,objectId:i,cameraHeight:s,cameraHeading:l}=n,u=t.clone();u.z=s/K(t.spatialReference),u.imageID=i,this.pointSources.push(u),l!==Fe&&(r.push(d),c&&a.push(c))}}),{features:o,polygons:r,frustums:a}}async deleteDataCaptureFeatures(e){const{dataCaptureLayer:t}=this;if(!t)throw new n("orientedimageryviewer:missing-featurelayer","Data capture layer is not available");return t.queryFeatures({objectIds:e,outFields:[t.objectIdField]}).then(({features:e})=>t.applyEdits({deleteFeatures:e}))}handleSectorClick(e){if(isNaN(e))return;const t=this._sectorData?.[be[e]],i=t?.at(0);i&&(this.triangularMeasurementActive&&this.currentBestFeature?this._updateImageMeasurementBestFeature(i):this._updateCurrentBestFeature(i))}handleFeatureClick(e){const{sector:t,featureIndexInSector:i}=e;if(isNaN(i))return;const r=this._sectorData?.[t],a=r?.at(i);a&&(this.triangularMeasurementActive&&this.currentBestFeature?this._updateImageMeasurementBestFeature(a):this._updateCurrentBestFeature(a))}load(e){return this.addResolvingPromise(this._loadViewAdapter(e).catch(e=>{if(!v(e))throw e})),this}async loadBestImage(e,t){return this.selectedPoint=Q(e),this.beforeLoad(),this._fetchFeaturesWithController(e,t)}async loadHeightMeasurementAdapter(e){if(!this.drawAdapter){const t=import("./adapters/draw/HeightMeasurementAdapter.js"),{default:i}=await t;if(y(e),this.drawAdapter=new i({viewModel:this,measurementService:this._measurementService}),!this.drawAdapter.viewModel.isResolved())return}return this.drawAdapter}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"),{default:i}=await t;y(e),this.sketch=new i({layer:this._defaultGraphicsLayer,view:this.activeViewer?.imageRenderer,updateOnGraphicClick:!1,defaultUpdateOptions:{reshapeOptions:{edgeOperation:"none",shapeOperation:"none",vertexOperation:void 0},enableMoveAllGraphics:!1,enableRotation:!1,enableScaling:!1,multipleSelectionEnabled:!1,toggleToolOnClick:!1,tool:"transform"}})}return this.sketch}async loadMeasurementAdapter(e){if(!this.sketchAdapter){const t=import("./adapters/sketch/MeasurementAdapter.js"),{default:i}=await t;if(y(e),this.sketchAdapter=new i({viewModel:this,measurementService:this._measurementService}),!this.sketchAdapter.viewModel.isResolved())return}return this.sketchAdapter}async processFeatureResponse(e,t,i){const{features:r}=e;if(this._clearFeatureGeometries(),!this._checkFeatures(r))return;const{features:a,polygons:o,frustums:s}=this.filterByFootprints(r,t,i?.skipFilter);if(!this._checkFeatures(a))return;this.coveragePolygons.addMany(o),this.coverageFrustums.addMany(s);const n=await this.processElevationSample(o,a,i);y(i),await this._updateElevationOfSelectedPointAndLocations(a,t,n),y(i),ze(a,n);let l=a;if(this.layer?.verticalSearchRange&&this.layer.hasZ&&this.verticalFilterEnabled&&(l=Ne(a,t,this.layer.verticalSearchRange),!l.length))return void this.setMessage("noImageAtElevation","info");const d=this._processSuitableFeatures(l,t);this.updateSuitabilities(d,i?.loadBestImage)}async processFeatureElevation(e,t,i){if(!t)return;const{features:r,polygons:a}=this.filterByFootprints(e,t,!0);if(!r?.length)return;const o=await this.processElevationSample(a,r,i);return y(i),o}async startMeasurement(e,t){this.sketch||await this.loadSketch(t),await this.loadMeasurementAdapter(t);const{sketch:i,sketchAdapter:r,activeViewer:a,mode:o}=this;if(!i||!r||!a||"none"===o)return;if(this.displayNewMeasurementButton=!1,"panoramic"===o&&(i.defaultCreateOptions.defaultZ=0),await i.create(e),"panoramic"===o){const{drawOperation:e}=i.view.activeTool;e.constraintsEnabled=!1,e._set("elevationDrawSurface",null)}const s=this.activeViewer?.imageRenderer.effectiveTheme.accentColor;s&&this.sketch&&(this.sketch.polygonSymbol=Ce(s),this.sketch.polylineSymbol="panoramic"===o?Ae:ke(s,2.5))}async startHeightMeasurement(){this.displayNewMeasurementButton=!1,this.draw??=new ce({view:this.activeViewer?.imageRenderer}),this.polylineDrawAction=this.draw.create("polyline"),await this.loadHeightMeasurementAdapter()}initializeMeasurement(e){switch(this.clearMeasurementGraphics(),this.resetMeasurementData(),e){case"distance":this.startMeasurement("polyline");break;case"area":this.startMeasurement("polygon");break;case"height":this.startHeightMeasurement()}}async overlayCameraLocations(e){const{activeViewer:i,overlayedCameraLocations:a,layer:o,mode:s,layerFloorFilterClause:n,layerTimeExtent:l,videoViewModel:d,_panoramicVideoViewer:c}=this,u="video"===s,h="panoramic-video"===s,p=this._getActiveFeatureForCurrentMode(),m=this._computeOverlayImageSize();if(!(m&&p&&o&&"none"!==s&&this.overlayGraphicsEnabled))return;const{polygon:g}=q(p.attributes);if(u?d?.removeOverlayGraphics(a.toArray()):h?c.removeManyGraphics(a.toArray()):i?.removeManyGraphics(a.toArray()),a.removeAll(),e){const{features:e}=await o.queryFeatures({where:I(`${o.objectIdField} <> ${p.attributes.objectId}`,I(o.definitionExpression,n)),geometry:g,returnGeometry:!0,outFields:[o.objectIdField],timeExtent:l}),v=await Promise.all(e.map(async e=>{const{attributes:i,geometry:r}=e;if("point"!==r?.type)return null;const a=await this._geometryToOverlayImageGeometry(r,p,m);if(!a)return null;const o="panoramic"===s||"panoramic-video"===s?Oe():Te();return new t({attributes:i,symbol:o,geometry:a})}));a.addMany(v.filter(r)),u?d?.addOverlayGraphics(a.toArray()):h?c.addManyGraphics(a.toArray()):i?.addManyGraphics(a.toArray())}}overlayGraphicsOnImage(e,t){this.removeOverlayedGraphicsOnImage(e),this.overlayedMapFeatures.set(e,t),"video"!==this.mode?"panoramic-video"!==this.mode?this.activeViewer?.addManyGraphics(t.toArray()):this._panoramicVideoViewer.addManyGraphics(t.toArray()):this.videoViewModel?.addOverlayGraphics(t.toArray())}async overlayMapFeatures(e,i=!1){const{activeViewer:a,mode:s,layer:n,videoViewModel:l,_panoramicVideoViewer:d}=this,c="video"===s,h="panoramic-video"===s,p=this._getActiveFeatureForCurrentMode(),m=this._computeOverlayImageSize();if(!(m&&p&&"none"!==s&&this.overlayGraphicsEnabled&&n))return;const{polygon:g}=q(p.attributes);try{const{imageGeometryField:t,oiObjectIdField:i}=dt(e,n.imageGeometryField,n.imageReferenceField);this.imageGeometryField=t.name,this.oiObjectIdField=i.name}catch(w){u.getLogger(this).warn("oriented-imagery-viewer:overlay-map-features",w)}const{features:v}=await e.queryFeatures({geometry:g,returnGeometry:!0,outFields:["*"]}),y=await Promise.all(v.map(async r=>{const o=r.symbol?.clone()??e.renderer?.getSymbol(r)?.clone(),{attributes:n,geometry:g}=r,{imageGeometryField:v,oiObjectIdField:y}=this;if(v&&y&&mt(e,v,y)&&`${n[y]}`==`${p.attributes.objectId}`)try{const r=h?d.horizonAngles:Be(a?.media),u=ct(n,v,e,i,m,c?"default":s,o,r);if(!c)return u;const p=u.geometry;if(!p)return null;const g=l?.imageGeometryToOverlayGeometry(p);return g?new t({attributes:n,layer:e,symbol:u.symbol,geometry:g,visible:u.visible}):null}catch(w){u.getLogger(this).warn("oriented-imagery-viewer:overlay-map-features","couldn't create graphic from attributes, geometry will be used",{error:w,feature:r,layer:e,imageGeometryField:this.imageGeometryField,imageReferenceField:this.oiObjectIdField})}if(!g)return null;const f={feature:p,imageSize:m,footprintExtent:this.footprintExtent},_=await this._geometryToOverlayImageGeometry(g,f.feature,f.imageSize);return _?new t({attributes:n,layer:e,symbol:o,geometry:_,visible:e.visible&&i}):null})),f=new o(y.filter(r));("video"!==s&&"panoramic-video"!==s||this.overlayGraphicsEnabled)&&this.overlayGraphicsOnImage(`${e.id}`,f)}getDepthAt(e){const{activeViewer:t,currentBestFeature:i,mode:r,state:a,depthImage:o}=this,s=t?.imageSize;if(!s||!i||"none"===r||a.includes("loading"))return u.getLogger(this).warnOnce("oriented-imagery-viewer:get-depth-at","Load an image to use depth"),null;if(!o?.loaded)return u.getLogger(this).error("oriented-imagery-viewer:get-depth-at","Depth image is not loaded"),this.emit("depth-image-service:not-loaded"),null;const n=(Array.isArray(e)?e:[e]).map(e=>o.depthAt(e,{width:s[0],height:s[1]})??null);return Array.isArray(e)?n:n[0]}getActiveSectors(){return be.filter(e=>this._sectorData?.[e]?.length)}async getPixelLocationForFeature(e,t,i){return(await this._transformationService.pointToPixelForFeature([e],t,i))[0]}async getPixelLocationsForFeature(e,t,i){return await this._transformationService.pointToPixelForFeature(e,t,i)}async plotMapPoint(e){this.plotReferencePoint(e);const t=this._getActiveFeatureForCurrentMode();if(t)return this.transformAndPlotReferencePointOnImage({feature:t,selectedLocation:e,options:{signal:this._transformController?.signal}})}plotReferencePointOnGround(e){this._referencePointOnGround&&(this._overlays?.remove(this._referencePointOnGround),this._referencePointOnGround.destroy()),null!=e&&(this._referencePointOnGround=new t({geometry:new L({...e.toJSON()}),symbol:Le}),this.view?this._overlays?.add(this._referencePointOnGround):this.emit("plot-ground-point",{data:{point:this._referencePointOnGround?.geometry}}))}plotReferencePointOnImage(e){switch(this.mode){case"video":return void this._plotReferencePointOnVideo(e);case"panoramic-video":return void this._plotReferencePointOnPanoramicVideo(e);case"default":return void this._plotReferencePointOnDefaultImage(e);case"panoramic":return void this._plotReferencePointOnPanoramicImage(e)}}removeAllOverlayMapFeatures(){const{mode:e}=this;this.overlayedMapFeatures.forEach(t=>{const i=t.toArray();switch(e){case"video":this.videoViewModel?.removeOverlayGraphics(i);break;case"panoramic-video":this._panoramicVideoViewer.removeManyGraphics(i);break;default:this.activeViewer?.removeManyGraphics(i)}}),this.overlayedMapFeatures.clear()}removeOverlayedGraphicsOnImage(e){const t=this.overlayedMapFeatures.get(e),{mode:i}=this;if(!t?.length)return;const r=t.toArray();switch(i){case"video":this.videoViewModel?.removeOverlayGraphics(r);break;case"panoramic-video":this._panoramicVideoViewer.removeManyGraphics(r);break;default:this.activeViewer?.removeManyGraphics(r)}this.overlayedMapFeatures.delete(e)}reset(){const{mode:e}=this;"default"===e||"panoramic"===e?this.resetImage():"video"===e?this.resetVideo():"panoramic-video"===e&&this.resetVideoPanoramic(),this.beforeLoad(!1)}resetImage(){switch(this.setMessage("onLoadMessage","info"),this.mode){case"default":this._imageViewer.clearImage(),this._imageViewer.clearGraphics();break;case"panoramic":this._panoramicViewer.clearGraphics()}this._clickTask=m(this._clickTask)}resetVideo(){this.setMessage("onLoadMessage","info"),this.videoViewModel?.resetVideoHandler(),this._overlays?.removeAll(),this.videoViewModel=null,this.featureCache=[],this.currentBestFeature=null}resetVideoPanoramic(){this.setMessage("onLoadMessage","info"),this._overlays?.removeAll(),this.currentBestFeature=null}resetMeasurementData(){this.areaMeasurementResult=0,this.areaMeasurementAccuracy=0,this.distanceMeasurementResult=0,this.distanceAccuracyArray=[],this.heightMeasurementResult=0,this.heightMeasurementAccuracy=0,this.heightGraphic=null,this.triangulatedDistanceMeasurement=null,this.triangulatedDistanceAccuracy=null,this.triangulatedAreaMeasurement=null,this.triangulatedMeasurementGraphic=null,this.updatingTriangularMeasurementState=!1,this.triangulatedAreaAccuracy=0,this._measurementService?.resetMeasurementVectors()}async saveDrawing(){const{dataCaptureLayer:e,sketchAdapter:t}=this;if(!e||"data-capture"!==t?.type)return;const{pendingGraphics:i,savedGraphics:r}=t,a=i.get(e.id),o=a?.toArray();if(!a||!o?.length)return;const{addFeatureResults:s}=await this.saveDataCaptureFeatures(o),n=s.reduce((t,{objectId:i,globalId:r,error:a},s)=>{const n=o[s],{attributes:l}=n;return a?t.error.push(n):(i&&(l[e.objectIdField]=i),r&&e.globalIdField&&(l[e.globalIdField]=r),t.success.push(n)),t},{success:[],error:[]});r.addMany(n.success),a.removeAll(),a.addMany(n.error)}async saveDataCaptureFeatures(e,t){const{activeViewer:i,currentBestFeature:a,dataCaptureLayer:o,mode:s}=this,l=i?.imageSize;if(!l||!a||"none"===s||"video"===s||"panoramic-video"===s)throw new n("orientedimageryviewer:missing-input","Image size, current best feature and mode are required to save data capture features");if(!o)throw new n("orientedimageryviewer:missing-featurelayer","Data capture layer is not available");const d=await Promise.all(e.map(async e=>{const i=e.clone(),{geometry:r}=i;if(!r)return;const a=r.type,s=o.hasZ,n=o.geometryType,l=a!==n,d=l?await(import("./transformers.js")):null,c=d?.default[n],u=l?c?.(r):r;return u&&(i.geometry=await this._transformationService.imageGeometryToMapGeometry(u,t),i.geometry)?(s||ut(i.geometry),i):void 0})),c=d.filter(r);return o.applyEdits({addFeatures:c}).then(e=>{const{addFeatureResults:t}=e;let i=0;const r=d.map(e=>{const r=t[i++];return e?r:{error:new n("orientedimageryviewer:save-unsucccessful","Error in saving data capture features"),objectId:null,globalId:null}});return{...e,addFeatureResults:r}})}async searchBestImage(e,t){try{const i=await z(e,t);i&&await this.processFeatureResponse(i,e.point,t)}catch(i){v(i)||(this.setMessage("imageLoadError","error",i.message),u.getLogger(this).error("error occurred while finding best image",i))}}selectTriangularMeasurementFeature(e){this.currentBestFeatureMeasurementImage=this.features?.find(({attributes:t})=>t.objectId===Number(e))}setAdditionalCameraLocationsVisibility(e){this.additionalCameraLocations.forEach(t=>{t.visible=e})}setAdditionalCoverageVisibility(e){this.additionalFootprints.forEach(t=>{t.visible=e})}setCurrentCoverageVisibility(e){this.bestFeatureCurrentFootprint&&(this.bestFeatureCurrentFootprint.visible=e),this.currentBestFeatureLocation&&(this.currentBestFeatureLocation.visible=e)}setMapImageConversionToolState(e){this.mapImageConversionToolState=e}setCurrentPanoramaView(e,t){this._panoramicViewer?.set({yaw:e,pitch:t})}async startDataCapture(e,t){const i=this.activeViewer?.imageRenderer,{oiObjectIdField:r,currentBestFeature:a}=this;if(!i||!a||!r)return;const{attributes:{objectId:s}}=a,n=this.overlayedMapFeatures.get(e.id)?.toArray()??[],l=[],d=[];for(const o of n)`${o.getAttribute(r)}`==`${s}`?l.push(o):d.push(o);this.overlayGraphicsOnImage(e.id,new o(d)),this.collectionId=e.id;const c=await this.loadSketch(t),u=await this.loadDataCaptureAdapter(t);y(t),c.addGraphics(l),u.savedGraphics.addMany(l);i.ui.find("zoom").visible=!1,i.map.layers.add(this.sketchGraphicsLayer)}async stopDataCapture(e=!1){this.sketch?.cancel(),this.sketchGraphicsLayer?.removeAll(),this.sketchAdapter=p(this.sketchAdapter),this.sketch=p(this.sketch),this.collectionId=null;const{dataCaptureLayer:t}=this,i=this.activeViewer?.imageRenderer;if(!i||i.destroyed)return;i.map.layers.remove(this.sketchGraphicsLayer),e&&t&&await this.overlayMapFeatures(t,!0);const r=i.ui.find("zoom");r&&(r.visible=!0)}stopMeasurement(){this.draw?.reset(),this.sketch?.cancel()}async toggleAllOverlayMapFeatures(e){!e&&this.dataCaptureLayer&&(await this.stopDataCapture(!0),this.dataCaptureLayer=null),this.overlayedMapFeatures.forEach(t=>{this._toggleVisiblity(t,e)})}toggleOverlayMapFeatures(e,t,i){const r=this.overlayedMapFeatures.get(e);r&&i&&this._toggleVisiblity(r,t)}toggleSelection(e){const{sketch:t}=this;t&&(t.updateOnGraphicClick=e,t.cancel())}async transformAndPlotReferencePointOnImage(e){const{feature:t,selectedLocation:i,options:r}=e;let a=!1,o=!1;const s="video"===this.mode?this.bestFeatureCurrentFootprint?.geometry:this.bestFeatureFootprint?.geometry;switch(s?.type){case"polygon":{const e=i.spatialReference.equals(s.spatialReference)?i:await G(i,s.spatialReference);a=s.contains(e);break}case"mesh":{const e=i.spatialReference.equals(s.spatialReference)?i:await G(i,s.spatialReference);o=s.extent.contains(e);break}}if(!a&&!o)return void this.clearReferencePointOnImage();const n="video"===this.mode||"panoramic-video"===this.mode?await this.getPixelLocationForFeature(i,{feature:t,mode:this.mode,imageSize:ye,footprintExtent:this.footprintExtent},r):await this._transformationService.pointToPixel(i,r);if(n)return y(r),this.plotReferencePointOnImage(n),{x:n.x,y:n.y};this.clearReferencePointOnImage()}async updateFeatureCache(e,t){const i=await N(e,t);i.features?.length&&(this.featureCache=i.features)}_plotReferencePointOnVideo(e){"video-loaded"===this.state&&this.videoViewModel?.videoPaused&&(this.clearReferencePointOnImage(),this.videoViewModel.plotReferencePointOnVideo(e))}_plotReferencePointOnPanoramicVideo(e){const i=this._panoramicVideoViewer,{imageSize:r,media:a}=i.viewModel;if(!this.panoramicVideoLoaded||!this.panoramicVideoPaused||!r)return;this.clearReferencePointOnImage();const o=Be(a),s=ht(e,"panoramic",r,o);this._referencePointOnImage=new t({geometry:s,symbol:Ge.clone()}),i.addGraphic(this._referencePointOnImage,0)}_getActiveFeatureForCurrentMode(){switch(this.mode){case"video":return this.videoViewModel?.closestFeature??this.currentBestFeature;case"panoramic-video":return this._panoramicVideoViewer.viewModel.closestFeature??this.currentBestFeature;default:return this.currentBestFeature}}_plotReferencePointOnDefaultImage(e){const i=this._imageViewer,{imageSize:r}=i;if("image-loaded"!==this.state||!r)return;this.clearReferencePointOnImage();const a=ht(e,"default",r);this._referencePointOnImage=new t({geometry:a,symbol:Le.clone()}),i.addGraphic(this._referencePointOnImage,0)}_plotReferencePointOnPanoramicImage(e){const i=this._panoramicViewer,{imageSize:r,media:a}=i;if("image-loaded"!==this.state||!r)return;this.clearReferencePointOnImage();const o=Be(a),s=ht(e,"panoramic",r,o);this._referencePointOnImage=new t({geometry:s,symbol:Ge.clone()}),i.addGraphic(this._referencePointOnImage,0)}async _fetchFeatures(e,t){const{layer:i,layerFloorFilterClause:r,layerTimeExtent:a,view:o}=this;if(!o)return;if(!i)return void this.setMessage("noLayerSelected","info");e.x=R(e.x,e.spatialReference);const s=i.spatialReference.equals(e.spatialReference)?e:await G(e,i.spatialReference),n=s.spatialReference.isGeographic?B(s):s,l=I("1=1",I(i.definitionExpression,r)),d=n.spatialReference.isGeographic?1:P(n.spatialReference),c={layerInstanceOrURL:i,point:n,queryParams:{where:l,maximumDistance:i.maximumDistance?i.maximumDistance/d:void 0,timeExtent:a}};return await this.searchBestImage(c,t)}async _fetchFeaturesWithController(e,t){try{await this._fetchFeatures(e,t)}catch(i){if(v(i))return;this.setMessage("imageLoadError","error"),u.getLogger(this).error("error occurred while fetching features",i)}}_groupFeaturesBySectors(){const{_suitabilities:e,additionalFeatures:t,features:i,invalidCameraHeading:r}=this,a=i.at(0);if(!e||!t||!a||!i||r)return void(this._sectorData=null);this._sectorData={};const s={};this._featureToSector=s;for(const c of be)this._sectorData[c]=new o;const n=e.map((e,t)=>({...e,featureIndex:t}));n.sort((e,t)=>e.trueSuitability-t.trueSuitability);const l=n.map(({distance:e})=>e),d=Math.max(...l);n.forEach(e=>{const{distance:t,angle:r,featureIndex:o}=e,n=t/d*Ve[2],l=Ze(t,d),c=Je(r);if(!this._sectorData)return;const u=Ve[3]+n*Math.sin(r*Math.PI/180),h=Ve[3]+n*Math.cos(r*Math.PI/180);let p;const m=i.at(o),g=m===a,{cameraPitch:v}=m.attributes,y=v<5;if(g&&y)p=-90;else{const e=u-Ve[3],t=h-Ve[3],i=t/Math.sqrt(e**2+t**2);let r=180*Math.acos(i)/Math.PI;(e<0&&t<0||e<0&&t>0)&&(r*=-1),p=r}const f=""===l?c:`${l}_${c}`;g&&(p===this.bestFeatureAngle?this.previousFeatureAngle=p:this.bestFeatureAngle=p,this.navigatorCurrentBestFeature=y?null:{x:u,y:h,direction:c}),s[`${m.attributes.objectId}`]=f;const w=this._sectorData[f];w.add({angle:r,featureIndex:o,x:u,y:h,objectID:m.attributes.objectId,sector:f,featureIndexInSector:w.length})})}async _initializeLocationViewModel(e){if(!this._locationViewModel){const t=import("./components/ImageLocationViewModel.js"),{default:i}=await t;y(e),this._locationViewModel=new i({oiViewModel:this,referenceTransformationService:this._referenceTransformationService})}}_initializeMeasurementService(){this._measurementService||(this._measurementService=new st({transformationService:this._transformationService,referenceTransformationService:this._referenceTransformationService}))}_initializeVideo(){if(this.videoElement||!this.currentBestFeature)return;this.removeHandles(xe.videoPlayerHandles),this.videoElement=new le({video:this.currentBestFeature.attributes.imagePath,georeference:new se({extent:new T(Me)}),autoplay:!1}),this.videoElement.content?.loop&&(this.videoElement.content.loop=!1);const e=new H({source:this.videoElement,title:this.layer?.title,copyright:this.layer?.copyright});this.videoLayer=e,e&&this.videoMapView.map.layers.add(e),this.videoViewModel=new rt({oiViewModel:this})}async getMapPoint(e,t){const i=await this._transformationService.pixelToMapPoint(Array.isArray(e)?e:[e],t);return Array.isArray(e)?i:i[0]}async getMapPointForFeature(e,t,i){const r=await this._transformationService.pixelToMapPointForFeature(Array.isArray(e)?e:[e],t,i);return Array.isArray(e)?r:r[0]}async loadPanoramicMediaSource(e,t){const{lookAt:i,...r}=e,a=Ue(r);try{await a.load(t)}catch(s){if(v(s))return;if("unsupported-format"===s.name)return void this.setMessage("unsupportedPanoramicImageryError","error",void 0,{datasetFormat:a?.extension??"UNKNOWN FORMAT"})}const o=this.triangularMeasurementActive?this._panoramicMeasurementViewer:this._panoramicViewer;await o.loadMedia(a,t),i&&o.set(i)}async loadMediaSource(e,t){const i=qe(e);await this._setImageSource(this.triangularMeasurementActive?this.imageMeasurementViewer:this._imageViewer,i,t)}_clearFeatureGeometries(){this.coveragePolygons.removeAll(),this.coverageFrustums.removeAll(),this.pointSources.removeAll()}_checkFeatures(e){return!!e?.length||(this.emit("no-image-found"),this.setMessage("noImageError","error"),this.videoElement?.content?.pause(),this.currentBestFeature=null,!1)}async _getElevationSampleFromGround(e,t,i){if(!e[0])return;const r=(await(import("../../geometry/operators/unionOperator.js"))).executeMany(e);if(this._updateFootprintWithFeatures(t,r),"3d"===this.view?.type)try{return await this.view.map.ground.createElevationSampler(this.footprintExtent,i)}catch(a){v(a)||u.getLogger(this).error(a)}}async processElevationSample(e,t,i){const{elevationSource:r}=t[0].attributes,a=await this._getElevationSampleFromGround(e,t,i);return a||(r&&this.footprintExtent&&J(r)?await Y({extent:this.footprintExtent,lod:r.lod,url:r.url,rasterFunction:r.rasterFunction}):void 0)}_processSuitableFeatures(e,t){return U({features:e,selectedPoint:t,camera:We(this.view)?this.view.camera:null,currentImage:this.currentBestFeature})}async _processHitTestResults(e,t,i){const{results:[r]}=t;if("graphic"!==r?.type)return this.beforeLoad(!1),this.emit("no-image-found"),void this.setMessage("noImageError","error");const a=r.graphic.getAttribute(e.objectIdField);return await this.showImageByObjectId(a,i)}async _queryAndLoadByObjectId(e,t,i,r,a){this.displayMessage=null;const{response:o}=await ot(e,t,i,r,a);if(y(a),!o?.features?.length)throw new at(t);const s=q(o.features[0].attributes).polygon,n=L.fromJSON(j(s)),l=Q(n),d=P(l.spatialReference);this.selectedPoint=l;const c={layerInstanceOrURL:e,point:l,queryParams:{where:I(I("1=1",I(e.definitionExpression,i)),`${e.objectIdField} <> ${t}`),maximumDistance:e.maximumDistance?e.maximumDistance/d:void 0,timeExtent:r}},u=await z(c,a);y(a);const{features:h}=u;return h.push(o.features[0]),await this.processFeatureResponse(u,l,{...a,loadBestImage:!1})}_reorderTriangularSketchLayer(){const e=this.imageMeasurementViewer.imageRenderer.map.layers?.length;this.sketchTriangularGraphicsLayer&&e&&this.imageMeasurementViewer.imageRenderer.map.layers.reorder(this.sketchTriangularGraphicsLayer,e-1)}async _setImageSource(e,t,i){e.media=t,await e.loadMedia(t,i)}_toggleVisiblity(e,t){e.forEach(e=>{e.visible=t})}async _updateElevationOfSelectedPointAndLocations(e,t,i,r){const{location:a,cameraHeight:o}=e[0].attributes,s=await re(a.spatialReference,a.z,o,{elevationSample:i,elevationSource:i?void 0:e[0].attributes.elevationSource,extent:this.footprintExtent},r);y(r);const[n,...l]=await X([t,...e.map(e=>e.attributes.geometry.clone())],s);y(r),t.elevation=n.z,e.forEach((e,t)=>{e.attributes.elevation=l[t].z})}_updateFeatures(e,t=!0){if(!e.length)return this.currentBestFeature=null,void this.additionalFeatures.removeAll();this.features.removeAll(),this.features.addMany(e),this.navigationNodes.removeAll(),this.navigationNodes.addMany(e.map(e=>{const{geometry:t,attributes:i}=e,{isSpherical:r,cameraHeading:a,cameraPitch:o}=i;return new it({geometry:t,attributes:i,currentHeading:r?0:a,currentPitch:r?0:o})})),e.length>1?this.additionalFeatures.addMany(e.slice(1)):this.additionalFeatures.removeAll(),this._updateGroundElevation=!0,t&&(this.currentBestFeature=e[0])}_updateFootprintWithFeatures(e,t){const i=[];for(const{attributes:{geometry:r}}of e)t.contains(r)||i.push([r.x,r.y]);i.sort((e,t)=>+x([e,t])),t.addRing(i),this.footprintExtent=ue(t.extent,2,2)}_scheduleVideoInteractionUpdate(){this.scheduledFrameId||(this.scheduledFrameId=requestAnimationFrame(()=>{this.scheduledFrameId=null,this._updateInteraction()}))}async _updatePointsAndPolygons(e){const{pointSources:i,currentBestFeature:r,currentCoverageVisible:a,isAdditionalPointSourcesVisible:o,mode:s,layer:n}=this;if(r&&(this.additionalFootprints.removeAll(),this.additionalCameraLocations.removeAll(),this.bestFeatureCurrentFootprint&&(this.bestFeatureCurrentFootprint.destroy(),this.bestFeatureCurrentFootprint=null,this.bestFeatureFootprint=null),!this.invalidCameraHeading)){await(this._adapter?.createFootprints(e)),y(e);for(const s of i){const i=this.view&&!this.view.spatialReference?.equals(s.spatialReference)?await G(s.clone(),this.view?.spatialReference,e):s.clone();s.imageID===r.attributes.objectId?this.currentBestFeatureLocation=new t({attributes:{imageID:s.imageID},geometry:i,symbol:Ee,visible:a}):this.additionalCameraLocations.push(new t({attributes:{imageID:s.imageID},geometry:i,symbol:je,visible:o}))}"video"!==s&&"panoramic-video"!==s||(await this.initializeTransformationService(e),n&&!this.featureCache.length&&await this.updateFeatureCache(n,r.geometry.spatialReference))}}_updateCurrentBestFeature(e){if(!e)return;if(this.currentBestFeature=this.features?.at(e.featureIndex),"video"===this.mode)return void(this.currentBestFeature&&this.videoViewModel?.playVideoFromSelectedLocation(this.currentBestFeature));if("panoramic-video"===this.mode)return void(this.currentBestFeature&&this._panoramicVideoViewer.viewModel.playPanoramicVideoFromSelectedLocation(this.currentBestFeature));const t=this.currentBestFeature?.attributes.cameraPitch&&this.currentBestFeature?.attributes.cameraPitch<5;let i;if(t)i=-90;else{const t=e.x-Ve[3],r=e.y-Ve[3],a=r/Math.sqrt(t**2+r**2);let o=180*Math.acos(a)/Math.PI;(t<0&&r<0||t<0&&r>0)&&(o*=-1),i=o}i===this.bestFeatureAngle?this.previousFeatureAngle=i:this.bestFeatureAngle=i,this.navigatorCurrentBestFeature=t?null:{x:e.x,y:e.y,direction:e.sector.includes("_")?e.sector.split("_")[1]:e.sector}}_updateImageMeasurementBestFeature(e){e&&(this.currentBestFeatureMeasurementImage=this.features?.at(e.featureIndex))}clearGraphics(){this._imageViewer.clearGraphics(),this._panoramicViewer.clearGraphics(),this.imageMeasurementViewer.clearGraphics(),this._panoramicMeasurementViewer.clearGraphics()}clearReferencePointOnImage(){this._referencePointOnImage&&(this._imageViewer.removeGraphic(this._referencePointOnImage),this._panoramicViewer.removeGraphic(this._referencePointOnImage),this._panoramicVideoViewer.removeGraphic(this._referencePointOnImage),this._referencePointOnImage=p(this._referencePointOnImage)),this.videoViewModel?.clearReferencePointOnVideo()}async initializeReferenceTransformationService(e){const{currentBestFeatureMeasurementImage:t,activeTriangulatedViewer:i,mode:r}=this;if(!t||!i||!i.imageSize||"panoramic"!==r&&"default"!==r)return;const{imageSize:a}=i,{attributes:o,elevationSample:s}=t,{location:{spatialReference:n,z:l},cameraHeight:d,elevationSource:c}=o;let u=o.location;u.spatialReference.isGeographic&&(u=Q(u));const h="default"===r?ae(o,a[0],a[1]):oe(o,a[0],a[1]),p=await re(n,l??0,d,{elevationSample:s,elevationSource:c,extent:this.footprintExtent},e),m=(await(import("./services/TransformationService.js"))).default,g={imageToWorldProperties:h,updateElevationProps:p,mode:r,imageSize:a,depthImageService:this.depthImage};this._referenceTransformationService=new m(g),this._locationViewModel&&(this._locationViewModel.referenceTransformationService=this._referenceTransformationService),this._measurementService&&(this._measurementService.referenceTransformationService=this._referenceTransformationService)}async initializeTransformationService(e){const{currentBestFeature:t,activeViewer:i,mode:r}=this,a="video"===r||"panoramic-video"===r?ye:i?.imageSize;if(!t||!a||"none"===r)return;const{attributes:o,elevationSample:s}=t,{location:{spatialReference:n,z:l},cameraHeight:d,elevationSource:c}=o;let u=o.location;u.spatialReference.isGeographic&&(u=Q(u));const h="default"===r||"video"===r?"default":"panoramic",p={..."default"===h?ae(o,a[0],a[1]):oe(o,a[0],a[1]),cameraLocation:u},m=await re(n,l??0,d,{elevationSample:s,elevationSource:c,extent:this.footprintExtent},e),g=(await(import("./services/TransformationService.js"))).default,v={imageToWorldProperties:p,updateElevationProps:m,mode:h,imageSize:a,depthImageService:this.depthImage};this._transformationService=new g(v),this._measurementService&&(this._measurementService.transformationService=this._transformationService)}plotReferencePoint(e){"mapPoint"in e?this.plotReferencePointOnGround(e.mapPoint):this.plotReferencePointOnGround(e)}clearSelectedPointOnViewer(){if(this._crossSymbol){if("video"===this.mode)return this.videoViewModel?.clearSelectedPointOnVideo(),void(this._crossSymbol=null);this._panoramicViewer.removeGraphic(this._crossSymbol),this._imageViewer.removeGraphic(this._crossSymbol),this.videoMapView.graphics.remove(this._crossSymbol),this._crossSymbol=p(this._crossSymbol)}else this.videoViewModel?.clearSelectedPointOnVideo()}setMessage(e,t,i,r){this.displayMessage={key:e,type:t,data:i,map:r}}async transformAndPlotSelectedLocation(e){const{invalidCameraHeading:t,selectedPoint:i,activeViewer:r,videoElement:a}=this,o="video"===this.mode?this.videoViewModel?.closestFeature??this.currentBestFeature:this.currentBestFeature;this.clearSelectedPointOnViewer();const s="video"===this.mode?!0===a?.loaded&&!0===this.videoViewModel?.videoPaused:"image-loaded"===r?.state;if(!i||!o||!s||t)return;if("video"===this.mode){if(!await Ye(i,this.bestFeatureCurrentFootprint?.geometry,e))return}let n;try{if(n="video"===this.mode?await this.getPixelLocationForFeature(i,{feature:o,mode:this.mode,imageSize:ye,footprintExtent:this.footprintExtent},e):await this._transformationService.pointToPixel(i,{signal:e?.signal}),"video"===this.mode&&!et(n))return;y(e),await this.plotSelectedPointOnImage(n,e)}catch(l){v(l)||u.getLogger(this).error("failed to transform map point to pixel, cross symbol will not be plotted on image",{error:l,selectedPoint:i,feature:o})}}updateCurrentCoveragePolygon(e){const{additionalFootprints:i,additionalCameraLocations:r,currentBestFeature:a,currentBestFeatureLocation:o,currentCoverageVisible:s,selectedPoint:n,view:l,_adapter:d,mode:c}=this;if(!a)return;const{attributes:{objectId:u},elevationSample:h}=a;if(this._initialCurrentCoverageUpdate){if(this._overlays?.removeAll(),this._initialCurrentCoverageUpdate=!1,this.bestFeatureCurrentFootprint=p(this.bestFeatureCurrentFootprint),e&&!this.invalidCameraHeading&&(e.visible=s,this.bestFeatureCurrentFootprint=e),l){const e=[...i,...r,o].filter($e);"3d"===l?.type&&h&&d?.updateGroundElevation&&(this._updateGroundElevation&&d.updateGroundElevation(e),"panoramic"===c&&d.updateGroundElevation([this.bestFeatureCurrentFootprint])),this._updateGroundElevation=!1,n&&(e.splice(-2,0,this.bestFeatureCurrentFootprint),e.push(new t({geometry:n.clone(),symbol:Ie.clone(),attributes:{imageID:u}}))),this._overlays.graphics.addMany(e)}}else if(l){if(this.invalidCameraHeading)return void this._superimposeService.clear();this.bestFeatureCurrentFootprint&&(this._overlays?.remove(this.bestFeatureCurrentFootprint),this.bestFeatureCurrentFootprint=p(this.bestFeatureCurrentFootprint));const t=this.bestFeatureCurrentFootprint&&this._overlays?this._overlays.graphics.indexOf(this.bestFeatureCurrentFootprint):-1;e&&(this.bestFeatureCurrentFootprint=e,"3d"===l?.type&&h&&d?.updateGroundElevation&&"panoramic"===c&&d.updateGroundElevation([e]),e.visible=this.currentCoverageVisible,this._overlays?.graphics.add(this.bestFeatureCurrentFootprint,t>=0?t:this._overlays.graphics.length-1))}}_updateSuperimposedImage(){if(!this._hasActiveSuperimposeCameraContext())return;const e="panoramic"===this.mode?this._panoramicViewer:null,{currentBestFeature:t,defaultSuperimposeCameraLockEnabled:i,layer:r,mode:a,view:o,state:s,superimposeViewEnabled:n,superimposeViewSupported:l,activeViewer:d,depthImage:c}=this,u=this.coverageFrustums.find(({imageID:e})=>e===t?.attributes.objectId);this._superimposeService.update({activeImageSize:d?.imageSize||void 0,adapter:this._adapter,currentBestFeature:t,currentBestFeatureFrustum:u,defaultSuperimposeCameraLockEnabled:i,depthImageLoaded:c?.loaded??!1,layer:r,mode:a,panoramicCamera:e?.camera,state:s,superimposeViewEnabled:n&&l,view:o}),this.setMessage("superimposeImageDescription","info"),this._superimposePreviousCurrentCoverageVisible??=this.currentCoverageVisible,this.currentCoverageVisible=!1}_getSuperimposeCameraWatchState(){const e="3d"===this.view?.type?this.view:null,t=e?.camera;return[this.superimposeViewEnabled,this.superimposeViewSupported,this.mode,this.state,this.view?.type,this.view?.interacting,this.view?.navigating,t?.heading,t?.tilt,t?.fov,t?.position.x,t?.position.y,t?.position.z]}_handleSuperimposeCameraChange(){const e=this.view,t="3d"===e?.type?e:null;this._hasActiveSuperimposeCameraContext()?"panoramic"!==this.mode?!t||t.interacting||t.navigating?this._abortSuperimposeSchedule():this._scheduleDefaultSuperimposeUpdate():this._schedulePanoramicSuperimposeUpdate():this._abortSuperimposeSchedule()}_shouldDisableUnsupportedSuperimposeView(){return this.superimposeViewEnabled&&"panoramic"===this.mode&&!this.superimposeViewSupported}_hasActiveSuperimposeCameraContext(){return("default"===this.mode||"panoramic"===this.mode)&&this.superimposeViewEnabled&&this.superimposeViewSupported&&"image-loaded"===this.state&&"3d"===this.view?.type&&!!this.view.camera}_abortSuperimposeSchedule(){this._superimposeScheduleController?.abort(),this._superimposeScheduleController=null,this._clearSuperimposeDebounceTimeout(),this._clearSuperimposeScheduledFrame()}_resetInactiveSuperimposeState(){const e=null!=this._superimposePreviousCurrentCoverageVisible;this._abortSuperimposeSchedule(),this._adapter?.disableDefaultSuperimposeNavigation?.(),this._adapter?.disablePanoramicSuperimposeNavigation?.(),this._superimposeService.clear(),this._restoreCurrentCoverageVisibilityAfterSuperimpose(),this._restoreDefaultMessageAfterSuperimpose(),e&&this._restoreViewerMediaAfterSuperimpose()}_restoreCurrentCoverageVisibilityAfterSuperimpose(){null!=this._superimposePreviousCurrentCoverageVisible&&(this.currentCoverageVisible=this._superimposePreviousCurrentCoverageVisible,this._superimposePreviousCurrentCoverageVisible=null)}_restoreViewerMediaAfterSuperimpose(){const{currentBestFeature:e,mode:t}=this;if(!e||"default"!==t&&"panoramic"!==t)return;this._restoreSuperimposeMediaTask?.abort();const i=a(async t=>{await this._loadCurrentFeatureMedia(e,{signal:t})});this._restoreSuperimposeMediaTask=i,i.promise.finally(()=>{this._restoreSuperimposeMediaTask===i&&(this._restoreSuperimposeMediaTask=null)})}_restoreDefaultMessageAfterSuperimpose(){if("superimposeImageDescription"===this.displayMessage?.key){!!this.currentBestFeature&&("default"===this.mode||"panoramic"===this.mode)?this.displayMessage=null:this.setMessage("onLoadMessage","info")}}_clearSuperimposeDebounceTimeout(){null!=this.superimposeDebounceTimeoutId&&(clearTimeout(this.superimposeDebounceTimeoutId),this.superimposeDebounceTimeoutId=null)}_clearSuperimposeScheduledFrame(){null!=this.superimposeScheduledFrameId&&(cancelAnimationFrame(this.superimposeScheduledFrameId),this.superimposeScheduledFrameId=null)}_schedulePanoramicSuperimposeUpdate(){this._abortSuperimposeSchedule(),this.superimposeDebounceTimeoutId=window.setTimeout(()=>{this.superimposeDebounceTimeoutId=null,this._hasActiveSuperimposeCameraContext()&&"panoramic"===this.mode&&this._updateSuperimposedImage()},150)}_scheduleDefaultSuperimposeUpdate(){const e=this.view;if(!("3d"===e?.type?e:null))return;if(this.superimposeScheduledFrameId)return;this._superimposeScheduleController?.abort();const t=new AbortController,{signal:i}=t,r=()=>{this._clearSuperimposeDebounceTimeout(),this._clearSuperimposeScheduledFrame(),this._superimposeScheduleController===t&&(this._superimposeScheduleController=null),i.removeEventListener("abort",r)};this._superimposeScheduleController=t,i.addEventListener("abort",r),this.superimposeScheduledFrameId=requestAnimationFrame(()=>{if(i.removeEventListener("abort",r),this.superimposeScheduledFrameId=null,this._superimposeScheduleController===t&&(this._superimposeScheduleController=null),i.aborted)return;const e=this.view,a="3d"===e?.type?e:null;!this._hasActiveSuperimposeCameraContext()||null==a||a.interacting||a.navigating||this._updateSuperimposedImage()})}};e([C()],vt.prototype,"activeLayer",null),e([C({readOnly:!0})],vt.prototype,"activeViewer",null),e([C()],vt.prototype,"activeTriangulatedViewer",null),e([C()],vt.prototype,"accuracyParametersMissing",null),e([C()],vt.prototype,"additionalFeatures",void 0),e([C({type:o.ofType(t)})],vt.prototype,"additionalCameraLocations",void 0),e([C({type:o.ofType(t)})],vt.prototype,"additionalFootprints",void 0),e([C()],vt.prototype,"areaMeasurementResult",void 0),e([C()],vt.prototype,"areaMeasurementAccuracy",void 0),e([C()],vt.prototype,"bestFeatureAngle",void 0),e([C()],vt.prototype,"bestFeatureCurrentFootprint",void 0),e([C({type:t})],vt.prototype,"bestFeatureFootprint",void 0),e([C({type:Number})],vt.prototype,"brightness",null),e([C()],vt.prototype,"cameraHeadingThreshold",void 0),e([C()],vt.prototype,"cameraPitchThreshold",void 0),e([C()],vt.prototype,"clickAction",void 0),e([C()],vt.prototype,"correctedLocationPointOnImage",void 0),e([C()],vt.prototype,"videoViewModel",void 0),e([C()],vt.prototype,"collectionId",void 0),e([C({type:Number})],vt.prototype,"contrast",null),e([C()],vt.prototype,"coverageFrustums",void 0),e([C()],vt.prototype,"coveragePolygons",void 0),e([C()],vt.prototype,"currentBestFeature",void 0),e([C()],vt.prototype,"currentBestFeatureMeasurementImage",void 0),e([C()],vt.prototype,"currentBestFeatureLocation",void 0),e([C()],vt.prototype,"currentCoverageVisible",void 0),e([C()],vt.prototype,"currentNode",null),e([C()],vt.prototype,"depthImage",void 0),e([C()],vt.prototype,"depthImageNotSupported",null),e([C()],vt.prototype,"featureCache",void 0),e([C()],vt.prototype,"navigationNodes",void 0),e([C({json:{write:!1}})],vt.prototype,"determineWorkflowForFeature",void 0),e([C({json:{write:!1}})],vt.prototype,"determineWorkflowForTriangularMeasurement",void 0),e([C()],vt.prototype,"disabled",void 0),e([C()],vt.prototype,"displayMessage",void 0),e([C()],vt.prototype,"displayNewMeasurementButton",void 0),e([C()],vt.prototype,"distanceMeasurementResult",void 0),e([C()],vt.prototype,"distanceAccuracyArray",void 0),e([C()],vt.prototype,"dataCaptureLayer",void 0),e([C({readOnly:!0})],vt.prototype,"featureCount",null),e([C()],vt.prototype,"features",void 0),e([C()],vt.prototype,"groundCoordinates",void 0),e([C()],vt.prototype,"groundCoordinatesAccuracy",void 0),e([C()],vt.prototype,"heightGraphic",void 0),e([C()],vt.prototype,"heightMeasurementResult",void 0),e([C()],vt.prototype,"heightMeasurementAccuracy",void 0),e([C({readOnly:!0})],vt.prototype,"imageGalleryEnabled",null),e([C()],vt.prototype,"imageGeometryField",void 0),e([C({readOnly:!0})],vt.prototype,"imageLoaded",null),e([C()],vt.prototype,"imageLocationToolState",void 0),e([C()],vt.prototype,"initialVideoMapViewExtent",void 0),e([C({readOnly:!0})],vt.prototype,"invalidCameraHeading",null),e([C()],vt.prototype,"imagePointsInView",null),e([C()],vt.prototype,"imageMeasurementViewer",void 0),e([C()],vt.prototype,"isAdditionalCoverageVisible",void 0),e([C()],vt.prototype,"isAdditionalPointSourcesVisible",void 0),e([C()],vt.prototype,"layer",void 0),e([C()],vt.prototype,"layerView",null),e([C({readOnly:!0})],vt.prototype,"layerFloorFilterClause",null),e([C({readOnly:!0})],vt.prototype,"layerTimeExtent",null),e([C({type:Number})],vt.prototype,"localPort",void 0),e([C()],vt.prototype,"locationPointOnImage",void 0),e([C()],vt.prototype,"mapImageConversionToolState",void 0),e([C()],vt.prototype,"measureType",void 0),e([C()],vt.prototype,"measurementGraphic",void 0),e([C({readOnly:!0,value:"none"})],vt.prototype,"mode",null),e([C()],vt.prototype,"navigationMode",void 0),e([C()],vt.prototype,"navigatorCurrentBestFeature",void 0),e([C()],vt.prototype,"oiObjectIdField",void 0),e([C({type:o.ofType(t)})],vt.prototype,"overlayedCameraLocations",void 0),e([C()],vt.prototype,"overlayedMapFeatures",void 0),e([C()],vt.prototype,"panoramicVideoLoaded",null),e([C()],vt.prototype,"panoramicVideoPaused",null),e([C()],vt.prototype,"pixelCoordinates",void 0),e([C()],vt.prototype,"preserveAngle",void 0),e([C()],vt.prototype,"pointSources",void 0),e([C({readOnly:!0})],vt.prototype,"popupEnabled",null),e([C()],vt.prototype,"preloadMedia",void 0),e([C()],vt.prototype,"preloadMediaSize",void 0),e([C()],vt.prototype,"previousFeatureAngle",void 0),e([C()],vt.prototype,"referencePoint",null),e([C({readOnly:!0})],vt.prototype,"sectorData",null),e([C()],vt.prototype,"selectedPoint",void 0),e([C({type:Number})],vt.prototype,"sharpness",null),e([C()],vt.prototype,"shouldShowSelectedImage",void 0),e([C()],vt.prototype,"superimposeViewEnabled",void 0),e([C()],vt.prototype,"defaultSuperimposeCameraLockEnabled",void 0),e([C()],vt.prototype,"superimposeViewSupported",null),e([C()],vt.prototype,"sketch",void 0),e([C()],vt.prototype,"sketchTriangular",void 0),e([C()],vt.prototype,"sketchTriangularGraphicsLayer",void 0),e([C()],vt.prototype,"draw",void 0),e([C()],vt.prototype,"drawAdapter",void 0),e([C()],vt.prototype,"polylineDrawAction",void 0),e([C()],vt.prototype,"scheduledFrameId",void 0),e([C()],vt.prototype,"superimposeScheduledFrameId",void 0),e([C()],vt.prototype,"superimposeDebounceTimeoutId",void 0),e([C()],vt.prototype,"sketchAdapter",void 0),e([C({readOnly:!0})],vt.prototype,"sketchGraphicsLayer",null),e([C({readOnly:!0})],vt.prototype,"state",null),e([C({readOnly:!0})],vt.prototype,"thumbnails",null),e([C()],vt.prototype,"videoExtentPoints",null),e([C()],vt.prototype,"triangularMeasurementActive",void 0),e([C()],vt.prototype,"triangulatedDistanceMeasurement",void 0),e([C()],vt.prototype,"triangulatedDistanceAccuracy",void 0),e([C()],vt.prototype,"triangulatedAreaMeasurement",void 0),e([C()],vt.prototype,"triangulatedAreaAccuracy",void 0),e([C()],vt.prototype,"triangulatedMeasurementGraphic",void 0),e([C()],vt.prototype,"triangulatedPoint",void 0),e([C()],vt.prototype,"triangulatedMeasurementAdapter",void 0),e([C()],vt.prototype,"updateFootprint",void 0),e([C()],vt.prototype,"updateVideoFootprint",void 0),e([C()],vt.prototype,"updateFootprintPanorama",void 0),e([C()],vt.prototype,"updatingTriangularMeasurementState",void 0),e([C({value:null})],vt.prototype,"view",null),e([C()],vt.prototype,"videoElement",void 0),e([C()],vt.prototype,"videoLayer",void 0),e([C()],vt.prototype,"videoMapView",void 0),e([C()],vt.prototype,"verticalFilterEnabled",void 0),e([C()],vt.prototype,"_adapter",void 0),e([C()],vt.prototype,"_defaultGraphicsLayer",null),e([C()],vt.prototype,"_highlightedFeatureHandle",void 0),e([C()],vt.prototype,"_imageViewer",void 0),e([C()],vt.prototype,"_initialCurrentCoverageUpdate",void 0),e([C()],vt.prototype,"_locationViewModel",void 0),e([C()],vt.prototype,"_measurementService",void 0),e([C()],vt.prototype,"_mediaPrefetcher",void 0),e([C()],vt.prototype,"_navigationManager",void 0),e([C()],vt.prototype,"_overlays",void 0),e([C()],vt.prototype,"_superimposePreviousCurrentCoverageVisible",void 0),e([C()],vt.prototype,"_superimposeService",void 0),e([C({readOnly:!0})],vt.prototype,"_overlaysView",null),e([C()],vt.prototype,"_panoramicVideoViewer",void 0),e([C()],vt.prototype,"_panoramicViewer",void 0),e([C()],vt.prototype,"_panoramicMeasurementViewer",void 0),e([C()],vt.prototype,"_referencePointOnGround",void 0),e([C()],vt.prototype,"_referencePointOnImage",void 0),e([C()],vt.prototype,"_referenceTransformationService",void 0),e([C()],vt.prototype,"_sectorData",void 0),e([C()],vt.prototype,"_transformationService",void 0),e([C()],vt.prototype,"_featureToSector",void 0),e([C({readOnly:!0})],vt.prototype,"_updatingHandles",void 0),e([C()],vt.prototype,"footprintExtent",void 0),e([C()],vt.prototype,"_featureChangedTask",void 0),vt=e([A("esri.widgets.OrientedImageryViewer.OrientedImageryViewerViewModel")],vt);const yt=vt;export{yt as default};
2
+ import{__decorate as e}from"tslib";import t from"../../Graphic.js";import{equals as i,isSome as r}from"../../core/arrayUtils.js";import{createTask as a}from"../../core/asyncUtils.js";import o from"../../core/Collection.js";import{deprecatedProperty as s}from"../../core/deprecate.js";import n from"../../core/Error.js";import{EventedMixin as l}from"../../core/Evented.js";import{makeHandle as d}from"../../core/handleUtils.js";import{equalsShallow as c}from"../../core/lang.js";import u from"../../core/Logger.js";import{clamp as h}from"../../core/mathUtils.js";import{destroyMaybe as p,abortMaybe as m}from"../../core/maybe.js";import{EsriPromise as g}from"../../core/Promise.js";import{isAbortError as v,throwIfAborted as y,waitTick as f}from"../../core/promiseUtils.js";import w from"../../core/ReactiveMap.js";import{whenOnce as _,on as F,watch as b,syncAndInitial as M,initial as V,when as S}from"../../core/reactiveUtils.js";import{sqlAnd as I}from"../../core/sql.js";import{getMetersPerUnitForSR as P}from"../../core/units.js";import{property as C,subclass as A}from"../../core/accessorSupport/decorators.js";import{isSerializable as k}from"../../core/support/jsonUtils.js";import{UpdatingHandles as O}from"../../core/support/UpdatingHandles.js";import T from"../../geometry/Extent.js";import L from"../../geometry/Point.js";import{projectAsync as G}from"../../geometry/projectionUtils.js";import E from"../../geometry/SpatialReference.js";import{polygonCentroidPoint as j}from"../../geometry/support/centroid.js";import{isClockwise as x}from"../../geometry/support/coordsUtils.js";import{normalizeMapX as R}from"../../geometry/support/normalizeUtils.js";import{geographicToWebMercator as B}from"../../geometry/support/webMercatorUtils.js";import D from"../../layers/GraphicsLayer.js";import H from"../../layers/MediaLayer.js";import{searchImages as z,getSortedLayerFeatures as N}from"../../layers/orientedImagery/queries.js";import{calculateSuitabilities as U}from"../../layers/orientedImagery/core/bestImageUtils.js";import{createCoveragePolygon as q,computePolygonForInspection as W,resizePolygon as $,checkIfPolygonContainsSelectedPoint as Z}from"../../layers/orientedImagery/core/coverageUtils.js";import{isElevationSource as J}from"../../layers/orientedImagery/core/ElevationSourceDefinitions.js";import{getMetersPerUnitOfSR as K,convertGeographicToWebMercator as Q}from"../../layers/orientedImagery/core/utils.js";import X from"../../layers/orientedImagery/transformations/updateElevation.js";import{getElevationSampler as Y}from"../../layers/orientedImagery/transformations/updateElevationUtils.js";import{or as ee,getInitialAngle as te,convertPixelLocationToSphereVertex as ie,getUpdateElevationProps as re,getImageToWorldProperties as ae,getImageToWorldPanoramicProperties as oe}from"../../layers/orientedImagery/transformations/utils.js";import se from"../../layers/support/ExtentAndRotationGeoreference.js";import{getFloorFilterClause as ne}from"../../layers/support/floorFilterUtils.js";import le from"../../layers/support/VideoElement.js";import de from"../../views/MapView.js";import ce from"../../views/draw/Draw.js";import{scale as ue}from"../../views/draw/support/drawUtils.js";import{ViewEventPriorities as he}from"../../views/input/InputManager.js";import pe from"../PanoramicVideoViewer.js";import me from"../PanoramicViewer.js";import{defaultAngleThresholdInDegrees as ge,videoMapViewConstraint as ve,fixedImageSize as ye,clockwiseDirections as fe,videoFitScaleTolerance as we,videoExtent as _e,invalidCameraHeading as Fe,sectorsInOrder as be,sampleExtent as Me,sectorsRadii as Ve}from"./constants.js";import{isFeatureAttachment as Se}from"./galleryUtils.js";import{crossSymbol as Ie,crossSymbol3D as Pe,measurementPolygonSymbol as Ce,polylineSymbolPanoramic as Ae,measurementPolylineSymbol as ke,cameraOverlaySymbol3D as Oe,cameraOverlaySymbol as Te,diamondSymbol as Le,diamondSymbol3D as Ge,activeSourcePointSymbol as Ee,sourcePointSymbol as je}from"./symbols.js";import{registryKeys as xe}from"./types.js";import{isNoAttachmentError as Re,extractHorizonAnglesFromMedia as Be,isTifOrMrf as De,filterOILLayerView as He,assignElevationSampleToFeatures as ze,filterByZ as Ne,createPanoramicMedia as Ue,createNonPanoramicMedia as qe,isSceneView as We,isGraphic as $e,calculateSegment as Ze,calculateDirection as Je}from"./utils.js";import{disableVideoZoomAndPan as Ke,getUpdatedConstraints as Qe,getUpdatedExtentPoints as Xe,isSelectedPointWithinVideoFootprint as Ye,isVideoPixelWithinFrame as et}from"./videoViewerUtils.js";import tt from"./components/ImageViewer.js";import it from"./components/NavigationNode.js";import rt from"./components/OrientedImageryVideoViewModel.js";import{NoFeatureFoundWithObjectIdError as at}from"./navigation/errors.js";import{queryFeatureByObjectIds as ot}from"./navigation/queries.js";import{ImageMeasurementService as st}from"./services/ImageMeasurementService.js";import nt from"./services/SuperimposeService.js";import{configureSketchTool as lt,extractFieldsFromDataCaptureLayer as dt,constructGraphicFromImageGeometry as ct}from"./support/dataCaptureUtils.js";import{removeZFromGeometry as ut,imageSpaceToPoint as ht}from"./support/geometryUtils.js";import pt from"./support/resolveMediaProps.js";import{isValidDataCaptureLayer as mt}from"./support/typeUtils.js";const gt=()=>new n("orientedimageryviewer:sketch-not-initialized","Sketch property is not initialized, call loadSketch first");let vt=class extends(l(g)){constructor(e){super(e),this.additionalFeatures=new o,this.additionalCameraLocations=new o,this.additionalFootprints=new o,this.areaMeasurementResult=0,this.areaMeasurementAccuracy=0,this.bestFeatureAngle=0,this.bestFeatureCurrentFootprint=null,this.bestFeatureFootprint=null,this.cameraHeadingThreshold=ge,this.cameraPitchThreshold=ge,this.clickAction="hittest",this.correctedLocationPointOnImage=null,this.videoViewModel=null,this.collectionId=null,this.coverageFrustums=new o,this.coveragePolygons=new o,this.currentBestFeature=null,this.currentBestFeatureMeasurementImage=null,this.currentBestFeatureLocation=null,this.currentCoverageVisible=!0,this.depthImage=null,this.featureCache=[],this.navigationNodes=new o,this.determineWorkflowForFeature=async(e,t,i)=>{const{currentBestFeature:r,selectedPoint:a}=this;if(this.emit("popup-close"),r&&a){this.displayMessage=null,this._initialCurrentCoverageUpdate=!0,this._updateGroundElevation=!0;try{await this._updatePointsAndPolygons(i),await this._loadDepthImage(i),await this._loadCurrentFeatureMedia(r,i)}catch(o){v(o)||(this.loadImageError(o),u.getLogger(this).error("#loadIImage()","error occured while loading image",o))}}},this.determineWorkflowForTriangularMeasurement=async(e,t,i)=>{if(this.emit("popup-close"),this.currentBestFeatureMeasurementImage&&this.selectedPoint)try{await this._loadMeasurementViewerImage(i)}catch(r){v(r)||(this.loadImageError(r),u.getLogger(this).error("#loadIImage()","error occured while loading image",r))}},this.disabled=!1,this.displayMessage={key:"onLoadMessage",type:"info"},this.displayNewMeasurementButton=!0,this.distanceMeasurementResult=0,this.distanceAccuracyArray=[],this.dataCaptureLayer=null,this.features=new o,this.groundCoordinates=null,this.groundCoordinatesAccuracy=null,this.groundCoordinatesAccuracyLoading=!1,this.heightGraphic=null,this.heightMeasurementResult=0,this.heightMeasurementAccuracy=0,this.imageGeometryField=null,this.imageLocationToolState=!1,this.initialVideoMapViewExtent=null,this.imageMeasurementViewer=new tt,this.isAdditionalCoverageVisible=!1,this.isAdditionalPointSourcesVisible=!1,this.layer=null,this.localPort=null,this.locationPointOnImage=null,this.mapImageConversionToolState=!1,this.measureType=null,this.measurementGraphic=null,this.navigatorCurrentBestFeature=null,this.oiObjectIdField=null,this.overlayedCameraLocations=new o,this.overlayedMapFeatures=new w,this.pixelCoordinates=null,this.preserveAngle="none",this.pointSources=new o,this.preloadMedia=!1,this.preloadMediaSize=5,this.previousFeatureAngle=0,this.selectedPoint=null,this.shouldShowSelectedImage=!1,this.superimposeViewEnabled=!1,this.defaultSuperimposeCameraLockEnabled=!0,this.sketch=null,this.sketchTriangular=null,this.sketchTriangularGraphicsLayer=null,this.draw=null,this.drawAdapter=null,this.polylineDrawAction=null,this.scheduledFrameId=null,this.superimposeScheduledFrameId=null,this.superimposeDebounceTimeoutId=null,this.sketchAdapter=null,this.triangularMeasurementActive=!1,this.triangulatedDistanceMeasurement=null,this.triangulatedDistanceAccuracy=null,this.triangulatedAreaMeasurement=null,this.triangulatedAreaAccuracy=0,this.triangulatedMeasurementGraphic=null,this.triangulatedPoint=null,this.triangulatedMeasurementAdapter=null,this.updateFootprint=async(e,t,i)=>{"default"===this.mode&&"image-loaded"!==this.state||await(this._adapter?.updateFootprint(e,t,i))},this.updateVideoFootprint=async e=>{this.mode.includes("video")&&this.videoElement?.content&&await(this._adapter?.updateVideoFootprint(e))},this.updateFootprintPanorama=async(e,t)=>{await(this._adapter?.updateFootprintPanorama(e,t))},this.updatingTriangularMeasurementState=!1,this.videoElement=null,this.videoLayer=null,this.videoMapView=new de({map:new Map,constraints:ve}),this.verticalFilterEnabled=!1,this._adapter=null,this._highlightedFeatureHandle=null,this._imageViewer=new tt,this._initialCurrentCoverageUpdate=!0,this._locationViewModel=null,this._measurementService=null,this._mediaPrefetcher=null,this._navigationManager=null,this._overlays=new D({listMode:"hide",internal:!0,elevationInfo:{mode:"absolute-height"},title:"OrentedImageryViewerViewModel overlays layer"}),this._superimposePreviousCurrentCoverageVisible=null,this._superimposeService=new nt({getMapPoint:(e,t)=>this.getMapPoint(e,t),getPanoramicTransformationState:()=>{const{imageToWorldProperties:e,mode:t,updateElevationProps:i}=this._transformationService;return"panoramic"===t&&e?{imageToWorldProperties:e,updateElevationProps:i}:null},pointToPixel:(e,t)=>this._transformationService.pointToPixel(e,t),overlays:this._overlays,getPointAtDistance:(e,t,i)=>this._transformationService.pixelToPointAtDistance(e,t,i)}),this._panoramicVideoViewer=new pe,this._panoramicViewer=new me,this._panoramicMeasurementViewer=new me,this._referencePointOnGround=null,this._referencePointOnImage=null,this._referenceTransformationService=null,this._sectorData=null,this._transformationService=null,this._featureToSector=null,this._updatingHandles=new O,this._clickTask=null,this._crossSymbol=null,this.footprintExtent=null,this._featureChangedTask=null,this._mediaPrefetchTask=null,this._restoreSuperimposeMediaTask=null,this._superimposeScheduleController=null,this._suitabilities=null,this._transformController=new AbortController,this._updateFootprintTask=null,this._updateGroundElevation=!1,this.addUpdatingPromise=e=>this._updatingHandles.addPromise(e),this.filterCapturedFeatures=e=>{const t=this.currentBestFeature?.attributes.objectId,i=this.layer?.imageReferenceField;if(!t||!e||!i)return;const r=this.overlayedMapFeatures.get(e);r?.forEach(e=>{const r=e.attributes??{},a=Object.keys(r).find(e=>e.toLowerCase()===i.toLowerCase());(a?r[a]:null)!==t&&(e.visible=!e.visible)})},this.hideImageGeometry=e=>{},this.highlight=e=>{if(!this._overlaysView)return;this.removeHighlight();const t=this.additionalFootprints.find(({attributes:{imageID:t}})=>t===Number(e));this._highlightedFeatureHandle=t?this._overlaysView?.highlight(t):null},this.loadDataCaptureAdapter=async e=>{await this.loadSketch(e);const t=import("./adapters/sketch/DataCaptureAdapter.js"),{default:i}=await t;return y(e),this.sketchAdapter=new i({viewModel:this}),this.sketchAdapter},this.loadImageFromFeature=(e,t,i)=>this._updatingHandles.addPromise(this._loadImageFromFeature(e,t,i)),this.storeImageMeasurementViewer=e=>{this.imageMeasurementViewer=e},this.storePanoramicMeasurementViewer=e=>{this._panoramicMeasurementViewer=e},this.loadImageViewer=e=>{this._imageViewer?.destroy(),this._imageViewer=e},this.loadPanoramicViewer=e=>{this._panoramicViewer?.destroy(),this._panoramicViewer=e},this.loadPanoramicVideoViewer=e=>{this._panoramicVideoViewer?.destroy(),this._panoramicVideoViewer=e},this.loadVideoViewer=e=>{this.videoMapView.container=e},this.showImageByObjectId=async(e,t)=>{const i=this.additionalFeatures.find(({attributes:t})=>t.objectId===e);if(i)this.currentBestFeature=i;else{const{layer:i,layerFloorFilterClause:a,layerTimeExtent:o}=this;if(!i)return void this.setMessage("noLayerSelected","info");this.beforeLoad();const s=this._updatingHandles.addPromise(this._queryAndLoadByObjectId(i,e,a,o,t));try{await s,await this.selectBestFeature(e,t)}catch(r){v(r)||(u.getLogger(this).error("oriented-imagery-viewer:show-image",r),"NoFeatureFoundWithObjectIdError"===r.name?this.setMessage("noFeatureFoundWithObjectId","error","",{objectId:e}):this.setMessage("imageLoadError","error",r.message))}}},this.getSectorFeatureById=e=>this._suitabilities?.find(({feature:{attributes:{objectId:t}}})=>t===e),this.getFeatureSectorById=e=>this._featureToSector?.[`${e}`],this.navigate=async(e,t)=>{const{mode:i}=this;if("default"!==i&&"panoramic"!==i)throw new n("NavigationError","Navigation is only supported in 'default' and 'panoramic' modes.");const r=e=>"default"===i&&e.declaredClass.endsWith("NavigationManager")||"panoramic"===i&&e.declaredClass.endsWith("NavigationManagerPanoramic");if(null==this._navigationManager||!r(this._navigationManager)){p(this._navigationManager);const e="default"===i?import("./navigation/NavigationManager.js"):import("./navigation/NavigationManagerPanoramic.js");this._navigationManager=new(await e).default({viewModel:this})}return this._navigationManager.navigate(e,t)},this.removeHighlight=()=>this._highlightedFeatureHandle?.remove(),this.revealImageGeometry=e=>{},this.selectBestFeature=async(e,t)=>(y(t),this.currentBestFeature=this.features?.find(({attributes:t})=>`${t.objectId}`==`${e}`),_(()=>{switch(this.mode){case"video":return"video-loaded"===this.state;case"panoramic-video":return this.panoramicVideoLoaded;default:return"image-loaded"===this.state}},t)),this.toggleImageAttributes=()=>{const{currentBestFeature:e,popupEnabled:i,layer:r,view:a}=this;if(this.emit("popup-close"),!(a&&e&&i&&r))return;const{attributes:o,geometry:s}=e,n=new t({geometry:s,attributes:o.toJSON(),origin:r.graphicOrigin,sourceLayer:r});this.emit("popup-open",{features:[n],location:o.location.clone()})},this.updateSuitabilities=(e,t=!0)=>{e.sort((e,t)=>e.suitability-t.suitability),this._suitabilities=e;const i=this._suitabilities.map(({feature:e})=>e);this._initialCurrentCoverageUpdate=!0,this._updateFeatures(i,t),this._groupFeaturesBySectors()},this._computeOverlayImageSize=()=>{const{mode:e}=this;return"video"===e?ye:"panoramic-video"===e?this._panoramicVideoViewer.imageSize:this.activeViewer?.imageSize},this._geometryToOverlayImageGeometry=async(e,t,i)=>{const{mode:r,videoViewModel:a,_panoramicVideoViewer:o}=this;if("video"===r)return await(a?.geometryToOverlayGeometry(e,t))??null;if("panoramic-video"===r){const a={feature:t,mode:r,imageSize:i,footprintExtent:this.footprintExtent};return await this._transformationService.geometryToImageGeometryForFeature(e,a,o.horizonAngles)}return await this._transformationService.geometryToImageGeometry(e)},this._createViewClickHandle=()=>{if(this.removeHandles(xe.click),this.disabled||null==this.view)return;const e=this.mapImageConversionToolState&&("image-loaded"===this.state||"video-loaded"===this.state&&"video"===this.mode&&!!this.videoViewModel?.videoPaused||this.panoramicVideoLoaded&&"panoramic-video"===this.mode&&this.panoramicVideoPaused)?this._mapImageConversionToolViewClickHandler:this._viewClickHandler;this.addHandles(this.view.on("click",e,he.DEFAULT),xe.click)},this._createImageClickHandle=()=>{this.removeHandles(xe.imageClick),this.videoViewModel?.syncMapImageConversionHandle();const{mapImageConversionToolState:e,mode:t,footprintExtent:i,panoramicVideoLoaded:r}=this,o="panoramic-video"===t?this._panoramicVideoViewer:this.activeViewer,s=o?.imageSize;if(!e||"none"===t||"video"===t||!s||!i)return;const n="panoramic-video"===t,l=this._getActiveFeatureForCurrentMode(),c=!n||r&&this.panoramicVideoPaused;if(!l||!c)return;const u=o.clickAction;this.clickAction="pixel-location";const h=d(()=>{this.clickAction=u});let p=null;const m=F(()=>o,"pixel-location",e=>{this.plotReferencePointOnImage(e),p?.abort(),p=a(async r=>{if(!e)return;const a=this._getActiveFeatureForCurrentMode();if(!a)return;const o={feature:a,mode:t,imageSize:s,footprintExtent:i};let l=n?await this.getMapPointForFeature(e,o,{signal:r}):await this._transformationService.pixelToMapPoint(e);const d=this.view?.spatialReference;l&&!ee(!d,l.spatialReference.equals(d))&&(l=await G(l,d,{signal:r})),y(r),this.plotReferencePointOnGround(l)})});this.addHandles([m,h],xe.imageClick)},this._createTriangularImageClickHandle=()=>{this.removeHandles(xe.triangularImageClick),this.triangularMeasurementActive&&"none"!==this.mode&&this.currentBestFeature&&this.currentBestFeatureMeasurementImage&&this.activeTriangulatedViewer&&this.addHandles(this.activeTriangulatedViewer.imageRenderer.on("double-click",this._measurementImageClickHandler),xe.triangularImageClick)},this._enablePan=()=>{this.removeHandles(xe.videoPanHandles)},this._disablePan=()=>{this.removeHandles(xe.videoPanHandles),this.addHandles(Ke(this.videoMapView),xe.videoPanHandles)},this._handleImageHitTestResponse=async e=>{const{layer:t,overlayedCameraLocations:i}=this;if(!t)return;const r=e.results.find(({graphic:e,graphic:{attributes:r}})=>i.includes(e)&&r&&!r[t.imageReferenceField]&&!r[t.imageGeometryField]);if(!r)return;const a=r.graphic.attributes[t.objectIdField];await this.showImageByObjectId(a)},this._loadCurrentFeatureMedia=async(e,t)=>{"video"!==this.mode?"panoramic-video"!==this.mode?await this._loadImage(t):await this._loadVideo(t):await this._loadFlatVideo(e,t)},this._loadFlatVideo=async(e,t)=>{this._initializeVideo(),this.videoViewModel?.playVideoFromSelectedLocation(e);const i=e.attributes.objectId;this._waitForFlatVideoAndPlotSelectedLocation(e,i,t)},this._waitForFlatVideoAndPlotSelectedLocation=async(e,t,i)=>{try{if(await _(()=>!0===this.videoElement?.loaded,i),`${this.currentBestFeature?.attributes.objectId}`!=`${t}`)return;await this.transformAndPlotSelectedLocation(i)}catch(r){v(r)||u.getLogger(this).error("failed to plot selected point on video",{error:r,selectedPoint:this.selectedPoint,feature:e})}},this._loadDepthImage=async e=>{const{currentBestFeature:t,layer:i,depthImageNotSupported:r}=this;if(this.depthImage?.destroy(),this.depthImage=null,!i||!t||r)return;const{depthImage:a}=t.attributes;if(!a)return;const o=(await(import("./services/DepthImageService.js"))).default;y(e),this.depthImage=new o({url:a});try{await this.depthImage.load(e)}catch(s){v(s)||(u.getLogger(this).error("error occurred while loading depth image",s),this.depthImage?.destroy(),this.depthImage=null)}},this._loadImage=async e=>{const{currentBestFeature:t,layer:i,mode:r}=this;if(this.clearGraphics(),i&&t&&"none"!==r&&"video"!==r&&"panoramic-video"!==r)try{await this.loadImageFromFeature(i,t,e),y(e),await this.transformAndPlotSelectedLocation(e)}catch(a){v(a)||this.loadImageError(a)}},this._loadVideo=async e=>{const{currentBestFeature:t,mode:i,selectedPoint:r}=this,a=t?.attributes.imagePath;if(!t||"panoramic-video"!==i||!a)return;const{attributes:o}=t,{cameraPitch:s,cameraOrientation:n,location:l}=o,d=l.spatialReference.isWGS84&&4!==n?.type?B(l):new L(l);try{this._panoramicVideoViewer.viewModel.video&&(this._panoramicVideoViewer.viewModel.video.pause(),this._panoramicVideoViewer.viewModel.videoPaused=!0),this._panoramicVideoViewer.videoSource=a;let t=0;d&&r&&(t=await te(d,r)-t),this._panoramicVideoViewer.pitch=s??0,this._panoramicVideoViewer.yaw=t,await this._panoramicVideoViewer.loadVideo(e),y(e)}catch(c){v(c)||this.loadImageError(c)}},this._loadImageFromFeature=async(e,t,i)=>{const{mode:r}=this;if("default"!==r&&"panoramic"!==r)return;let a;try{a=await pt(t.attributes,e,i),y(i)}catch(f){if(v(f))return;return Re(f)?(u.getLogger(this).error(f),void this.setMessage("noAttachment","error",`${e.objectIdField}: ${t.attributes.objectId}`)):(u.getLogger(this).error(f,{[e.objectIdField]:t.attributes.objectId,layer:e}),void this.setMessage("imageLoadError","error",`query-attachments-failed:${e.objectIdField} ${t.attributes.objectId}`))}if(!a)return;const{mediaUrl:o,datasetFormat:s,rotation:n,searchParams:l,location:d,cameraHeading:c,matrix:h,cameraPitch:p,getDataSetFormatError:m}=a,g=`${t.attributes.objectId}`;try{let a=this._mediaPrefetcher?.getCachedMedia(g);if(!a){const i=this.navigationNodes.find(e=>e.id===t.attributes.objectId);if(i){try{await(this._mediaPrefetcher?.startPrefetchForNode(i,e))}catch(w){}a=this._mediaPrefetcher?.getCachedMedia(g)}}if(a){if("panoramic"===r){const e=this.triangularMeasurementActive?this._panoramicMeasurementViewer:this._panoramicViewer;let r=0;return d&&this.selectedPoint&&(r=await te(d,this.selectedPoint)-r),await e.loadMedia(a,i),this.selectedPoint?e.set({yaw:r,pitch:p}):"viewAngle"in t.attributes&&Number.isFinite(t.attributes.viewAngle)&&e.set({yaw:t.attributes.viewAngle,pitch:p}),void(this.triangularMeasurementActive?await this.initializeReferenceTransformationService(i):await this.initializeTransformationService(i))}return await this._setImageSource(this.triangularMeasurementActive?this.imageMeasurementViewer:this._imageViewer,a,i),void(this.triangularMeasurementActive?await this.initializeReferenceTransformationService(i):await this.initializeTransformationService(i))}}catch(w){}m&&u.getLogger(this).warn("error occurred while getting dataset format",m),"panoramic"===r?await this.loadPanoramicMediaSource({lookAt:{yaw:this.selectedPoint?await te(d,this.selectedPoint):"viewAngle"in t.attributes&&Number.isFinite(t.attributes.viewAngle)?t.attributes.viewAngle:0,pitch:p},extension:s?.toUpperCase(),url:o,cameraHeading:c,matrix:h},i):await this.loadMediaSource({datasetFormat:s?.toUpperCase(),url:o,customParameters:l,rotation:n},i),this.triangularMeasurementActive?await this.initializeReferenceTransformationService(i):await this.initializeTransformationService(i)},this._loadMeasurementViewerImage=async e=>{const{currentBestFeatureMeasurementImage:t,layer:i,mode:r}=this;if(this.imageMeasurementViewer.clearGraphics(),this._panoramicMeasurementViewer.clearGraphics(),i&&t&&"none"!==r&&"video"!==r&&"panoramic-video"!==r)try{await this.loadImageFromFeature(i,t,e),y(e)}catch(a){v(a)||this.loadImageError(a)}},this._loadMediaPrefetcher=async e=>{if(!this._mediaPrefetcher){const{default:t}=await(import("./support/MediaPrefetcher.js"));y(e),this._mediaPrefetcher=new t({maxEntries:this.preloadMediaSize*fe.length})}return this._mediaPrefetcher},this._loadViewAdapter=async e=>{const{view:t}=this;if(this._adapter?.disableDefaultSuperimposeNavigation?.(),this._adapter?.disablePanoramicSuperimposeNavigation?.(),t)switch(t.type){case"2d":{const{default:t}=await(import("./adapters/view/MapViewAdapter.js"));y(e),this._adapter=new t(this);break}case"3d":{const{default:t}=await(import("./adapters/view/SceneViewAdapter.js"));y(e),this._adapter=new t(this);break}}else this._adapter=null},this._mapImageConversionToolViewClickHandler=e=>{if(e.stopPropagation(),e.preventDefault(),e.mapPoint){const t=e.mapPoint;t.x=R(t.x,t.spatialReference),this.plotMapPoint(e.mapPoint)}},this._measurementImageClickHandler=e=>{e.stopPropagation(),e.preventDefault();const{sketchTriangular:t,triangularMeasurementActive:i,currentBestFeatureMeasurementImage:r,triangulatedMeasurementGraphic:a}=this;t&&i&&r&&a&&"active"!==t.state&&(t.update([a],{tool:"reshape"}),this.updatingTriangularMeasurementState=!0)},this._updateInteraction=()=>{const e=this.videoMapView.extent;if(!e)return;const{minScale:t}=this.videoMapView.constraints,i=this.videoMapView.scale<t-we,r=Qe(e);i&&!!r?(this._enablePan(),this.videoMapView.constraints.geometry=r):i?(this._disablePan(),this.videoMapView.constraints.geometry=null):(this.initialVideoMapViewExtent&&!this.videoMapView.extent.equals(this.initialVideoMapViewExtent)&&(this.videoMapView.extent=this.initialVideoMapViewExtent),this._disablePan(),this.videoMapView.constraints.geometry=null)},this._viewClickHandler=e=>{this._clickTask?.abort(),this._clickTask=a(async t=>{const{pointerType:i,button:r,mapPoint:a}=e;if("mouse"===i&&0!==r||!a)return;e.stopPropagation(),e.preventDefault();const{view:o,layer:s}=this;if(o){if(s){if(this.shouldShowSelectedImage){const i=o.hitTest(e,{include:[s]});this._updatingHandles.addPromise(i);const r=await i;return y(t),await this._processHitTestResults(s,r,{signal:t})}return this._updatingHandles.addPromise(this.loadBestImage(a,{signal:t}))}this.setMessage("noLayerSelected","info")}})},this.plotSelectedPointOnImage=async(e,i)=>{if(await f(i),!e)return;const r=new L({...k(e)?e.toJSON():e});if("default"===this.mode)r.x-=.5,r.y=.5-r.y,r.spatialReference=this._imageViewer.imageRenderer.spatialReference.clone(),this._crossSymbol=new t({geometry:r,symbol:Ie}),this._imageViewer.addGraphic(this._crossSymbol,0);else if("video"===this.mode)this._crossSymbol=this.videoViewModel?.plotSelectedPointOnVideo(r)??null;else if("panoramic"===this.mode){const{imageSize:i,media:r}=this._panoramicViewer;if(!i||!r)return;const a=Be(r),o=ie(e,...i,a);this._crossSymbol=new t({geometry:new L(o,E.WebMercator),symbol:Pe}),this._panoramicViewer.addGraphic(this._crossSymbol,0)}},this.handleSectorClick=this.handleSectorClick.bind(this),this.searchBestImage=this.searchBestImage.bind(this),this.transformAndPlotReferencePointOnImage=this.transformAndPlotReferencePointOnImage.bind(this)}initialize(){this.addHandles([b(()=>this.view,()=>this.load(),M),b(()=>this.view?.map,(e,t)=>{t?.layers.remove(this._overlays),e?.layers.add(this._overlays)},V),b(()=>this.view?.map?.allLayers?.length,e=>{e&&this.view?.map?.layers.reorder(this._overlays,e-1)},V),b(()=>[this.state,this.panoramicVideoLoaded,this.mapImageConversionToolState,this.view,this.disabled,this.panoramicVideoPaused,this.videoViewModel?.videoPaused],(e,t)=>{const i=e[2],r=t?.[2];r&&!i&&(this.plotReferencePointOnGround(null),this.clearReferencePointOnImage()),this._createViewClickHandle(),this._createImageClickHandle()},M),b(()=>[this.triangularMeasurementActive,this.currentBestFeatureMeasurementImage],()=>{this._createTriangularImageClickHandle()},M),b(()=>[this.state,this.imageLocationToolState,this.view],()=>{this._initializeMeasurementService(),this._initializeLocationViewModel()},M),b(()=>this.measureType,()=>{this.clearPreviousMeasurements(),this._initializeMeasurementService()},M),b(()=>this.bestFeatureAngle,(e,t)=>{this.previousFeatureAngle=t??0},M),b(()=>[this.superimposeViewEnabled,this.defaultSuperimposeCameraLockEnabled,this.superimposeViewSupported,this.currentBestFeature,this.mode,this.state,this.view?.type],()=>{this._shouldDisableUnsupportedSuperimposeView()?this.superimposeViewEnabled=!1:this._hasActiveSuperimposeCameraContext()?this._updateSuperimposedImage():this._resetInactiveSuperimposeState()},M),b(()=>this._getSuperimposeCameraWatchState(),()=>this._handleSuperimposeCameraChange(),M),b(()=>this.currentBestFeature,async(e,t)=>{m(this._featureChangedTask),this._featureChangedTask=a(async i=>this.determineWorkflowForFeature.apply(this,[e,t,{signal:i}])),await this._featureChangedTask.promise},{sync:!0}),b(()=>[this.currentNode,this.preloadMedia,this.navigationMode],()=>{this._mediaPrefetchTask?.abort(),this._mediaPrefetchTask=a(async e=>{this.preloadMedia&&null!=this.navigationMode?(this._mediaPrefetcher??=await this._loadMediaPrefetcher({signal:e}),y(e),"directional"===this.navigationMode?this._mediaPrefetcher.enqueueDirectionalPrefetch(this.layer,this.currentNode,this.preloadMediaSize):this._mediaPrefetcher.enqueueSequentialPrefetch(this.layer,this.currentNode,this.preloadMediaSize)):this._mediaPrefetcher?.clear()})},M),b(()=>this.currentBestFeatureMeasurementImage,(e,t)=>{m(this._featureChangedTask),t&&e!==t&&(this.triangulatedPoint=null,this.sketchTriangularGraphicsLayer?.graphics.destroyAll(),this._measurementService?.resetMeasurementVectors()),this._featureChangedTask=a(async i=>{await this.determineWorkflowForTriangularMeasurement(e,t,{signal:i}),y(i),this._reorderTriangularSketchLayer()})},M),b(()=>this.triangularMeasurementActive,(e,t)=>{t&&!e&&(this._measurementService?.resetMeasurementVectors(),this.currentBestFeatureMeasurementImage=null,this.triangulatedDistanceMeasurement=null,this.triangulatedMeasurementGraphic=null,this.triangulatedPoint=null,this.updatingTriangularMeasurementState=!1,this.triangulatedAreaMeasurement=null,this.triangulatedDistanceAccuracy=null,this.triangulatedAreaAccuracy=0,this.sketchTriangularGraphicsLayer?.graphics.destroyAll(),this.clearReferencePointOnImage(),this.imageMeasurementViewer.clearImage(),this.imageMeasurementViewer.clearGraphics(),this._panoramicMeasurementViewer.clearImage(),this._panoramicMeasurementViewer.clearGraphics())}),b(()=>this.mode,e=>{switch(this.removeHandles(xe.interactionHandles),e){case"default":this.addHandles(b(()=>{const{state:e}=this;return"image-loaded"===e?this._imageViewer.imagePointsInView:null},e=>{e&&(m(this._updateFootprintTask),this._updateFootprintTask=a(async t=>{await this.updateFootprint(e,void 0,{signal:t})}))},{...M,equals:(e,t)=>i(e,t,c)}),xe.interactionHandles);break;case"video":this.addHandles(b(()=>{const{footprintExtent:e,videoElement:t,bestFeatureFootprint:i}=this;if(e&&t?.loaded&&i)return{videoExtent:_e,bestFeatureFootprint:i}},e=>{e?.videoExtent&&e?.bestFeatureFootprint&&(m(this._updateFootprintTask),this._updateFootprintTask=a(async t=>{const i={points:e.videoExtent,feature:void 0,scale:void 0,options:{signal:t}};await this.updateVideoFootprint(i)}))},{...M,equals:(e,t)=>i(e?.videoExtent,t?.videoExtent,c)&&e?.bestFeatureFootprint===t?.bestFeatureFootprint}),xe.interactionHandles);break;case"panoramic":this.addHandles(b(()=>{const{currentBestFeature:e,state:t,_panoramicViewer:i}=this,{imageSize:r,vfov:a,hfov:o,pitch:s,yaw:n}=i;return e&&r&&!t.includes("loading")&&null!=a&&null!=o&&null!=s&&null!=n?[a,o,n,s]:null},e=>{if(!e||this.state.includes("loading"))return;const[t,i,r,o]=e;this.currentNode&&(this.currentNode.currentHeading=r,this.currentNode.currentPitch=o),m(this._updateFootprintTask),this._updateFootprintTask=a(async e=>{await this.updateFootprintPanorama({verticalFieldOfView:t,horizontalFieldOfView:i,yaw:r,pitch:o},{signal:e}),this._updateFootprintTask=null})},{equals:(e,t)=>i(e,t,c)}),xe.interactionHandles);break;case"panoramic-video":this.addHandles(b(()=>{const{currentBestFeature:e,state:t,_panoramicVideoViewer:i}=this,{imageSize:r,vfov:a,hfov:o,pitch:s,yaw:n,viewModel:l}=i,d=l.closestFeature??e;return d&&r&&!t.includes("loading")&&null!=a&&null!=o&&null!=s&&null!=n?[a,o,n,s,d]:null},e=>{if(!e)return;const[t,i,r,o,s]=e;m(this._updateFootprintTask),this._updateFootprintTask=a(async e=>{await this.updateFootprintPanorama({verticalFieldOfView:t,horizontalFieldOfView:i,yaw:r,pitch:o,feature:s,horizonAngles:this._panoramicVideoViewer.horizonAngles},{signal:e}),y(e),this._updateFootprintTask=null})},{equals:(e,t)=>i(e,t,c)}),xe.interactionHandles)}},M),b(()=>[this.brightness,this.contrast,this.sharpness],()=>{const{_imageViewer:e,brightness:t,contrast:i,mode:r,sharpness:a}=this;"default"===r&&(e.brightness=t,e.contrast=i,e.sharpness=a)},M),b(()=>this.activeViewer?.imageRenderer,()=>{this.sketch&&(this.sketch.view=this.activeViewer?.imageRenderer)}),b(()=>this.activeViewer,e=>{this.removeHandles(xe.hittestHandles),e&&this.addHandles(F(()=>e,"hittest-response",this._handleImageHitTestResponse),xe.hittestHandles)}),b(()=>this.videoMapView.extent,async()=>{this._scheduleVideoInteractionUpdate();const e=this.videoViewModel?.closestFeature;e&&(m(this._updateFootprintTask),this._updateFootprintTask=a(async t=>{const i={points:this.videoExtentPoints,feature:e,options:{signal:t}};await this.updateVideoFootprint(i)}))}),b(()=>[this.videoMapView.interacting,this.videoMapView.navigating,this.videoMapView.scale],()=>{this._scheduleVideoInteractionUpdate()},{initial:!0}),S(()=>null!=this.videoMapView.extent,()=>{this.initialVideoMapViewExtent=this.videoMapView.extent},{once:!0})]),this.when().finally(()=>{this.notifyChange("state")})}destroy(){this._adapter?.disableDefaultSuperimposeNavigation?.(),this._adapter?.disablePanoramicSuperimposeNavigation?.(),this._abortSuperimposeSchedule(),this.currentBestFeature=null,this._updateFootprintTask=m(this._updateFootprintTask),this._clickTask=m(this._clickTask),this._restoreSuperimposeMediaTask=m(this._restoreSuperimposeMediaTask),this.coverageFrustums.destroy(),this.coveragePolygons.destroy(),this.pointSources.destroy(),this.additionalFootprints.destroy(),this.additionalCameraLocations.destroy(),this.bestFeatureFootprint=p(this.bestFeatureFootprint),this.bestFeatureCurrentFootprint=p(this.bestFeatureCurrentFootprint),this.videoViewModel=p(this.videoViewModel),this._locationViewModel=p(this._locationViewModel),this.clearSelectedPointOnViewer(),this._referencePointOnGround=p(this._referencePointOnGround),this.clearReferencePointOnImage(),this._superimposeService.destroy(),this._overlays&&this.view?.map?.remove(this._overlays),this._overlays.destroy(),this._imageViewer.destroy(),this.imageMeasurementViewer.destroy(),this._panoramicViewer.destroy(),this._panoramicMeasurementViewer.destroy(),this._mediaPrefetcher?.destroy()}get activeLayer(){return s(u.getLogger(this),"activeLayer",{replacement:"layer"}),this.layer}set activeLayer(e){s(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 activeTriangulatedViewer(){switch(this.mode){case"default":return this.imageMeasurementViewer;case"panoramic":return this._panoramicMeasurementViewer;default:return null}}get accuracyParametersMissing(){return this.layer?.orientationAccuracy?.every(e=>0===e)??!0}get brightness(){return this._get("brightness")??0}set brightness(e){this._set("brightness",h(e,-10,10))}get contrast(){return this._get("contrast")??0}set contrast(e){this._set("contrast",h(e,-10,10))}get currentNode(){const{currentBestFeature:e,navigationNodes:t}=this;return t.find(t=>t.id===e?.attributes.objectId)}get depthImageNotSupported(){if(this.currentBestFeature?.attributes.depthImage)return!De(this.currentBestFeature.attributes.depthImage)}get featureCount(){return this.features?.length??0}get imageGalleryEnabled(){const{currentBestFeature:e}=this;if(!e)return!1;const t=e.attributes.imagePath?.trim();return De(t)||Se(t)}get imageLoaded(){return s(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===Fe}get imagePointsInView(){const{mode:e,_imageViewer:t}=this;return"default"===e?t.imagePointsInView:null}get layerView(){const{layer:e,view:t}=this;if(e&&t)return t.allLayerViews.find(He(e))}get layerFloorFilterClause(){const{layerView:e}=this;return e?ne(e):null}get layerTimeExtent(){return this.layerView?.timeExtent??null}get mode(){const e=this.currentBestFeature?.attributes;if(!e)return"none";const t=e.orientedImageryType;if(t?.includes("video"))return t.includes("360")?"panoramic-video":"video";const{horizontalFieldOfView:i,isSpherical:r}=e;return 360===i||r?"panoramic":"default"}get panoramicVideoLoaded(){const{mode:e,_panoramicVideoViewer:t}=this,{videoLoaded:i}=t.viewModel;return("panoramic-video"===e&&!0===i)??!1}get overlayGraphicsEnabled(){const{mode:e,state:t,panoramicVideoLoaded:i,videoViewModel:r,panoramicVideoPaused:a}=this;return"image-loaded"===t||"video"===e&&"video-loaded"===t&&!0===r?.videoPaused||"panoramic-video"===e&&i&&a}get panoramicVideoPaused(){return!!this._panoramicVideoViewer.viewModel.videoPaused}get popupEnabled(){return!0===this.layer?.popupEnabled}get referencePoint(){return this._referencePointOnGround?.geometry}get sectorData(){const{_sectorData:e}=this;return e?be.map(t=>e[t]):null}get sharpness(){return this._get("sharpness")??0}set sharpness(e){this._set("sharpness",h(e,0,1))}get superimposeViewSupported(){return"default"===this.mode||"panoramic"===this.mode}get sketchGraphicsLayer(){const{sketch:e}=this;return"graphics"===e?.layer?.type?e.layer:void 0}get state(){const{mode:e,_updatingHandles:{updating:t},_featureChangedTask:i,_navigationManager:r}=this;if(!this.isFulfilled()||t||!1===i?.finished||r?.navigating)return"loading";if(this.isRejected())return"error";if("error"===this.displayMessage?.type)return"image-load-error";switch(e){case"default":return this._imageViewer.state;case"panoramic":return this._panoramicViewer.state;case"video":return this.videoElement?.loaded?"video-loaded":"video-not-loaded"}return"ready"}get thumbnails(){const{features:e}=this;return e?new o(e.map(({attributes:{imagePath:e,objectId:t,cameraRoll:i,imageRotation:r}})=>{const a=e?.trim();return De(a)||Se(a)?{url:a,objectId:t,rotation:(i??0)+(r??0)}:null}).filter(r)):null}get videoExtentPoints(){const e=Xe(this.videoMapView.extent);return e.length?e:_e}set view(e){this._set("view",e)}get _defaultGraphicsLayer(){const e={blendMode:"source-atop"};switch(this.mode){case"panoramic":return new D({...e,elevationInfo:{mode:"absolute-height"}});case"default":return new D({...e});default:return}}get _overlaysView(){return this.view?.layerViews.find(({layer:e})=>e===this._overlays)}updatePanoramicSuperimposeRadiusOffset(e){this._superimposeService.updatePanoramicRadiusOffset(e)}setDefaultSuperimposeZOffsetPercentage(e){this._superimposeService.setDefaultZOffsetPercentage(e)}setPanoramicSuperimposeRadiusPercentage(e){this._superimposeService.setPanoramicRadiusPercentage(e)}updateDefaultSuperimposeCameraLock(e){this.defaultSuperimposeCameraLockEnabled=e,this.superimposeViewEnabled&&"default"===this.mode&&(e?this._adapter?.enableDefaultSuperimposeNavigation?.():this._adapter?.disableDefaultSuperimposeNavigation?.())}beforeLoad(e=!0){this.emit("popup-close"),e&&(this.displayMessage=null),this._abortSuperimposeSchedule(),this._adapter?.disableDefaultSuperimposeNavigation?.(),this._adapter?.disablePanoramicSuperimposeNavigation?.(),this.clearPreviousGroundLocation(),this.triangularMeasurementActive=!1,this.currentBestFeatureMeasurementImage=null,this.measureType=null,this.imageLocationToolState=!1,this.features.removeAll(),this.currentBestFeature=null,this.additionalFeatures.removeAll(),this.additionalFootprints.removeAll(),this.additionalCameraLocations.removeAll(),this.bestFeatureCurrentFootprint=p(this.bestFeatureCurrentFootprint),this._restoreSuperimposeMediaTask=m(this._restoreSuperimposeMediaTask),this._superimposeService.clear(),this._overlays?.removeAll()}async calculateLocationAccuracy(e){return this._measurementService?.calculateLocationAccuracy(e)}clearLocationPointOnImage(e=!1){this.locationPointOnImage&&!e&&(this._imageViewer.removeGraphic(this.locationPointOnImage),this._panoramicViewer.removeGraphic(this.locationPointOnImage),this.locationPointOnImage=p(this.locationPointOnImage)),this.correctedLocationPointOnImage&&(this.imageMeasurementViewer.removeGraphic(this.correctedLocationPointOnImage),this._panoramicMeasurementViewer.removeGraphic(this.correctedLocationPointOnImage),this.correctedLocationPointOnImage=p(this.correctedLocationPointOnImage))}clearPreviousMeasurements(){this.clearMeasurementGraphics(),this.resetMeasurementData(),this.stopMeasurement()}clearPreviousGroundLocation(){this.groundCoordinates=null,this.groundCoordinatesAccuracy=null,this.groundCoordinatesAccuracyLoading=!1,this.pixelCoordinates=null,this.clearLocationPointOnImage()}clearMeasurementGraphics(){this.measurementGraphic&&(this.activeViewer?.removeGraphic(this.measurementGraphic),this.measurementGraphic=null),this.heightGraphic&&(this.activeViewer?.removeGraphic(this.heightGraphic),this.heightGraphic=null),this.triangularMeasurementActive&&this.sketchTriangularGraphicsLayer?.graphics.destroyAll()}digitizeCancel(){return this.sketch?.cancel()}digitizeCanRedo(){return this.sketch?.canRedo()??!1}digitizeCanUndo(){return this.sketch?.canUndo()??!1}digitizeComplete(){return this.sketch?.complete()}async digitizeCreate(e,t){const{sketch:i,dataCaptureLayer:r}=this;if(!i)throw gt();lt(r,e,i),await i.create(e,{...t,defaultZ:0})}digitizeDelete(){if(!this.sketch)throw gt();return this.sketch.delete()}digitizeDuplicate(){if(!this.sketch)throw gt();return this.sketch.duplicate()}digitizePlace(e,t){if(!this.sketch)throw gt();return this.sketch.place(e,t)}digitizeRedo(){if(!this.sketch)throw gt();return this.sketch.redo()}digitizeUndo(){if(!this.sketch)throw gt();return this.sketch.undo()}digitizeUpdate(e,t){if(!this.sketch)throw gt();return this.sketch.update(e,t)}filterByFootprints(e,t,i=!1){const r=[],a=[],o=[];return e.forEach(e=>{const{layer:{coveragePercent:s},attributes:n}=e;let l;const{polygon:d,frustum:c}=q(n);if(l=d.clone(),n.isInspection&&(l=W(n)),s&&(l=$(l,s)),i||!t||Z(l,t)){o.push(e);const{geometry:t,objectId:i,cameraHeight:s,cameraHeading:l}=n,u=t.clone();u.z=s/K(t.spatialReference),u.imageID=i,this.pointSources.push(u),l!==Fe&&(r.push(d),c&&a.push(c))}}),{features:o,polygons:r,frustums:a}}async deleteDataCaptureFeatures(e){const{dataCaptureLayer:t}=this;if(!t)throw new n("orientedimageryviewer:missing-featurelayer","Data capture layer is not available");return t.queryFeatures({objectIds:e,outFields:[t.objectIdField]}).then(({features:e})=>t.applyEdits({deleteFeatures:e}))}handleSectorClick(e){if(isNaN(e))return;const t=this._sectorData?.[be[e]],i=t?.at(0);i&&(this.triangularMeasurementActive&&this.currentBestFeature?this._updateImageMeasurementBestFeature(i):this._updateCurrentBestFeature(i))}handleFeatureClick(e){const{sector:t,featureIndexInSector:i}=e;if(isNaN(i))return;const r=this._sectorData?.[t],a=r?.at(i);a&&(this.triangularMeasurementActive&&this.currentBestFeature?this._updateImageMeasurementBestFeature(a):this._updateCurrentBestFeature(a))}load(e){return this.addResolvingPromise(this._loadViewAdapter(e).catch(e=>{if(!v(e))throw e})),this}async loadBestImage(e,t){return this.selectedPoint=Q(e),this.beforeLoad(),this._fetchFeaturesWithController(e,t)}async loadHeightMeasurementAdapter(e){if(!this.drawAdapter){const t=import("./adapters/draw/HeightMeasurementAdapter.js"),{default:i}=await t;if(y(e),this.drawAdapter=new i({viewModel:this,measurementService:this._measurementService}),!this.drawAdapter.viewModel.isResolved())return}return this.drawAdapter}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"),{default:i}=await t;y(e),this.sketch=new i({layer:this._defaultGraphicsLayer,view:this.activeViewer?.imageRenderer,updateOnGraphicClick:!1,defaultUpdateOptions:{reshapeOptions:{edgeOperation:"none",shapeOperation:"none",vertexOperation:void 0},enableMoveAllGraphics:!1,enableRotation:!1,enableScaling:!1,multipleSelectionEnabled:!1,toggleToolOnClick:!1,tool:"transform"}})}return this.sketch}async loadMeasurementAdapter(e){if(!this.sketchAdapter){const t=import("./adapters/sketch/MeasurementAdapter.js"),{default:i}=await t;if(y(e),this.sketchAdapter=new i({viewModel:this,measurementService:this._measurementService}),!this.sketchAdapter.viewModel.isResolved())return}return this.sketchAdapter}async processFeatureResponse(e,t,i){const{features:r}=e;if(this._clearFeatureGeometries(),!this._checkFeatures(r))return;const{features:a,polygons:o,frustums:s}=this.filterByFootprints(r,t,i?.skipFilter);if(!this._checkFeatures(a))return;this.coveragePolygons.addMany(o),this.coverageFrustums.addMany(s);const n=await this.processElevationSample(o,a,i);y(i),await this._updateElevationOfSelectedPointAndLocations(a,t,n),y(i),ze(a,n);let l=a;if(this.layer?.verticalSearchRange&&this.layer.hasZ&&this.verticalFilterEnabled&&(l=Ne(a,t,this.layer.verticalSearchRange),!l.length))return void this.setMessage("noImageAtElevation","info");const d=this._processSuitableFeatures(l,t);this.updateSuitabilities(d,i?.loadBestImage)}async processFeatureElevation(e,t,i){if(!t)return;const{features:r,polygons:a}=this.filterByFootprints(e,t,!0);if(!r?.length)return;const o=await this.processElevationSample(a,r,i);return y(i),o}async startMeasurement(e,t){this.sketch||await this.loadSketch(t),await this.loadMeasurementAdapter(t);const{sketch:i,sketchAdapter:r,activeViewer:a,mode:o}=this;if(!i||!r||!a||"none"===o)return;if(this.displayNewMeasurementButton=!1,"panoramic"===o&&(i.defaultCreateOptions.defaultZ=0),await i.create(e),"panoramic"===o){const{drawOperation:e}=i.view.activeTool;e.constraintsEnabled=!1,e._set("elevationDrawSurface",null)}const s=this.activeViewer?.imageRenderer.effectiveTheme.accentColor;s&&this.sketch&&(this.sketch.polygonSymbol=Ce(s),this.sketch.polylineSymbol="panoramic"===o?Ae:ke(s,2.5))}async startHeightMeasurement(){this.displayNewMeasurementButton=!1,this.draw??=new ce({view:this.activeViewer?.imageRenderer}),this.polylineDrawAction=this.draw.create("polyline"),await this.loadHeightMeasurementAdapter()}initializeMeasurement(e){switch(this.clearMeasurementGraphics(),this.resetMeasurementData(),e){case"distance":this.startMeasurement("polyline");break;case"area":this.startMeasurement("polygon");break;case"height":this.startHeightMeasurement()}}async overlayCameraLocations(e){const{activeViewer:i,overlayedCameraLocations:a,layer:o,mode:s,layerFloorFilterClause:n,layerTimeExtent:l,videoViewModel:d,_panoramicVideoViewer:c}=this,u="video"===s,h="panoramic-video"===s,p=this._getActiveFeatureForCurrentMode(),m=this._computeOverlayImageSize();if(!(m&&p&&o&&"none"!==s&&this.overlayGraphicsEnabled))return;const{polygon:g}=q(p.attributes);if(u?d?.removeOverlayGraphics(a.toArray()):h?c.removeManyGraphics(a.toArray()):i?.removeManyGraphics(a.toArray()),a.removeAll(),e){const{features:e}=await o.queryFeatures({where:I(`${o.objectIdField} <> ${p.attributes.objectId}`,I(o.definitionExpression,n)),geometry:g,returnGeometry:!0,outFields:[o.objectIdField],timeExtent:l}),v=await Promise.all(e.map(async e=>{const{attributes:i,geometry:r}=e;if("point"!==r?.type)return null;const a=await this._geometryToOverlayImageGeometry(r,p,m);if(!a)return null;const o="panoramic"===s||"panoramic-video"===s?Oe():Te();return new t({attributes:i,symbol:o,geometry:a})}));a.addMany(v.filter(r)),u?d?.addOverlayGraphics(a.toArray()):h?c.addManyGraphics(a.toArray()):i?.addManyGraphics(a.toArray())}}overlayGraphicsOnImage(e,t){this.removeOverlayedGraphicsOnImage(e),this.overlayedMapFeatures.set(e,t),"video"!==this.mode?"panoramic-video"!==this.mode?this.activeViewer?.addManyGraphics(t.toArray()):this._panoramicVideoViewer.addManyGraphics(t.toArray()):this.videoViewModel?.addOverlayGraphics(t.toArray())}async overlayMapFeatures(e,i=!1){const{activeViewer:a,mode:s,layer:n,videoViewModel:l,_panoramicVideoViewer:d}=this,c="video"===s,h="panoramic-video"===s,p=this._getActiveFeatureForCurrentMode(),m=this._computeOverlayImageSize();if(!(m&&p&&"none"!==s&&this.overlayGraphicsEnabled&&n))return;const{polygon:g}=q(p.attributes);try{const{imageGeometryField:t,oiObjectIdField:i}=dt(e,n.imageGeometryField,n.imageReferenceField);this.imageGeometryField=t.name,this.oiObjectIdField=i.name}catch(w){u.getLogger(this).warn("oriented-imagery-viewer:overlay-map-features",w)}const{features:v}=await e.queryFeatures({geometry:g,returnGeometry:!0,outFields:["*"]}),y=await Promise.all(v.map(async r=>{const o=r.symbol?.clone()??e.renderer?.getSymbol(r)?.clone(),{attributes:n,geometry:g}=r,{imageGeometryField:v,oiObjectIdField:y}=this;if(v&&y&&mt(e,v,y)&&`${n[y]}`==`${p.attributes.objectId}`)try{const r=h?d.horizonAngles:Be(a?.media),u=ct(n,v,e,i,m,c?"default":s,o,r);if(!c)return u;const p=u.geometry;if(!p)return null;const g=l?.imageGeometryToOverlayGeometry(p);return g?new t({attributes:n,layer:e,symbol:u.symbol,geometry:g,visible:u.visible}):null}catch(w){u.getLogger(this).warn("oriented-imagery-viewer:overlay-map-features","couldn't create graphic from attributes, geometry will be used",{error:w,feature:r,layer:e,imageGeometryField:this.imageGeometryField,imageReferenceField:this.oiObjectIdField})}if(!g)return null;const f={feature:p,imageSize:m,footprintExtent:this.footprintExtent},_=await this._geometryToOverlayImageGeometry(g,f.feature,f.imageSize);return _?new t({attributes:n,layer:e,symbol:o,geometry:_,visible:e.visible&&i}):null})),f=new o(y.filter(r));("video"!==s&&"panoramic-video"!==s||this.overlayGraphicsEnabled)&&this.overlayGraphicsOnImage(`${e.id}`,f)}getDepthAt(e){const{activeViewer:t,currentBestFeature:i,mode:r,state:a,depthImage:o}=this,s=t?.imageSize;if(!s||!i||"none"===r||a.includes("loading"))return u.getLogger(this).warnOnce("oriented-imagery-viewer:get-depth-at","Load an image to use depth"),null;if(!o?.loaded)return u.getLogger(this).error("oriented-imagery-viewer:get-depth-at","Depth image is not loaded"),this.emit("depth-image-service:not-loaded"),null;const n=(Array.isArray(e)?e:[e]).map(e=>o.depthAt(e,{width:s[0],height:s[1]})??null);return Array.isArray(e)?n:n[0]}getActiveSectors(){return be.filter(e=>this._sectorData?.[e]?.length)}async getPixelLocationForFeature(e,t,i){return(await this._transformationService.pointToPixelForFeature([e],t,i))[0]}async getPixelLocationsForFeature(e,t,i){return await this._transformationService.pointToPixelForFeature(e,t,i)}async plotMapPoint(e){this.plotReferencePoint(e);const t=this._getActiveFeatureForCurrentMode();if(t)return this.transformAndPlotReferencePointOnImage({feature:t,selectedLocation:e,options:{signal:this._transformController?.signal}})}plotReferencePointOnGround(e){this._referencePointOnGround&&(this._overlays?.remove(this._referencePointOnGround),this._referencePointOnGround.destroy()),null!=e&&(this._referencePointOnGround=new t({geometry:new L({...e.toJSON()}),symbol:Le}),this.view?this._overlays?.add(this._referencePointOnGround):this.emit("plot-ground-point",{data:{point:this._referencePointOnGround?.geometry}}))}plotReferencePointOnImage(e){switch(this.mode){case"video":return void this._plotReferencePointOnVideo(e);case"panoramic-video":return void this._plotReferencePointOnPanoramicVideo(e);case"default":return void this._plotReferencePointOnDefaultImage(e);case"panoramic":return void this._plotReferencePointOnPanoramicImage(e)}}removeAllOverlayMapFeatures(){const{mode:e}=this;this.overlayedMapFeatures.forEach(t=>{const i=t.toArray();switch(e){case"video":this.videoViewModel?.removeOverlayGraphics(i);break;case"panoramic-video":this._panoramicVideoViewer.removeManyGraphics(i);break;default:this.activeViewer?.removeManyGraphics(i)}}),this.overlayedMapFeatures.clear()}removeOverlayedGraphicsOnImage(e){const t=this.overlayedMapFeatures.get(e),{mode:i}=this;if(!t?.length)return;const r=t.toArray();switch(i){case"video":this.videoViewModel?.removeOverlayGraphics(r);break;case"panoramic-video":this._panoramicVideoViewer.removeManyGraphics(r);break;default:this.activeViewer?.removeManyGraphics(r)}this.overlayedMapFeatures.delete(e)}reset(){const{mode:e}=this;"default"===e||"panoramic"===e?this.resetImage():"video"===e?this.resetVideo():"panoramic-video"===e&&this.resetVideoPanoramic(),this.beforeLoad(!1)}resetImage(){switch(this.setMessage("onLoadMessage","info"),this.mode){case"default":this._imageViewer.clearImage(),this._imageViewer.clearGraphics();break;case"panoramic":this._panoramicViewer.clearGraphics()}this._clickTask=m(this._clickTask)}resetVideo(){this.setMessage("onLoadMessage","info"),this.videoViewModel?.resetVideoHandler(),this._overlays?.removeAll(),this.videoViewModel=null,this.featureCache=[],this.currentBestFeature=null}resetVideoPanoramic(){this.setMessage("onLoadMessage","info"),this._overlays?.removeAll(),this.currentBestFeature=null}resetMeasurementData(){this.areaMeasurementResult=0,this.areaMeasurementAccuracy=0,this.distanceMeasurementResult=0,this.distanceAccuracyArray=[],this.heightMeasurementResult=0,this.heightMeasurementAccuracy=0,this.heightGraphic=null,this.triangulatedDistanceMeasurement=null,this.triangulatedDistanceAccuracy=null,this.triangulatedAreaMeasurement=null,this.triangulatedMeasurementGraphic=null,this.updatingTriangularMeasurementState=!1,this.triangulatedAreaAccuracy=0,this._measurementService?.resetMeasurementVectors()}async saveDrawing(){const{dataCaptureLayer:e,sketchAdapter:t}=this;if(!e||"data-capture"!==t?.type)return;const{pendingGraphics:i,savedGraphics:r}=t,a=i.get(e.id),o=a?.toArray();if(!a||!o?.length)return;const{addFeatureResults:s}=await this.saveDataCaptureFeatures(o),n=s.reduce((t,{objectId:i,globalId:r,error:a},s)=>{const n=o[s],{attributes:l}=n;return a?t.error.push(n):(i&&(l[e.objectIdField]=i),r&&e.globalIdField&&(l[e.globalIdField]=r),t.success.push(n)),t},{success:[],error:[]});r.addMany(n.success),a.removeAll(),a.addMany(n.error)}async saveDataCaptureFeatures(e,t){const{activeViewer:i,currentBestFeature:a,dataCaptureLayer:o,mode:s}=this,l=i?.imageSize;if(!l||!a||"none"===s||"video"===s||"panoramic-video"===s)throw new n("orientedimageryviewer:missing-input","Image size, current best feature and mode are required to save data capture features");if(!o)throw new n("orientedimageryviewer:missing-featurelayer","Data capture layer is not available");const d=await Promise.all(e.map(async e=>{const i=e.clone(),{geometry:r}=i;if(!r)return;const a=r.type,s=o.hasZ,n=o.geometryType,l=a!==n,d=l?await(import("./transformers.js")):null,c=d?.default[n],u=l?c?.(r):r;return u&&(i.geometry=await this._transformationService.imageGeometryToMapGeometry(u,t),i.geometry)?(s||ut(i.geometry),i):void 0})),c=d.filter(r);return o.applyEdits({addFeatures:c}).then(e=>{const{addFeatureResults:t}=e;let i=0;const r=d.map(e=>{const r=t[i++];return e?r:{error:new n("orientedimageryviewer:save-unsucccessful","Error in saving data capture features"),objectId:null,globalId:null}});return{...e,addFeatureResults:r}})}async searchBestImage(e,t){try{const i=await z(e,t);i&&await this.processFeatureResponse(i,e.point,t)}catch(i){v(i)||(this.setMessage("imageLoadError","error",i.message),u.getLogger(this).error("error occurred while finding best image",i))}}selectTriangularMeasurementFeature(e){this.currentBestFeatureMeasurementImage=this.features?.find(({attributes:t})=>t.objectId===Number(e))}setAdditionalCameraLocationsVisibility(e){this.additionalCameraLocations.forEach(t=>{t.visible=e})}setAdditionalCoverageVisibility(e){this.additionalFootprints.forEach(t=>{t.visible=e})}setCurrentCoverageVisibility(e){this.bestFeatureCurrentFootprint&&(this.bestFeatureCurrentFootprint.visible=e),this.currentBestFeatureLocation&&(this.currentBestFeatureLocation.visible=e)}setMapImageConversionToolState(e){this.mapImageConversionToolState=e}setCurrentPanoramaView(e,t){this._panoramicViewer?.set({yaw:e,pitch:t})}async startDataCapture(e,t){const i=this.activeViewer?.imageRenderer,{oiObjectIdField:r,currentBestFeature:a}=this;if(!i||!a||!r)return;const{attributes:{objectId:s}}=a,n=this.overlayedMapFeatures.get(e.id)?.toArray()??[],l=[],d=[];for(const o of n)`${o.getAttribute(r)}`==`${s}`?l.push(o):d.push(o);this.overlayGraphicsOnImage(e.id,new o(d)),this.collectionId=e.id;const c=await this.loadSketch(t),u=await this.loadDataCaptureAdapter(t);y(t),c.addGraphics(l),u.savedGraphics.addMany(l);i.ui.find("zoom").visible=!1,i.map.layers.add(this.sketchGraphicsLayer)}async stopDataCapture(e=!1){this.sketch?.cancel(),this.sketchGraphicsLayer?.removeAll(),this.sketchAdapter=p(this.sketchAdapter),this.sketch=p(this.sketch),this.collectionId=null;const{dataCaptureLayer:t}=this,i=this.activeViewer?.imageRenderer;if(!i||i.destroyed)return;i.map.layers.remove(this.sketchGraphicsLayer),e&&t&&await this.overlayMapFeatures(t,!0);const r=i.ui.find("zoom");r&&(r.visible=!0)}stopMeasurement(){this.draw?.reset(),this.sketch?.cancel()}async toggleAllOverlayMapFeatures(e){!e&&this.dataCaptureLayer&&(await this.stopDataCapture(!0),this.dataCaptureLayer=null),this.overlayedMapFeatures.forEach(t=>{this._toggleVisiblity(t,e)})}toggleOverlayMapFeatures(e,t,i){const r=this.overlayedMapFeatures.get(e);r&&i&&this._toggleVisiblity(r,t)}toggleSelection(e){const{sketch:t}=this;t&&(t.updateOnGraphicClick=e,t.cancel())}async transformAndPlotReferencePointOnImage(e){const{feature:t,selectedLocation:i,options:r}=e;let a=!1,o=!1;const s="video"===this.mode?this.bestFeatureCurrentFootprint?.geometry:this.bestFeatureFootprint?.geometry;switch(s?.type){case"polygon":{const e=i.spatialReference.equals(s.spatialReference)?i:await G(i,s.spatialReference);a=s.contains(e);break}case"mesh":{const e=i.spatialReference.equals(s.spatialReference)?i:await G(i,s.spatialReference);o=s.extent.contains(e);break}}if(!a&&!o)return void this.clearReferencePointOnImage();const n="video"===this.mode||"panoramic-video"===this.mode?await this.getPixelLocationForFeature(i,{feature:t,mode:this.mode,imageSize:ye,footprintExtent:this.footprintExtent},r):await this._transformationService.pointToPixel(i,r);if(n)return y(r),this.plotReferencePointOnImage(n),{x:n.x,y:n.y};this.clearReferencePointOnImage()}async updateFeatureCache(e,t){const i=await N(e,t);i.features?.length&&(this.featureCache=i.features)}_plotReferencePointOnVideo(e){"video-loaded"===this.state&&this.videoViewModel?.videoPaused&&(this.clearReferencePointOnImage(),this.videoViewModel.plotReferencePointOnVideo(e))}_plotReferencePointOnPanoramicVideo(e){const i=this._panoramicVideoViewer,{imageSize:r,media:a}=i.viewModel;if(!this.panoramicVideoLoaded||!this.panoramicVideoPaused||!r)return;this.clearReferencePointOnImage();const o=Be(a),s=ht(e,"panoramic",r,o);this._referencePointOnImage=new t({geometry:s,symbol:Ge.clone()}),i.addGraphic(this._referencePointOnImage,0)}_getActiveFeatureForCurrentMode(){switch(this.mode){case"video":return this.videoViewModel?.closestFeature??this.currentBestFeature;case"panoramic-video":return this._panoramicVideoViewer.viewModel.closestFeature??this.currentBestFeature;default:return this.currentBestFeature}}_plotReferencePointOnDefaultImage(e){const i=this._imageViewer,{imageSize:r}=i;if("image-loaded"!==this.state||!r)return;this.clearReferencePointOnImage();const a=ht(e,"default",r);this._referencePointOnImage=new t({geometry:a,symbol:Le.clone()}),i.addGraphic(this._referencePointOnImage,0)}_plotReferencePointOnPanoramicImage(e){const i=this._panoramicViewer,{imageSize:r,media:a}=i;if("image-loaded"!==this.state||!r)return;this.clearReferencePointOnImage();const o=Be(a),s=ht(e,"panoramic",r,o);this._referencePointOnImage=new t({geometry:s,symbol:Ge.clone()}),i.addGraphic(this._referencePointOnImage,0)}async _fetchFeatures(e,t){const{layer:i,layerFloorFilterClause:r,layerTimeExtent:a,view:o}=this;if(!o)return;if(!i)return void this.setMessage("noLayerSelected","info");e.x=R(e.x,e.spatialReference);const s=i.spatialReference.equals(e.spatialReference)?e:await G(e,i.spatialReference),n=s.spatialReference.isGeographic?B(s):s,l=I("1=1",I(i.definitionExpression,r)),d=n.spatialReference.isGeographic?1:P(n.spatialReference),c={layerInstanceOrURL:i,point:n,queryParams:{where:l,maximumDistance:i.maximumDistance?i.maximumDistance/d:void 0,timeExtent:a}};return await this.searchBestImage(c,t)}async _fetchFeaturesWithController(e,t){try{await this._fetchFeatures(e,t)}catch(i){if(v(i))return;this.setMessage("imageLoadError","error"),u.getLogger(this).error("error occurred while fetching features",i)}}_groupFeaturesBySectors(){const{_suitabilities:e,additionalFeatures:t,features:i,invalidCameraHeading:r}=this,a=i.at(0);if(!e||!t||!a||!i||r)return void(this._sectorData=null);this._sectorData={};const s={};this._featureToSector=s;for(const c of be)this._sectorData[c]=new o;const n=e.map((e,t)=>({...e,featureIndex:t}));n.sort((e,t)=>e.trueSuitability-t.trueSuitability);const l=n.map(({distance:e})=>e),d=Math.max(...l);n.forEach(e=>{const{distance:t,angle:r,featureIndex:o}=e,n=t/d*Ve[2],l=Ze(t,d),c=Je(r);if(!this._sectorData)return;const u=Ve[3]+n*Math.sin(r*Math.PI/180),h=Ve[3]+n*Math.cos(r*Math.PI/180);let p;const m=i.at(o),g=m===a,{cameraPitch:v}=m.attributes,y=v<5;if(g&&y)p=-90;else{const e=u-Ve[3],t=h-Ve[3],i=t/Math.sqrt(e**2+t**2);let r=180*Math.acos(i)/Math.PI;(e<0&&t<0||e<0&&t>0)&&(r*=-1),p=r}const f=""===l?c:`${l}_${c}`;g&&(p===this.bestFeatureAngle?this.previousFeatureAngle=p:this.bestFeatureAngle=p,this.navigatorCurrentBestFeature=y?null:{x:u,y:h,direction:c}),s[`${m.attributes.objectId}`]=f;const w=this._sectorData[f];w.add({angle:r,featureIndex:o,x:u,y:h,objectID:m.attributes.objectId,sector:f,featureIndexInSector:w.length})})}async _initializeLocationViewModel(e){if(!this._locationViewModel){const t=import("./components/ImageLocationViewModel.js"),{default:i}=await t;y(e),this._locationViewModel=new i({oiViewModel:this,referenceTransformationService:this._referenceTransformationService})}}_initializeMeasurementService(){this._measurementService||(this._measurementService=new st({transformationService:this._transformationService,referenceTransformationService:this._referenceTransformationService}))}_initializeVideo(){if(this.videoElement||!this.currentBestFeature)return;this.removeHandles(xe.videoPlayerHandles),this.videoElement=new le({video:this.currentBestFeature.attributes.imagePath,georeference:new se({extent:new T(Me)}),autoplay:!1}),this.videoElement.content?.loop&&(this.videoElement.content.loop=!1);const e=new H({source:this.videoElement,title:this.layer?.title,copyright:this.layer?.copyright});this.videoLayer=e,e&&this.videoMapView.map.layers.add(e),this.videoViewModel=new rt({oiViewModel:this})}async getMapPoint(e,t){const i=await this._transformationService.pixelToMapPoint(Array.isArray(e)?e:[e],t);return Array.isArray(e)?i:i[0]}async getMapPointForFeature(e,t,i){const r=await this._transformationService.pixelToMapPointForFeature(Array.isArray(e)?e:[e],t,i);return Array.isArray(e)?r:r[0]}async loadPanoramicMediaSource(e,t){const{lookAt:i,...r}=e,a=Ue(r);try{await a.load(t)}catch(s){if(v(s))return;if("unsupported-format"===s.name)return void this.setMessage("unsupportedPanoramicImageryError","error",void 0,{datasetFormat:a?.extension??"UNKNOWN FORMAT"})}const o=this.triangularMeasurementActive?this._panoramicMeasurementViewer:this._panoramicViewer;await o.loadMedia(a,t),i&&o.set(i)}async loadMediaSource(e,t){const i=qe(e);await this._setImageSource(this.triangularMeasurementActive?this.imageMeasurementViewer:this._imageViewer,i,t)}_clearFeatureGeometries(){this.coveragePolygons.removeAll(),this.coverageFrustums.removeAll(),this.pointSources.removeAll()}_checkFeatures(e){return!!e?.length||(this.emit("no-image-found"),this.setMessage("noImageError","error"),this.videoElement?.content?.pause(),this.currentBestFeature=null,!1)}async _getElevationSampleFromGround(e,t,i){if(!e[0])return;const r=(await(import("../../geometry/operators/unionOperator.js"))).executeMany(e);if(this._updateFootprintWithFeatures(t,r),"3d"===this.view?.type)try{return await this.view.map.ground.createElevationSampler(this.footprintExtent,i)}catch(a){v(a)||u.getLogger(this).error(a)}}async processElevationSample(e,t,i){const{elevationSource:r}=t[0].attributes,a=await this._getElevationSampleFromGround(e,t,i);return a||(r&&this.footprintExtent&&J(r)?await Y({extent:this.footprintExtent,lod:r.lod,url:r.url,rasterFunction:r.rasterFunction}):void 0)}_processSuitableFeatures(e,t){return U({features:e,selectedPoint:t,camera:We(this.view)?this.view.camera:null,currentImage:this.currentBestFeature})}async _processHitTestResults(e,t,i){const{results:[r]}=t;if("graphic"!==r?.type)return this.beforeLoad(!1),this.emit("no-image-found"),void this.setMessage("noImageError","error");const a=r.graphic.getAttribute(e.objectIdField);return await this.showImageByObjectId(a,i)}async _queryAndLoadByObjectId(e,t,i,r,a){this.displayMessage=null;const{response:o}=await ot(e,t,i,r,a);if(y(a),!o?.features?.length)throw new at(t);const s=q(o.features[0].attributes).polygon,n=L.fromJSON(j(s)),l=Q(n),d=P(l.spatialReference);this.selectedPoint=l;const c={layerInstanceOrURL:e,point:l,queryParams:{where:I(I("1=1",I(e.definitionExpression,i)),`${e.objectIdField} <> ${t}`),maximumDistance:e.maximumDistance?e.maximumDistance/d:void 0,timeExtent:r}},u=await z(c,a);y(a);const{features:h}=u;return h.push(o.features[0]),await this.processFeatureResponse(u,l,{...a,loadBestImage:!1})}_reorderTriangularSketchLayer(){const e=this.imageMeasurementViewer.imageRenderer.map.layers?.length;this.sketchTriangularGraphicsLayer&&e&&this.imageMeasurementViewer.imageRenderer.map.layers.reorder(this.sketchTriangularGraphicsLayer,e-1)}async _setImageSource(e,t,i){e.media=t,await e.loadMedia(t,i)}_toggleVisiblity(e,t){e.forEach(e=>{e.visible=t})}async _updateElevationOfSelectedPointAndLocations(e,t,i,r){const{location:a,cameraHeight:o}=e[0].attributes,s=await re(a.spatialReference,a.z,o,{elevationSample:i,elevationSource:i?void 0:e[0].attributes.elevationSource,extent:this.footprintExtent},r);y(r);const[n,...l]=await X([t,...e.map(e=>e.attributes.geometry.clone())],s);y(r),t.elevation=n.z,e.forEach((e,t)=>{e.attributes.elevation=l[t].z})}_updateFeatures(e,t=!0){if(!e.length)return this.currentBestFeature=null,void this.additionalFeatures.removeAll();this.features.removeAll(),this.features.addMany(e),this.navigationNodes.removeAll(),this.navigationNodes.addMany(e.map(e=>{const{geometry:t,attributes:i}=e,{isSpherical:r,cameraHeading:a,cameraPitch:o}=i;return new it({geometry:t,attributes:i,currentHeading:r?0:a,currentPitch:r?0:o})})),e.length>1?this.additionalFeatures.addMany(e.slice(1)):this.additionalFeatures.removeAll(),this._updateGroundElevation=!0,t&&(this.currentBestFeature=e[0])}_updateFootprintWithFeatures(e,t){const i=[];for(const{attributes:{geometry:r}}of e)t.contains(r)||i.push([r.x,r.y]);i.sort((e,t)=>+x([e,t])),t.addRing(i),this.footprintExtent=ue(t.extent,2,2)}_scheduleVideoInteractionUpdate(){this.scheduledFrameId||(this.scheduledFrameId=requestAnimationFrame(()=>{this.scheduledFrameId=null,this._updateInteraction()}))}async _updatePointsAndPolygons(e){const{pointSources:i,currentBestFeature:r,currentCoverageVisible:a,isAdditionalPointSourcesVisible:o,mode:s,layer:n}=this;if(r&&(this.additionalFootprints.removeAll(),this.additionalCameraLocations.removeAll(),this.bestFeatureCurrentFootprint&&(this.bestFeatureCurrentFootprint.destroy(),this.bestFeatureCurrentFootprint=null,this.bestFeatureFootprint=null),!this.invalidCameraHeading)){await(this._adapter?.createFootprints(e)),y(e);for(const s of i){const i=this.view&&!this.view.spatialReference?.equals(s.spatialReference)?await G(s.clone(),this.view?.spatialReference,e):s.clone();s.imageID===r.attributes.objectId?this.currentBestFeatureLocation=new t({attributes:{imageID:s.imageID},geometry:i,symbol:Ee,visible:a}):this.additionalCameraLocations.push(new t({attributes:{imageID:s.imageID},geometry:i,symbol:je,visible:o}))}"video"!==s&&"panoramic-video"!==s||(await this.initializeTransformationService(e),n&&!this.featureCache.length&&await this.updateFeatureCache(n,r.geometry.spatialReference))}}_updateCurrentBestFeature(e){if(!e)return;if(this.currentBestFeature=this.features?.at(e.featureIndex),"video"===this.mode)return void(this.currentBestFeature&&this.videoViewModel?.playVideoFromSelectedLocation(this.currentBestFeature));if("panoramic-video"===this.mode)return void(this.currentBestFeature&&this._panoramicVideoViewer.viewModel.playPanoramicVideoFromSelectedLocation(this.currentBestFeature));const t=this.currentBestFeature?.attributes.cameraPitch&&this.currentBestFeature?.attributes.cameraPitch<5;let i;if(t)i=-90;else{const t=e.x-Ve[3],r=e.y-Ve[3],a=r/Math.sqrt(t**2+r**2);let o=180*Math.acos(a)/Math.PI;(t<0&&r<0||t<0&&r>0)&&(o*=-1),i=o}i===this.bestFeatureAngle?this.previousFeatureAngle=i:this.bestFeatureAngle=i,this.navigatorCurrentBestFeature=t?null:{x:e.x,y:e.y,direction:e.sector.includes("_")?e.sector.split("_")[1]:e.sector}}_updateImageMeasurementBestFeature(e){e&&(this.currentBestFeatureMeasurementImage=this.features?.at(e.featureIndex))}clearGraphics(){this._imageViewer.clearGraphics(),this._panoramicViewer.clearGraphics(),this.imageMeasurementViewer.clearGraphics(),this._panoramicMeasurementViewer.clearGraphics()}clearReferencePointOnImage(){this._referencePointOnImage&&(this._imageViewer.removeGraphic(this._referencePointOnImage),this._panoramicViewer.removeGraphic(this._referencePointOnImage),this._panoramicVideoViewer.removeGraphic(this._referencePointOnImage),this._referencePointOnImage=p(this._referencePointOnImage)),this.videoViewModel?.clearReferencePointOnVideo()}async initializeReferenceTransformationService(e){const{currentBestFeatureMeasurementImage:t,activeTriangulatedViewer:i,mode:r}=this;if(!t||!i||!i.imageSize||"panoramic"!==r&&"default"!==r)return;const{imageSize:a}=i,{attributes:o,elevationSample:s}=t,{location:{spatialReference:n,z:l},cameraHeight:d,elevationSource:c}=o;let u=o.location;u.spatialReference.isGeographic&&(u=Q(u));const h="default"===r?ae(o,a[0],a[1]):oe(o,a[0],a[1]),p=await re(n,l??0,d,{elevationSample:s,elevationSource:c,extent:this.footprintExtent},e),m=(await(import("./services/TransformationService.js"))).default,g={imageToWorldProperties:h,updateElevationProps:p,mode:r,imageSize:a,depthImageService:this.depthImage};this._referenceTransformationService=new m(g),this._locationViewModel&&(this._locationViewModel.referenceTransformationService=this._referenceTransformationService),this._measurementService&&(this._measurementService.referenceTransformationService=this._referenceTransformationService)}async initializeTransformationService(e){const{currentBestFeature:t,activeViewer:i,mode:r}=this,a="video"===r||"panoramic-video"===r?ye:i?.imageSize;if(!t||!a||"none"===r)return;const{attributes:o,elevationSample:s}=t,{location:{spatialReference:n,z:l},cameraHeight:d,elevationSource:c}=o;let u=o.location;u.spatialReference.isGeographic&&(u=Q(u));const h="default"===r||"video"===r?"default":"panoramic",p={..."default"===h?ae(o,a[0],a[1]):oe(o,a[0],a[1]),cameraLocation:u},m=await re(n,l??0,d,{elevationSample:s,elevationSource:c,extent:this.footprintExtent},e),g=(await(import("./services/TransformationService.js"))).default,v={imageToWorldProperties:p,updateElevationProps:m,mode:h,imageSize:a,depthImageService:this.depthImage};this._transformationService=new g(v),this._measurementService&&(this._measurementService.transformationService=this._transformationService)}plotReferencePoint(e){"mapPoint"in e?this.plotReferencePointOnGround(e.mapPoint):this.plotReferencePointOnGround(e)}clearSelectedPointOnViewer(){if(this._crossSymbol){if("video"===this.mode)return this.videoViewModel?.clearSelectedPointOnVideo(),void(this._crossSymbol=null);this._panoramicViewer.removeGraphic(this._crossSymbol),this._imageViewer.removeGraphic(this._crossSymbol),this.videoMapView.graphics.remove(this._crossSymbol),this._crossSymbol=p(this._crossSymbol)}else this.videoViewModel?.clearSelectedPointOnVideo()}setMessage(e,t,i,r){this.displayMessage={key:e,type:t,data:i,map:r}}async transformAndPlotSelectedLocation(e){const{invalidCameraHeading:t,selectedPoint:i,activeViewer:r,videoElement:a}=this,o="video"===this.mode?this.videoViewModel?.closestFeature??this.currentBestFeature:this.currentBestFeature;this.clearSelectedPointOnViewer();const s="video"===this.mode?!0===a?.loaded&&!0===this.videoViewModel?.videoPaused:"image-loaded"===r?.state;if(!i||!o||!s||t)return;if("video"===this.mode){if(!await Ye(i,this.bestFeatureCurrentFootprint?.geometry,e))return}let n;try{if(n="video"===this.mode?await this.getPixelLocationForFeature(i,{feature:o,mode:this.mode,imageSize:ye,footprintExtent:this.footprintExtent},e):await this._transformationService.pointToPixel(i,{signal:e?.signal}),"video"===this.mode&&!et(n))return;y(e),await this.plotSelectedPointOnImage(n,e)}catch(l){v(l)||u.getLogger(this).error("failed to transform map point to pixel, cross symbol will not be plotted on image",{error:l,selectedPoint:i,feature:o})}}updateCurrentCoveragePolygon(e){const{additionalFootprints:i,additionalCameraLocations:r,currentBestFeature:a,currentBestFeatureLocation:o,currentCoverageVisible:s,selectedPoint:n,view:l,_adapter:d,mode:c}=this;if(!a)return;const{attributes:{objectId:u},elevationSample:h}=a;if(this._initialCurrentCoverageUpdate){if(this._overlays?.removeAll(),this._initialCurrentCoverageUpdate=!1,this.bestFeatureCurrentFootprint=p(this.bestFeatureCurrentFootprint),e&&!this.invalidCameraHeading&&(e.visible=s,this.bestFeatureCurrentFootprint=e),l){const e=[...i,...r,o].filter($e);"3d"===l?.type&&h&&d?.updateGroundElevation&&(this._updateGroundElevation&&d.updateGroundElevation(e),"panoramic"===c&&d.updateGroundElevation([this.bestFeatureCurrentFootprint])),this._updateGroundElevation=!1,n&&(e.splice(-2,0,this.bestFeatureCurrentFootprint),e.push(new t({geometry:n.clone(),symbol:Ie.clone(),attributes:{imageID:u}}))),this._overlays.graphics.addMany(e)}}else if(l){if(this.invalidCameraHeading)return void this._superimposeService.clear();this.bestFeatureCurrentFootprint&&(this._overlays?.remove(this.bestFeatureCurrentFootprint),this.bestFeatureCurrentFootprint=p(this.bestFeatureCurrentFootprint));const t=this.bestFeatureCurrentFootprint&&this._overlays?this._overlays.graphics.indexOf(this.bestFeatureCurrentFootprint):-1;e&&(this.bestFeatureCurrentFootprint=e,"3d"===l?.type&&h&&d?.updateGroundElevation&&"panoramic"===c&&d.updateGroundElevation([e]),e.visible=this.currentCoverageVisible,this._overlays?.graphics.add(this.bestFeatureCurrentFootprint,t>=0?t:this._overlays.graphics.length-1))}}_updateSuperimposedImage(){if(!this._hasActiveSuperimposeCameraContext())return;const e="panoramic"===this.mode?this._panoramicViewer:null,{currentBestFeature:t,defaultSuperimposeCameraLockEnabled:i,layer:r,mode:a,view:o,state:s,superimposeViewEnabled:n,superimposeViewSupported:l,activeViewer:d,depthImage:c}=this,u=this.coverageFrustums.find(({imageID:e})=>e===t?.attributes.objectId);this._superimposeService.update({activeImageSize:d?.imageSize||void 0,adapter:this._adapter,currentBestFeature:t,currentBestFeatureFrustum:u,defaultSuperimposeCameraLockEnabled:i,depthImageLoaded:c?.loaded??!1,layer:r,mode:a,panoramicCamera:e?.camera,state:s,superimposeViewEnabled:n&&l,view:o}),this.setMessage("superimposeImageDescription","info"),this._superimposePreviousCurrentCoverageVisible??=this.currentCoverageVisible,this.currentCoverageVisible=!1}_getSuperimposeCameraWatchState(){const e="3d"===this.view?.type?this.view:null,t=e?.camera;return[this.superimposeViewEnabled,this.superimposeViewSupported,this.mode,this.state,this.view?.type,this.view?.interacting,this.view?.navigating,t?.heading,t?.tilt,t?.fov,t?.position.x,t?.position.y,t?.position.z]}_handleSuperimposeCameraChange(){const e=this.view,t="3d"===e?.type?e:null;this._hasActiveSuperimposeCameraContext()?"panoramic"!==this.mode?!t||t.interacting||t.navigating?this._abortSuperimposeSchedule():this._scheduleDefaultSuperimposeUpdate():this._schedulePanoramicSuperimposeUpdate():this._abortSuperimposeSchedule()}_shouldDisableUnsupportedSuperimposeView(){return this.superimposeViewEnabled&&"panoramic"===this.mode&&!this.superimposeViewSupported}_hasActiveSuperimposeCameraContext(){return("default"===this.mode||"panoramic"===this.mode)&&this.superimposeViewEnabled&&this.superimposeViewSupported&&"image-loaded"===this.state&&"3d"===this.view?.type&&!!this.view.camera}_abortSuperimposeSchedule(){this._superimposeScheduleController?.abort(),this._superimposeScheduleController=null,this._clearSuperimposeDebounceTimeout(),this._clearSuperimposeScheduledFrame()}_resetInactiveSuperimposeState(){const e=null!=this._superimposePreviousCurrentCoverageVisible;this._abortSuperimposeSchedule(),this._adapter?.disableDefaultSuperimposeNavigation?.(),this._adapter?.disablePanoramicSuperimposeNavigation?.(),this._superimposeService.clear(),this._restoreCurrentCoverageVisibilityAfterSuperimpose(),this._restoreDefaultMessageAfterSuperimpose(),e&&this._restoreViewerMediaAfterSuperimpose()}_restoreCurrentCoverageVisibilityAfterSuperimpose(){null!=this._superimposePreviousCurrentCoverageVisible&&(this.currentCoverageVisible=this._superimposePreviousCurrentCoverageVisible,this._superimposePreviousCurrentCoverageVisible=null)}_restoreViewerMediaAfterSuperimpose(){const{currentBestFeature:e,mode:t}=this;if(!e||"default"!==t&&"panoramic"!==t)return;this._restoreSuperimposeMediaTask?.abort();const i=a(async t=>{await this._loadCurrentFeatureMedia(e,{signal:t})});this._restoreSuperimposeMediaTask=i,i.promise.finally(()=>{this._restoreSuperimposeMediaTask===i&&(this._restoreSuperimposeMediaTask=null)})}_restoreDefaultMessageAfterSuperimpose(){if("superimposeImageDescription"===this.displayMessage?.key){!!this.currentBestFeature&&("default"===this.mode||"panoramic"===this.mode)?this.displayMessage=null:this.setMessage("onLoadMessage","info")}}_clearSuperimposeDebounceTimeout(){null!=this.superimposeDebounceTimeoutId&&(clearTimeout(this.superimposeDebounceTimeoutId),this.superimposeDebounceTimeoutId=null)}_clearSuperimposeScheduledFrame(){null!=this.superimposeScheduledFrameId&&(cancelAnimationFrame(this.superimposeScheduledFrameId),this.superimposeScheduledFrameId=null)}_schedulePanoramicSuperimposeUpdate(){this._abortSuperimposeSchedule(),this.superimposeDebounceTimeoutId=window.setTimeout(()=>{this.superimposeDebounceTimeoutId=null,this._hasActiveSuperimposeCameraContext()&&"panoramic"===this.mode&&this._updateSuperimposedImage()},150)}_scheduleDefaultSuperimposeUpdate(){const e=this.view;if(!("3d"===e?.type?e:null))return;if(this.superimposeScheduledFrameId)return;this._superimposeScheduleController?.abort();const t=new AbortController,{signal:i}=t,r=()=>{this._clearSuperimposeDebounceTimeout(),this._clearSuperimposeScheduledFrame(),this._superimposeScheduleController===t&&(this._superimposeScheduleController=null),i.removeEventListener("abort",r)};this._superimposeScheduleController=t,i.addEventListener("abort",r),this.superimposeScheduledFrameId=requestAnimationFrame(()=>{if(i.removeEventListener("abort",r),this.superimposeScheduledFrameId=null,this._superimposeScheduleController===t&&(this._superimposeScheduleController=null),i.aborted)return;const e=this.view,a="3d"===e?.type?e:null;!this._hasActiveSuperimposeCameraContext()||null==a||a.interacting||a.navigating||this._updateSuperimposedImage()})}};e([C()],vt.prototype,"activeLayer",null),e([C({readOnly:!0})],vt.prototype,"activeViewer",null),e([C()],vt.prototype,"activeTriangulatedViewer",null),e([C()],vt.prototype,"accuracyParametersMissing",null),e([C()],vt.prototype,"additionalFeatures",void 0),e([C({type:o.ofType(t)})],vt.prototype,"additionalCameraLocations",void 0),e([C({type:o.ofType(t)})],vt.prototype,"additionalFootprints",void 0),e([C()],vt.prototype,"areaMeasurementResult",void 0),e([C()],vt.prototype,"areaMeasurementAccuracy",void 0),e([C()],vt.prototype,"bestFeatureAngle",void 0),e([C()],vt.prototype,"bestFeatureCurrentFootprint",void 0),e([C({type:t})],vt.prototype,"bestFeatureFootprint",void 0),e([C({type:Number})],vt.prototype,"brightness",null),e([C()],vt.prototype,"cameraHeadingThreshold",void 0),e([C()],vt.prototype,"cameraPitchThreshold",void 0),e([C()],vt.prototype,"clickAction",void 0),e([C()],vt.prototype,"correctedLocationPointOnImage",void 0),e([C()],vt.prototype,"videoViewModel",void 0),e([C()],vt.prototype,"collectionId",void 0),e([C({type:Number})],vt.prototype,"contrast",null),e([C()],vt.prototype,"coverageFrustums",void 0),e([C()],vt.prototype,"coveragePolygons",void 0),e([C()],vt.prototype,"currentBestFeature",void 0),e([C()],vt.prototype,"currentBestFeatureMeasurementImage",void 0),e([C()],vt.prototype,"currentBestFeatureLocation",void 0),e([C()],vt.prototype,"currentCoverageVisible",void 0),e([C()],vt.prototype,"currentNode",null),e([C()],vt.prototype,"depthImage",void 0),e([C()],vt.prototype,"depthImageNotSupported",null),e([C()],vt.prototype,"featureCache",void 0),e([C()],vt.prototype,"navigationNodes",void 0),e([C({json:{write:!1}})],vt.prototype,"determineWorkflowForFeature",void 0),e([C({json:{write:!1}})],vt.prototype,"determineWorkflowForTriangularMeasurement",void 0),e([C()],vt.prototype,"disabled",void 0),e([C()],vt.prototype,"displayMessage",void 0),e([C()],vt.prototype,"displayNewMeasurementButton",void 0),e([C()],vt.prototype,"distanceMeasurementResult",void 0),e([C()],vt.prototype,"distanceAccuracyArray",void 0),e([C()],vt.prototype,"dataCaptureLayer",void 0),e([C({readOnly:!0})],vt.prototype,"featureCount",null),e([C()],vt.prototype,"features",void 0),e([C()],vt.prototype,"groundCoordinates",void 0),e([C()],vt.prototype,"groundCoordinatesAccuracy",void 0),e([C()],vt.prototype,"groundCoordinatesAccuracyLoading",void 0),e([C()],vt.prototype,"heightGraphic",void 0),e([C()],vt.prototype,"heightMeasurementResult",void 0),e([C()],vt.prototype,"heightMeasurementAccuracy",void 0),e([C({readOnly:!0})],vt.prototype,"imageGalleryEnabled",null),e([C()],vt.prototype,"imageGeometryField",void 0),e([C({readOnly:!0})],vt.prototype,"imageLoaded",null),e([C()],vt.prototype,"imageLocationToolState",void 0),e([C()],vt.prototype,"initialVideoMapViewExtent",void 0),e([C({readOnly:!0})],vt.prototype,"invalidCameraHeading",null),e([C()],vt.prototype,"imagePointsInView",null),e([C()],vt.prototype,"imageMeasurementViewer",void 0),e([C()],vt.prototype,"isAdditionalCoverageVisible",void 0),e([C()],vt.prototype,"isAdditionalPointSourcesVisible",void 0),e([C()],vt.prototype,"layer",void 0),e([C()],vt.prototype,"layerView",null),e([C({readOnly:!0})],vt.prototype,"layerFloorFilterClause",null),e([C({readOnly:!0})],vt.prototype,"layerTimeExtent",null),e([C({type:Number})],vt.prototype,"localPort",void 0),e([C()],vt.prototype,"locationPointOnImage",void 0),e([C()],vt.prototype,"mapImageConversionToolState",void 0),e([C()],vt.prototype,"measureType",void 0),e([C()],vt.prototype,"measurementGraphic",void 0),e([C({readOnly:!0,value:"none"})],vt.prototype,"mode",null),e([C()],vt.prototype,"navigationMode",void 0),e([C()],vt.prototype,"navigatorCurrentBestFeature",void 0),e([C()],vt.prototype,"oiObjectIdField",void 0),e([C({type:o.ofType(t)})],vt.prototype,"overlayedCameraLocations",void 0),e([C()],vt.prototype,"overlayedMapFeatures",void 0),e([C()],vt.prototype,"panoramicVideoLoaded",null),e([C()],vt.prototype,"panoramicVideoPaused",null),e([C()],vt.prototype,"pixelCoordinates",void 0),e([C()],vt.prototype,"preserveAngle",void 0),e([C()],vt.prototype,"pointSources",void 0),e([C({readOnly:!0})],vt.prototype,"popupEnabled",null),e([C()],vt.prototype,"preloadMedia",void 0),e([C()],vt.prototype,"preloadMediaSize",void 0),e([C()],vt.prototype,"previousFeatureAngle",void 0),e([C()],vt.prototype,"referencePoint",null),e([C({readOnly:!0})],vt.prototype,"sectorData",null),e([C()],vt.prototype,"selectedPoint",void 0),e([C({type:Number})],vt.prototype,"sharpness",null),e([C()],vt.prototype,"shouldShowSelectedImage",void 0),e([C()],vt.prototype,"superimposeViewEnabled",void 0),e([C()],vt.prototype,"defaultSuperimposeCameraLockEnabled",void 0),e([C()],vt.prototype,"superimposeViewSupported",null),e([C()],vt.prototype,"sketch",void 0),e([C()],vt.prototype,"sketchTriangular",void 0),e([C()],vt.prototype,"sketchTriangularGraphicsLayer",void 0),e([C()],vt.prototype,"draw",void 0),e([C()],vt.prototype,"drawAdapter",void 0),e([C()],vt.prototype,"polylineDrawAction",void 0),e([C()],vt.prototype,"scheduledFrameId",void 0),e([C()],vt.prototype,"superimposeScheduledFrameId",void 0),e([C()],vt.prototype,"superimposeDebounceTimeoutId",void 0),e([C()],vt.prototype,"sketchAdapter",void 0),e([C({readOnly:!0})],vt.prototype,"sketchGraphicsLayer",null),e([C({readOnly:!0})],vt.prototype,"state",null),e([C({readOnly:!0})],vt.prototype,"thumbnails",null),e([C()],vt.prototype,"videoExtentPoints",null),e([C()],vt.prototype,"triangularMeasurementActive",void 0),e([C()],vt.prototype,"triangulatedDistanceMeasurement",void 0),e([C()],vt.prototype,"triangulatedDistanceAccuracy",void 0),e([C()],vt.prototype,"triangulatedAreaMeasurement",void 0),e([C()],vt.prototype,"triangulatedAreaAccuracy",void 0),e([C()],vt.prototype,"triangulatedMeasurementGraphic",void 0),e([C()],vt.prototype,"triangulatedPoint",void 0),e([C()],vt.prototype,"triangulatedMeasurementAdapter",void 0),e([C()],vt.prototype,"updateFootprint",void 0),e([C()],vt.prototype,"updateVideoFootprint",void 0),e([C()],vt.prototype,"updateFootprintPanorama",void 0),e([C()],vt.prototype,"updatingTriangularMeasurementState",void 0),e([C({value:null})],vt.prototype,"view",null),e([C()],vt.prototype,"videoElement",void 0),e([C()],vt.prototype,"videoLayer",void 0),e([C()],vt.prototype,"videoMapView",void 0),e([C()],vt.prototype,"verticalFilterEnabled",void 0),e([C()],vt.prototype,"_adapter",void 0),e([C()],vt.prototype,"_defaultGraphicsLayer",null),e([C()],vt.prototype,"_highlightedFeatureHandle",void 0),e([C()],vt.prototype,"_imageViewer",void 0),e([C()],vt.prototype,"_initialCurrentCoverageUpdate",void 0),e([C()],vt.prototype,"_locationViewModel",void 0),e([C()],vt.prototype,"_measurementService",void 0),e([C()],vt.prototype,"_mediaPrefetcher",void 0),e([C()],vt.prototype,"_navigationManager",void 0),e([C()],vt.prototype,"_overlays",void 0),e([C()],vt.prototype,"_superimposePreviousCurrentCoverageVisible",void 0),e([C()],vt.prototype,"_superimposeService",void 0),e([C({readOnly:!0})],vt.prototype,"_overlaysView",null),e([C()],vt.prototype,"_panoramicVideoViewer",void 0),e([C()],vt.prototype,"_panoramicViewer",void 0),e([C()],vt.prototype,"_panoramicMeasurementViewer",void 0),e([C()],vt.prototype,"_referencePointOnGround",void 0),e([C()],vt.prototype,"_referencePointOnImage",void 0),e([C()],vt.prototype,"_referenceTransformationService",void 0),e([C()],vt.prototype,"_sectorData",void 0),e([C()],vt.prototype,"_transformationService",void 0),e([C()],vt.prototype,"_featureToSector",void 0),e([C({readOnly:!0})],vt.prototype,"_updatingHandles",void 0),e([C()],vt.prototype,"footprintExtent",void 0),e([C()],vt.prototype,"_featureChangedTask",void 0),vt=e([A("esri.widgets.OrientedImageryViewer.OrientedImageryViewerViewModel")],vt);const yt=vt;export{yt as default};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import i from"../../../Graphic.js";import t from"../../../core/Accessor.js";import{createTask as o}from"../../../core/asyncUtils.js";import{equalsMaybe as r}from"../../../core/maybe.js";import{throwIfAborted as a}from"../../../core/promiseUtils.js";import{on as s,watch as n,syncAndInitial as l}from"../../../core/reactiveUtils.js";import{property as c,subclass as m}from"../../../core/accessorSupport/decorators.js";import{isSerializable as d}from"../../../core/support/jsonUtils.js";import{projectAsync as u}from"../../../geometry/projectionUtils.js";import{or as w}from"../../../layers/orientedImagery/transformations/utils.js";import{computeTriangulatedVector as h,computeTriangulatedPoint as g}from"../imageMeasurementUtils.js";import{locationSymbol as V,locationSymbol3D as p}from"../symbols.js";import{registryKeys as M}from"../types.js";import{extractHorizonAnglesFromMedia as f}from"../utils.js";import{imageSpaceToPoint as v}from"../support/geometryUtils.js";let y=class extends t{constructor(e){super(e),this.referenceTransformationService=null,this._createImageLocationHandle=()=>{this.oiViewModel.removeHandles("image-click");const{imageLocationToolState:e,mode:i,activeViewer:t,currentBestFeature:r,footprintExtent:n,layer:l}=this.oiViewModel,c=t?.imageSize;if(!(e&&"none"!==i&&c&&n&&r))return;this.oiViewModel.clickAction="pixel-location";let m=null;const d=s(()=>t,"pixel-location",e=>{const{currentBestFeatureMeasurementImage:s,triangularMeasurementActive:c,activeTriangulatedViewer:d}=this.oiViewModel;if(!e)return;this.oiViewModel.pixelCoordinates=e;const h=null!=s&&!d?.state.includes("loading");w(!c,h)&&this._plotLocationPointOnImage(e),m?.abort(),m=o(async o=>{if(!e)return;let s=await this.oiViewModel.getMapPoint(e);a(o);const m=this.oiViewModel.view?.spatialReference;m&&!s.spatialReference.equals(m)&&(s=await u(s,m),a(o)),this.oiViewModel.groundCoordinates=s,c&&s&&h&&await this._triangulatedLocationWorkflow(s,o);const d=l?.orientationAccuracy;if(!d)return;const w={pixel:e,currentResult:s,currentBestFeature:r,mode:i,activeViewer:t,footprintExtent:n,accuracyParameters:d,viewSpatialReference:m,signal:o},g=await this.oiViewModel.calculateLocationAccuracy(w);a(o),g&&(this.oiViewModel.groundCoordinatesAccuracy=g)})});this.oiViewModel.addHandles(d,"image-click")},this._createTriangularImageLocationHandle=()=>{this.oiViewModel.removeHandles(M.triangularImageClick);const{imageLocationToolState:e,mode:i,activeTriangulatedViewer:t}=this.oiViewModel,r=t?.imageSize;if(!e||"none"===i||!r)return;this.oiViewModel.clickAction="pixel-location";let n=null;const l=s(()=>t,"pixel-location",e=>{1===this.measurementVectors.length&&e&&(this._plotLocationPointOnImage(e,!0),n?.abort(),n=o(async i=>{if(!e||this.oiViewModel.triangulatedPoint||2===this.measurementVectors?.length||!this.oiViewModel.currentBestFeatureMeasurementImage)return;let t=await(this.referenceTransformationService?.pixelToMapPoint(e));if(a(i),!t)return;const o=this.oiViewModel.view?.spatialReference;o&&!t.spatialReference.equals(o)&&(t=await u(t,o),a(i)),await this._calculateTriangulatedPointFromGroundPoint(t,{signal:i}),a(i)}))});this.oiViewModel.addHandles(l,M.triangularImageClick)}}initialize(){this.addHandles([n(()=>[this.oiViewModel.state,this.oiViewModel.imageLocationToolState,this.oiViewModel.view],(e,i)=>{if(this._resetMeasurementVectors(),this._createImageLocationHandle(),!e[1])return this.oiViewModel.clearPreviousGroundLocation(),void this._resetCursor();e[1]!==i?.[1]&&this._setMeasurementCursor()},l)])}async _calculateTriangulatedPointFromGroundPoint(e,i){if(this.oiViewModel.currentBestFeatureMeasurementImage&&e){const{currentBestFeatureMeasurementImage:t,view:o}=this.oiViewModel,s=h(e,t);s&&this.measurementVectors.push(s);let n=await g(this.measurementVectors);a(i),r(n?.spatialReference,o?.spatialReference)||(n=await u(n,o?.spatialReference)),this.oiViewModel.triangulatedPoint=n??this.oiViewModel.triangulatedPoint}}async _plotReferenceLocationPoint(e,i){if(this.oiViewModel.currentBestFeatureMeasurementImage){const t=await(this.referenceTransformationService?.pointToPixel(e,{signal:i}));a(i),t&&this._plotLocationPointOnImage(t,!0)}}_plotLocationPointOnImage(e,t=!1){const{activeViewer:o,mode:r,state:a,activeTriangulatedViewer:s}=this.oiViewModel,n=t?s:o;if("image-loaded"!==a||!n?.imageSize||"default"!==r&&"panoramic"!==r)return;this.oiViewModel.clearLocationPointOnImage(t);const l=d(e)?e.toJSON():e,c=f(n?.media),m=v(l,r,n.imageSize,c),u=new i({geometry:m,symbol:"default"===r?V:p});t?this.oiViewModel.correctedLocationPointOnImage=u:this.oiViewModel.locationPointOnImage=u,n.addGraphic(u,0)}_resetCursor(){const{activeViewer:e,imageMeasurementViewer:i}=this.oiViewModel;e&&this.oiViewModel.removeHandles(M.activeViewerCursorHandles),i&&this.oiViewModel.removeHandles(M.imageViewerCursorHandles)}_resetMeasurementVectors(){this.measurementVectors=[]}_setMeasurementCursor(){const{activeViewer:e,imageMeasurementViewer:i,triangularMeasurementActive:t}=this.oiViewModel;e&&this.oiViewModel.addHandles(e.imageRenderer.acquireCursor("crosshair","high"),M.activeViewerCursorHandles),i&&t&&this.oiViewModel.addHandles(i.imageRenderer.acquireCursor("crosshair","high"),M.activeViewerCursorHandles)}async _triangulatedLocationWorkflow(e,i){if(this.oiViewModel.currentBestFeature&&e){const{currentBestFeature:t}=this.oiViewModel;this.oiViewModel.triangulatedPoint&&(this.measurementVectors=[],this.oiViewModel.triangulatedPoint=null,this.oiViewModel.clearLocationPointOnImage(!0));const o=h(e,t);if(!o)return;this.measurementVectors.push(o),await this._plotReferenceLocationPoint(e,i),a(i),this._createTriangularImageLocationHandle()}}};e([c()],y.prototype,"measurementVectors",void 0),e([c()],y.prototype,"oiViewModel",void 0),e([c()],y.prototype,"referenceTransformationService",void 0),y=e([m("esri.widgets.OrientedImageryViewer.components.ImageLocationViewModel")],y);const P=y;export{P as default};
2
+ import{__decorate as e}from"tslib";import i from"../../../Graphic.js";import t from"../../../core/Accessor.js";import{createTask as o}from"../../../core/asyncUtils.js";import{equalsMaybe as r}from"../../../core/maybe.js";import{throwIfAborted as a}from"../../../core/promiseUtils.js";import{on as s,watch as n,syncAndInitial as c}from"../../../core/reactiveUtils.js";import{property as l,subclass as d}from"../../../core/accessorSupport/decorators.js";import{isSerializable as m}from"../../../core/support/jsonUtils.js";import{projectAsync as u}from"../../../geometry/projectionUtils.js";import{or as w}from"../../../layers/orientedImagery/transformations/utils.js";import{computeTriangulatedVector as h,computeTriangulatedPoint as g}from"../imageMeasurementUtils.js";import{locationSymbol as V,locationSymbol3D as p}from"../symbols.js";import{registryKeys as M}from"../types.js";import{extractHorizonAnglesFromMedia as f}from"../utils.js";import{imageSpaceToPoint as v}from"../support/geometryUtils.js";let y=class extends t{constructor(e){super(e),this.referenceTransformationService=null,this._createImageLocationHandle=()=>{this.oiViewModel.removeHandles("image-click");const{imageLocationToolState:e,mode:i,activeViewer:t,currentBestFeature:r,footprintExtent:n,layer:c}=this.oiViewModel,l=t?.imageSize;if(!(e&&"none"!==i&&l&&n&&r))return;this.oiViewModel.clickAction="pixel-location";let d=null;const m=s(()=>t,"pixel-location",e=>{const{currentBestFeatureMeasurementImage:s,triangularMeasurementActive:l,activeTriangulatedViewer:m}=this.oiViewModel;if(!e)return;this.oiViewModel.pixelCoordinates=e;const h=null!=s&&!m?.state.includes("loading");w(!l,h)&&this._plotLocationPointOnImage(e),d?.abort();const g=o(async o=>{if(!e)return;let s=await this.oiViewModel.getMapPoint(e);a(o);const m=this.oiViewModel.view?.spatialReference;m&&!s.spatialReference.equals(m)&&(s=await u(s,m),a(o)),this.oiViewModel.groundCoordinates=s,this.oiViewModel.groundCoordinatesAccuracy=null,l&&s&&h&&await this._triangulatedLocationWorkflow(s,o);const w=c?.orientationAccuracy;if(!w)return void(d===g&&(this.oiViewModel.groundCoordinatesAccuracyLoading=!1));this.oiViewModel.groundCoordinatesAccuracyLoading=!0;const V={pixel:e,currentResult:s,currentBestFeature:r,mode:i,activeViewer:t,footprintExtent:n,accuracyParameters:w,viewSpatialReference:m,signal:o};try{const e=await this.oiViewModel.calculateLocationAccuracy(V);a(o),e&&(this.oiViewModel.groundCoordinatesAccuracy=e)}finally{d===g&&(this.oiViewModel.groundCoordinatesAccuracyLoading=!1)}});d=g});this.oiViewModel.addHandles(m,"image-click")},this._createTriangularImageLocationHandle=()=>{this.oiViewModel.removeHandles(M.triangularImageClick);const{imageLocationToolState:e,mode:i,activeTriangulatedViewer:t}=this.oiViewModel,r=t?.imageSize;if(!e||"none"===i||!r)return;this.oiViewModel.clickAction="pixel-location";let n=null;const c=s(()=>t,"pixel-location",e=>{1===this.measurementVectors.length&&e&&(this._plotLocationPointOnImage(e,!0),n?.abort(),n=o(async i=>{if(!e||this.oiViewModel.triangulatedPoint||2===this.measurementVectors?.length||!this.oiViewModel.currentBestFeatureMeasurementImage)return;let t=await(this.referenceTransformationService?.pixelToMapPoint(e));if(a(i),!t)return;const o=this.oiViewModel.view?.spatialReference;o&&!t.spatialReference.equals(o)&&(t=await u(t,o),a(i)),await this._calculateTriangulatedPointFromGroundPoint(t,{signal:i}),a(i)}))});this.oiViewModel.addHandles(c,M.triangularImageClick)}}initialize(){this.addHandles([n(()=>[this.oiViewModel.state,this.oiViewModel.imageLocationToolState,this.oiViewModel.view],(e,i)=>{if(this._resetMeasurementVectors(),this._createImageLocationHandle(),!e[1])return this.oiViewModel.clearPreviousGroundLocation(),void this._resetCursor();e[1]!==i?.[1]&&this._setMeasurementCursor()},c)])}async _calculateTriangulatedPointFromGroundPoint(e,i){if(this.oiViewModel.currentBestFeatureMeasurementImage&&e){const{currentBestFeatureMeasurementImage:t,view:o}=this.oiViewModel,s=h(e,t);s&&this.measurementVectors.push(s);let n=await g(this.measurementVectors);a(i),r(n?.spatialReference,o?.spatialReference)||(n=await u(n,o?.spatialReference)),this.oiViewModel.triangulatedPoint=n??this.oiViewModel.triangulatedPoint}}async _plotReferenceLocationPoint(e,i){if(this.oiViewModel.currentBestFeatureMeasurementImage){const t=await(this.referenceTransformationService?.pointToPixel(e,{signal:i}));a(i),t&&this._plotLocationPointOnImage(t,!0)}}_plotLocationPointOnImage(e,t=!1){const{activeViewer:o,mode:r,state:a,activeTriangulatedViewer:s}=this.oiViewModel,n=t?s:o;if("image-loaded"!==a||!n?.imageSize||"default"!==r&&"panoramic"!==r)return;this.oiViewModel.clearLocationPointOnImage(t);const c=m(e)?e.toJSON():e,l=f(n?.media),d=v(c,r,n.imageSize,l),u=new i({geometry:d,symbol:"default"===r?V:p});t?this.oiViewModel.correctedLocationPointOnImage=u:this.oiViewModel.locationPointOnImage=u,n.addGraphic(u,0)}_resetCursor(){const{activeViewer:e,imageMeasurementViewer:i}=this.oiViewModel;e&&this.oiViewModel.removeHandles(M.activeViewerCursorHandles),i&&this.oiViewModel.removeHandles(M.imageViewerCursorHandles)}_resetMeasurementVectors(){this.measurementVectors=[]}_setMeasurementCursor(){const{activeViewer:e,imageMeasurementViewer:i,triangularMeasurementActive:t}=this.oiViewModel;e&&this.oiViewModel.addHandles(e.imageRenderer.acquireCursor("crosshair","high"),M.activeViewerCursorHandles),i&&t&&this.oiViewModel.addHandles(i.imageRenderer.acquireCursor("crosshair","high"),M.activeViewerCursorHandles)}async _triangulatedLocationWorkflow(e,i){if(this.oiViewModel.currentBestFeature&&e){const{currentBestFeature:t}=this.oiViewModel;this.oiViewModel.triangulatedPoint&&(this.measurementVectors=[],this.oiViewModel.triangulatedPoint=null,this.oiViewModel.clearLocationPointOnImage(!0));const o=h(e,t);if(!o)return;this.measurementVectors.push(o),await this._plotReferenceLocationPoint(e,i),a(i),this._createTriangularImageLocationHandle()}}};e([l()],y.prototype,"measurementVectors",void 0),e([l()],y.prototype,"oiViewModel",void 0),e([l()],y.prototype,"referenceTransformationService",void 0),y=e([d("esri.widgets.OrientedImageryViewer.components.ImageLocationViewModel")],y);const L=y;export{L as default};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import{property as t,subclass as c}from"../../../core/accessorSupport/decorators.js";import{onLocaleChange as o}from"../../../intl/locale.js";import{formatNumber as n}from"../../../intl/number.js";import{substitute as a}from"../../../intl/substitute.js";import i from"../../Widget.js";import{css as l}from"../css.js";import{copyToClipboard as s}from"../imageMeasurementUtils.js";import{loadCalciteComponents as r}from"../../support/componentsUtils.js";import{tsx as m}from"../../support/widget.js";import{messageBundle as u}from"../../support/decorators/messageBundle.js";const d={minimumFractionDigits:6,maximumFractionDigits:6,useGrouping:!1},p={minimumFractionDigits:3,maximumFractionDigits:3,useGrouping:!1};let g=class extends i{constructor(e){super(e),this.messages=null,this.messagesCommon=null,this.accuracy=null,this._selectedSystem="Basemap",this._handleSystemSelection=e=>{this._selectedSystem=e.target.value}}initialize(){this.addHandles(o(()=>this.scheduleRender()))}loadDependencies(){return r({action:()=>import("@esri/calcite-components/dist/components/calcite-action"),block:()=>import("@esri/calcite-components/dist/components/calcite-block"),panel:()=>import("@esri/calcite-components/dist/components/calcite-panel"),select:()=>import("@esri/calcite-components/dist/components/calcite-select"),option:()=>import("@esri/calcite-components/dist/components/calcite-option"),table:()=>import("@esri/calcite-components/dist/components/calcite-table"),"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")})}_renderLocationBlock(){const{groundCoordinates:e,_selectedSystem:t}=this;return e&&"XY"===t?m("calcite-block",{heading:this.getLocation(),headingLevel:6}):null}_renderLocationTable(){const{groundCoordinates:e,messages:t,_selectedSystem:c,accuracy:o}=this,a={groundX:n(e.x,p),accuracyX:null!=o?.x?n(o.x,p):"",groundY:n(e.y,p),accuracyY:null!=o?.y?n(o.y,p):"",groundZ:null!=e.z?n(e.z,p):"",accuracyZ:null!=o?.z?n(o.z,p):""};return e&&"Basemap"===c?m("calcite-table",{bordered:!0,caption:t.measurementTable,class:l.measurementsTable,scale:"s"},m("calcite-table-row",{slot:"table-header"},m("calcite-table-header",{alignment:"center",heading:t.type}),m("calcite-table-header",{alignment:"center",heading:t.value}),m("calcite-table-header",{alignment:"center",heading:t.accuracy})),m("calcite-table-row",null,m("calcite-table-cell",{alignment:"center"},t.x),m("calcite-table-cell",{alignment:"center"},a.groundX),m("calcite-table-cell",{alignment:"center"},a.accuracyX)),m("calcite-table-row",null,m("calcite-table-cell",{alignment:"center"},t.y),m("calcite-table-cell",{alignment:"center"},a.groundY),m("calcite-table-cell",{alignment:"center"},a.accuracyY)),m("calcite-table-row",null,m("calcite-table-cell",{alignment:"center"},t.z),m("calcite-table-cell",{alignment:"center"},a.groundZ),m("calcite-table-cell",{alignment:"center"},a.accuracyZ))):null}_renderSystemSelect(){const{messages:e,messagesCommon:t,groundCoordinates:c}=this,o="feet"===c.spatialReference.unit?e.xyzFeet:e.xyz;return m("div",{class:l.measurementsBar},m("calcite-select",{bind:this,label:e.selectUnitSystem,scale:"m",width:"full",onCalciteSelectChange:this._handleSystemSelection},m("calcite-option",{value:"Basemap"},o),m("calcite-option",{value:"XY"},e.decimalDegrees)),m("calcite-action",{icon:"copy-to-clipboard",scale:"s",slot:"control",text:"Copy",title:t.copy,onclick:()=>this.copyLocation()}))}copyLocation(){const{groundCoordinates:e}=this;if(!e)return;const t=this.getLocation();t&&s(t)}getLocation(){const{_selectedSystem:e,groundCoordinates:t,accuracy:c}=this;return"Basemap"===e?this.getBasemapLocation(t,c):this.getXYLocation(t)}getXYLocation(e){if(null==e?.longitude||null==e?.latitude)return"";const t={groundX:n(e.longitude,d),groundY:n(e.latitude,d)};return a("{groundX}° , {groundY}°",t)}getBasemapLocation(e,t){if(null==e?.x||null==e?.y)return"";const c={groundX:n(e.x,p),accuracyX:null!=t?.x?n(t.x,p):0,groundY:n(e.y,p),accuracyY:null!=t?.y?n(t.y,p):0,groundZ:null!=e.z?n(e.z,p):0,accuracyZ:null!=t?.z?n(t.z,p):0};return a("{groundX} ± {accuracyX}, {groundY} ± {accuracyY}, {groundZ} ± {accuracyZ}",c)}render(){return m("calcite-panel",{class:l.measurementResults,key:"ground-location-container"},this._renderSystemSelect(),this._renderLocationBlock(),this._renderLocationTable())}};e([t()],g.prototype,"messages",void 0),e([t(),u("esri/t9n/common")],g.prototype,"messagesCommon",void 0),e([t()],g.prototype,"groundCoordinates",void 0),e([t()],g.prototype,"accuracy",void 0),e([t()],g.prototype,"_selectedSystem",void 0),g=e([c("esri.widgets.OrientedImageryViewer.components.ImageLocationWidget")],g);const y=g;export{y as default};
2
+ import{__decorate as e}from"tslib";import{property as t,subclass as c}from"../../../core/accessorSupport/decorators.js";import{onLocaleChange as o}from"../../../intl/locale.js";import{formatNumber as a}from"../../../intl/number.js";import{substitute as n}from"../../../intl/substitute.js";import i from"../../Widget.js";import{css as l}from"../css.js";import{copyToClipboard as r}from"../imageMeasurementUtils.js";import{loadCalciteComponents as s}from"../../support/componentsUtils.js";import{tsx as m}from"../../support/widget.js";import{messageBundle as u}from"../../support/decorators/messageBundle.js";const d={minimumFractionDigits:6,maximumFractionDigits:6,useGrouping:!1},p={minimumFractionDigits:3,maximumFractionDigits:3,useGrouping:!1};let g=class extends i{constructor(e){super(e),this.messages=null,this.messagesCommon=null,this.accuracy=null,this.accuracyLoading=!1,this._selectedSystem="Basemap",this._handleSystemSelection=e=>{this._selectedSystem=e.target.value}}initialize(){this.addHandles(o(()=>this.scheduleRender()))}loadDependencies(){return s({action:()=>import("@esri/calcite-components/dist/components/calcite-action"),block:()=>import("@esri/calcite-components/dist/components/calcite-block"),icon:()=>import("@esri/calcite-components/dist/components/calcite-icon"),panel:()=>import("@esri/calcite-components/dist/components/calcite-panel"),select:()=>import("@esri/calcite-components/dist/components/calcite-select"),option:()=>import("@esri/calcite-components/dist/components/calcite-option"),table:()=>import("@esri/calcite-components/dist/components/calcite-table"),"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")})}_renderLocationBlock(){const{groundCoordinates:e,_selectedSystem:t}=this;return e&&"XY"===t?m("calcite-block",{heading:this.getLocation(),headingLevel:6}):null}_renderAccuracyValue(e,t){return e||!t?e:m("calcite-icon",{icon:"hourglass-active",scale:"s"})}_renderLocationTable(){const{groundCoordinates:e,messages:t,_selectedSystem:c,accuracy:o,accuracyLoading:n}=this,i={groundX:a(e.x,p),accuracyX:null!=o?.x?a(o.x,p):"",groundY:a(e.y,p),accuracyY:null!=o?.y?a(o.y,p):"",groundZ:null!=e.z?a(e.z,p):"",accuracyZ:null!=o?.z?a(o.z,p):""};return e&&"Basemap"===c?m("calcite-table",{bordered:!0,caption:t.measurementTable,class:l.measurementsTable,scale:"s"},m("calcite-table-row",{slot:"table-header"},m("calcite-table-header",{alignment:"center",heading:t.type}),m("calcite-table-header",{alignment:"center",heading:t.value}),m("calcite-table-header",{alignment:"center",heading:t.accuracy})),m("calcite-table-row",null,m("calcite-table-cell",{alignment:"center"},t.x),m("calcite-table-cell",{alignment:"center"},i.groundX),m("calcite-table-cell",{alignment:"center"},this._renderAccuracyValue(i.accuracyX,n))),m("calcite-table-row",null,m("calcite-table-cell",{alignment:"center"},t.y),m("calcite-table-cell",{alignment:"center"},i.groundY),m("calcite-table-cell",{alignment:"center"},this._renderAccuracyValue(i.accuracyY,n))),m("calcite-table-row",null,m("calcite-table-cell",{alignment:"center"},t.z),m("calcite-table-cell",{alignment:"center"},i.groundZ),m("calcite-table-cell",{alignment:"center"},this._renderAccuracyValue(i.accuracyZ,n)))):null}_renderSystemSelect(){const{messages:e,messagesCommon:t,groundCoordinates:c}=this,o="feet"===c.spatialReference.unit?e.xyzFeet:e.xyz;return m("div",{class:l.measurementsBar},m("calcite-select",{bind:this,label:e.selectUnitSystem,scale:"m",width:"full",onCalciteSelectChange:this._handleSystemSelection},m("calcite-option",{value:"Basemap"},o),m("calcite-option",{value:"XY"},e.decimalDegrees)),m("calcite-action",{icon:"copy-to-clipboard",scale:"s",slot:"control",text:"Copy",title:t.copy,onclick:()=>this.copyLocation()}))}copyLocation(){const{groundCoordinates:e}=this;if(!e)return;const t=this.getLocation();t&&r(t)}getLocation(){const{_selectedSystem:e,groundCoordinates:t,accuracy:c}=this;return"Basemap"===e?this.getBasemapLocation(t,c):this.getXYLocation(t)}getXYLocation(e){if(null==e?.longitude||null==e?.latitude)return"";const t={groundX:a(e.longitude,d),groundY:a(e.latitude,d)};return n("{groundX}° , {groundY}°",t)}getBasemapLocation(e,t){if(null==e?.x||null==e?.y)return"";const c={groundX:a(e.x,p),accuracyX:null!=t?.x?a(t.x,p):0,groundY:a(e.y,p),accuracyY:null!=t?.y?a(t.y,p):0,groundZ:null!=e.z?a(e.z,p):0,accuracyZ:null!=t?.z?a(t.z,p):0};return n("{groundX} ± {accuracyX}, {groundY} ± {accuracyY}, {groundZ} ± {accuracyZ}",c)}render(){return m("calcite-panel",{class:l.measurementResults,key:"ground-location-container"},this._renderSystemSelect(),this._renderLocationBlock(),this._renderLocationTable())}};e([t()],g.prototype,"messages",void 0),e([t(),u("esri/t9n/common")],g.prototype,"messagesCommon",void 0),e([t()],g.prototype,"groundCoordinates",void 0),e([t()],g.prototype,"accuracy",void 0),e([t()],g.prototype,"accuracyLoading",void 0),e([t()],g.prototype,"_selectedSystem",void 0),g=e([c("esri.widgets.OrientedImageryViewer.components.ImageLocationWidget")],g);const y=g;export{y as default};