@arcgis/core 5.0.0-next.10 → 5.0.0-next.12

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 (414) hide show
  1. package/PopupTemplate.js +1 -1
  2. package/analysis/AreaMeasurementAnalysis.js +1 -1
  3. package/analysis/VolumeMeasurement/volumeMeasurementConfiguration.js +1 -1
  4. package/applications/KnowledgeStudio/generalSdkInternalAccess.js +1 -1
  5. package/applications/KnowledgeStudio/resourceSerializationUtils.js +1 -1
  6. package/arcade/functions/geomasync.js +1 -1
  7. package/arcade/functions/geomsync.js +1 -1
  8. package/arcade/functions/knowledgegraph.js +1 -1
  9. package/arcade/geometry/nearestVertex.js +5 -0
  10. package/arcade/geometry/operators.js +1 -1
  11. package/arcade/geometry/operatorsWorker.js +1 -1
  12. package/assets/esri/core/workers/RemoteClient.js +1 -1
  13. package/assets/esri/core/workers/chunks/{af47272aaaef0ea57e71.js → 00ea3052170e831c6bc8.js} +1 -1
  14. package/assets/esri/core/workers/chunks/{91dfd29e2dba200eab09.js → 0105d814fb51c366d1da.js} +1 -1
  15. package/assets/esri/core/workers/chunks/{125e71b0e29d1d132777.js → 02a22dd6d208a925cc5a.js} +1 -1
  16. package/assets/esri/core/workers/chunks/02e7359162cf974b41b6.js +1 -0
  17. package/assets/esri/core/workers/chunks/{ead8d0cbcebd12dbfad7.js → 04211fba145d9f06b3ec.js} +1 -1
  18. package/assets/esri/core/workers/chunks/0441ea7c89266a68b6f0.js +1 -0
  19. package/assets/esri/core/workers/chunks/07f2a75431dd8fc502ef.js +1 -0
  20. package/assets/esri/core/workers/chunks/092d72caf3269e696d1c.js +1 -0
  21. package/assets/esri/core/workers/chunks/{d1e97cce5047f1791e22.js → 0ac13de43438f572f59c.js} +1 -1
  22. package/assets/esri/core/workers/chunks/{629127877042ad784ad2.js → 0c8aeb6262e9ec7c87d0.js} +1 -1
  23. package/assets/esri/core/workers/chunks/{d07f911d40bf05fc0306.js → 1008e3d64f5880e3dbf2.js} +1 -1
  24. package/assets/esri/core/workers/chunks/{c29486c4eeb3e72effff.js → 110429583b28c28c36ee.js} +1 -1
  25. package/assets/esri/core/workers/chunks/{61d970ed75c2c358b1e9.js → 14d601e0fe7a0538c7c1.js} +1 -1
  26. package/assets/esri/core/workers/chunks/18474c017ddacd1d3d2c.js +1 -0
  27. package/assets/esri/core/workers/chunks/{1257c37bf04d39c27b62.js → 1c3bee704bafb64bba70.js} +1 -1
  28. package/assets/esri/core/workers/chunks/1d07846bcaac47df0644.js +1 -0
  29. package/assets/esri/core/workers/chunks/{509392131ec473d6b988.js → 1dfca37f95f2b968aa54.js} +1 -1
  30. package/assets/esri/core/workers/chunks/2132ccc45da90f6208b2.js +1 -0
  31. package/assets/esri/core/workers/chunks/2166238a7ad63a2d43c7.js +1 -0
  32. package/assets/esri/core/workers/chunks/2214d3b1f11658a85d0f.js +1 -0
  33. package/assets/esri/core/workers/chunks/2266a8f2c2ec37c19bb4.js +1 -0
  34. package/assets/esri/core/workers/chunks/22ca80f491e070b2a5e7.js +1 -0
  35. package/assets/esri/core/workers/chunks/{f80f5dbf96c343ac4df6.js → 24d8922ac9cd48621357.js} +1 -1
  36. package/assets/esri/core/workers/chunks/257f17b3836a623a9dbe.js +1 -0
  37. package/assets/esri/core/workers/chunks/2b27499fa9de22970b7a.js +1 -0
  38. package/assets/esri/core/workers/chunks/2e76fbd3c874300fc4a7.js +1 -0
  39. package/assets/esri/core/workers/chunks/31b5900119dd7cd9e7d3.js +1 -0
  40. package/assets/esri/core/workers/chunks/34bb4852ebef0f529c96.js +1 -0
  41. package/assets/esri/core/workers/chunks/{9698f36c143953a975d4.js → 353d447f3745942c88a8.js} +1 -1
  42. package/assets/esri/core/workers/chunks/{52282f767bd0e99ddca0.js → 3545dce74bb6b0354cb7.js} +1 -1
  43. package/assets/esri/core/workers/chunks/36b1f47d70b57d79df7b.js +1 -0
  44. package/assets/esri/core/workers/chunks/38810e3f298e8a0b64a6.js +1 -0
  45. package/assets/esri/core/workers/chunks/{7290e7a819eb291b1df2.js → 38fa50336983265c73a4.js} +3 -3
  46. package/assets/esri/core/workers/chunks/{fe49321dca22dc60d105.js → 3b1982bf7b44ff897a35.js} +1 -1
  47. package/assets/esri/core/workers/chunks/3bacd904cd93c8013f6a.js +1 -0
  48. package/assets/esri/core/workers/chunks/{588533c3abe876f20f62.js → 3d5b157bd9060b07670b.js} +1 -1
  49. package/assets/esri/core/workers/chunks/{06e60fc7715d08ede59d.js → 3edffdb0e282ed562ac7.js} +1 -1
  50. package/assets/esri/core/workers/chunks/3fa15d4ee5fab8fff76e.js +1 -0
  51. package/assets/esri/core/workers/chunks/487e1c592f1b6fd03a7d.js +1 -0
  52. package/assets/esri/core/workers/chunks/{ee5aa11750c51b220f1e.js → 4bcb83119481453dbb90.js} +1 -1
  53. package/assets/esri/core/workers/chunks/4ca5d58117e7a5f73e1e.js +1 -0
  54. package/assets/esri/core/workers/chunks/{826fa0dfb63df77bfd95.js → 4f0016111fd84c612f41.js} +1 -1
  55. package/assets/esri/core/workers/chunks/{24cd7b84cd0f3de4bff2.js → 4f14fed0ec885c3c33d5.js} +1 -1
  56. package/assets/esri/core/workers/chunks/{4baf6f6e7ddedb25f806.js → 5299ec59c86022ca37e2.js} +1 -1
  57. package/assets/esri/core/workers/chunks/53a9c34cb3f6ac06cd50.js +1 -0
  58. package/assets/esri/core/workers/chunks/5415fbcc7ed203fc5575.js +1 -0
  59. package/assets/esri/core/workers/chunks/54c49a768147720c3c56.js +1 -0
  60. package/assets/esri/core/workers/chunks/558822b700e8bd844052.js +1 -0
  61. package/assets/esri/core/workers/chunks/{da24ad57747714ac5eda.js → 55adbd7481f8dfb1067e.js} +1 -1
  62. package/assets/esri/core/workers/chunks/{7803495f8862d9025bcd.js → 56e06c9c1120bea2c641.js} +1 -1
  63. package/assets/esri/core/workers/chunks/{dc66490520f97eef15bf.js → 57806a01f33074b601e7.js} +24 -24
  64. package/assets/esri/core/workers/chunks/{67f03d042455cd0f7009.js → 57b410198d83bf0ab708.js} +1 -1
  65. package/assets/esri/core/workers/chunks/{0a5d74414dd02a2fb8e1.js → 5bc4140333d0db904949.js} +1 -1
  66. package/assets/esri/core/workers/chunks/5e08b19e6d7202ea38d7.js +1 -0
  67. package/assets/esri/core/workers/chunks/{0d5212f59e9b62c16164.js → 5f6df4a3376b52ead53f.js} +1 -1
  68. package/assets/esri/core/workers/chunks/{15c7c10ff9ac63f0e792.js → 5fb2edf942b1cd8d7336.js} +1 -1
  69. package/assets/esri/core/workers/chunks/600e2e6b51e2fb9c598c.js +1 -0
  70. package/assets/esri/core/workers/chunks/{dc51438b832551924a9e.js → 6238ca7541800eb2566b.js} +1 -1
  71. package/assets/esri/core/workers/chunks/{731f7b552dde0fb325cd.js → 62c2bd082a0c669bc857.js} +1 -1
  72. package/assets/esri/core/workers/chunks/{b8a3f1e60e24a13749c1.js → 631fb2e62e48f8be4051.js} +1 -1
  73. package/assets/esri/core/workers/chunks/{c8e686efe344a33a0258.js → 6490bc392a4b4f9e24f9.js} +1 -1
  74. package/assets/esri/core/workers/chunks/{e767f83f9e2de6650f80.js → 6581b94e796781c0ad4a.js} +1 -1
  75. package/assets/esri/core/workers/chunks/{53654edd766d9b4ef750.js → 658cd45b5fb304fd840a.js} +1 -1
  76. package/assets/esri/core/workers/chunks/67f305b0c72e77a6331a.js +1 -0
  77. package/assets/esri/core/workers/chunks/6922351c001fdb4cb757.js +1 -0
  78. package/assets/esri/core/workers/chunks/{6e22b02a9715c10578d0.js → 69cca5d3f715876c6b32.js} +1 -1
  79. package/assets/esri/core/workers/chunks/6c13c01c47abc1939f96.js +1 -0
  80. package/assets/esri/core/workers/chunks/{c37f7756d48ff9af2656.js → 736035c0069ccb03bee6.js} +1 -1
  81. package/assets/esri/core/workers/chunks/7c14f99e6cfff2a8ef4a.js +1 -0
  82. package/assets/esri/core/workers/chunks/812f2ccc01f44e3cfd41.js +1 -0
  83. package/assets/esri/core/workers/chunks/82338cdd56aa1de28db3.js +1 -0
  84. package/assets/esri/core/workers/chunks/{51ab2acac4ecc1ca9c34.js → 86830fcb5475502dac65.js} +1 -1
  85. package/assets/esri/core/workers/chunks/{11e96a312f1294d34c50.js → 881df4fd1dc594576457.js} +1 -1
  86. package/assets/esri/core/workers/chunks/{d1ca7c3a32ce00ed8b81.js → 8be16b03caa947ac7631.js} +1 -1
  87. package/assets/esri/core/workers/chunks/8cd03b54b2859b52fb81.js +1 -0
  88. package/assets/esri/core/workers/chunks/8d9ccc9a43a315cb6b04.js +1 -0
  89. package/assets/esri/core/workers/chunks/{042cd64e1f4eb326c30f.js → 8fc82fe1fcbcedf35400.js} +1 -1
  90. package/assets/esri/core/workers/chunks/91afee11072471e4eefe.js +1 -0
  91. package/assets/esri/core/workers/chunks/{fbd8d2f61f8a15bcf3db.js → 9595aabbaf411eceea1e.js} +1 -1
  92. package/assets/esri/core/workers/chunks/9978ec6c67e87dc08a1d.js +1 -0
  93. package/assets/esri/core/workers/chunks/9cdd087c43a601ec331d.js +1 -0
  94. package/assets/esri/core/workers/chunks/9e5e05d6430712b0b1bc.js +1 -0
  95. package/assets/esri/core/workers/chunks/{5e2ce34def5e053913b2.js → a10e533f336c035d8d40.js} +1 -1
  96. package/assets/esri/core/workers/chunks/{311b564e44ae637c960d.js → a3ade7e8b9ddadb5f800.js} +1 -1
  97. package/assets/esri/core/workers/chunks/{18c5d79d5ee1136e0a57.js → a57751f3d78524c876cd.js} +1 -1
  98. package/assets/esri/core/workers/chunks/{0030d68d9edf42b4af57.js → a6a87f92f453204e9bdb.js} +1 -1
  99. package/assets/esri/core/workers/chunks/a6ee40dfc471d6612f3c.js +1 -0
  100. package/assets/esri/core/workers/chunks/a8ea050090c351e3b6d6.js +1 -0
  101. package/assets/esri/core/workers/chunks/adf7ccf4ef629211c7ee.js +1 -0
  102. package/assets/esri/core/workers/chunks/ae6066ea6cb373dc6db3.js +1 -0
  103. package/assets/esri/core/workers/chunks/af5fc5d6c1d072a27df1.js +1 -0
  104. package/assets/esri/core/workers/chunks/b193de09e005b0976a6a.js +1 -0
  105. package/assets/esri/core/workers/chunks/b328635d191f5424c047.js +1 -0
  106. package/assets/esri/core/workers/chunks/b59f9c3f7a149214256f.js +1 -0
  107. package/assets/esri/core/workers/chunks/{664ae441617afe4b17ec.js → b87bc987983b31c13f64.js} +1 -1
  108. package/assets/esri/core/workers/chunks/bb56717c4e36f28d4c08.js +1 -0
  109. package/assets/esri/core/workers/chunks/bbdfa8ffcf084cbd9938.js +1 -0
  110. package/assets/esri/core/workers/chunks/bc19a232076d98825eef.js +1 -0
  111. package/assets/esri/core/workers/chunks/bc29c29bfa5be3ebafb1.js +1 -0
  112. package/assets/esri/core/workers/chunks/{ddfd01bb9ba8577c3ffc.js → c3dcfe26c2c3c829762d.js} +1 -1
  113. package/assets/esri/core/workers/chunks/c3ddcf9148dd2640c402.js +1 -0
  114. package/assets/esri/core/workers/chunks/{6d9f2b113d6bde936a04.js → c4dfd897bcab20dee43b.js} +1 -1
  115. package/assets/esri/core/workers/chunks/{0f30a9514571c7be9978.js → c5c02ace54fe4ab9214b.js} +1 -1
  116. package/assets/esri/core/workers/chunks/{87921f3fa9001f5801ed.js → c68935ed44eb0702a6ba.js} +1 -1
  117. package/assets/esri/core/workers/chunks/{4fb5f1c671892001a4fd.js → c9579d607e59bae214da.js} +1 -1
  118. package/assets/esri/core/workers/chunks/d39a10155317e6f7a21c.js +1 -0
  119. package/assets/esri/core/workers/chunks/{773f2c6c9d38db76dfed.js → d42f7e48d694b2427c0d.js} +1 -1
  120. package/assets/esri/core/workers/chunks/d466f3f0d3824c77da7c.js +1 -0
  121. package/assets/esri/core/workers/chunks/d4a91f2256e48316a8f0.js +1 -0
  122. package/assets/esri/core/workers/chunks/d69265ceabfa92b40bb7.js +1 -0
  123. package/assets/esri/core/workers/chunks/d7755c4c8d1d3059efca.js +1 -0
  124. package/assets/esri/core/workers/chunks/{eb9c166db0db6fa60e95.js → d7b0fcce847f563ea255.js} +1 -1
  125. package/assets/esri/core/workers/chunks/d87f0116ee53ec5f98e9.js +1 -0
  126. package/assets/esri/core/workers/chunks/d888ae5ac1810a486919.js +1 -0
  127. package/assets/esri/core/workers/chunks/db54552def7bc6cef9bd.js +1 -0
  128. package/assets/esri/core/workers/chunks/dc4d29cfce12ac599888.js +1 -0
  129. package/assets/esri/core/workers/chunks/dda6ca9af35518652d0f.js +1 -0
  130. package/assets/esri/core/workers/chunks/{7005d956c990a04ee8b2.js → dec336700cfb83abbbeb.js} +1 -1
  131. package/assets/esri/core/workers/chunks/{b3613a38178cad2ebc82.js → dee9867b3379e024ae96.js} +1 -1
  132. package/assets/esri/core/workers/chunks/df130abb76713a85b4f9.js +1 -0
  133. package/assets/esri/core/workers/chunks/e0aa036c56ecdfe01503.js +1 -0
  134. package/assets/esri/core/workers/chunks/e2e4f6b58763fae51ae5.js +1 -0
  135. package/assets/esri/core/workers/chunks/e8a9c56fd0e7fd2558ef.js +1 -0
  136. package/assets/esri/core/workers/chunks/{1d06fcae4c2f02fb1c95.js → eb7eb3b3b8800fd73f3e.js} +1 -1
  137. package/assets/esri/core/workers/chunks/{37c1f155da14de91565a.js → edf58513f789856cd1db.js} +1 -1
  138. package/assets/esri/core/workers/chunks/{f34e3fa0c5b28531e289.js → ef789e8487deab916fad.js} +1 -1
  139. package/assets/esri/core/workers/chunks/f28ffda9a95c6568503d.js +1 -0
  140. package/assets/esri/core/workers/chunks/f98689562017583f73ee.js +1 -0
  141. package/assets/esri/core/workers/chunks/{292daac70bb828e4923f.js → f9cd068d184cab66dc33.js} +1 -1
  142. package/assets/esri/core/workers/chunks/{dff2df259f140b7d97a9.js → fd88e07cba5964f80e9e.js} +1 -1
  143. package/assets/esri/core/workers/chunks/{c9b16fd41cd59d452522.js → fdbe16e3b23e01655c0c.js} +1 -1
  144. package/assets/esri/core/workers/chunks/{063905fbf9a0c6586949.js → ffdba51e7256ebf8ebd3.js} +1 -1
  145. package/assets/esri/libs/parquet/pkg/bundle_bg.wasm +0 -0
  146. package/assets/esri/rest/knowledgeGraph/wasmInterface/arcgis-knowledge-client-core-simd.wasm +0 -0
  147. package/assets/esri/rest/knowledgeGraph/wasmInterface/arcgis-knowledge-client-core.wasm +0 -0
  148. package/assets/esri/themes/base/widgets/_Editor.scss +35 -2
  149. package/assets/esri/themes/base/widgets/_FeatureTable.scss +2 -0
  150. package/assets/esri/themes/dark/main.css +1 -1
  151. package/assets/esri/themes/light/main.css +1 -1
  152. package/assets/esri/themes/light/view.css +1 -1
  153. package/chunks/Envelope.js +1 -1
  154. package/chunks/Geometry.js +1 -1
  155. package/chunks/MultiPathImpl.js +1 -1
  156. package/chunks/Point2D.js +1 -1
  157. package/chunks/UnitFactory.js +1 -1
  158. package/chunks/arcgis-knowledge-client-core-simd.js +1 -1
  159. package/chunks/arcgis-knowledge-client-core.js +1 -1
  160. package/chunks/containsOperator.js +1 -1
  161. package/chunks/densifyOperator.js +1 -1
  162. package/chunks/differenceOperator.js +1 -1
  163. package/chunks/intersectsOperator.js +1 -1
  164. package/chunks/persistableUrlUtils.js +1 -1
  165. package/config.js +1 -1
  166. package/core/XHRAdapter.js +1 -1
  167. package/core/libs/gl-matrix-2/math/quat.js +1 -1
  168. package/core/quantityFormatUtils.js +1 -1
  169. package/core/unitFormatUtils.js +1 -1
  170. package/core/unitUtils.js +1 -1
  171. package/editing/fieldUtils.js +5 -0
  172. package/geometry/Extent.js +1 -1
  173. package/geometry/Geometry.js +1 -1
  174. package/geometry/Mesh.js +1 -1
  175. package/geometry/Point.js +1 -1
  176. package/geometry/SpatialReference.js +1 -1
  177. package/geometry/ellipsoidUtils.js +1 -1
  178. package/geometry/operators/support/jsonConverter.js +1 -1
  179. package/geometry/support/MeshTransform.js +1 -1
  180. package/geometry/support/axisAngleDegrees.js +1 -1
  181. package/geometry/support/meshUtils/exporters/gltf/gltf.js +1 -1
  182. package/geometry/support/meshUtils/rotate.js +1 -1
  183. package/geometry/support/meshUtils/scale.js +1 -1
  184. package/geometry/support/meshUtils/vertexSpaceConversion.js +1 -1
  185. package/geometry/support/plane.js +1 -1
  186. package/geometry/support/polygonUtils.js +1 -1
  187. package/interfaces.d.ts +114 -11
  188. package/kernel.js +1 -1
  189. package/layers/KnowledgeGraphLayer.js +1 -1
  190. package/layers/Layer.js +1 -1
  191. package/layers/LinkChartLayer.js +1 -1
  192. package/layers/MapNotesLayer.js +1 -1
  193. package/layers/graphics/data/QueryEngine.js +1 -1
  194. package/layers/knowledgeGraph/KnowledgeGraphSublayer.js +1 -1
  195. package/layers/orientedImagery/transformations/updateElevationUtils.js +1 -1
  196. package/layers/save/groupLayerUtils.js +1 -1
  197. package/layers/save/imageryUtils.js +1 -1
  198. package/layers/save/streamLayerUtils.js +1 -1
  199. package/layers/support/DateTimeFieldFormat.js +1 -1
  200. package/layers/support/FieldFormat.js +1 -1
  201. package/layers/support/LayerLoadContext.js +1 -1
  202. package/layers/support/NumberFieldFormat.js +1 -1
  203. package/layers/support/arcgisLayerUrl.js +1 -1
  204. package/layers/support/arcgisLayers.js +1 -1
  205. package/layers/support/fetchService.js +1 -1
  206. package/layers/support/fieldFormatUtils.js +1 -1
  207. package/layers/support/fieldUtils.js +1 -1
  208. package/layers/support/serviceCapabilitiesUtils.js +1 -1
  209. package/layers/video/VideoCameraSensorModel.js +1 -1
  210. package/networks/support/UNTraceConfiguration.js +1 -1
  211. package/package.json +1 -1
  212. package/popup/ExpressionInfo.js +1 -1
  213. package/popup/FieldInfo.js +1 -1
  214. package/popup/content/AttachmentsContent.js +1 -1
  215. package/popup/content/BarChartMediaInfo.js +1 -1
  216. package/popup/content/ColumnChartMediaInfo.js +1 -1
  217. package/popup/content/Content.js +1 -1
  218. package/popup/content/CustomContent.js +1 -1
  219. package/popup/content/ExpressionContent.js +1 -1
  220. package/popup/content/FieldsContent.js +1 -1
  221. package/popup/content/ImageMediaInfo.js +1 -1
  222. package/popup/content/LineChartMediaInfo.js +1 -1
  223. package/popup/content/MediaContent.js +1 -1
  224. package/popup/content/PieChartMediaInfo.js +1 -1
  225. package/popup/content/RelationshipContent.js +1 -1
  226. package/popup/content/TextContent.js +1 -1
  227. package/popup/content/UtilityNetworkAssociationsContent.js +1 -1
  228. package/popup/content/mixins/ChartMediaInfo.js +1 -1
  229. package/popup/content/mixins/MediaInfo.js +1 -1
  230. package/popup/content.js +1 -1
  231. package/popup/support/FieldInfoFormat.js +1 -1
  232. package/portal/support/layersLoader.js +1 -1
  233. package/request/cors.js +5 -0
  234. package/request/loadImage.js +5 -0
  235. package/request/preferredHosts.js +5 -0
  236. package/request/process.js +5 -0
  237. package/request/queue.js +5 -0
  238. package/request/serviceJSON.js +5 -0
  239. package/request.js +1 -1
  240. package/rest/geometryService/utils.js +1 -1
  241. package/rest/knowledgeGraphService.d.ts +1 -0
  242. package/support/getDefaultUnitForView.js +1 -1
  243. package/support/popupUtils.js +1 -1
  244. package/support/revision.js +1 -1
  245. package/symbols/support/symbolUtils.js +1 -1
  246. package/time/TimeExtent.js +1 -1
  247. package/views/2d/analysis/AreaMeasurement/AreaMeasurementAreaVisualization.js +5 -0
  248. package/views/2d/analysis/AreaMeasurement/AreaMeasurementController.js +5 -0
  249. package/views/2d/analysis/AreaMeasurement/AreaMeasurementLabelVisualization.js +5 -0
  250. package/views/2d/analysis/AreaMeasurement/AreaMeasurementManipulatorVisualization.js +5 -0
  251. package/views/2d/analysis/AreaMeasurement/AreaMeasurementSketchVisualization.js +5 -0
  252. package/views/2d/analysis/AreaMeasurement/AreaMeasurementTool.js +5 -0
  253. package/views/2d/analysis/AreaMeasurementAnalysisView2D.js +5 -0
  254. package/views/2d/analysis/analysisViewModuleImportUtils.js +1 -1
  255. package/views/2d/layers/features/FeaturePipelineWorker.js +1 -1
  256. package/views/2d/layers/features/processor/FeatureUpdateStrategy.js +1 -1
  257. package/views/2d/layers/features/processor/TrackStrategy.js +1 -1
  258. package/views/2d/layers/features/sources/strategies/FeatureDrillDownTileLoadStrategy.js +1 -1
  259. package/views/2d/layers/features/sources/strategies/chunks/Overrides.js +1 -1
  260. package/views/3d/analysis/AreaMeasurementAnalysisView3D.js +1 -1
  261. package/views/3d/analysis/Slice/SliceTool.js +1 -1
  262. package/views/3d/analysis/VolumeMeasurement/VolumeMeasurementCutFillComputation.js +1 -1
  263. package/views/3d/analysis/VolumeMeasurement/VolumeMeasurementCutFillController.js +1 -1
  264. package/views/3d/analysis/VolumeMeasurement/VolumeMeasurementCutFillVisualization.js +1 -1
  265. package/views/3d/environment/CloudsRenderer.js +1 -1
  266. package/views/3d/interactive/measurementTools/areaMeasurement3D/AreaMeasurement3DView.js +1 -1
  267. package/views/3d/interactive/measurementTools/directLineMeasurement3D/DirectLineMeasurement3DView.js +1 -1
  268. package/views/3d/layers/ElevationLayerView3D.js +1 -1
  269. package/views/3d/layers/FlowSubView3D.js +1 -1
  270. package/views/3d/layers/PointCloudLayerView3D.js +1 -1
  271. package/views/3d/layers/graphics/Graphics3DCore.js +1 -1
  272. package/views/3d/layers/graphics/wosrLoader.js +1 -1
  273. package/views/3d/layers/i3s/I3SClientMaterialUtil.js +1 -1
  274. package/views/3d/layers/i3s/I3SDataRequester.js +1 -1
  275. package/views/3d/layers/support/featureTileQuery3D.js +1 -1
  276. package/views/3d/support/StreamTextureCollection.js +1 -1
  277. package/views/3d/support/flow/geometryUtils.js +1 -1
  278. package/views/3d/support/pointsOfInterest/Focus.js +1 -1
  279. package/views/3d/terrain/TerrainSurface.js +1 -1
  280. package/views/3d/webgl-engine/collections/Component/ComponentData.js +1 -1
  281. package/views/3d/webgl-engine/collections/Component/ComponentObjectCollection.js +1 -1
  282. package/views/3d/webgl-engine/effects/magnifier/Magnifier.js +1 -1
  283. package/views/3d/webgl-engine/effects/smaa/SMAA.js +1 -1
  284. package/views/3d/webgl-engine/lib/CutFillDepth.js +1 -1
  285. package/views/3d/webgl-engine/lib/Texture.js +1 -1
  286. package/views/3d/webgl-engine/lib/TextureBackedBuffer/BufferManager.js +1 -1
  287. package/views/3d/webgl-engine/lib/TextureBackedBuffer/ManagedTextureBackedBuffer.js +1 -1
  288. package/views/3d/webgl-engine/lib/TextureBackedBuffer/TextureBackedBuffer.js +1 -1
  289. package/views/3d/webgl-engine/lib/edgeRendering/EdgeView.js +1 -1
  290. package/views/3d/webgl-engine/materials/internal/WaterTextureRepository.js +1 -1
  291. package/views/View2D.js +1 -1
  292. package/views/analysis/ElevationProfile/ElevationProfileController.js +1 -1
  293. package/views/analysis/ElevationProfile/constants.js +1 -1
  294. package/views/analysis/ElevationProfile/elevationProfileErrors.js +1 -1
  295. package/views/analysis/ElevationProfile/elevationProfileGenerationUtils.js +1 -1
  296. package/views/draw/DrawOperation.js +1 -1
  297. package/views/draw/support/tooltipUtils.js +1 -1
  298. package/views/interactive/tooltip/components/TooltipEditableField.js +1 -1
  299. package/views/interactive/tooltip/fields/TooltipField.js +1 -1
  300. package/views/interactive/tooltip/infos/TooltipInfoWithCoordinates.js +1 -1
  301. package/views/magnifier/resources.js +1 -1
  302. package/views/support/euclideanLengthMeasurementUtils.js +1 -1
  303. package/webdoc/support/webdocSaveUtils.js +1 -1
  304. package/widgets/BasemapLayerList.js +1 -1
  305. package/widgets/BatchAttributeForm/templates/support/createBatchFormTemplate.js +1 -1
  306. package/widgets/Editor/CreateFeaturesWorkflow.js +1 -1
  307. package/widgets/Editor/EditorViewModel.js +1 -1
  308. package/widgets/Editor/MergeFeaturesWorkflow.js +1 -1
  309. package/widgets/Editor/MergeFeaturesWorkflowData.js +1 -1
  310. package/widgets/Editor/SplitFeatureWorkflow.js +1 -1
  311. package/widgets/Editor/UpdateFeaturesWorkflow.js +1 -1
  312. package/widgets/Editor/UpdateRecordWorkflow.js +1 -1
  313. package/widgets/Editor/UpdateWorkflow.js +1 -1
  314. package/widgets/Editor/Workflow.js +1 -1
  315. package/widgets/Editor/components/FeatureList.js +1 -1
  316. package/widgets/Editor/components/MergeFeaturesList.js +5 -0
  317. package/widgets/Editor/components/Notices.js +1 -1
  318. package/widgets/Editor/components/PanelContent.js +1 -1
  319. package/widgets/Editor/components/UpdateFeaturePanelContent.js +1 -1
  320. package/widgets/Editor/css.js +1 -1
  321. package/widgets/Editor/support/EditorItem.js +1 -1
  322. package/widgets/Editor/support/SketchController.js +1 -1
  323. package/widgets/Editor/support/errors.js +1 -1
  324. package/widgets/Editor/support/mergeFeaturesUtils.js +1 -1
  325. package/widgets/Editor/support/splitFeatureUtils.js +1 -1
  326. package/widgets/Editor/workflowUtils.js +1 -1
  327. package/widgets/Editor.js +1 -1
  328. package/widgets/FeatureForm/FeatureFormUtilityNetworkAssociations/UtilityNetworkAssociationItemList.js +1 -1
  329. package/widgets/FeatureForm/FieldInput.js +1 -1
  330. package/widgets/FeatureForm.js +1 -1
  331. package/widgets/FeatureTable/FeatureTableViewModel.js +1 -1
  332. package/widgets/FeatureTable/FieldColumn.js +1 -1
  333. package/widgets/FeatureTable/support/FeatureStore.js +1 -1
  334. package/widgets/LayerList.js +1 -1
  335. package/widgets/Legend/support/ActiveLayerInfo.js +1 -1
  336. package/widgets/Legend/support/utils.js +1 -1
  337. package/widgets/PanoramicVideoViewer.js +1 -1
  338. package/widgets/TimeSlider.js +1 -1
  339. package/widgets/support/FilterCondition.js +1 -1
  340. package/assets/esri/core/workers/chunks/0200637e0503556a3b97.js +0 -1
  341. package/assets/esri/core/workers/chunks/022c854eff2c2c2aed6b.js +0 -1
  342. package/assets/esri/core/workers/chunks/066a0ea67688361e85a5.js +0 -1
  343. package/assets/esri/core/workers/chunks/06f75c5b6b50934d72a6.js +0 -1
  344. package/assets/esri/core/workers/chunks/15f969836d63c7fe2d9d.js +0 -1
  345. package/assets/esri/core/workers/chunks/2857bcb68df874e9aa62.js +0 -1
  346. package/assets/esri/core/workers/chunks/2a9fc0301268ff909246.js +0 -1
  347. package/assets/esri/core/workers/chunks/2ddcf3cea0efe4052618.js +0 -1
  348. package/assets/esri/core/workers/chunks/2e8a4df83c43f86d7361.js +0 -1
  349. package/assets/esri/core/workers/chunks/2f2e4f81f3daa3fb8527.js +0 -1
  350. package/assets/esri/core/workers/chunks/3109f0a6914e7be088ed.js +0 -1
  351. package/assets/esri/core/workers/chunks/31bb1ee9370c2753ce9d.js +0 -1
  352. package/assets/esri/core/workers/chunks/329fccd7f5cb8401e0c3.js +0 -1
  353. package/assets/esri/core/workers/chunks/38f6b9288c82dac9a800.js +0 -1
  354. package/assets/esri/core/workers/chunks/3b1848713ee25f750242.js +0 -1
  355. package/assets/esri/core/workers/chunks/42a1e71d09e8583a7327.js +0 -1
  356. package/assets/esri/core/workers/chunks/44f27eac92c5ccc57e12.js +0 -1
  357. package/assets/esri/core/workers/chunks/4941bfd3aae7f6bdac97.js +0 -1
  358. package/assets/esri/core/workers/chunks/4bd2cc65f7db0d261543.js +0 -1
  359. package/assets/esri/core/workers/chunks/4fa230dc6e5e87b0dec1.js +0 -1
  360. package/assets/esri/core/workers/chunks/4fbe2a8d742065cbaea3.js +0 -1
  361. package/assets/esri/core/workers/chunks/4fe4feeb251f2916a339.js +0 -1
  362. package/assets/esri/core/workers/chunks/55eb6a0f1e4569a65f2a.js +0 -1
  363. package/assets/esri/core/workers/chunks/57e04e2d8721bbdc029a.js +0 -1
  364. package/assets/esri/core/workers/chunks/591e459f9fce34f519ca.js +0 -1
  365. package/assets/esri/core/workers/chunks/59514624daf188a8030f.js +0 -1
  366. package/assets/esri/core/workers/chunks/5c09d98b41f71a036e2a.js +0 -1
  367. package/assets/esri/core/workers/chunks/605b9643b1baeff16149.js +0 -1
  368. package/assets/esri/core/workers/chunks/6293e33f304c4952f88c.js +0 -1
  369. package/assets/esri/core/workers/chunks/6e25ef5ad6d6b3f88343.js +0 -1
  370. package/assets/esri/core/workers/chunks/759321045c264bc6964e.js +0 -1
  371. package/assets/esri/core/workers/chunks/7e3f27ebf366d4266350.js +0 -1
  372. package/assets/esri/core/workers/chunks/826072cfc0ac8e36f03c.js +0 -1
  373. package/assets/esri/core/workers/chunks/8ce608013b353155ee5a.js +0 -1
  374. package/assets/esri/core/workers/chunks/8d9d3797c6d62fdfff9d.js +0 -1
  375. package/assets/esri/core/workers/chunks/9b0c2f4311fe9bca370a.js +0 -1
  376. package/assets/esri/core/workers/chunks/9c48d8d17831aa57f8a4.js +0 -1
  377. package/assets/esri/core/workers/chunks/9f21436016ff7a899e79.js +0 -1
  378. package/assets/esri/core/workers/chunks/9f28b2800945903bc165.js +0 -1
  379. package/assets/esri/core/workers/chunks/a27e74117c37f3efcbca.js +0 -1
  380. package/assets/esri/core/workers/chunks/a41ba05c09a59d1eb35f.js +0 -1
  381. package/assets/esri/core/workers/chunks/a5a67216e0d0cee95a55.js +0 -1
  382. package/assets/esri/core/workers/chunks/a93ebd076bc55aa6eab0.js +0 -1
  383. package/assets/esri/core/workers/chunks/aaed35a6414859233678.js +0 -1
  384. package/assets/esri/core/workers/chunks/acd0564ad1544f452f3f.js +0 -1
  385. package/assets/esri/core/workers/chunks/b0f43191a431c9de16e5.js +0 -1
  386. package/assets/esri/core/workers/chunks/b320bb76c7e9998fe53b.js +0 -1
  387. package/assets/esri/core/workers/chunks/ba4571d2637a74a59552.js +0 -1
  388. package/assets/esri/core/workers/chunks/c4090a60d149a5962179.js +0 -1
  389. package/assets/esri/core/workers/chunks/c61c61dac1e8d6188749.js +0 -1
  390. package/assets/esri/core/workers/chunks/c84caf81bfaa4a8b5aa1.js +0 -1
  391. package/assets/esri/core/workers/chunks/c8c8cf43fd640d2f5cb1.js +0 -1
  392. package/assets/esri/core/workers/chunks/d28670cb11164e318e45.js +0 -1
  393. package/assets/esri/core/workers/chunks/d48af7bc06b4bb176534.js +0 -1
  394. package/assets/esri/core/workers/chunks/d56ac52a5288e06365e7.js +0 -1
  395. package/assets/esri/core/workers/chunks/ddca92e18e96ea1c9d89.js +0 -1
  396. package/assets/esri/core/workers/chunks/ded9747ae04ab889d52a.js +0 -1
  397. package/assets/esri/core/workers/chunks/df5afa06c6deb6b40109.js +0 -1
  398. package/assets/esri/core/workers/chunks/df8279e1baf378faf85f.js +0 -1
  399. package/assets/esri/core/workers/chunks/e3434f91f47f551d9e02.js +0 -1
  400. package/assets/esri/core/workers/chunks/eb6c3dd440ede4adf603.js +0 -1
  401. package/assets/esri/core/workers/chunks/edc671b9b83c8e19cb42.js +0 -1
  402. package/assets/esri/core/workers/chunks/f141c9f7f0d9b2322bf6.js +0 -1
  403. package/assets/esri/core/workers/chunks/f7a1f48c53422c6e2028.js +0 -1
  404. package/assets/esri/core/workers/chunks/f7f002ea5ff5fe7f6249.js +0 -1
  405. package/assets/esri/core/workers/chunks/f8e889be4b45f6f0667e.js +0 -1
  406. package/assets/esri/core/workers/chunks/fbd796c88f07bb6755dc.js +0 -1
  407. package/assets/esri/core/workers/chunks/fec3897ed7e8691387ed.js +0 -1
  408. package/processRequest.js +0 -5
  409. package/requestQueue.js +0 -5
  410. package/support/requestPresets.js +0 -5
  411. package/support/requestUtils.js +0 -5
  412. /package/{rest/support → request}/ImageWithType.js +0 -0
  413. /package/{requestConfig.js → request/config.js} +0 -0
  414. /package/{support/requestImageUtils.js → request/image.js} +0 -0
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as e}from"tslib";import t from"../../../../../core/Accessor.js";import{equals as r,binaryIndexOf as s}from"../../../../../core/arrayUtils.js";import"../../../../../core/has.js";import n from"../../../../../core/Logger.js";import{clamp as i}from"../../../../../core/mathUtils.js";import{disposeMaybe as o,destroyMaybe as a}from"../../../../../core/maybe.js";import{isAbortError as c,onAbortOrThrow as l}from"../../../../../core/promiseUtils.js";import{property as d}from"../../../../../core/accessorSupport/decorators/property.js";import{subclass as h}from"../../../../../core/accessorSupport/decorators/subclass.js";import{fromMat4 as u,transpose as m,invert as g}from"../../../../../core/libs/gl-matrix-2/math/mat3.js";import{create as p}from"../../../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{create as f}from"../../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{j as _,d as b,a as y,f as j}from"../../../../../chunks/vec32.js";import{create as w,clone as O}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{UpdatingHandles as E}from"../../../../../core/support/UpdatingHandles.js";import{n as x,g as v}from"../../../../../chunks/sphere.js";import{c as M}from"../../../../../chunks/vec33.js";import{encodeElevationOffset as R}from"../../collections/Component/Material/shader/ComponentData.glsl.js";import{TwoVectorPosition as T}from"../../core/util/TwoVectorPosition.js";import{Attribute as C}from"../Attribute.js";import{GridLocalOriginFactory as D}from"../GridLocalOriginFactory.js";import{applyToModelMatrix as A}from"../localOriginHelper.js";import{LocalOriginManager as P}from"../LocalOriginManager.js";import{Object3D as k}from"../Object3D.js";import{VertexArrayObject as U}from"../VertexArrayObject.js";import{VertexLayout as q,glVertexLayout as B,EdgeInputBufferLayout as H,RegularEdgeInstancesGLLayout as L,SilhouetteEdgeInstancesGLLayout as V}from"./bufferLayouts.js";import{EdgeRenderer as S,lineWidthFractionFactor as I,extensionLengthOffset as N}from"./EdgeRenderer.js";import{EdgePassParameters as z}from"./EdgeShaderParameters.js";import{EdgeWorkerHandle as F}from"./EdgeWorkerHandle.js";import{generateStrokesTexture as G}from"./strokes.js";import{determineRendererType as K,determineEdgeTransparency as W,determineObjectTransparency as J,fillComponentBufferIndices as Q}from"./util.js";import{BufferManager as X}from"../TextureBackedBuffer/BufferManager.js";import{VertexBuffer as Y}from"../../../../webgl/VertexBuffer.js";const Z=128;let $=class extends t{constructor(e){super(e),this._updatingHandles=new E,this._objectEntries=new Map,this._pendingDeletions=new Map,this._renderers=new Map,this._gpuMemoryUsage=0,this._workerAbort=new AbortController,this._tmpModelPosition=w(),this._localOrigins=new P(new D(e.renderSR));const t=q.createBuffer(4);for(let r=0;r<4;r++)t.sideness.set(r,0,0===r||3===r?0:1),t.sideness.set(r,1,0===r||1===r?0:1);this._vertexBuffer=new Y(e.rctx,B,t.buffer)}initialize(){this._workerHandle=new F(this.schedule),this._componentColorManager=new X(this.rctx,3)}destroy(){this.destroyed||(this._objectEntries.forEach(e=>this._discardObjectEntry(e)),this._objectEntries.clear(),this._pendingDeletions.forEach(e=>this._discardObjectEntry(e)),this._pendingDeletions.clear(),this._strokesTexture=o(this._strokesTexture),this._componentColorManager=a(this._componentColorManager),this._workerAbort.abort(),this._workerHandle.destroy(),this._vertexBuffer.dispose(),this._renderers.clear(),this._updatingHandles.destroy(),this._set("schedule",_e))}get updating(){return this._updatingHandles.updating}get usedMemory(){return this._gpuMemoryUsage}shouldRender(){return this._renderers.size>0}async addComponentObject(e,t,r,s,n,i,o){if(this.hasObject(e))return this._getObjectMemoryUsage(e);let a;const c=new re(null,new Promise(e=>a=e),e.obb.center,e.obb.radius);this._objectEntries.set(e,c);const l=await this._updatingHandles.addPromise(this._addComponentGeometry(e.transform,c,t,r,s,n,i,o));return this.setNeedsRender(),a(),l}async addOrUpdateObject3D(e,t,r,s){if(this.destroyed)return void n.getLogger(this).warn("Attempt to add an object to a destroyed instance");const i=new AbortController;let o;const a=e.boundingVolumeWorldSpace.bounds,l=new re(i,new Promise(e=>o=e),x(a,w()),v(a)),d=this._objectEntries.get(e);d&&(this._pendingDeletions.has(e)?this._discardObjectEntry(d):this._pendingDeletions.set(e,d)),this._objectEntries.set(e,l);try{const n=new Array;if(e.geometries.length>1&&te(e))n.push(this._addObjectMergedGeometries(e,l,t,r,s));else for(const i of e.geometries)i.material.supportsEdges&&n.push(this._addGeometry(e,l,i,t,r,s));await this._updatingHandles.addPromise(Promise.all(n)),this._removePendingDeletion(e)}catch(h){c(h)?this._discardObjectEntry(l):this._removePendingDeletion(e)}finally{this.setNeedsRender(),o()}}removeObject(e){const t=this._objectEntries.get(e);this._objectEntries.delete(e),this._discardObjectEntry(t),this._removePendingDeletion(e)}_removePendingDeletion(e){const t=this._pendingDeletions.get(e);this._pendingDeletions.delete(e),this._discardObjectEntry(t)}async _getObjectEntry(e){const t=this._objectEntries.get(e);if(!t)throw new Error("no object");return await t.loaded,null==t.loaded?null:t}fastUpdateObject3DEdgesTransform(e){if(this.destroyed)return!1;const t=this._objectEntries.get(e);if(!t)return!1;const{geometries:r}=e,{renderables:s}=t;if(0===r.length||0===s.length)return!0;if(s.length>1)return!1;const[n]=s,i=n.transform;if(!(i instanceof ie))return!1;const[o]=r;if(o.localOrigin!==i.origin.origin)return!1;const a=f(),c=this._computeModelTransformWithLocalOrigin(e,o,a);return n.transform=new ie(a,c),this.setNeedsRender(),!0}_discardObjectEntry(e){e&&(e.abort?.abort(),e.renderables.length&&(e.renderables.forEach(e=>this._removeRenderable(e)),this.setNeedsRender()),e.loaded=null)}hasObject(e){return this._objectEntries.has(e)}async updateAllComponentOpacities(e,t){const r=await this._updatingHandles.addPromise(this._getObjectEntry(e));if(null==r)return;const s=Array.isArray(t)?e=>t[e]:()=>t;r.renderables.forEach(e=>{const t=e.components.meta.length;for(let r=0;r<t;r++){const t=s(r),n=e.components.meta[r],i=n.index;n.material.opacity=t,e.components.buffer.textureBuffer.setDataElement(i,1,3,255*t)}this._updateTransparency(e)}),this.setNeedsRender()}async _getObjectMemoryUsage(e){const t=await this._getObjectEntry(e);return t?t.renderables.reduce((e,t)=>e+t.statistics.gpuMemoryUsage,0):0}async updateAllComponentMaterials(e,t,r,s){const n=e instanceof k,i=K(t),o=S.getKey(i,r,n),a=await this._updatingHandles.addPromise(this._getObjectEntry(e));null!=a&&(a.renderables.forEach(e=>{if(o!==e.rendererKey){const t=this._renderers.get(e.rendererKey),s=this._acquireRenderer(i,r,n);t.removeRenderable(e),--t.refCount,e.rendererKey=o,s.addRenderable(e)}if(Array.isArray(t))for(let r=0;r<t.length;r++)e.components.meta[r].material=t[r];else e.components.meta[0].material=t;s&&ce(e.components),this._updateTransparency(e)}),this.setNeedsRender())}async updateAllVerticalOffsets(e,t){const r=await this._updatingHandles.addPromise(this._getObjectEntry(e));null!=r&&this._updateAllVerticalOffsets(r,t)}_updateAllVerticalOffsets(e,t){e.renderables.forEach(e=>{const r=e.components.meta;for(let s=0;s<r.length;s++)e.components.meta[s].verticalOffset=t?.[s]??0;ce(e.components)}),this.setNeedsRender()}async updateObjectVisibility(e,t){const r=await this._updatingHandles.addPromise(this._getObjectEntry(e));r&&(r.renderables.forEach(e=>e.visible=t),this.setNeedsRender())}render(e,t){if(null==this._componentColorManager)return;this._localOrigins.updateViewMatrices(e.camera.viewMatrix);const r=e.camera.viewInverseTransposeMatrix,s=w(),n=new T;let i=0,o=0;if(this._renderers.forEach(r=>{0!==r.refCount?(++this.techniques.precompiling,r.forEachRenderable(t=>{t.visible&&(i+=t.statistics.averageEdgeLength,o++,t.regular&&r.acquireTechnique(e,!1),t.silhouette&&r.acquireTechnique(e,!0))},t),--this.techniques.precompiling):this._renderers.delete(r.key)}),this._componentColorManager.garbageCollect(),this._componentColorManager.updateTextures(),0===o)return;const a=new z(40*i/o,t);_(s,r[3],r[7],r[11]),n.set(s),b(a.transformWorldFromViewTH,n.high),b(a.transformWorldFromViewTL,n.low),u(a.transformViewFromCameraRelativeRS,e.camera.viewMatrix),m(fe,a.transformViewFromCameraRelativeRS),g(a.transformNormalViewFromGlobal,fe),a.transformProjFromView=e.camera.projectionMatrix,this._updateObjectCameraDistances(e),this._renderers.forEach(t=>{le(t,e,a),de(t,e,a)})}_updateTransparency(e){const t=W(e.components.meta),r=J(e.components.meta);t===e.edgeTransparency&&r===e.objectTransparency||(e.edgeTransparency=t,e.objectTransparency=r,this._renderers.get(e.rendererKey).setRenderablesDirty())}_computeModelTransformWithLocalOrigin(e,t,r){e.getCombinedShaderTransformation(t,r);const s=null!=t.localOrigin?this._localOrigins.register(t.localOrigin):this._localOrigins.acquire(_(this._tmpModelPosition,r[12],r[13],r[14]));return t.localOrigin=s.origin,A(s.origin.vec3,r),s}_createComponentBuffers(e){if(null==this._componentColorManager)return null;const t=new Array,r=this._componentColorManager.getBuffer(e.length);for(let n=0;n<e.length;n++){const s=e[n],i=r.acquireIndex();t.push({index:i,verticalOffset:0,material:s})}const s=new se(r,t);return ce(s),s}_extractEdges(e,t,r,s,n,i,o=i.length){return o<Z&&(n=!0),this._workerHandle.process({data:r,indices:i,indicesLength:o,writerSettings:t,skipDeduplicate:s},e,n)}_createRenderable(e,t,r,s,n){const i=t=>new ne(new U(this.rctx,new Map([["vertices",this._vertexBuffer],["instances",0===t?new Y(this.rctx,L,e.regular.instancesData.buffer):new Y(this.rctx,V,e.silhouette.instancesData.buffer)]])),0===t?e.regular.lodInfo:e.silhouette.lodInfo),o=e.regular.lodInfo.lengths.length>0?i(0):null,a=e.silhouette.lodInfo.lengths.length>0?i(1):null,c=(o?.vao.usedMemory??0)+(a?.vao.usedMemory??0);return new oe(o,a,{gpuMemoryUsage:c,externalMemoryUsage:n,averageEdgeLength:e.averageEdgeLength},r,W(t.meta),J(t.meta),t,s)}async _addGeometry(e,t,r,s,n,i){if(r.edgeIndicesLength<=0)return;const o=r.attributes.get("position"),a=f(),c=this._computeModelTransformWithLocalOrigin(e,r,a),l=new pe(o,a,c);return this._addPositionData(t,l,r.edgeIndicesLength,s,n,i)}async _addPositionData(e,t,r,s,n,i=!1){if(null==e.loaded)return;const o=this._createComponentBuffers([s]);if(null==o)return;const a=this._acquireRenderer(s.type,n,!0),{modelTransform:c,origin:l}=t,d=t.position.indices,h=t.position,u=h.data.length/h.size,m=H.createBuffer(u);for(let f=0;f<u;f++)m.position.set(f,0,h.data[f*h.size]),m.position.set(f,1,h.data[f*h.size+1]),m.position.set(f,2,h.data[f*h.size+2]);Q(o.meta,[0,m.componentIndex.count],m.componentIndex);const g=await this._updatingHandles.addPromise(this._extractEdges(e.abort?.signal||this._workerAbort.signal,a.writerSettings,m,!1,i,d,r));if(null==e.loaded)return;const p=this._createRenderable(g,o,new ie(c,l),a.key,!1);e.renderables.push(p),a.addRenderable(p),this._gpuMemoryUsage+=p.statistics.gpuMemoryUsage}async _addComponentGeometry(e,t,r,s,n,i,o,a){if(null==t.loaded)return 0;const c=this._createComponentBuffers(i);if(null==c)return 0;const l=K(i),d=this._acquireRenderer(l,o||!1,!1),h=H.createBuffer(r.length/3);M(h.position.typedBuffer,r,h.position.typedBufferStride,3),Q(c.meta,n,h.componentIndex,s);const u=!0,m=d.writerSettings,g=await this._updatingHandles.addPromise(this._extractEdges(this._workerAbort.signal,m,h,u,!1,s));if(null==t.loaded)return 0;const p=this._createRenderable(g,c,e,d.key,!0);return t.renderables.push(p),d.addRenderable(p),this._updateAllVerticalOffsets(t,a),p.statistics.gpuMemoryUsage}async _addObjectMergedGeometries(e,t,r,s,n){const i=new Map;let o=0,a=0,c=null;const l=e.geometries.filter(e=>{if(e.edgeIndicesLength<=0||!e.material.supportsEdges)return!1;!c&&e.localOrigin&&(c=e);const t=e.positionAttribute;return a+=t.data.length/t.size,o+=e.edgeIndicesLength,!0});if(0===l.length)return;const d=a>=65536?Uint32Array:Uint16Array,h=o?new d(o):null,u=[];let m=0;l.forEach(e=>{const t=e.attributes.get("position"),r=t.indices;let s=i.get(t.data);if(null==s){s=u.length/3;for(let e=0;e<t.data.length;e+=t.size)u.push(t.data[e]),u.push(t.data[e+1]),u.push(t.data[e+2]);i.set(t.data,s)}for(let n=0;n<e.edgeIndicesLength;n++)h[m++]=s+r[n]});const g=c||e.geometries[0],p=f(),_=this._computeModelTransformWithLocalOrigin(e,g,p);for(let f=0;f<e.geometries.length;f++)e.geometries[f].localOrigin=_.origin;const b=new pe(new C(u,h,3),p,_);await this._updatingHandles.addPromise(this._addPositionData(t,b,h.length,r,s,n))}_acquireRenderer(e,t,r){const s=S.getKey(e,t,r);let n=this._renderers.get(s);return null==this._strokesTexture&&(this._strokesTexture=G(this.rctx)),n||(n=new S(this.rctx,this.techniques,{type:e,hasSlicePlane:t,strokesTexture:this._strokesTexture,legacy:r,spherical:1===this.viewingMode}),this._renderers.set(s,n)),++n.refCount,n}_removeRenderable(e){ee(e.regular),ee(e.silhouette);const t=this._renderers.get(e.rendererKey);if(t){t.removeRenderable(e),--t.refCount,this._localOrigins.release(e.transform.origin),this._gpuMemoryUsage-=e.statistics.externalMemoryUsage?0:e.statistics.gpuMemoryUsage;for(const t of e.components.meta)e.components.buffer.releaseIndex(t.index)}}_updateObjectCameraDistances(e){const t=e.camera.eye,r=e.camera.viewForward,s=w(),n=e=>{y(s,e.center,t);const n=j(s,r),i=e.radius,o=n<-i?1/0:n<i?0:n-i;e.renderables.forEach(e=>e.distanceToCamera=o)};this._objectEntries.forEach(n),this._pendingDeletions.forEach(n)}get test(){}};function ee(e){e?.vao&&(e.vao.buffer("instances")?.dispose(),e.vao.disposeVAOOnly(),e.vao=null)}function te(e){let t=null,s=null;for(const n of e.geometries){if(n.material.supportsEdges){if(t){if(!r(t,n.transformation))return!1}else t=n.transformation;if(s||null==n.localOrigin){if(null!=s?.localOrigin&&null!=n.localOrigin&&s.localOrigin.id!==n.localOrigin.id)return!1}else s=n}}return!0}e([d({constructOnly:!0})],$.prototype,"rctx",void 0),e([d({constructOnly:!0})],$.prototype,"renderSR",void 0),e([d({constructOnly:!0})],$.prototype,"viewingMode",void 0),e([d({constructOnly:!0})],$.prototype,"techniques",void 0),e([d({constructOnly:!0})],$.prototype,"setNeedsRender",void 0),e([d({constructOnly:!0})],$.prototype,"schedule",void 0),e([d({readOnly:!0})],$.prototype,"_updatingHandles",void 0),e([d({readOnly:!0})],$.prototype,"updating",null),$=e([h("esri.views.3d.webgl-engine.lib.edgeRendering.EdgeView")],$);class re{constructor(e,t,r,s){this.abort=e,this.radius=s,this.renderables=new Array;const n=e?l(e.signal,()=>e.abort()):null;this.loaded=t,this.loaded.then(()=>{null!=this.loaded&&(this.loaded=!0),this.abort=null,n?.remove()}),this.center=O(r)}}class se{constructor(e,t){this.buffer=e,this.meta=t}}class ne{constructor(e,t){this.vao=e,this.lod=t}}class ie{constructor(e,t){this.modelMatrix=e,this.origin=t}}class oe{constructor(e,t,r,s,n,i,o,a){this.regular=e,this.silhouette=t,this.statistics=r,this.transform=s,this.edgeTransparency=n,this.objectTransparency=i,this.components=o,this.rendererKey=a,this.distanceToCamera=0,this.visible=!0}}class ae extends oe{}function ce(e){const{meta:t,buffer:r}=e,s=new Uint8Array(4);for(let n=0;n<t.length;n++){const e=t[n].material,o=t[n].index,a=i(Math.round(e.size*I),0,255),c=i(e.extensionLength,-N,255-N)+N,l=255*e.opacity,d=e.color,h=255*d[0],u=255*d[1],m=255*d[2],g=255*d[3];r.textureBuffer.setData(o,0,h,u,m,g),r.textureBuffer.setData(o,1,a,c,e.type,l),R(t[n].verticalOffset,s),r.textureBuffer.setData(o,2,s[0],s[1],s[2],s[3])}}function le(e,t,r){let s,n;const i=r.transparency,o=t.camera.perScreenPixelRatio;e.forEachRenderable(i=>{if(!he(i)||!i.visible)return;s??=e.acquireTechnique(t,!1),n??=e.rctx.bindTechnique(s,t,r);const a=ge(i.regular.lod.lengths,i.distanceToCamera,o);e.renderRegularEdges(n,i,r,t,a)},i)}function de(e,t,r){let s,n;const i=r.transparency,o=t.camera.perScreenPixelRatio;e.forEachRenderable(i=>{if(!me(i)||!i.visible)return;s??=e.acquireTechnique(t,!0),n??=e.rctx.bindTechnique(s,t,r);const a=ge(i.silhouette.lod.lengths,i.distanceToCamera,o);e.renderSilhouetteEdges(n,i,r,t,a)},i)}function he(e){return null!=e.regular}class ue extends oe{}function me(e){return null!=e.silhouette}function ge(e,t,r){const n=t*r,i=s(e,n,!0);return-1===i?n<e[0]?e.length:0:e.length-i}class pe{constructor(e,t,r){this.position=e,this.modelTransform=t,this.origin=r}}const fe=p(),_e=()=>Promise.reject();export{$ as EdgeView,ie as LegacyTransform,ae as RegularRenderable,oe as Renderable,ue as SilhouetteRenderable};
5
+ import{__decorate as e}from"tslib";import t from"../../../../../core/Accessor.js";import{equals as r,binaryIndexOf as s}from"../../../../../core/arrayUtils.js";import"../../../../../core/has.js";import n from"../../../../../core/Logger.js";import{clamp as i}from"../../../../../core/mathUtils.js";import{disposeMaybe as o,destroyMaybe as a}from"../../../../../core/maybe.js";import{isAbortError as c,onAbortOrThrow as l}from"../../../../../core/promiseUtils.js";import{property as d}from"../../../../../core/accessorSupport/decorators/property.js";import{subclass as h}from"../../../../../core/accessorSupport/decorators/subclass.js";import{fromMat4 as u,transpose as m,invert as g}from"../../../../../core/libs/gl-matrix-2/math/mat3.js";import{create as p}from"../../../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{create as f}from"../../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{j as _,d as y,a as b,f as j}from"../../../../../chunks/vec32.js";import{create as w,clone as O}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{UpdatingHandles as E}from"../../../../../core/support/UpdatingHandles.js";import{n as v,g as x}from"../../../../../chunks/sphere.js";import{c as M}from"../../../../../chunks/vec33.js";import{maxElevationOffset as T}from"../../collections/Component/Material/shader/ComponentData.glsl.js";import{TwoVectorPosition as R}from"../../core/util/TwoVectorPosition.js";import{Attribute as C}from"../Attribute.js";import{GridLocalOriginFactory as P}from"../GridLocalOriginFactory.js";import{applyToModelMatrix as A}from"../localOriginHelper.js";import{LocalOriginManager as D}from"../LocalOriginManager.js";import{Object3D as k}from"../Object3D.js";import{VertexArrayObject as S}from"../VertexArrayObject.js";import{VertexLayout as L,glVertexLayout as U,EdgeInputBufferLayout as V,RegularEdgeInstancesGLLayout as q,SilhouetteEdgeInstancesGLLayout as H}from"./bufferLayouts.js";import{EdgeRenderer as B,lineWidthFractionFactor as F,extensionLengthOffset as I}from"./EdgeRenderer.js";import{EdgePassParameters as N}from"./EdgeShaderParameters.js";import{EdgeWorkerHandle as W}from"./EdgeWorkerHandle.js";import{generateStrokesTexture as z}from"./strokes.js";import{determineRendererType as G,determineEdgeTransparency as K,determineObjectTransparency as J,fillComponentBufferIndices as Q}from"./util.js";import{BufferManager as X}from"../TextureBackedBuffer/BufferManager.js";import{VertexBuffer as Y}from"../../../../webgl/VertexBuffer.js";const Z=128;let $=class extends t{constructor(e){super(e),this._updatingHandles=new E,this._objectEntries=new Map,this._pendingDeletions=new Map,this._renderers=new Map,this._gpuMemoryUsage=0,this._workerAbort=new AbortController,this._tmpModelPosition=w(),this._localOrigins=new D(new P(e.renderSR));const t=L.createBuffer(4);for(let r=0;r<4;r++)t.sideness.set(r,0,0===r||3===r?0:1),t.sideness.set(r,1,0===r||1===r?0:1);this._vertexBuffer=new Y(e.rctx,U,t.buffer)}initialize(){this._workerHandle=new W(this.schedule),this._componentColorManager=new X(this.rctx,ye)}destroy(){this.destroyed||(this._objectEntries.forEach(e=>this._discardObjectEntry(e)),this._objectEntries.clear(),this._pendingDeletions.forEach(e=>this._discardObjectEntry(e)),this._pendingDeletions.clear(),this._strokesTexture=o(this._strokesTexture),this._componentColorManager=a(this._componentColorManager),this._workerAbort.abort(),this._workerHandle.destroy(),this._vertexBuffer.dispose(),this._renderers.clear(),this._updatingHandles.destroy(),this._set("schedule",_e))}get updating(){return this._updatingHandles.updating}get usedMemory(){return this._gpuMemoryUsage}shouldRender(){return this._renderers.size>0}async addComponentObject(e,t,r,s,n,i,o){if(this.hasObject(e))return this._getObjectMemoryUsage(e);let a;const c=new re(null,new Promise(e=>a=e),e.obb.center,e.obb.radius);this._objectEntries.set(e,c);const l=await this._updatingHandles.addPromise(this._addComponentGeometry(e.transform,c,t,r,s,n,i,o));return this.setNeedsRender(),a(),l}async addOrUpdateObject3D(e,t,r,s){if(this.destroyed)return void n.getLogger(this).warn("Attempt to add an object to a destroyed instance");const i=new AbortController;let o;const a=e.boundingVolumeWorldSpace.bounds,l=new re(i,new Promise(e=>o=e),v(a,w()),x(a)),d=this._objectEntries.get(e);d&&(this._pendingDeletions.has(e)?this._discardObjectEntry(d):this._pendingDeletions.set(e,d)),this._objectEntries.set(e,l);try{const n=new Array;if(e.geometries.length>1&&te(e))n.push(this._addObjectMergedGeometries(e,l,t,r,s));else for(const i of e.geometries)i.material.supportsEdges&&n.push(this._addGeometry(e,l,i,t,r,s));await this._updatingHandles.addPromise(Promise.all(n)),this._removePendingDeletion(e)}catch(h){c(h)?this._discardObjectEntry(l):this._removePendingDeletion(e)}finally{this.setNeedsRender(),o()}}removeObject(e){const t=this._objectEntries.get(e);this._objectEntries.delete(e),this._discardObjectEntry(t),this._removePendingDeletion(e)}_removePendingDeletion(e){const t=this._pendingDeletions.get(e);this._pendingDeletions.delete(e),this._discardObjectEntry(t)}async _getObjectEntry(e){const t=this._objectEntries.get(e);if(!t)throw new Error("no object");return await t.loaded,null==t.loaded?null:t}fastUpdateObject3DEdgesTransform(e){if(this.destroyed)return!1;const t=this._objectEntries.get(e);if(!t)return!1;const{geometries:r}=e,{renderables:s}=t;if(0===r.length||0===s.length)return!0;if(s.length>1)return!1;const[n]=s,i=n.transform;if(!(i instanceof ie))return!1;const[o]=r;if(o.localOrigin!==i.origin.origin)return!1;const a=f(),c=this._computeModelTransformWithLocalOrigin(e,o,a);return n.transform=new ie(a,c),this.setNeedsRender(),!0}_discardObjectEntry(e){e&&(e.abort?.abort(),e.renderables.length&&(e.renderables.forEach(e=>this._removeRenderable(e)),this.setNeedsRender()),e.loaded=null)}hasObject(e){return this._objectEntries.has(e)}async updateAllComponentOpacities(e,t){const r=await this._updatingHandles.addPromise(this._getObjectEntry(e));if(null==r)return;const s=Array.isArray(t)?e=>t[e]:()=>t;r.renderables.forEach(e=>{const{meta:t,buffer:r}=e.components,n=t.length,i=r.textureBuffer.getScalarField("opacity");for(let o=0;o<n;o++){const e=s(o),r=t[o],n=r.index;r.material.opacity=e,i.set(n,255*e)}this._updateTransparency(e)}),this.setNeedsRender()}async _getObjectMemoryUsage(e){const t=await this._getObjectEntry(e);return t?t.renderables.reduce((e,t)=>e+t.statistics.gpuMemoryUsage,0):0}async updateAllComponentMaterials(e,t,r,s){const n=e instanceof k,i=G(t),o=B.getKey(i,r,n),a=await this._updatingHandles.addPromise(this._getObjectEntry(e));null!=a&&(a.renderables.forEach(e=>{if(o!==e.rendererKey){const t=this._renderers.get(e.rendererKey),s=this._acquireRenderer(i,r,n);t.removeRenderable(e),--t.refCount,e.rendererKey=o,s.addRenderable(e)}if(Array.isArray(t))for(let r=0;r<t.length;r++)e.components.meta[r].material=t[r];else e.components.meta[0].material=t;s&&ce(e.components),this._updateTransparency(e)}),this.setNeedsRender())}async updateAllVerticalOffsets(e,t){const r=await this._updatingHandles.addPromise(this._getObjectEntry(e));null!=r&&this._updateAllVerticalOffsets(r,t)}_updateAllVerticalOffsets(e,t){e.renderables.forEach(e=>{const r=e.components.meta;for(let s=0;s<r.length;s++)e.components.meta[s].verticalOffset=t?.[s]??0;ce(e.components)}),this.setNeedsRender()}async updateObjectVisibility(e,t){const r=await this._updatingHandles.addPromise(this._getObjectEntry(e));r&&(r.renderables.forEach(e=>e.visible=t),this.setNeedsRender())}render(e,t){if(null==this._componentColorManager)return;this._localOrigins.updateViewMatrices(e.camera.viewMatrix);const r=e.camera.viewInverseTransposeMatrix,s=w(),n=new R;let i=0,o=0;if(this._renderers.forEach(r=>{0!==r.refCount?(++this.techniques.precompiling,r.forEachRenderable(t=>{t.visible&&(i+=t.statistics.averageEdgeLength,o++,t.regular&&r.acquireTechnique(e,!1),t.silhouette&&r.acquireTechnique(e,!0))},t),--this.techniques.precompiling):this._renderers.delete(r.key)}),this._componentColorManager.garbageCollect(),this._componentColorManager.updateTextures(),0===o)return;const a=new N(40*i/o,t);_(s,r[3],r[7],r[11]),n.set(s),y(a.transformWorldFromViewTH,n.high),y(a.transformWorldFromViewTL,n.low),u(a.transformViewFromCameraRelativeRS,e.camera.viewMatrix),m(fe,a.transformViewFromCameraRelativeRS),g(a.transformNormalViewFromGlobal,fe),a.transformProjFromView=e.camera.projectionMatrix,this._updateObjectCameraDistances(e),this._renderers.forEach(t=>{le(t,e,a),de(t,e,a)})}_updateTransparency(e){const t=K(e.components.meta),r=J(e.components.meta);t===e.edgeTransparency&&r===e.objectTransparency||(e.edgeTransparency=t,e.objectTransparency=r,this._renderers.get(e.rendererKey).setRenderablesDirty())}_computeModelTransformWithLocalOrigin(e,t,r){e.getCombinedShaderTransformation(t,r);const s=null!=t.localOrigin?this._localOrigins.register(t.localOrigin):this._localOrigins.acquire(_(this._tmpModelPosition,r[12],r[13],r[14]));return t.localOrigin=s.origin,A(s.origin.vec3,r),s}_createComponentBuffers(e){if(null==this._componentColorManager)return null;const t=new Array,r=this._componentColorManager.getBuffer(e.length),s=r.acquireIndices(e.length);for(let i=0;i<e.length;i++){const r=e[i],n=s[i];t.push({index:n,verticalOffset:0,material:r})}const n=new se(r,t);return ce(n),n}_extractEdges(e,t,r,s,n,i,o=i.length){return o<Z&&(n=!0),this._workerHandle.process({data:r,indices:i,indicesLength:o,writerSettings:t,skipDeduplicate:s},e,n)}_createRenderable(e,t,r,s,n){const i=t=>new ne(new S(this.rctx,new Map([["vertices",this._vertexBuffer],["instances",0===t?new Y(this.rctx,q,e.regular.instancesData.buffer):new Y(this.rctx,H,e.silhouette.instancesData.buffer)]])),0===t?e.regular.lodInfo:e.silhouette.lodInfo),o=e.regular.lodInfo.lengths.length>0?i(0):null,a=e.silhouette.lodInfo.lengths.length>0?i(1):null,c=(o?.vao.usedMemory??0)+(a?.vao.usedMemory??0);return new oe(o,a,{gpuMemoryUsage:c,externalMemoryUsage:n,averageEdgeLength:e.averageEdgeLength},r,K(t.meta),J(t.meta),t,s)}async _addGeometry(e,t,r,s,n,i){if(r.edgeIndicesLength<=0)return;const o=r.attributes.get("position"),a=f(),c=this._computeModelTransformWithLocalOrigin(e,r,a),l=new pe(o,a,c);return this._addPositionData(t,l,r.edgeIndicesLength,s,n,i)}async _addPositionData(e,t,r,s,n,i=!1){if(null==e.loaded)return;const o=this._createComponentBuffers([s]);if(null==o)return;const a=this._acquireRenderer(s.type,n,!0),{modelTransform:c,origin:l}=t,d=t.position.indices,h=t.position,u=h.data.length/h.size,m=V.createBuffer(u);for(let f=0;f<u;f++)m.position.set(f,0,h.data[f*h.size]),m.position.set(f,1,h.data[f*h.size+1]),m.position.set(f,2,h.data[f*h.size+2]);Q(o.meta,[0,m.componentIndex.count],m.componentIndex);const g=await this._updatingHandles.addPromise(this._extractEdges(e.abort?.signal||this._workerAbort.signal,a.writerSettings,m,!1,i,d,r));if(null==e.loaded)return;const p=this._createRenderable(g,o,new ie(c,l),a.key,!1);e.renderables.push(p),a.addRenderable(p),this._gpuMemoryUsage+=p.statistics.gpuMemoryUsage}async _addComponentGeometry(e,t,r,s,n,i,o,a){if(null==t.loaded)return 0;const c=this._createComponentBuffers(i);if(null==c)return 0;const l=G(i),d=this._acquireRenderer(l,o||!1,!1),h=V.createBuffer(r.length/3);M(h.position.typedBuffer,r,h.position.typedBufferStride,3),Q(c.meta,n,h.componentIndex,s);const u=!0,m=d.writerSettings,g=await this._updatingHandles.addPromise(this._extractEdges(this._workerAbort.signal,m,h,u,!1,s));if(null==t.loaded)return 0;const p=this._createRenderable(g,c,e,d.key,!0);return t.renderables.push(p),d.addRenderable(p),this._updateAllVerticalOffsets(t,a),p.statistics.gpuMemoryUsage}async _addObjectMergedGeometries(e,t,r,s,n){const i=new Map;let o=0,a=0,c=null;const l=e.geometries.filter(e=>{if(e.edgeIndicesLength<=0||!e.material.supportsEdges)return!1;!c&&e.localOrigin&&(c=e);const t=e.positionAttribute;return a+=t.data.length/t.size,o+=e.edgeIndicesLength,!0});if(0===l.length)return;const d=a>=65536?Uint32Array:Uint16Array,h=o?new d(o):null,u=[];let m=0;l.forEach(e=>{const t=e.attributes.get("position"),r=t.indices;let s=i.get(t.data);if(null==s){s=u.length/3;for(let e=0;e<t.data.length;e+=t.size)u.push(t.data[e]),u.push(t.data[e+1]),u.push(t.data[e+2]);i.set(t.data,s)}for(let n=0;n<e.edgeIndicesLength;n++)h[m++]=s+r[n]});const g=c||e.geometries[0],p=f(),_=this._computeModelTransformWithLocalOrigin(e,g,p);for(let f=0;f<e.geometries.length;f++)e.geometries[f].localOrigin=_.origin;const y=new pe(new C(u,h,3),p,_);await this._updatingHandles.addPromise(this._addPositionData(t,y,h.length,r,s,n))}_acquireRenderer(e,t,r){const s=B.getKey(e,t,r);let n=this._renderers.get(s);return null==this._strokesTexture&&(this._strokesTexture=z(this.rctx)),n||(n=new B(this.rctx,this.techniques,{type:e,hasSlicePlane:t,strokesTexture:this._strokesTexture,legacy:r,spherical:1===this.viewingMode}),this._renderers.set(s,n)),++n.refCount,n}_removeRenderable(e){ee(e.regular),ee(e.silhouette);const t=this._renderers.get(e.rendererKey);if(t){t.removeRenderable(e),--t.refCount,this._localOrigins.release(e.transform.origin),this._gpuMemoryUsage-=e.statistics.externalMemoryUsage?0:e.statistics.gpuMemoryUsage;for(const t of e.components.meta)e.components.buffer.releaseIndex(t.index)}}_updateObjectCameraDistances(e){const t=e.camera.eye,r=e.camera.viewForward,s=w(),n=e=>{b(s,e.center,t);const n=j(s,r),i=e.radius,o=n<-i?1/0:n<i?0:n-i;e.renderables.forEach(e=>e.distanceToCamera=o)};this._objectEntries.forEach(n),this._pendingDeletions.forEach(n)}get test(){}};function ee(e){e?.vao&&(e.vao.buffer("instances")?.dispose(),e.vao.disposeVAOOnly(),e.vao=null)}function te(e){let t=null,s=null;for(const n of e.geometries){if(n.material.supportsEdges){if(t){if(!r(t,n.transformation))return!1}else t=n.transformation;if(s||null==n.localOrigin){if(null!=s?.localOrigin&&null!=n.localOrigin&&s.localOrigin.id!==n.localOrigin.id)return!1}else s=n}}return!0}e([d({constructOnly:!0})],$.prototype,"rctx",void 0),e([d({constructOnly:!0})],$.prototype,"renderSR",void 0),e([d({constructOnly:!0})],$.prototype,"viewingMode",void 0),e([d({constructOnly:!0})],$.prototype,"techniques",void 0),e([d({constructOnly:!0})],$.prototype,"setNeedsRender",void 0),e([d({constructOnly:!0})],$.prototype,"schedule",void 0),e([d({readOnly:!0})],$.prototype,"_updatingHandles",void 0),e([d({readOnly:!0})],$.prototype,"updating",null),$=e([h("esri.views.3d.webgl-engine.lib.edgeRendering.EdgeView")],$);class re{constructor(e,t,r,s){this.abort=e,this.radius=s,this.renderables=new Array;const n=e?l(e.signal,()=>e.abort()):null;this.loaded=t,this.loaded.then(()=>{null!=this.loaded&&(this.loaded=!0),this.abort=null,n?.remove()}),this.center=O(r)}}class se{constructor(e,t){this.buffer=e,this.meta=t}}class ne{constructor(e,t){this.vao=e,this.lod=t}}class ie{constructor(e,t){this.modelMatrix=e,this.origin=t}}class oe{constructor(e,t,r,s,n,i,o,a){this.regular=e,this.silhouette=t,this.statistics=r,this.transform=s,this.edgeTransparency=n,this.objectTransparency=i,this.components=o,this.rendererKey=a,this.distanceToCamera=0,this.visible=!0}}class ae extends oe{}function ce(e){const{meta:t,buffer:r}=e,s=r.textureBuffer,n=s.getVec4Field("color"),o=s.getScalarField("lineWidth"),a=s.getScalarField("extensionLength"),c=s.getScalarField("materialType"),l=s.getScalarField("opacity"),d=s.getScalarField("elevationOffset");for(let h=0;h<t.length;h++){const e=t[h].material,r=t[h].index,s=i(Math.round(e.size*F),0,255),u=i(e.extensionLength,-I,255-I)+I,m=255*e.opacity,g=e.color,p=255*g[0],f=255*g[1],_=255*g[2],y=255*g[3];n.setValues(r,p,f,_,y),o.set(r,s),a.set(r,u),c.set(r,e.type),l.set(r,m),d.set(r,t[h].verticalOffset)}}function le(e,t,r){let s,n;const i=r.transparency,o=t.camera.perScreenPixelRatio;e.forEachRenderable(i=>{if(!he(i)||!i.visible)return;s??=e.acquireTechnique(t,!1),n??=e.rctx.bindTechnique(s,t,r);const a=ge(i.regular.lod.lengths,i.distanceToCamera,o);e.renderRegularEdges(n,i,r,t,a)},i)}function de(e,t,r){let s,n;const i=r.transparency,o=t.camera.perScreenPixelRatio;e.forEachRenderable(i=>{if(!me(i)||!i.visible)return;s??=e.acquireTechnique(t,!0),n??=e.rctx.bindTechnique(s,t,r);const a=ge(i.silhouette.lod.lengths,i.distanceToCamera,o);e.renderSilhouetteEdges(n,i,r,t,a)},i)}function he(e){return null!=e.regular}class ue extends oe{}function me(e){return null!=e.silhouette}function ge(e,t,r){const n=t*r,i=s(e,n,!0);return-1===i?n<e[0]?e.length:0:e.length-i}class pe{constructor(e,t,r){this.position=e,this.modelTransform=t,this.origin=r}}const fe=p(),_e=()=>Promise.reject(),ye=[{name:"color",type:"vec4u8"},{name:"lineWidth",type:"u8"},{name:"extensionLength",type:"u8"},{name:"materialType",type:"u8"},{name:"opacity",type:"u8"},{name:"elevationOffset",type:"packed-f32",maxValue:T}];export{$ as EdgeView,ie as LegacyTransform,ae as RegularRenderable,oe as Renderable,ue as SilhouetteRenderable};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as r}from"tslib";import{getAssetUrl as s}from"../../../../../assets.js";import e from"../../../../../core/Accessor.js";import{createTask as t}from"../../../../../core/asyncUtils.js";import a from"../../../../../core/Logger.js";import{abortMaybe as o,disposeMaybe as i}from"../../../../../core/maybe.js";import{throwIfAborted as m}from"../../../../../core/promiseUtils.js";import{property as p}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/has.js";import"../../../../../core/RandomLCG.js";import{subclass as c}from"../../../../../core/accessorSupport/decorators/subclass.js";import{requestImage as l}from"../../../../../support/requestImageUtils.js";import{NoParameters as n}from"../../../../webgl/NoParameters.js";import{Texture as u}from"../../../../webgl/Texture.js";import{TextureDescriptor as h}from"../../../../webgl/TextureDescriptor.js";let g=class extends e{constructor(){super(...arguments),this._passParameters=new d,this._resourcesTask=null}get passParameters(){return this._passParameters}destroy(){this._resourcesTask=o(this._resourcesTask),this._passParameters.waveNormal=i(this._passParameters.waveNormal),this._passParameters.wavePerturbation=i(this._passParameters.wavePerturbation)}get updating(){return!!this._resourcesTask&&!this._resourcesTask.finished}ensureResources(r){return this._resourcesTask||(this._resourcesTask=t(async e=>{await Promise.allSettled([this._loadImageResource(r,s("esri/images/materials/water/normals.jpg"),r=>this._passParameters.waveNormal=r,e),this._loadImageResource(r,s("esri/images/materials/water/perturbation.jpg"),r=>this._passParameters.wavePerturbation=r,e)])})),this._resourcesTask.finished?2:1}async _loadImageResource(r,s,e,t){try{const a=await l(s,{signal:t});m(t);const o=new h(a.width,a.height);o.pixelFormat=6407,o.samplingMode=9987,o.hasMipmap=!0,o.maxAnisotropy=8,e(new u(r,o,a))}catch(o){a.getLogger(this).error("Failed to load water material normal texture.",o)}}};r([p()],g.prototype,"_resourcesTask",void 0),r([p({type:Boolean,readOnly:!0})],g.prototype,"updating",null),g=r([c("esri.views.3d.webgl-engine.materials.internal.WaterTextureRepository")],g);class d extends n{}export{d as WaterTexturePassParameters,g as WaterTextureRepository};
5
+ import{__decorate as e}from"tslib";import{getAssetUrl as r}from"../../../../../assets.js";import s from"../../../../../core/Accessor.js";import{createTask as t}from"../../../../../core/asyncUtils.js";import a from"../../../../../core/Logger.js";import{abortMaybe as o,disposeMaybe as i}from"../../../../../core/maybe.js";import{throwIfAborted as m}from"../../../../../core/promiseUtils.js";import{property as p}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/has.js";import"../../../../../core/RandomLCG.js";import{subclass as c}from"../../../../../core/accessorSupport/decorators/subclass.js";import{requestImage as l}from"../../../../../request/image.js";import{NoParameters as n}from"../../../../webgl/NoParameters.js";import{Texture as u}from"../../../../webgl/Texture.js";import{TextureDescriptor as h}from"../../../../webgl/TextureDescriptor.js";let g=class extends s{constructor(){super(...arguments),this._passParameters=new d,this._resourcesTask=null}get passParameters(){return this._passParameters}destroy(){this._resourcesTask=o(this._resourcesTask),this._passParameters.waveNormal=i(this._passParameters.waveNormal),this._passParameters.wavePerturbation=i(this._passParameters.wavePerturbation)}get updating(){return!!this._resourcesTask&&!this._resourcesTask.finished}ensureResources(e){return this._resourcesTask||(this._resourcesTask=t(async s=>{await Promise.allSettled([this._loadImageResource(e,r("esri/images/materials/water/normals.jpg"),e=>this._passParameters.waveNormal=e,s),this._loadImageResource(e,r("esri/images/materials/water/perturbation.jpg"),e=>this._passParameters.wavePerturbation=e,s)])})),this._resourcesTask.finished?2:1}async _loadImageResource(e,r,s,t){try{const a=await l(r,{signal:t});m(t);const o=new h(a.width,a.height);o.pixelFormat=6407,o.samplingMode=9987,o.hasMipmap=!0,o.maxAnisotropy=8,s(new u(e,o,a))}catch(o){a.getLogger(this).error("Failed to load water material normal texture.",o)}}};e([p()],g.prototype,"_resourcesTask",void 0),e([p({type:Boolean,readOnly:!0})],g.prototype,"updating",null),g=e([c("esri.views.3d.webgl-engine.materials.internal.WaterTextureRepository")],g);class d extends n{}export{d as WaterTexturePassParameters,g as WaterTextureRepository};
package/views/View2D.js CHANGED
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as e}from"tslib";import t from"../Viewpoint.js";import i from"../core/Collection.js";import r from"../core/CollectionFlattener.js";import s from"../core/Error.js";import has from"../core/has.js";import a from"../core/Logger.js";import{destroyMaybe as n}from"../core/maybe.js";import{watch as o,syncAndInitial as l}from"../core/reactiveUtils.js";import{initialize as p}from"../core/workers/workers.js";import{property as h}from"../core/accessorSupport/decorators/property.js";import{cast as g}from"../core/accessorSupport/decorators/cast.js";import"../core/RandomLCG.js";import{subclass as d}from"../core/accessorSupport/decorators/subclass.js";import{ensureClass as c}from"../core/accessorSupport/ensureType.js";import{owningCollectionProperty as u}from"../core/support/OwningCollection.js";import m from"../geometry/Polygon.js";import{isLoadedOrLoadFor as y}from"../geometry/projectionUtils.js";import w from"../layers/support/TileInfo.js";import{AnalysesCollection as f}from"../support/AnalysesCollection.js";import{BreakpointsOwner as V}from"./BreakpointsOwner.js";import{DOMContainer as v}from"./DOMContainer.js";import{PopupView as M}from"./PopupView.js";import b from"./View.js";import{Viewport2DBaseMixin as _}from"./Viewport2DBaseMixin.js";import{Viewport2DMixin as j}from"./Viewport2DMixin.js";import R from"./2d/AnimationManager.js";import{layerView2DImporter as S}from"./2d/layerViewModuleImportUtils.js";import L from"./2d/tiling/TileInfoView.js";import"./2d/tiling/TileKey.js";import"./2d/tiling/TileQueue.js";import"./2d/tiling/TileStrategy.js";import{extentToScale as O}from"./2d/viewpointUtils.js";import{importAnalysisViewModule as T}from"./2d/analysis/analysisViewModuleImportUtils.js";import{ManagedCanvas as C}from"./2d/engine/ManagedCanvas.js";import k from"./2d/layers/features/support/TileStore.js";import{createOrReuseHighlightGradient as D}from"./2d/layers/support/util.js";import{clipContainsPoint as x}from"./2d/support/clippingUtils.js";import{getDefaultHighlightOptions as P,setDefaultHighlightOptions as A}from"./2d/support/highlightOptionsUtils.js";import{hitTest as E}from"./2d/support/hitTestUtils.js";import{takeRawScreenshot as z,takeScreenshot as U}from"./2d/support/screenshotUtils.js";import{Timeline as G}from"./2d/support/Timeline.js";import I from"./navigation/Navigation.js";import q from"./navigation/NavigationActionMap.js";import N from"./support/AnalysisViewManager.js";import W from"./support/HighlightOptions.js";import{check as $}from"./support/WebGLRequirements.js";import F from"./ui/DefaultUI.js";import B from"./ui/2d/DefaultUI2D.js";import{RenderingContextOptions as H}from"./webgl/RenderingContextOptions.js";import{isWebMap as Z}from"../webmap/utils.js";import J from"../webmap/background/ColorBackground.js";let K,Q,X,Y,ee,te,ie;async function re(){const[,{GraphicsView2D:e,GraphicContainer:t,LabelManager:i,MapViewNavigation:r,MagnifierView2D:s,GridView2D:a,Stage:n}]=await Promise.all([import("./2d/webglDeps.js"),import("./2d/mapViewDeps.js")]);Q=e,X=t,Y=i,ee=r,te=s,ie=a,K=n}let se=class extends(j(_(V(M(v(b)))))){get timeZone(){return super.timeZone}set timeZone(e){super.timeZone=e}constructor(e){super(e),this._magnifierView=null,this._gridView=null,this.stage=null,this._resolveWhenReady=[],this.rootLayerViews=new r({getCollections:()=>[this.basemapView?.baseLayerViews,this.layerViews,this.basemapView?.referenceLayerViews],getChildrenFunction:()=>null}),this.featuresTilingScheme=null,this.graphicsView=null,this.labelManager=null,this.navigation=new I({actionMap:new q({dragTertiary:"none"})}),this.renderingOptions={samplingMode:"dynamic",edgeLabelsVisible:!0,labelsAnimationTime:125,labelCollisionsEnabled:!0},this.supersampleScreenshotsEnabled=!0,this.analyses=new f,this.analysisViewManager=new N({importAnalysisViewModule:e=>T(e),view:this}),this.floors=new i,this.grid=null,this.map=null,this.timeline=new G,this.type="2d",this.view2dType=null,this.ui=new B,this.animationsEnabled=!0,this.test={takeScreenshot:async e=>z(this._getScreenshotView(e),e)},this.padding={top:0,right:0,bottom:0,left:0},p()}destroy(){this.layerViewManager.clear(),this._set("preconditionsReady",!1),this.frameTask=n(this.frameTask),this.goToManager.destroy(),this.rootLayerViews.destroy(),this.inputManager.destroy(),this._set("inputManager",null)}get graphicsTileStore(){return new k(this.featuresTilingScheme)}get constraintsInfo(){const e=this.defaultsFromMap?.tileInfo,t=this.spatialReference;return{lods:e?.spatialReference?.equals(t)?e.lods:null,spatialReference:t}}get initialExtentRequired(){if(!this.stateManager)return!1;const{scale:e,constraints:t,center:i,viewpoint:r,extent:s}=this;let a=this.zoom;return!(this.map&&"initialViewProperties"in this.map&&this.map.initialViewProperties?.viewpoint)&&(!s&&(t?.effectiveLODs||(a=-1),(!i||0===e&&-1===a)&&(null==r?.targetGeometry||"extent"!==r.targetGeometry.type&&!r.scale)))}get defaultsFromMapSettings(){return{required:{extent:!1,heightModelInfo:!1,tileInfo:!0},requiresExtentInSpatialReference:this.spatialReferenceLocked}}get scheduler(){return this.frameTask.scheduler}get typeSpecificPreconditionsReady(){const e=this._getDefaultViewpoint();if(!e)return!1;const t=e.targetGeometry,i=this.spatialReference;return y(t.spatialReference,i)}get background(){return Z(this.map)?this.map.initialViewProperties.background:null}set background(e){this._override("background",e)}get center(){return this.stateManager?.center??null}set center(e){this.stateManager.center=e}get constraints(){return super.constraints}set constraints(e){super.constraints=e}get highlightOptions(){return P(this)}set highlightOptions(e){A(this,e)}get padding(){return this.stateManager?.padding}set padding(e){this.stateManager&&(this.stateManager.padding=e)}get rendering(){return this.stage?.renderRequested??!1}get resizeAlign(){return super.resizeAlign}set resizeAlign(e){super.resizeAlign=e}get resolution(){return this.stateManager.resolution??0}get rotation(){return super.rotation}set rotation(e){super.rotation=e}get scale(){return this.stateManager?.scale??0}set scale(e){this.stateManager&&(this.stateManager.scale=e)}get spatialReference(){return super.spatialReference}set spatialReference(e){super.spatialReference=e}get spatialReferenceLocked(){return this._get("spatialReferenceLocked")}set spatialReferenceLocked(e){this.stage&&a.getLogger(this).warn("spatialReferenceLocked cannot be changed after the view has become ready"),this._set("spatialReferenceLocked",e)}get tileInfo(){return this.featuresTilingScheme?.tileInfo}get updating(){const e=!(!this.magnifier.visible||null===this.magnifier.position||!this._magnifierView?.updatingHandles.updating),t=!this.destroyed&&(!this.analysisViewManager||!this.layerViewManager||!this.labelManager||!this.graphicsView||!0===this.analysisViewManager.updating||!0===this.layerViewManager.updating||!0===this.labelManager.updating||!0===this.graphicsView.updating||this.allLayerViews.some(e=>!e.destroyed&&!("layerViews"in e)&&!0===e.updating)||e);if(has("esri-2d-log-updating")){const i=this.allLayerViews.reduce((e,t)=>({...e,[`${t.layer.id}(${t.layer.type})`]:!t.destroyed&&!("layerViews"in t)&&t.updating}),{});console.log(`Updating MapView: ${t}\n-> Null LayerViewManager: ${!this.layerViewManager}\n-> Null LabelManager: ${!this.labelManager}\n-> Null GraphicsView: ${!this.graphicsView}\n-> layerViewManager.updating: ${this.layerViewManager?.updating}\n-> labelManager.updating: ${this.labelManager?.updating}\n-> graphicsView.updating: ${this.graphicsView?.updating}\n-> allLayerViews: ${JSON.stringify(i)}\n-> updatingMagnifier: ${e}\n`)}return t}get viewpoint(){return super.viewpoint}set viewpoint(e){super.viewpoint=e}get visibleArea(){const e=this.stateManager.visibleArea;return e?new m({rings:[e.map(e=>[e[0],e[1]])],spatialReference:this.spatialReference}):e}get zoom(){return this.stateManager.zoom??-1}set zoom(e){this.stateManager.zoom=e}get navigating(){return this.mapViewNavigation?.interacting??!1}async hitTest(e,t){return E(this,e,t)}async takeScreenshot(e){return U(this._getScreenshotView(e),e)}toScreen(e,t){return this.stateManager.toScreen(e,t)}async whenAnalysisView(e){if(null==e.parent)throw new s("view:no-analysisview-for-analysis","The analysis does not exist in view.analyses",{analysis:e});return this.analysisViewManager.whenAnalysisView(e)}whenLayerView(e){return super.whenLayerView(e)}graphicChanged(e){if(this.graphicsView){this.graphicsView.graphicUpdateHandler(e)}}whenReady(){return new Promise(e=>{this.ready?e(this):this._resolveWhenReady.push(e)})}forceDOMReadyCycle(){this.forceReadyCycle()}getDefaultSpatialReference(){return this.map&&"initialViewProperties"in this.map&&this.map.initialViewProperties.spatialReference||this.defaultsFromMap?.spatialReference||null}getDefaultTimeZone(){return Z(this.map)?this.map.initialViewProperties.timeZone:null}getDefaultTimeExtent(){return Z(this.map)?this.map.initialViewProperties.timeExtent:null}getSurface(){return this.surface}hasLayerViewModule(e){return S.hasLayerViewModule(e)}importLayerView(e){return S.importLayerView(e)}pixelSizeAt(){return this.ready?this.resolution:(a.getLogger(this).error("#pixelSizeAt()","Map view cannot be used before it is ready"),null)}async popupHitTest(e){const t=this.toMap(e),i=await this.hitTest(e),r=this.allLayerViews.toArray().filter(i=>i.clips.every(i=>x(this,i,e,t))).reverse(),s=new globalThis.Map(r.map(e=>[e.layer.uid,e])),a=[];let n=0,o=0;for(;n<i.results.length||o<r.length;){const e=i.results.at(n);if(e&&"graphic"!==e.type){++n;continue}const l=s.get((e?.layer??e?.graphic.layer)?.uid);if((!e||l)&&o<r.length&&r.at(o)!==l){const e=r.at(o);"fetchPopupFeaturesAtLocation"in e&&a.push({mapPoint:t,layerView:e}),++o}else e&&(a.push({graphic:e.graphic,layerView:l}),++n)}return{hits:a,location:t}}requestUpdate(){this.ready&&this.frameTask.requestUpdate()}async validate(){let e=$(this.type);if(has("safari")&&has("safari")<9&&(e=new s("mapview:browser-not-supported","This browser is not supported by MapView (Safari < 9)",{type:"safari",requiredVersion:9,detectedVersion:has("safari")})),null!=e)throw a.getLogger(this).warn("#validate()",e.message),e}loadAsyncDependencies(){return re()}_getDefaultViewpoint(){const{constraints:e,initialExtent:i,map:r,padding:s,size:a}=this;if(!e)return null;const n=r&&"initialViewProperties"in r?r.initialViewProperties:void 0,o=this.stateManager.getUserStartupOptions(this.size),l=n?.viewpoint,p=l?.targetGeometry?.extent??i,h=p?.center,g=l?.rotation??0,d=l?.scale||p&&O(p,[a[0]-s.left-s.right,a[1]-s.top-s.bottom]),c=o.center??h,u=o.rotation??g,m=o.scale??d;return c&&m?new t({targetGeometry:c,scale:m,rotation:u}):null}_startup(){this.timeline.begin("MapView Startup");const e=this._getDefaultViewpoint();this.stateManager.startup(e,this.size,this.spatialReference,this.defaultsFromMap.extent?.center),this.graphics.owner=this;const t=new C(this.surface),i=new K(this.surface,{canvas:this.renderCanvas,contextOptions:new H(this.deactivatedWebGLExtensions,this.debugWebGLExtensions),renderingOptions:this.renderingOptions,timeline:this.timeline},t);this.stage=i,this._magnifierView=new te,this._magnifierView.magnifier=this.magnifier,this._gridView=new ie;const r=new Y({view:this});this._set("labelManager",r);const s=new R({view:this});this._set("animationManager",s);const a=new ee({view:this,animationManager:s});this._set("mapViewNavigation",a),this._setupSpatialReferenceDependentProperties(),this.addHandles([this.rootLayerViews.on("change",()=>this._updateStageChildren()),i.on("webgl-error",e=>this.fatalError=e.error),o(()=>this.stationary,e=>i.stationary=e,l),o(()=>this.background,e=>{i.backgroundColor=e?.color,this._magnifierView.backgroundColor=e?.color},l),o(()=>this.magnifier,e=>this._magnifierView.magnifier=e,l),o(()=>this.grid,e=>this._gridView.grid=e,l),o(()=>this.renderingOptions,e=>i.renderingOptions=e,l),o(()=>this.highlights.items.map(e=>({name:e.name,options:{fillColor:e.color,haloColor:e.haloColor,fillOpacity:e.fillOpacity,haloOpacity:e.haloOpacity,haloWidth:e.haloWidth,haloBlur:e.haloBlur}})),()=>{i.highlightGradient=D(i.highlightGradient,this.highlights.items)},l),o(()=>this.state.id,()=>i.state=this.state,l),o(()=>this.animationsEnabled,e=>{this.stage.animationsEnabled=e},l)],"map-view"),this._updateStageChildren();const n=this._resolveWhenReady;this._resolveWhenReady=[],n.forEach(e=>e(this)),this.timeline.end("MapView Startup"),this.frameTask.start(),this._set("ready",!0)}_teardown(){this._destroySpatialReferenceDependentProperties(),this.removeHandles("map-view"),this.mapViewNavigation.destroy(),this._set("mapViewNavigation",null),this.animation=null,this.animationManager.destroy(),this._set("animationManager",null),this.layerViewManager.clear(),this.labelManager.destroy(),this._magnifierView.destroy(),this._gridView.destroy(),this.stage.destroy(),this.stage=null,this._set("graphicsView",null),this._magnifierView=null,this._gridView=null,this._set("labelManager",null),this._set("mapViewNavigation",null),this.graphics.owner=null,this.frameTask.stop(),this.stationaryManager.clear(),this._set("ready",!1),this.stateManager.teardown()}_updateStageChildren(){this.stage.removeAllChildren(),this.rootLayerViews.forEach(e=>{this.stage.addChild(e.container)});const e=this.graphicsView;this.stage.addChild(e.container),this.stage.addChild(this._magnifierView),this.stage.addChild(this._gridView)}_setupSpatialReferenceDependentProperties(){const e=new L(w.create({spatialReference:this.spatialReference,size:512,numLODs:36}));this._set("featuresTilingScheme",e);const t=new Q({view:this,graphics:this.graphics,requestUpdateCallback:()=>this.requestUpdate(),container:new X(e)});this._set("graphicsView",t)}_destroySpatialReferenceDependentProperties(){const e=this.graphicsView;this._set("graphicsView",null),e.destroy(),this._set("featuresTilingScheme",null)}_getScreenshotView(e){const{allLayerViews:t,padding:i,size:r,stage:s}=this;return{allLayerViews:t,backgroundColor:e?.ignoreBackground?null:this.background?.color,padding:i,size:r,stage:s}}_spatialReferenceChanged(e){if(this.ready){this.frameTask.stop();for(const e of this.allLayerViews)e.processDetach();this._destroySpatialReferenceDependentProperties(),this.stateManager.changeSpatialReference(e),this.stage.state=this.state,this._setupSpatialReferenceDependentProperties();for(const e of this.allLayerViews)e.processAttach();this.frameTask.requestFrame(),this.frameTask.start(),this._updateStageChildren()}}static{this.type="2d"}};e([h({constructOnly:!0})],se.prototype,"deactivatedWebGLExtensions",void 0),e([h({constructOnly:!0})],se.prototype,"debugWebGLExtensions",void 0),e([h({readOnly:!0})],se.prototype,"featuresTilingScheme",void 0),e([h({readOnly:!0})],se.prototype,"graphicsTileStore",null),e([h()],se.prototype,"graphicsView",void 0),e([h()],se.prototype,"constraintsInfo",null),e([h()],se.prototype,"initialExtentRequired",null),e([h()],se.prototype,"labelManager",void 0),e([h({type:I,nonNullable:!0})],se.prototype,"navigation",void 0),e([h({constructOnly:!0})],se.prototype,"renderCanvas",void 0),e([h()],se.prototype,"renderingOptions",void 0),e([h({constructOnly:!0})],se.prototype,"supersampleScreenshotsEnabled",void 0),e([h()],se.prototype,"defaultsFromMapSettings",null),e([h({readOnly:!0})],se.prototype,"typeSpecificPreconditionsReady",null),e([h(u(f,"analyses"))],se.prototype,"analyses",void 0),e([h()],se.prototype,"analysisViewManager",void 0),e([h({type:J})],se.prototype,"background",null),e([h()],se.prototype,"center",null),e([h({type:i})],se.prototype,"floors",void 0),e([h()],se.prototype,"grid",void 0),e([h({type:W})],se.prototype,"highlightOptions",null),e([h()],se.prototype,"map",void 0),e([h()],se.prototype,"padding",null),e([h({readOnly:!0})],se.prototype,"rendering",null),e([h({readOnly:!0})],se.prototype,"resolution",null),e([h()],se.prototype,"scale",null),e([h({type:Boolean,value:!1})],se.prototype,"spatialReferenceLocked",null),e([h({readOnly:!0})],se.prototype,"tileInfo",null),e([h({type:G,readOnly:!0})],se.prototype,"timeline",void 0),e([h({readOnly:!0})],se.prototype,"type",void 0),e([h({readOnly:!0})],se.prototype,"updating",null),e([h({readOnly:!0})],se.prototype,"view2dType",void 0),e([h({readOnly:!0})],se.prototype,"visibleArea",null),e([h()],se.prototype,"zoom",null),e([h({readOnly:!0})],se.prototype,"navigating",null),e([h(),g(e=>e instanceof F?e:c(B,e))],se.prototype,"ui",void 0),e([h()],se.prototype,"animationsEnabled",void 0),se=e([d("esri.views.View2D")],se);const ae=se;export{ae as default};
5
+ import{__decorate as e}from"tslib";import t from"../Viewpoint.js";import i from"../core/Collection.js";import r from"../core/CollectionFlattener.js";import s from"../core/Error.js";import has from"../core/has.js";import a from"../core/Logger.js";import{destroyMaybe as n}from"../core/maybe.js";import{watch as o,syncAndInitial as l}from"../core/reactiveUtils.js";import{initialize as p}from"../core/workers/workers.js";import{property as h}from"../core/accessorSupport/decorators/property.js";import{cast as g}from"../core/accessorSupport/decorators/cast.js";import"../core/RandomLCG.js";import{subclass as d}from"../core/accessorSupport/decorators/subclass.js";import{ensureClass as c}from"../core/accessorSupport/ensureType.js";import{owningCollectionProperty as u}from"../core/support/OwningCollection.js";import m from"../geometry/Polygon.js";import{isLoadedOrLoadFor as y}from"../geometry/projectionUtils.js";import f from"../layers/support/TileInfo.js";import{AnalysesCollection as w}from"../support/AnalysesCollection.js";import{BreakpointsOwner as V}from"./BreakpointsOwner.js";import{DOMContainer as v}from"./DOMContainer.js";import{PopupView as M}from"./PopupView.js";import b from"./View.js";import{Viewport2DBaseMixin as _}from"./Viewport2DBaseMixin.js";import{Viewport2DMixin as j}from"./Viewport2DMixin.js";import R from"./2d/AnimationManager.js";import{layerView2DImporter as S}from"./2d/layerViewModuleImportUtils.js";import L from"./2d/tiling/TileInfoView.js";import"./2d/tiling/TileKey.js";import"./2d/tiling/TileQueue.js";import"./2d/tiling/TileStrategy.js";import{extentToScale as O}from"./2d/viewpointUtils.js";import{importAnalysisViewModule as T}from"./2d/analysis/analysisViewModuleImportUtils.js";import{ManagedCanvas as C}from"./2d/engine/ManagedCanvas.js";import k from"./2d/layers/features/support/TileStore.js";import{createOrReuseHighlightGradient as D}from"./2d/layers/support/util.js";import{clipContainsPoint as x}from"./2d/support/clippingUtils.js";import{getDefaultHighlightOptions as P,setDefaultHighlightOptions as A}from"./2d/support/highlightOptionsUtils.js";import{hitTest as E}from"./2d/support/hitTestUtils.js";import{takeRawScreenshot as z,takeScreenshot as U}from"./2d/support/screenshotUtils.js";import{Timeline as G}from"./2d/support/Timeline.js";import I from"./navigation/Navigation.js";import q from"./navigation/NavigationActionMap.js";import N from"./support/AnalysisViewManager.js";import W from"./support/HighlightOptions.js";import{check as $}from"./support/WebGLRequirements.js";import F from"./ui/DefaultUI.js";import B from"./ui/2d/DefaultUI2D.js";import{RenderingContextOptions as H}from"./webgl/RenderingContextOptions.js";import{isWebMap as Z}from"../webmap/utils.js";import J from"../webmap/background/ColorBackground.js";let K,Q,X,Y,ee,te,ie;async function re(){const[,{GraphicsView2D:e,GraphicContainer:t,LabelManager:i,MapViewNavigation:r,MagnifierView2D:s,GridView2D:a,Stage:n}]=await Promise.all([import("./2d/webglDeps.js"),import("./2d/mapViewDeps.js")]);Q=e,X=t,Y=i,ee=r,te=s,ie=a,K=n}let se=class extends(j(_(V(M(v(b)))))){get timeZone(){return super.timeZone}set timeZone(e){super.timeZone=e}constructor(e){super(e),this._magnifierView=null,this._gridView=null,this.stage=null,this._resolveWhenReady=[],this.rootLayerViews=new r({getCollections:()=>[this.basemapView?.baseLayerViews,this.layerViews,this.basemapView?.referenceLayerViews],getChildrenFunction:()=>null}),this.featuresTilingScheme=null,this.graphicsView=null,this.labelManager=null,this.navigation=new I({actionMap:new q({dragTertiary:"none"})}),this.renderingOptions={samplingMode:"dynamic",edgeLabelsVisible:!0,labelsAnimationTime:125,labelCollisionsEnabled:!0},this.supersampleScreenshotsEnabled=!0,this.analyses=new w,this.analysisViewManager=new N({importAnalysisViewModule:e=>T(e),view:this}),this.floors=new i,this.grid=null,this.map=null,this.timeline=new G,this.type="2d",this.view2dType=null,this.ui=new B,this.animationsEnabled=!0,this.test={takeScreenshot:async e=>z(this._getScreenshotView(e),e)},this.padding={top:0,right:0,bottom:0,left:0},p()}destroy(){this.layerViewManager.clear(),this._set("preconditionsReady",!1),this.frameTask=n(this.frameTask),this.goToManager.destroy(),this.rootLayerViews.destroy(),this.inputManager.destroy(),this._set("inputManager",null)}get graphicsTileStore(){return new k(this.featuresTilingScheme)}get constraintsInfo(){const e=this.defaultsFromMap?.tileInfo,t=this.spatialReference;return{lods:e?.spatialReference?.equals(t)?e.lods:null,spatialReference:t}}get initialExtentRequired(){if(!this.stateManager)return!1;const{scale:e,constraints:t,center:i,viewpoint:r,extent:s}=this;let a=this.zoom;return!(this.map&&"initialViewProperties"in this.map&&this.map.initialViewProperties?.viewpoint)&&(!s&&(t?.effectiveLODs||(a=-1),(!i||0===e&&-1===a)&&(null==r?.targetGeometry||"extent"!==r.targetGeometry.type&&!r.scale)))}get defaultsFromMapSettings(){return{required:{extent:!1,heightModelInfo:!1,tileInfo:!0},requiresExtentInSpatialReference:this.spatialReferenceLocked}}get scheduler(){return this.frameTask.scheduler}get typeSpecificPreconditionsReady(){const e=this._getDefaultViewpoint();if(!e)return!1;const t=e.targetGeometry,i=this.spatialReference;return y(t.spatialReference,i)}get background(){return Z(this.map)?this.map.initialViewProperties.background:null}set background(e){this._override("background",e)}get center(){return this.stateManager?.center??null}set center(e){this.stateManager.center=e}get constraints(){return super.constraints}set constraints(e){super.constraints=e}get highlightOptions(){return P(this)}set highlightOptions(e){A(this,e)}get padding(){return this.stateManager?.padding}set padding(e){this.stateManager&&(this.stateManager.padding=e)}get rendering(){return this.stage?.renderRequested??!1}get resizeAlign(){return super.resizeAlign}set resizeAlign(e){super.resizeAlign=e}get resolution(){return this.stateManager.resolution??0}get rotation(){return super.rotation}set rotation(e){super.rotation=e}get scale(){return this.stateManager?.scale??0}set scale(e){this.stateManager&&(this.stateManager.scale=e)}get spatialReference(){return super.spatialReference}set spatialReference(e){super.spatialReference=e}get spatialReferenceLocked(){return this._get("spatialReferenceLocked")}set spatialReferenceLocked(e){this.stage&&a.getLogger(this).warn("spatialReferenceLocked cannot be changed after the view has become ready"),this._set("spatialReferenceLocked",e)}get tileInfo(){return this.featuresTilingScheme?.tileInfo}get updating(){const e=!(!this.magnifier.visible||null===this.magnifier.position||!this._magnifierView?.updatingHandles.updating),t=!this.destroyed&&(!this.layerViewManager||!this.labelManager||!this.graphicsView||!0===this.analysisViewManager.updating||!0===this.layerViewManager.updating||!0===this.labelManager.updating||!0===this.graphicsView.updating||this.allLayerViews.some(e=>!e.destroyed&&!("layerViews"in e)&&!0===e.updating)||e);if(has("esri-2d-log-updating")){const i=this.allLayerViews.reduce((e,t)=>({...e,[`${t.layer.id}(${t.layer.type})`]:!t.destroyed&&!("layerViews"in t)&&t.updating}),{});console.log(`Updating MapView: ${t}\n-> Null LayerViewManager: ${!this.layerViewManager}\n-> Null LabelManager: ${!this.labelManager}\n-> Null GraphicsView: ${!this.graphicsView}\n-> layerViewManager.updating: ${this.layerViewManager?.updating}\n-> labelManager.updating: ${this.labelManager?.updating}\n-> graphicsView.updating: ${this.graphicsView?.updating}\n-> allLayerViews: ${JSON.stringify(i)}\n-> updatingMagnifier: ${e}\n`)}return t}get viewpoint(){return super.viewpoint}set viewpoint(e){super.viewpoint=e}get visibleArea(){const e=this.stateManager.visibleArea;return e?new m({rings:[e.map(e=>[e[0],e[1]])],spatialReference:this.spatialReference}):e}get zoom(){return this.stateManager.zoom??-1}set zoom(e){this.stateManager.zoom=e}get navigating(){return this.mapViewNavigation?.interacting??!1}async hitTest(e,t){return E(this,e,t)}async takeScreenshot(e){return U(this._getScreenshotView(e),e)}toScreen(e,t){return this.stateManager.toScreen(e,t)}async whenAnalysisView(e){if(null==e.parent)throw new s("view:no-analysisview-for-analysis","The analysis does not exist in view.analyses",{analysis:e});return this.analysisViewManager.whenAnalysisView(e)}whenLayerView(e){return super.whenLayerView(e)}graphicChanged(e){if(this.graphicsView){this.graphicsView.graphicUpdateHandler(e)}}whenReady(){return new Promise(e=>{this.ready?e(this):this._resolveWhenReady.push(e)})}forceDOMReadyCycle(){this.forceReadyCycle()}getDefaultSpatialReference(){return this.map&&"initialViewProperties"in this.map&&this.map.initialViewProperties.spatialReference||this.defaultsFromMap?.spatialReference||null}getDefaultTimeZone(){return Z(this.map)?this.map.initialViewProperties.timeZone:null}getDefaultTimeExtent(){return Z(this.map)?this.map.initialViewProperties.timeExtent:null}getSurface(){return this.surface}hasLayerViewModule(e){return S.hasLayerViewModule(e)}importLayerView(e){return S.importLayerView(e)}pixelSizeAt(){return this.ready?this.resolution:(a.getLogger(this).error("#pixelSizeAt()","Map view cannot be used before it is ready"),null)}async popupHitTest(e){const t=this.toMap(e),i=await this.hitTest(e),r=this.allLayerViews.toArray().filter(i=>i.clips.every(i=>x(this,i,e,t))).reverse(),s=new globalThis.Map(r.map(e=>[e.layer.uid,e])),a=[];let n=0,o=0;for(;n<i.results.length||o<r.length;){const e=i.results.at(n);if(e&&"graphic"!==e.type){++n;continue}const l=s.get((e?.layer??e?.graphic.layer)?.uid);if((!e||l)&&o<r.length&&r.at(o)!==l){const e=r.at(o);"fetchPopupFeaturesAtLocation"in e&&a.push({mapPoint:t,layerView:e}),++o}else e&&(a.push({graphic:e.graphic,layerView:l}),++n)}return{hits:a,location:t}}requestUpdate(){this.ready&&this.frameTask.requestUpdate()}async validate(){let e=$(this.type);if(has("safari")&&has("safari")<9&&(e=new s("mapview:browser-not-supported","This browser is not supported by MapView (Safari < 9)",{type:"safari",requiredVersion:9,detectedVersion:has("safari")})),null!=e)throw a.getLogger(this).warn("#validate()",e.message),e}loadAsyncDependencies(){return re()}_getDefaultViewpoint(){const{constraints:e,initialExtent:i,map:r,padding:s,size:a}=this;if(!e)return null;const n=r&&"initialViewProperties"in r?r.initialViewProperties:void 0,o=this.stateManager.getUserStartupOptions(this.size),l=n?.viewpoint,p=l?.targetGeometry?.extent??i,h=p?.center,g=l?.rotation??0,d=l?.scale||p&&O(p,[a[0]-s.left-s.right,a[1]-s.top-s.bottom]),c=o.center??h,u=o.rotation??g,m=o.scale??d;return c&&m?new t({targetGeometry:c,scale:m,rotation:u}):null}_startup(){this.timeline.begin("MapView Startup");const e=this._getDefaultViewpoint();this.stateManager.startup(e,this.size,this.spatialReference,this.defaultsFromMap.extent?.center),this.graphics.owner=this;const t=new C(this.surface),i=new K(this.surface,{canvas:this.renderCanvas,contextOptions:new H(this.deactivatedWebGLExtensions,this.debugWebGLExtensions),renderingOptions:this.renderingOptions,timeline:this.timeline},t);this.stage=i,this._magnifierView=new te,this._magnifierView.magnifier=this.magnifier,this._gridView=new ie;const r=new Y({view:this});this._set("labelManager",r);const s=new R({view:this});this._set("animationManager",s);const a=new ee({view:this,animationManager:s});this._set("mapViewNavigation",a),this._setupSpatialReferenceDependentProperties(),this.addHandles([this.rootLayerViews.on("change",()=>this._updateStageChildren()),i.on("webgl-error",e=>this.fatalError=e.error),o(()=>this.stationary,e=>i.stationary=e,l),o(()=>this.background,e=>{i.backgroundColor=e?.color,this._magnifierView.backgroundColor=e?.color},l),o(()=>this.magnifier,e=>this._magnifierView.magnifier=e,l),o(()=>this.grid,e=>this._gridView.grid=e,l),o(()=>this.renderingOptions,e=>i.renderingOptions=e,l),o(()=>this.highlights.items.map(e=>({name:e.name,options:{fillColor:e.color,haloColor:e.haloColor,fillOpacity:e.fillOpacity,haloOpacity:e.haloOpacity,haloWidth:e.haloWidth,haloBlur:e.haloBlur}})),()=>{i.highlightGradient=D(i.highlightGradient,this.highlights.items)},l),o(()=>this.state.id,()=>i.state=this.state,l),o(()=>this.animationsEnabled,e=>{this.stage.animationsEnabled=e},l)],"map-view"),this._updateStageChildren();const n=this._resolveWhenReady;this._resolveWhenReady=[],n.forEach(e=>e(this)),this.timeline.end("MapView Startup"),this.frameTask.start(),this._set("ready",!0)}_teardown(){this._destroySpatialReferenceDependentProperties(),this.removeHandles("map-view"),this.mapViewNavigation.destroy(),this._set("mapViewNavigation",null),this.animation=null,this.animationManager.destroy(),this._set("animationManager",null),this.layerViewManager.clear(),this.labelManager.destroy(),this._magnifierView.destroy(),this._gridView.destroy(),this.stage.destroy(),this.stage=null,this._set("graphicsView",null),this._magnifierView=null,this._gridView=null,this._set("labelManager",null),this._set("mapViewNavigation",null),this.graphics.owner=null,this.frameTask.stop(),this.stationaryManager.clear(),this._set("ready",!1),this.stateManager.teardown()}_updateStageChildren(){this.stage.removeAllChildren(),this.rootLayerViews.forEach(e=>{this.stage.addChild(e.container)});const e=this.graphicsView;this.stage.addChild(e.container),this.stage.addChild(this._magnifierView),this.stage.addChild(this._gridView)}_setupSpatialReferenceDependentProperties(){const e=new L(f.create({spatialReference:this.spatialReference,size:512,numLODs:36}));this._set("featuresTilingScheme",e);const t=new Q({view:this,graphics:this.graphics,requestUpdateCallback:()=>this.requestUpdate(),container:new X(e)});this._set("graphicsView",t)}_destroySpatialReferenceDependentProperties(){const e=this.graphicsView;this._set("graphicsView",null),e.destroy(),this._set("featuresTilingScheme",null)}_getScreenshotView(e){const{allLayerViews:t,padding:i,size:r,stage:s}=this;return{allLayerViews:t,backgroundColor:e?.ignoreBackground?null:this.background?.color,padding:i,size:r,stage:s}}_spatialReferenceChanged(e){if(this.ready){this.frameTask.stop();for(const e of this.allLayerViews)e.processDetach();this._destroySpatialReferenceDependentProperties(),this.stateManager.changeSpatialReference(e),this.stage.state=this.state,this._setupSpatialReferenceDependentProperties();for(const e of this.allLayerViews)e.processAttach();this.frameTask.requestFrame(),this.frameTask.start(),this._updateStageChildren()}}static{this.type="2d"}};e([h({constructOnly:!0})],se.prototype,"deactivatedWebGLExtensions",void 0),e([h({constructOnly:!0})],se.prototype,"debugWebGLExtensions",void 0),e([h({readOnly:!0})],se.prototype,"featuresTilingScheme",void 0),e([h({readOnly:!0})],se.prototype,"graphicsTileStore",null),e([h()],se.prototype,"graphicsView",void 0),e([h()],se.prototype,"constraintsInfo",null),e([h()],se.prototype,"initialExtentRequired",null),e([h()],se.prototype,"labelManager",void 0),e([h({type:I,nonNullable:!0})],se.prototype,"navigation",void 0),e([h({constructOnly:!0})],se.prototype,"renderCanvas",void 0),e([h()],se.prototype,"renderingOptions",void 0),e([h({constructOnly:!0})],se.prototype,"supersampleScreenshotsEnabled",void 0),e([h()],se.prototype,"defaultsFromMapSettings",null),e([h({readOnly:!0})],se.prototype,"typeSpecificPreconditionsReady",null),e([h(u(w,"analyses"))],se.prototype,"analyses",void 0),e([h()],se.prototype,"analysisViewManager",void 0),e([h({type:J})],se.prototype,"background",null),e([h()],se.prototype,"center",null),e([h({type:i})],se.prototype,"floors",void 0),e([h()],se.prototype,"grid",void 0),e([h({type:W})],se.prototype,"highlightOptions",null),e([h()],se.prototype,"map",void 0),e([h()],se.prototype,"padding",null),e([h({readOnly:!0})],se.prototype,"rendering",null),e([h({readOnly:!0})],se.prototype,"resolution",null),e([h()],se.prototype,"scale",null),e([h({type:Boolean,value:!1})],se.prototype,"spatialReferenceLocked",null),e([h({readOnly:!0})],se.prototype,"tileInfo",null),e([h({type:G,readOnly:!0})],se.prototype,"timeline",void 0),e([h({readOnly:!0})],se.prototype,"type",void 0),e([h({readOnly:!0})],se.prototype,"updating",null),e([h({readOnly:!0})],se.prototype,"view2dType",void 0),e([h({readOnly:!0})],se.prototype,"visibleArea",null),e([h()],se.prototype,"zoom",null),e([h({readOnly:!0})],se.prototype,"navigating",null),e([h(),g(e=>e instanceof F?e:c(B,e))],se.prototype,"ui",void 0),e([h()],se.prototype,"animationsEnabled",void 0),se=e([d("esri.views.View2D")],se);const ae=se;export{ae as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as t}from"tslib";import e from"../../../core/Accessor.js";import{min as o}from"../../../core/arrayUtils.js";import{createTask as i}from"../../../core/asyncUtils.js";import{dedupeResult as s}from"../../../core/dedupeResult.js";import{makeHandle as r}from"../../../core/handleUtils.js";import{equalsShallow as a}from"../../../core/lang.js";import{LRUCache as n}from"../../../core/LRUCache.js";import{mapCollection as l}from"../../../core/mapCollectionUtils.js";import{destroyMaybe as p,abortMaybe as u,equalsMaybe as c}from"../../../core/maybe.js";import{throwIfAborted as m,throwIfAbortError as h}from"../../../core/promiseUtils.js";import{watch as _,syncAndInitial as d,on as f}from"../../../core/reactiveUtils.js";import{throttle as v}from"../../../core/throttle.js";import{adaptiveVerticalLengthUnit as y,adaptiveLengthUnit as g}from"../../../core/unitUtils.js";import{property as C}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/Logger.js";import{subclass as P}from"../../../core/accessorSupport/decorators/subclass.js";import{ElevationQueryTileCache as j}from"../../../layers/support/ElevationQueryTileCache.js";import{absoluteHeightElevationInfo as T}from"../../../support/elevationInfoUtils.js";import{getDefaultUnitForView as U}from"../../../support/getDefaultUnitForView.js";import b from"../../../symbols/support/ElevationInfo.js";import{getConfig as w}from"./constants.js";import R from"./ElevationProfileError.js";import{InvalidGeometryError as S,UnknownError as I}from"./elevationProfileErrors.js";import{createProfileQueue as E,sanitizeProgress as D,generateProfiles as q}from"./elevationProfileGenerationUtils.js";import{mergeStatistics as x,getBoundsInMeters as O}from"./elevationProfileStatisticsUtils.js";let k=class extends e{constructor(t){super(t),this.error=null,this._getStableEffectiveUnits=s(()=>{const t=O(this._activeComputations.map(t=>t.result.rawResult)),e=this.analysis.displayUnits,o=U(this.view);return{distance:g(t.maxDistance,"meters",e.distance??o),elevation:y(t.maxElevation,"meters",e.elevation??o)}},a),this._updateTask=null,this._queue=null,this._currentTileCache=null,this._parametersPerComputation=new Map,this._getStableUpdateParameters=s(()=>({stationary:this.view.stationary??!0,activeComputations:this._activeComputations,generationParameters:this._generationParameters}),a),this._getStableGenerationParameters=s(()=>{const{view:t,analysis:e}=this;return t?.ready&&this._queue?{view:t,geometry:e.geometry,geometryIsValid:e.valid,elevationInfo:this.elevationInfo,queue:this._queue,cache:this._tileCache,options:this._options,slicePlane:"3d"===t.type?t.slice.plane:null}:null},a),this._getStableElevationInfo=s(()=>this.analysis.elevationInfo??V,c),this._getStableOptions=s(()=>{const{densificationMaxSamples:t,defaultDemResolution:e,maxTotalSamples:o}=w();let i=this._minDemResolution??e;return i=parseFloat(i.toFixed(2)),{samplingDistance:i,densificationMaxSamples:Math.round(t/this._activeComputations.length),maxTotalSamples:o}},a),this._updateThrottled=v(t=>this._update(t),w().updateThrottleMillis)}initialize(){this._computationsCollection=l(()=>this.analysis.profiles,t=>this.computationFactory.create({controller:this,profile:t,onInvalidate:t=>this._invalidateComputation(t)}),{recycleItems:!0}),this.addHandles([this._computationsCollection.on("change",()=>{this._parametersPerComputation.clear(),this._updateThrottled(this._updateParameters)}),_(()=>this._updateParameters,t=>this._updateThrottled(t),d),this._updateThrottled]);const t="3d"===this.view.type?this.view.resourceController:void 0;this._queue=E(t?.scheduler),t?.addUpdatingObject(this)}destroy(){this._abortUpdate(),this._parametersPerComputation.clear(),this._computationsCollection?.destroy(),this._queue=p(this._queue),this._currentTileCache=p(this._currentTileCache)}get effectiveDisplayUnits(){return this._getStableEffectiveUnits()}get progress(){let t=0,e=0;for(const o of this._activeComputations)t++,e+=o.progress;return D(t>0?e/t:0)}get updating(){const{progress:t}=this,e=!!this._queue?.updating,o=this._updateThrottled.hasPendingUpdates(),i=null!=this._updateTask&&!this._updateTask.finished;return e||o||i||t>0&&t<1}get results(){return this._computations.map(t=>t.result)}get statistics(){return x(this._activeComputations.map(t=>t.result.statistics))}get hoveredPoints(){return this._computations.map(t=>t.hoveredPoint)}onElevationChange(t){const{view:e}=this;return"3d"===e?.type?f(()=>e.elevationProvider,"elevation-change",t,{onListenerAdd:t,onListenerRemove:t}):r()}get _tileCache(){this._currentTileCache=p(this._currentTileCache);const t=this.view;if("3d"===t?.type){const e=t.basemapTerrain?.elevationQueryCache;if(null!=e)return e}return null==this._currentTileCache&&(this._currentTileCache=new j(new n(20971520))),this._currentTileCache}get _computations(){return this._computationsCollection?.toArray()??[]}get _activeComputations(){return this._computations.filter(t=>t.profile.enabled&&t.available)}get _minDemResolution(){const t=this._minDemResolutions;return t.length>0?o(t):null}get _minDemResolutions(){const t=[];for(const{minDemResolution:e}of this._activeComputations)null!=e&&t.push(e);return t}get _updateParameters(){return this._getStableUpdateParameters()}get _generationParameters(){return this._getStableGenerationParameters()}get elevationInfo(){return this._getStableElevationInfo()}get _options(){return this._getStableOptions()}_update({stationary:t,activeComputations:e,generationParameters:o}){this._abortUpdate(),t&&(null!=o?this._updateTask=i(async t=>{this.error=null;const i=e.filter(t=>!this._isComputationValid(t,o));try{if(!o.geometryIsValid)throw new S;const e=q({...o,providers:i},{signal:t});let s=!1;for await(const r of e){m(t),s||(this._clearInvalidResults(o),s=!0);for(let t=0;t<i.length;t++)i[t].setResult(r[t])}for(const t of i)this._parametersPerComputation.set(t,o)}catch(s){h(s),this._abortUpdate(),this.error=s instanceof R?s:new I,i.forEach(t=>{t.clearResult()})}}):this._clearResults())}_abortUpdate(){this._updateTask=u(this._updateTask)}_isComputationValid(t,e){return this._parametersPerComputation.has(t)&&this._parametersPerComputation.get(t)===e}_invalidateComputation(t){this._parametersPerComputation.delete(t),this._updateThrottled(this._updateParameters)}_clearInvalidResults(t){for(const e of this._computations)this._isComputationValid(e,t)||(e.clearResult(),this._parametersPerComputation.delete(e))}_clearResults(){for(const t of this._computations)t.clearResult(),this._parametersPerComputation.delete(t)}};t([C({constructOnly:!0})],k.prototype,"analysis",void 0),t([C({constructOnly:!0})],k.prototype,"analysisViewData",void 0),t([C({constructOnly:!0})],k.prototype,"computationFactory",void 0),t([C({constructOnly:!0})],k.prototype,"view",void 0),t([C()],k.prototype,"error",void 0),t([C({readOnly:!0})],k.prototype,"effectiveDisplayUnits",null),t([C()],k.prototype,"progress",null),t([C()],k.prototype,"updating",null),t([C()],k.prototype,"results",null),t([C()],k.prototype,"statistics",null),t([C()],k.prototype,"hoveredPoints",null),t([C()],k.prototype,"_updateTask",void 0),t([C()],k.prototype,"_queue",void 0),t([C()],k.prototype,"_tileCache",null),t([C()],k.prototype,"_computationsCollection",void 0),t([C()],k.prototype,"_computations",null),t([C()],k.prototype,"_activeComputations",null),t([C({readOnly:!0})],k.prototype,"_minDemResolution",null),t([C()],k.prototype,"_minDemResolutions",null),t([C()],k.prototype,"_updateParameters",null),t([C()],k.prototype,"_generationParameters",null),t([C()],k.prototype,"elevationInfo",null),t([C()],k.prototype,"_options",null),k=t([P("esri.views.analysis.ElevationProfile.ElevationProfileController")],k);const V=new b({...T});export{k as ElevationProfileController};
5
+ import{__decorate as t}from"tslib";import e from"../../../core/Accessor.js";import{min as o}from"../../../core/arrayUtils.js";import{createTask as i}from"../../../core/asyncUtils.js";import{dedupeResult as s}from"../../../core/dedupeResult.js";import{makeHandle as r}from"../../../core/handleUtils.js";import{equalsShallow as a}from"../../../core/lang.js";import{LRUCache as n}from"../../../core/LRUCache.js";import{mapCollection as l}from"../../../core/mapCollectionUtils.js";import{destroyMaybe as p,abortMaybe as u,equalsMaybe as c}from"../../../core/maybe.js";import{throwIfAborted as m,throwIfAbortError as h}from"../../../core/promiseUtils.js";import{watch as _,syncAndInitial as d,on as f}from"../../../core/reactiveUtils.js";import{throttle as v}from"../../../core/throttle.js";import{adaptiveVerticalLengthUnit as y,adaptiveLengthUnit as g}from"../../../core/unitUtils.js";import{property as C}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/Logger.js";import{subclass as P}from"../../../core/accessorSupport/decorators/subclass.js";import{ElevationQueryTileCache as j}from"../../../layers/support/ElevationQueryTileCache.js";import{absoluteHeightElevationInfo as T}from"../../../support/elevationInfoUtils.js";import{getDefaultUnitForView as U}from"../../../support/getDefaultUnitForView.js";import b from"../../../symbols/support/ElevationInfo.js";import{getConfig as w}from"./constants.js";import R from"./ElevationProfileError.js";import{InvalidGeometryError as S,UnknownError as I}from"./elevationProfileErrors.js";import{createProfileQueue as E,sanitizeProgress as D,generateProfiles as q}from"./elevationProfileGenerationUtils.js";import{mergeStatistics as x,getBoundsInMeters as O}from"./elevationProfileStatisticsUtils.js";let k=class extends e{constructor(t){super(t),this.error=null,this._getStableEffectiveUnits=s(()=>{const t=O(this._activeComputations.map(t=>t.result.rawResult)),e=this.analysis.displayUnits,o=U(this.view);return{distance:g(t.maxDistance,"meters",e.distance??o),elevation:y(t.maxElevation,"meters",e.elevation??o)}},a),this._updateTask=null,this._queue=null,this._currentTileCache=null,this._parametersPerComputation=new Map,this._getStableUpdateParameters=s(()=>({stationary:this.view.stationary??!0,activeComputations:this._activeComputations,generationParameters:this._generationParameters}),a),this._getStableGenerationParameters=s(()=>{const{view:t,analysis:e}=this;return t?.ready&&this._queue?{view:t,geometry:e.geometry,geometryIsValid:e.valid,elevationInfo:this.elevationInfo,queue:this._queue,cache:this._tileCache,options:this._options,slicePlane:"3d"===t.type?t.slice.plane:null}:null},a),this._getStableElevationInfo=s(()=>this.analysis.elevationInfo??V,c),this._getStableOptions=s(()=>{const{densificationMaxSamples:t,defaultDemResolution:e,maxTotalSamples:o}=w();let i=this._minDemResolution??e;return i=parseFloat(i.toFixed(2)),{samplingDistance:i,densificationMaxSamples:Math.round(t/this._activeComputations.length),maxTotalSamples:o}},a),this._updateThrottled=v(t=>this._update(t),w().updateThrottleMillis)}initialize(){this._computationsCollection=l(()=>this.analysis.profiles,t=>this.computationFactory.create({controller:this,profile:t,onInvalidate:t=>this._invalidateComputation(t)}),{recycleItems:!0}),this.addHandles([this._computationsCollection.on("change",()=>{this._parametersPerComputation.clear(),this._updateThrottled(this._updateParameters)}),_(()=>this._updateParameters,t=>this._updateThrottled(t),d),this._updateThrottled]);const t="3d"===this.view.type?this.view.resourceController:void 0;this._queue=E(t?.scheduler),t?.addUpdatingObject(this)}destroy(){this._abortUpdate(),this._parametersPerComputation.clear(),this._computationsCollection?.destroy(),this._queue=p(this._queue),this._currentTileCache=p(this._currentTileCache)}get effectiveDisplayUnits(){return this._getStableEffectiveUnits()}get progress(){let t=0,e=0;for(const o of this._activeComputations)t++,e+=o.progress;return D(t>0?e/t:0)}get updating(){const{progress:t}=this,e=!!this._queue?.updating,o=this._updateThrottled.hasPendingUpdates(),i=null!=this._updateTask&&!this._updateTask.finished;return e||o||i||t>0&&t<1}get results(){return this._computations.map(t=>t.result)}get statistics(){return x(this._activeComputations.map(t=>t.result.statistics))}get hoveredPoints(){return this._computations.map(t=>t.hoveredPoint)}onElevationChange(t){const{view:e}=this;return"3d"===e?.type?f(()=>e.elevationProvider,"elevation-change",t,{onListenerAdd:t,onListenerRemove:t}):r()}get _tileCache(){this._currentTileCache=p(this._currentTileCache);const t=this.view;if("3d"===t?.type){const e=t.basemapTerrain?.elevationQueryCache;if(null!=e)return e}return null==this._currentTileCache&&(this._currentTileCache=new j(new n(20971520))),this._currentTileCache}get _computations(){return this._computationsCollection?.toArray()??[]}get _activeComputations(){return this._computations.filter(t=>t.profile.enabled&&t.available)}get _minDemResolution(){const t=this._minDemResolutions;return t.length>0?o(t):null}get _minDemResolutions(){const t=[];for(const{minDemResolution:e}of this._activeComputations)null!=e&&t.push(e);return t}get _updateParameters(){return this._getStableUpdateParameters()}get _generationParameters(){return this._getStableGenerationParameters()}get elevationInfo(){return this._getStableElevationInfo()}get _options(){return this._getStableOptions()}_update({stationary:t,activeComputations:e,generationParameters:o}){this._abortUpdate(),t&&(null!=o?this._updateTask=i(async t=>{this.error=null;const i=e.filter(t=>!this._isComputationValid(t,o));try{if(!o.geometryIsValid)throw new S;const e=q({...o,providers:i},{signal:t});let s=!1;for await(const r of e){m(t),s||(this._clearInvalidResults(o),s=!0);for(let t=0;t<i.length;t++)i[t].setResult(r[t])}for(const t of i)this._parametersPerComputation.set(t,o)}catch(s){h(s),this._abortUpdate(),this.error=s instanceof R?s:s instanceof S?null:new I,i.forEach(t=>t.clearResult())}}):this._clearResults())}_abortUpdate(){this._updateTask=u(this._updateTask)}_isComputationValid(t,e){return this._parametersPerComputation.has(t)&&this._parametersPerComputation.get(t)===e}_invalidateComputation(t){this._parametersPerComputation.delete(t),this._updateThrottled(this._updateParameters)}_clearInvalidResults(t){for(const e of this._computations)this._isComputationValid(e,t)||(e.clearResult(),this._parametersPerComputation.delete(e))}_clearResults(){for(const t of this._computations)t.clearResult(),this._parametersPerComputation.delete(t)}};t([C({constructOnly:!0})],k.prototype,"analysis",void 0),t([C({constructOnly:!0})],k.prototype,"analysisViewData",void 0),t([C({constructOnly:!0})],k.prototype,"computationFactory",void 0),t([C({constructOnly:!0})],k.prototype,"view",void 0),t([C()],k.prototype,"error",void 0),t([C({readOnly:!0})],k.prototype,"effectiveDisplayUnits",null),t([C()],k.prototype,"progress",null),t([C()],k.prototype,"updating",null),t([C()],k.prototype,"results",null),t([C()],k.prototype,"statistics",null),t([C()],k.prototype,"hoveredPoints",null),t([C()],k.prototype,"_updateTask",void 0),t([C()],k.prototype,"_queue",void 0),t([C()],k.prototype,"_tileCache",null),t([C()],k.prototype,"_computationsCollection",void 0),t([C()],k.prototype,"_computations",null),t([C()],k.prototype,"_activeComputations",null),t([C({readOnly:!0})],k.prototype,"_minDemResolution",null),t([C()],k.prototype,"_minDemResolutions",null),t([C()],k.prototype,"_updateParameters",null),t([C()],k.prototype,"_generationParameters",null),t([C()],k.prototype,"elevationInfo",null),t([C()],k.prototype,"_options",null),k=t([P("esri.views.analysis.ElevationProfile.ElevationProfileController")],k);const V=new b({...T});export{k as ElevationProfileController};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{makeHandle as e}from"../../../core/handleUtils.js";import{convertUnit as t}from"../../../core/unitUtils.js";let l={noDataValue:-5e5,defaultQueryOptions:()=>({noDataValue:l.noDataValue,demResolution:"auto",maximumAutoTileRequests:150,ignoreInvisibleLayers:!0,signal:null}),updateThrottleMillis:100,delayAfterPreviewMillis:500,defaultDemResolution:t(10,"centimeters","meters"),densificationMaxSamples:3e3,largeChartSamples:1e4,maxTotalSamples:1e5,maxChartRatio:300,minSlopeSampleDistance:10,formatPrecision:1,profileLinesUpdateThrottleMillis:100,hoveredPointsStyle:{size:14,borderStyle:"solid",borderWidth:3,borderColor:"#ffffff",boxShadow:"0px 0px 0px 5px rgba(255,255,255,0.2)"}};function i(){return l}function o(t){const i=l;return l={...l,...t},e(()=>{l=i})}function a(){return o({defaultDemResolution:100,densificationMaxSamples:500,updateThrottleMillis:0,delayAfterPreviewMillis:0,profileLinesUpdateThrottleMillis:0})}const r={progress:1,hasZ:!1,samples:[],statistics:null,spatialReference:null},s=" ― ";export{r as errorResult,i as getConfig,s as notAvailable,o as setConfig,a as setTestConfig};
5
+ import{makeHandle as e}from"../../../core/handleUtils.js";import{convertUnit as t}from"../../../core/unitUtils.js";let i={noDataValue:-5e5,defaultQueryOptions:()=>({noDataValue:i.noDataValue,demResolution:"auto",maximumAutoTileRequests:150,ignoreInvisibleLayers:!0,signal:null}),updateThrottleMillis:100,delayAfterPreviewMillis:500,defaultDemResolution:t(10,"centimeters","meters"),densificationMaxSamples:3e3,largeChartSamples:1e4,maxTotalSamples:1e5,maxChartRatio:300,minSlopeSampleDistance:10,formatPrecision:1,profileLinesUpdateThrottleMillis:100,hoveredPointsStyle:{size:14,borderStyle:"solid",borderWidth:3,borderColor:"#ffffff",boxShadow:"0px 0px 0px 5px rgba(255,255,255,0.2)"}};function l(){return i}function o(t){const l=i;return i={...i,...t},e(()=>{i=l})}function a(){return o({defaultDemResolution:100,densificationMaxSamples:500,updateThrottleMillis:0,delayAfterPreviewMillis:0,profileLinesUpdateThrottleMillis:0})}const r=" ― ";export{l as getConfig,r as notAvailable,o as setConfig,a as setTestConfig};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import r from"./ElevationProfileError.js";class e extends r{constructor(){super("too-complex","The input geometry has too many points.")}}class o extends r{constructor(){super("invalid-geometry","The input geometry is invalid.")}}class t extends r{constructor(){super("elevation-query-error","Error querying elevation from provider.")}}class n extends r{constructor(){super("unknown","Unknown error.")}}export{t as ElevationQueryError,o as InvalidGeometryError,e as TooComplexError,n as UnknownError};
5
+ import r from"../../../core/Error.js";import o from"./ElevationProfileError.js";class e extends o{constructor(){super("too-complex","The input geometry has too many points.")}}class t extends o{constructor(){super("elevation-query-error","Error querying elevation from provider.")}}class s extends o{constructor(){super("unknown","Unknown error.")}}class n extends r{constructor(){super("invalid-geometry","The input geometry is invalid.")}}export{t as ElevationQueryError,n as InvalidGeometryError,e as TooComplexError,s as UnknownError};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{splitIntoChunks as e}from"../../../core/arrayUtils.js";import{lerp as t}from"../../../core/mathUtils.js";import{throwIfAborted as r,throwIfNotAbortError as n,after as o,isAbortError as s}from"../../../core/promiseUtils.js";import i from"../../../geometry/Multipoint.js";import{unnormalizedCoordinate as l}from"../../../geometry/support/coordsUtils.js";import{getInfo as a}from"../../../geometry/support/spatialReferenceUtils.js";import{getConfig as c,errorResult as u}from"./constants.js";import{InvalidGeometryError as p,TooComplexError as f,ElevationQueryError as m}from"./elevationProfileErrors.js";import{isValidInputPath as d,countPoints as h,densifyPath as y}from"./elevationProfileGeometryUtils.js";import{getStatistics as w}from"./elevationProfileStatisticsUtils.js";import{breadthFirstBinaryPartitioning as g}from"./elevationProfileTraversalUtils.js";import{ScheduledQueueProcessor as v}from"../../support/ScheduledQueueProcessor.js";import{TaskPriority as P}from"../../support/Scheduler.js";async function*j(e,t){const{view:n,geometry:s,elevationInfo:i,providers:l,options:a}=e,u=n.spatialReference;if(!u||null==s||!d(s))throw new p;const m=l.length;if(0===m)return null;const w=Math.round(a.maxTotalSamples/m);if(h(s)>w)throw new f;const g=await y(s,i,n,u,a,w,t);r(t);let v=0;const P=new Array(m),j=new Array(m);for(let r=0;r<m;r++){const n=M(g);P[r]=n,v+=n.samples.length;const o={...e,provider:l[r],result:n,densificationResult:g};j[r]=R(o,t)[Symbol.iterator]()}if(v>a.maxTotalSamples)throw new f;const Z=await Promise.all(j.map(e=>{const t=e.next();return!0===t.done?Promise.resolve(null):t.value}));r(t);for(let r=0;r<m;r++)P[r]=Z[r];yield P,await o(e.delayAfterPreview??c().delayAfterPreviewMillis,null,t.signal),r(t);const S=[];try{let e;do{e=!1;for(let t=0;t<m;t++){const r=j[t].next();!1===r.done&&(S.push({resultPromise:r.value,index:t}),e=!0)}}while(e)}finally{j.forEach(e=>e.return?.())}for(const{resultPromise:o,index:c}of S)P[c]=await o,r(t),yield P;for(const r of P)null!=r&&(r.progress=1);yield P}function*R(t,r){const{densificationResult:n}=t,o={...t,abortOptions:r,densificationResult:n},s=g(0,o.result.samples.length),i=s.slice(0,o.provider.numSamplesForPreview);yield Z(o,i,!0);const l=e(s,o.provider.numSamplesPerChunk);for(const e of l)yield Z(o,e,!1)}async function Z({densificationResult:e,result:t,provider:r,queue:n,abortOptions:o,cache:l},a,p){const{densifiedPath:f,pathLength:m}=e,d=t.spatialReference,{samples:h}=t,y=[];for(let s=0;s<a.length;s++){const e=h[a[s]];y[s]=[...e.coordinate]}try{return await n.push({geometry:new i({spatialReference:d,points:y,hasZ:f.hasZ}),provider:r,indices:a,preview:p,result:t,parameters:{...c().defaultQueryOptions(),minDemResolution:p?Math.round(m/r.numSamplesForPreview):Math.round(m/h.length),cache:l}},o),{...t}}catch(w){return s(w)?null:u}}function S(e){return new v({priority:P.ELEVATION_PROFILE,concurrency:1,scheduler:e,process:async e=>{r(e.parameters);try{await U(e)}catch(t){n(t)}}})}async function U({geometry:e,provider:t,indices:r,preview:n,result:o,parameters:s}){if(0===r.length)return;const i=(await b(t,e,s)).geometry,{hasZ:l,points:a}=i,c=s.noDataValue,{samples:u}=o;for(let p=0;p<r.length;p++){const e=u[r[p]];if(e.isHole)continue;const t=l?a[p][2]:null;null===t||t===c?e.sampledZ=null:(o.hasZ=!0,e.sampledZ=t),e.sampled=!0}x(u),o.progress=n?0:o.progress+r.length/u.length,o.statistics=w(o.samples,o.spatialReference)}function x(e){const t=e.length-1;let r=0;for(let n=1;n<=t;n++){(e[n].sampled||n===t)&&(E(e,r,n),r=n)}}function E(e,r,n){if(n-r===1)return;const o=e[r],s=o.sampledZ,i=e[n],l=i.sampledZ;if(null==s||null==l){for(let t=r+1;t<n;t++)e[t].sampledZ=null;return}const a=o.distance,c=i.distance-a;for(let u=r+1;u<n;u++){const r=e[u],n=(r.distance-a)/c;r.sampledZ=t(s,l,n)}}function M({densifiedPath:e,distances:t}){const r=e.spatialReference,n=a(r),o=e.paths,s=o.length,i=[];let c=null,u=0;for(let a=0;a<s;a++){const e=o[a],r=e.length,s=t[a];for(let t=0;t<r;t++){const r=e[t],o=s[t];n&&(r[0]=l(r[0],n.valid[0],n.valid[1])),c&&0===t&&A(i,c,r,u,o),i.push(O(r,o)),c=r,u=o}}return{progress:0,samples:i,hasZ:!1,statistics:null,spatialReference:r}}function A(e,t,r,n,o){e.push(T(t,n)),e.push(T(r,o))}function O(e,t){return{coordinate:e,distance:t,sampledZ:null,sampled:!1,isHole:!1}}function T(e,t){return{coordinate:e,distance:t,sampledZ:null,sampled:!0,isHole:!0}}async function b(e,t,r){try{return await e.queryElevation(t,r)}catch(n){throw new m}}function F(e,t,r){if(!e||0===e.length)return;const n=e.length-1,o=e[0];if(t<=r(o))return o;const s=e[n];if(t>=r(s))return s;let i=0,l=0,a=n;for(;i<a;){l=i+Math.floor((a-i)/2);const o=e[l],s=r(o);if(s===t)return o;if(t<s){if(l>0){const n=e[l-1],i=r(n);if(t>i)return t-i>=s-t?o:n}a=l}else{if(l<n){const n=e[l+1],i=r(n);if(t<i)return t-s>=i-t?n:o}i=l+1}}return e[l]}function H(e){return e>.999999?1:e}export{F as binaryFindClosest,S as createProfileQueue,R as generateProfile,j as generateProfiles,x as interpolateElevations,H as sanitizeProgress};
5
+ import{splitIntoChunks as e}from"../../../core/arrayUtils.js";import{lerp as t}from"../../../core/mathUtils.js";import{throwIfAborted as r,throwIfNotAbortError as n,after as o}from"../../../core/promiseUtils.js";import s from"../../../geometry/Multipoint.js";import{unnormalizedCoordinate as i}from"../../../geometry/support/coordsUtils.js";import{getInfo as l}from"../../../geometry/support/spatialReferenceUtils.js";import{getConfig as a}from"./constants.js";import{InvalidGeometryError as c,TooComplexError as u,ElevationQueryError as p}from"./elevationProfileErrors.js";import{isValidInputPath as f,countPoints as m,densifyPath as d}from"./elevationProfileGeometryUtils.js";import{getStatistics as h}from"./elevationProfileStatisticsUtils.js";import{breadthFirstBinaryPartitioning as y}from"./elevationProfileTraversalUtils.js";import{ScheduledQueueProcessor as w}from"../../support/ScheduledQueueProcessor.js";import{TaskPriority as g}from"../../support/Scheduler.js";async function*v(e,t){const{view:n,geometry:s,elevationInfo:i,providers:l,options:p}=e,h=n.spatialReference;if(!h||null==s||!f(s))throw new c;const y=l.length;if(0===y)return null;const w=Math.round(p.maxTotalSamples/y);if(m(s)>w)throw new u;const g=await d(s,i,n,h,p,w,t);r(t);let v=0;const j=new Array(y),R=new Array(y);for(let r=0;r<y;r++){const n=x(g);j[r]=n,v+=n.samples.length;const o={...e,provider:l[r],result:n,densificationResult:g};R[r]=P(o,t)[Symbol.iterator]()}if(v>p.maxTotalSamples)throw new u;const Z=await Promise.all(R.map(e=>{const t=e.next();return!0===t.done?Promise.resolve(null):t.value}));r(t);for(let r=0;r<y;r++)j[r]=Z[r];yield j,await o(e.delayAfterPreview??a().delayAfterPreviewMillis,null,t.signal),r(t);const S=[];try{let e;do{e=!1;for(let t=0;t<y;t++){const r=R[t].next();!1===r.done&&(S.push({resultPromise:r.value,index:t}),e=!0)}}while(e)}finally{R.forEach(e=>e.return?.())}for(const{resultPromise:o,index:a}of S)j[a]=await o,r(t),yield j;for(const r of j)null!=r&&(r.progress=1);yield j}function*P(t,r){const{densificationResult:n}=t,o={...t,abortOptions:r,densificationResult:n},s=y(0,o.result.samples.length),i=s.slice(0,o.provider.numSamplesForPreview);yield j(o,i,!0);const l=e(s,o.provider.numSamplesPerChunk);for(const e of l)yield j(o,e,!1)}async function j({densificationResult:e,result:t,provider:r,queue:o,abortOptions:i,cache:l},c,u){const{densifiedPath:p,pathLength:f}=e,m=t.spatialReference,{samples:d}=t,h=[];for(let n=0;n<c.length;n++){const e=d[c[n]];h[n]=[...e.coordinate]}try{return await o.push({geometry:new s({spatialReference:m,points:h,hasZ:p.hasZ}),provider:r,indices:c,preview:u,result:t,parameters:{...a().defaultQueryOptions(),minDemResolution:u?Math.round(f/r.numSamplesForPreview):Math.round(f/d.length),cache:l}},i),{...t}}catch(y){return n(y),null}}function R(e){return new w({priority:g.ELEVATION_PROFILE,concurrency:1,scheduler:e,process:async e=>{r(e.parameters);try{await Z(e)}catch(t){n(t)}}})}async function Z({geometry:e,provider:t,indices:r,preview:n,result:o,parameters:s}){if(0===r.length)return;const i=(await O(t,e,s)).geometry,{hasZ:l,points:a}=i,c=s.noDataValue,{samples:u}=o;for(let p=0;p<r.length;p++){const e=u[r[p]];if(e.isHole)continue;const t=l?a[p][2]:null;null===t||t===c?e.sampledZ=null:(o.hasZ=!0,e.sampledZ=t),e.sampled=!0}S(u),o.progress=n?0:o.progress+r.length/u.length,o.statistics=h(o.samples,o.spatialReference)}function S(e){const t=e.length-1;let r=0;for(let n=1;n<=t;n++){(e[n].sampled||n===t)&&(U(e,r,n),r=n)}}function U(e,r,n){if(n-r===1)return;const o=e[r],s=o.sampledZ,i=e[n],l=i.sampledZ;if(null==s||null==l){for(let t=r+1;t<n;t++)e[t].sampledZ=null;return}const a=o.distance,c=i.distance-a;for(let u=r+1;u<n;u++){const r=e[u],n=(r.distance-a)/c;r.sampledZ=t(s,l,n)}}function x({densifiedPath:e,distances:t}){const r=e.spatialReference,n=l(r),o=e.paths,s=o.length,a=[];let c=null,u=0;for(let l=0;l<s;l++){const e=o[l],r=e.length,s=t[l];for(let t=0;t<r;t++){const r=e[t],o=s[t];n&&(r[0]=i(r[0],n.valid[0],n.valid[1])),c&&0===t&&E(a,c,r,u,o),a.push(M(r,o)),c=r,u=o}}return{progress:0,samples:a,hasZ:!1,statistics:null,spatialReference:r}}function E(e,t,r,n,o){e.push(A(t,n)),e.push(A(r,o))}function M(e,t){return{coordinate:e,distance:t,sampledZ:null,sampled:!1,isHole:!1}}function A(e,t){return{coordinate:e,distance:t,sampledZ:null,sampled:!0,isHole:!0}}async function O(e,t,r){try{return await e.queryElevation(t,r)}catch(n){throw new p}}function T(e,t,r){if(!e||0===e.length)return;const n=e.length-1,o=e[0];if(t<=r(o))return o;const s=e[n];if(t>=r(s))return s;let i=0,l=0,a=n;for(;i<a;){l=i+Math.floor((a-i)/2);const o=e[l],s=r(o);if(s===t)return o;if(t<s){if(l>0){const n=e[l-1],i=r(n);if(t>i)return t-i>=s-t?o:n}a=l}else{if(l<n){const n=e[l+1],i=r(n);if(t<i)return t-s>=i-t?n:o}i=l+1}}return e[l]}function b(e){return e>.999999?1:e}export{T as binaryFindClosest,R as createProfileQueue,P as generateProfile,v as generateProfiles,S as interpolateElevations,b as sanitizeProgress};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as t}from"tslib";import{EventedAccessor as e}from"../../core/Evented.js";import{clone as i}from"../../core/lang.js";import{destroyMaybe as n,equalsMaybe as r}from"../../core/maybe.js";import{memoize as s}from"../../core/memoize.js";import{ignoreAbortErrors as o}from"../../core/promiseUtils.js";import a from"../../core/ReactiveSet.js";import{watch as p,syncAndInitial as c}from"../../core/reactiveUtils.js";import{createScreenPoint as l}from"../../core/screenUtils.js";import{property as d}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/Logger.js";import{subclass as h}from"../../core/accessorSupport/decorators/subclass.js";import{diff as u}from"../../core/accessorSupport/diffUtils.js";import{UpdatingHandles as g}from"../../core/support/UpdatingHandles.js";import{pointEquals as m,pointNear as y}from"../../layers/graphics/dehydratedFeatureComparison.js";import{getEffectiveElevationInfo as _}from"../../support/elevationInfoUtils.js";import{defaultDrawingMode as v}from"./DrawingMode.js";import{LegacyDrawManipulator as f}from"./LegacyDrawManipulator.js";import{createCoordinateHelper as x}from"../interactive/coordinateHelper.js";import{createManipulatorDragEventPipeline as P,sceneSnappingAtLocation as b}from"../interactive/dragEventPipeline.js";import{EditGeometry as T,Part as S}from"../interactive/editGeometry/EditGeometry.js";import{EditGeometryOperations as C}from"../interactive/editGeometry/EditGeometryOperations.js";import{isPoint as V}from"../interactive/sketch/constraints.js";import{getPointConstraint as w,getPolylineOrPolygonConstraint as O,pointToConstraintSpace as M,constraintSpaceToPoint as D}from"../interactive/sketch/constraintUtils.js";import E from"../interactive/sketch/SketchLabelOptions.js";import{SnappingContext as I}from"../interactive/snapping/SnappingContext.js";import{createSnapDragEventPipelineStep as H}from"../interactive/snapping/SnappingDragPipelineStep.js";import{SnappingOperation as j}from"../interactive/snapping/SnappingOperation.js";import{setupSnappingToggleHandles as G}from"../interactive/snapping/snappingUtils.js";const k="crosshair",Z="progress",L=Symbol(),U=Symbol();let A=class extends e{constructor(t){super(t),this._createOperationCompleted=!1,this._hideDefaultCursor=!1,this._pointerDownStates=new a,this._stagedScreenPoint=null,this._stagedPointerType=null,this._updatingHandles=new g,this._stagedPointerId=null,this.constraintsEnabled=!1,this.constraints=void 0,this._getPointConstraint=s(w),this._getPolylineOrPolygonConstraint=s(O),this.constraintZ=null,this.defaultZ=null,this.isDraped=!0,this.labelOptions=new E,this.cursor=null,this.loading=!1,this.snapToSceneEnabled=null,this.firstVertex=null,this.lastVertex=null,this.secondToLastVertex=null,null==t.elevationInfo&&(this.elevationInfo=_(!!t.hasZ))}initializePointer(){const t=this.view.inputManager?.latestPointerInfo;null!=t&&this._updatePointer(t.location,t.id,t.type)}initialize(){const{geometryType:t,view:e}=this,i=e.spatialReference,n="viewingMode"in e.state?e.state.viewingMode:2,s="segment"===t||"multipoint"===t?"polyline":t;this.coordinateHelper=x(this.hasZ,this.hasM,i),this._editGeometryOperations=new C(new T(s,this.coordinateHelper),n),this._snappingOperation=new j({view:e}),this.addHandles([p(()=>({stagedPoint:this._snappingOperation.stagedPoint,constraint:this._constraint}),({stagedPoint:t,constraint:e},i)=>{const{snappingOptions:n}=this;n&&(n.forceDisabled=null!=e&&V(e));if(null!=i&&t===i.stagedPoint&&e!==i.constraint)return this._onKeyboardBasedChange();this._processCursor(t??this._screenToMap(this._stagedScreenPoint))},{equals:(t,e)=>t.stagedPoint===e.stagedPoint&&r(t.constraint,e.constraint)}),p(()=>this.view.viewpoint,(t,e)=>{t&&e&&u(t,e)&&this._onKeyboardBasedChange()})]),this._activePart=new S(i,n),this._editGeometryOperations.data.parts.push(this._activePart);const a=this.segmentLabels;null!=a&&(a.context={view:e,editGeometryOperations:this._editGeometryOperations,elevationInfo:this.elevationInfo,labelOptions:this.labelOptions,automaticLengthMeasurementUtils:this.automaticLengthMeasurementUtils},this.addHandles(p(()=>this.labelOptions.enabled,t=>{a.visible=t},c))),this.addHandles(this._editGeometryOperations.on(["vertex-add","vertex-update","vertex-remove"],t=>{const e=t.vertices.map(t=>({componentIndex:0,vertexIndex:t.index,coordinates:this.coordinateHelper.vectorToArray(t.pos)})),i=e.map(t=>t.coordinates),n=this.coordinateHelper.vectorToDehydratedPoint(this._activePart.getFirstVertex()?.pos)??null;m(n,this.firstVertex)||(this.firstVertex=n);const r=this.coordinateHelper.vectorToDehydratedPoint(this._activePart.getLastVertex()?.pos)??null;m(r,this.lastVertex)||(this.lastVertex=r);const s=this.coordinateHelper.vectorToDehydratedPoint(this._activePart.segments.at(-1)?.leftVertex?.pos)??null;switch(m(s,this.secondToLastVertex)||(this.secondToLastVertex=s),this._processCursor(this.cursorVertex),t.type){case"vertex-add":this.emit(t.type,{...t,added:i,vertices:e});break;case"vertex-update":this.emit(t.type,{...t,updated:i,vertices:e});break;case"vertex-remove":this.emit(t.type,{...t,removed:i,vertices:e})}}));const l=this._manipulator=new f({consumesClicks:!1,grabbableForEvent:t=>"click"!==this.drawingMode||"touch"===t.pointerType&&this._snappingEnabled&&1===this._pointerDownStates.size});this.manipulators.add(l),l.grabbable="point"!==t&&"multipoint"!==t,this.addHandles([l.events.on("immediate-click",t=>this._onImmediateClick(t)),l.events.on("immediate-double-click",t=>this._onImmediateDoubleClick(t)),p(()=>this.drawingMode,()=>{this.removeHandles(L),this.addHandles(this._createManipulatorDragPipeline(l),L)},c),p(()=>({effectiveCursor:this.effectiveCursor}),({effectiveCursor:t})=>{l.cursor=t},c)]),G(this,()=>{const t=this.view.inputManager.latestPointerInfo?.type??"mouse",e=this._getSnappingContext(t);if(null!=this.snappingManager){const t=this._snappingOperation.snapAgainNearPreviousMapPoint(this.snappingManager,e);this._updatingHandles.addPromise(o(t))}})}destroy(){n(this.segmentLabels),n(this._snappingOperation),this._editGeometryOperations=n(this._editGeometryOperations),this._updatingHandles.destroy()}get _isDragging(){const{_stagedPointerId:t,_manipulator:e}=this;return null!=t&&this._pointerDownStates.has(t)||e.grabbing||!e.interactive}get _snappingEnabled(){return null!=this.snappingManager&&this.snappingManager.options.effectiveEnabled}get _requiresScenePoint(){const t=this._updateAndGetEffectiveDrawSurface();return"3d"===this.view.type&&this.drawSurface!==t}get canRedo(){return this._editGeometryOperations.canRedo}get canUndo(){return this._editGeometryOperations.canUndo}get committedVertices(){return this._activePart.vertices.map(t=>this.coordinateHelper.vectorToArray(t.pos))}get _constraint(){const{constraints:t,constraintsEnabled:e}=this;if(t&&e)switch(this.geometryType){case"point":case"multipoint":return this._getPointConstraint(t);case"polygon":case"polyline":return this._getPolylineOrPolygonConstraint(this.lastVertex,this.secondToLastVertex,t)}}set drawingMode(t){this._set("drawingMode",t??v)}get effectiveCursor(){return this.loading?Z:this._hideDefaultCursor?null:this.cursor||k}get interactive(){return this._manipulator.interactive}set interactive(t){this._manipulator.interactive=t}get isCompleted(){return this._createOperationCompleted}get numCommittedVertices(){return this._activePart.vertices.length}get snappingOptions(){return null!=this.snappingManager?this.snappingManager.options:null}get cursorVertex(){return this._get("cursorVertex")}get visualizationCursorVertex(){return"mouse"===this._stagedPointerType?this.cursorVertex:null}get committableVertex(){const{cursorVertex:t,lastVertex:e,firstVertex:i,geometryType:n}=this;return"polygon"===n&&y(t,i)||y(t,e)?null:t}get updating(){return this._updatingHandles.updating}get geometryIncludingUncommittedVertices(){const{committedVertices:t,committableVertex:e,coordinateHelper:i}=this,n=t.slice();return null!=e&&n.push(i.pointToArray(e)),n}cancel(){this.complete({aborted:!0})}commitStagedVertex(){this._snappingOperation.abort();const{committableVertex:t}=this;null!=t&&this._editGeometryOperations.appendVertex(this.coordinateHelper.pointToVector(t),this._activePart)}complete(t){const e=t?.aborted||!1;this._snappingOperation.abort(),this.snappingManager?.doneSnapping();const{geometryType:i,numCommittedVertices:n}=this,r="multipoint"===i&&0===n||"polyline"===i&&n<2||"polygon"===i&&n<3;"segment"!==i&&"point"!==i||this.commitStagedVertex(),this._createOperationCompleted=!r,(this.isCompleted||e)&&(this._stagedScreenPoint=null,this._stagedPointerId=null,this._stagedPointerType=null,this._processCursor(null),this.emit("complete",{vertices:this.committedVertices.map((t,e)=>({componentIndex:0,vertexIndex:e,coordinates:t})),aborted:e,type:"complete"}))}onInputEvent(t){switch(t.type){case"pointer-down":this._pointerDownStates.add(t.pointerId);break;case"pointer-up":this._pointerDownStates.delete(t.pointerId)}switch(t.type){case"pointer-move":return this._onPointerMove(t);case"hold":return this._onHold(t)}}redo(){this._editGeometryOperations.redo()}undo(){null!=this.snappingManager&&this.snappingManager.doneSnapping(),this._editGeometryOperations.undo()}_processCursor(t){const e=i(this.cursorVertex),n=i(t),r=n&&(this._updateAndGetEffectiveDrawSurface()?.constrainZ(n)??n),s=this._snapToClosingVertex(r),o=this._applyConstraints(s);y(e,o)||(this._set("cursorVertex",o),this.segmentLabels?.set("stagedVertex",null!=o?this.coordinateHelper.pointToVector(o):null),null==o||"mouse"!==this._stagedPointerType?this.emit("cursor-remove"):this.emit("cursor-update",{updated:null,vertices:[{componentIndex:0,vertexIndex:this._activePart.vertices.length,coordinates:this.coordinateHelper.pointToArray(o)}],operation:"apply",type:"vertex-update"}))}_snapToClosingVertex(t){if(null==t||this._isDragging||"polygon"!==this.geometryType||this.numCommittedVertices<=2)return t;const e=this._mapToScreen(t);if(!e)return t;const i=this._activePart;return this._vertexWithinPointerDistance(i.vertices[0].pos,e)?this.firstVertex:this._vertexWithinPointerDistance(i.vertices.at(-1).pos,e)?this.lastVertex:t}_createManipulatorDragPipeline(t){switch(this.drawingMode){case"click":return this._createManipulatorDragPipelineClick(t);case"freehand":return this._createManipulatorDragPipelineFreehand(t);case"hybrid":return this._createManipulatorDragPipelineHybrid(t)}}_createManipulatorDragPipelineClick(t){return P(t,(t,e,i,n)=>{const r="touch"===n&&this._snappingEnabled;if(this.isCompleted||!r)return;const{snappingStep:s,cancelSnapping:o}=H({predicate:()=>r,snappingManager:this.snappingManager,snappingContext:new I({editGeometryOperations:this._editGeometryOperations,elevationInfo:this.elevationInfo,feature:this.graphic,pointer:n,visualizer:this.snappingVisualizer,drawConstraints:this.constraints}),updatingHandles:this._updatingHandles,useZ:!this._requiresScenePoint});i=i.next(t=>(r&&null!=this.snappingManager&&this.snappingManager.doneSnapping(),t)).next(o),e.next(this._screenToMapDragEventStep()).next(t=>("start"===t.action&&(this._processCursor(t.mapStart),("segment"===this.geometryType||r&&!this.numCommittedVertices)&&this.commitStagedVertex()),t)).next(b(this.view,this.elevationInfo)).next(...s).next(t=>(r&&(this._processCursor(t.mapEnd),"end"===t.action&&this.commitStagedVertex()),t)).next(t=>("end"===t.action&&("mouse"!==this._stagedPointerType&&this._snappingOperation.abort(),"segment"!==this.geometryType&&"point"!==this.geometryType||this.complete()),t))})}_createManipulatorDragPipelineFreehand(t){return P(t,(t,e)=>{this.isCompleted||e.next(this._screenToMapDragEventStep()).next(t=>("start"===t.action&&(this._snappingOperation.abort(),null==this.committableVertex&&this._processCursor(t.mapStart),"segment"===this.geometryType&&this.commitStagedVertex()),t)).next(t=>{switch(t.action){case"start":case"update":this._processCursor(t.mapEnd),"polygon"!==this.geometryType&&"polyline"!==this.geometryType||this.commitStagedVertex();break;case"end":this.complete()}return t})})}_createManipulatorDragPipelineHybrid(t){return P(t,(t,e)=>{this.isCompleted||e.next(this._screenToMapDragEventStep()).next(t=>("start"===t.action&&(this._snappingOperation.abort(),this.addHandles(this._editGeometryOperations.createUndoGroup(),U),this._processCursor(t.mapStart),this.commitStagedVertex()),t)).next(t=>{switch(t.action){case"start":case"update":this._processCursor(t.mapEnd),"polygon"!==this.geometryType&&"polyline"!==this.geometryType||this.commitStagedVertex();break;case"end":"mouse"!==this._stagedPointerType&&this._snappingOperation.abort(),this.removeHandles(U),"segment"!==this.geometryType&&"point"!==this.geometryType||this.complete()}return t})})}get _drawAtFixedElevation(){const{constraintsEnabled:t,constraintZ:e,geometryType:i,numCommittedVertices:n}=this;return t?null!=e||"segment"===i&&n>0:("segment"===i||"polygon"===i)&&n>0}_updateAndGetEffectiveDrawSurface(){const{constraintsEnabled:t,coordinateHelper:e,drawSurface:i,elevationDrawSurface:n,snapToSceneEnabled:r}=this;if(null==n)return i;if(!this.hasZ)return n.defaultZ=null,n;const s=this.elevationInfo?.mode;let o=this.defaultZ,a=t||"absolute-height"===s;if(null!=r&&(a=r),"on-the-ground"===s&&(a=!1),this._drawAtFixedElevation){o=(t?this.constraintZ:null)??e.getZ(this._activePart.vertices[0].pos),a=!1}return a?i:(n.defaultZ=o,n)}_mapToScreen(t){return this._updateAndGetEffectiveDrawSurface()?.mapToScreen(t)}_onHold(t){this._snappingOperation.abort(),"click"===this.drawingMode&&"touch"===t.pointerType&&this._snappingEnabled&&this._processCursor(t.mapPoint),t.stopPropagation()}_onImmediateClick(t){if(!("mouse"===t.pointerType&&2===t.button||this._manipulator.dragging))try{const{drawingMode:e,geometryType:i}=this;this._stagedPointerType=t.pointerType,this._stagedScreenPoint=t.screenPoint;const n=this._screenToMap(t.screenPoint);if(null==n)return;if(null==n||"freehand"===e&&"point"!==i&&"multipoint"!==i)return;if(this._snappingEnabled&&null!=this.cursorVertex||this._processCursor(n),null==this.committableVertex)return void this.complete();this.commitStagedVertex(),"mouse"!==t.pointerType&&this._processCursor(null),("freehand"===e&&"multipoint"!==this.geometryType||"point"===i||"segment"===i&&2===this.numCommittedVertices||"segment"===i&&"hybrid"===e&&1===this.numCommittedVertices)&&this.complete()}finally{t.stopPropagation()}}_onImmediateDoubleClick(t){this._manipulator.dragging||"point"===this.geometryType||(this.complete(),t.stopPropagation())}_onPointerMove(t){const e=l(t.x,t.y);this._updatePointer(e,t.pointerId,t.pointerType)&&t.stopPropagation()}_updatePointer(t,e,i){return this._stagedScreenPoint=t,this._stagedPointerType=i,this._stagedPointerId=e,this._isDragging?(this._snappingOperation.abort(),!1):(this._processCursorMovementRelativeToSurface(t,i),!0)}_onKeyboardBasedChange(){"mouse"===this._stagedPointerType&&this._stagedScreenPoint&&null!=this._stagedPointerId&&!this._isDragging?this._processCursorMovementRelativeToSurface(this._stagedScreenPoint,this._stagedPointerType):this._snappingOperation.abort()}_processCursorMovementRelativeToSurface(t,e){const i=this._snappingOperation,n=this._screenToMap(t),r=this._requiresScenePoint?this.drawSurface?.screenToMap(t):null;if(null==n)return this._hideDefaultCursor=!0,this._processCursor(null),void i.abort();this._hideDefaultCursor=!1;const s=this.snappingManager;if(null==s)return this._processCursor(n),void i.abort();const a=this._getSnappingContext(e);this._updatingHandles.addPromise(o(i.snap({point:n,scenePoint:r},s,a)))}_applyConstraints(t){const{_constraint:e,constraints:i}=this;if(!t||!i||!e)return t;const{context:n}=i,r=M(t,n),s=r?e.closestTo(r):void 0;if(!s)return t;const o=D(s,t,n),a="2d"===this.view.type||"absolute-height"!==n.elevationInfo.mode;return null!=o&&a&&null!=this.constraintZ&&this.hasZ&&(o.z=this.constraintZ),o}_screenToMap(t){return t?this._updateAndGetEffectiveDrawSurface()?.screenToMap(t):null}_screenToMapDragEventStep(){let t=null;return e=>{if("start"===e.action&&(t=this._screenToMap(e.screenStart)),null==t)return null;const i=this._screenToMap(e.screenEnd);return null!=i?{...e,mapStart:t,mapEnd:i}:null}}_vertexWithinPointerDistance(t,e){const i=25,n=this._mapToScreen(this.coordinateHelper.vectorToDehydratedPoint(t));return null!=n&&z(n,e,i)}_getSnappingContext(t){const e=this._drawAtFixedElevation?this.elevationDrawSurface?.defaultZ:null;return new I({editGeometryOperations:this._editGeometryOperations,elevationInfo:this.elevationInfo,pointer:t,feature:this.graphic,visualizer:this.snappingVisualizer,selfSnappingZ:null!=e?{value:e,elevationInfo:this.elevationInfo}:null,drawConstraints:this.constraints})}};function z(t,e,i){const n=t.x-e.x,r=t.y-e.y;return n*n+r*r<=i}t([d()],A.prototype,"_hideDefaultCursor",void 0),t([d()],A.prototype,"_stagedPointerId",void 0),t([d()],A.prototype,"_isDragging",null),t([d()],A.prototype,"_snappingOperation",void 0),t([d()],A.prototype,"_snappingEnabled",null),t([d({constructOnly:!0})],A.prototype,"graphic",void 0),t([d()],A.prototype,"constraintsEnabled",void 0),t([d()],A.prototype,"constraints",void 0),t([d()],A.prototype,"_constraint",null),t([d()],A.prototype,"constraintZ",void 0),t([d()],A.prototype,"defaultZ",void 0),t([d()],A.prototype,"isDraped",void 0),t([d({constructOnly:!0})],A.prototype,"automaticLengthMeasurementUtils",void 0),t([d({value:v})],A.prototype,"drawingMode",null),t([d({constructOnly:!0})],A.prototype,"elevationDrawSurface",void 0),t([d({constructOnly:!0})],A.prototype,"elevationInfo",void 0),t([d({constructOnly:!0,type:E})],A.prototype,"labelOptions",void 0),t([d({constructOnly:!0})],A.prototype,"geometryType",void 0),t([d({constructOnly:!0})],A.prototype,"hasM",void 0),t([d({constructOnly:!0})],A.prototype,"hasZ",void 0),t([d()],A.prototype,"cursor",void 0),t([d()],A.prototype,"effectiveCursor",null),t([d()],A.prototype,"loading",void 0),t([d({constructOnly:!0})],A.prototype,"manipulators",void 0),t([d({constructOnly:!0})],A.prototype,"drawSurface",void 0),t([d({constructOnly:!0})],A.prototype,"segmentLabels",void 0),t([d({constructOnly:!0})],A.prototype,"snappingManager",void 0),t([d({constructOnly:!0})],A.prototype,"snappingVisualizer",void 0),t([d()],A.prototype,"snapToSceneEnabled",void 0),t([d({readOnly:!0})],A.prototype,"cursorVertex",null),t([d({readOnly:!0})],A.prototype,"visualizationCursorVertex",null),t([d()],A.prototype,"committableVertex",null),t([d()],A.prototype,"firstVertex",void 0),t([d()],A.prototype,"lastVertex",void 0),t([d()],A.prototype,"secondToLastVertex",void 0),t([d()],A.prototype,"updating",null),t([d({constructOnly:!0})],A.prototype,"view",void 0),A=t([h("esri.views.draw.DrawOperation")],A);export{A as DrawOperation,k as defaultCursor,Z as defaultLoadingCursor};
5
+ import{__decorate as t}from"tslib";import{EventedAccessor as e}from"../../core/Evented.js";import{clone as i}from"../../core/lang.js";import{equalsMaybe as n,destroyMaybe as r}from"../../core/maybe.js";import{memoize as s}from"../../core/memoize.js";import{ignoreAbortErrors as o}from"../../core/promiseUtils.js";import a from"../../core/ReactiveSet.js";import{watch as p,syncAndInitial as c}from"../../core/reactiveUtils.js";import{createScreenPoint as l}from"../../core/screenUtils.js";import{property as d}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/Logger.js";import{subclass as h}from"../../core/accessorSupport/decorators/subclass.js";import{diff as u}from"../../core/accessorSupport/diffUtils.js";import{UpdatingHandles as g}from"../../core/support/UpdatingHandles.js";import{pointEquals as m,pointNear as y}from"../../layers/graphics/dehydratedFeatureComparison.js";import{getEffectiveElevationInfo as _}from"../../support/elevationInfoUtils.js";import{defaultDrawingMode as v}from"./DrawingMode.js";import{LegacyDrawManipulator as f}from"./LegacyDrawManipulator.js";import{createCoordinateHelper as x}from"../interactive/coordinateHelper.js";import{createManipulatorDragEventPipeline as P,sceneSnappingAtLocation as b}from"../interactive/dragEventPipeline.js";import{EditGeometry as T,Part as S}from"../interactive/editGeometry/EditGeometry.js";import{EditGeometryOperations as C}from"../interactive/editGeometry/EditGeometryOperations.js";import{isPoint as V}from"../interactive/sketch/constraints.js";import{getPointConstraint as w,getPolylineOrPolygonConstraint as O,pointToConstraintSpace as M,constraintSpaceToPoint as D}from"../interactive/sketch/constraintUtils.js";import E from"../interactive/sketch/SketchLabelOptions.js";import{SnappingContext as I}from"../interactive/snapping/SnappingContext.js";import{createSnapDragEventPipelineStep as H}from"../interactive/snapping/SnappingDragPipelineStep.js";import{SnappingOperation as j}from"../interactive/snapping/SnappingOperation.js";import{setupSnappingToggleHandles as G}from"../interactive/snapping/snappingUtils.js";const k="crosshair",Z="progress",L=Symbol(),U=Symbol();let A=class extends e{constructor(t){super(t),this._createOperationCompleted=!1,this._hideDefaultCursor=!1,this._pointerDownStates=new a,this._stagedScreenPoint=null,this._stagedPointerType=null,this._updatingHandles=new g,this._stagedPointerId=null,this.constraintsEnabled=!1,this.constraints=void 0,this._getPointConstraint=s(w),this._getPolylineOrPolygonConstraint=s(O),this.constraintZ=null,this.defaultZ=null,this.isDraped=!0,this.labelOptions=new E,this.cursor=null,this.loading=!1,this.snapToSceneEnabled=null,this.firstVertex=null,this.lastVertex=null,this.secondToLastVertex=null,null==t.elevationInfo&&(this.elevationInfo=_(!!t.hasZ))}initializePointer(){const t=this.view.inputManager?.latestPointerInfo;null!=t&&this._updatePointer(t.location,t.id,t.type)}initialize(){const{geometryType:t,view:e}=this,i=e.spatialReference,r="viewingMode"in e.state?e.state.viewingMode:2,s="segment"===t||"multipoint"===t?"polyline":t;this.coordinateHelper=x(this.hasZ,this.hasM,i),this._editGeometryOperations=new C(new T(s,this.coordinateHelper),r),this._snappingOperation=new j({view:e}),this.addHandles([p(()=>({stagedPoint:this._snappingOperation.stagedPoint,constraint:this._constraint}),({stagedPoint:t,constraint:e},i)=>{const{snappingOptions:n}=this;n&&(n.forceDisabled=null!=e&&V(e));if(null!=i&&t===i.stagedPoint&&e!==i.constraint)return this._onKeyboardBasedChange();this._processCursor(t??this._screenToMap(this._stagedScreenPoint))},{equals:(t,e)=>t.stagedPoint===e.stagedPoint&&n(t.constraint,e.constraint)}),p(()=>this.view.viewpoint,(t,e)=>{t&&e&&u(t,e)&&this._onKeyboardBasedChange()})]),this._activePart=new S(i,r),this._editGeometryOperations.data.parts.push(this._activePart);const a=this.segmentLabels;null!=a&&(a.context={view:e,editGeometryOperations:this._editGeometryOperations,elevationInfo:this.elevationInfo,labelOptions:this.labelOptions,automaticLengthMeasurementUtils:this.automaticLengthMeasurementUtils},this.addHandles(p(()=>this.labelOptions.enabled,t=>{a.visible=t},c))),this.addHandles(this._editGeometryOperations.on(["vertex-add","vertex-update","vertex-remove"],t=>{const e=t.vertices.map(t=>({componentIndex:0,vertexIndex:t.index,coordinates:this.coordinateHelper.vectorToArray(t.pos)})),i=e.map(t=>t.coordinates),n=this.coordinateHelper.vectorToDehydratedPoint(this._activePart.getFirstVertex()?.pos)??null;m(n,this.firstVertex)||(this.firstVertex=n);const r=this.coordinateHelper.vectorToDehydratedPoint(this._activePart.getLastVertex()?.pos)??null;m(r,this.lastVertex)||(this.lastVertex=r);const s=this.coordinateHelper.vectorToDehydratedPoint(this._activePart.segments.at(-1)?.leftVertex?.pos)??null;switch(m(s,this.secondToLastVertex)||(this.secondToLastVertex=s),this._processCursor(this.cursorVertex),t.type){case"vertex-add":this.emit(t.type,{...t,added:i,vertices:e});break;case"vertex-update":this.emit(t.type,{...t,updated:i,vertices:e});break;case"vertex-remove":this.emit(t.type,{...t,removed:i,vertices:e})}}));const l=this._manipulator=new f({consumesClicks:!1,grabbableForEvent:t=>"click"!==this.drawingMode||"touch"===t.pointerType&&this._snappingEnabled&&1===this._pointerDownStates.size});this.manipulators.add(l),l.grabbable="point"!==t&&"multipoint"!==t,this.addHandles([l.events.on("immediate-click",t=>this._onImmediateClick(t)),l.events.on("immediate-double-click",t=>this._onImmediateDoubleClick(t)),p(()=>this.drawingMode,()=>{this.removeHandles(L),this.addHandles(this._createManipulatorDragPipeline(l),L)},c),p(()=>({effectiveCursor:this.effectiveCursor}),({effectiveCursor:t})=>{l.cursor=t},c)]),G(this,()=>{const t=this.view.inputManager.latestPointerInfo?.type??"mouse",e=this._getSnappingContext(t);if(null!=this.snappingManager){const t=this._snappingOperation.snapAgainNearPreviousMapPoint(this.snappingManager,e);this._updatingHandles.addPromise(o(t))}})}destroy(){r(this.segmentLabels),r(this._snappingOperation),this._editGeometryOperations=r(this._editGeometryOperations),this._updatingHandles.destroy()}get _isDragging(){const{_stagedPointerId:t,_manipulator:e}=this;return null!=t&&this._pointerDownStates.has(t)||e.grabbing||!e.interactive}get _snappingEnabled(){return null!=this.snappingManager&&this.snappingManager.options.effectiveEnabled}get _requiresScenePoint(){const t=this._updateAndGetEffectiveDrawSurface();return"3d"===this.view.type&&this.drawSurface!==t}get canRedo(){return this._editGeometryOperations.canRedo}get canUndo(){return this._editGeometryOperations.canUndo}get committedVertices(){return this._activePart.vertices.map(t=>this.coordinateHelper.vectorToArray(t.pos))}get _constraint(){const{constraints:t,constraintsEnabled:e}=this;if(t&&e)switch(this.geometryType){case"point":case"multipoint":return this._getPointConstraint(t);case"polygon":case"polyline":return this._getPolylineOrPolygonConstraint(this.lastVertex,this.secondToLastVertex,t)}}set drawingMode(t){this._set("drawingMode",t??v)}get effectiveCursor(){return this.loading?Z:this._hideDefaultCursor?null:this.cursor||k}get interactive(){return this._manipulator.interactive}set interactive(t){this._manipulator.interactive=t}get isCompleted(){return this._createOperationCompleted}get numCommittedVertices(){return this._activePart.vertices.length}get snappingOptions(){return null!=this.snappingManager?this.snappingManager.options:null}get cursorVertex(){return this._get("cursorVertex")}get visualizationCursorVertex(){return"mouse"===this._stagedPointerType?this.cursorVertex:null}get committableVertex(){const{cursorVertex:t,lastVertex:e,firstVertex:i,geometryType:n}=this;return"polygon"===n&&y(t,i)||y(t,e)?null:t}get updating(){return this._updatingHandles.updating}get geometryIncludingUncommittedVertices(){const{committedVertices:t,committableVertex:e,coordinateHelper:i}=this,n=t.slice();return null!=e&&n.push(i.pointToArray(e)),n}cancel(){this.complete({aborted:!0})}commitStagedVertex(){this._snappingOperation.abort();const{committableVertex:t}=this;null!=t&&this._editGeometryOperations.appendVertex(this.coordinateHelper.pointToVector(t),this._activePart)}complete(t){const e=t?.aborted||!1;this._snappingOperation.abort(),this.snappingManager?.doneSnapping();const{geometryType:i,numCommittedVertices:n}=this,r="multipoint"===i&&0===n||"polyline"===i&&n<2||"polygon"===i&&n<3;"segment"!==i&&"point"!==i||this.commitStagedVertex(),this._createOperationCompleted=!r,(this.isCompleted||e)&&(this._stagedScreenPoint=null,this._stagedPointerId=null,this._stagedPointerType=null,this._processCursor(null),this.emit("complete",{vertices:this.committedVertices.map((t,e)=>({componentIndex:0,vertexIndex:e,coordinates:t})),aborted:e,type:"complete"}))}onInputEvent(t){switch(t.type){case"pointer-down":this._pointerDownStates.add(t.pointerId);break;case"pointer-up":this._pointerDownStates.delete(t.pointerId)}switch(t.type){case"pointer-move":return this._onPointerMove(t);case"hold":return this._onHold(t)}}redo(){this._editGeometryOperations.redo()}undo(){null!=this.snappingManager&&this.snappingManager.doneSnapping(),this._editGeometryOperations.undo()}_processCursor(t){const e=i(this.cursorVertex),n=i(t),r=n&&(this._updateAndGetEffectiveDrawSurface()?.constrainZ(n)??n),s=this._snapToClosingVertex(r),o=this._applyConstraints(s);y(e,o)||(this._set("cursorVertex",o),this.segmentLabels?.set("stagedVertex",null!=o?this.coordinateHelper.pointToVector(o):null),null==o||"mouse"!==this._stagedPointerType?this.emit("cursor-remove"):this.emit("cursor-update",{updated:null,vertices:[{componentIndex:0,vertexIndex:this._activePart.vertices.length,coordinates:this.coordinateHelper.pointToArray(o)}],operation:"apply",type:"vertex-update"}))}_snapToClosingVertex(t){if(null==t||this._isDragging||"polygon"!==this.geometryType||this.numCommittedVertices<=2)return t;const e=this._mapToScreen(t);if(!e)return t;const i=this._activePart;return this._vertexWithinPointerDistance(i.vertices[0].pos,e)?this.firstVertex:this._vertexWithinPointerDistance(i.vertices.at(-1).pos,e)?this.lastVertex:t}_createManipulatorDragPipeline(t){switch(this.drawingMode){case"click":return this._createManipulatorDragPipelineClick(t);case"freehand":return this._createManipulatorDragPipelineFreehand(t);case"hybrid":return this._createManipulatorDragPipelineHybrid(t)}}_createManipulatorDragPipelineClick(t){return P(t,(t,e,i,n)=>{const r="touch"===n&&this._snappingEnabled;if(this.isCompleted||!r)return;const{snappingStep:s,cancelSnapping:o}=H({predicate:()=>r,snappingManager:this.snappingManager,snappingContext:new I({editGeometryOperations:this._editGeometryOperations,elevationInfo:this.elevationInfo,feature:this.graphic,pointer:n,visualizer:this.snappingVisualizer,drawConstraints:this.constraints}),updatingHandles:this._updatingHandles,useZ:!this._requiresScenePoint});i=i.next(t=>(r&&null!=this.snappingManager&&this.snappingManager.doneSnapping(),t)).next(o),e.next(this._screenToMapDragEventStep()).next(t=>("start"===t.action&&(this._processCursor(t.mapStart),("segment"===this.geometryType||r&&!this.numCommittedVertices)&&this.commitStagedVertex()),t)).next(b(this.view,this.elevationInfo)).next(...s).next(t=>(r&&(this._processCursor(t.mapEnd),"end"===t.action&&this.commitStagedVertex()),t)).next(t=>("end"===t.action&&("mouse"!==this._stagedPointerType&&this._snappingOperation.abort(),"segment"!==this.geometryType&&"point"!==this.geometryType||this.complete()),t))})}_createManipulatorDragPipelineFreehand(t){return P(t,(t,e)=>{this.isCompleted||e.next(this._screenToMapDragEventStep()).next(t=>("start"===t.action&&(this._snappingOperation.abort(),null==this.committableVertex&&this._processCursor(t.mapStart),"segment"===this.geometryType&&this.commitStagedVertex()),t)).next(t=>{switch(t.action){case"start":case"update":this._processCursor(t.mapEnd),"polygon"!==this.geometryType&&"polyline"!==this.geometryType||this.commitStagedVertex();break;case"end":this.complete()}return t})})}_createManipulatorDragPipelineHybrid(t){return P(t,(t,e)=>{this.isCompleted||e.next(this._screenToMapDragEventStep()).next(t=>("start"===t.action&&(this._snappingOperation.abort(),this.addHandles(this._editGeometryOperations.createUndoGroup(),U),this._processCursor(t.mapStart),this.commitStagedVertex()),t)).next(t=>{switch(t.action){case"start":case"update":this._processCursor(t.mapEnd),"polygon"!==this.geometryType&&"polyline"!==this.geometryType||this.commitStagedVertex();break;case"end":"mouse"!==this._stagedPointerType&&this._snappingOperation.abort(),this.removeHandles(U),"segment"!==this.geometryType&&"point"!==this.geometryType||this.complete()}return t})})}get _drawAtFixedElevation(){const{constraintsEnabled:t,constraintZ:e,geometryType:i,numCommittedVertices:n}=this;return t?null!=e||"segment"===i&&n>0:("segment"===i||"polygon"===i)&&n>0}_updateAndGetEffectiveDrawSurface(){const{constraintsEnabled:t,coordinateHelper:e,drawSurface:i,elevationDrawSurface:n,snapToSceneEnabled:r}=this;if(null==n)return i;if(!this.hasZ)return n.defaultZ=null,n;const s=this.elevationInfo?.mode;let o=this.defaultZ,a=t||"absolute-height"===s;if(null!=r&&(a=r),"on-the-ground"===s&&(a=!1),this._drawAtFixedElevation){o=(t?this.constraintZ:null)??e.getZ(this._activePart.vertices[0].pos),a=!1}return a?i:(n.defaultZ=o,n)}_mapToScreen(t){return this._updateAndGetEffectiveDrawSurface()?.mapToScreen(t)}_onHold(t){this._snappingOperation.abort(),"click"===this.drawingMode&&"touch"===t.pointerType&&this._snappingEnabled&&this._processCursor(t.mapPoint),t.stopPropagation()}_onImmediateClick(t){if(!("mouse"===t.pointerType&&2===t.button||this._manipulator.dragging))try{const{drawingMode:e,geometryType:i}=this;this._stagedPointerType=t.pointerType,this._stagedScreenPoint=t.screenPoint;const n=this._screenToMap(t.screenPoint);if(null==n)return;if(null==n||"freehand"===e&&"point"!==i&&"multipoint"!==i)return;if(this._snappingEnabled&&null!=this.cursorVertex||this._processCursor(n),null==this.committableVertex)return void this.complete();this.commitStagedVertex(),"mouse"!==t.pointerType&&this._processCursor(null),("freehand"===e&&"multipoint"!==this.geometryType||"point"===i||"segment"===i&&2===this.numCommittedVertices||"segment"===i&&"hybrid"===e&&1===this.numCommittedVertices)&&this.complete()}finally{t.stopPropagation()}}_onImmediateDoubleClick(t){this._manipulator.dragging||"point"===this.geometryType||(this.complete(),t.stopPropagation())}_onPointerMove(t){const e=l(t.x,t.y);this._updatePointer(e,t.pointerId,t.pointerType)&&t.stopPropagation()}_updatePointer(t,e,i){return this._stagedScreenPoint=t,this._stagedPointerType=i,this._stagedPointerId=e,this._isDragging?(this._snappingOperation.abort(),!1):(this._processCursorMovementRelativeToSurface(t,i),!0)}_onKeyboardBasedChange(){"mouse"===this._stagedPointerType&&this._stagedScreenPoint&&null!=this._stagedPointerId&&!this._isDragging?this._processCursorMovementRelativeToSurface(this._stagedScreenPoint,this._stagedPointerType):this._snappingOperation.abort()}_processCursorMovementRelativeToSurface(t,e){const i=this._snappingOperation,n=this._screenToMap(t),r=this._requiresScenePoint?this.drawSurface?.screenToMap(t):null;if(null==n)return this._hideDefaultCursor=!0,this._processCursor(null),void i.abort();this._hideDefaultCursor=!1;const s=this.snappingManager;if(null==s)return this._processCursor(n),void i.abort();const a=this._getSnappingContext(e);this._updatingHandles.addPromise(o(i.snap({point:n,scenePoint:r},s,a)))}_applyConstraints(t){const{_constraint:e,constraints:i}=this;if(!t||!i||!e)return t;const{context:n}=i,r=M(t,n),s=r?e.closestTo(r):void 0;if(!s)return t;const o=D(s,t,n),a="2d"===this.view.type||"absolute-height"!==n.elevationInfo.mode;return null!=o&&a&&null!=this.constraintZ&&this.hasZ&&(o.z=this.constraintZ),o}_screenToMap(t){return t?this._updateAndGetEffectiveDrawSurface()?.screenToMap(t):null}_screenToMapDragEventStep(){let t=null;return e=>{if("start"===e.action&&(t=this._screenToMap(e.screenStart)),null==t)return null;const i=this._screenToMap(e.screenEnd);return null!=i?{...e,mapStart:t,mapEnd:i}:null}}_vertexWithinPointerDistance(t,e){const i=25,n=this._mapToScreen(this.coordinateHelper.vectorToDehydratedPoint(t));return null!=n&&z(n,e,i)}_getSnappingContext(t){const e=this._drawAtFixedElevation?this.elevationDrawSurface?.defaultZ:null;return new I({editGeometryOperations:this._editGeometryOperations,elevationInfo:this.elevationInfo,pointer:t,feature:this.graphic,visualizer:this.snappingVisualizer,selfSnappingZ:null!=e?{value:e,elevationInfo:this.elevationInfo}:null,drawConstraints:this.constraints})}};function z(t,e,i){const n=t.x-e.x,r=t.y-e.y;return n*n+r*r<=i}t([d()],A.prototype,"_hideDefaultCursor",void 0),t([d()],A.prototype,"_stagedPointerId",void 0),t([d()],A.prototype,"_isDragging",null),t([d()],A.prototype,"_snappingOperation",void 0),t([d()],A.prototype,"_snappingEnabled",null),t([d({constructOnly:!0})],A.prototype,"graphic",void 0),t([d()],A.prototype,"constraintsEnabled",void 0),t([d()],A.prototype,"constraints",void 0),t([d()],A.prototype,"_constraint",null),t([d()],A.prototype,"constraintZ",void 0),t([d()],A.prototype,"defaultZ",void 0),t([d()],A.prototype,"isDraped",void 0),t([d({constructOnly:!0})],A.prototype,"automaticLengthMeasurementUtils",void 0),t([d({value:v})],A.prototype,"drawingMode",null),t([d({constructOnly:!0})],A.prototype,"elevationDrawSurface",void 0),t([d({constructOnly:!0})],A.prototype,"elevationInfo",void 0),t([d({constructOnly:!0,type:E})],A.prototype,"labelOptions",void 0),t([d({constructOnly:!0})],A.prototype,"geometryType",void 0),t([d({constructOnly:!0})],A.prototype,"hasM",void 0),t([d({constructOnly:!0})],A.prototype,"hasZ",void 0),t([d()],A.prototype,"cursor",void 0),t([d()],A.prototype,"effectiveCursor",null),t([d()],A.prototype,"loading",void 0),t([d({constructOnly:!0})],A.prototype,"manipulators",void 0),t([d({constructOnly:!0})],A.prototype,"drawSurface",void 0),t([d({constructOnly:!0})],A.prototype,"segmentLabels",void 0),t([d({constructOnly:!0})],A.prototype,"snappingManager",void 0),t([d({constructOnly:!0})],A.prototype,"snappingVisualizer",void 0),t([d()],A.prototype,"snapToSceneEnabled",void 0),t([d({readOnly:!0})],A.prototype,"cursorVertex",null),t([d({readOnly:!0})],A.prototype,"visualizationCursorVertex",null),t([d()],A.prototype,"committableVertex",null),t([d()],A.prototype,"firstVertex",void 0),t([d()],A.prototype,"lastVertex",void 0),t([d()],A.prototype,"secondToLastVertex",void 0),t([d()],A.prototype,"updating",null),t([d({constructOnly:!0})],A.prototype,"view",void 0),A=t([h("esri.views.draw.DrawOperation")],A);export{A as DrawOperation,k as defaultCursor,Z as defaultLoadingCursor};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{valueInUnit as e,zeroSquareMeters as t,zeroMeters as o,createLength as n,zeroDegreesGeographic as i}from"../../../core/quantityUtils.js";import{getMetersPerVerticalUnitForSR as r}from"../../../core/unitUtils.js";import{ensureType as a}from"../../../core/accessorSupport/ensureType.js";import c from"../../../geometry/Point.js";import{absoluteHeightElevationInfo as l,getConvertedElevationFromXYZ as s}from"../../../support/elevationInfoUtils.js";import{getDrawHelpMessage as p}from"./helpMessageUtils.js";import{getDrawMeshHelpMessage as u}from"./helpMessageUtils3d.js";import{getConstraintContext as m}from"../../interactive/sketch/constraintUtils.js";import{updateTooltipInfoFromMeshTransform as d}from"../../interactive/tooltip/tooltipCommonUtils.js";import{DrawCircleTooltipInfo as f}from"../../interactive/tooltip/infos/DrawCircleTooltipInfo.js";import{DrawMeshTooltipInfo as y}from"../../interactive/tooltip/infos/DrawMeshTooltipInfo.js";import{DrawMultipointTooltipInfo as g}from"../../interactive/tooltip/infos/DrawMultipointTooltipInfo.js";import{DrawPointTooltipInfo as w}from"../../interactive/tooltip/infos/DrawPointTooltipInfo.js";import{DrawPolygonTooltipInfo as h}from"../../interactive/tooltip/infos/DrawPolygonTooltipInfo.js";import{DrawPolylineTooltipInfo as v}from"../../interactive/tooltip/infos/DrawPolylineTooltipInfo.js";import{DrawRectangleTooltipInfo as O}from"../../interactive/tooltip/infos/DrawRectangleTooltipInfo.js";import{directionForVertices as k}from"../../support/angularMeasurementUtils.js";import{elevationFromZ as M,elevationFromPoint as x}from"../../support/euclideanLengthMeasurementUtils.js";function D(e,t){return{point:new w({sketchOptions:t,viewType:e}),multipoint:new g({sketchOptions:t,viewType:e}),polyline:new v({sketchOptions:t,viewType:e}),polygon:new h({sketchOptions:t,viewType:e}),mesh:new y({sketchOptions:t,viewType:e}),rectangle:new O({sketchOptions:t}),circle:new f({sketchOptions:t})}}function T(e){const{directionOptions:t,geometryType:o,sketchOptions:n,tooltipInfos:i}=e,r=t=>{const o=N(e).mode,n=i[t].elevation;"relative-to-ground"===o||"relative-to-scene"===o||"on-the-ground"===o?n.lock(W(e)):n.unlock()},a=e=>{if(t){const o=i[e].direction;o.committed=t.angle,o.unlockOnVertexPlacement=!1,n.values.directionMode=t.mode}};switch(o){case"polygon":case"polyline":r(o),a(o);break;case"point":case"mesh":r(o)}}function j(e,t){const{drawOperation:o,view:n}=t,i=b(t),r=N(t);if("2d"===n.type||!e||"absolute-height"!==r.mode||1!==o?.numCommittedVertices||!i||"draw-polyline"!==i.type&&"draw-polygon"!==i.type||i.elevation.locked)return;const[a,c,l]=e,s=K(a,c,l,r,t);null!=s&&i.elevation.lock(s)}function U(e){b(e)?.allFields.forEach(e=>{e.unlockOnVertexPlacement&&e.unlock()})}function b({geometryType:e,graphic:t,tooltipInfos:o}){return t?.geometry?.type!==P[e]?"circle"===e||"rectangle"===e?o[e]:null:o[e]}const P={point:"point",multipoint:"multipoint",mesh:"mesh",polyline:"polyline",polygon:"polygon",circle:"polygon",rectangle:"polygon",freehandPolygon:"polygon",freehandPolyline:"polyline",text:"point"};function I(e,t){switch(e?.type){case"draw-point":L(e,t);break;case"draw-multipoint":V(e,t);break;case"draw-polyline":z(e,t);break;case"draw-polygon":A(e,t);break;case"draw-rectangle":F(e,t);break;case"draw-circle":H(e,t);break;case"draw-mesh":G(e,t)}}function L(e,t){const o=t.graphic?.geometry;"point"===o?.type&&(S(e,o,t),e.helpMessage=p("point",o,t.drawOperation.drawingMode))}function V(e,t){const o=t.graphic?.geometry;"multipoint"===o?.type&&(S(e,o,t),e.helpMessage=p("multipoint",o,t.drawOperation.drawingMode))}function G(e,t){const{graphic:o,view:n}=t,i=o?.geometry;"3d"!==n.type||i&&"mesh"!==i.type||(S(e,i?.origin,t),i&&d(e,i),e.helpMessage=u(o,n))}function S(e,t,o){const{drawOperation:n,view:i,sketchOptions:r}=o,{cursorVertex:a}=n;e.sketchOptions=r,e.viewType=i.type;const c="multipoint"===t?.type?t.getPoint(t.points.length-1):t;if(e.setLocationFromPoint(c,Q(o)),R(e.elevation,o),!a)return void(n.constraints=void 0);const l=a;n.constraints={context:$(l,o),x:e.x.committed,y:e.y.committed,longitude:e.longitude.committed,latitude:e.latitude.committed,elevation:e.elevation.committed,distance:null,direction:null}}function z(e,t){const{createOperationGeometry:n,drawOperation:i,automaticLengthMeasurementUtils:r}=t,a=null!=n?n.full:null;a&&"polyline"!==a.type||(Z(e,t),e.totalLength.actual=i.lastVertex?(a?r.autoLength2D(a):null)??o:null,e.helpMessage=p("polyline",a,t.drawOperation.drawingMode))}function A(e,o){const{createOperationGeometry:n,drawOperation:i}=o,r=null!=n?n.full:null;r&&"polygon"!==r.type||(Z(e,o),e.area.actual=i.lastVertex?(r?o.automaticAreaMeasurementUtils.autoArea2D(r):null)??t:null,e.helpMessage=p("polygon",r,o.drawOperation.drawingMode))}const B=a(c);function Z(e,t){const{drawOperation:n,sketchOptions:r,view:a,automaticLengthMeasurementUtils:c}=t,{cursorVertex:l,lastVertex:s,secondToLastVertex:p}=n,u=r.values.effectiveDirectionMode;e.sketchOptions=r,e.viewType=a.type;const m=s&&l?c.autoDistanceBetweenPoints2D(B(s),B(l))??o:null;if(e.distance.actual=m,e.distance.readOnly=null==s,e.direction.actual=null,e.direction.readOnly=!0,s&&l&&("absolute"===u||p)){const t=k(p,s,l,u);e.direction.actual=t??i,e.direction.readOnly=!1}e.setLocationFromPoint(l,Q(t)),R(e.elevation,t);const d=C(s,t);e.xyMode=d,e.direction.visible="direction-distance"===d,e.distance.visible="direction-distance"===d,e.effectiveX.visible="coordinates"===d,e.effectiveY.visible="coordinates"===d;const f=l??s;n.constraints=f?{context:$(f,t),x:e.x.committed,y:e.y.committed,longitude:e.longitude.committed,latitude:e.latitude.committed,elevation:e.elevation.committed,distance:e.distance.committed,direction:e.direction.committed}:void 0}function C(e,{sketchOptions:t}){const o=t.tooltips.xyMode;return"auto"===o?e?"direction-distance":"coordinates":o}function F(e,t){e.sketchOptions=t.sketchOptions,e.xSize=E(t),e.ySize=X(t),e.area=q(t),e.helpMessage=p("rectangle",t.graphic?.geometry,t.drawOperation.drawingMode)}function H(e,t){const{forceUniformSize:o,sketchOptions:n}=t;e.sketchOptions=n,e.radius=o?Y(t):null,e.xSize=o?null:E(t),e.ySize=o?null:X(t),e.area=q(t),e.helpMessage=p("circle",t.graphic?.geometry,t.drawOperation.drawingMode)}function R(e,t){const{drawOperation:o}=t,n=o?.cursorVertex??o?.lastVertex;e.actual=x(n)??W(t),e.visible=o.hasZ,e.readOnly=!1,e.showAsZ=!0}function q(e){const o=e.createOperationGeometry?.full;return"polygon"!==o?.type?t:e.automaticAreaMeasurementUtils.autoArea2D(o)??t}function E({createOperationGeometry:e,automaticLengthMeasurementUtils:t}){const n=e?.rectangle?.midpoints;return(null!=n?t.autoDistanceBetweenPoints2D(n.left,n.right):null)??o}function X({createOperationGeometry:e,automaticLengthMeasurementUtils:t}){const n=e?.rectangle?.midpoints;return(null!=n?t.autoDistanceBetweenPoints2D(n.top,n.bottom):null)??o}function Y({createOperationGeometry:e,automaticLengthMeasurementUtils:t}){return(null!=e?.circle?.center&&null!=e.circle.edge?t.autoDistanceBetweenPoints2D(e.circle.center,e.circle.edge):null)??o}function J(t){const{geometryType:o,tooltipInfos:n}=t;switch(o){case"point":case"multipoint":case"mesh":case"polyline":case"polygon":{const i=n[o].elevation.committed;if(!i)return;return e(i,"meters")/r(Q(t))}default:return}}function K(e,t,o,n,i){const{view:r,drawOperation:a}=i;if("3d"!==r.type||!a)return;o??=0;const c=Q(i),l=N(i),p=s(r,e,t,o,c,l,n);return M(p,c)??W(i)}function N(e){return e.drawOperation.elevationInfo??l}function Q(e){return e.drawOperation.coordinateHelper.spatialReference}function W(e){const t=r(Q(e));return n(e.defaultZ*t,"meters")}function $(e,t){return m(e,t.view,Q(t),N(t),t.drawOperation.coordinateHelper.hasZ(),t.sketchOptions.values.effectiveDirectionMode)}export{D as createTooltipInfos,b as getActiveTooltipInfo,J as getConstraintZ,T as initializeConstraints,j as lockElevationOnVertexAdd,U as unlockConstraintsOnVertexAddOrRemove,I as updateTooltipInfo};
5
+ import{valueInUnit as e,zeroSquareMeters as t,zeroMeters as o,createLength as n,zeroDegreesGeographic as i}from"../../../core/quantityUtils.js";import{getMetersPerVerticalUnitForSR as r}from"../../../core/unitUtils.js";import{ensureType as a}from"../../../core/accessorSupport/ensureType.js";import c from"../../../geometry/Point.js";import{absoluteHeightElevationInfo as l,getConvertedElevationFromXYZ as s}from"../../../support/elevationInfoUtils.js";import{getDrawHelpMessage as p}from"./helpMessageUtils.js";import{getDrawMeshHelpMessage as u}from"./helpMessageUtils3d.js";import{getConstraintContext as m}from"../../interactive/sketch/constraintUtils.js";import{updateTooltipInfoFromMeshTransform as d}from"../../interactive/tooltip/tooltipCommonUtils.js";import{DrawCircleTooltipInfo as f}from"../../interactive/tooltip/infos/DrawCircleTooltipInfo.js";import{DrawMeshTooltipInfo as y}from"../../interactive/tooltip/infos/DrawMeshTooltipInfo.js";import{DrawMultipointTooltipInfo as g}from"../../interactive/tooltip/infos/DrawMultipointTooltipInfo.js";import{DrawPointTooltipInfo as h}from"../../interactive/tooltip/infos/DrawPointTooltipInfo.js";import{DrawPolygonTooltipInfo as w}from"../../interactive/tooltip/infos/DrawPolygonTooltipInfo.js";import{DrawPolylineTooltipInfo as v}from"../../interactive/tooltip/infos/DrawPolylineTooltipInfo.js";import{DrawRectangleTooltipInfo as O}from"../../interactive/tooltip/infos/DrawRectangleTooltipInfo.js";import{directionForVertices as k}from"../../support/angularMeasurementUtils.js";import{elevationFromZ as M}from"../../support/euclideanLengthMeasurementUtils.js";function x(e,t){return{point:new h({sketchOptions:t,viewType:e}),multipoint:new g({sketchOptions:t,viewType:e}),polyline:new v({sketchOptions:t,viewType:e}),polygon:new w({sketchOptions:t,viewType:e}),mesh:new y({sketchOptions:t,viewType:e}),rectangle:new O({sketchOptions:t}),circle:new f({sketchOptions:t})}}function D(e){const{directionOptions:t,geometryType:o,sketchOptions:n,tooltipInfos:i}=e,r=t=>{const o=J(e).mode,n=i[t].elevation;"relative-to-ground"===o||"relative-to-scene"===o||"on-the-ground"===o?n.lock(N(e)):n.unlock()},a=e=>{if(t){const o=i[e].direction;o.committed=t.angle,o.unlockOnVertexPlacement=!1,n.values.directionMode=t.mode}};switch(o){case"polygon":case"polyline":r(o),a(o);break;case"point":case"mesh":r(o)}}function T(e,t){const{drawOperation:o,view:n}=t,i=U(t),r=J(t);if("2d"===n.type||!e||"absolute-height"!==r.mode||1!==o?.numCommittedVertices||!i||"draw-polyline"!==i.type&&"draw-polygon"!==i.type||i.elevation.locked)return;const[a,c,l]=e,s=Y(a,c,l,r,t);null!=s&&i.elevation.lock(s)}function j(e){U(e)?.allFields.forEach(e=>{e.unlockOnVertexPlacement&&e.unlock()})}function U({geometryType:e,graphic:t,tooltipInfos:o}){return t?.geometry?.type!==P[e]?"circle"===e||"rectangle"===e?o[e]:null:o[e]}const P={point:"point",multipoint:"multipoint",mesh:"mesh",polyline:"polyline",polygon:"polygon",circle:"polygon",rectangle:"polygon",freehandPolygon:"polygon",freehandPolyline:"polyline",text:"point"};function b(e,t){switch(e?.type){case"draw-point":I(e,t);break;case"draw-multipoint":L(e,t);break;case"draw-polyline":S(e,t);break;case"draw-polygon":Z(e,t);break;case"draw-rectangle":B(e,t);break;case"draw-circle":C(e,t);break;case"draw-mesh":V(e,t)}}function I(e,t){const o=t.graphic?.geometry;"point"===o?.type&&(G(e,t),e.helpMessage=p("point",o,t.drawOperation.drawingMode))}function L(e,t){const o=t.graphic?.geometry;"multipoint"===o?.type&&(G(e,t),e.helpMessage=p("multipoint",o,t.drawOperation.drawingMode))}function V(e,t){const{graphic:o,view:n}=t,i=o?.geometry;"3d"!==n.type||i&&"mesh"!==i.type||(G(e,t),i&&d(e,i),e.helpMessage=u(o,n))}function G(e,t){const{drawOperation:o,view:n,sketchOptions:i}=t,{cursorVertex:r,hasZ:a}=o;e.sketchOptions=i,e.viewType=n.type,e.setLocationFromPoint(r,K(t)),e.setElevationFromPoint(r,{hasZ:a}),o.constraints=r?{context:Q(r,t),x:e.x.committed,y:e.y.committed,longitude:e.longitude.committed,latitude:e.latitude.committed,elevation:e.elevation.committed,distance:null,direction:null}:void 0}function S(e,t){const{createOperationGeometry:n,drawOperation:i,automaticLengthMeasurementUtils:r}=t,a=null!=n?n.full:null;a&&"polyline"!==a.type||(F(e,t),e.totalLength.actual=i.lastVertex?(a?r.autoLength2D(a):null)??o:null,e.helpMessage=p("polyline",a,t.drawOperation.drawingMode))}function Z(e,o){const{createOperationGeometry:n,drawOperation:i}=o,r=null!=n?n.full:null;r&&"polygon"!==r.type||(F(e,o),e.area.actual=i.lastVertex?(r?o.automaticAreaMeasurementUtils.autoArea2D(r):null)??t:null,e.helpMessage=p("polygon",r,o.drawOperation.drawingMode))}const z=a(c);function F(e,t){const{drawOperation:n,sketchOptions:r,view:a,automaticLengthMeasurementUtils:c}=t,{cursorVertex:l,lastVertex:s,secondToLastVertex:p,hasZ:u}=n,m=r.values.effectiveDirectionMode;e.sketchOptions=r,e.viewType=a.type;const d=s&&l?c.autoDistanceBetweenPoints2D(z(s),z(l))??o:null;e.distance.actual=d,e.distance.readOnly=null==s;const f=null!==s&&("absolute"===m||p);if(e.direction.actual=null,e.direction.readOnly=!f,f&&l){const t=k(p,s,l,m);e.direction.actual=t??i}e.setLocationFromPoint(l,K(t)),e.setElevationFromPoint(l,{hasZ:u});const y=A(s,t);e.xyMode=y,e.direction.visible="direction-distance"===y,e.distance.visible="direction-distance"===y,e.effectiveX.visible="coordinates"===y,e.effectiveY.visible="coordinates"===y;const g=l??s;n.constraints=g?{context:Q(g,t),x:e.x.committed,y:e.y.committed,longitude:e.longitude.committed,latitude:e.latitude.committed,elevation:e.elevation.committed,distance:e.distance.committed,direction:e.direction.committed}:void 0}function A(e,{sketchOptions:t}){const o=t.tooltips.xyMode;return"auto"===o?e?"direction-distance":"coordinates":o}function B(e,t){e.sketchOptions=t.sketchOptions,e.xSize=H(t),e.ySize=R(t),e.area=E(t),e.helpMessage=p("rectangle",t.graphic?.geometry,t.drawOperation.drawingMode)}function C(e,t){const{forceUniformSize:o,sketchOptions:n}=t;e.sketchOptions=n,e.radius=o?q(t):null,e.xSize=o?null:H(t),e.ySize=o?null:R(t),e.area=E(t),e.helpMessage=p("circle",t.graphic?.geometry,t.drawOperation.drawingMode)}function E(e){const o=e.createOperationGeometry?.full;return"polygon"!==o?.type?t:e.automaticAreaMeasurementUtils.autoArea2D(o)??t}function H({createOperationGeometry:e,automaticLengthMeasurementUtils:t}){const n=e?.rectangle?.midpoints;return(null!=n?t.autoDistanceBetweenPoints2D(n.left,n.right):null)??o}function R({createOperationGeometry:e,automaticLengthMeasurementUtils:t}){const n=e?.rectangle?.midpoints;return(null!=n?t.autoDistanceBetweenPoints2D(n.top,n.bottom):null)??o}function q({createOperationGeometry:e,automaticLengthMeasurementUtils:t}){return(null!=e?.circle?.center&&null!=e.circle.edge?t.autoDistanceBetweenPoints2D(e.circle.center,e.circle.edge):null)??o}function X(t){const{geometryType:o,tooltipInfos:n}=t;switch(o){case"point":case"multipoint":case"mesh":case"polyline":case"polygon":{const i=n[o].elevation.committed;if(!i)return;return e(i,"meters")/r(K(t))}default:return}}function Y(e,t,o,n,i){const{view:r,drawOperation:a}=i;if("3d"!==r.type||!a)return;o??=0;const c=K(i),l=J(i),p=s(r,e,t,o,c,l,n);return M(p,c)??N(i)}function J(e){return e.drawOperation.elevationInfo??l}function K(e){return e.drawOperation.coordinateHelper.spatialReference}function N(e){const t=r(K(e));return n(e.defaultZ*t,"meters")}function Q(e,t){return m(e,t.view,K(t),J(t),t.drawOperation.coordinateHelper.hasZ(),t.sketchOptions.values.effectiveDirectionMode)}export{x as createTooltipInfos,U as getActiveTooltipInfo,X as getConstraintZ,D as initializeConstraints,T as lockElevationOnVertexAdd,j as unlockConstraintsOnVertexAddOrRemove,b as updateTooltipInfo};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as t}from"tslib";import{watch as e}from"../../../../core/reactiveUtils.js";import{waitAnimationFrame as i}from"../../../../core/scheduling.js";import{property as o}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/Logger.js";import"../../../../core/RandomLCG.js";import{subclass as n}from"../../../../core/accessorSupport/decorators/subclass.js";import{tooltipKeys as s}from"../../keybindings.js";import{base as l}from"../css.js";import r from"../../../../widgets/Widget.js";import{loadCalciteComponents as a}from"../../../../widgets/support/componentsUtils.js";import"../../../../widgets/support/widgetUtils.js";import{tsx as c,tsxFragment as u}from"../../../../widgets/support/jsxFactory.js";import"@arcgis/toolkit/dom";const p=`${l}-editable-field`,d={base:p,inputMode:`${p}--input`,feedbackMode:`${p}--feedback`,readOnly:`${p}--read-only`,locked:`${p}--locked`,title:`${p}__title`,value:`${p}__value`,valueContent:`${p}__value__content`,valueContentReadOnly:`${p}__value__content--read-only`,lockIcon:`${p}__lock-icon`,input:`${p}__input`,inputWrapper:`${p}__input-wrapper`,inputMessage:`${p}__input-message`,inputSuffix:`${p}__input-suffix`,button:`${p}__button`},h={lock:"lock",unlock:"unlock"};let _=class extends r{constructor(){super(...arguments),this._input=null,this._lock=null,this._onLockClick=()=>{this.field.toggleLock(this.context)},this._onLockAfterCreate=t=>{this._lock=t},this._onLockAfterRemoved=()=>{this._lock=null},this._onKeyDown=t=>{t.key===s.discard&&"input"===this.mode&&this._input&&this.context.onDiscard(this._input)},this._onInputKeyDown=t=>{const e=this._input;if(e)switch(t.key){case s.commit:return this.field.onCommit("commit-and-exit",e,this.context);case s.next:{t.preventDefault(),t.stopPropagation();const i=t.shiftKey?"commit-and-previous":"commit-and-next";return this.field.onCommit(i,e,this.context)}}},this._onInput=t=>{this.field.onInput(t.currentTarget.value)},this._onInputBlur=t=>{const e=this._input;e&&t.relatedTarget!==this._lock&&this.field.onCommit("commit-on-blur",e,this.context)},this._selectText=()=>{const t=()=>{this._input===document.activeElement&&this._input?.selectText()};t(),i().then(t)},this._onAfterCreate=t=>{this._input=t,t.addEventListener("paste",this._onPaste),t.addEventListener("beforeinput",this._onBeforeInput)},this._onAfterRemoved=t=>{t.removeEventListener("paste",this._onPaste),t.removeEventListener("beforeinput",this._onBeforeInput)},this._onPaste=t=>{const e=t.clipboardData?.getData("text");if(!e)return;null!=this.field.parse(e,this.context)&&(t.stopPropagation(),this.field.onInput(e))},this._onBeforeInput=t=>{("historyUndo"===t.inputType||"historyRedo"===t.inputType)&&!this.field.dirty&&t.preventDefault()}}initialize(){this.addHandles(e(()=>this._rawDisplayValue,()=>{const{committed:t,inputValue:e}=this.field;t||e||this._input!==document.activeElement||this._selectText()}))}loadDependencies(){return a({button:()=>import("@esri/calcite-components/dist/components/calcite-button"),icon:()=>import("@esri/calcite-components/dist/components/calcite-icon"),input:()=>import("@esri/calcite-components/dist/components/calcite-input"),"input-message":()=>import("@esri/calcite-components/dist/components/calcite-input-message")})}render(){const{field:t,mode:e}=this,i="input"===e,{locked:o,readOnly:n}=t;return c("div",{class:this.classes({[d.base]:!0,[d.feedbackMode]:"feedback"===e,[d.inputMode]:"input"===e,[d.locked]:o,[d.readOnly]:n})},c("div",{class:d.title,key:"title"},this._title),c("div",{class:d.value,key:"value",onkeydown:this._onKeyDown},i?this._renderValueInputMode():this._renderValueFeedbackMode()))}get _formattedValue(){return this.field.getFormattedValue(this.context)||m}get _rawDisplayValue(){return this.field.getRawDisplayValue(this.context)}get _suffix(){return this.field.getSuffix(this.context)}get _title(){const{title:t}=this.field;return"string"==typeof t?t:t(this.context)}get _messages(){return this.context?.messages.sketch??{}}_renderValueFeedbackMode(){return c(u,null,c("div",{class:d.valueContent,key:"value-feedback"},this._formattedValue),this.field.locked&&"input"!==this.mode?c("calcite-icon",{class:d.lockIcon,icon:h.lock,key:"icon",scale:"s"}):null)}_renderValueInputMode(){return this.field.readOnly?this._renderValueReadOnly():this._renderValueWritable()}_renderValueReadOnly(){return c("div",{class:this.classes(d.valueContent,d.valueContentReadOnly),key:"value-read-only"},this._formattedValue)}_renderValueWritable(){const{field:t}=this,e=this._messages,{name:i,invalid:o}=t;return c(u,null,c("div",{class:d.inputWrapper,key:"value-input"},c("calcite-input",{afterCreate:this._onAfterCreate,afterRemoved:this._onAfterRemoved,class:d.input,"data-field-name":i,"data-testid":`tooltip-field-${i}`,key:"input",onblur:this._onInputBlur,onfocus:this._selectText,onkeydown:this._onInputKeyDown,scale:"s",status:o?"invalid":"idle",type:"text",value:this._rawDisplayValue??m,onCalciteInputInput:this._onInput}),o?c("calcite-input-message",{class:d.inputMessage,scale:"s",status:"invalid"},e.invalidValue):null),c("div",{class:d.inputSuffix,key:"suffix"},this._suffix),this._renderedLockButton)}get _renderedLockButton(){const{name:t,locked:e,lockable:i}=this.field;if(!i)return c("div",{key:"no-lock-button"});const o=this._messages,n=e?o.unlockConstraint:o.lockConstraint;return c("calcite-button",{afterCreate:this._onLockAfterCreate,afterRemoved:this._onLockAfterRemoved,alignment:"center",appearance:"transparent",class:d.button,"data-testid":`tooltip-field-${t}-lock`,iconStart:e?h.lock:h.unlock,key:"lock-button",kind:"neutral",label:n,onclick:this._onLockClick,scale:"s",tabIndex:-1,title:n})}};t([o()],_.prototype,"field",void 0),t([o()],_.prototype,"context",void 0),t([o()],_.prototype,"mode",void 0),t([o()],_.prototype,"_input",void 0),t([o()],_.prototype,"_lock",void 0),t([o()],_.prototype,"_formattedValue",null),t([o()],_.prototype,"_rawDisplayValue",null),t([o()],_.prototype,"_suffix",null),t([o()],_.prototype,"_title",null),t([o()],_.prototype,"_messages",null),t([o()],_.prototype,"_renderedLockButton",null),_=t([n("esri.views.interactive.tooltip.components.TooltipEditableField")],_);const m="—";export{_ as TooltipEditableField};
5
+ import{__decorate as t}from"tslib";import{watch as e}from"../../../../core/reactiveUtils.js";import{waitAnimationFrame as i}from"../../../../core/scheduling.js";import{property as o}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/Logger.js";import"../../../../core/RandomLCG.js";import{subclass as n}from"../../../../core/accessorSupport/decorators/subclass.js";import{tooltipKeys as s}from"../../keybindings.js";import{base as l}from"../css.js";import r from"../../../../widgets/Widget.js";import{loadCalciteComponents as a}from"../../../../widgets/support/componentsUtils.js";import"../../../../widgets/support/widgetUtils.js";import{tsx as c,tsxFragment as u}from"../../../../widgets/support/jsxFactory.js";import"@arcgis/toolkit/dom";const d=`${l}-editable-field`,p={base:d,inputMode:`${d}--input`,feedbackMode:`${d}--feedback`,readOnly:`${d}--read-only`,locked:`${d}--locked`,title:`${d}__title`,value:`${d}__value`,valueContent:`${d}__value__content`,valueContentReadOnly:`${d}__value__content--read-only`,lockIcon:`${d}__lock-icon`,input:`${d}__input`,inputWrapper:`${d}__input-wrapper`,inputMessage:`${d}__input-message`,inputSuffix:`${d}__input-suffix`,button:`${d}__button`},h={lock:"lock",unlock:"unlock"};let _=class extends r{constructor(){super(...arguments),this._input=null,this._lock=null,this._onLockClick=()=>{this.field.toggleLock(this.context)},this._onLockAfterCreate=t=>{this._lock=t},this._onLockAfterRemoved=()=>{this._lock=null},this._onKeyDown=t=>{t.key===s.discard&&"input"===this.mode&&this._input&&this.context.onDiscard(this._input)},this._onInputKeyDown=t=>{const e=this._input;if(e)switch(t.key){case s.commit:return this.field.onCommit("commit-and-exit",e,this.context);case s.next:{t.preventDefault(),t.stopPropagation();const i=t.shiftKey?"commit-and-previous":"commit-and-next";return this.field.onCommit(i,e,this.context)}}},this._onInput=t=>{this.field.onInput(t.currentTarget.value)},this._onInputBlur=t=>{const e=this._input;e&&t.relatedTarget!==this._lock&&this.field.onCommit("commit-on-blur",e,this.context)},this._selectText=()=>{const t=()=>{this._input===document.activeElement&&this._input?.selectText()};t(),i().then(t)},this._onAfterCreate=t=>{this._input=t,t.addEventListener("paste",this._onPaste),t.addEventListener("beforeinput",this._onBeforeInput)},this._onAfterRemoved=t=>{t.removeEventListener("paste",this._onPaste),t.removeEventListener("beforeinput",this._onBeforeInput)},this._onPaste=t=>{const e=t.clipboardData?.getData("text");if(!e)return;null!=this.field.parse(e,this.context)&&(t.stopPropagation(),this.field.onInput(e))},this._onBeforeInput=t=>{("historyUndo"===t.inputType||"historyRedo"===t.inputType)&&!this.field.dirty&&t.preventDefault()}}initialize(){this.addHandles(e(()=>this._rawDisplayValue,()=>{const{committed:t,inputValue:e}=this.field;t||e||this._input!==document.activeElement||this._selectText()}))}loadDependencies(){return a({button:()=>import("@esri/calcite-components/dist/components/calcite-button"),icon:()=>import("@esri/calcite-components/dist/components/calcite-icon"),input:()=>import("@esri/calcite-components/dist/components/calcite-input"),"input-message":()=>import("@esri/calcite-components/dist/components/calcite-input-message")})}render(){const{field:t,mode:e}=this,i="input"===e,{locked:o,readOnly:n}=t;return c("div",{class:this.classes({[p.base]:!0,[p.feedbackMode]:"feedback"===e,[p.inputMode]:"input"===e,[p.locked]:o,[p.readOnly]:n})},c("div",{class:p.title,key:"title"},this._title),c("div",{class:p.value,key:"value",onkeydown:this._onKeyDown},i?this._renderValueInputMode():this._renderValueFeedbackMode()))}get _formattedValue(){return this.field.getFormattedValue(this.context)||m}get _rawDisplayValue(){return this.field.getRawDisplayValue(this.context)}get _suffix(){return this.field.getSuffix(this.context)}get _title(){const{title:t}=this.field;return"string"==typeof t?t:t(this.context)}get _messages(){return this.context?.messages.sketch??{}}_renderValueFeedbackMode(){return c(u,null,c("div",{class:p.valueContent,key:"value-feedback"},this._formattedValue),this.field.locked&&"input"!==this.mode?c("calcite-icon",{class:p.lockIcon,icon:h.lock,key:"icon",scale:"s"}):null)}_renderValueInputMode(){return this.field.readOnly?this._renderValueReadOnly():this._renderValueWritable()}_renderValueReadOnly(){return c("div",{class:this.classes(p.valueContent,p.valueContentReadOnly),key:"value-read-only"},this._formattedValue)}_renderValueWritable(){const{field:t}=this,e=this._messages,{name:i,invalid:o}=t;return c(u,null,c("div",{class:p.inputWrapper,key:"value-input"},c("calcite-input",{afterCreate:this._onAfterCreate,afterRemoved:this._onAfterRemoved,class:p.input,"data-field-name":i,"data-testid":`tooltip-field-${i}`,key:"input",onblur:this._onInputBlur,onfocus:this._selectText,onkeydown:this._onInputKeyDown,scale:"s",status:o?"invalid":"idle",type:"text",value:this._rawDisplayValue??m,onCalciteInputInput:this._onInput}),o?c("calcite-input-message",{class:p.inputMessage,scale:"s",status:"invalid"},e.invalidValue):null),c("div",{class:p.inputSuffix,key:"suffix"},this._suffix),this._renderedLockButton)}get _renderedLockButton(){const{disabled:t,locked:e,lockable:i,name:o}=this.field;if(!i)return c("div",{key:"no-lock-button"});const n=this._messages,s=e?n.unlockConstraint:n.lockConstraint;return c("calcite-button",{afterCreate:this._onLockAfterCreate,afterRemoved:this._onLockAfterRemoved,alignment:"center",appearance:"transparent",class:p.button,"data-testid":`tooltip-field-${o}-lock`,disabled:t,iconStart:e?h.lock:h.unlock,key:"lock-button",kind:"neutral",label:s,onclick:this._onLockClick,scale:"s",tabIndex:-1,title:s})}};t([o()],_.prototype,"field",void 0),t([o()],_.prototype,"context",void 0),t([o()],_.prototype,"mode",void 0),t([o()],_.prototype,"_input",void 0),t([o()],_.prototype,"_lock",void 0),t([o()],_.prototype,"_formattedValue",null),t([o()],_.prototype,"_rawDisplayValue",null),t([o()],_.prototype,"_suffix",null),t([o()],_.prototype,"_title",null),t([o()],_.prototype,"_messages",null),t([o()],_.prototype,"_renderedLockButton",null),_=t([n("esri.views.interactive.tooltip.components.TooltipEditableField")],_);const m="—";export{_ as TooltipEditableField};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as t}from"tslib";import o from"../../../../core/Accessor.js";import{generateUUID as i}from"../../../../core/uuid.js";import{property as l}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/Logger.js";import"../../../../core/RandomLCG.js";import{subclass as e}from"../../../../core/accessorSupport/decorators/subclass.js";let s=class extends o{constructor(t){super(t),this.actual=null,this.lockable=!0,this.id=i(),this.inputValue=null,this.readOnly=!1,this.suffix=null,this.visible=!0,this.invalid=!1,this.unlockOnVertexPlacement=!0}get committed(){return this.lockable?this._get("committed"):null}set committed(t){this.lockable&&this._set("committed",t)}get dirty(){return null!=this.inputValue}get locked(){return this.lockable&&null!=this.committed}onInput(t){this.inputValue=t,this.invalid=!1}onCommit(t,o,i){this.lockable?this._onCommitLockable(t,i):this._onCommitNonLockable(i),this.invalid&&"commit-and-exit"===t||i.onCommit(o,t)}_onCommitLockable(t,o){const{inputValue:i,locked:l}=this;l&&n(i)?this.unlock():("commit-and-exit"===t&&!l||null!=i)&&this._parseInputAndLock(o)}_onCommitNonLockable(t){const{inputValue:o}=this;n(o)?this.lockable?this.setActual(null):this.clearInputValue():null!=o&&this._parseInputAndSetActual(t)}applyValue(t){this.lockable?this.lock(t):this.setActual(t)}clearInputValue(){this.inputValue=null,this.invalid=!1}setActual(t){this.actual=t,this.clearInputValue()}lock(t){this.lockable&&(this.committed=t??this.actual,this.clearInputValue())}unlock(){this.lockable&&(this.committed=null,this.clearInputValue())}toggleLock(t){this.lockable&&(this.locked?this.unlock():this._parseInputAndLock(t))}getSuffix(t){const{suffix:o}=this;return"function"==typeof o?o(t):o}getFormattedValue(t){const{actual:o,committed:i,format:l}=this;return null!=i?l(i,t):null!=o?l(o,t):null}getRawDisplayValue(t){const{actual:o,committed:i,inputValue:l}=this;return null!=l?l:this.lockable&&null!=i?this.formatForInputMode(i,t):null!=o?this.formatForInputMode(o,t):null}_parseInputAndSetActual(t){const{inputValue:o}=this;if(null==o||n(o))return this.setActual(null);const i=this.parse(o,t);null!=i?this.setActual(i):this.invalid=!0}_parseInputAndLock(t){const{inputValue:o,actual:i}=this;if(n(o))return this.unlock();if(null==o)return this.lock(i);const l=this.parse(o,t);null!=l?this.lock(l):this.invalid=!0}};function n(t){return null!=t&&""===t.trim()}t([l()],s.prototype,"actual",void 0),t([l()],s.prototype,"committed",null),t([l()],s.prototype,"dirty",null),t([l()],s.prototype,"format",void 0),t([l()],s.prototype,"formatForInputMode",void 0),t([l()],s.prototype,"lockable",void 0),t([l()],s.prototype,"locked",null),t([l()],s.prototype,"id",void 0),t([l()],s.prototype,"inputValue",void 0),t([l()],s.prototype,"name",void 0),t([l()],s.prototype,"parse",void 0),t([l()],s.prototype,"readOnly",void 0),t([l()],s.prototype,"suffix",void 0),t([l()],s.prototype,"title",void 0),t([l()],s.prototype,"visible",void 0),t([l()],s.prototype,"invalid",void 0),t([l()],s.prototype,"unlockOnVertexPlacement",void 0),s=t([e("esri.views.interactive.tooltip.fields.TooltipField")],s);export{s as TooltipField};
5
+ import{__decorate as t}from"tslib";import o from"../../../../core/Accessor.js";import{generateUUID as i}from"../../../../core/uuid.js";import{property as l}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/Logger.js";import"../../../../core/RandomLCG.js";import{subclass as e}from"../../../../core/accessorSupport/decorators/subclass.js";let s=class extends o{constructor(t){super(t),this.actual=null,this.lockable=!0,this.id=i(),this.inputValue=null,this.readOnly=!1,this.suffix=null,this.visible=!0,this.invalid=!1,this.unlockOnVertexPlacement=!0}get committed(){return this.lockable?this._get("committed"):null}set committed(t){this.lockable&&this._set("committed",t)}get dirty(){return null!=this.inputValue}get disabled(){return null==this.actual&&!this.dirty&&!this.locked}get locked(){return this.lockable&&null!=this.committed}onInput(t){this.inputValue=t,this.invalid=!1}onCommit(t,o,i){this.lockable?this._onCommitLockable(t,i):this._onCommitNonLockable(i),this.invalid&&"commit-and-exit"===t||i.onCommit(o,t)}_onCommitLockable(t,o){const{inputValue:i,locked:l}=this;l&&n(i)?this.unlock():("commit-and-exit"===t&&!l||null!=i)&&this._parseInputAndLock(o)}_onCommitNonLockable(t){const{inputValue:o}=this;n(o)?this.lockable?this.setActual(null):this.clearInputValue():null!=o&&this._parseInputAndSetActual(t)}applyValue(t){this.lockable?this.lock(t):this.setActual(t)}clearInputValue(){this.inputValue=null,this.invalid=!1}setActual(t){this.actual=t,this.clearInputValue()}lock(t){this.lockable&&(this.committed=t??this.actual,this.clearInputValue())}unlock(){this.lockable&&(this.committed=null,this.clearInputValue())}toggleLock(t){this.lockable&&(this.locked?this.unlock():this._parseInputAndLock(t))}getSuffix(t){const{suffix:o}=this;return"function"==typeof o?o(t):o}getFormattedValue(t){const{actual:o,committed:i,format:l}=this;return null!=i?l(i,t):null!=o?l(o,t):null}getRawDisplayValue(t){const{actual:o,committed:i,inputValue:l}=this;return null!=l?l:this.lockable&&null!=i?this.formatForInputMode(i,t):null!=o?this.formatForInputMode(o,t):null}_parseInputAndSetActual(t){const{inputValue:o}=this;if(null==o||n(o))return this.setActual(null);const i=this.parse(o,t);null!=i?this.setActual(i):this.invalid=!0}_parseInputAndLock(t){const{inputValue:o,actual:i}=this;if(n(o))return this.unlock();if(null==o)return this.lock(i);const l=this.parse(o,t);null!=l?this.lock(l):this.invalid=!0}};function n(t){return null!=t&&""===t.trim()}t([l()],s.prototype,"actual",void 0),t([l()],s.prototype,"committed",null),t([l()],s.prototype,"dirty",null),t([l()],s.prototype,"disabled",null),t([l()],s.prototype,"format",void 0),t([l()],s.prototype,"formatForInputMode",void 0),t([l()],s.prototype,"lockable",void 0),t([l()],s.prototype,"locked",null),t([l()],s.prototype,"id",void 0),t([l()],s.prototype,"inputValue",void 0),t([l()],s.prototype,"name",void 0),t([l()],s.prototype,"parse",void 0),t([l()],s.prototype,"readOnly",void 0),t([l()],s.prototype,"suffix",void 0),t([l()],s.prototype,"title",void 0),t([l()],s.prototype,"visible",void 0),t([l()],s.prototype,"invalid",void 0),t([l()],s.prototype,"unlockOnVertexPlacement",void 0),s=t([e("esri.views.interactive.tooltip.fields.TooltipField")],s);export{s as TooltipField};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as t}from"tslib";import{createScalar as e}from"../../../../core/quantityUtils.js";import{property as i}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/Logger.js";import"../../../../core/RandomLCG.js";import{subclass as o}from"../../../../core/accessorSupport/decorators/subclass.js";import{getLongitudeLatitude as s}from"../../../../geometry/support/pointUtils.js";import{makeLongitudeField as r,makeLatitudeField as a,makeXField as l,makeYField as c,makeElevationField as u}from"../fields/fields.js";import{createGeographicCoordinate as p}from"../fields/parsingAndFormattingUtils.js";import{supportsGeodesicMeasurement as n}from"../../../support/geodesicMeasurementUtils.js";const h=h=>{const f=h;let m=class extends f{constructor(){super(...arguments),this.longitude=r(),this.latitude=a(),this.x=l(),this.y=c(),this.elevation=u(),this.geographic=!1}get effectiveX(){return this.geographic?this.longitude:this.x}get effectiveY(){return this.geographic?this.latitude:this.y}get key(){return{longitude:this.longitude.actual,latitude:this.latitude.actual,x:this.x.actual,y:this.y.actual,elevation:this.elevation.actual,geographic:this.geographic}}setLocationFromPoint(t,i=t?.spatialReference){if(this.geographic=!!i&&n(i),null==t)return this._setActualLonLat(null,null),void this._setActualXY(null,null);if(this.geographic){const e=s(t,g);this._setActualLonLat(p(e?.[0]),p(e?.[1]))}else this._setActualXY(e(t.x),e(t.y))}_setActualLonLat(t,e){this.longitude.actual=t,this.latitude.actual=e}_setActualXY(t,e){this.x.actual=t,this.y.actual=e}};return t([i()],m.prototype,"geographic",void 0),t([i()],m.prototype,"effectiveX",null),t([i()],m.prototype,"effectiveY",null),t([i()],m.prototype,"key",null),m=t([o("esri.views.interactive.tooltip.infos.TooltipInfoWithCoordinates")],m),m},g=[0,0];export{h as TooltipInfoWithCoordinates};
5
+ import{__decorate as t}from"tslib";import{createScalar as e}from"../../../../core/quantityUtils.js";import{property as i}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/Logger.js";import"../../../../core/RandomLCG.js";import{subclass as o}from"../../../../core/accessorSupport/decorators/subclass.js";import{getLongitudeLatitude as s}from"../../../../geometry/support/pointUtils.js";import{makeLongitudeField as r,makeLatitudeField as a,makeXField as l,makeYField as c,makeElevationField as n}from"../fields/fields.js";import{createGeographicCoordinate as u}from"../fields/parsingAndFormattingUtils.js";import{elevationFromPoint as p}from"../../../support/euclideanLengthMeasurementUtils.js";import{supportsGeodesicMeasurement as h}from"../../../support/geodesicMeasurementUtils.js";const g=g=>{const f=g;let d=class extends f{constructor(){super(...arguments),this.longitude=r(),this.latitude=a(),this.x=l(),this.y=c(),this.elevation=n(),this.geographic=!1}get effectiveX(){return this.geographic?this.longitude:this.x}get effectiveY(){return this.geographic?this.latitude:this.y}get key(){return{longitude:this.longitude.actual,latitude:this.latitude.actual,x:this.x.actual,y:this.y.actual,elevation:this.elevation.actual,geographic:this.geographic}}setLocationFromPoint(t,i=t?.spatialReference){if(this.geographic=!!i&&h(i),null==t)return this._setActualLonLat(null,null),void this._setActualXY(null,null);if(this.geographic){const e=s(t,m);this._setActualLonLat(u(e?.[0]),u(e?.[1]))}else this._setActualXY(e(t.x),e(t.y))}setElevationFromPoint(t,e){const{elevation:i}=this;i.actual=p(t),i.visible=e.hasZ,i.readOnly=!1,i.showAsZ=!0}_setActualLonLat(t,e){this.longitude.actual=t,this.latitude.actual=e}_setActualXY(t,e){this.x.actual=t,this.y.actual=e}};return t([i()],d.prototype,"geographic",void 0),t([i()],d.prototype,"effectiveX",null),t([i()],d.prototype,"effectiveY",null),t([i()],d.prototype,"key",null),d=t([o("esri.views.interactive.tooltip.infos.TooltipInfoWithCoordinates")],d),d},m=[0,0];export{g as TooltipInfoWithCoordinates};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{throwIfAborted as a}from"../../core/promiseUtils.js";import{requestImage as t}from"../../support/requestImageUtils.js";async function s(s){const r=import("./mask-svg.js"),i=import("./overlay-svg.js"),o=t((await r).default,{signal:s}),e=t((await i).default,{signal:s}),m={mask:await o,overlay:await e};return a(s),m}export{s as loadMagnifierResources};
5
+ import{throwIfAborted as a}from"../../core/promiseUtils.js";import{requestImage as t}from"../../request/image.js";async function s(s){const i=import("./mask-svg.js"),r=import("./overlay-svg.js"),o=t((await i).default,{signal:s}),e=t((await r).default,{signal:s}),m={mask:await o,overlay:await e};return a(s),m}export{s as loadMagnifierResources};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{createLength as n}from"../../core/quantityUtils.js";import{lengthUnitFromSpatialReference as t,verticalLengthUnitFromSpatialReference as e}from"../../core/unitUtils.js";import{k as r,j as l}from"../../chunks/vec32.js";import{create as i}from"../../core/libs/gl-matrix-2/factories/vec3f64.js";import{projectVectorToVector as u}from"../../geometry/projection/projectVectorToVector.js";import{equals as o}from"../../geometry/support/spatialReferenceUtils.js";import{computeEuclideanMeasurementSR as c}from"./measurementUtils.js";function s(n){return f(n,0)}function a(n){return f(n,1)}function f(e,r){const{hasZ:l,spatialReference:i}=e,u=c(i);let o=0;const s=t(u);if(null==s)return null;const a=0===r?x:Z;for(const n of e.paths){if(n.length<2)continue;const t=n.length-1;for(let e=0;e<t;++e){const t=n[e];U[0]=t[0],U[1]=t[1],U[2]=l?t[2]:0;const r=n[e+1];b[0]=r[0],b[1]=r[1],b[2]=l?r[2]:0;const u=a(U,b,i);if(null==u)return null;o+=u.value}}return n(o,s)}function p(n,t){const{spatialReference:e}=n;return o(e,t.spatialReference)?(U[0]=n.x,U[1]=n.y,U[2]=n.hasZ?n.z:0,b[0]=t.x,b[1]=t.y,b[2]=t.hasZ?t.z:0,j(U,b,e)):null}function h(n,t){const{spatialReference:e}=n;return o(e,t.spatialReference)?(U[0]=n.x,U[1]=n.y,U[2]=n.hasZ?n.z:0,b[0]=t.x,b[1]=t.y,b[2]=t.hasZ?t.z:0,x(U,b,e)):null}function m(n,t){const{spatialReference:e}=n;return o(e,t.spatialReference)?(U[0]=n.x,U[1]=n.y,U[2]=n.hasZ?n.z:0,b[0]=t.x,b[1]=t.y,b[2]=t.hasZ?t.z:0,Z(U,b,e)):null}function z(n,t){const{spatialReference:e}=n;return o(e,t.spatialReference)?(U[0]=n.x,U[1]=n.y,U[2]=n.hasZ?n.z:0,b[0]=t.x,b[1]=t.y,b[2]=t.hasZ?t.z:0,d(U,b,e)):null}function y(n){return null!=n?R(n.hasZ?n.z:0,n.spatialReference):null}function R(t,r){const l=e(r);return null!=l?n(t??0,l):null}function j(t,e,r){const l=g(t,e,r);return null!=l?{direct:n(l.direct,l.unit),horizontal:n(l.horizontal,l.unit),vertical:n(l.vertical,l.unit)}:null}function x(t,e,r){const l=g(t,e,r,0);return null!=l?n(l.direct,l.unit):null}function Z(t,e,r){const l=g(t,e,r,1);return null!=l?n(l.horizontal,l.unit):null}function v(t,e,r){const l=g(t,e,r,2);return null!=l?n(Math.abs(l.verticalSigned),l.unit):null}function d(t,e,r){const l=g(t,e,r,2);return null!=l?n(l.verticalSigned,l.unit):null}function g(n,e,i,o){const s=c(i),a=t(s);if(null==a)return null;const f=e[2]-n[2];if(2===o)return{verticalSigned:f,unit:a};if(!u(n,i,S,s)||!u(e,i,k,s))return null;if(0===o){return{direct:r(k,S),unit:a}}if(l(M,n[0],n[1],e[2]),!u(M,i,M,s))return null;const p=r(M,k);if(1===o)return{horizontal:p,unit:a};return{direct:r(k,S),horizontal:p,vertical:Math.abs(f),unit:a}}const U=i(),b=i(),S=i(),k=i(),M=i();export{y as elevationFromPoint,R as elevationFromZ,x as euclideanDirectDistance,h as euclideanDirectDistanceBetweenPoints,j as euclideanDistance,p as euclideanDistanceBetweenPoints,Z as euclideanHorizontalDistance,m as euclideanHorizontalDistanceBetweenPoints,a as euclideanHorizontalLength,s as euclideanLength,v as verticalDistance,d as verticalSignedDistance,z as verticalSignedDistanceBetweenPoints};
5
+ import{createLength as n}from"../../core/quantityUtils.js";import{verticalLengthUnitFromSpatialReference as t,lengthUnitFromSpatialReference as e}from"../../core/unitUtils.js";import{k as r,j as l}from"../../chunks/vec32.js";import{create as i}from"../../core/libs/gl-matrix-2/factories/vec3f64.js";import{projectVectorToVector as u}from"../../geometry/projection/projectVectorToVector.js";import{equals as o}from"../../geometry/support/spatialReferenceUtils.js";import{computeEuclideanMeasurementSR as c}from"./measurementUtils.js";function s(n){return f(n,0)}function a(n){return f(n,1)}function f(t,r){const{hasZ:l,spatialReference:i}=t,u=c(i);let o=0;const s=e(u);if(null==s)return null;const a=0===r?x:Z;for(const n of t.paths){if(n.length<2)continue;const t=n.length-1;for(let e=0;e<t;++e){const t=n[e];U[0]=t[0],U[1]=t[1],U[2]=l?t[2]:0;const r=n[e+1];b[0]=r[0],b[1]=r[1],b[2]=l?r[2]:0;const u=a(U,b,i);if(null==u)return null;o+=u.value}}return n(o,s)}function p(n,t){const{spatialReference:e}=n;return o(e,t.spatialReference)?(U[0]=n.x,U[1]=n.y,U[2]=n.hasZ?n.z:0,b[0]=t.x,b[1]=t.y,b[2]=t.hasZ?t.z:0,j(U,b,e)):null}function h(n,t){const{spatialReference:e}=n;return o(e,t.spatialReference)?(U[0]=n.x,U[1]=n.y,U[2]=n.hasZ?n.z:0,b[0]=t.x,b[1]=t.y,b[2]=t.hasZ?t.z:0,x(U,b,e)):null}function m(n,t){const{spatialReference:e}=n;return o(e,t.spatialReference)?(U[0]=n.x,U[1]=n.y,U[2]=n.hasZ?n.z:0,b[0]=t.x,b[1]=t.y,b[2]=t.hasZ?t.z:0,Z(U,b,e)):null}function z(n,t){const{spatialReference:e}=n;return o(e,t.spatialReference)?(U[0]=n.x,U[1]=n.y,U[2]=n.hasZ?n.z:0,b[0]=t.x,b[1]=t.y,b[2]=t.hasZ?t.z:0,d(U,b,e)):null}function y(n){return null!=n?R(n.hasZ?n.z:0,n.spatialReference):null}function R(e,r){const l=t(r);return null!=l?n(e??0,l):null}function j(t,e,r){const l=g(t,e,r);return null!=l?{direct:n(l.direct,l.unit),horizontal:n(l.horizontal,l.unit),vertical:n(l.vertical,l.unit)}:null}function x(t,e,r){const l=g(t,e,r,0);return null!=l?n(l.direct,l.unit):null}function Z(t,e,r){const l=g(t,e,r,1);return null!=l?n(l.horizontal,l.unit):null}function v(t,e,r){const l=g(t,e,r,2);return null!=l?n(Math.abs(l.verticalSigned),l.unit):null}function d(t,e,r){const l=g(t,e,r,2);return null!=l?n(l.verticalSigned,l.unit):null}function g(n,t,i,o){const s=c(i),a=e(s);if(null==a)return null;const f=t[2]-n[2];if(2===o)return{verticalSigned:f,unit:a};if(!u(n,i,S,s)||!u(t,i,k,s))return null;if(0===o){return{direct:r(k,S),unit:a}}if(l(M,n[0],n[1],t[2]),!u(M,i,M,s))return null;const p=r(M,k);if(1===o)return{horizontal:p,unit:a};return{direct:r(k,S),horizontal:p,vertical:Math.abs(f),unit:a}}const U=i(),b=i(),S=i(),k=i(),M=i();export{y as elevationFromPoint,R as elevationFromZ,x as euclideanDirectDistance,h as euclideanDirectDistanceBetweenPoints,j as euclideanDistance,p as euclideanDistanceBetweenPoints,Z as euclideanHorizontalDistance,m as euclideanHorizontalDistanceBetweenPoints,a as euclideanHorizontalLength,s as euclideanLength,v as verticalDistance,d as verticalSignedDistance,z as verticalSignedDistanceBetweenPoints};