@arcgis/core 5.2.0-next.95 → 5.2.0-next.96

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 (530) hide show
  1. package/applications/WebEditor/geometryUtils.d.ts +1 -1
  2. package/arcade/arcadeAsyncRuntime.js +1 -1
  3. package/arcade/arcadeCompiler.js +1 -1
  4. package/arcade/arcadeRuntime.js +1 -1
  5. package/arcade/containerUtils.js +1 -1
  6. package/arcade/functions/track.js +1 -1
  7. package/arcgisGlobal.d.ts +2 -0
  8. package/assets/components/assets/icon/aiAgent16.json +1 -0
  9. package/assets/components/assets/icon/aiAgent24.json +1 -0
  10. package/assets/components/assets/icon/aiAgent32.json +1 -0
  11. package/assets/components/assets/icon/aiAgents16.json +1 -0
  12. package/assets/components/assets/icon/aiAgents24.json +1 -0
  13. package/assets/components/assets/icon/aiAgents32.json +1 -0
  14. package/assets/components/assets/icon/explodeGeometry16.json +1 -0
  15. package/assets/components/assets/icon/explodeGeometry24.json +1 -0
  16. package/assets/components/assets/icon/explodeGeometry32.json +1 -0
  17. package/assets/components/assets/icon/integration16.json +1 -0
  18. package/assets/components/assets/icon/integration24.json +1 -0
  19. package/assets/components/assets/icon/integration32.json +1 -0
  20. package/assets/components/assets/icon/spatiotemporalCatalog16.json +1 -0
  21. package/assets/components/assets/icon/spatiotemporalCatalog24.json +1 -0
  22. package/assets/components/assets/icon/spatiotemporalCatalog32.json +1 -0
  23. package/assets/components/assets/input-time-zone/t9n/messages.de.json +1 -1
  24. package/assets/esri/core/workers/RemoteClient.js +1 -1
  25. package/assets/esri/core/workers/chunks/000f91a18c22377f8525.js +1 -0
  26. package/assets/esri/core/workers/chunks/{05662a663f761dd3dea5.js → 006146ad6d4a5cbf1a1f.js} +1 -1
  27. package/assets/esri/core/workers/chunks/{bd1a7e95a797e1ed4a7b.js → 013c17e07756fa465845.js} +1 -1
  28. package/assets/esri/core/workers/chunks/014eaccf2c2d357981f0.js +1 -0
  29. package/assets/esri/core/workers/chunks/{f253875feb11883deb84.js → 04d4cd66485b622403d0.js} +1 -1
  30. package/assets/esri/core/workers/chunks/05eb064f9b543890ae24.js +1 -0
  31. package/assets/esri/core/workers/chunks/05fbd1f373cfa3724f0c.js +1 -0
  32. package/assets/esri/core/workers/chunks/{26737d061c7cfbbab95c.js → 0809a55a2f9be07cc5a9.js} +1 -1
  33. package/assets/esri/core/workers/chunks/0930738f43ce09b2ed2d.js +1 -0
  34. package/assets/esri/core/workers/chunks/{691434d4c6a38e63d819.js → 0a242e76bc293b0ad04b.js} +1 -1
  35. package/assets/esri/core/workers/chunks/0a4092578dc7578bcf76.js +1 -0
  36. package/assets/esri/core/workers/chunks/0e11bee9b56a7f51b012.js +1 -0
  37. package/assets/esri/core/workers/chunks/0e65869a5dd5a3917da7.js +1 -0
  38. package/assets/esri/core/workers/chunks/0ffb5a1275d07dcd9115.js +1 -0
  39. package/assets/esri/core/workers/chunks/{e370a3337b3c90240e73.js → 105da965fc90604eb6bf.js} +1 -1
  40. package/assets/esri/core/workers/chunks/1082bb0858585bd4fa21.js +2 -0
  41. package/assets/esri/core/workers/chunks/{5235b9c21ac4156c2375.js → 10f4c5533f50c3693318.js} +1 -1
  42. package/assets/esri/core/workers/chunks/1201bb22a2bfd7d7ecba.js +1 -0
  43. package/assets/esri/core/workers/chunks/16f55c5d642a23c2547e.js +1 -0
  44. package/assets/esri/core/workers/chunks/{09e01fd1c199be0c8e03.js → 16ffbe484f6cd4736f79.js} +1 -1
  45. package/assets/esri/core/workers/chunks/{1bf967c68d0c795d3fb4.js → 19a4907fc93ae8b817e9.js} +1 -1
  46. package/assets/esri/core/workers/chunks/{f74c7cbe4bd12f73ae90.js → 19d7339f20f3008c4893.js} +1 -1
  47. package/assets/esri/core/workers/chunks/{a8aa8cb60b30f0983e7e.js → 1a9f17781e0a3bc5106f.js} +1 -1
  48. package/assets/esri/core/workers/chunks/{bf7875fda48b15271a10.js → 1bef7097fe5e402539ea.js} +1 -1
  49. package/assets/esri/core/workers/chunks/{fa377112ef3b78f6ed18.js → 1de1cc0ed0f169a58aff.js} +1 -1
  50. package/assets/esri/core/workers/chunks/{0549e2badf511e27aa54.js → 1e3b07cf0e608431a277.js} +1 -1
  51. package/assets/esri/core/workers/chunks/{2e51764c8aa31096cb2a.js → 20feca2fdd304b3e9664.js} +1 -1
  52. package/assets/esri/core/workers/chunks/{4c73c2f4331351e2a50c.js → 22ff018342860249b3eb.js} +1 -1
  53. package/assets/esri/core/workers/chunks/248df6fda489a9de5852.js +1 -0
  54. package/assets/esri/core/workers/chunks/279b16727d4b515eca44.js +1 -0
  55. package/assets/esri/core/workers/chunks/2b10d6597af3eeec5396.js +1 -0
  56. package/assets/esri/core/workers/chunks/2bd4b536e329112591c4.js +1 -0
  57. package/assets/esri/core/workers/chunks/2c01477b69c38f691e19.js +1 -0
  58. package/assets/esri/core/workers/chunks/2e2349387a2b9903f13c.js +2 -0
  59. package/assets/esri/core/workers/chunks/{4d700cb028f6306b163e.js → 32aa1529e84b839d051d.js} +1 -1
  60. package/assets/esri/core/workers/chunks/33041e50ea02d99480b0.js +1 -0
  61. package/assets/esri/core/workers/chunks/{5d7a5aa608ed6192b016.js → 349982635e921e838030.js} +1 -1
  62. package/assets/esri/core/workers/chunks/35d0a7597473d46866de.js +1 -0
  63. package/assets/esri/core/workers/chunks/374d726fdd0a9848cea5.js +1 -0
  64. package/assets/esri/core/workers/chunks/379f5ca5372d834af497.js +1 -0
  65. package/assets/esri/core/workers/chunks/37ae52c71bf9c70fbb92.js +1 -0
  66. package/assets/esri/core/workers/chunks/{05393b23ab24126d4236.js → 38bc5d09ae07f486d457.js} +1 -1
  67. package/assets/esri/core/workers/chunks/3bafa01ca01a67d09432.js +1 -0
  68. package/assets/esri/core/workers/chunks/3c7901ea007c9615ba54.js +1 -0
  69. package/assets/esri/core/workers/chunks/4047208f9559e06d7102.js +1 -0
  70. package/assets/esri/core/workers/chunks/4049e9b86c8e27a7ff12.js +1 -0
  71. package/assets/esri/core/workers/chunks/411bbdecba340df11d95.js +2 -0
  72. package/assets/esri/core/workers/chunks/42b5533f94ebcdc4befe.js +1 -0
  73. package/assets/esri/core/workers/chunks/44ca13c874b5aa0ed5a0.js +1 -0
  74. package/assets/esri/core/workers/chunks/4717831effb1ac6d5f5d.js +1 -0
  75. package/assets/esri/core/workers/chunks/{5edf77618ca51819d7c4.js → 476535cfb06ced74d611.js} +2 -2
  76. package/assets/esri/core/workers/chunks/486f1277fe834c0fc4c1.js +1 -0
  77. package/assets/esri/core/workers/chunks/48ade66f1685a1aaffba.js +1 -0
  78. package/assets/esri/core/workers/chunks/4d13c1a04788e5222678.js +1 -0
  79. package/assets/esri/core/workers/chunks/{cc3186dcbbf5edff8b9e.js → 4d7f6c92041d52cc8732.js} +1 -1
  80. package/assets/esri/core/workers/chunks/{595edbc1e9bba47d5676.js → 4f89da01b67b66a92c01.js} +1 -1
  81. package/assets/esri/core/workers/chunks/507bbcde2b39321b50a4.js +1 -0
  82. package/assets/esri/core/workers/chunks/{9b8e33985310f281f084.js → 56a5b65961e722f5cae9.js} +1 -1
  83. package/assets/esri/core/workers/chunks/5830deda121e4c95d199.js +1 -0
  84. package/assets/esri/core/workers/chunks/{b102ae764c14d8b32ace.js → 58a52adc42fbe5cd12c6.js} +1 -1
  85. package/assets/esri/core/workers/chunks/{b0e25ccb5a1e57a82628.js → 58b93f13316196d2e97d.js} +1 -1
  86. package/assets/esri/core/workers/chunks/58f98bd89b644cfdafae.js +1 -0
  87. package/assets/esri/core/workers/chunks/5a8658e4ef5163e8ab3b.js +1 -0
  88. package/assets/esri/core/workers/chunks/5aa3e1e9c701c7fef6e4.js +1 -0
  89. package/assets/esri/core/workers/chunks/5bb8d9d887dd4211afd2.js +1 -0
  90. package/assets/esri/core/workers/chunks/5d7625eb9997cd0dff09.js +1 -0
  91. package/assets/esri/core/workers/chunks/5e56a004b4407b8066eb.js +1 -0
  92. package/assets/esri/core/workers/chunks/5efc66be4576c6f67064.js +1 -0
  93. package/assets/esri/core/workers/chunks/60b1af54e7fc20fd9588.js +1 -0
  94. package/assets/esri/core/workers/chunks/6134a2c6983792787184.js +1 -0
  95. package/assets/esri/core/workers/chunks/6319413b89e23f671487.js +1 -0
  96. package/assets/esri/core/workers/chunks/{1b311ff39dede07865df.js → 633454b27c34f9ec7940.js} +1 -1
  97. package/assets/esri/core/workers/chunks/63c43ebf46964c283b4d.js +1 -0
  98. package/assets/esri/core/workers/chunks/65d3638ded62c5606ae3.js +1 -0
  99. package/assets/esri/core/workers/chunks/{aa0ef4493a7e9bed159f.js → 662f4b39ec44c68e0733.js} +1 -1
  100. package/assets/esri/core/workers/chunks/680bef5e8237cc3bdd84.js +1 -0
  101. package/assets/esri/core/workers/chunks/6835f959952f70972fce.js +1 -0
  102. package/assets/esri/core/workers/chunks/{ddf284648a73b6993737.js → 68d823697c298122ee08.js} +1 -1
  103. package/assets/esri/core/workers/chunks/6aaefd61505027267c9b.js +1 -0
  104. package/assets/esri/core/workers/chunks/6ceb17eada151230abf7.js +1 -0
  105. package/assets/esri/core/workers/chunks/6df29716f75696434807.js +1 -0
  106. package/assets/esri/core/workers/chunks/6e804bd6bb4b0ee44fa9.js +1 -0
  107. package/assets/esri/core/workers/chunks/{ee77999df3785468b2b6.js → 6f6e8b7e6e2c856e4ed1.js} +1 -1
  108. package/assets/esri/core/workers/chunks/{8ea28a4b1afe8bb2d313.js → 7091bbdc36f1f03f14b3.js} +1 -1
  109. package/assets/esri/core/workers/chunks/7608de0d942b4c16b2f6.js +1 -0
  110. package/assets/esri/core/workers/chunks/{4b6f433022a6822706cb.js → 762817d30474c15142b4.js} +1 -1
  111. package/assets/esri/core/workers/chunks/762e9a15b2638475a2b4.js +1 -0
  112. package/assets/esri/core/workers/chunks/79088d5c9c2e6a780929.js +1 -0
  113. package/assets/esri/core/workers/chunks/{f3d57c5b9dffd12e45b4.js → 7c3a89c12ea32a071ad4.js} +1 -1
  114. package/assets/esri/core/workers/chunks/7c67596c0792282afdfc.js +1 -0
  115. package/assets/esri/core/workers/chunks/7cef6e5f39137e74bbc3.js +1 -0
  116. package/assets/esri/core/workers/chunks/{87e0ceb1a64ab08e679a.js → 7fd54fa2f91cdab44ab3.js} +1 -1
  117. package/assets/esri/core/workers/chunks/822a5020afbca21df7f7.js +1 -0
  118. package/assets/esri/core/workers/chunks/8599d2f2eb0fbb4a8bf5.js +1 -0
  119. package/assets/esri/core/workers/chunks/862f7090ba4a56c07093.js +1 -0
  120. package/assets/esri/core/workers/chunks/{97c7dfd29ad4c2966cb4.js → 88252899a5291ad29710.js} +1 -1
  121. package/assets/esri/core/workers/chunks/8837fbcc0d484659b79c.js +1 -0
  122. package/assets/esri/core/workers/chunks/8dcc7749de3391710864.js +1 -0
  123. package/assets/esri/core/workers/chunks/900dad076347443b3ad9.js +1 -0
  124. package/assets/esri/core/workers/chunks/{f8f7b86bbd62106bc3d4.js → 925f83be3c1eb4b5c6af.js} +1 -1
  125. package/assets/esri/core/workers/chunks/{a4a22149077c7780481c.js → 9378ce457b02717304e6.js} +1 -1
  126. package/assets/esri/core/workers/chunks/93a7cf23f73b23fc7802.js +1 -0
  127. package/assets/esri/core/workers/chunks/93c1d1e7c0935242071e.js +1 -0
  128. package/assets/esri/core/workers/chunks/{fddcb8be714ad18ad0c8.js → 970b33947bf61fccd461.js} +1 -1
  129. package/assets/esri/core/workers/chunks/97aaff86e06380a68df8.js +1 -0
  130. package/assets/esri/core/workers/chunks/9bc7df2b8ae0ed443d13.js +1 -0
  131. package/assets/esri/core/workers/chunks/9cc14a41d4a90f6d626e.js +1 -0
  132. package/assets/esri/core/workers/chunks/9e514a58b1165e273202.js +1 -0
  133. package/assets/esri/core/workers/chunks/9fe1db0762ab3326eab4.js +1 -0
  134. package/assets/esri/core/workers/chunks/{a5bb19d2b7d7db22222b.js → a10188c4d1904965898a.js} +1 -1
  135. package/assets/esri/core/workers/chunks/a2288d44cba34d947613.js +1 -0
  136. package/assets/esri/core/workers/chunks/a26916de4c105859621e.js +1 -0
  137. package/assets/esri/core/workers/chunks/a322afbb48898ce35851.js +1 -0
  138. package/assets/esri/core/workers/chunks/a34cadd486e7fcc79063.js +1 -0
  139. package/assets/esri/core/workers/chunks/{cefb70d633c220cbedf9.js → a4dc1a80ed6604d71722.js} +1 -1
  140. package/assets/esri/core/workers/chunks/{6baae3e856d904fef9b1.js → a8f70cece5ce2b095cdd.js} +1 -1
  141. package/assets/esri/core/workers/chunks/ab332bd411d6c7d4190c.js +1 -0
  142. package/assets/esri/core/workers/chunks/{777f2fdf1f4b9f243893.js → ab3a6ce7bc2a27b92469.js} +1 -1
  143. package/assets/esri/core/workers/chunks/abd2f8fae6b918fbdd6d.js +1 -0
  144. package/assets/esri/core/workers/chunks/{b13d2da33ec07e9d41ff.js → b0da2b089a89d643df1e.js} +1 -1
  145. package/assets/esri/core/workers/chunks/{65f4ca7201e7267bfc81.js → b5fcf4165ac72654742d.js} +1 -1
  146. package/assets/esri/core/workers/chunks/b82b523b6837ed1f28d3.js +2 -0
  147. package/assets/esri/core/workers/chunks/{527b87fddf33bb5d519e.js → ba77a8892cb23c7a297d.js} +1 -1
  148. package/assets/esri/core/workers/chunks/bb8089929ded0613d8e7.js +1 -0
  149. package/assets/esri/core/workers/chunks/bc7ca87d3bfe8a4aec81.js +1 -0
  150. package/assets/esri/core/workers/chunks/bc9b96a539f28afcb8cb.js +1 -0
  151. package/assets/esri/core/workers/chunks/{2d07d5a9ec67c39ef10c.js → bd4f29d2681e5596591a.js} +1 -1
  152. package/assets/esri/core/workers/chunks/bf9eba555aebca2c132b.js +1 -0
  153. package/assets/esri/core/workers/chunks/{903c7bd079888f65fef1.js → c3fbd81bb5820e48038f.js} +1 -1
  154. package/assets/esri/core/workers/chunks/c9df18e9ff7367a004b6.js +1 -0
  155. package/assets/esri/core/workers/chunks/ca8061e0a6d78d646ebf.js +1 -0
  156. package/assets/esri/core/workers/chunks/cc73ac8404615dc392d2.js +1 -0
  157. package/assets/esri/core/workers/chunks/{e823c9ccb7bc348d8824.js → ccb26860518dce6d01c0.js} +1 -1
  158. package/assets/esri/core/workers/chunks/cded34b161fcc790e672.js +1 -0
  159. package/assets/esri/core/workers/chunks/{1bf5c0a4bc5a960a3fa2.js → d1d4979e9dcabe5e4619.js} +1 -1
  160. package/assets/esri/core/workers/chunks/d2865c604849ce79183f.js +1 -0
  161. package/assets/esri/core/workers/chunks/{9b81bd62a2c72f592db1.js → d826f6d32b4c5885276a.js} +1 -1
  162. package/assets/esri/core/workers/chunks/d92540d3ffc4af980dd8.js +1 -0
  163. package/assets/esri/core/workers/chunks/dc7853795439ae77ace9.js +1 -0
  164. package/assets/esri/core/workers/chunks/{1f047dd747e7c1916dc7.js → dd55737fba0a8fe68101.js} +3 -3
  165. package/assets/esri/core/workers/chunks/dd8d19eb6b8e955c8067.js +1 -0
  166. package/assets/esri/core/workers/chunks/dda269a088275c823b40.js +1 -0
  167. package/assets/esri/core/workers/chunks/{7b70d6fdfa7a19ffffb0.js → de95dee8db92cf8f796f.js} +1 -1
  168. package/assets/esri/core/workers/chunks/e1c8767143f9f9d1f049.js +1 -0
  169. package/assets/esri/core/workers/chunks/{2cf2f2842c19be84ab4d.js → e6cb31c727f799c1297c.js} +1 -1
  170. package/assets/esri/core/workers/chunks/e934ef66d130c212c05b.js +1 -0
  171. package/assets/esri/core/workers/chunks/{7c56446184abcd14678b.js → ea77654c8964cc39b9a6.js} +1 -1
  172. package/assets/esri/core/workers/chunks/eb167f9f6132a6348d2e.js +1 -0
  173. package/assets/esri/core/workers/chunks/ed5ac1efd3cba49be756.js +1 -0
  174. package/assets/esri/core/workers/chunks/ef24fd6c0322e5de9fdf.js +2 -0
  175. package/assets/esri/core/workers/chunks/f219ba010c480bb75684.js +1 -0
  176. package/assets/esri/core/workers/chunks/fbf2d90240d36f8b423f.js +1 -0
  177. package/assets/esri/core/workers/chunks/{4ee99e654dad6f09abee.js → fc042b9936686785c39e.js} +1 -1
  178. package/assets/esri/core/workers/chunks/fc1658eae7b312502fab.js +1 -0
  179. package/assets/esri/core/workers/chunks/{af6b9fd77b1792fbb66e.js → fd4d124c5bf810d9e352.js} +1 -1
  180. package/assets/esri/core/workers/chunks/ffa35ecc681ec1c4739a.js +1 -0
  181. package/assets/esri/core/workers/chunks/ffca0b2333e760b66d3a.js +1 -0
  182. package/config.js +1 -1
  183. package/editing/sharedTemplates/executor/builders/bufferLineToPolygon.js +1 -1
  184. package/editing/sharedTemplates/executor/builders/bufferPointToPolygon.js +1 -1
  185. package/editing/sharedTemplates/executor/builders/bufferPolygonToPolygon.js +1 -1
  186. package/editing/sharedTemplates/executor/builders/pointAtIntersectionVerticesOfLine.js +1 -1
  187. package/editing/sharedTemplates/executor/builders/support/offsetUtils.js +1 -1
  188. package/editing/sharedTemplates/executor/support/createPresetServiceEdit.js +1 -1
  189. package/geometry/Polygon.js +1 -1
  190. package/geometry/geometryEngine.d.ts +36 -36
  191. package/geometry/operators/affineTransformOperator.d.ts +30 -1
  192. package/geometry/operators/affineTransformOperator.js +1 -1
  193. package/geometry/operators/alphaShapeOperator.d.ts +49 -5
  194. package/geometry/operators/alphaShapeOperator.js +1 -1
  195. package/geometry/operators/areaOperator.d.ts +28 -4
  196. package/geometry/operators/areaOperator.js +1 -1
  197. package/geometry/operators/autoCompleteOperator.d.ts +25 -2
  198. package/geometry/operators/autoCompleteOperator.js +1 -1
  199. package/geometry/operators/boundaryOperator.d.ts +40 -2
  200. package/geometry/operators/boundaryOperator.js +1 -1
  201. package/geometry/operators/bufferOperator.d.ts +51 -6
  202. package/geometry/operators/bufferOperator.js +1 -1
  203. package/geometry/operators/centroidOperator.d.ts +23 -2
  204. package/geometry/operators/centroidOperator.js +1 -1
  205. package/geometry/operators/clipOperator.d.ts +34 -2
  206. package/geometry/operators/clipOperator.js +1 -1
  207. package/geometry/operators/containsOperator.d.ts +32 -2
  208. package/geometry/operators/containsOperator.js +1 -1
  209. package/geometry/operators/convexHullOperator.d.ts +47 -4
  210. package/geometry/operators/convexHullOperator.js +1 -1
  211. package/geometry/operators/crossesOperator.d.ts +35 -2
  212. package/geometry/operators/crossesOperator.js +1 -1
  213. package/geometry/operators/cutOperator.d.ts +23 -2
  214. package/geometry/operators/cutOperator.js +1 -1
  215. package/geometry/operators/densifyOperator.d.ts +61 -6
  216. package/geometry/operators/densifyOperator.js +1 -1
  217. package/geometry/operators/differenceOperator.d.ts +34 -2
  218. package/geometry/operators/differenceOperator.js +1 -1
  219. package/geometry/operators/disjointOperator.d.ts +33 -2
  220. package/geometry/operators/disjointOperator.js +1 -1
  221. package/geometry/operators/distanceOperator.d.ts +29 -4
  222. package/geometry/operators/distanceOperator.js +1 -1
  223. package/geometry/operators/equalsOperator.d.ts +32 -2
  224. package/geometry/operators/equalsOperator.js +1 -1
  225. package/geometry/operators/extendOperator.d.ts +29 -3
  226. package/geometry/operators/extendOperator.js +1 -1
  227. package/geometry/operators/generalizeOperator.d.ts +46 -5
  228. package/geometry/operators/generalizeOperator.js +1 -1
  229. package/geometry/operators/geodesicBufferOperator.d.ts +71 -7
  230. package/geometry/operators/geodesicBufferOperator.js +1 -1
  231. package/geometry/operators/geodesicProximityOperator.d.ts +106 -14
  232. package/geometry/operators/geodesicProximityOperator.js +1 -1
  233. package/geometry/operators/geodeticAreaOperator.d.ts +51 -5
  234. package/geometry/operators/geodeticAreaOperator.js +1 -1
  235. package/geometry/operators/geodeticDensifyOperator.d.ts +65 -6
  236. package/geometry/operators/geodeticDensifyOperator.js +1 -1
  237. package/geometry/operators/geodeticDistanceOperator.d.ts +52 -5
  238. package/geometry/operators/geodeticDistanceOperator.js +1 -1
  239. package/geometry/operators/geodeticLengthOperator.d.ts +51 -5
  240. package/geometry/operators/geodeticLengthOperator.js +1 -1
  241. package/geometry/operators/geodeticUtilsOperator.d.ts +79 -9
  242. package/geometry/operators/geodeticUtilsOperator.js +1 -1
  243. package/geometry/operators/graphicBufferOperator.d.ts +47 -4
  244. package/geometry/operators/graphicBufferOperator.js +1 -1
  245. package/geometry/operators/integrateOperator.d.ts +24 -2
  246. package/geometry/operators/integrateOperator.js +1 -1
  247. package/geometry/operators/intersectionOperator.d.ts +88 -3
  248. package/geometry/operators/intersectionOperator.js +1 -1
  249. package/geometry/operators/intersectsOperator.d.ts +32 -2
  250. package/geometry/operators/intersectsOperator.js +1 -1
  251. package/geometry/operators/isNearOperator.d.ts +31 -4
  252. package/geometry/operators/isNearOperator.js +1 -1
  253. package/geometry/operators/json/bufferOperator.js +1 -1
  254. package/geometry/operators/json/containsOperator.js +1 -1
  255. package/geometry/operators/json/convexHullOperator.js +1 -1
  256. package/geometry/operators/json/crossesOperator.js +1 -1
  257. package/geometry/operators/json/disjointOperator.js +1 -1
  258. package/geometry/operators/json/generalizeOperator.js +1 -1
  259. package/geometry/operators/json/geodesicBufferOperator.js +1 -1
  260. package/geometry/operators/json/graphicBufferOperator.js +1 -1
  261. package/geometry/operators/json/intersectionOperator.js +1 -1
  262. package/geometry/operators/json/intersectsOperator.js +1 -1
  263. package/geometry/operators/json/lengthOperator.js +1 -1
  264. package/geometry/operators/json/offsetOperator.js +1 -1
  265. package/geometry/operators/json/overlapsOperator.js +1 -1
  266. package/geometry/operators/json/projectOperator.js +1 -1
  267. package/geometry/operators/json/simplifyOperator.js +1 -1
  268. package/geometry/operators/json/simplifyOperatorOGC.js +1 -1
  269. package/geometry/operators/json/touchesOperator.js +1 -1
  270. package/geometry/operators/json/unionOperator.js +1 -1
  271. package/geometry/operators/json/withinOperator.js +1 -1
  272. package/geometry/operators/labelPointOperator.d.ts +32 -2
  273. package/geometry/operators/labelPointOperator.js +1 -1
  274. package/geometry/operators/lengthOperator.d.ts +28 -4
  275. package/geometry/operators/lengthOperator.js +1 -1
  276. package/geometry/operators/linesToPolygonsOperator.d.ts +23 -2
  277. package/geometry/operators/linesToPolygonsOperator.js +1 -1
  278. package/geometry/operators/locateBetweenOperator.d.ts +28 -2
  279. package/geometry/operators/locateBetweenOperator.js +1 -1
  280. package/geometry/operators/minimumBoundingCircleOperator.d.ts +38 -4
  281. package/geometry/operators/minimumBoundingCircleOperator.js +1 -1
  282. package/geometry/operators/multiPartToSinglePartOperator.d.ts +33 -4
  283. package/geometry/operators/multiPartToSinglePartOperator.js +1 -1
  284. package/geometry/operators/offsetOperator.d.ts +50 -5
  285. package/geometry/operators/offsetOperator.js +1 -1
  286. package/geometry/operators/overlapsOperator.d.ts +33 -2
  287. package/geometry/operators/overlapsOperator.js +1 -1
  288. package/geometry/operators/polygonOverlayOperator.d.ts +31 -5
  289. package/geometry/operators/polygonOverlayOperator.js +1 -1
  290. package/geometry/operators/polygonSlicerOperator.d.ts +72 -10
  291. package/geometry/operators/polygonSlicerOperator.js +1 -1
  292. package/geometry/operators/projectOperator.d.ts +63 -3
  293. package/geometry/operators/projectOperator.js +1 -1
  294. package/geometry/operators/proximityOperator.d.ts +71 -9
  295. package/geometry/operators/proximityOperator.js +1 -1
  296. package/geometry/operators/relateOperator.d.ts +41 -2
  297. package/geometry/operators/relateOperator.js +1 -1
  298. package/geometry/operators/reshapeOperator.d.ts +28 -2
  299. package/geometry/operators/reshapeOperator.js +1 -1
  300. package/geometry/operators/shapePreservingProjectOperator.d.ts +64 -6
  301. package/geometry/operators/shapePreservingProjectOperator.js +1 -1
  302. package/geometry/operators/simplifyOGCOperator.d.ts +72 -6
  303. package/geometry/operators/simplifyOGCOperator.js +1 -1
  304. package/geometry/operators/simplifyOperator.d.ts +72 -4
  305. package/geometry/operators/simplifyOperator.js +1 -1
  306. package/geometry/operators/singlePartToMultiPartOperator.js +1 -1
  307. package/geometry/operators/support/Transformation.d.ts +17 -11
  308. package/geometry/operators/support/jsonConverter.js +1 -1
  309. package/geometry/operators/symmetricDifferenceOperator.d.ts +33 -2
  310. package/geometry/operators/symmetricDifferenceOperator.js +1 -1
  311. package/geometry/operators/touchesOperator.d.ts +32 -2
  312. package/geometry/operators/touchesOperator.js +1 -1
  313. package/geometry/operators/types.d.ts +4 -1
  314. package/geometry/operators/unionOperator.d.ts +33 -2
  315. package/geometry/operators/unionOperator.js +1 -1
  316. package/geometry/operators/withinOperator.d.ts +32 -2
  317. package/geometry/operators/withinOperator.js +1 -1
  318. package/geometry/projectionUtils.js +1 -1
  319. package/geometry/support/geometryUtils.js +1 -1
  320. package/geometry/support/normalizeUtils.d.ts +5 -3
  321. package/geometry/support/normalizeUtils.js +1 -1
  322. package/interfaces.d.ts +202 -202
  323. package/kernel.js +1 -1
  324. package/layers/graphics/data/QueryEngineResult.js +1 -1
  325. package/layers/graphics/data/queryUtils.js +1 -1
  326. package/layers/graphics/data/spatialQuerySupport.js +1 -1
  327. package/layers/graphics/sources/support/sourceUtils.js +1 -1
  328. package/layers/mixins/ArcGISImageService.js +1 -1
  329. package/layers/mixins/TiledImagery.js +1 -1
  330. package/layers/orientedImagery/transformations/updateElevationUtils.js +1 -1
  331. package/layers/raster/datasets/FunctionRaster.js +1 -1
  332. package/layers/raster/datasets/pixelReader.js +1 -1
  333. package/layers/raster/functions/clipUtils.js +1 -1
  334. package/layers/raster/functions/rasterProjectionHelper.js +1 -1
  335. package/layers/support/Sublayer.js +1 -1
  336. package/layers/video/videoUtils.js +1 -1
  337. package/package.json +4 -4
  338. package/popup/FeatureContentCollection.d.ts +3 -3
  339. package/popup/FeatureContentCollection.js +1 -1
  340. package/smartMapping/support/adapters/InMemoryLayerAdapter.js +1 -1
  341. package/support/revision.js +1 -1
  342. package/support/tests/serviceMockDependencies.js +1 -1
  343. package/support/tests/setupServiceMocksMesh.js +1 -1
  344. package/symbols/cim/CIMEffects.js +1 -1
  345. package/symbols/cim/effects/EffectBuffer.js +1 -1
  346. package/symbols/cim/effects/EffectControlMeasureLine.js +1 -1
  347. package/symbols/cim/effects/EffectDonut.js +1 -1
  348. package/symbols/cim/effects/EffectEnclosingPolygon.js +1 -1
  349. package/symbols/cim/effects/EffectOffset.js +1 -1
  350. package/symbols/cim/effects/EffectTaperedPolygon.js +1 -1
  351. package/views/2d/analysis/AreaMeasurement/AreaMeasurementController.js +1 -1
  352. package/views/2d/analysis/DistanceMeasurement/DistanceMeasurementController.js +1 -1
  353. package/views/2d/engine/webgl/Overlay.js +1 -1
  354. package/views/2d/engine/webgl/VideoScreenRenderer.js +1 -1
  355. package/views/2d/engine/webgl/shaderGraph/techniques/labels/LabelMeshWriter.js +1 -1
  356. package/views/2d/layers/TileLayerView2D.js +1 -1
  357. package/views/2d/layers/support/RouteLayerWaypointVisualization.js +1 -1
  358. package/views/3d/analysis/ShadowCastAnalysisView3D.js +1 -1
  359. package/views/3d/analysis/VolumeMeasurement/VolumeMeasurementController.js +1 -1
  360. package/views/3d/layers/ElevationLayerView3D.js +1 -1
  361. package/views/3d/layers/ElevationLayerView3DModifications.js +1 -1
  362. package/views/3d/layers/graphics/Deconflictor.js +1 -1
  363. package/views/3d/layers/graphics/Graphics3DCore.js +1 -1
  364. package/views/3d/layers/i3s/I3SMeshViewFilter.js +1 -1
  365. package/views/MapView.d.ts +3 -3
  366. package/views/VideoView.js +1 -1
  367. package/views/View2D.d.ts +22 -22
  368. package/views/analysis/ElevationProfile/elevationProfileGeometryUtils.js +1 -1
  369. package/views/draw/DrawTool.js +1 -1
  370. package/views/draw/support/createUtils.js +1 -1
  371. package/views/layers/SceneLayerView.js +1 -1
  372. package/views/support/GeometryWorker.js +1 -1
  373. package/views/support/imageReprojection.js +1 -1
  374. package/views/video/VideoOperationalDataView.js +1 -1
  375. package/widgets/AreaMeasurement2D/AreaMeasurement2DTool.js +1 -1
  376. package/widgets/BatchAttributeForm/expressions/ExpressionsModel.js +1 -1
  377. package/widgets/BatchAttributeForm/expressions/expressionUtils.js +1 -1
  378. package/widgets/BatchAttributeForm/inputs/support/DynamicChoiceController.js +1 -1
  379. package/widgets/BatchAttributeForm/templates/FieldElementTemplate.js +1 -1
  380. package/widgets/BatchAttributeForm/templates/support/createBatchFormTemplate.js +1 -1
  381. package/widgets/DistanceMeasurement2D/DistanceMeasurement2DTool.js +1 -1
  382. package/widgets/Editor/support/mergeFeaturesUtils.js +1 -1
  383. package/widgets/Editor/support/splitFeatureUtils.js +1 -1
  384. package/widgets/ElevationProfile/support/ElevationProfileView.js +1 -1
  385. package/widgets/ElevationProfile/support/InputRepresentation2D.js +1 -1
  386. package/widgets/ElevationProfile/support/InputRepresentation3D.js +1 -1
  387. package/widgets/ElevationProfile/support/geometryUtils.js +1 -1
  388. package/widgets/FeatureForm/FeatureFormUtilityNetworkAssociations/UtilityNetworkAssociationItemList.js +1 -1
  389. package/widgets/Features/FeaturesViewModel.js +1 -1
  390. package/widgets/Features.js +1 -1
  391. package/widgets/FloorFilter/FloorFilterViewModel.js +1 -1
  392. package/widgets/OrientedImageryViewer/OrientedImageryViewerViewModel.js +1 -1
  393. package/widgets/OrientedImageryViewer/adapters/view/MapViewAdapter.js +1 -1
  394. package/widgets/OrientedImageryViewer/components/ImageViewerViewModel.js +1 -1
  395. package/widgets/OrientedImageryViewer/components/OrientedImageryVideoViewModel.js +1 -1
  396. package/widgets/OrientedImageryViewer/imageMeasurementUtils.js +1 -1
  397. package/widgets/OrientedImageryViewer/support/panConstraint.js +1 -1
  398. package/widgets/OrientedImageryViewer/support/superimposeUtils.js +1 -1
  399. package/widgets/OrientedImageryViewer/videoViewerUtils.js +1 -1
  400. package/widgets/Print.js +1 -1
  401. package/widgets/Search/SearchViewModel.js +1 -1
  402. package/widgets/Search/support/layerSearchUtils.js +1 -1
  403. package/widgets/Search/support/locatorUtils.js +1 -1
  404. package/widgets/UtilityNetworkTrace/support/GeometryHandler.js +1 -1
  405. package/widgets/support/FilterBuilder/FilterBuilderViewModel.d.ts +104 -0
  406. package/widgets/support/FilterBuilder/FilterBuilderViewModel.js +1 -1
  407. package/widgets/support/FilterBuilder.js +1 -1
  408. package/widgets/support/FilterCondition/FilterConditionViewModel.d.ts +145 -0
  409. package/widgets/support/FilterCondition/FilterConditionViewModel.js +1 -1
  410. package/widgets/support/FilterCondition/types.d.ts +20 -0
  411. package/widgets/support/ItemList.js +1 -1
  412. package/widgets/support/SelectionList/FeatureItem.d.ts +17 -68
  413. package/widgets/support/SelectionList/FeatureItem.js +1 -1
  414. package/widgets/support/SelectionList/GroupLayerItem.d.ts +12 -50
  415. package/widgets/support/SelectionList/GroupLayerItem.js +1 -1
  416. package/widgets/support/SelectionList/ItemBase.d.ts +14 -44
  417. package/widgets/support/SelectionList/ItemBase.js +1 -1
  418. package/widgets/support/SelectionList/LayerItem.d.ts +10 -56
  419. package/widgets/support/SelectionList/LayerItem.js +1 -1
  420. package/widgets/support/SelectionList/types.d.ts +4 -4
  421. package/widgets/support/Selector2D/selectorUtils.js +1 -1
  422. package/assets/esri/core/workers/chunks/090ea7a131f8f60203ed.js +0 -1
  423. package/assets/esri/core/workers/chunks/0b4a7209b99227a842ad.js +0 -1
  424. package/assets/esri/core/workers/chunks/0be98adfef79fc5036f0.js +0 -1
  425. package/assets/esri/core/workers/chunks/0d2e2d90a4e4a28e2c0c.js +0 -1
  426. package/assets/esri/core/workers/chunks/0d7763d39a5a8586a0ae.js +0 -1
  427. package/assets/esri/core/workers/chunks/0d95f72e1c07ab867d21.js +0 -1
  428. package/assets/esri/core/workers/chunks/0dbbac7a2378728571a7.js +0 -1
  429. package/assets/esri/core/workers/chunks/0df9864ecebe6a2b973f.js +0 -1
  430. package/assets/esri/core/workers/chunks/104d74bc36c28c519396.js +0 -1
  431. package/assets/esri/core/workers/chunks/1670e9867efde4d7a6d6.js +0 -1
  432. package/assets/esri/core/workers/chunks/1c803eef9a8fdabc61e3.js +0 -2
  433. package/assets/esri/core/workers/chunks/1e192ac0533a5c0b5a7a.js +0 -1
  434. package/assets/esri/core/workers/chunks/1fe077f57a087c0e9119.js +0 -1
  435. package/assets/esri/core/workers/chunks/20f7b5fe64a217cb3d3d.js +0 -1
  436. package/assets/esri/core/workers/chunks/212222b64039d436b9a6.js +0 -1
  437. package/assets/esri/core/workers/chunks/24944b625ed8dcd904f0.js +0 -1
  438. package/assets/esri/core/workers/chunks/2b6d261fe79fe186fb22.js +0 -1
  439. package/assets/esri/core/workers/chunks/2bc3e7f394386fa75447.js +0 -1
  440. package/assets/esri/core/workers/chunks/30af0f7c4cfa541c9efd.js +0 -1
  441. package/assets/esri/core/workers/chunks/30d816bdeea00f6fa1ca.js +0 -1
  442. package/assets/esri/core/workers/chunks/35d46c2f658a8e92d913.js +0 -1
  443. package/assets/esri/core/workers/chunks/36e35a8067b18f59cc05.js +0 -1
  444. package/assets/esri/core/workers/chunks/3869dca884d7ca6488f5.js +0 -1
  445. package/assets/esri/core/workers/chunks/3f5234120d3a14186c1c.js +0 -1
  446. package/assets/esri/core/workers/chunks/45c1c90ac6c14657f3ff.js +0 -1
  447. package/assets/esri/core/workers/chunks/4a40b894ec89b0a4f9bf.js +0 -1
  448. package/assets/esri/core/workers/chunks/5165d367328ac7badf47.js +0 -1
  449. package/assets/esri/core/workers/chunks/5168bd8ab6233dc9c32a.js +0 -1
  450. package/assets/esri/core/workers/chunks/545bec045167c433af8f.js +0 -1
  451. package/assets/esri/core/workers/chunks/5782c0362a1799ceef41.js +0 -1
  452. package/assets/esri/core/workers/chunks/59598023c0aea62a6297.js +0 -1
  453. package/assets/esri/core/workers/chunks/59f0a2bd40b033ce77e4.js +0 -1
  454. package/assets/esri/core/workers/chunks/5af16937904c06fb06f6.js +0 -1
  455. package/assets/esri/core/workers/chunks/5b8591486f33627f5389.js +0 -1
  456. package/assets/esri/core/workers/chunks/6057a79c68c33ee4a193.js +0 -1
  457. package/assets/esri/core/workers/chunks/607acd9f615f87e14075.js +0 -1
  458. package/assets/esri/core/workers/chunks/62ee6c247f783acabb74.js +0 -1
  459. package/assets/esri/core/workers/chunks/63127e3b22e7eac6003d.js +0 -2
  460. package/assets/esri/core/workers/chunks/6564f17c4700dc8d9c0e.js +0 -2
  461. package/assets/esri/core/workers/chunks/678585509706755c0434.js +0 -2
  462. package/assets/esri/core/workers/chunks/691e9cc541cfaebe1776.js +0 -1
  463. package/assets/esri/core/workers/chunks/6a2d890640b2cd6c5ccb.js +0 -1
  464. package/assets/esri/core/workers/chunks/6b84982dfaf084a61b93.js +0 -1
  465. package/assets/esri/core/workers/chunks/6cbc30b31f0bb39c73ca.js +0 -1
  466. package/assets/esri/core/workers/chunks/6f01bd01b13662eb3bd7.js +0 -1
  467. package/assets/esri/core/workers/chunks/74cd9df85c4560bb8e52.js +0 -1
  468. package/assets/esri/core/workers/chunks/75bddfe2be64379db8fd.js +0 -1
  469. package/assets/esri/core/workers/chunks/7cf903db44f3647c8fd4.js +0 -1
  470. package/assets/esri/core/workers/chunks/7ddb5800777fbecee3a8.js +0 -1
  471. package/assets/esri/core/workers/chunks/7eae9053065d3d38e54e.js +0 -1
  472. package/assets/esri/core/workers/chunks/80f38ab2b7ae61e6f301.js +0 -1
  473. package/assets/esri/core/workers/chunks/854f42f16fdb40000aae.js +0 -1
  474. package/assets/esri/core/workers/chunks/87094044458b0ea5cb0f.js +0 -2
  475. package/assets/esri/core/workers/chunks/88f03352a4dc6184ea1f.js +0 -1
  476. package/assets/esri/core/workers/chunks/909ee7d2a0eec773037a.js +0 -1
  477. package/assets/esri/core/workers/chunks/91ac9328afff8a51bd96.js +0 -1
  478. package/assets/esri/core/workers/chunks/9246e2468528650bdc7c.js +0 -1
  479. package/assets/esri/core/workers/chunks/92a6559a6999b26362d7.js +0 -1
  480. package/assets/esri/core/workers/chunks/94ddfe165ac25aef8229.js +0 -1
  481. package/assets/esri/core/workers/chunks/9509bef285929c52c244.js +0 -1
  482. package/assets/esri/core/workers/chunks/99966339b061eb9945b8.js +0 -1
  483. package/assets/esri/core/workers/chunks/99f627938dbf0152fc02.js +0 -1
  484. package/assets/esri/core/workers/chunks/9df38cadebf8e6fd746c.js +0 -1
  485. package/assets/esri/core/workers/chunks/9e2b3754a76e0dd4a94a.js +0 -1
  486. package/assets/esri/core/workers/chunks/a0565137027c83108953.js +0 -1
  487. package/assets/esri/core/workers/chunks/a0eb882a5a81d25b9153.js +0 -1
  488. package/assets/esri/core/workers/chunks/a785e827f0215a73103d.js +0 -1
  489. package/assets/esri/core/workers/chunks/abe7670db06b27c0c8c8.js +0 -1
  490. package/assets/esri/core/workers/chunks/b19cff0e43fab2632660.js +0 -1
  491. package/assets/esri/core/workers/chunks/b333de4dea14c5db0a4d.js +0 -1
  492. package/assets/esri/core/workers/chunks/b6af90be328ebda26b8d.js +0 -1
  493. package/assets/esri/core/workers/chunks/b7c0da9d255d5e48320d.js +0 -1
  494. package/assets/esri/core/workers/chunks/bd7d87d175ba933ab2ce.js +0 -1
  495. package/assets/esri/core/workers/chunks/be0417df35a7d99af675.js +0 -1
  496. package/assets/esri/core/workers/chunks/c30b6bbabd05e4976fba.js +0 -1
  497. package/assets/esri/core/workers/chunks/c35553d07ad169910742.js +0 -1
  498. package/assets/esri/core/workers/chunks/c5c2fed38e0ccf84f1fa.js +0 -1
  499. package/assets/esri/core/workers/chunks/c88bfa51d2a8a024fc24.js +0 -1
  500. package/assets/esri/core/workers/chunks/ca36d85a47179d95f2fc.js +0 -1
  501. package/assets/esri/core/workers/chunks/d0cf9ff48f051adbd455.js +0 -1
  502. package/assets/esri/core/workers/chunks/d1304d414b1fa725168a.js +0 -1
  503. package/assets/esri/core/workers/chunks/d24125a791247019e2ca.js +0 -1
  504. package/assets/esri/core/workers/chunks/d26be8313526ecea9c68.js +0 -1
  505. package/assets/esri/core/workers/chunks/d2cb3d5ef0a9285afb78.js +0 -1
  506. package/assets/esri/core/workers/chunks/d4b0012ae1d3b8a9ba01.js +0 -1
  507. package/assets/esri/core/workers/chunks/e018cbd97e6e0e4ca5c4.js +0 -1
  508. package/assets/esri/core/workers/chunks/e39bccc000c768120a32.js +0 -1
  509. package/assets/esri/core/workers/chunks/e4380706b629729f2212.js +0 -1
  510. package/assets/esri/core/workers/chunks/ea1877ce00da3b585a30.js +0 -1
  511. package/assets/esri/core/workers/chunks/ea5ee1b12b43594592a0.js +0 -1
  512. package/assets/esri/core/workers/chunks/ea91c57a0b31f3f65ee5.js +0 -1
  513. package/assets/esri/core/workers/chunks/eafc591e1a98000d54ef.js +0 -1
  514. package/assets/esri/core/workers/chunks/ef851a2cff76fd211c07.js +0 -1
  515. package/assets/esri/core/workers/chunks/f3e53be08ab9dbdf17ae.js +0 -1
  516. package/assets/esri/core/workers/chunks/f53010adb70463b75bb9.js +0 -1
  517. package/assets/esri/core/workers/chunks/f5a058a0ce006bce2a2a.js +0 -1
  518. package/assets/esri/core/workers/chunks/f5f5b54cab722abe88e0.js +0 -1
  519. package/assets/esri/core/workers/chunks/f60ed579981913d44675.js +0 -1
  520. package/assets/esri/core/workers/chunks/f6f56f3e011dcef90bbb.js +0 -1
  521. package/assets/esri/core/workers/chunks/f83c3597e9332bd991eb.js +0 -1
  522. package/assets/esri/core/workers/chunks/f9a4387f850d85c44ca5.js +0 -1
  523. package/assets/esri/core/workers/chunks/fdd0e6d9927d3c43b0d3.js +0 -1
  524. package/geometry/operators/importUtils.js +0 -2
  525. /package/assets/esri/core/workers/chunks/{1c803eef9a8fdabc61e3.js.LICENSE.txt → 1082bb0858585bd4fa21.js.LICENSE.txt} +0 -0
  526. /package/assets/esri/core/workers/chunks/{87094044458b0ea5cb0f.js.LICENSE.txt → 2e2349387a2b9903f13c.js.LICENSE.txt} +0 -0
  527. /package/assets/esri/core/workers/chunks/{678585509706755c0434.js.LICENSE.txt → 411bbdecba340df11d95.js.LICENSE.txt} +0 -0
  528. /package/assets/esri/core/workers/chunks/{5edf77618ca51819d7c4.js.LICENSE.txt → 476535cfb06ced74d611.js.LICENSE.txt} +0 -0
  529. /package/assets/esri/core/workers/chunks/{6564f17c4700dc8d9c0e.js.LICENSE.txt → b82b523b6837ed1f28d3.js.LICENSE.txt} +0 -0
  530. /package/assets/esri/core/workers/chunks/{63127e3b22e7eac6003d.js.LICENSE.txt → ef24fd6c0322e5de9fdf.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,deg2rad as p}from"../../core/mathUtils.js";import{destroyMaybe as m,abortMaybe as g}from"../../core/maybe.js";import{EsriPromise as v}from"../../core/Promise.js";import{isAbortError as y,throwIfAborted as f,waitTick as w}from"../../core/promiseUtils.js";import _ from"../../core/ReactiveMap.js";import{whenOnce as F,on as b,watch as M,syncAndInitial as V,initial as S,when as I}from"../../core/reactiveUtils.js";import{sqlAnd as P}from"../../core/sql.js";import{getMetersPerUnitForSR as C}from"../../core/units.js";import{property as A,subclass as k}from"../../core/accessorSupport/decorators.js";import{isSerializable as O}from"../../core/support/jsonUtils.js";import{UpdatingHandles as T}from"../../core/support/UpdatingHandles.js";import L from"../../geometry/Extent.js";import G from"../../geometry/Point.js";import{projectAsync as E}from"../../geometry/projectionUtils.js";import j from"../../geometry/SpatialReference.js";import{polygonCentroidPoint as x}from"../../geometry/support/centroid.js";import{isClockwise as R}from"../../geometry/support/coordsUtils.js";import{normalizeMapX as B}from"../../geometry/support/normalizeUtils.js";import{geographicToWebMercator as D}from"../../geometry/support/webMercatorUtils.js";import H from"../../layers/GraphicsLayer.js";import z from"../../layers/MediaLayer.js";import{searchImages as N,getSortedLayerFeatures as U}from"../../layers/orientedImagery/queries.js";import{calculateSuitabilities as q}from"../../layers/orientedImagery/core/bestImageUtils.js";import{createCoveragePolygon as W,computePolygonForInspection as $,resizePolygon as Z,checkIfPolygonContainsSelectedPoint as J}from"../../layers/orientedImagery/core/coverageUtils.js";import{isElevationSource as K}from"../../layers/orientedImagery/core/ElevationSourceDefinitions.js";import{getMetersPerUnitOfSR as Q,convertGeographicToWebMercator as X}from"../../layers/orientedImagery/core/utils.js";import Y from"../../layers/orientedImagery/transformations/updateElevation.js";import{getElevationSampler as ee}from"../../layers/orientedImagery/transformations/updateElevationUtils.js";import{or as te,getInitialAngle as ie,convertPixelLocationToSphereVertex as re,getUpdateElevationProps as ae,getImageToWorldProperties as oe,getImageToWorldPanoramicProperties as se}from"../../layers/orientedImagery/transformations/utils.js";import ne from"../../layers/support/ExtentAndRotationGeoreference.js";import{getFloorFilterClause as le}from"../../layers/support/floorFilterUtils.js";import de from"../../layers/support/VideoElement.js";import ce from"../../views/MapView.js";import ue from"../../views/draw/Draw.js";import{scale as he}from"../../views/draw/support/drawUtils.js";import{ViewEventPriorities as pe}from"../../views/input/InputManager.js";import me from"../PanoramicVideoViewer.js";import ge from"../PanoramicViewer.js";import{defaultAngleThresholdInDegrees as ve,videoMapViewConstraint as ye,fixedImageSize as fe,clockwiseDirections as we,videoFitScaleTolerance as _e,videoExtent as Fe,invalidCameraHeading as be,sectorsInOrder as Me,sampleExtent as Ve,sectorsRadii as Se}from"./constants.js";import{isFeatureAttachment as Ie}from"./galleryUtils.js";import{crossSymbol as Pe,crossSymbol3D as Ce,measurementPolygonSymbol as Ae,polylineSymbolPanoramic as ke,measurementPolylineSymbol as Oe,cameraOverlaySymbol3D as Te,cameraOverlaySymbol as Le,diamondSymbol as Ge,diamondSymbol3D as Ee,activeSourcePointSymbol as je,sourcePointSymbol as xe}from"./symbols.js";import{registryKeys as Re}from"./types.js";import{isNoAttachmentError as Be,extractHorizonAnglesFromMedia as De,isTifOrMrf as He,filterOILLayerView as ze,assignElevationSampleToFeatures as Ne,filterByZ as Ue,createPanoramicMedia as qe,createNonPanoramicMedia as We,isSceneView as $e,isGraphic as Ze,calculateSegment as Je,calculateDirection as Ke}from"./utils.js";import{disableVideoZoomAndPan as Qe,getUpdatedConstraints as Xe,getUpdatedExtentPoints as Ye,isSelectedPointWithinVideoFootprint as et,isVideoPixelWithinFrame as tt}from"./videoViewerUtils.js";import it from"./components/ImageViewer.js";import rt from"./components/NavigationNode.js";import at from"./components/OrientedImageryVideoViewModel.js";import{NoFeatureFoundWithObjectIdError as ot}from"./navigation/errors.js";import{queryFeatureByObjectIds as st}from"./navigation/queries.js";import{ImageMeasurementService as nt}from"./services/ImageMeasurementService.js";import lt from"./services/SuperimposeService.js";import{configureSketchTool as dt,extractFieldsFromDataCaptureLayer as ct,constructGraphicFromImageGeometry as ut}from"./support/dataCaptureUtils.js";import{removeZFromGeometry as ht,imageSpaceToPoint as pt}from"./support/geometryUtils.js";import mt from"./support/resolveMediaProps.js";import{isValidDataCaptureLayer as gt}from"./support/typeUtils.js";const vt=()=>new n("orientedimageryviewer:sketch-not-initialized","Sketch property is not initialized, call loadSketch first");let yt=class extends(l(v)){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=ve,this.cameraPitchThreshold=ve,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){y(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){y(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 it,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 _,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 ce({map:new Map,constraints:ye}),this.verticalFilterEnabled=!1,this._adapter=null,this._highlightedFeatureHandle=null,this._imageViewer=new it,this._initialCurrentCoverageUpdate=!0,this._locationViewModel=null,this._measurementService=null,this._mediaPrefetcher=null,this._navigationManager=null,this._overlays=new H({listMode:"hide",internal:!0,elevationInfo:{mode:"absolute-height"},title:"OrentedImageryViewerViewModel overlays layer"}),this._superimposePreviousCurrentCoverageVisible=null,this._superimposeService=new lt({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 me,this._panoramicViewer=new ge,this._panoramicMeasurementViewer=new ge,this._referencePointOnGround=null,this._referencePointOnImage=null,this._referenceTransformationService=null,this._sectorData=null,this._transformationService=null,this._featureToSector=null,this._updatingHandles=new T,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 f(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){y(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)){m(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)=>(f(t),this.currentBestFeature=this.features?.find(({attributes:t})=>`${t.objectId}`==`${e}`),F(()=>{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?fe:"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(Re.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,pe.DEFAULT),Re.click)},this._createImageClickHandle=()=>{this.removeHandles(Re.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=b(()=>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&&!te(!d,l.spatialReference.equals(d))&&(l=await E(l,d,{signal:r})),f(r),this.plotReferencePointOnGround(l)})});this.addHandles([m,h],Re.imageClick)},this._createTriangularImageClickHandle=()=>{this.removeHandles(Re.triangularImageClick),this.triangularMeasurementActive&&"none"!==this.mode&&this.currentBestFeature&&this.currentBestFeatureMeasurementImage&&this.activeTriangulatedViewer&&this.addHandles(this.activeTriangulatedViewer.imageRenderer.on("double-click",this._measurementImageClickHandler),Re.triangularImageClick)},this._enablePan=()=>{this.removeHandles(Re.videoPanHandles)},this._disablePan=()=>{this.removeHandles(Re.videoPanHandles),this.addHandles(Qe(this.videoMapView),Re.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 F(()=>!0===this.videoElement?.loaded,i),`${this.currentBestFeature?.attributes.objectId}`!=`${t}`)return;await this.transformAndPlotSelectedLocation(i)}catch(r){y(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;f(e),this.depthImage=new o({url:a});try{await this.depthImage.load(e)}catch(s){y(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),f(e),await this.transformAndPlotSelectedLocation(e)}catch(a){y(a)||this.loadImageError(a)}},this._loadVideo=async e=>{const{currentBestFeature:t,mode:i,selectedPoint:r}=this,a=t?.attributes.imagePath;if(!t||"panoramic-video"!==i||!a)return;const{attributes:o}=t,{cameraPitch:s,cameraOrientation:n,location:l}=o,d=l.spatialReference.isWGS84&&4!==n?.type?D(l):new G(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 ie(d,r)-t),this._panoramicVideoViewer.pitch=s??0,this._panoramicVideoViewer.yaw=t,await this._panoramicVideoViewer.loadVideo(e),f(e)}catch(c){y(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 mt(t.attributes,e,i),f(i)}catch(v){if(y(v))return;return Be(v)?(u.getLogger(this).error(v),void this.setMessage("noAttachment","error",`${e.objectIdField}: ${t.attributes.objectId}`)):(u.getLogger(this).error(v,{[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 ie(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 ie(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),f(e)}catch(a){y(a)||this.loadImageError(a)}},this._loadMediaPrefetcher=async e=>{if(!this._mediaPrefetcher){const{default:t}=await(import("./support/MediaPrefetcher.js"));f(e),this._mediaPrefetcher=new t({maxEntries:this.preloadMediaSize*we.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"));f(e),this._adapter=new t(this);break}case"3d":{const{default:t}=await(import("./adapters/view/SceneViewAdapter.js"));f(e),this._adapter=new t(this);break}}else this._adapter=null},this._mapImageConversionToolViewClickHandler=e=>{if(e.stopPropagation(),e.preventDefault(),e.mapPoint){const t=e.mapPoint;t.x=B(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-_e,r=Xe(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 f(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 w(i),!e)return;const r=new G({...O(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:Pe}),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=De(r),o=re(e,...i,a);this._crossSymbol=new t({geometry:new G(o,j.WebMercator),symbol:Ce}),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([M(()=>this.view,()=>this.load(),V),M(()=>this.view?.map,(e,t)=>{t?.layers.remove(this._overlays),e?.layers.add(this._overlays)},S),M(()=>this.view?.map?.allLayers?.length,e=>{e&&this.view?.map?.layers.reorder(this._overlays,e-1)},S),M(()=>[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()},V),M(()=>[this.triangularMeasurementActive,this.currentBestFeatureMeasurementImage],()=>{this._createTriangularImageClickHandle()},V),M(()=>[this.state,this.imageLocationToolState,this.view],()=>{this._initializeMeasurementService(),this._initializeLocationViewModel()},V),M(()=>this.measureType,()=>{this.clearPreviousMeasurements(),this._initializeMeasurementService()},V),M(()=>this.bestFeatureAngle,(e,t)=>{this.previousFeatureAngle=t??0},V),M(()=>[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()},V),M(()=>this._getSuperimposeCameraWatchState(),()=>this._handleSuperimposeCameraChange(),V),M(()=>this.currentBestFeature,async(e,t)=>{g(this._featureChangedTask),this._featureChangedTask=a(async i=>this.determineWorkflowForFeature.apply(this,[e,t,{signal:i}])),await this._featureChangedTask.promise},{sync:!0}),M(()=>[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}),f(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()})},V),M(()=>this.currentBestFeatureMeasurementImage,(e,t)=>{g(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}),f(i),this._reorderTriangularSketchLayer()})},V),M(()=>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())}),M(()=>this.mode,e=>{switch(this.removeHandles(Re.interactionHandles),e){case"default":this.addHandles(M(()=>{const{state:e}=this;return"image-loaded"===e?this._imageViewer.imagePointsInView:null},e=>{e&&(g(this._updateFootprintTask),this._updateFootprintTask=a(async t=>{await this.updateFootprint(e,void 0,{signal:t})}))},{...V,equals:(e,t)=>i(e,t,c)}),Re.interactionHandles);break;case"video":this.addHandles(M(()=>{const{footprintExtent:e,videoElement:t,bestFeatureFootprint:i}=this;if(e&&t?.loaded&&i)return{videoExtent:Fe,bestFeatureFootprint:i}},e=>{e?.videoExtent&&e?.bestFeatureFootprint&&(g(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)}))},{...V,equals:(e,t)=>i(e?.videoExtent,t?.videoExtent,c)&&e?.bestFeatureFootprint===t?.bestFeatureFootprint}),Re.interactionHandles);break;case"panoramic":this.addHandles(M(()=>{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),g(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)}),Re.interactionHandles);break;case"panoramic-video":this.addHandles(M(()=>{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;g(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}),f(e),this._updateFootprintTask=null})},{equals:(e,t)=>i(e,t,c)}),Re.interactionHandles)}},V),M(()=>[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)},V),M(()=>this.activeViewer?.imageRenderer,()=>{this.sketch&&(this.sketch.view=this.activeViewer?.imageRenderer)}),M(()=>this.activeViewer,e=>{this.removeHandles(Re.hittestHandles),e&&this.addHandles(b(()=>e,"hittest-response",this._handleImageHitTestResponse),Re.hittestHandles)}),M(()=>this.videoMapView.extent,async()=>{this._scheduleVideoInteractionUpdate();const e=this.videoViewModel?.closestFeature;e&&(g(this._updateFootprintTask),this._updateFootprintTask=a(async t=>{const i={points:this.videoExtentPoints,feature:e,options:{signal:t}};await this.updateVideoFootprint(i)}))}),M(()=>[this.videoMapView.interacting,this.videoMapView.navigating,this.videoMapView.scale],()=>{this._scheduleVideoInteractionUpdate()},{initial:!0}),I(()=>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=g(this._updateFootprintTask),this._clickTask=g(this._clickTask),this._restoreSuperimposeMediaTask=g(this._restoreSuperimposeMediaTask),this.coverageFrustums.destroy(),this.coveragePolygons.destroy(),this.pointSources.destroy(),this.additionalFootprints.destroy(),this.additionalCameraLocations.destroy(),this.bestFeatureFootprint=m(this.bestFeatureFootprint),this.bestFeatureCurrentFootprint=m(this.bestFeatureCurrentFootprint),this.videoViewModel=m(this.videoViewModel),this._locationViewModel=m(this._locationViewModel),this.clearSelectedPointOnViewer(),this._referencePointOnGround=m(this._referencePointOnGround),this.clearReferencePointOnImage(),this._superimposeService.destroy(),this._overlays&&this.view?.map?.remove(this._overlays),this._overlays.destroy(),this._imageViewer.destroy(),this.imageMeasurementViewer.destroy(),this._panoramicViewer.destroy(),this._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!He(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 He(t)||Ie(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===be}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(ze(e))}get layerFloorFilterClause(){const{layerView:e}=this;return e?le(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?Me.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 He(a)||Ie(a)?{url:a,objectId:t,rotation:(i??0)+(r??0)}:null}).filter(r)):null}get videoExtentPoints(){const e=Ye(this.videoMapView.extent);return e.length?e:Fe}set view(e){this._set("view",e)}get _defaultGraphicsLayer(){const e={blendMode:"source-atop"};switch(this.mode){case"panoramic":return new H({...e,elevationInfo:{mode:"absolute-height"}});case"default":return new H({...e});default:return}}get _overlaysView(){return this.view?.layerViews.find(({layer:e})=>e===this._overlays)}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=m(this.bestFeatureCurrentFootprint),this._restoreSuperimposeMediaTask=g(this._restoreSuperimposeMediaTask),this._superimposeService.clear(),this._overlays?.removeAll()}async calculateLocationAccuracy(e){return this._measurementService?.calculateLocationAccuracy(e)}clearLocationPointOnImage(e=!1){this.locationPointOnImage&&!e&&(this._imageViewer.removeGraphic(this.locationPointOnImage),this._panoramicViewer.removeGraphic(this.locationPointOnImage),this.locationPointOnImage=m(this.locationPointOnImage)),this.correctedLocationPointOnImage&&(this.imageMeasurementViewer.removeGraphic(this.correctedLocationPointOnImage),this._panoramicMeasurementViewer.removeGraphic(this.correctedLocationPointOnImage),this.correctedLocationPointOnImage=m(this.correctedLocationPointOnImage))}clearPreviousMeasurements(){this.clearMeasurementGraphics(),this.resetMeasurementData(),this.stopMeasurement()}clearPreviousGroundLocation(){this.groundCoordinates=null,this.groundCoordinatesAccuracy=null,this.groundCoordinatesAccuracyLoading=!1,this.pixelCoordinates=null,this.clearLocationPointOnImage()}clearMeasurementGraphics(){this.measurementGraphic&&(this.activeViewer?.removeGraphic(this.measurementGraphic),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 vt();dt(r,e,i),await i.create(e,{...t,defaultZ:0})}digitizeDelete(){if(!this.sketch)throw vt();return this.sketch.delete()}digitizeDuplicate(){if(!this.sketch)throw vt();return this.sketch.duplicate()}digitizePlace(e,t){if(!this.sketch)throw vt();return this.sketch.place(e,t)}digitizeRedo(){if(!this.sketch)throw vt();return this.sketch.redo()}digitizeUndo(){if(!this.sketch)throw vt();return this.sketch.undo()}digitizeUpdate(e,t){if(!this.sketch)throw vt();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}=W(n);if(l=d.clone(),n.isInspection&&(l=$(n)),s&&(l=Z(l,s)),i||!t||J(l,t)){o.push(e);const{geometry:t,objectId:i,cameraHeight:s,cameraHeading:l}=n,u=t.clone();u.z=s/Q(t.spatialReference),u.imageID=i,this.pointSources.push(u),l!==be&&(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?.[Me[e]],i=t?.at(0);i&&(this.triangularMeasurementActive&&this.currentBestFeature?this._updateImageMeasurementBestFeature(i):this._updateCurrentBestFeature(i))}handleFeatureClick(e){const{sector:t,featureIndexInSector:i}=e;if(isNaN(i))return;const r=this._sectorData?.[t],a=r?.at(i);a&&(this.triangularMeasurementActive&&this.currentBestFeature?this._updateImageMeasurementBestFeature(a):this._updateCurrentBestFeature(a))}load(e){return this.addResolvingPromise(this._loadViewAdapter(e).catch(e=>{if(!y(e))throw e})),this}async loadBestImage(e,t){return this.selectedPoint=X(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(f(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;f(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(f(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);f(i),await this._updateElevationOfSelectedPointAndLocations(a,t,n),f(i),Ne(a,n);let l=a;if(this.layer?.verticalSearchRange&&this.layer.hasZ&&this.verticalFilterEnabled&&(l=Ue(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 f(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=Ae(s),this.sketch.polylineSymbol="panoramic"===o?ke:Oe(s,2.5))}async startHeightMeasurement(){this.displayNewMeasurementButton=!1,this.draw??=new ue({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}=W(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:P(`${o.objectIdField} <> ${p.attributes.objectId}`,P(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?Te():Le();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}=W(p.attributes);try{const{imageGeometryField:t,oiObjectIdField:i}=ct(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&&gt(e,v,y)&&`${n[y]}`==`${p.attributes.objectId}`)try{const r=h?d.horizonAngles:De(a?.media),u=ut(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 Me.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 G({...e.toJSON()}),symbol:Ge}),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=g(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||ht(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 N(e,t);i&&await this.processFeatureResponse(i,e.point,t)}catch(i){y(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);f(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=m(this.sketchAdapter),this.sketch=m(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 E(i,s.spatialReference);a=s.contains(e);break}case"mesh":{const e=i.spatialReference.equals(s.spatialReference)?i:await E(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:fe,footprintExtent:this.footprintExtent},r):await this._transformationService.pointToPixel(i,r);if(n)return f(r),this.plotReferencePointOnImage(n),{x:n.x,y:n.y};this.clearReferencePointOnImage()}async updateFeatureCache(e,t){const i=await U(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=De(a),s=pt(e,"panoramic",r,o);this._referencePointOnImage=new t({geometry:s,symbol:Ee.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=pt(e,"default",r);this._referencePointOnImage=new t({geometry:a,symbol:Ge.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=De(a),s=pt(e,"panoramic",r,o);this._referencePointOnImage=new t({geometry:s,symbol:Ee.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=B(e.x,e.spatialReference);const s=i.spatialReference.equals(e.spatialReference)?e:await E(e,i.spatialReference),n=s.spatialReference.isGeographic?D(s):s,l=P("1=1",P(i.definitionExpression,r)),d=n.spatialReference.isGeographic?1:C(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(y(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 Me)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*Se[2],l=Je(t,d),c=Ke(r);if(!this._sectorData)return;const u=Se[3]+n*Math.sin(r*Math.PI/180),h=Se[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-Se[3],t=h-Se[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;f(e),this._locationViewModel=new i({oiViewModel:this,referenceTransformationService:this._referenceTransformationService})}}_initializeMeasurementService(){this._measurementService||(this._measurementService=new nt({transformationService:this._transformationService,referenceTransformationService:this._referenceTransformationService}))}_initializeVideo(){if(this.videoElement||!this.currentBestFeature)return;this.removeHandles(Re.videoPlayerHandles),this.videoElement=new de({video:this.currentBestFeature.attributes.imagePath,georeference:new ne({extent:new L(Ve)}),autoplay:!1}),this.videoElement.content?.loop&&(this.videoElement.content.loop=!1);const e=new z({source:this.videoElement,title:this.layer?.title,copyright:this.layer?.copyright});this.videoLayer=e,e&&this.videoMapView.map.layers.add(e),this.videoViewModel=new at({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=qe(r);try{await a.load(t)}catch(s){if(y(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=We(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){y(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&&K(r)?await ee({extent:this.footprintExtent,lod:r.lod,url:r.url,rasterFunction:r.rasterFunction}):void 0)}_processSuitableFeatures(e,t){return q({features:e,selectedPoint:t,camera:$e(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 st(e,t,i,r,a);if(f(a),!o?.features?.length)throw new ot(t);const{attributes:s}=o.features[0];let n,l;if(s.orientedImageryType?.includes("360")){n=X(s.geometry);const{cameraHeading:e,farDistance:t,nearDistance:i}=s,r=[Math.sin(p(e)),Math.cos(p(e))],a=(t+i)/2;l=C(n.spatialReference),n.x+=a*r[0]/l,n.y+=a*r[1]/l,n.z=void 0}else{const e=W(s).polygon,t=G.fromJSON(x(e));n=X(t),l=C(n.spatialReference)}this.selectedPoint=n;const d={layerInstanceOrURL:e,point:n,queryParams:{where:P(P("1=1",P(e.definitionExpression,i)),`${e.objectIdField} <> ${t}`),maximumDistance:e.maximumDistance?e.maximumDistance/l:void 0,timeExtent:r}},c=await N(d,a);f(a);const{features:u}=c;return u.push(o.features[0]),await this.processFeatureResponse(c,n,{...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 ae(a.spatialReference,a.z,o,{elevationSample:i,elevationSource:i?void 0:e[0].attributes.elevationSource,extent:this.footprintExtent},r);f(r);const[n,...l]=await Y([t,...e.map(e=>e.attributes.geometry.clone())],s);f(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 rt({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)=>+R([e,t])),t.addRing(i),this.footprintExtent=he(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)),f(e);for(const s of i){const i=this.view&&!this.view.spatialReference?.equals(s.spatialReference)?await E(s.clone(),this.view?.spatialReference,e):s.clone();s.imageID===r.attributes.objectId?this.currentBestFeatureLocation=new t({attributes:{imageID:s.imageID},geometry:i,symbol:je,visible:a}):this.additionalCameraLocations.push(new t({attributes:{imageID:s.imageID},geometry:i,symbol:xe,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-Se[3],r=e.y-Se[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=m(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=X(u));const h="default"===r?oe(o,a[0],a[1]):se(o,a[0],a[1]),p=await ae(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?fe: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=X(u));const h="default"===r||"video"===r?"default":"panoramic",p={..."default"===h?oe(o,a[0],a[1]):se(o,a[0],a[1]),cameraLocation:u},m=await ae(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=m(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 et(i,this.bestFeatureCurrentFootprint?.geometry,e))return}let n;try{if(n="video"===this.mode?await this.getPixelLocationForFeature(i,{feature:o,mode:this.mode,imageSize:fe,footprintExtent:this.footprintExtent},e):await this._transformationService.pointToPixel(i,{signal:e?.signal}),"video"===this.mode&&!tt(n))return;f(e),await this.plotSelectedPointOnImage(n,e)}catch(l){y(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=m(this.bestFeatureCurrentFootprint),e&&!this.invalidCameraHeading&&(e.visible=s,this.bestFeatureCurrentFootprint=e),l){const e=[...i,...r,o].filter(Ze);"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:Pe.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=m(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([A()],yt.prototype,"activeLayer",null),e([A({readOnly:!0})],yt.prototype,"activeViewer",null),e([A()],yt.prototype,"activeTriangulatedViewer",null),e([A()],yt.prototype,"accuracyParametersMissing",null),e([A()],yt.prototype,"additionalFeatures",void 0),e([A({type:o.ofType(t)})],yt.prototype,"additionalCameraLocations",void 0),e([A({type:o.ofType(t)})],yt.prototype,"additionalFootprints",void 0),e([A()],yt.prototype,"areaMeasurementResult",void 0),e([A()],yt.prototype,"areaMeasurementAccuracy",void 0),e([A()],yt.prototype,"bestFeatureAngle",void 0),e([A()],yt.prototype,"bestFeatureCurrentFootprint",void 0),e([A({type:t})],yt.prototype,"bestFeatureFootprint",void 0),e([A({type:Number})],yt.prototype,"brightness",null),e([A()],yt.prototype,"cameraHeadingThreshold",void 0),e([A()],yt.prototype,"cameraPitchThreshold",void 0),e([A()],yt.prototype,"clickAction",void 0),e([A()],yt.prototype,"correctedLocationPointOnImage",void 0),e([A()],yt.prototype,"videoViewModel",void 0),e([A()],yt.prototype,"collectionId",void 0),e([A({type:Number})],yt.prototype,"contrast",null),e([A()],yt.prototype,"coverageFrustums",void 0),e([A()],yt.prototype,"coveragePolygons",void 0),e([A()],yt.prototype,"currentBestFeature",void 0),e([A()],yt.prototype,"currentBestFeatureMeasurementImage",void 0),e([A()],yt.prototype,"currentBestFeatureLocation",void 0),e([A()],yt.prototype,"currentCoverageVisible",void 0),e([A()],yt.prototype,"currentNode",null),e([A()],yt.prototype,"depthImage",void 0),e([A()],yt.prototype,"depthImageNotSupported",null),e([A()],yt.prototype,"featureCache",void 0),e([A()],yt.prototype,"navigationNodes",void 0),e([A({json:{write:!1}})],yt.prototype,"determineWorkflowForFeature",void 0),e([A({json:{write:!1}})],yt.prototype,"determineWorkflowForTriangularMeasurement",void 0),e([A()],yt.prototype,"disabled",void 0),e([A()],yt.prototype,"displayMessage",void 0),e([A()],yt.prototype,"displayNewMeasurementButton",void 0),e([A()],yt.prototype,"distanceMeasurementResult",void 0),e([A()],yt.prototype,"distanceAccuracyArray",void 0),e([A()],yt.prototype,"dataCaptureLayer",void 0),e([A({readOnly:!0})],yt.prototype,"featureCount",null),e([A()],yt.prototype,"features",void 0),e([A()],yt.prototype,"groundCoordinates",void 0),e([A()],yt.prototype,"groundCoordinatesAccuracy",void 0),e([A()],yt.prototype,"groundCoordinatesAccuracyLoading",void 0),e([A()],yt.prototype,"heightGraphic",void 0),e([A()],yt.prototype,"heightMeasurementResult",void 0),e([A()],yt.prototype,"heightMeasurementAccuracy",void 0),e([A({readOnly:!0})],yt.prototype,"imageGalleryEnabled",null),e([A()],yt.prototype,"imageGeometryField",void 0),e([A({readOnly:!0})],yt.prototype,"imageLoaded",null),e([A()],yt.prototype,"imageLocationToolState",void 0),e([A()],yt.prototype,"initialVideoMapViewExtent",void 0),e([A({readOnly:!0})],yt.prototype,"invalidCameraHeading",null),e([A()],yt.prototype,"imagePointsInView",null),e([A()],yt.prototype,"imageMeasurementViewer",void 0),e([A()],yt.prototype,"isAdditionalCoverageVisible",void 0),e([A()],yt.prototype,"isAdditionalPointSourcesVisible",void 0),e([A()],yt.prototype,"layer",void 0),e([A()],yt.prototype,"layerView",null),e([A({readOnly:!0})],yt.prototype,"layerFloorFilterClause",null),e([A({readOnly:!0})],yt.prototype,"layerTimeExtent",null),e([A({type:Number})],yt.prototype,"localPort",void 0),e([A()],yt.prototype,"locationPointOnImage",void 0),e([A()],yt.prototype,"mapImageConversionToolState",void 0),e([A()],yt.prototype,"measureType",void 0),e([A()],yt.prototype,"measurementGraphic",void 0),e([A({readOnly:!0,value:"none"})],yt.prototype,"mode",null),e([A()],yt.prototype,"navigationMode",void 0),e([A()],yt.prototype,"navigatorCurrentBestFeature",void 0),e([A()],yt.prototype,"oiObjectIdField",void 0),e([A({type:o.ofType(t)})],yt.prototype,"overlayedCameraLocations",void 0),e([A()],yt.prototype,"overlayedMapFeatures",void 0),e([A()],yt.prototype,"panoramicVideoLoaded",null),e([A()],yt.prototype,"panoramicVideoPaused",null),e([A()],yt.prototype,"pixelCoordinates",void 0),e([A()],yt.prototype,"preserveAngle",void 0),e([A()],yt.prototype,"pointSources",void 0),e([A({readOnly:!0})],yt.prototype,"popupEnabled",null),e([A()],yt.prototype,"preloadMedia",void 0),e([A()],yt.prototype,"preloadMediaSize",void 0),e([A()],yt.prototype,"previousFeatureAngle",void 0),e([A()],yt.prototype,"referencePoint",null),e([A({readOnly:!0})],yt.prototype,"sectorData",null),e([A()],yt.prototype,"selectedPoint",void 0),e([A({type:Number})],yt.prototype,"sharpness",null),e([A()],yt.prototype,"shouldShowSelectedImage",void 0),e([A()],yt.prototype,"superimposeViewEnabled",void 0),e([A()],yt.prototype,"defaultSuperimposeCameraLockEnabled",void 0),e([A()],yt.prototype,"superimposeViewSupported",null),e([A()],yt.prototype,"sketch",void 0),e([A()],yt.prototype,"sketchTriangular",void 0),e([A()],yt.prototype,"sketchTriangularGraphicsLayer",void 0),e([A()],yt.prototype,"draw",void 0),e([A()],yt.prototype,"drawAdapter",void 0),e([A()],yt.prototype,"polylineDrawAction",void 0),e([A()],yt.prototype,"scheduledFrameId",void 0),e([A()],yt.prototype,"superimposeScheduledFrameId",void 0),e([A()],yt.prototype,"superimposeDebounceTimeoutId",void 0),e([A()],yt.prototype,"sketchAdapter",void 0),e([A({readOnly:!0})],yt.prototype,"sketchGraphicsLayer",null),e([A({readOnly:!0})],yt.prototype,"state",null),e([A({readOnly:!0})],yt.prototype,"thumbnails",null),e([A()],yt.prototype,"videoExtentPoints",null),e([A()],yt.prototype,"triangularMeasurementActive",void 0),e([A()],yt.prototype,"triangulatedDistanceMeasurement",void 0),e([A()],yt.prototype,"triangulatedDistanceAccuracy",void 0),e([A()],yt.prototype,"triangulatedAreaMeasurement",void 0),e([A()],yt.prototype,"triangulatedAreaAccuracy",void 0),e([A()],yt.prototype,"triangulatedMeasurementGraphic",void 0),e([A()],yt.prototype,"triangulatedPoint",void 0),e([A()],yt.prototype,"triangulatedMeasurementAdapter",void 0),e([A()],yt.prototype,"updateFootprint",void 0),e([A()],yt.prototype,"updateVideoFootprint",void 0),e([A()],yt.prototype,"updateFootprintPanorama",void 0),e([A()],yt.prototype,"updatingTriangularMeasurementState",void 0),e([A({value:null})],yt.prototype,"view",null),e([A()],yt.prototype,"videoElement",void 0),e([A()],yt.prototype,"videoLayer",void 0),e([A()],yt.prototype,"videoMapView",void 0),e([A()],yt.prototype,"verticalFilterEnabled",void 0),e([A()],yt.prototype,"_adapter",void 0),e([A()],yt.prototype,"_defaultGraphicsLayer",null),e([A()],yt.prototype,"_highlightedFeatureHandle",void 0),e([A()],yt.prototype,"_imageViewer",void 0),e([A()],yt.prototype,"_initialCurrentCoverageUpdate",void 0),e([A()],yt.prototype,"_locationViewModel",void 0),e([A()],yt.prototype,"_measurementService",void 0),e([A()],yt.prototype,"_mediaPrefetcher",void 0),e([A()],yt.prototype,"_navigationManager",void 0),e([A()],yt.prototype,"_overlays",void 0),e([A()],yt.prototype,"_superimposePreviousCurrentCoverageVisible",void 0),e([A()],yt.prototype,"_superimposeService",void 0),e([A({readOnly:!0})],yt.prototype,"_overlaysView",null),e([A()],yt.prototype,"_panoramicVideoViewer",void 0),e([A()],yt.prototype,"_panoramicViewer",void 0),e([A()],yt.prototype,"_panoramicMeasurementViewer",void 0),e([A()],yt.prototype,"_referencePointOnGround",void 0),e([A()],yt.prototype,"_referencePointOnImage",void 0),e([A()],yt.prototype,"_referenceTransformationService",void 0),e([A()],yt.prototype,"_sectorData",void 0),e([A()],yt.prototype,"_transformationService",void 0),e([A()],yt.prototype,"_featureToSector",void 0),e([A({readOnly:!0})],yt.prototype,"_updatingHandles",void 0),e([A()],yt.prototype,"footprintExtent",void 0),e([A()],yt.prototype,"_featureChangedTask",void 0),yt=e([k("esri.widgets.OrientedImageryViewer.OrientedImageryViewerViewModel")],yt);const ft=yt;export{ft 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,deg2rad as p}from"../../core/mathUtils.js";import{destroyMaybe as m,abortMaybe as g}from"../../core/maybe.js";import{EsriPromise as v}from"../../core/Promise.js";import{isAbortError as y,throwIfAborted as f,waitTick as w}from"../../core/promiseUtils.js";import _ from"../../core/ReactiveMap.js";import{whenOnce as F,on as b,watch as M,syncAndInitial as V,initial as S,when as I}from"../../core/reactiveUtils.js";import{sqlAnd as P}from"../../core/sql.js";import{getMetersPerUnitForSR as C}from"../../core/units.js";import{property as A,subclass as k}from"../../core/accessorSupport/decorators.js";import{isSerializable as O}from"../../core/support/jsonUtils.js";import{UpdatingHandles as T}from"../../core/support/UpdatingHandles.js";import L from"../../geometry/Extent.js";import G from"../../geometry/Point.js";import{projectAsync as E}from"../../geometry/projectionUtils.js";import j from"../../geometry/SpatialReference.js";import{polygonCentroidPoint as x}from"../../geometry/support/centroid.js";import{isClockwise as R}from"../../geometry/support/coordsUtils.js";import{normalizeMapX as B}from"../../geometry/support/normalizeUtils.js";import{geographicToWebMercator as D}from"../../geometry/support/webMercatorUtils.js";import H from"../../layers/GraphicsLayer.js";import z from"../../layers/MediaLayer.js";import{searchImages as N,getSortedLayerFeatures as U}from"../../layers/orientedImagery/queries.js";import{calculateSuitabilities as q}from"../../layers/orientedImagery/core/bestImageUtils.js";import{createCoveragePolygon as W,computePolygonForInspection as $,resizePolygon as Z,checkIfPolygonContainsSelectedPoint as J}from"../../layers/orientedImagery/core/coverageUtils.js";import{isElevationSource as K}from"../../layers/orientedImagery/core/ElevationSourceDefinitions.js";import{getMetersPerUnitOfSR as Q,convertGeographicToWebMercator as X}from"../../layers/orientedImagery/core/utils.js";import Y from"../../layers/orientedImagery/transformations/updateElevation.js";import{getElevationSampler as ee}from"../../layers/orientedImagery/transformations/updateElevationUtils.js";import{or as te,getInitialAngle as ie,convertPixelLocationToSphereVertex as re,getUpdateElevationProps as ae,getImageToWorldProperties as oe,getImageToWorldPanoramicProperties as se}from"../../layers/orientedImagery/transformations/utils.js";import ne from"../../layers/support/ExtentAndRotationGeoreference.js";import{getFloorFilterClause as le}from"../../layers/support/floorFilterUtils.js";import de from"../../layers/support/VideoElement.js";import ce from"../../views/MapView.js";import ue from"../../views/draw/Draw.js";import{scale as he}from"../../views/draw/support/drawUtils.js";import{ViewEventPriorities as pe}from"../../views/input/InputManager.js";import me from"../PanoramicVideoViewer.js";import ge from"../PanoramicViewer.js";import{defaultAngleThresholdInDegrees as ve,videoMapViewConstraint as ye,fixedImageSize as fe,clockwiseDirections as we,videoFitScaleTolerance as _e,videoExtent as Fe,invalidCameraHeading as be,sectorsInOrder as Me,sampleExtent as Ve,sectorsRadii as Se}from"./constants.js";import{isFeatureAttachment as Ie}from"./galleryUtils.js";import{crossSymbol as Pe,crossSymbol3D as Ce,measurementPolygonSymbol as Ae,polylineSymbolPanoramic as ke,measurementPolylineSymbol as Oe,cameraOverlaySymbol3D as Te,cameraOverlaySymbol as Le,diamondSymbol as Ge,diamondSymbol3D as Ee,activeSourcePointSymbol as je,sourcePointSymbol as xe}from"./symbols.js";import{registryKeys as Re}from"./types.js";import{isNoAttachmentError as Be,extractHorizonAnglesFromMedia as De,isTifOrMrf as He,filterOILLayerView as ze,assignElevationSampleToFeatures as Ne,filterByZ as Ue,createPanoramicMedia as qe,createNonPanoramicMedia as We,isSceneView as $e,isGraphic as Ze,calculateSegment as Je,calculateDirection as Ke}from"./utils.js";import{disableVideoZoomAndPan as Qe,getUpdatedConstraints as Xe,getUpdatedExtentPoints as Ye,isSelectedPointWithinVideoFootprint as et,isVideoPixelWithinFrame as tt}from"./videoViewerUtils.js";import it from"./components/ImageViewer.js";import rt from"./components/NavigationNode.js";import at from"./components/OrientedImageryVideoViewModel.js";import{NoFeatureFoundWithObjectIdError as ot}from"./navigation/errors.js";import{queryFeatureByObjectIds as st}from"./navigation/queries.js";import{ImageMeasurementService as nt}from"./services/ImageMeasurementService.js";import lt from"./services/SuperimposeService.js";import{configureSketchTool as dt,extractFieldsFromDataCaptureLayer as ct,constructGraphicFromImageGeometry as ut}from"./support/dataCaptureUtils.js";import{removeZFromGeometry as ht,imageSpaceToPoint as pt}from"./support/geometryUtils.js";import mt from"./support/resolveMediaProps.js";import{isValidDataCaptureLayer as gt}from"./support/typeUtils.js";const vt=()=>new n("orientedimageryviewer:sketch-not-initialized","Sketch property is not initialized, call loadSketch first");let yt=class extends(l(v)){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=ve,this.cameraPitchThreshold=ve,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){y(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){y(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 it,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 _,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 ce({map:new Map,constraints:ye}),this.verticalFilterEnabled=!1,this._adapter=null,this._highlightedFeatureHandle=null,this._imageViewer=new it,this._initialCurrentCoverageUpdate=!0,this._locationViewModel=null,this._measurementService=null,this._mediaPrefetcher=null,this._navigationManager=null,this._overlays=new H({listMode:"hide",internal:!0,elevationInfo:{mode:"absolute-height"},title:"OrentedImageryViewerViewModel overlays layer"}),this._superimposePreviousCurrentCoverageVisible=null,this._superimposeService=new lt({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 me,this._panoramicViewer=new ge,this._panoramicMeasurementViewer=new ge,this._referencePointOnGround=null,this._referencePointOnImage=null,this._referenceTransformationService=null,this._sectorData=null,this._transformationService=null,this._featureToSector=null,this._updatingHandles=new T,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 f(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){y(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)){m(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)=>(f(t),this.currentBestFeature=this.features?.find(({attributes:t})=>`${t.objectId}`==`${e}`),F(()=>{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?fe:"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(Re.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,pe.DEFAULT),Re.click)},this._createImageClickHandle=()=>{this.removeHandles(Re.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=b(()=>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&&!te(!d,l.spatialReference.equals(d))&&(l=await E(l,d,{signal:r})),f(r),this.plotReferencePointOnGround(l)})});this.addHandles([m,h],Re.imageClick)},this._createTriangularImageClickHandle=()=>{this.removeHandles(Re.triangularImageClick),this.triangularMeasurementActive&&"none"!==this.mode&&this.currentBestFeature&&this.currentBestFeatureMeasurementImage&&this.activeTriangulatedViewer&&this.addHandles(this.activeTriangulatedViewer.imageRenderer.on("double-click",this._measurementImageClickHandler),Re.triangularImageClick)},this._enablePan=()=>{this.removeHandles(Re.videoPanHandles)},this._disablePan=()=>{this.removeHandles(Re.videoPanHandles),this.addHandles(Qe(this.videoMapView),Re.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 F(()=>!0===this.videoElement?.loaded,i),`${this.currentBestFeature?.attributes.objectId}`!=`${t}`)return;await this.transformAndPlotSelectedLocation(i)}catch(r){y(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;f(e),this.depthImage=new o({url:a});try{await this.depthImage.load(e)}catch(s){y(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),f(e),await this.transformAndPlotSelectedLocation(e)}catch(a){y(a)||this.loadImageError(a)}},this._loadVideo=async e=>{const{currentBestFeature:t,mode:i,selectedPoint:r}=this,a=t?.attributes.imagePath;if(!t||"panoramic-video"!==i||!a)return;const{attributes:o}=t,{cameraPitch:s,cameraOrientation:n,location:l}=o,d=l.spatialReference.isWGS84&&4!==n?.type?D(l):new G(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 ie(d,r)-t),this._panoramicVideoViewer.pitch=s??0,this._panoramicVideoViewer.yaw=t,await this._panoramicVideoViewer.loadVideo(e),f(e)}catch(c){y(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 mt(t.attributes,e,i),f(i)}catch(v){if(y(v))return;return Be(v)?(u.getLogger(this).error(v),void this.setMessage("noAttachment","error",`${e.objectIdField}: ${t.attributes.objectId}`)):(u.getLogger(this).error(v,{[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 ie(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 ie(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),f(e)}catch(a){y(a)||this.loadImageError(a)}},this._loadMediaPrefetcher=async e=>{if(!this._mediaPrefetcher){const{default:t}=await(import("./support/MediaPrefetcher.js"));f(e),this._mediaPrefetcher=new t({maxEntries:this.preloadMediaSize*we.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"));f(e),this._adapter=new t(this);break}case"3d":{const{default:t}=await(import("./adapters/view/SceneViewAdapter.js"));f(e),this._adapter=new t(this);break}}else this._adapter=null},this._mapImageConversionToolViewClickHandler=e=>{if(e.stopPropagation(),e.preventDefault(),e.mapPoint){const t=e.mapPoint;t.x=B(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-_e,r=Xe(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 f(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 w(i),!e)return;const r=new G({...O(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:Pe}),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=De(r),o=re(e,...i,a);this._crossSymbol=new t({geometry:new G(o,j.WebMercator),symbol:Ce}),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([M(()=>this.view,()=>this.load(),V),M(()=>this.view?.map,(e,t)=>{t?.layers.remove(this._overlays),e?.layers.add(this._overlays)},S),M(()=>this.view?.map?.allLayers?.length,e=>{e&&this.view?.map?.layers.reorder(this._overlays,e-1)},S),M(()=>[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()},V),M(()=>[this.triangularMeasurementActive,this.currentBestFeatureMeasurementImage],()=>{this._createTriangularImageClickHandle()},V),M(()=>[this.state,this.imageLocationToolState,this.view],()=>{this._initializeMeasurementService(),this._initializeLocationViewModel()},V),M(()=>this.measureType,()=>{this.clearPreviousMeasurements(),this._initializeMeasurementService()},V),M(()=>this.bestFeatureAngle,(e,t)=>{this.previousFeatureAngle=t??0},V),M(()=>[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()},V),M(()=>this._getSuperimposeCameraWatchState(),()=>this._handleSuperimposeCameraChange(),V),M(()=>this.currentBestFeature,async(e,t)=>{g(this._featureChangedTask),this._featureChangedTask=a(async i=>this.determineWorkflowForFeature.apply(this,[e,t,{signal:i}])),await this._featureChangedTask.promise},{sync:!0}),M(()=>[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}),f(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()})},V),M(()=>this.currentBestFeatureMeasurementImage,(e,t)=>{g(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}),f(i),this._reorderTriangularSketchLayer()})},V),M(()=>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())}),M(()=>this.mode,e=>{switch(this.removeHandles(Re.interactionHandles),e){case"default":this.addHandles(M(()=>{const{state:e}=this;return"image-loaded"===e?this._imageViewer.imagePointsInView:null},e=>{e&&(g(this._updateFootprintTask),this._updateFootprintTask=a(async t=>{await this.updateFootprint(e,void 0,{signal:t})}))},{...V,equals:(e,t)=>i(e,t,c)}),Re.interactionHandles);break;case"video":this.addHandles(M(()=>{const{footprintExtent:e,videoElement:t,bestFeatureFootprint:i}=this;if(e&&t?.loaded&&i)return{videoExtent:Fe,bestFeatureFootprint:i}},e=>{e?.videoExtent&&e?.bestFeatureFootprint&&(g(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)}))},{...V,equals:(e,t)=>i(e?.videoExtent,t?.videoExtent,c)&&e?.bestFeatureFootprint===t?.bestFeatureFootprint}),Re.interactionHandles);break;case"panoramic":this.addHandles(M(()=>{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),g(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)}),Re.interactionHandles);break;case"panoramic-video":this.addHandles(M(()=>{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;g(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}),f(e),this._updateFootprintTask=null})},{equals:(e,t)=>i(e,t,c)}),Re.interactionHandles)}},V),M(()=>[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)},V),M(()=>this.activeViewer?.imageRenderer,()=>{this.sketch&&(this.sketch.view=this.activeViewer?.imageRenderer)}),M(()=>this.activeViewer,e=>{this.removeHandles(Re.hittestHandles),e&&this.addHandles(b(()=>e,"hittest-response",this._handleImageHitTestResponse),Re.hittestHandles)}),M(()=>this.videoMapView.extent,async()=>{this._scheduleVideoInteractionUpdate();const e=this.videoViewModel?.closestFeature;e&&(g(this._updateFootprintTask),this._updateFootprintTask=a(async t=>{const i={points:this.videoExtentPoints,feature:e,options:{signal:t}};await this.updateVideoFootprint(i)}))}),M(()=>[this.videoMapView.interacting,this.videoMapView.navigating,this.videoMapView.scale],()=>{this._scheduleVideoInteractionUpdate()},{initial:!0}),I(()=>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=g(this._updateFootprintTask),this._clickTask=g(this._clickTask),this._restoreSuperimposeMediaTask=g(this._restoreSuperimposeMediaTask),this.coverageFrustums.destroy(),this.coveragePolygons.destroy(),this.pointSources.destroy(),this.additionalFootprints.destroy(),this.additionalCameraLocations.destroy(),this.bestFeatureFootprint=m(this.bestFeatureFootprint),this.bestFeatureCurrentFootprint=m(this.bestFeatureCurrentFootprint),this.videoViewModel=m(this.videoViewModel),this._locationViewModel=m(this._locationViewModel),this.clearSelectedPointOnViewer(),this._referencePointOnGround=m(this._referencePointOnGround),this.clearReferencePointOnImage(),this._superimposeService.destroy(),this._overlays&&this.view?.map?.remove(this._overlays),this._overlays.destroy(),this._imageViewer.destroy(),this.imageMeasurementViewer.destroy(),this._panoramicViewer.destroy(),this._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!He(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 He(t)||Ie(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===be}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(ze(e))}get layerFloorFilterClause(){const{layerView:e}=this;return e?le(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?Me.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 He(a)||Ie(a)?{url:a,objectId:t,rotation:(i??0)+(r??0)}:null}).filter(r)):null}get videoExtentPoints(){const e=Ye(this.videoMapView.extent);return e.length?e:Fe}set view(e){this._set("view",e)}get _defaultGraphicsLayer(){const e={blendMode:"source-atop"};switch(this.mode){case"panoramic":return new H({...e,elevationInfo:{mode:"absolute-height"}});case"default":return new H({...e});default:return}}get _overlaysView(){return this.view?.layerViews.find(({layer:e})=>e===this._overlays)}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=m(this.bestFeatureCurrentFootprint),this._restoreSuperimposeMediaTask=g(this._restoreSuperimposeMediaTask),this._superimposeService.clear(),this._overlays?.removeAll()}async calculateLocationAccuracy(e){return this._measurementService?.calculateLocationAccuracy(e)}clearLocationPointOnImage(e=!1){this.locationPointOnImage&&!e&&(this._imageViewer.removeGraphic(this.locationPointOnImage),this._panoramicViewer.removeGraphic(this.locationPointOnImage),this.locationPointOnImage=m(this.locationPointOnImage)),this.correctedLocationPointOnImage&&(this.imageMeasurementViewer.removeGraphic(this.correctedLocationPointOnImage),this._panoramicMeasurementViewer.removeGraphic(this.correctedLocationPointOnImage),this.correctedLocationPointOnImage=m(this.correctedLocationPointOnImage))}clearPreviousMeasurements(){this.clearMeasurementGraphics(),this.resetMeasurementData(),this.stopMeasurement()}clearPreviousGroundLocation(){this.groundCoordinates=null,this.groundCoordinatesAccuracy=null,this.groundCoordinatesAccuracyLoading=!1,this.pixelCoordinates=null,this.clearLocationPointOnImage()}clearMeasurementGraphics(){this.measurementGraphic&&(this.activeViewer?.removeGraphic(this.measurementGraphic),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 vt();dt(r,e,i),await i.create(e,{...t,defaultZ:0})}digitizeDelete(){if(!this.sketch)throw vt();return this.sketch.delete()}digitizeDuplicate(){if(!this.sketch)throw vt();return this.sketch.duplicate()}digitizePlace(e,t){if(!this.sketch)throw vt();return this.sketch.place(e,t)}digitizeRedo(){if(!this.sketch)throw vt();return this.sketch.redo()}digitizeUndo(){if(!this.sketch)throw vt();return this.sketch.undo()}digitizeUpdate(e,t){if(!this.sketch)throw vt();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}=W(n);if(l=d.clone(),n.isInspection&&(l=$(n)),s&&(l=Z(l,s)),i||!t||J(l,t)){o.push(e);const{geometry:t,objectId:i,cameraHeight:s,cameraHeading:l}=n,u=t.clone();u.z=s/Q(t.spatialReference),u.imageID=i,this.pointSources.push(u),l!==be&&(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?.[Me[e]],i=t?.at(0);i&&(this.triangularMeasurementActive&&this.currentBestFeature?this._updateImageMeasurementBestFeature(i):this._updateCurrentBestFeature(i))}handleFeatureClick(e){const{sector:t,featureIndexInSector:i}=e;if(isNaN(i))return;const r=this._sectorData?.[t],a=r?.at(i);a&&(this.triangularMeasurementActive&&this.currentBestFeature?this._updateImageMeasurementBestFeature(a):this._updateCurrentBestFeature(a))}load(e){return this.addResolvingPromise(this._loadViewAdapter(e).catch(e=>{if(!y(e))throw e})),this}async loadBestImage(e,t){return this.selectedPoint=X(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(f(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;f(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(f(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);f(i),await this._updateElevationOfSelectedPointAndLocations(a,t,n),f(i),Ne(a,n);let l=a;if(this.layer?.verticalSearchRange&&this.layer.hasZ&&this.verticalFilterEnabled&&(l=Ue(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 f(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=Ae(s),this.sketch.polylineSymbol="panoramic"===o?ke:Oe(s,2.5))}async startHeightMeasurement(){this.displayNewMeasurementButton=!1,this.draw??=new ue({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}=W(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:P(`${o.objectIdField} <> ${p.attributes.objectId}`,P(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?Te():Le();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}=W(p.attributes);try{const{imageGeometryField:t,oiObjectIdField:i}=ct(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&&gt(e,v,y)&&`${n[y]}`==`${p.attributes.objectId}`)try{const r=h?d.horizonAngles:De(a?.media),u=ut(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 Me.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 G({...e.toJSON()}),symbol:Ge}),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=g(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||ht(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 N(e,t);i&&await this.processFeatureResponse(i,e.point,t)}catch(i){y(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);f(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=m(this.sketchAdapter),this.sketch=m(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 E(i,s.spatialReference);a=s.contains(e);break}case"mesh":{const e=i.spatialReference.equals(s.spatialReference)?i:await E(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:fe,footprintExtent:this.footprintExtent},r):await this._transformationService.pointToPixel(i,r);if(n)return f(r),this.plotReferencePointOnImage(n),{x:n.x,y:n.y};this.clearReferencePointOnImage()}async updateFeatureCache(e,t){const i=await U(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=De(a),s=pt(e,"panoramic",r,o);this._referencePointOnImage=new t({geometry:s,symbol:Ee.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=pt(e,"default",r);this._referencePointOnImage=new t({geometry:a,symbol:Ge.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=De(a),s=pt(e,"panoramic",r,o);this._referencePointOnImage=new t({geometry:s,symbol:Ee.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=B(e.x,e.spatialReference);const s=i.spatialReference.equals(e.spatialReference)?e:await E(e,i.spatialReference),n=s.spatialReference.isGeographic?D(s):s,l=P("1=1",P(i.definitionExpression,r)),d=n.spatialReference.isGeographic?1:C(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(y(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 Me)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*Se[2],l=Je(t,d),c=Ke(r);if(!this._sectorData)return;const u=Se[3]+n*Math.sin(r*Math.PI/180),h=Se[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-Se[3],t=h-Se[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;f(e),this._locationViewModel=new i({oiViewModel:this,referenceTransformationService:this._referenceTransformationService})}}_initializeMeasurementService(){this._measurementService||(this._measurementService=new nt({transformationService:this._transformationService,referenceTransformationService:this._referenceTransformationService}))}_initializeVideo(){if(this.videoElement||!this.currentBestFeature)return;this.removeHandles(Re.videoPlayerHandles),this.videoElement=new de({video:this.currentBestFeature.attributes.imagePath,georeference:new ne({extent:new L(Ve)}),autoplay:!1}),this.videoElement.content?.loop&&(this.videoElement.content.loop=!1);const e=new z({source:this.videoElement,title:this.layer?.title,copyright:this.layer?.copyright});this.videoLayer=e,e&&this.videoMapView.map.layers.add(e),this.videoViewModel=new at({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=qe(r);try{await a.load(t)}catch(s){if(y(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=We(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{unionExecuteMany:r}=await(import("../../geometry/operators/unionOperator.js")),a=r(e);if(this._updateFootprintWithFeatures(t,a),"3d"===this.view?.type)try{return await this.view.map.ground.createElevationSampler(this.footprintExtent,i)}catch(o){y(o)||u.getLogger(this).error(o)}}async processElevationSample(e,t,i){const{elevationSource:r}=t[0].attributes,a=await this._getElevationSampleFromGround(e,t,i);return a||(r&&this.footprintExtent&&K(r)?await ee({extent:this.footprintExtent,lod:r.lod,url:r.url,rasterFunction:r.rasterFunction}):void 0)}_processSuitableFeatures(e,t){return q({features:e,selectedPoint:t,camera:$e(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 st(e,t,i,r,a);if(f(a),!o?.features?.length)throw new ot(t);const{attributes:s}=o.features[0];let n,l;if(s.orientedImageryType?.includes("360")){n=X(s.geometry);const{cameraHeading:e,farDistance:t,nearDistance:i}=s,r=[Math.sin(p(e)),Math.cos(p(e))],a=(t+i)/2;l=C(n.spatialReference),n.x+=a*r[0]/l,n.y+=a*r[1]/l,n.z=void 0}else{const e=W(s).polygon,t=G.fromJSON(x(e));n=X(t),l=C(n.spatialReference)}this.selectedPoint=n;const d={layerInstanceOrURL:e,point:n,queryParams:{where:P(P("1=1",P(e.definitionExpression,i)),`${e.objectIdField} <> ${t}`),maximumDistance:e.maximumDistance?e.maximumDistance/l:void 0,timeExtent:r}},c=await N(d,a);f(a);const{features:u}=c;return u.push(o.features[0]),await this.processFeatureResponse(c,n,{...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 ae(a.spatialReference,a.z,o,{elevationSample:i,elevationSource:i?void 0:e[0].attributes.elevationSource,extent:this.footprintExtent},r);f(r);const[n,...l]=await Y([t,...e.map(e=>e.attributes.geometry.clone())],s);f(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 rt({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)=>+R([e,t])),t.addRing(i),this.footprintExtent=he(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)),f(e);for(const s of i){const i=this.view&&!this.view.spatialReference?.equals(s.spatialReference)?await E(s.clone(),this.view?.spatialReference,e):s.clone();s.imageID===r.attributes.objectId?this.currentBestFeatureLocation=new t({attributes:{imageID:s.imageID},geometry:i,symbol:je,visible:a}):this.additionalCameraLocations.push(new t({attributes:{imageID:s.imageID},geometry:i,symbol:xe,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-Se[3],r=e.y-Se[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=m(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=X(u));const h="default"===r?oe(o,a[0],a[1]):se(o,a[0],a[1]),p=await ae(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?fe: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=X(u));const h="default"===r||"video"===r?"default":"panoramic",p={..."default"===h?oe(o,a[0],a[1]):se(o,a[0],a[1]),cameraLocation:u},m=await ae(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=m(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 et(i,this.bestFeatureCurrentFootprint?.geometry,e))return}let n;try{if(n="video"===this.mode?await this.getPixelLocationForFeature(i,{feature:o,mode:this.mode,imageSize:fe,footprintExtent:this.footprintExtent},e):await this._transformationService.pointToPixel(i,{signal:e?.signal}),"video"===this.mode&&!tt(n))return;f(e),await this.plotSelectedPointOnImage(n,e)}catch(l){y(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=m(this.bestFeatureCurrentFootprint),e&&!this.invalidCameraHeading&&(e.visible=s,this.bestFeatureCurrentFootprint=e),l){const e=[...i,...r,o].filter(Ze);"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:Pe.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=m(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([A()],yt.prototype,"activeLayer",null),e([A({readOnly:!0})],yt.prototype,"activeViewer",null),e([A()],yt.prototype,"activeTriangulatedViewer",null),e([A()],yt.prototype,"accuracyParametersMissing",null),e([A()],yt.prototype,"additionalFeatures",void 0),e([A({type:o.ofType(t)})],yt.prototype,"additionalCameraLocations",void 0),e([A({type:o.ofType(t)})],yt.prototype,"additionalFootprints",void 0),e([A()],yt.prototype,"areaMeasurementResult",void 0),e([A()],yt.prototype,"areaMeasurementAccuracy",void 0),e([A()],yt.prototype,"bestFeatureAngle",void 0),e([A()],yt.prototype,"bestFeatureCurrentFootprint",void 0),e([A({type:t})],yt.prototype,"bestFeatureFootprint",void 0),e([A({type:Number})],yt.prototype,"brightness",null),e([A()],yt.prototype,"cameraHeadingThreshold",void 0),e([A()],yt.prototype,"cameraPitchThreshold",void 0),e([A()],yt.prototype,"clickAction",void 0),e([A()],yt.prototype,"correctedLocationPointOnImage",void 0),e([A()],yt.prototype,"videoViewModel",void 0),e([A()],yt.prototype,"collectionId",void 0),e([A({type:Number})],yt.prototype,"contrast",null),e([A()],yt.prototype,"coverageFrustums",void 0),e([A()],yt.prototype,"coveragePolygons",void 0),e([A()],yt.prototype,"currentBestFeature",void 0),e([A()],yt.prototype,"currentBestFeatureMeasurementImage",void 0),e([A()],yt.prototype,"currentBestFeatureLocation",void 0),e([A()],yt.prototype,"currentCoverageVisible",void 0),e([A()],yt.prototype,"currentNode",null),e([A()],yt.prototype,"depthImage",void 0),e([A()],yt.prototype,"depthImageNotSupported",null),e([A()],yt.prototype,"featureCache",void 0),e([A()],yt.prototype,"navigationNodes",void 0),e([A({json:{write:!1}})],yt.prototype,"determineWorkflowForFeature",void 0),e([A({json:{write:!1}})],yt.prototype,"determineWorkflowForTriangularMeasurement",void 0),e([A()],yt.prototype,"disabled",void 0),e([A()],yt.prototype,"displayMessage",void 0),e([A()],yt.prototype,"displayNewMeasurementButton",void 0),e([A()],yt.prototype,"distanceMeasurementResult",void 0),e([A()],yt.prototype,"distanceAccuracyArray",void 0),e([A()],yt.prototype,"dataCaptureLayer",void 0),e([A({readOnly:!0})],yt.prototype,"featureCount",null),e([A()],yt.prototype,"features",void 0),e([A()],yt.prototype,"groundCoordinates",void 0),e([A()],yt.prototype,"groundCoordinatesAccuracy",void 0),e([A()],yt.prototype,"groundCoordinatesAccuracyLoading",void 0),e([A()],yt.prototype,"heightGraphic",void 0),e([A()],yt.prototype,"heightMeasurementResult",void 0),e([A()],yt.prototype,"heightMeasurementAccuracy",void 0),e([A({readOnly:!0})],yt.prototype,"imageGalleryEnabled",null),e([A()],yt.prototype,"imageGeometryField",void 0),e([A({readOnly:!0})],yt.prototype,"imageLoaded",null),e([A()],yt.prototype,"imageLocationToolState",void 0),e([A()],yt.prototype,"initialVideoMapViewExtent",void 0),e([A({readOnly:!0})],yt.prototype,"invalidCameraHeading",null),e([A()],yt.prototype,"imagePointsInView",null),e([A()],yt.prototype,"imageMeasurementViewer",void 0),e([A()],yt.prototype,"isAdditionalCoverageVisible",void 0),e([A()],yt.prototype,"isAdditionalPointSourcesVisible",void 0),e([A()],yt.prototype,"layer",void 0),e([A()],yt.prototype,"layerView",null),e([A({readOnly:!0})],yt.prototype,"layerFloorFilterClause",null),e([A({readOnly:!0})],yt.prototype,"layerTimeExtent",null),e([A({type:Number})],yt.prototype,"localPort",void 0),e([A()],yt.prototype,"locationPointOnImage",void 0),e([A()],yt.prototype,"mapImageConversionToolState",void 0),e([A()],yt.prototype,"measureType",void 0),e([A()],yt.prototype,"measurementGraphic",void 0),e([A({readOnly:!0,value:"none"})],yt.prototype,"mode",null),e([A()],yt.prototype,"navigationMode",void 0),e([A()],yt.prototype,"navigatorCurrentBestFeature",void 0),e([A()],yt.prototype,"oiObjectIdField",void 0),e([A({type:o.ofType(t)})],yt.prototype,"overlayedCameraLocations",void 0),e([A()],yt.prototype,"overlayedMapFeatures",void 0),e([A()],yt.prototype,"panoramicVideoLoaded",null),e([A()],yt.prototype,"panoramicVideoPaused",null),e([A()],yt.prototype,"pixelCoordinates",void 0),e([A()],yt.prototype,"preserveAngle",void 0),e([A()],yt.prototype,"pointSources",void 0),e([A({readOnly:!0})],yt.prototype,"popupEnabled",null),e([A()],yt.prototype,"preloadMedia",void 0),e([A()],yt.prototype,"preloadMediaSize",void 0),e([A()],yt.prototype,"previousFeatureAngle",void 0),e([A()],yt.prototype,"referencePoint",null),e([A({readOnly:!0})],yt.prototype,"sectorData",null),e([A()],yt.prototype,"selectedPoint",void 0),e([A({type:Number})],yt.prototype,"sharpness",null),e([A()],yt.prototype,"shouldShowSelectedImage",void 0),e([A()],yt.prototype,"superimposeViewEnabled",void 0),e([A()],yt.prototype,"defaultSuperimposeCameraLockEnabled",void 0),e([A()],yt.prototype,"superimposeViewSupported",null),e([A()],yt.prototype,"sketch",void 0),e([A()],yt.prototype,"sketchTriangular",void 0),e([A()],yt.prototype,"sketchTriangularGraphicsLayer",void 0),e([A()],yt.prototype,"draw",void 0),e([A()],yt.prototype,"drawAdapter",void 0),e([A()],yt.prototype,"polylineDrawAction",void 0),e([A()],yt.prototype,"scheduledFrameId",void 0),e([A()],yt.prototype,"superimposeScheduledFrameId",void 0),e([A()],yt.prototype,"superimposeDebounceTimeoutId",void 0),e([A()],yt.prototype,"sketchAdapter",void 0),e([A({readOnly:!0})],yt.prototype,"sketchGraphicsLayer",null),e([A({readOnly:!0})],yt.prototype,"state",null),e([A({readOnly:!0})],yt.prototype,"thumbnails",null),e([A()],yt.prototype,"videoExtentPoints",null),e([A()],yt.prototype,"triangularMeasurementActive",void 0),e([A()],yt.prototype,"triangulatedDistanceMeasurement",void 0),e([A()],yt.prototype,"triangulatedDistanceAccuracy",void 0),e([A()],yt.prototype,"triangulatedAreaMeasurement",void 0),e([A()],yt.prototype,"triangulatedAreaAccuracy",void 0),e([A()],yt.prototype,"triangulatedMeasurementGraphic",void 0),e([A()],yt.prototype,"triangulatedPoint",void 0),e([A()],yt.prototype,"triangulatedMeasurementAdapter",void 0),e([A()],yt.prototype,"updateFootprint",void 0),e([A()],yt.prototype,"updateVideoFootprint",void 0),e([A()],yt.prototype,"updateFootprintPanorama",void 0),e([A()],yt.prototype,"updatingTriangularMeasurementState",void 0),e([A({value:null})],yt.prototype,"view",null),e([A()],yt.prototype,"videoElement",void 0),e([A()],yt.prototype,"videoLayer",void 0),e([A()],yt.prototype,"videoMapView",void 0),e([A()],yt.prototype,"verticalFilterEnabled",void 0),e([A()],yt.prototype,"_adapter",void 0),e([A()],yt.prototype,"_defaultGraphicsLayer",null),e([A()],yt.prototype,"_highlightedFeatureHandle",void 0),e([A()],yt.prototype,"_imageViewer",void 0),e([A()],yt.prototype,"_initialCurrentCoverageUpdate",void 0),e([A()],yt.prototype,"_locationViewModel",void 0),e([A()],yt.prototype,"_measurementService",void 0),e([A()],yt.prototype,"_mediaPrefetcher",void 0),e([A()],yt.prototype,"_navigationManager",void 0),e([A()],yt.prototype,"_overlays",void 0),e([A()],yt.prototype,"_superimposePreviousCurrentCoverageVisible",void 0),e([A()],yt.prototype,"_superimposeService",void 0),e([A({readOnly:!0})],yt.prototype,"_overlaysView",null),e([A()],yt.prototype,"_panoramicVideoViewer",void 0),e([A()],yt.prototype,"_panoramicViewer",void 0),e([A()],yt.prototype,"_panoramicMeasurementViewer",void 0),e([A()],yt.prototype,"_referencePointOnGround",void 0),e([A()],yt.prototype,"_referencePointOnImage",void 0),e([A()],yt.prototype,"_referenceTransformationService",void 0),e([A()],yt.prototype,"_sectorData",void 0),e([A()],yt.prototype,"_transformationService",void 0),e([A()],yt.prototype,"_featureToSector",void 0),e([A({readOnly:!0})],yt.prototype,"_updatingHandles",void 0),e([A()],yt.prototype,"footprintExtent",void 0),e([A()],yt.prototype,"_featureChangedTask",void 0),yt=e([k("esri.widgets.OrientedImageryViewer.OrientedImageryViewerViewModel")],yt);const ft=yt;export{ft as default};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import e from"../../../../Graphic.js";import{isSome as t}from"../../../../core/arrayUtils.js";import i from"../../../../core/Logger.js";import{waitTick as o,throwIfAborted as r,isAbortError as a}from"../../../../core/promiseUtils.js";import s from"../../../../geometry/Polygon.js";import{projectAsync as n}from"../../../../geometry/projectionUtils.js";import{execute as l}from"../../../../geometry/operators/centroidOperator.js";import{adjustHorizonAngles as p,convertOrientationToPixelLocation as c}from"../../../../layers/orientedImagery/transformations/utils.js";import{fixedImageSize as u}from"../../constants.js";import{activePolygonSymbol as d,polygonSymbol as m}from"../../symbols.js";import{extractHorizonAnglesFromMedia as g}from"../../utils.js";class v{constructor(v){this.viewModel=v,this.createFootprints=async t=>{await o(t);const{coveragePolygons:i,currentBestFeature:r,isAdditionalCoverageVisible:a}=this.viewModel;for(const o of i)o?.imageID===r.attributes.objectId?this.viewModel.bestFeatureFootprint=new e({attributes:{imageID:o?.imageID},geometry:o,symbol:d,visible:!1}):this.viewModel.additionalFootprints.push(new e({attributes:{imageID:o?.imageID},geometry:o,symbol:m.clone(),visible:a}))},this.updateFootprint=async(o,l,p)=>{const{activeViewer:c,mode:m,currentBestFeature:g,currentCoverageVisible:v,footprintExtent:f}=this.viewModel,w=l??g;if(g&&("video"===m?u:c?.imageSize)&&f&&w)try{const i=await this.viewModel.getMapPoint(o);r(p);const a=i.filter(t);if(!a.length)return;const l=[a.map(({x:e,y:t})=>[e,t,1])];l[0].push(l[0][0]);const c=new s({rings:l,spatialReference:a[0].spatialReference}),u=this.viewModel.view?.spatialReference.equals(c.spatialReference)?c:await n(c,this.viewModel.view.spatialReference,p);this.viewModel.updateCurrentCoveragePolygon(new e({geometry:u,attributes:{imageID:w.attributes.objectId},symbol:d,visible:v}))}catch(h){a(h)||i.getLogger(this.viewModel).error("update-footprint",h)}else this.viewModel.updateCurrentCoveragePolygon(null)},this.updateVideoFootprint=async o=>{const{points:p,feature:c,scale:m,options:g}=o,{activeViewer:v,mode:f,currentBestFeature:w,currentCoverageVisible:h,footprintExtent:y}=this.viewModel,M="video"===f?u:v?.imageSize,b=c??w;if(w&&M&&y&&b&&"none"!==f)try{const i={feature:b,mode:f,imageSize:M,footprintExtent:y},o=await this.viewModel.getMapPointForFeature(p,i,g);r(g);const a=o.filter(t);if(!a.length)return;const c=[a.map(({x:e,y:t})=>[e,t,1])];c[0].push(c[0][0]);let u=new s({rings:c,spatialReference:a[0].spatialReference});if(m){const e=u.spatialReference,t=l(u),i=u.rings.map(e=>e.map(([e,i])=>[t.x+(e-t.x)*m,t.y+(i-t.y)*m]));u=new s({rings:i,spatialReference:e})}const v=this.viewModel.view?.spatialReference.equals(u.spatialReference)?u:await n(u,this.viewModel.view.spatialReference,g);this.viewModel.updateCurrentCoveragePolygon(new e({geometry:v,attributes:{imageID:b.attributes.objectId},symbol:d,visible:h}))}catch(C){a(C)||i.getLogger(this.viewModel).error("update-footprint",C)}else this.viewModel.updateCurrentCoveragePolygon(null)},this.updateFootprintPanorama=async(t,i)=>{const{horizontalFieldOfView:o,pitch:a,verticalFieldOfView:l,yaw:m,feature:v,horizonAngles:f}=t,{activeViewer:w,currentBestFeature:h,currentCoverageVisible:y,footprintExtent:M,mode:b}=this.viewModel,C="video"===b||"panoramic-video"===b?u:w?.imageSize,F=v??h;if(!F||!C||!M||"none"===b)return void this.viewModel.updateCurrentCoveragePolygon(null);const{cameraPitch:j,objectId:P}=F.attributes;if(a+j-l/2>180)return void this.viewModel.updateCurrentCoveragePolygon(null);const R=[],I=l/2,x=o/2,V=a-I,D=a+I;if(V>90)return void this.viewModel.updateCurrentCoveragePolygon(null);const z=V<0,E=[-x,I],S=[x,I],B=[x,-I],q=[-x,-I];if(V<90&&D>90){R.push(z?B:q);const e=Math.floor(o/5),t=o/e;for(let i=0;i<=e;i++)R.push([i*t-x,90-a]);R.push(z?q:B)}D<90&&(R.push(E,S),z?R.push(q,B):R.push(B,q));const L=f??g(w?.media),O=R.map(([e,t])=>{const i=a+t,o=m+e,r=L?p(o,i,L):[o,i];return{...c(r[0],r[1],C[0],C[1]),heading:o,pitch:i}}),U={feature:F,mode:b,imageSize:C,footprintExtent:M},A=v?await this.viewModel.getMapPointForFeature(O,U,i):await this.viewModel.getMapPoint(O,i);r(i);const G=[A.map(({x:e,y:t})=>[e,t,1])];G[0].push(G[0][0]);const k=new s({rings:G,spatialReference:A[0].spatialReference}),H=this.viewModel.view?.spatialReference;if(!H)return;const J=H.equals(k.spatialReference)?k:await n(k,H,i);this.viewModel.updateCurrentCoveragePolygon(new e({geometry:J,attributes:{imageID:P},symbol:d.clone(),visible:y}))}}}export{v as default};
2
+ import e from"../../../../Graphic.js";import{isSome as t}from"../../../../core/arrayUtils.js";import i from"../../../../core/Logger.js";import{waitTick as o,throwIfAborted as r,isAbortError as a}from"../../../../core/promiseUtils.js";import s from"../../../../geometry/Polygon.js";import{projectAsync as n}from"../../../../geometry/projectionUtils.js";import{centroidExecute as l}from"../../../../geometry/operators/centroidOperator.js";import{adjustHorizonAngles as p,convertOrientationToPixelLocation as c}from"../../../../layers/orientedImagery/transformations/utils.js";import{fixedImageSize as u}from"../../constants.js";import{activePolygonSymbol as d,polygonSymbol as m}from"../../symbols.js";import{extractHorizonAnglesFromMedia as g}from"../../utils.js";class v{constructor(v){this.viewModel=v,this.createFootprints=async t=>{await o(t);const{coveragePolygons:i,currentBestFeature:r,isAdditionalCoverageVisible:a}=this.viewModel;for(const o of i)o?.imageID===r.attributes.objectId?this.viewModel.bestFeatureFootprint=new e({attributes:{imageID:o?.imageID},geometry:o,symbol:d,visible:!1}):this.viewModel.additionalFootprints.push(new e({attributes:{imageID:o?.imageID},geometry:o,symbol:m.clone(),visible:a}))},this.updateFootprint=async(o,l,p)=>{const{activeViewer:c,mode:m,currentBestFeature:g,currentCoverageVisible:v,footprintExtent:f}=this.viewModel,w=l??g;if(g&&("video"===m?u:c?.imageSize)&&f&&w)try{const i=await this.viewModel.getMapPoint(o);r(p);const a=i.filter(t);if(!a.length)return;const l=[a.map(({x:e,y:t})=>[e,t,1])];l[0].push(l[0][0]);const c=new s({rings:l,spatialReference:a[0].spatialReference}),u=this.viewModel.view?.spatialReference.equals(c.spatialReference)?c:await n(c,this.viewModel.view.spatialReference,p);this.viewModel.updateCurrentCoveragePolygon(new e({geometry:u,attributes:{imageID:w.attributes.objectId},symbol:d,visible:v}))}catch(h){a(h)||i.getLogger(this.viewModel).error("update-footprint",h)}else this.viewModel.updateCurrentCoveragePolygon(null)},this.updateVideoFootprint=async o=>{const{points:p,feature:c,scale:m,options:g}=o,{activeViewer:v,mode:f,currentBestFeature:w,currentCoverageVisible:h,footprintExtent:y}=this.viewModel,M="video"===f?u:v?.imageSize,b=c??w;if(w&&M&&y&&b&&"none"!==f)try{const i={feature:b,mode:f,imageSize:M,footprintExtent:y},o=await this.viewModel.getMapPointForFeature(p,i,g);r(g);const a=o.filter(t);if(!a.length)return;const c=[a.map(({x:e,y:t})=>[e,t,1])];c[0].push(c[0][0]);let u=new s({rings:c,spatialReference:a[0].spatialReference});if(m){const e=u.spatialReference,t=l(u),i=u.rings.map(e=>e.map(([e,i])=>[t.x+(e-t.x)*m,t.y+(i-t.y)*m]));u=new s({rings:i,spatialReference:e})}const v=this.viewModel.view?.spatialReference.equals(u.spatialReference)?u:await n(u,this.viewModel.view.spatialReference,g);this.viewModel.updateCurrentCoveragePolygon(new e({geometry:v,attributes:{imageID:b.attributes.objectId},symbol:d,visible:h}))}catch(C){a(C)||i.getLogger(this.viewModel).error("update-footprint",C)}else this.viewModel.updateCurrentCoveragePolygon(null)},this.updateFootprintPanorama=async(t,i)=>{const{horizontalFieldOfView:o,pitch:a,verticalFieldOfView:l,yaw:m,feature:v,horizonAngles:f}=t,{activeViewer:w,currentBestFeature:h,currentCoverageVisible:y,footprintExtent:M,mode:b}=this.viewModel,C="video"===b||"panoramic-video"===b?u:w?.imageSize,F=v??h;if(!F||!C||!M||"none"===b)return void this.viewModel.updateCurrentCoveragePolygon(null);const{cameraPitch:j,objectId:P}=F.attributes;if(a+j-l/2>180)return void this.viewModel.updateCurrentCoveragePolygon(null);const R=[],I=l/2,x=o/2,V=a-I,D=a+I;if(V>90)return void this.viewModel.updateCurrentCoveragePolygon(null);const z=V<0,E=[-x,I],S=[x,I],B=[x,-I],q=[-x,-I];if(V<90&&D>90){R.push(z?B:q);const e=Math.floor(o/5),t=o/e;for(let i=0;i<=e;i++)R.push([i*t-x,90-a]);R.push(z?q:B)}D<90&&(R.push(E,S),z?R.push(q,B):R.push(B,q));const L=f??g(w?.media),O=R.map(([e,t])=>{const i=a+t,o=m+e,r=L?p(o,i,L):[o,i];return{...c(r[0],r[1],C[0],C[1]),heading:o,pitch:i}}),U={feature:F,mode:b,imageSize:C,footprintExtent:M},A=v?await this.viewModel.getMapPointForFeature(O,U,i):await this.viewModel.getMapPoint(O,i);r(i);const G=[A.map(({x:e,y:t})=>[e,t,1])];G[0].push(G[0][0]);const k=new s({rings:G,spatialReference:A[0].spatialReference}),H=this.viewModel.view?.spatialReference;if(!H)return;const J=H.equals(k.spatialReference)?k:await n(k,H,i);this.viewModel.updateCurrentCoveragePolygon(new e({geometry:J,attributes:{imageID:P},symbol:d.clone(),visible:y}))}}}export{v 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 t from"../../../Map.js";import i from"../../../core/Error.js";import{EventedAccessor as r}from"../../../core/Evented.js";import a from"../../../core/Logger.js";import{clamp as s}from"../../../core/mathUtils.js";import{abortMaybe as o}from"../../../core/maybe.js";import{throwIfAborted as n,isAbortError as l}from"../../../core/promiseUtils.js";import{watch as h,syncAndInitial as m,when as d,initial as p}from"../../../core/reactiveUtils.js";import{property as c,subclass as g}from"../../../core/accessorSupport/decorators.js";import{UpdatingHandles as u}from"../../../core/support/UpdatingHandles.js";import y from"../../../geometry/Point.js";import _ from"../../../geometry/Polygon.js";import f from"../../../geometry/SpatialReference.js";import{execute as v}from"../../../geometry/operators/intersectionOperator.js";import R from"../../../layers/GraphicsLayer.js";import w from"../../../layers/support/RasterFunction.js";import{convolutionKernel as x}from"../../../layers/support/rasterFunctionConstants.js";import C from"../../../layers/support/TileInfo.js";import b from"../../../views/MapView.js";import{getResolutionToScaleFactor as I}from"../../../views/2d/viewpointUtils.js";import j from"../support/NonPanoramicMedia.js";import{rotate as P,constrainViewpoint as H}from"../support/panConstraint.js";const M={click:"click-handle",enhancements:"enhancements-handle"};let L=class extends r{constructor(e){super(e),this._imageChanged=!1,this._panConstraint=null,this._image=null,this._loadController=null,this._overlays=new R({blendMode:"source-atop"}),this._map=new t,this.autoLoad=!1,this.clickAction="none",this.error=null,this.imageRotation=0,this.state="ready",this.updatingHandles=new u,this._cancelLoadWithController=()=>{this._loadController=o(this._loadController)},this._createImageHandles=()=>{this.removeHandles(M.enhancements),this.addHandles(h(()=>[this.brightness,this.contrast,this.sharpness],([e,t,i])=>{this.image?.loaded&&(this.image.effect=`contrast(${10*(t+10)}%) brightness(${10*(e+10)}%)`,this.sharpenImage(this.image,i))},m))},this._createPanConstraint=()=>{const{image:e,imageRenderer:t}=this,i=i=>{const{constraints:r,height:a,width:s,rotation:o}=t,{targetGeometry:n}=i;return"point"===n?.type&&e?.serviceRasterInfo?(H({constraints:r,containerHeight:a,containerWidth:s,imageExtent:e.serviceRasterInfo.extent,rotation:o,viewpoint:i,viewportExtent:t.extent}),i):i};return{constrain:i,applyPanConstraint:i}},this._createResizeHandles=e=>{e.removeHandles("resize"),e.addHandles(h(()=>{if(!this.imageRenderer.ready)return;const{extent:t}=e.serviceRasterInfo,{width:i,height:r,rotation:a}=this.imageRenderer,{extent:s}=P(_.fromExtent(t),a,t.center.x,t.center.y),{width:o,height:n}=s;return Math.max(o/i,n/r)},e=>{if(!this.imageRenderer||null==e)return;const{constraints:t,scale:i,spatialReference:r}=this.imageRenderer,a=t.minScale,s=I(r),o=.25*s,n=s*e;let l=n;const h=[];for(;l>o;)h.push(l),l/=2;h.push(l);const{lods:m}=C.create({scales:h});if(t.set({minScale:n,lods:m}),this._imageChanged)return this.imageRenderer.scale=n,void(this._imageChanged=!1);this.imageRenderer.scale=Math.abs(i-a)<=1e-6?n:i},m),"resize")},this._loadMediaInternal=async(e,t)=>{if(this.state="image-loading",this.clearImage(),this.error=null,this._imageChanged=!0,!e)throw new Error("No media to load");try{const{layer:i}=await e.load(t);n(t),this._image=i,this._updatePanConstraint(),this._createResizeHandles(this._image),this._map.add(this._image),this.imageRotation=e.rotation??0,this.media=e,this.state="image-loaded"}catch(i){if(!l(i))throw this.state="image-load-error",this.error=i,a.getLogger(this).error(`error occurred while loading image ${this._image?.url}`,i),this._image=null,i;this.state="image-load-aborted"}return this._image},this._loadWithController=()=>{this._cancelLoadWithController(),this.media&&(this._loadController=new AbortController,this._loadMediaInternal(this.media,this._loadController))},this._updatePanConstraint=()=>{this._panConstraint&&this.imageRenderer.constraints.customConstraints.remove(this._panConstraint),this._panConstraint=this._createPanConstraint(),this.imageRenderer.constraints.customConstraints.add(this._panConstraint)},this.addGraphic=(e,t)=>{this._overlays.graphics.add(e,t)},this.addManyGraphics=e=>{this._overlays.addMany(e)},this.clearGraphics=()=>{this._overlays.graphics.removeAll()},this.clearImage=()=>{this.image&&this._map.layers.remove(this.image),this._image=null},this.removeGraphic=e=>{this._overlays.remove(e)},this.removeManyGraphics=e=>{this._overlays.removeMany(e)},this._imageRenderer=new b({constraints:{snapToZoom:!0,rotationEnabled:!1},map:this._map,popupEnabled:!1,spatialReference:f.WebMercator,attributionVisible:!1})}destroy(){this.clearImage(),this.media=null,this._imageRenderer.destroy()}initialize(){this.state="initialized",this.addHandles([d(()=>null!=this.media&&this.autoLoad,this._loadWithController,m),h(()=>this.image?.loaded,()=>{this._createImageHandles()}),h(()=>this.imageRotation,()=>{this._rotateImage()}),h(()=>this.imageRenderer.map,(e,t)=>{t?.layers.remove(this._overlays),e?.layers.add(this._overlays)},p),h(()=>this.imageRenderer.map.allLayers.length,e=>{e&&this.imageRenderer.map.layers.reorder(this._overlays,e-1)},m),h(()=>this.clickAction,e=>{this.removeHandles(M.click),"none"!==e&&this.addHandles(this.imageRenderer.on("click",t=>{if(this.image?.loaded&&this.imageRenderer.ready)switch(e){case"emit":t.stopPropagation(),this.emit("click",t);break;case"hittest":t.stopPropagation(),t.defer(async()=>{const e=await this.imageRenderer.hitTest(t.screenPoint,{include:this._overlays});e.results=e.results.filter(e=>"graphic"===e.type),this.emit("hittest-response",e)});break;case"pixel-location":{if(t.stopPropagation(),!this.image?.serviceRasterInfo||!t.mapPoint)return void this.emit("pixel-location",null);const{extent:e,pixelSize:i}=this.image.serviceRasterInfo,r=(t.mapPoint.x-e.xmin)*i.x,a=(e.ymax-t.mapPoint.y)*i.y,s=new y({x:r,y:a,spatialReference:e.spatialReference});this.emit("pixel-location",s);break}}}))},m)])}get brightness(){return this._get("brightness")??0}set brightness(e){this._set("brightness",s(e,-10,10))}get contrast(){return this._get("contrast")??0}set contrast(e){this._set("contrast",s(e,-10,10))}get image(){return this._image}get imagePointsInView(){const{extent:e,ready:t}=this.imageRenderer,i=this.imageRotation,r=this.image?.fullExtent,a=this.image?.serviceRasterInfo,s=!0===this._imageRenderer.allLayerViews.find(({layer:e})=>e===this.image)?.attached;if(!(t&&e&&r&&a&&s))return null;const o=P(_.fromExtent(e),i,e.center.x,e.center.y),n=_.fromExtent(r),l=v(o,n);if(!l)return null;const{rings:h}=l;return h.flat().map(([e,t])=>({x:(e-a.extent.xmin)*a.pixelSize.x,y:(a.extent.ymax-t)*a.pixelSize.y}))}get imageSize(){const{image:e}=this;if(!e?.raster)return null;const{width:t,height:i}=e.raster.rasterInfo;return[t,i]}get imageRenderer(){return this._imageRenderer}get imageView(){return this.imageRenderer.allLayerViews.find(e=>e.layer===this.image)}get sharpness(){return this._get("sharpness")??0}set sharpness(e){this._set("sharpness",s(e,0,1))}get updating(){return this.updatingHandles.updating}_rotateImage(){this.imageRenderer.constraints.rotationEnabled=!0,this.imageRenderer.rotation=this.imageRotation,this.imageRenderer.constraints.rotationEnabled=!1}sharpenImage(e,t){if(!t)return void(e.rasterFunction=null);const i=[0,-1*t,0,-1*t,4*t+1,-1*t,0,-1*t,0],r=new w({functionName:"Convolution",functionArguments:{type:x.userDefined,cols:3,rows:3,kernel:i,convolutionType:x.userDefined}});e.rasterFunction=r}async loadMedia(e,t){this.state="image-loading";const i=this.autoLoad;this.autoLoad=!1;return await this._loadMediaInternal(e,t).finally(()=>{this.autoLoad=i})}};e([c()],L.prototype,"_image",void 0),e([c()],L.prototype,"_imageRenderer",void 0),e([c()],L.prototype,"_loadController",void 0),e([c()],L.prototype,"_overlays",void 0),e([c()],L.prototype,"_map",void 0),e([c({type:Boolean})],L.prototype,"autoLoad",void 0),e([c({type:Number})],L.prototype,"brightness",null),e([c()],L.prototype,"clickAction",void 0),e([c({type:Number})],L.prototype,"contrast",null),e([c({type:Object})],L.prototype,"customParameters",void 0),e([c({type:i})],L.prototype,"error",void 0),e([c({readOnly:!0})],L.prototype,"image",null),e([c({readOnly:!0})],L.prototype,"imagePointsInView",null),e([c({readOnly:!0})],L.prototype,"imageSize",null),e([c({readOnly:!0})],L.prototype,"imageRenderer",null),e([c({type:Number})],L.prototype,"imageRotation",void 0),e([c()],L.prototype,"imageView",null),e([c({type:j})],L.prototype,"media",void 0),e([c({type:Number})],L.prototype,"sharpness",null),e([c()],L.prototype,"state",void 0),e([c()],L.prototype,"updatingHandles",void 0),e([c()],L.prototype,"updating",null),L=e([g("esri.widgets.OrientedImageryViewer.components.ImageViewerViewModel")],L);const E=L;export{E as default};
2
+ import{__decorate as e}from"tslib";import t from"../../../Map.js";import i from"../../../core/Error.js";import{EventedAccessor as r}from"../../../core/Evented.js";import a from"../../../core/Logger.js";import{clamp as s}from"../../../core/mathUtils.js";import{abortMaybe as o}from"../../../core/maybe.js";import{throwIfAborted as n,isAbortError as l}from"../../../core/promiseUtils.js";import{watch as h,syncAndInitial as m,when as d,initial as p}from"../../../core/reactiveUtils.js";import{property as c,subclass as g}from"../../../core/accessorSupport/decorators.js";import{UpdatingHandles as u}from"../../../core/support/UpdatingHandles.js";import y from"../../../geometry/Point.js";import _ from"../../../geometry/Polygon.js";import f from"../../../geometry/SpatialReference.js";import{intersectionExecute as v}from"../../../geometry/operators/intersectionOperator.js";import R from"../../../layers/GraphicsLayer.js";import w from"../../../layers/support/RasterFunction.js";import{convolutionKernel as x}from"../../../layers/support/rasterFunctionConstants.js";import C from"../../../layers/support/TileInfo.js";import b from"../../../views/MapView.js";import{getResolutionToScaleFactor as I}from"../../../views/2d/viewpointUtils.js";import j from"../support/NonPanoramicMedia.js";import{rotate as P,constrainViewpoint as H}from"../support/panConstraint.js";const M={click:"click-handle",enhancements:"enhancements-handle"};let L=class extends r{constructor(e){super(e),this._imageChanged=!1,this._panConstraint=null,this._image=null,this._loadController=null,this._overlays=new R({blendMode:"source-atop"}),this._map=new t,this.autoLoad=!1,this.clickAction="none",this.error=null,this.imageRotation=0,this.state="ready",this.updatingHandles=new u,this._cancelLoadWithController=()=>{this._loadController=o(this._loadController)},this._createImageHandles=()=>{this.removeHandles(M.enhancements),this.addHandles(h(()=>[this.brightness,this.contrast,this.sharpness],([e,t,i])=>{this.image?.loaded&&(this.image.effect=`contrast(${10*(t+10)}%) brightness(${10*(e+10)}%)`,this.sharpenImage(this.image,i))},m))},this._createPanConstraint=()=>{const{image:e,imageRenderer:t}=this,i=i=>{const{constraints:r,height:a,width:s,rotation:o}=t,{targetGeometry:n}=i;return"point"===n?.type&&e?.serviceRasterInfo?(H({constraints:r,containerHeight:a,containerWidth:s,imageExtent:e.serviceRasterInfo.extent,rotation:o,viewpoint:i,viewportExtent:t.extent}),i):i};return{constrain:i,applyPanConstraint:i}},this._createResizeHandles=e=>{e.removeHandles("resize"),e.addHandles(h(()=>{if(!this.imageRenderer.ready)return;const{extent:t}=e.serviceRasterInfo,{width:i,height:r,rotation:a}=this.imageRenderer,{extent:s}=P(_.fromExtent(t),a,t.center.x,t.center.y),{width:o,height:n}=s;return Math.max(o/i,n/r)},e=>{if(!this.imageRenderer||null==e)return;const{constraints:t,scale:i,spatialReference:r}=this.imageRenderer,a=t.minScale,s=I(r),o=.25*s,n=s*e;let l=n;const h=[];for(;l>o;)h.push(l),l/=2;h.push(l);const{lods:m}=C.create({scales:h});if(t.set({minScale:n,lods:m}),this._imageChanged)return this.imageRenderer.scale=n,void(this._imageChanged=!1);this.imageRenderer.scale=Math.abs(i-a)<=1e-6?n:i},m),"resize")},this._loadMediaInternal=async(e,t)=>{if(this.state="image-loading",this.clearImage(),this.error=null,this._imageChanged=!0,!e)throw new Error("No media to load");try{const{layer:i}=await e.load(t);n(t),this._image=i,this._updatePanConstraint(),this._createResizeHandles(this._image),this._map.add(this._image),this.imageRotation=e.rotation??0,this.media=e,this.state="image-loaded"}catch(i){if(!l(i))throw this.state="image-load-error",this.error=i,a.getLogger(this).error(`error occurred while loading image ${this._image?.url}`,i),this._image=null,i;this.state="image-load-aborted"}return this._image},this._loadWithController=()=>{this._cancelLoadWithController(),this.media&&(this._loadController=new AbortController,this._loadMediaInternal(this.media,this._loadController))},this._updatePanConstraint=()=>{this._panConstraint&&this.imageRenderer.constraints.customConstraints.remove(this._panConstraint),this._panConstraint=this._createPanConstraint(),this.imageRenderer.constraints.customConstraints.add(this._panConstraint)},this.addGraphic=(e,t)=>{this._overlays.graphics.add(e,t)},this.addManyGraphics=e=>{this._overlays.addMany(e)},this.clearGraphics=()=>{this._overlays.graphics.removeAll()},this.clearImage=()=>{this.image&&this._map.layers.remove(this.image),this._image=null},this.removeGraphic=e=>{this._overlays.remove(e)},this.removeManyGraphics=e=>{this._overlays.removeMany(e)},this._imageRenderer=new b({constraints:{snapToZoom:!0,rotationEnabled:!1},map:this._map,popupEnabled:!1,spatialReference:f.WebMercator,attributionVisible:!1})}destroy(){this.clearImage(),this.media=null,this._imageRenderer.destroy()}initialize(){this.state="initialized",this.addHandles([d(()=>null!=this.media&&this.autoLoad,this._loadWithController,m),h(()=>this.image?.loaded,()=>{this._createImageHandles()}),h(()=>this.imageRotation,()=>{this._rotateImage()}),h(()=>this.imageRenderer.map,(e,t)=>{t?.layers.remove(this._overlays),e?.layers.add(this._overlays)},p),h(()=>this.imageRenderer.map.allLayers.length,e=>{e&&this.imageRenderer.map.layers.reorder(this._overlays,e-1)},m),h(()=>this.clickAction,e=>{this.removeHandles(M.click),"none"!==e&&this.addHandles(this.imageRenderer.on("click",t=>{if(this.image?.loaded&&this.imageRenderer.ready)switch(e){case"emit":t.stopPropagation(),this.emit("click",t);break;case"hittest":t.stopPropagation(),t.defer(async()=>{const e=await this.imageRenderer.hitTest(t.screenPoint,{include:this._overlays});e.results=e.results.filter(e=>"graphic"===e.type),this.emit("hittest-response",e)});break;case"pixel-location":{if(t.stopPropagation(),!this.image?.serviceRasterInfo||!t.mapPoint)return void this.emit("pixel-location",null);const{extent:e,pixelSize:i}=this.image.serviceRasterInfo,r=(t.mapPoint.x-e.xmin)*i.x,a=(e.ymax-t.mapPoint.y)*i.y,s=new y({x:r,y:a,spatialReference:e.spatialReference});this.emit("pixel-location",s);break}}}))},m)])}get brightness(){return this._get("brightness")??0}set brightness(e){this._set("brightness",s(e,-10,10))}get contrast(){return this._get("contrast")??0}set contrast(e){this._set("contrast",s(e,-10,10))}get image(){return this._image}get imagePointsInView(){const{extent:e,ready:t}=this.imageRenderer,i=this.imageRotation,r=this.image?.fullExtent,a=this.image?.serviceRasterInfo,s=!0===this._imageRenderer.allLayerViews.find(({layer:e})=>e===this.image)?.attached;if(!(t&&e&&r&&a&&s))return null;const o=P(_.fromExtent(e),i,e.center.x,e.center.y),n=_.fromExtent(r),l=v(o,n);if(!l)return null;const{rings:h}=l;return h.flat().map(([e,t])=>({x:(e-a.extent.xmin)*a.pixelSize.x,y:(a.extent.ymax-t)*a.pixelSize.y}))}get imageSize(){const{image:e}=this;if(!e?.raster)return null;const{width:t,height:i}=e.raster.rasterInfo;return[t,i]}get imageRenderer(){return this._imageRenderer}get imageView(){return this.imageRenderer.allLayerViews.find(e=>e.layer===this.image)}get sharpness(){return this._get("sharpness")??0}set sharpness(e){this._set("sharpness",s(e,0,1))}get updating(){return this.updatingHandles.updating}_rotateImage(){this.imageRenderer.constraints.rotationEnabled=!0,this.imageRenderer.rotation=this.imageRotation,this.imageRenderer.constraints.rotationEnabled=!1}sharpenImage(e,t){if(!t)return void(e.rasterFunction=null);const i=[0,-1*t,0,-1*t,4*t+1,-1*t,0,-1*t,0],r=new w({functionName:"Convolution",functionArguments:{type:x.userDefined,cols:3,rows:3,kernel:i,convolutionType:x.userDefined}});e.rasterFunction=r}async loadMedia(e,t){this.state="image-loading";const i=this.autoLoad;this.autoLoad=!1;return await this._loadMediaInternal(e,t).finally(()=>{this.autoLoad=i})}};e([c()],L.prototype,"_image",void 0),e([c()],L.prototype,"_imageRenderer",void 0),e([c()],L.prototype,"_loadController",void 0),e([c()],L.prototype,"_overlays",void 0),e([c()],L.prototype,"_map",void 0),e([c({type:Boolean})],L.prototype,"autoLoad",void 0),e([c({type:Number})],L.prototype,"brightness",null),e([c()],L.prototype,"clickAction",void 0),e([c({type:Number})],L.prototype,"contrast",null),e([c({type:Object})],L.prototype,"customParameters",void 0),e([c({type:i})],L.prototype,"error",void 0),e([c({readOnly:!0})],L.prototype,"image",null),e([c({readOnly:!0})],L.prototype,"imagePointsInView",null),e([c({readOnly:!0})],L.prototype,"imageSize",null),e([c({readOnly:!0})],L.prototype,"imageRenderer",null),e([c({type:Number})],L.prototype,"imageRotation",void 0),e([c()],L.prototype,"imageView",null),e([c({type:j})],L.prototype,"media",void 0),e([c({type:Number})],L.prototype,"sharpness",null),e([c()],L.prototype,"state",void 0),e([c()],L.prototype,"updatingHandles",void 0),e([c()],L.prototype,"updating",null),L=e([g("esri.widgets.OrientedImageryViewer.components.ImageViewerViewModel")],L);const E=L;export{E 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 t from"../../../Graphic.js";import i from"../../../core/Accessor.js";import{createTask as o}from"../../../core/asyncUtils.js";import r from"../../../core/Logger.js";import{throwIfAborted as n,isAbortError as s}from"../../../core/promiseUtils.js";import{watch as a,syncAndInitial as d}from"../../../core/reactiveUtils.js";import{property as l,subclass as c}from"../../../core/accessorSupport/decorators.js";import p from"../../../geometry/Extent.js";import h from"../../../geometry/Multipoint.js";import u from"../../../geometry/Polygon.js";import m from"../../../geometry/Polyline.js";import{projectAsync as V}from"../../../geometry/projectionUtils.js";import{execute as v}from"../../../geometry/operators/clipOperator.js";import{execute as f}from"../../../geometry/operators/intersectionOperator.js";import{createCoveragePolygon as y}from"../../../layers/orientedImagery/core/coverageUtils.js";import{getResolutionToScaleFactor as w}from"../../../views/2d/viewpointUtils.js";import{fixedImageSize as g,videoSpatialReference as M,sampleExtent as P,videoFitScaleTolerance as O}from"../constants.js";import{diamondSymbol as _,crossSymbol as F}from"../symbols.js";import{registryKeys as S}from"../types.js";import{imageGeometryToVideoMapGeometry as x,pixelToVideoMapPoint as R,geoToPixel as E}from"../videoViewerUtils.js";import{coordinateToPoints as L}from"../support/geometryUtils.js";const[j,C]=g,b=new p({...P,spatialReference:M});function G({x:e,y:t}){return[P.xmin+e/j*(P.xmax-P.xmin),P.ymax-t/C*(P.ymax-P.ymin)]}function I(e){if(e.length<2)return[];const t=new m({paths:[e.map(e=>G(e))],spatialReference:M}),i=v(t,b);return"polyline"===i?.type?i.paths:[]}async function T(e,t,i){let o=y(t.attributes).polygon;e.spatialReference.equals(o.spatialReference)||(o=await V(o,e.spatialReference,i),n(i));const r=f(e,o);return"polyline"===r?.type?r:null}async function H(e,t,i){let o=y(t.attributes).polygon;e.spatialReference.equals(o.spatialReference)||(o=await V(o,e.spatialReference,i),n(i));const r=f(e,o);return"polygon"===r?.type?r:null}let A=class extends i{constructor(e){super(e),this.closestFeature=null,this.currentTime=0,this.videoBrightness=0,this.videoContrast=0,this.videoDuration=void 0,this.videoPaused=null,this.videoScale=void 0,this.videoMuted=null,this._referencePointOnVideo=null,this._selectedPointOnVideo=null,this.enableAudio=()=>{const{videoElement:e}=this.oiViewModel;e?.content&&(e.content.muted=!1,this.videoMuted=!1)},this.playVideoHandler=()=>{const e=this.oiViewModel.videoElement?.content;e&&(e.paused?e.play().catch(e=>{r.getLogger(this).error("error playing video",e)}):e.pause())},this.rewindVideoHandler=()=>{const e=this.oiViewModel.videoElement?.content;e&&(e.currentTime=0,e.play().catch(e=>{r.getLogger(this).error("error playing video",e)}))},this.resetVideoHandler=()=>{const{videoElement:e,videoMapView:t,videoLayer:i}=this.oiViewModel;this.removeHandles(S.videoImageClick),this.closestFeature=null,this.clearReferencePointOnVideo(),this.clearOverlayGraphics(),e?.content&&i&&t&&(e.content.pause(),t.map.layers.remove(i),i.destroy(),this.oiViewModel.videoElement=null)},this.resetVideoEnhancementTools=()=>{this.oiViewModel?.videoLayer&&(this.videoBrightness=0,this.videoContrast=0,this._updateVideoEffect())},this.resetVideoScale=()=>{this.videoScale&&(this.oiViewModel.videoMapView.scale=this.videoScale)},this.toggleAudio=()=>{const{videoElement:e}=this.oiViewModel;if(e?.content){const t=e.content.muted;e.content.muted=!t,this.videoMuted=!t}}}initialize(){this.addHandles([a(()=>this.oiViewModel.videoElement?.content,e=>{if(e instanceof HTMLVideoElement){this._startVideo();const t=async()=>{this.currentTime=Number(e.currentTime.toFixed(2)),e.currentTime&&await this._updateVidFootprint(e.currentTime)};e.addEventListener("timeupdate",t),e.addEventListener("play",()=>this._updateVideoIcon(e.paused)),e.addEventListener("pause",()=>this._pauseVideoHandler(e))}},d),a(()=>this._videoMinResolutionForCurrentView,e=>{null!=e&&this._updateVideoScaleForResize(e)},d),a(()=>this.oiViewModel.layer,(e,t)=>{t&&e&&e.uid!==t.uid&&this.oiViewModel.resetVideo()},d)])}destroy(){this.resetVideoHandler()}_pauseVideoHandler(e){this._updateVideoIcon(e.paused),e.paused&&this.oiViewModel.transformAndPlotSelectedLocation()}get _videoMinResolutionForCurrentView(){const{mode:e,videoMapView:t}=this.oiViewModel;if("video"!==e||!t.ready)return;const{width:i,height:o}=t;return i&&o?Math.max(b.width/i,b.height/o):void 0}_updateVideoScaleForResize(e){const{videoMapView:t}=this.oiViewModel,{constraints:i,scale:o,spatialReference:r}=t,n=i.minScale,s=Math.abs(o-n)<=O,a=w(r)*e;i.set({minScale:a}),this.videoScale=a,t.scale=s?a:o,s&&requestAnimationFrame(()=>{const{extent:e,scale:i,constraints:o}=t;e&&Math.abs(i-o.minScale)<=O&&(this.oiViewModel.initialVideoMapViewExtent=e.clone())})}_setVideoInfo(){const{videoElement:e,videoMapView:t}=this.oiViewModel;e?.content&&(this.videoDuration=e.content.duration,this.videoScale=t.scale)}_startVideo(){try{this.enableAudio(),this._setVideoInfo();const e=this.oiViewModel.currentBestFeature;e&&this.playVideoFromSelectedLocation(e)}catch(e){r.getLogger(this).error("oriented-imagery-viewer:video-load",e)}}async _updateVideoFootprintWithGivenFeature(e,t,i){const{activeViewer:o,mode:a,footprintExtent:d}=this.oiViewModel;if(t&&("video"===a?g:o?.imageSize)&&d)try{const o={points:e,feature:t,undefined:void 0,options:i};await this.oiViewModel.updateVideoFootprint(o),n(i)}catch(l){s(l)||r.getLogger(this).error("update-footprint",l)}else this.oiViewModel.updateCurrentCoveragePolygon(null)}async _updateVidFootprint(e){const t=this.oiViewModel.featureCache.find(t=>t.attributes.offsetFromStart===Math.floor(e));null!=t?.attributes.offsetFromStart&&this.closestFeature!==t&&(this.closestFeature=t,await this._updateVideoFootprintWithGivenFeature(this.oiViewModel.videoExtentPoints,t))}_updateVideoIcon(e){this.videoPaused=!!e,!e&&this.oiViewModel.mapImageConversionToolState&&(this.oiViewModel.setMapImageConversionToolState(!1),this.oiViewModel.plotReferencePointOnGround(null),this.clearReferencePointOnVideo()),e||(this.oiViewModel.clearSelectedPointOnViewer(),this.clearOverlayGraphics())}_updateVideoEffect(){if(!this.oiViewModel?.videoLayer)return;const e=1+this.videoBrightness/10,t=1+this.videoContrast/10;this.oiViewModel.videoLayer.effect=`brightness(${e}) contrast(${t})`}handleVideoBrightnessChange(e){this.oiViewModel?.videoLayer&&(this.videoBrightness=e??0,this._updateVideoEffect())}handleVideoContrastChange(e){this.oiViewModel?.videoLayer&&(this.videoContrast=e??0,this._updateVideoEffect())}playVideoFromSelectedLocation(e){const t=e.attributes.offsetFromStart,i=this.oiViewModel.videoElement?.content;this.closestFeature=e,this.resetVideoScale(),this.clearOverlayGraphics(),i&&null!=t&&(i.currentTime=t,i.play().catch(e=>{r.getLogger(this).error("error playing video",e)}))}addOverlayGraphics(e){this.oiViewModel.videoMapView.graphics.addMany(e)}imageGeometryToOverlayGeometry(e){return x(e)}async geometryToOverlayGeometry(e,t,i){const{footprintExtent:o}=this.oiViewModel;if(!o)return null;const r={feature:t,mode:"video",imageSize:g,footprintExtent:o};switch(e.type){case"point":{const t=await this.oiViewModel.getPixelLocationForFeature(e,r,i);return R(t)}case"polyline":{const o=await T(e,t,i);if(!o)return null;const s=(await Promise.all(o.paths.map(async t=>{const o=t.map(t=>L(t,e.spatialReference)),s=await this.oiViewModel.getPixelLocationsForFeature(o,r,i);return n(i),I(s)}))).flat();return s.length?new m({paths:s,spatialReference:M}):null}case"polygon":{const o=await H(e,t,i);if(!o)return null;const s=await Promise.all(o.rings.map(async t=>{const o=t.map(t=>L(t,e.spatialReference)),s=await this.oiViewModel.getPixelLocationsForFeature(o,r,i);return n(i),s.map(e=>{const t=R(e);return[t.x,t.y]})}));return u.fromJSON({rings:s,spatialReference:M})}case"multipoint":{const t=e.points.map(t=>L(t,e.spatialReference)),o=await this.oiViewModel.getPixelLocationsForFeature(t,r,i);return n(i),h.fromJSON({points:o.map(e=>{const t=R(e);return[t.x,t.y]}),spatialReference:M})}case"extent":{const o=u.fromExtent(e),r=await this.geometryToOverlayGeometry(o,t,i);return r?.extent??null}default:return null}}removeOverlayGraphics(e){this.oiViewModel.videoMapView.graphics.removeMany(e)}clearOverlayGraphics(){const e=Array.from(this.oiViewModel.overlayedMapFeatures.values()).flatMap(e=>e.toArray()),t=this.oiViewModel.videoMapView.graphics.toArray().filter(e=>e!==this._referencePointOnVideo&&e!==this._selectedPointOnVideo),i=Array.from(new Set([...this.oiViewModel.overlayedCameraLocations.toArray(),...e,...t]));i.length&&this.removeOverlayGraphics(i)}syncMapImageConversionHandle(){this.removeHandles(S.videoImageClick);const{currentBestFeature:e,footprintExtent:t,mode:i,mapImageConversionToolState:r,state:s,view:a,videoMapView:d}=this.oiViewModel;if(!r||!0!==this.videoPaused||"video-loaded"!==s||!t||!e)return;let l=null;const c=d.on("click",e=>{if(e.stopPropagation(),e.preventDefault(),!e.mapPoint)return;const r=E(e.mapPoint.x,e.mapPoint.y);this.oiViewModel.plotReferencePointOnImage(r),l?.abort(),l=o(async e=>{const o=this.closestFeature??this.oiViewModel.currentBestFeature;if(!o)return;const s={feature:o,mode:i,imageSize:g,footprintExtent:t};let d=await this.oiViewModel.getMapPointForFeature(r,s,{signal:e});n(e);const l=a?.spatialReference;l&&!d.spatialReference.equals(l)&&(d=await V(d,l),n(e)),this.oiViewModel.plotReferencePointOnGround(d)})});this.addHandles(c,S.videoImageClick)}plotReferencePointOnVideo(e){this.clearReferencePointOnVideo(),this._referencePointOnVideo=new t({geometry:R(e),symbol:_.clone()}),this.oiViewModel.videoMapView.graphics.add(this._referencePointOnVideo)}plotSelectedPointOnVideo(e){return this.clearSelectedPointOnVideo(),this._selectedPointOnVideo=new t({geometry:R(e),symbol:F.clone()}),this.oiViewModel.videoMapView.graphics.add(this._selectedPointOnVideo),this._selectedPointOnVideo}clearReferencePointOnVideo(){this._referencePointOnVideo&&(this.oiViewModel.videoMapView.graphics.remove(this._referencePointOnVideo),this._referencePointOnVideo.destroy(),this._referencePointOnVideo=null)}clearSelectedPointOnVideo(){this._selectedPointOnVideo&&(this.oiViewModel.videoMapView.graphics.remove(this._selectedPointOnVideo),this._selectedPointOnVideo.destroy(),this._selectedPointOnVideo=null)}};e([l()],A.prototype,"closestFeature",void 0),e([l()],A.prototype,"currentTime",void 0),e([l()],A.prototype,"oiViewModel",void 0),e([l({type:Number})],A.prototype,"videoBrightness",void 0),e([l({type:Number})],A.prototype,"videoContrast",void 0),e([l()],A.prototype,"videoDuration",void 0),e([l()],A.prototype,"videoPaused",void 0),e([l()],A.prototype,"videoScale",void 0),e([l()],A.prototype,"videoMuted",void 0),e([l()],A.prototype,"_referencePointOnVideo",void 0),e([l()],A.prototype,"_selectedPointOnVideo",void 0),e([l()],A.prototype,"_videoMinResolutionForCurrentView",null),A=e([c("esri.widgets.OrientedImageryViewer.components.OrientedImageryVideoViewModel")],A);const B=A;export{B as default};
2
+ import{__decorate as e}from"tslib";import t from"../../../Graphic.js";import i from"../../../core/Accessor.js";import{createTask as o}from"../../../core/asyncUtils.js";import r from"../../../core/Logger.js";import{throwIfAborted as n,isAbortError as s}from"../../../core/promiseUtils.js";import{watch as a,syncAndInitial as d}from"../../../core/reactiveUtils.js";import{property as l,subclass as c}from"../../../core/accessorSupport/decorators.js";import p from"../../../geometry/Extent.js";import h from"../../../geometry/Multipoint.js";import u from"../../../geometry/Polygon.js";import m from"../../../geometry/Polyline.js";import{projectAsync as V}from"../../../geometry/projectionUtils.js";import{clipExecute as v}from"../../../geometry/operators/clipOperator.js";import{intersectionExecute as f}from"../../../geometry/operators/intersectionOperator.js";import{createCoveragePolygon as y}from"../../../layers/orientedImagery/core/coverageUtils.js";import{getResolutionToScaleFactor as w}from"../../../views/2d/viewpointUtils.js";import{fixedImageSize as g,videoSpatialReference as M,sampleExtent as P,videoFitScaleTolerance as O}from"../constants.js";import{diamondSymbol as _,crossSymbol as F}from"../symbols.js";import{registryKeys as S}from"../types.js";import{imageGeometryToVideoMapGeometry as x,pixelToVideoMapPoint as R,geoToPixel as E}from"../videoViewerUtils.js";import{coordinateToPoints as L}from"../support/geometryUtils.js";const[j,C]=g,b=new p({...P,spatialReference:M});function G({x:e,y:t}){return[P.xmin+e/j*(P.xmax-P.xmin),P.ymax-t/C*(P.ymax-P.ymin)]}function I(e){if(e.length<2)return[];const t=new m({paths:[e.map(e=>G(e))],spatialReference:M}),i=v(t,b);return"polyline"===i?.type?i.paths:[]}async function T(e,t,i){let o=y(t.attributes).polygon;e.spatialReference.equals(o.spatialReference)||(o=await V(o,e.spatialReference,i),n(i));const r=f(e,o);return"polyline"===r?.type?r:null}async function H(e,t,i){let o=y(t.attributes).polygon;e.spatialReference.equals(o.spatialReference)||(o=await V(o,e.spatialReference,i),n(i));const r=f(e,o);return"polygon"===r?.type?r:null}let A=class extends i{constructor(e){super(e),this.closestFeature=null,this.currentTime=0,this.videoBrightness=0,this.videoContrast=0,this.videoDuration=void 0,this.videoPaused=null,this.videoScale=void 0,this.videoMuted=null,this._referencePointOnVideo=null,this._selectedPointOnVideo=null,this.enableAudio=()=>{const{videoElement:e}=this.oiViewModel;e?.content&&(e.content.muted=!1,this.videoMuted=!1)},this.playVideoHandler=()=>{const e=this.oiViewModel.videoElement?.content;e&&(e.paused?e.play().catch(e=>{r.getLogger(this).error("error playing video",e)}):e.pause())},this.rewindVideoHandler=()=>{const e=this.oiViewModel.videoElement?.content;e&&(e.currentTime=0,e.play().catch(e=>{r.getLogger(this).error("error playing video",e)}))},this.resetVideoHandler=()=>{const{videoElement:e,videoMapView:t,videoLayer:i}=this.oiViewModel;this.removeHandles(S.videoImageClick),this.closestFeature=null,this.clearReferencePointOnVideo(),this.clearOverlayGraphics(),e?.content&&i&&t&&(e.content.pause(),t.map.layers.remove(i),i.destroy(),this.oiViewModel.videoElement=null)},this.resetVideoEnhancementTools=()=>{this.oiViewModel?.videoLayer&&(this.videoBrightness=0,this.videoContrast=0,this._updateVideoEffect())},this.resetVideoScale=()=>{this.videoScale&&(this.oiViewModel.videoMapView.scale=this.videoScale)},this.toggleAudio=()=>{const{videoElement:e}=this.oiViewModel;if(e?.content){const t=e.content.muted;e.content.muted=!t,this.videoMuted=!t}}}initialize(){this.addHandles([a(()=>this.oiViewModel.videoElement?.content,e=>{if(e instanceof HTMLVideoElement){this._startVideo();const t=async()=>{this.currentTime=Number(e.currentTime.toFixed(2)),e.currentTime&&await this._updateVidFootprint(e.currentTime)};e.addEventListener("timeupdate",t),e.addEventListener("play",()=>this._updateVideoIcon(e.paused)),e.addEventListener("pause",()=>this._pauseVideoHandler(e))}},d),a(()=>this._videoMinResolutionForCurrentView,e=>{null!=e&&this._updateVideoScaleForResize(e)},d),a(()=>this.oiViewModel.layer,(e,t)=>{t&&e&&e.uid!==t.uid&&this.oiViewModel.resetVideo()},d)])}destroy(){this.resetVideoHandler()}_pauseVideoHandler(e){this._updateVideoIcon(e.paused),e.paused&&this.oiViewModel.transformAndPlotSelectedLocation()}get _videoMinResolutionForCurrentView(){const{mode:e,videoMapView:t}=this.oiViewModel;if("video"!==e||!t.ready)return;const{width:i,height:o}=t;return i&&o?Math.max(b.width/i,b.height/o):void 0}_updateVideoScaleForResize(e){const{videoMapView:t}=this.oiViewModel,{constraints:i,scale:o,spatialReference:r}=t,n=i.minScale,s=Math.abs(o-n)<=O,a=w(r)*e;i.set({minScale:a}),this.videoScale=a,t.scale=s?a:o,s&&requestAnimationFrame(()=>{const{extent:e,scale:i,constraints:o}=t;e&&Math.abs(i-o.minScale)<=O&&(this.oiViewModel.initialVideoMapViewExtent=e.clone())})}_setVideoInfo(){const{videoElement:e,videoMapView:t}=this.oiViewModel;e?.content&&(this.videoDuration=e.content.duration,this.videoScale=t.scale)}_startVideo(){try{this.enableAudio(),this._setVideoInfo();const e=this.oiViewModel.currentBestFeature;e&&this.playVideoFromSelectedLocation(e)}catch(e){r.getLogger(this).error("oriented-imagery-viewer:video-load",e)}}async _updateVideoFootprintWithGivenFeature(e,t,i){const{activeViewer:o,mode:a,footprintExtent:d}=this.oiViewModel;if(t&&("video"===a?g:o?.imageSize)&&d)try{const o={points:e,feature:t,undefined:void 0,options:i};await this.oiViewModel.updateVideoFootprint(o),n(i)}catch(l){s(l)||r.getLogger(this).error("update-footprint",l)}else this.oiViewModel.updateCurrentCoveragePolygon(null)}async _updateVidFootprint(e){const t=this.oiViewModel.featureCache.find(t=>t.attributes.offsetFromStart===Math.floor(e));null!=t?.attributes.offsetFromStart&&this.closestFeature!==t&&(this.closestFeature=t,await this._updateVideoFootprintWithGivenFeature(this.oiViewModel.videoExtentPoints,t))}_updateVideoIcon(e){this.videoPaused=!!e,!e&&this.oiViewModel.mapImageConversionToolState&&(this.oiViewModel.setMapImageConversionToolState(!1),this.oiViewModel.plotReferencePointOnGround(null),this.clearReferencePointOnVideo()),e||(this.oiViewModel.clearSelectedPointOnViewer(),this.clearOverlayGraphics())}_updateVideoEffect(){if(!this.oiViewModel?.videoLayer)return;const e=1+this.videoBrightness/10,t=1+this.videoContrast/10;this.oiViewModel.videoLayer.effect=`brightness(${e}) contrast(${t})`}handleVideoBrightnessChange(e){this.oiViewModel?.videoLayer&&(this.videoBrightness=e??0,this._updateVideoEffect())}handleVideoContrastChange(e){this.oiViewModel?.videoLayer&&(this.videoContrast=e??0,this._updateVideoEffect())}playVideoFromSelectedLocation(e){const t=e.attributes.offsetFromStart,i=this.oiViewModel.videoElement?.content;this.closestFeature=e,this.resetVideoScale(),this.clearOverlayGraphics(),i&&null!=t&&(i.currentTime=t,i.play().catch(e=>{r.getLogger(this).error("error playing video",e)}))}addOverlayGraphics(e){this.oiViewModel.videoMapView.graphics.addMany(e)}imageGeometryToOverlayGeometry(e){return x(e)}async geometryToOverlayGeometry(e,t,i){const{footprintExtent:o}=this.oiViewModel;if(!o)return null;const r={feature:t,mode:"video",imageSize:g,footprintExtent:o};switch(e.type){case"point":{const t=await this.oiViewModel.getPixelLocationForFeature(e,r,i);return R(t)}case"polyline":{const o=await T(e,t,i);if(!o)return null;const s=(await Promise.all(o.paths.map(async t=>{const o=t.map(t=>L(t,e.spatialReference)),s=await this.oiViewModel.getPixelLocationsForFeature(o,r,i);return n(i),I(s)}))).flat();return s.length?new m({paths:s,spatialReference:M}):null}case"polygon":{const o=await H(e,t,i);if(!o)return null;const s=await Promise.all(o.rings.map(async t=>{const o=t.map(t=>L(t,e.spatialReference)),s=await this.oiViewModel.getPixelLocationsForFeature(o,r,i);return n(i),s.map(e=>{const t=R(e);return[t.x,t.y]})}));return u.fromJSON({rings:s,spatialReference:M})}case"multipoint":{const t=e.points.map(t=>L(t,e.spatialReference)),o=await this.oiViewModel.getPixelLocationsForFeature(t,r,i);return n(i),h.fromJSON({points:o.map(e=>{const t=R(e);return[t.x,t.y]}),spatialReference:M})}case"extent":{const o=u.fromExtent(e),r=await this.geometryToOverlayGeometry(o,t,i);return r?.extent??null}default:return null}}removeOverlayGraphics(e){this.oiViewModel.videoMapView.graphics.removeMany(e)}clearOverlayGraphics(){const e=Array.from(this.oiViewModel.overlayedMapFeatures.values()).flatMap(e=>e.toArray()),t=this.oiViewModel.videoMapView.graphics.toArray().filter(e=>e!==this._referencePointOnVideo&&e!==this._selectedPointOnVideo),i=Array.from(new Set([...this.oiViewModel.overlayedCameraLocations.toArray(),...e,...t]));i.length&&this.removeOverlayGraphics(i)}syncMapImageConversionHandle(){this.removeHandles(S.videoImageClick);const{currentBestFeature:e,footprintExtent:t,mode:i,mapImageConversionToolState:r,state:s,view:a,videoMapView:d}=this.oiViewModel;if(!r||!0!==this.videoPaused||"video-loaded"!==s||!t||!e)return;let l=null;const c=d.on("click",e=>{if(e.stopPropagation(),e.preventDefault(),!e.mapPoint)return;const r=E(e.mapPoint.x,e.mapPoint.y);this.oiViewModel.plotReferencePointOnImage(r),l?.abort(),l=o(async e=>{const o=this.closestFeature??this.oiViewModel.currentBestFeature;if(!o)return;const s={feature:o,mode:i,imageSize:g,footprintExtent:t};let d=await this.oiViewModel.getMapPointForFeature(r,s,{signal:e});n(e);const l=a?.spatialReference;l&&!d.spatialReference.equals(l)&&(d=await V(d,l),n(e)),this.oiViewModel.plotReferencePointOnGround(d)})});this.addHandles(c,S.videoImageClick)}plotReferencePointOnVideo(e){this.clearReferencePointOnVideo(),this._referencePointOnVideo=new t({geometry:R(e),symbol:_.clone()}),this.oiViewModel.videoMapView.graphics.add(this._referencePointOnVideo)}plotSelectedPointOnVideo(e){return this.clearSelectedPointOnVideo(),this._selectedPointOnVideo=new t({geometry:R(e),symbol:F.clone()}),this.oiViewModel.videoMapView.graphics.add(this._selectedPointOnVideo),this._selectedPointOnVideo}clearReferencePointOnVideo(){this._referencePointOnVideo&&(this.oiViewModel.videoMapView.graphics.remove(this._referencePointOnVideo),this._referencePointOnVideo.destroy(),this._referencePointOnVideo=null)}clearSelectedPointOnVideo(){this._selectedPointOnVideo&&(this.oiViewModel.videoMapView.graphics.remove(this._selectedPointOnVideo),this._selectedPointOnVideo.destroy(),this._selectedPointOnVideo=null)}};e([l()],A.prototype,"closestFeature",void 0),e([l()],A.prototype,"currentTime",void 0),e([l()],A.prototype,"oiViewModel",void 0),e([l({type:Number})],A.prototype,"videoBrightness",void 0),e([l({type:Number})],A.prototype,"videoContrast",void 0),e([l()],A.prototype,"videoDuration",void 0),e([l()],A.prototype,"videoPaused",void 0),e([l()],A.prototype,"videoScale",void 0),e([l()],A.prototype,"videoMuted",void 0),e([l()],A.prototype,"_referencePointOnVideo",void 0),e([l()],A.prototype,"_selectedPointOnVideo",void 0),e([l()],A.prototype,"_videoMinResolutionForCurrentView",null),A=e([c("esri.widgets.OrientedImageryViewer.components.OrientedImageryVideoViewModel")],A);const B=A;export{B as default};