@arcgis/core 4.28.0-next.20230919 → 4.28.0-next.20230921

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 (412) hide show
  1. package/Color.js +1 -1
  2. package/WebScene.js +1 -1
  3. package/arcade/ArcadeDate.js +1 -1
  4. package/arcade/executionError.js +1 -1
  5. package/arcade/featureset/support/errorsupport.js +1 -1
  6. package/assets/esri/core/workers/RemoteClient.js +1 -1
  7. package/assets/esri/core/workers/chunks/06621efb2573fad23b45.js +1 -0
  8. package/assets/esri/core/workers/chunks/072b4e041b8630c513a0.js +1 -0
  9. package/assets/esri/core/workers/chunks/101f776316a85b708927.js +1 -0
  10. package/assets/esri/core/workers/chunks/107546ef77a45d31c7ac.js +1 -0
  11. package/assets/esri/core/workers/chunks/10fd951bd296b2beeeba.js +1 -0
  12. package/assets/esri/core/workers/chunks/114269dda1d296893908.js +1 -0
  13. package/assets/esri/core/workers/chunks/126df6237fc80608344e.js +1 -0
  14. package/assets/esri/core/workers/chunks/134524cf6b1ebf208338.js +1 -0
  15. package/assets/esri/core/workers/chunks/17a36704e63ca1b34c5d.js +1 -0
  16. package/assets/esri/core/workers/chunks/1c83f47d446f2bca1721.js +1 -0
  17. package/assets/esri/core/workers/chunks/{09d395a9786607294689.js → 1c8469fbde39d85ee622.js} +1 -1
  18. package/assets/esri/core/workers/chunks/1cbaba30f55f00f7498b.js +1 -0
  19. package/assets/esri/core/workers/chunks/21a9c8aa2a9e9990df41.js +1 -0
  20. package/assets/esri/core/workers/chunks/{506874f562ce11f8914a.js → 243a4eed107d363dfad8.js} +1 -1
  21. package/assets/esri/core/workers/chunks/24629402c647ef6b5f6b.js +1 -0
  22. package/assets/esri/core/workers/chunks/2a1c1be9c202462cf54d.js +1 -0
  23. package/assets/esri/core/workers/chunks/2bb69d76a13564e8e455.js +1 -0
  24. package/assets/esri/core/workers/chunks/2d0d03cbea83c868edba.js +1 -0
  25. package/assets/esri/core/workers/chunks/2e130cb2f1038055c07b.js +1 -0
  26. package/assets/esri/core/workers/chunks/32ba4eba730e9232d964.js +1 -0
  27. package/assets/esri/core/workers/chunks/{b428fcb53ecc82b49e66.js → 332689bf60d246485993.js} +1 -1
  28. package/assets/esri/core/workers/chunks/3619e04cbb6691549014.js +1 -0
  29. package/assets/esri/core/workers/chunks/37116fb4c68cf3c3890a.js +1 -0
  30. package/assets/esri/core/workers/chunks/{3a7ad0d24264e2bc2e87.js → 3ca759f72d3bb29e9ea9.js} +22 -22
  31. package/assets/esri/core/workers/chunks/3dbfb4f370a874393822.js +1 -0
  32. package/assets/esri/core/workers/chunks/3f4e9b1663ec521bfe00.js +1 -0
  33. package/assets/esri/core/workers/chunks/406db5c90271a3a203d4.js +1 -0
  34. package/assets/esri/core/workers/chunks/4339ce8aaf87fabb80cc.js +1 -0
  35. package/assets/esri/core/workers/chunks/4369a6c1e0a82ab4db6a.js +1 -0
  36. package/assets/esri/core/workers/chunks/43ba2bacd0f7d19915f7.js +1 -0
  37. package/assets/esri/core/workers/chunks/44b8e75593b7df1843e1.js +1 -0
  38. package/assets/esri/core/workers/chunks/467a821d05df8ec0dc1c.js +1 -0
  39. package/assets/esri/core/workers/chunks/47be4c75dd6372b96fe4.js +1 -0
  40. package/assets/esri/core/workers/chunks/53097659f31750c03a6d.js +1 -0
  41. package/assets/esri/core/workers/chunks/{c1141056581af072aee9.js → 580039dd491854ca325c.js} +1 -1
  42. package/assets/esri/core/workers/chunks/59c00d6fba0fd1c03d01.js +1 -0
  43. package/assets/esri/core/workers/chunks/5a5720caa64a46daadf9.js +1 -0
  44. package/assets/esri/core/workers/chunks/5edb99b58549cd66b394.js +1 -0
  45. package/assets/esri/core/workers/chunks/6203ddf6caad3d356327.js +1 -0
  46. package/assets/esri/core/workers/chunks/652749dc847fcb887234.js +1 -0
  47. package/assets/esri/core/workers/chunks/6c495077cc79e1898927.js +1 -0
  48. package/assets/esri/core/workers/chunks/{e5c3beebd507e1dda35f.js → 749fc49246093d693227.js} +1 -1
  49. package/assets/esri/core/workers/chunks/74d3ecb1a06d9f81e2c5.js +1 -0
  50. package/assets/esri/core/workers/chunks/77c15b1c2729c780f75a.js +1 -0
  51. package/assets/esri/core/workers/chunks/7ea33aa455c5143affb1.js +1 -0
  52. package/assets/esri/core/workers/chunks/7ed70c96fbfe00792e7c.js +1 -0
  53. package/assets/esri/core/workers/chunks/8ab832468300cc4feb5a.js +1 -0
  54. package/assets/esri/core/workers/chunks/90771b0de3e520a1df9a.js +1 -0
  55. package/assets/esri/core/workers/chunks/94188fe381239d48a975.js +1 -0
  56. package/assets/esri/core/workers/chunks/a277c980ba8704939688.js +1 -0
  57. package/assets/esri/core/workers/chunks/b1746c022fe6edaeda55.js +1 -0
  58. package/assets/esri/core/workers/chunks/b449d6bd5851187d419f.js +1 -0
  59. package/assets/esri/core/workers/chunks/bbc0dcd316c5598bc9ad.js +1 -0
  60. package/assets/esri/core/workers/chunks/bc1dc6383e60e7e61d50.js +1 -0
  61. package/assets/esri/core/workers/chunks/bc6323bdc98013da6fe5.js +1 -0
  62. package/assets/esri/core/workers/chunks/bde89b2684b6185992ef.js +1 -0
  63. package/assets/esri/core/workers/chunks/c4bb67150ccd01ea6014.js +1 -0
  64. package/assets/esri/core/workers/chunks/{727548fffd4e270617d3.js → c6ea5aac232d1eca04dd.js} +1 -1
  65. package/assets/esri/core/workers/chunks/c8438c2d9ac48afe4033.js +1 -0
  66. package/assets/esri/core/workers/chunks/c9dfb145f0c1d93e0fbd.js +1 -0
  67. package/assets/esri/core/workers/chunks/cad260881653567bc8f9.js +1 -0
  68. package/assets/esri/core/workers/chunks/cec607d0138351a4952e.js +1 -0
  69. package/assets/esri/core/workers/chunks/d24afa6d8fd0061d9f00.js +1 -0
  70. package/assets/esri/core/workers/chunks/{f147269d85adfb4588ed.js → d9061beaa43065316062.js} +1 -1
  71. package/assets/esri/core/workers/chunks/dd7508d4016715371e0c.js +1 -0
  72. package/assets/esri/core/workers/chunks/dff1c3c38dda2bd1a9d6.js +1 -0
  73. package/assets/esri/core/workers/chunks/e55f7fc7eff0074ce0fc.js +1 -0
  74. package/assets/esri/core/workers/chunks/eb01f4cdb9b918cc61e7.js +1 -0
  75. package/assets/esri/core/workers/chunks/ec8258c9dc1491e97fc8.js +1 -0
  76. package/assets/esri/core/workers/chunks/ed1fbc1bc8d50453e2f5.js +1 -0
  77. package/assets/esri/core/workers/chunks/eeac53da496de4cd4182.js +1 -0
  78. package/assets/esri/core/workers/chunks/eef27d305023034084a4.js +1 -0
  79. package/assets/esri/core/workers/chunks/f38c54ada9e7012a2960.js +1 -0
  80. package/assets/esri/core/workers/chunks/f508ccfde6425dabe9ac.js +1 -0
  81. package/assets/esri/core/workers/chunks/f5e0ff5292b9fd18fc92.js +1 -0
  82. package/assets/esri/core/workers/chunks/f5eb8b5021620be7538e.js +1 -0
  83. package/assets/esri/images/portal/onlinemedialayer16.png +0 -0
  84. package/assets/esri/themes/base/widgets/_FeatureForm.scss +2 -1
  85. package/assets/esri/themes/dark/main.css +1 -1
  86. package/assets/esri/themes/light/main.css +1 -1
  87. package/assets/esri/themes/light/view.css +1 -1
  88. package/assets/esri/widgets/FeatureForm/t9n/FeatureForm.json +1 -1
  89. package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_ar.json +1 -1
  90. package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_bg.json +1 -1
  91. package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_bs.json +1 -1
  92. package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_ca.json +1 -1
  93. package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_cs.json +1 -1
  94. package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_da.json +1 -1
  95. package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_de.json +1 -1
  96. package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_el.json +1 -1
  97. package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_en.json +1 -1
  98. package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_es.json +1 -1
  99. package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_et.json +1 -1
  100. package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_fi.json +1 -1
  101. package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_fr.json +1 -1
  102. package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_he.json +1 -1
  103. package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_hr.json +1 -1
  104. package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_hu.json +1 -1
  105. package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_id.json +1 -1
  106. package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_it.json +1 -1
  107. package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_ja.json +1 -1
  108. package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_ko.json +1 -1
  109. package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_lt.json +1 -1
  110. package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_lv.json +1 -1
  111. package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_nb.json +1 -1
  112. package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_nl.json +1 -1
  113. package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_pl.json +1 -1
  114. package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_pt-BR.json +1 -1
  115. package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_pt-PT.json +1 -1
  116. package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_ro.json +1 -1
  117. package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_ru.json +1 -1
  118. package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_sk.json +1 -1
  119. package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_sl.json +1 -1
  120. package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_sr.json +1 -1
  121. package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_sv.json +1 -1
  122. package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_th.json +1 -1
  123. package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_tr.json +1 -1
  124. package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_uk.json +1 -1
  125. package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_vi.json +1 -1
  126. package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_zh-CN.json +1 -1
  127. package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_zh-HK.json +1 -1
  128. package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_zh-TW.json +1 -1
  129. package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace.json +1 -1
  130. package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_ar.json +1 -1
  131. package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_bg.json +1 -1
  132. package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_bs.json +1 -1
  133. package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_ca.json +1 -1
  134. package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_cs.json +1 -1
  135. package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_da.json +1 -1
  136. package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_de.json +1 -1
  137. package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_el.json +1 -1
  138. package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_en.json +1 -1
  139. package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_es.json +1 -1
  140. package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_et.json +1 -1
  141. package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_fi.json +1 -1
  142. package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_fr.json +1 -1
  143. package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_he.json +1 -1
  144. package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_hr.json +1 -1
  145. package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_hu.json +1 -1
  146. package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_id.json +1 -1
  147. package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_it.json +1 -1
  148. package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_ja.json +1 -1
  149. package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_ko.json +1 -1
  150. package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_lt.json +1 -1
  151. package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_lv.json +1 -1
  152. package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_nb.json +1 -1
  153. package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_nl.json +1 -1
  154. package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_pl.json +1 -1
  155. package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_pt-BR.json +1 -1
  156. package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_pt-PT.json +1 -1
  157. package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_ro.json +1 -1
  158. package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_ru.json +1 -1
  159. package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_sk.json +1 -1
  160. package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_sl.json +1 -1
  161. package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_sr.json +1 -1
  162. package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_sv.json +1 -1
  163. package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_th.json +1 -1
  164. package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_tr.json +1 -1
  165. package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_uk.json +1 -1
  166. package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_vi.json +1 -1
  167. package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_zh-CN.json +1 -1
  168. package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_zh-HK.json +1 -1
  169. package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_zh-TW.json +1 -1
  170. package/chunks/LaserlinePath.glsl.js +5 -1
  171. package/core/HandleOwner.js +1 -1
  172. package/core/MemCache.js +1 -1
  173. package/core/date.js +5 -0
  174. package/core/sql.js +1 -1
  175. package/core/string.js +1 -1
  176. package/interfaces.d.ts +60 -43
  177. package/intl/date.js +1 -1
  178. package/layers/GeoJSONLayer.js +1 -1
  179. package/layers/ImageryLayer.js +1 -1
  180. package/layers/VoxelWasmPerSceneView.js +1 -1
  181. package/layers/WFSLayer.js +1 -1
  182. package/layers/graphics/sources/GeoJSONSource.js +1 -1
  183. package/layers/graphics/sources/MemorySource.js +1 -1
  184. package/layers/graphics/sources/WFSSource.js +1 -1
  185. package/layers/graphics/sources/WFSSourceWorker.js +1 -1
  186. package/layers/graphics/sources/csv/csv.js +1 -1
  187. package/layers/graphics/sources/geojson/GeoJSONSourceWorker.js +1 -1
  188. package/layers/graphics/sources/geojson/geojson.js +1 -1
  189. package/layers/graphics/sources/support/CSVSourceWorker.js +1 -1
  190. package/layers/graphics/sources/support/MemorySourceWorker.js +1 -1
  191. package/{views/interactive/tooltip/tooltipInfoUnion.js → layers/graphics/sources/support/QueryEngineBuildLayer.js} +1 -0
  192. package/layers/graphics/sources/support/sourceUtils.js +1 -1
  193. package/layers/mixins/SceneService.js +1 -1
  194. package/layers/ogc/wfsUtils.js +1 -1
  195. package/layers/save/utils.js +1 -1
  196. package/layers/support/editableLayers.js +1 -1
  197. package/layers/support/fieldUtils.js +1 -1
  198. package/layers/support/labelFormatUtils.js +1 -1
  199. package/layers/support/layersCreator.js +1 -1
  200. package/layers/support/rasterFunctionUtils.js +1 -1
  201. package/layers/support/rasterFunctions/creators/createBandIndexFunctions.js +1 -1
  202. package/layers/support/rasterFunctions/creators/createDataManagementFunctions.js +1 -1
  203. package/layers/support/rasterFunctions/creators/createLocalFunctions.js +1 -1
  204. package/networks/support/utils.js +1 -1
  205. package/package.json +1 -1
  206. package/portal/PortalItem.js +1 -1
  207. package/portal/support/layersLoader.js +1 -1
  208. package/rest/geometryService/cut.js +1 -1
  209. package/rest/query/operations/query.js +1 -1
  210. package/rest/versionManagement/deleteVersion.js +1 -1
  211. package/rest/versionManagement/gdbVersion/alterVersion.js +1 -1
  212. package/rest/versionManagement/gdbVersion/post.js +1 -1
  213. package/rest/versionManagement/gdbVersion/reconcile.js +1 -1
  214. package/rest/versionManagement/gdbVersion/serverVersionUtils.js +5 -0
  215. package/support/revision.js +1 -1
  216. package/time/timeZoneUtils.js +1 -1
  217. package/views/2d/engine/Stage.js +1 -1
  218. package/views/2d/engine/webgl/mesh/factories/WGLMeshFactory.js +1 -1
  219. package/views/2d/layers/features/controllers/FeatureController2D.js +1 -1
  220. package/views/2d/layers/features/sources/BaseFeatureSource.js +1 -1
  221. package/views/2d/layers/features/sources/DataTileSource.js +1 -1
  222. package/views/2d/layers/features/sources/StreamSource.js +1 -1
  223. package/views/2d/layers/features/support/whereUtils.js +1 -1
  224. package/views/3d/analysis/AreaMeasurement/support/AreaMeasurementVisualization.js +1 -1
  225. package/views/3d/analysis/Dimension/LengthDimensionSubTool.js +1 -1
  226. package/views/3d/analysis/Dimension/lengthDimensionConstraintUtils.js +1 -1
  227. package/views/3d/analysis/Slice/RotateManipulator.js +1 -1
  228. package/views/3d/environment/EnvironmentRenderer.js +1 -1
  229. package/views/3d/environment/LocalAtmosphere.js +1 -1
  230. package/views/3d/externalRenderers/StageRenderer.js +1 -1
  231. package/views/3d/interactive/manipulatorUtils.js +1 -1
  232. package/views/3d/interactive/measurementTools/areaMeasurement3D/AreaMeasurement3DTool.js +1 -1
  233. package/views/3d/interactive/visualElements/MeasurementAreaVisualElement.js +1 -1
  234. package/views/3d/interactive/visualElements/OutlineVisualElement.js +1 -1
  235. package/views/3d/interactive/visualElements/PointVisualElement.js +1 -1
  236. package/views/3d/interactive/visualElements/RightAngleQuadVisualElement.js +1 -1
  237. package/views/3d/layers/MediaLayerView3D.js +1 -1
  238. package/views/3d/layers/SceneLayerGraphicsView3D.js +1 -1
  239. package/views/3d/layers/graphics/Deconflictor.js +1 -1
  240. package/views/3d/layers/graphics/ElevationAligners.js +1 -1
  241. package/views/3d/layers/graphics/Graphics3DExtrudeSymbolLayer.js +1 -1
  242. package/views/3d/layers/graphics/Graphics3DLineCalloutSymbolLayer.js +1 -1
  243. package/views/3d/layers/graphics/Graphics3DMeshFillSymbolLayer.js +1 -1
  244. package/views/3d/layers/graphics/Graphics3DObjectSymbolLayer.js +1 -1
  245. package/views/3d/layers/graphics/objectResourceUtils.js +1 -1
  246. package/views/3d/layers/graphics/polygonUtils.js +1 -1
  247. package/views/3d/layers/graphics/wosrLoader.js +1 -1
  248. package/views/3d/layers/i3s/I3SUtil.js +1 -1
  249. package/views/3d/layers/i3s/PointRenderer.js +1 -1
  250. package/views/3d/layers/support/HeatmapFeatureProcessor.js +1 -1
  251. package/views/3d/layers/support/overlayImageUtils.js +1 -1
  252. package/views/3d/layers/support/patternUtils.js +1 -1
  253. package/views/3d/support/LaserLineRenderer.js +1 -1
  254. package/views/3d/support/StreamDataLoader.js +1 -1
  255. package/views/3d/support/dito.js +1 -1
  256. package/views/3d/support/engineContent/line.js +1 -1
  257. package/views/3d/support/pointsOfInterest/CenterOnSurface.js +1 -1
  258. package/views/3d/support/pointsOfInterest/Focus.js +1 -1
  259. package/views/3d/terrain/OverlayRenderer.js +1 -1
  260. package/views/3d/terrain/TerrainRenderer.js +1 -1
  261. package/views/3d/terrain/TileRenderer.js +1 -1
  262. package/views/3d/webgl-engine/collections/Component/ComponentIntersectionData.js +1 -1
  263. package/views/3d/webgl-engine/collections/Component/IntersectionGeometry.js +1 -1
  264. package/views/3d/webgl-engine/core/FBOCache.js +1 -1
  265. package/views/3d/webgl-engine/core/renderPasses/RenderPassManager.js +1 -1
  266. package/views/3d/webgl-engine/core/shaderLibrary/attributes/InstancedDoublePrecision.glsl.js +6 -6
  267. package/views/3d/webgl-engine/core/shaderLibrary/hud/AlignPixel.glsl.js +10 -12
  268. package/views/3d/webgl-engine/core/shaderLibrary/hud/HUDVisibility.glsl.js +8 -21
  269. package/views/3d/webgl-engine/effects/RenderPluginManager.js +1 -1
  270. package/views/3d/webgl-engine/effects/highlight/Highlight.js +1 -1
  271. package/views/3d/webgl-engine/effects/highlight/ShadowHighlight.js +1 -1
  272. package/views/3d/webgl-engine/effects/smaa/SMAA.js +1 -1
  273. package/views/3d/webgl-engine/effects/ssao/SSAO.js +1 -1
  274. package/views/3d/webgl-engine/lib/Attribute.js +1 -1
  275. package/views/3d/webgl-engine/lib/BoundingInfo.js +1 -1
  276. package/views/3d/webgl-engine/lib/Camera.js +1 -1
  277. package/views/3d/webgl-engine/lib/DrapedHeatmapRenderer.js +1 -1
  278. package/views/3d/webgl-engine/lib/Geometry.js +1 -1
  279. package/views/3d/webgl-engine/lib/GeometryUtil.js +1 -1
  280. package/views/3d/webgl-engine/lib/GridLocalOriginFactory.js +1 -1
  281. package/views/3d/webgl-engine/lib/PathGeometryData.js +1 -1
  282. package/views/3d/webgl-engine/lib/RenderGeometry.js +1 -1
  283. package/views/3d/webgl-engine/lib/Renderer.js +1 -1
  284. package/views/3d/webgl-engine/lib/SortedRenderGeometryRenderer.js +1 -1
  285. package/views/3d/webgl-engine/lib/TextTextureAtlas.js +1 -1
  286. package/views/3d/webgl-engine/lib/edgeRendering/EdgeView.js +1 -1
  287. package/views/3d/webgl-engine/lib/geometryDataUtils.js +1 -1
  288. package/views/3d/webgl-engine/lib/lodRendering/LodRenderer.js +1 -1
  289. package/views/3d/webgl-engine/lib/lodRendering/LodResources.js +1 -1
  290. package/views/3d/webgl-engine/materials/DefaultBufferWriter.js +1 -1
  291. package/views/3d/webgl-engine/materials/HUDMaterial.js +1 -1
  292. package/views/3d/webgl-engine/materials/HeatmapDensityMaterial.js +1 -1
  293. package/views/3d/webgl-engine/materials/ImageMaterial.js +1 -1
  294. package/views/3d/webgl-engine/materials/LineCalloutMaterial.js +1 -1
  295. package/views/3d/webgl-engine/materials/LineMarkerMaterial.js +1 -1
  296. package/views/3d/webgl-engine/materials/MeasurementArrowMaterial.js +1 -1
  297. package/views/3d/webgl-engine/materials/NativeLineMaterial.js +1 -1
  298. package/views/3d/webgl-engine/materials/PatternMaterial.js +1 -1
  299. package/views/3d/webgl-engine/materials/RibbonLineMaterial.js +1 -1
  300. package/views/3d/webgl-engine/materials/ShadedColorMaterial.js +1 -1
  301. package/views/3d/webgl-engine/materials/internal/MaterialUtil.js +1 -1
  302. package/views/3d/webgl-engine/materials/internal/bufferWriterUtils.js +1 -1
  303. package/views/3d/webgl-engine/materials/renderers/MergedRenderer.js +1 -1
  304. package/views/View.js +1 -1
  305. package/views/draw/DrawGraphicTool.js +1 -1
  306. package/views/draw/support/HighlightHelper.js +1 -1
  307. package/views/draw/support/Reshape.js +1 -1
  308. package/views/draw/support/layerUtils.js +1 -1
  309. package/views/interactive/SegmentLabels.js +1 -1
  310. package/views/interactive/keybindings.js +1 -1
  311. package/views/interactive/tooltip/SketchTooltipInfo.js +1 -1
  312. package/views/interactive/tooltip/TooltipContentWithHelpMessage.js +1 -1
  313. package/views/interactive/tooltip/TooltipEditableField.js +1 -1
  314. package/views/interactive/tooltip/TranslateTooltipInfos.js +1 -1
  315. package/views/interactive/tooltip/content/Fields.js +5 -0
  316. package/views/interactive/tooltip/content/TooltipContentDrawPoint.js +1 -1
  317. package/views/interactive/tooltip/content/TooltipContentDrawPolygon.js +1 -1
  318. package/views/interactive/tooltip/content/TooltipContentDrawPolyline.js +1 -1
  319. package/views/layers/FeatureLayerView.js +1 -1
  320. package/views/webgl/FramebufferObject.js +1 -1
  321. package/webdoc/saveAPIKeyUtils.js +5 -0
  322. package/webdoc/webdocSaveUtils.js +1 -1
  323. package/widgets/BasemapGallery.js +1 -1
  324. package/widgets/BasemapLayerList.js +1 -1
  325. package/widgets/Bookmarks.js +1 -1
  326. package/widgets/Editor/CreateFeaturesWorkflow.js +1 -1
  327. package/widgets/Editor/EditorViewModel.js +1 -1
  328. package/widgets/Editor/UpdateRecordWorkflow.js +1 -1
  329. package/widgets/Editor/UpdateWorkflow.js +1 -1
  330. package/widgets/Expand.js +1 -1
  331. package/widgets/Feature/FeatureRelationship.js +1 -1
  332. package/widgets/Feature/support/featureUtils.js +1 -1
  333. package/widgets/FeatureForm/EditableInput.js +1 -1
  334. package/widgets/FeatureForm/FeatureFormViewModel.js +1 -1
  335. package/widgets/FeatureForm/RelationshipInput.js +1 -1
  336. package/widgets/FeatureForm.js +1 -1
  337. package/widgets/FeatureTemplates/FeatureTemplatesViewModel.js +1 -1
  338. package/widgets/Fullscreen.js +1 -1
  339. package/widgets/Legend/support/ActiveLayerInfo.js +1 -1
  340. package/widgets/Search.js +1 -1
  341. package/widgets/Swipe.js +1 -1
  342. package/widgets/UtilityNetworkTrace/UtilityNetworkTraceViewModel.js +1 -1
  343. package/widgets/UtilityNetworkTrace/support/ResultAreaHandler.js +1 -1
  344. package/widgets/UtilityNetworkTrace/support/UtilityHelper.js +1 -1
  345. package/widgets/UtilityNetworkTrace.js +1 -1
  346. package/widgets/support/SketchTooltipControls.js +1 -1
  347. package/widgets/support/globalCss.js +1 -1
  348. package/assets/esri/core/workers/chunks/0274b84548cb048562e4.js +0 -1
  349. package/assets/esri/core/workers/chunks/034accc7cab6c88a3b31.js +0 -1
  350. package/assets/esri/core/workers/chunks/0839b45999fcb556e460.js +0 -1
  351. package/assets/esri/core/workers/chunks/09589852b129bfb5624f.js +0 -1
  352. package/assets/esri/core/workers/chunks/132e9e6147304ffd128d.js +0 -1
  353. package/assets/esri/core/workers/chunks/1790ca4193d730f5f206.js +0 -1
  354. package/assets/esri/core/workers/chunks/1a449168d30a688e6128.js +0 -1
  355. package/assets/esri/core/workers/chunks/1c94624fd001c803a814.js +0 -1
  356. package/assets/esri/core/workers/chunks/25ab3bec45de900be36e.js +0 -1
  357. package/assets/esri/core/workers/chunks/273167b2dd46e58b8739.js +0 -1
  358. package/assets/esri/core/workers/chunks/2c5eb8aaad696fa16744.js +0 -1
  359. package/assets/esri/core/workers/chunks/353bad8530710a284592.js +0 -1
  360. package/assets/esri/core/workers/chunks/357d452b8522185cc433.js +0 -1
  361. package/assets/esri/core/workers/chunks/3c2be3d204e6bf87266a.js +0 -1
  362. package/assets/esri/core/workers/chunks/3c2c64832fb498bbaa83.js +0 -1
  363. package/assets/esri/core/workers/chunks/3c4d59018ce8502c65e7.js +0 -1
  364. package/assets/esri/core/workers/chunks/43eff89599f36d83924b.js +0 -1
  365. package/assets/esri/core/workers/chunks/4632ada4af99cab70a61.js +0 -1
  366. package/assets/esri/core/workers/chunks/481eab7879ed5d8a1f67.js +0 -1
  367. package/assets/esri/core/workers/chunks/4b3a5cc435435c81e6a5.js +0 -1
  368. package/assets/esri/core/workers/chunks/4f34fd8c2bb769541e9c.js +0 -1
  369. package/assets/esri/core/workers/chunks/4f5a0bc7411c0db33662.js +0 -1
  370. package/assets/esri/core/workers/chunks/56a4cea67cc579bf7547.js +0 -1
  371. package/assets/esri/core/workers/chunks/56afd89d08c874f620a1.js +0 -1
  372. package/assets/esri/core/workers/chunks/5b08d578521562b166e3.js +0 -1
  373. package/assets/esri/core/workers/chunks/5f938d6da9fd3f3edc74.js +0 -1
  374. package/assets/esri/core/workers/chunks/6108d72faf48a592c8ba.js +0 -1
  375. package/assets/esri/core/workers/chunks/656a8be4ce1bec721366.js +0 -1
  376. package/assets/esri/core/workers/chunks/7531ebc60e9ae61220e0.js +0 -1
  377. package/assets/esri/core/workers/chunks/77923afde29ae1ff10ca.js +0 -1
  378. package/assets/esri/core/workers/chunks/79683324be49aab79dd8.js +0 -1
  379. package/assets/esri/core/workers/chunks/7cdb4416afd5922cf5f3.js +0 -1
  380. package/assets/esri/core/workers/chunks/7e87bc83a0a2715e3016.js +0 -1
  381. package/assets/esri/core/workers/chunks/7f680cf24dd97d61bcd2.js +0 -1
  382. package/assets/esri/core/workers/chunks/7f797fed73cf7b48a686.js +0 -1
  383. package/assets/esri/core/workers/chunks/861609ebd3a77b787b0f.js +0 -1
  384. package/assets/esri/core/workers/chunks/869c3927f1e246cd1e42.js +0 -1
  385. package/assets/esri/core/workers/chunks/95371c0f5464f5daae9f.js +0 -1
  386. package/assets/esri/core/workers/chunks/962b99fd273709c726d3.js +0 -1
  387. package/assets/esri/core/workers/chunks/98fbcbb2115376d7ff62.js +0 -1
  388. package/assets/esri/core/workers/chunks/9abcd1d11bfd92f872ab.js +0 -1
  389. package/assets/esri/core/workers/chunks/9b54b5bdb6367c36f6e9.js +0 -1
  390. package/assets/esri/core/workers/chunks/9dab9f6c07ececa7f851.js +0 -1
  391. package/assets/esri/core/workers/chunks/9ff6ce486898713af7e2.js +0 -1
  392. package/assets/esri/core/workers/chunks/a98a435d4dbea73f7517.js +0 -1
  393. package/assets/esri/core/workers/chunks/b05bb6e784e5453696be.js +0 -1
  394. package/assets/esri/core/workers/chunks/b51d0ec283f61f638a48.js +0 -1
  395. package/assets/esri/core/workers/chunks/b5ee6c0c07fa50410370.js +0 -1
  396. package/assets/esri/core/workers/chunks/b9cf8f02974aeb3ce208.js +0 -1
  397. package/assets/esri/core/workers/chunks/bdf13091bd0e1ab0db7e.js +0 -1
  398. package/assets/esri/core/workers/chunks/bef1a1218a94ab6e2b51.js +0 -1
  399. package/assets/esri/core/workers/chunks/c22c2b15fe5f2c97a2ae.js +0 -1
  400. package/assets/esri/core/workers/chunks/c880d2f0ff06b3bf731f.js +0 -1
  401. package/assets/esri/core/workers/chunks/c88869d2a647c22dc3e6.js +0 -1
  402. package/assets/esri/core/workers/chunks/cc96be71fee49f07dcd4.js +0 -1
  403. package/assets/esri/core/workers/chunks/e4237360eef474d1f0ac.js +0 -1
  404. package/assets/esri/core/workers/chunks/e54ae2a4281dd58e0707.js +0 -1
  405. package/assets/esri/core/workers/chunks/e977e721f6f50e3c5f13.js +0 -1
  406. package/assets/esri/core/workers/chunks/ed31cf6688c0f7dac1f9.js +0 -1
  407. package/assets/esri/core/workers/chunks/f07a0ea10428adecea1a.js +0 -1
  408. package/assets/esri/core/workers/chunks/f1eab5c67ed808c18f86.js +0 -1
  409. package/assets/esri/core/workers/chunks/f2e7142a8db164940544.js +0 -1
  410. package/assets/esri/core/workers/chunks/f939b4166f76975f5da0.js +0 -1
  411. package/assets/esri/core/workers/chunks/ff4f4107a866e4a68386.js +0 -1
  412. package/layers/ogc/dateUtils.js +0 -5
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.28/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../../../chunks/tslib.es6.js";import t from"../../../../../core/Accessor.js";import{isSome as r}from"../../../../../core/arrayUtils.js";import has from"../../../../../core/has.js";import{ignoreAbortErrors as s,after as i,throwIfAborted as a,throwIfNotAbortError as o,isAbortError as n}from"../../../../../core/promiseUtils.js";import{when as u,watch as g,whenOnce as l}from"../../../../../core/reactiveUtils.js";import{property as d}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/accessorSupport/ensureType.js";import{subclass as h}from"../../../../../core/accessorSupport/decorators/subclass.js";import{UpdatingHandles as c}from"../../../../../core/support/UpdatingHandles.js";import{convertToGeometry as p}from"../../../../../layers/graphics/featureConversionUtils.js";import{QueryEngine as y}from"../../../../../layers/graphics/data/QueryEngine.js";import f from"../../../../../layers/support/FieldsIndex.js";import{FeatureStore2D as m}from"../FeatureStore2D.js";import{createSource as S}from"../sources/createSource.js";import _ from"../support/AttributeStore.js";import{BinStore as b}from"../support/BinStore.js";import{ClusterStore as v}from"../support/ClusterStore.js";import{ComputedAttributeStorage as I}from"../support/ComputedAttributeStorage.js";import{FeatureSetReaderJSON as Q}from"../support/FeatureSetReaderJSON.js";import{UpdateToken as C}from"../support/UpdateToken.js";import{QueueProcessor as F}from"../../../../support/QueueProcessor.js";const E=5e3,w="tileRenderer.featuresView.attributeView.initialize",T="tileRenderer.featuresView.attributeView.requestUpdate",j="tileRenderer.featuresView.requestRender";function A(e){return"worker:port-closed"===e.name}function k(e){if(!n(e)&&!A(e))throw e}function U(e){return"feature"===e.type&&"snapshot"===e.mode}let x=class extends t{constructor(){super(...arguments),this._storage=new I,this._markedIdsBufId=this._storage.createBitset(),this._lastCleanup=performance.now(),this._cleanupNeeded=!1,this._invalidated=!1,this._tileToResolver=new Map,this._didEdit=!1,this._updateVersion=1,this._updatingHandles=new c,this.tileStore=null,this.config=null,this.processor=null,this.remoteClient=null,this.service=null}initialize(){this._initStores(),this._initSource(),this._updateQueue=new F({concurrency:"stream"===this._source.type?1:4,process:(e,t)=>this._onTileMessage(e,{signal:t})}),this.addHandles([this.tileStore.on("update",this.onTileUpdate.bind(this)),u((()=>!this.updating),(()=>this.onIdle()))])}_initSource(){const e=this.tileStore.tileScheme,t=()=>this._updateQueue&&this._updateQueue.length<50,r=(e,t)=>(this._invalidated=!0,this._patchTile(e,t));this._source=S(this.service,this.spatialReference,e,r,t,this.featureStore),this._proxyEvents()}_setStreamClientProperty(e,t){this.remoteClient.invoke("setProperty",{propertyName:e,value:t}).catch(k)}_proxyEvents(){if("stream"===this._source.type){const e=this._source.events,t=this._source;this.addHandles([g((()=>t.connectionStatus),(e=>this._setStreamClientProperty("pipelineConnectionStatus",e)),{initial:!0}),g((()=>t.errorString),(e=>this._setStreamClientProperty("pipelineErrorString",e)),{initial:!0}),e.on("data-received",(e=>this.remoteClient.invoke("emitEvent",{name:"data-received",event:{attributes:e.attributes,centroid:e.centroid,geometry:e.geometry}}).catch(k))),e.on("message-received",(e=>this.remoteClient.invoke("emitEvent",{name:"message-received",event:e}).catch(k))),e.on("updateRate",(e=>this.remoteClient.invoke("emitEvent",{name:"update-rate",event:{...e}}).catch(k)))])}}_initAttributeStore(e){this.attributeStore||(this.attributeStore=new _({type:"remote",initialize:(e,t)=>s(this.remoteClient.invoke(w,e,{signal:t}).catch(k)),update:(e,t)=>s(this.remoteClient.invoke(T,e,{signal:t}).catch(k)),render:e=>s(this.remoteClient.invoke(j,void 0,{signal:e}).catch(k))},e))}_initStores(){const e="snapshot"===this.service.type?"snapshot":"on-demand",t={geometryInfo:{geometryType:this.service.geometryType,hasM:!1,hasZ:!1},spatialReference:this.spatialReference,fieldsIndex:this.fieldsIndex,fields:this.service.fields};this.featureStore=new m(t,this._storage,e)}_initQueryEngine(e){const t=this;this.featureQueryEngine?.destroy(),this.featureQueryEngine=new y({definitionExpression:e.schema.source.definitionExpression??void 0,fields:this.service.fields,geometryType:this.service.geometryType,objectIdField:this.service.objectIdField,hasM:!1,hasZ:!1,spatialReference:this.spatialReference.toJSON(),cacheSpatialQueries:!0,featureStore:this.featureStore,aggregateAdapter:{getFeatureObjectIds(e){if(null==t.aggregateStore)return[];return t.aggregateStore.getFeatureDisplayIdsForAggregate(e).map((e=>t.getObjectId(e)))}},timeInfo:this.service.timeInfo})}_initAggregateQueryEngine(e,t){if(this.aggregateQueryEngine?.destroy(),null==e)return;const r=t.targets.aggregate.params.fields.slice();this.aggregateQueryEngine=new y({definitionExpression:void 0,fields:r,geometryType:e.geometryInfo.geometryType,objectIdField:e.objectIdField,hasM:e.geometryInfo.hasM,hasZ:e.geometryInfo.hasZ,spatialReference:this.spatialReference.toJSON(),cacheSpatialQueries:!1,featureStore:e,aggregateAdapter:{getFeatureObjectIds:e=>[]}})}destroy(){this._updateQueue.destroy(),this._source.destroy(),this.featureQueryEngine?.destroy(),this.aggregateQueryEngine?.destroy(),this.attributeStore?.destroy();for(const e of this.tileStore.tiles)this._source.unsubscribe(e);clearInterval(this._checkUpdating),this._updatingHandles.destroy()}get fieldsIndex(){return new f(this.service.fields)}get spatialReference(){return this.tileStore.tileScheme.spatialReference}get dataUpdating(){return this._source.updatingHandles.updating}get updating(){return this.isUpdating()}isUpdating(){const e=this._source.updatingHandles.updating,t=!this.attributeStore||this.attributeStore.updatingHandles.updating,r=e||t||this._updatingHandles.updating;if(has("esri-2d-log-updating")){let s=`Updating FeatureController2D: ${r}\n`;s+=` -> updatingSource ${e}\n`;for(const e of this._source.subscriptions)s+=` ${e.tile.id} ${e.isDone}\n`;s+=` -> updatingAttributeStore ${t}\n`,s+=` -> updatingHandles ${this._updatingHandles.updating} (queue: ${this._updateQueue.length})\n`,console.log(s)}return r}updateCustomParameters(e){"stream"===this._source.type&&this._source.updateCustomParameters(e)}enableEvent(e){this._source.enableEvent(e.name,e.value)}pause(){this._updateQueue.pause(),this._updateQueue.clear()}resume(){this._updateQueue.resume()}pauseStream(){"stream"===this._source.type&&this._source.pauseStream()}resumeStream(){"stream"===this._source.type&&this._source.resumeStream()}sendMessageToSocket(e){"stream"===this._source.type&&this._source.sendMessageToSocket(e)}sendMessageToClient(e){"stream"===this._source.type&&this._source.sendMessageToClient(e)}_initAggregateStore(e){const t=e.schema.targets?.aggregate?.type??null;if((this.config?.schema.targets?.aggregate?.type??null)!==t&&(null!=this.aggregateStore&&(this.removeHandles("valueRangesChanged"),this.aggregateStore.destroy(),this.aggregateStore=null),t)){switch(t){case"cluster":{const e={geometryInfo:{geometryType:"esriGeometryPoint",hasM:!1,hasZ:!1},spatialReference:this.spatialReference,fieldsIndex:this.fieldsIndex,fields:this.service.fields};this.aggregateStore=new v(e,this.spatialReference,this._storage,this.service),this.addHandles(this.aggregateStore.events.on("valueRangesChanged",(e=>{this.remoteClient.invoke("emitEvent",{name:"valueRangesChanged",event:{valueRanges:e.valueRanges}}).catch(k)})),"valueRangesChanged");break}case"bin":{const e={geometryInfo:{geometryType:"esriGeometryPolygon",hasM:!1,hasZ:!1},spatialReference:this.spatialReference,fieldsIndex:this.fieldsIndex,fields:this.service.fields};this.aggregateStore=new b(e,this.spatialReference,this._storage,this.service);break}}this.aggregateStore.onTileUpdate({added:this.tileStore.tiles,removed:[]})}}async update(e,t){this._updateVersion++,has("esri-2d-update-debug")&&console.debug(`FeatureController2D::update: Token version ${this._updateVersion}`),this._initQueryEngine(t),this._initAttributeStore(t),this.pause(),await Promise.all([this._source.update(e,t.schema.source),this.featureStore.updateSchema(e,t.schema.targets.feature),this.attributeStore.update(e,t),this.attributeStore.updateFilters(e,t,this)]),this._initAggregateStore(t),null!=this.aggregateStore&&await this.aggregateStore.updateSchema(e,t.schema.targets.aggregate),this._initAggregateQueryEngine(this.aggregateStore,t.schema),has("esri-2d-update-debug")&&e.describe(),this._set("config",t)}async applyUpdate(e){e.version=this._updateVersion,has("esri-2d-update-debug")&&console.debug(`FeatureController2D::applyUpdate: Token version ${e.version}`),e.mesh&&this.clearTiles(),this._updateQueue.resume(),await this._source.applyUpdate(e),has("esri-2d-update-debug")&&console.debug("FeatureController2D::applyUpdate Waiting for source update to finish"),this.notifyChange("updating"),await l((()=>!this.updating)),has("esri-2d-update-debug")&&console.debug("FeatureController2D::applyUpdate Source update finsihed"),null!=this.aggregateStore&&(await i(10),has("esri-2d-update-debug")&&console.debug("FeatureController2D::applyUpdate Waiting for aggregate idle call"),await l((()=>!this.updating)),has("esri-2d-update-debug")&&console.debug("FeatureController2D::applyUpdate Aggregate idle called")),has("esri-2d-update-debug")&&console.debug("FeatureController2D::applyUpdate Update finished")}async onEdits({edits:e}){has("esri-2d-update-debug")&&console.debug("Applying Edit:",e),this._didEdit=!0;try{const t=e.removed.map((e=>e.objectId&&-1!==e.objectId?e.objectId:this._lookupObjectIdByGlobalId(e.globalId))),r=e.addOrModified.map((({objectId:e})=>e));this.featureStore.invalidate(),await this._source.edit(r,t),this.clearTiles(),this.notifyChange("updating"),null!=this.aggregateStore&&this.aggregateStore.clear(),await this._source.resend(),await l((()=>!this.updating))}catch(t){}}async refresh(e){if(!e.dataChanged){const e=C.empty();return e.storage.filters=!0,this.applyUpdate(e)}this.featureStore.invalidate(),this.clearTiles(),this._source.refresh(this._updateVersion,e),this._cleanupNeeded=!0,this.notifyChange("updating"),await l((()=>!this.updating))}clearTiles(){for(const e of this.tileStore.tiles)this.processor.onTileClear(e,!1)}onTileUpdate(e){null!=this.aggregateStore&&this.aggregateStore.onTileUpdate(e);for(const t of e.added)this._source.subscribe(t,this._updateVersion),this._level=t.level;for(const t of e.removed)this._source.unsubscribe(t),this._cleanupNeeded=!0,this._tileToResolver.has(t.id)&&(this._tileToResolver.get(t.id).resolve(),this._tileToResolver.delete(t.id));this.notifyChange("updating")}async onIdle(){this._invalidated&&(this._invalidated=!1,null==this.aggregateStore&&"heatmap"!==this.processor.type||await this._repushCurrentLevelTiles()),this._markAndSweep()}async querySummaryStatistics({query:e,params:t}){return this.featureQueryEngine.executeQueryForSummaryStatistics(e,t)}async queryAggregateSummaryStatistics({query:e,params:t}){return this.aggregateQueryEngine.executeQueryForSummaryStatistics(this._normalizeAggregateQuery(e),t)}async queryUniqueValues({query:e,params:t}){return this.featureQueryEngine.executeQueryForUniqueValues(e,t)}async queryAggregateUniqueValues({query:e,params:t}){return this.aggregateQueryEngine.executeQueryForUniqueValues(this._normalizeAggregateQuery(e),t)}async queryClassBreaks({query:e,params:t}){return this.featureQueryEngine.executeQueryForClassBreaks(e,t)}async queryAggregateClassBreaks({query:e,params:t}){return this.aggregateQueryEngine.executeQueryForClassBreaks(this._normalizeAggregateQuery(e),t)}async queryHistogram({query:e,params:t}){return this.featureQueryEngine.executeQueryForHistogram(e,t)}async queryAggregateHistogram({query:e,params:t}){return this.aggregateQueryEngine.executeQueryForHistogram(this._normalizeAggregateQuery(e),t)}queryExtent(e){return this.featureQueryEngine.executeQueryForExtent(e)}queryAggregates(e){return this.aggregateQueryEngine.executeQuery(this._normalizeAggregateQuery(e))}queryAggregateCount(e){return this.aggregateQueryEngine.executeQueryForCount(this._normalizeAggregateQuery(e))}queryAggregateIds(e){return this.aggregateQueryEngine.executeQueryForIds(this._normalizeAggregateQuery(e))}queryFeatures(e){return this.featureQueryEngine.executeQuery(e)}async queryVisibleFeatures(e){const t=await this.featureQueryEngine.executeQuery(e),r=t.objectIdFieldName;return t.features=t.features.filter((e=>{const t=e.attributes[r],s=this.getDisplayId(t);return null!=s&&this.attributeStore.isVisible(s)})),t}queryFeatureCount(e){return this.featureQueryEngine.executeQueryForCount(e)}queryLatestObservations(e){return this.featureQueryEngine.executeQueryForLatestObservations(e)}queryObjectIds(e){return this.featureQueryEngine.executeQueryForIds(e)}async queryStatistics(){return this.featureStore.storeStatistics}getObjectId(e){return this.featureStore.lookupObjectId(e,this._storage)}getDisplayId(e){if(null!=this.aggregateStore){const t=this.aggregateStore.getDisplayId(e);if(null==t){const t=this.featureStore.lookupDisplayId(e);return this.aggregateStore.getDisplayIdForReferenceId(t)}return t}return this.featureStore.lookupDisplayId(e)}getFeatures(e){const t=[],r=[];for(const s of e){const e=null!=this.aggregateStore?this.getAggregate(s):null;if(null!=e)if(null!=e.attributes.referenceId){const r=this.getFeature(e.attributes.referenceId);null!=r&&t.push(r)}else r.push(e);else{const e=this.getFeature(s);null!=e&&t.push(e)}}return{features:t,aggregates:r}}getFeature(e){const t=this.featureStore.lookupFeatureByDisplayId(e,this._storage);if(null==t)return null;const r=t.readHydratedGeometry(),s=p(r,t.geometryType,t.hasZ,t.hasM);return{attributes:t.readAttributes(),geometry:s}}getAggregate(e){return null==this.aggregateStore?null:this.aggregateStore.getAggregate(e)}getAggregates(){return null==this.aggregateStore?[]:this.aggregateStore.getAggregates()}async setHighlight(e){const t=e.map((e=>this.getDisplayId(e))).filter(r);return this.attributeStore.setHighlight(e,t)}_normalizeAggregateQuery(e){const t=e.objectIds??[];for(const r of e.aggregateIds??[])t.push(r);return e.objectIds=t,e.aggregateIds=[],e}_lookupObjectIdByGlobalId(e){const t=this.service.globalIdField;if(null==t)throw new Error("Expected globalIdField to be defined");let r=null;if(this.featureStore.forEach((s=>{e===s.readAttribute(t)&&(r=s.getObjectId())})),null==r)throw new Error(`Expected to find a feature with globalId ${e}`);return r}async _repushCurrentLevelTiles(){const e=this.tileStore.tiles.filter((e=>e.level===this._level));e.map((async e=>this._patchTile({type:"append",id:e.key.id,clear:!0,addOrUpdate:null,end:!1})));const t=e.map((async e=>this._patchTile({type:"append",id:e.key.id,addOrUpdate:Q.fromOptimizedFeatures([],this.service),remove:[],end:!0,isRepush:!0,status:C.empty()})));await Promise.all(t)}_maybeForceCleanup(){performance.now()-this._lastCleanup>E&&this._markAndSweep()}_patchTile(e,t){const r=this._updateQueue.push(e,t).catch((e=>{}));return this._updatingHandles.addPromise(r)}async _onTileMessage(e,t){if(a(t),has("esri-2d-update-debug")){const t=e.addOrUpdate?.hasFeatures;console.debug(e.id,`FeatureController:onTileMessage: [clear:${e.clear}, end:${e.end}, features: ${t}]`)}const r=this.tileStore.get(e.id);if(!r)return;if(e.clear)return this.processor.onTileClear(r,e.end);const s=e.status;this._cleanupNeeded=!0;const i=[];for(const a of e.remove??[]){const e=this.featureStore.lookupDisplayId(a);e&&i.push(e)}e.remove=i;try{if(null==e.addOrUpdate)return void this.processor.onTileMessage(r,{...e,addOrUpdate:null},null!=this.aggregateStore,t).catch(o);if(e.addOrUpdate.setArcadeSpatialReference(this.spatialReference),this.featureStore.hasInstance(e.addOrUpdate.instance)&&s.targets.feature||(s.targets.feature=!0,this.featureStore.onTileData(r,e)),!s.storage.data||!s.storage.filters){s.storage.data=!0,s.storage.filters=!0,this.attributeStore.onTileData(r,e);"stream"===this._source.type||this._didEdit?(await this.attributeStore.sendUpdates(),a(t)):this.attributeStore.sendUpdates()}if(null!=this.aggregateStore&&!s.targets.aggregate){s.targets.aggregate=!0;const t=U(this._source)&&this._source.loading,i=!U(this._source)||t||e.end;if(this.aggregateStore.onTileData(r,e,this._storage,this.attributeStore,i),!i)return;s.mesh||(this.attributeStore.onTileData(r,e),await this.attributeStore.sendUpdates())}if(!s.mesh){s.mesh=!0;const i=null!=this.aggregateStore&&"cluster"===this.aggregateStore.type;await this.processor.onTileMessage(r,e,i,t),a(t)}this._maybeForceCleanup()}catch(n){o(n)}}_mark(e,t,r){const s=(4294901760&this._storage.getInstanceId(e))>>>16;e&&(t.add(s),r.set(e))}_markAndSweep(){this._lastCleanup=performance.now();if(!(!("feature"===this._source.type&&"snapshot"===this._source.mode)&&("stream"===this._source.type||this._cleanupNeeded)))return;this._cleanupNeeded=!1;const e=this._storage.getBitset(this._markedIdsBufId),t=new Set;e.clear();for(const r of this.tileStore.tiles)for(const s of this._source.readers(r.id)){const r=s.getCursor();for(;r.next();){let s=r.getDisplayId();if(!s){const e=r.getObjectId();s=this.featureStore.lookupDisplayId(e)}this._mark(s,t,e)}}"symbol"===this.processor.type&&this.processor.forEachBufferId((r=>{this._mark(r,t,e)})),this._updateQueue.forEach((r=>{for(const s of r.remove??[]){const r=this.featureStore.lookupDisplayId(s);this._mark(r,t,e)}})),null!=this.aggregateStore&&(this.aggregateStore.sweepFeatures(e,this.featureStore),"sweepAggregates"in this.aggregateStore&&this.aggregateStore.sweepAggregates(this._storage,this.attributeStore,this._level)),this.featureStore.sweepFeatures(e,this._storage,this.attributeStore),this.featureStore.sweepFeatureSets(t)}};e([d({constructOnly:!0})],x.prototype,"tileStore",void 0),e([d()],x.prototype,"config",void 0),e([d({readOnly:!0})],x.prototype,"fieldsIndex",null),e([d()],x.prototype,"processor",void 0),e([d({constructOnly:!0})],x.prototype,"remoteClient",void 0),e([d({constructOnly:!0})],x.prototype,"service",void 0),e([d()],x.prototype,"spatialReference",null),e([d()],x.prototype,"dataUpdating",null),e([d()],x.prototype,"updating",null),x=e([h("esri.views.2d.layers.features.controllers.FeatureController2D")],x);const R=x;export{R as default};
5
+ import{_ as e}from"../../../../../chunks/tslib.es6.js";import t from"../../../../../core/Accessor.js";import{isSome as r}from"../../../../../core/arrayUtils.js";import has from"../../../../../core/has.js";import{ignoreAbortErrors as s,after as i,throwIfAborted as a,throwIfNotAbortError as o,isAbortError as n}from"../../../../../core/promiseUtils.js";import{when as u,watch as g,whenOnce as l}from"../../../../../core/reactiveUtils.js";import{property as d}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/accessorSupport/ensureType.js";import{subclass as h}from"../../../../../core/accessorSupport/decorators/subclass.js";import{UpdatingHandles as c}from"../../../../../core/support/UpdatingHandles.js";import{convertToGeometry as p}from"../../../../../layers/graphics/featureConversionUtils.js";import{QueryEngine as y}from"../../../../../layers/graphics/data/QueryEngine.js";import f from"../../../../../layers/support/FieldsIndex.js";import{FeatureStore2D as m}from"../FeatureStore2D.js";import{createSource as S}from"../sources/createSource.js";import _ from"../support/AttributeStore.js";import{BinStore as b}from"../support/BinStore.js";import{ClusterStore as v}from"../support/ClusterStore.js";import{ComputedAttributeStorage as I}from"../support/ComputedAttributeStorage.js";import{FeatureSetReaderJSON as Q}from"../support/FeatureSetReaderJSON.js";import{UpdateToken as C}from"../support/UpdateToken.js";import{QueueProcessor as F}from"../../../../support/QueueProcessor.js";const E=5e3,w="tileRenderer.featuresView.attributeView.initialize",T="tileRenderer.featuresView.attributeView.requestUpdate",j="tileRenderer.featuresView.requestRender";function A(e){return"worker:port-closed"===e.name}function k(e){if(!n(e)&&!A(e))throw e}function U(e){return"feature"===e.type&&"snapshot"===e.mode}let x=class extends t{constructor(){super(...arguments),this._storage=new I,this._markedIdsBufId=this._storage.createBitset(),this._lastCleanup=performance.now(),this._cleanupNeeded=!1,this._invalidated=!1,this._tileToResolver=new Map,this._didEdit=!1,this._updateVersion=1,this._updatingHandles=new c,this.tileStore=null,this.config=null,this.processor=null,this.remoteClient=null,this.service=null}initialize(){this._initStores(),this._initSource(),this._updateQueue=new F({concurrency:"stream"===this._source.type?1:4,process:(e,t)=>this._onTileMessage(e,{signal:t})}),this.addHandles([this.tileStore.on("update",this.onTileUpdate.bind(this)),u((()=>!this.updating),(()=>this.onIdle()))])}_initSource(){const e=this.tileStore.tileScheme,t=()=>this._updateQueue&&this._updateQueue.length<50,r=(e,t)=>(this._invalidated=!0,this._patchTile(e,t));this._source=S(this.service,this.spatialReference,e,r,t,this.featureStore),this._proxyEvents()}_setStreamClientProperty(e,t){this.remoteClient.invoke("setProperty",{propertyName:e,value:t}).catch(k)}_proxyEvents(){if("stream"===this._source.type){const e=this._source.events,t=this._source;this.addHandles([g((()=>t.connectionStatus),(e=>this._setStreamClientProperty("pipelineConnectionStatus",e)),{initial:!0}),g((()=>t.errorString),(e=>this._setStreamClientProperty("pipelineErrorString",e)),{initial:!0}),e.on("data-received",(e=>this.remoteClient.invoke("emitEvent",{name:"data-received",event:{attributes:e.attributes,centroid:e.centroid,geometry:e.geometry}}).catch(k))),e.on("message-received",(e=>this.remoteClient.invoke("emitEvent",{name:"message-received",event:e}).catch(k))),e.on("updateRate",(e=>this.remoteClient.invoke("emitEvent",{name:"update-rate",event:{...e}}).catch(k)))])}}_initAttributeStore(e){this.attributeStore||(this.attributeStore=new _({type:"remote",initialize:(e,t)=>s(this.remoteClient.invoke(w,e,{signal:t}).catch(k)),update:(e,t)=>s(this.remoteClient.invoke(T,e,{signal:t}).catch(k)),render:e=>s(this.remoteClient.invoke(j,void 0,{signal:e}).catch(k))},e))}_initStores(){const e="snapshot"===this.service.type?"snapshot":"on-demand",t={geometryInfo:{geometryType:this.service.geometryType,hasM:!1,hasZ:!1},spatialReference:this.spatialReference,fieldsIndex:this.fieldsIndex,fields:this.service.fields};this.featureStore=new m(t,this._storage,e)}_initQueryEngine(e){const t=this;this.featureQueryEngine?.destroy(),this.featureQueryEngine=new y({definitionExpression:e.schema.source.definitionExpression??void 0,fields:this.service.fields,geometryType:this.service.geometryType,objectIdField:this.service.objectIdField,hasM:!1,hasZ:!1,spatialReference:this.spatialReference.toJSON(),cacheSpatialQueries:!0,featureStore:this.featureStore,aggregateAdapter:{getFeatureObjectIds(e){if(null==t.aggregateStore)return[];return t.aggregateStore.getFeatureDisplayIdsForAggregate(e).map((e=>t.getObjectId(e)))}},timeInfo:this.service.timeInfo})}_initAggregateQueryEngine(e,t){if(this.aggregateQueryEngine?.destroy(),null==e)return;const r=t.targets.aggregate.params.fields.slice();this.aggregateQueryEngine=new y({definitionExpression:void 0,fields:r,geometryType:e.geometryInfo.geometryType,objectIdField:e.objectIdField,hasM:e.geometryInfo.hasM,hasZ:e.geometryInfo.hasZ,spatialReference:this.spatialReference.toJSON(),cacheSpatialQueries:!1,featureStore:e,aggregateAdapter:{getFeatureObjectIds:e=>[]}})}destroy(){this._updateQueue.destroy(),this._source.destroy(),this.featureQueryEngine?.destroy(),this.aggregateQueryEngine?.destroy(),this.attributeStore?.destroy();for(const e of this.tileStore.tiles)this._source.unsubscribe(e);clearInterval(this._checkUpdating),this._updatingHandles.destroy()}get fieldsIndex(){return new f(this.service.fields)}get spatialReference(){return this.tileStore.tileScheme.spatialReference}get dataUpdating(){return this._source.updatingHandles.updating}get updating(){return this.isUpdating()}isUpdating(){const e=this._source.updatingHandles.updating,t=!this.attributeStore||this.attributeStore.updatingHandles.updating,r=e||t||this._updatingHandles.updating;if(has("esri-2d-log-updating")){let s=`Updating FeatureController2D: ${r}\n`;s+=` -> updatingSource ${e}\n`;for(const e of this._source.subscriptions)s+=` ${e.tile.id} ${e.isDone}\n`;s+=` -> updatingAttributeStore ${t}\n`,s+=` -> updatingHandles ${this._updatingHandles.updating} (queue: ${this._updateQueue.length})\n`,console.log(s)}return r}updateCustomParameters(e){"stream"===this._source.type&&this._source.updateCustomParameters(e)}enableEvent(e){this._source.enableEvent(e.name,e.value)}pause(){this._updateQueue.pause(),this._updateQueue.clear()}resume(){this._updateQueue.resume()}pauseStream(){"stream"===this._source.type&&this._source.pauseStream()}resumeStream(){"stream"===this._source.type&&this._source.resumeStream()}sendMessageToSocket(e){"stream"===this._source.type&&this._source.sendMessageToSocket(e)}sendMessageToClient(e){"stream"===this._source.type&&this._source.sendMessageToClient(e)}_initAggregateStore(e){const t=e.schema.targets?.aggregate?.type??null;if((this.config?.schema.targets?.aggregate?.type??null)!==t&&(null!=this.aggregateStore&&(this.removeHandles("valueRangesChanged"),this.aggregateStore.destroy(),this.aggregateStore=null),t)){switch(t){case"cluster":{const e={geometryInfo:{geometryType:"esriGeometryPoint",hasM:!1,hasZ:!1},spatialReference:this.spatialReference,fieldsIndex:this.fieldsIndex,fields:this.service.fields};this.aggregateStore=new v(e,this.spatialReference,this._storage,this.service),this.addHandles(this.aggregateStore.events.on("valueRangesChanged",(e=>{this.remoteClient.invoke("emitEvent",{name:"valueRangesChanged",event:{valueRanges:e.valueRanges}}).catch(k)})),"valueRangesChanged");break}case"bin":{const e={geometryInfo:{geometryType:"esriGeometryPolygon",hasM:!1,hasZ:!1},spatialReference:this.spatialReference,fieldsIndex:this.fieldsIndex,fields:this.service.fields};this.aggregateStore=new b(e,this.spatialReference,this._storage,this.service);break}}this.aggregateStore.onTileUpdate({added:this.tileStore.tiles,removed:[]})}}async update(e,t){this._updateVersion++,has("esri-2d-update-debug")&&console.debug(`FeatureController2D::update: Token version ${this._updateVersion}`),this._initQueryEngine(t),this._initAttributeStore(t),this.pause(),await Promise.all([this._source.update(e,t.schema.source),this.featureStore.updateSchema(e,t.schema.targets.feature),this.attributeStore.update(e,t),this.attributeStore.updateFilters(e,t,this)]),this._initAggregateStore(t),null!=this.aggregateStore&&await this.aggregateStore.updateSchema(e,t.schema.targets.aggregate),this._initAggregateQueryEngine(this.aggregateStore,t.schema),has("esri-2d-update-debug")&&e.describe(),this._set("config",t)}async applyUpdate(e){e.version=this._updateVersion,has("esri-2d-update-debug")&&console.debug(`FeatureController2D::applyUpdate: Token version ${e.version}`),e.mesh&&this.clearTiles(),this._updateQueue.resume(),await this._source.applyUpdate(e),has("esri-2d-update-debug")&&console.debug("FeatureController2D::applyUpdate Waiting for source update to finish"),this.notifyChange("updating"),await l((()=>!this.updating)),has("esri-2d-update-debug")&&console.debug("FeatureController2D::applyUpdate Source update finsihed"),null!=this.aggregateStore&&(await i(10),has("esri-2d-update-debug")&&console.debug("FeatureController2D::applyUpdate Waiting for aggregate idle call"),await l((()=>!this.updating)),has("esri-2d-update-debug")&&console.debug("FeatureController2D::applyUpdate Aggregate idle called")),has("esri-2d-update-debug")&&console.debug("FeatureController2D::applyUpdate Update finished")}async onEdits({edits:e}){has("esri-2d-update-debug")&&console.debug("Applying Edit:",e),this._didEdit=!0;try{const t=e.removed.map((e=>e.objectId&&-1!==e.objectId?e.objectId:this._lookupObjectIdByGlobalId(e.globalId))),r=e.addOrModified.map((({objectId:e})=>e));this.featureStore.invalidate(),await this._source.edit(r,t),this.clearTiles(),this.notifyChange("updating"),null!=this.aggregateStore&&this.aggregateStore.clear(),await this._source.resend(),await l((()=>!this.updating))}catch(t){}}async refresh(e){if(!e.dataChanged){const e=C.empty();return e.storage.filters=!0,this.applyUpdate(e)}this.featureStore.invalidate(),this.clearTiles(),this._source.refresh(this._updateVersion,e),this._cleanupNeeded=!0,this.notifyChange("updating"),await l((()=>!this.updating))}clearTiles(){for(const e of this.tileStore.tiles)this.processor.onTileClear(e,!1)}onTileUpdate(e){null!=this.aggregateStore&&this.aggregateStore.onTileUpdate(e);for(const t of e.added){const e=this._source.subscribe(t,this._updateVersion);"stream"!==this._source.type&&this._updatingHandles.addPromise(e.done),this._level=t.level}for(const t of e.removed)this._source.unsubscribe(t),this._cleanupNeeded=!0,this._tileToResolver.has(t.id)&&(this._tileToResolver.get(t.id).resolve(),this._tileToResolver.delete(t.id));this.notifyChange("updating")}async onIdle(){this._invalidated&&(this._invalidated=!1,null==this.aggregateStore&&"heatmap"!==this.processor.type||await this._repushCurrentLevelTiles()),this._markAndSweep()}async querySummaryStatistics({query:e,params:t}){return this.featureQueryEngine.executeQueryForSummaryStatistics(e,t)}async queryAggregateSummaryStatistics({query:e,params:t}){return this.aggregateQueryEngine.executeQueryForSummaryStatistics(this._normalizeAggregateQuery(e),t)}async queryUniqueValues({query:e,params:t}){return this.featureQueryEngine.executeQueryForUniqueValues(e,t)}async queryAggregateUniqueValues({query:e,params:t}){return this.aggregateQueryEngine.executeQueryForUniqueValues(this._normalizeAggregateQuery(e),t)}async queryClassBreaks({query:e,params:t}){return this.featureQueryEngine.executeQueryForClassBreaks(e,t)}async queryAggregateClassBreaks({query:e,params:t}){return this.aggregateQueryEngine.executeQueryForClassBreaks(this._normalizeAggregateQuery(e),t)}async queryHistogram({query:e,params:t}){return this.featureQueryEngine.executeQueryForHistogram(e,t)}async queryAggregateHistogram({query:e,params:t}){return this.aggregateQueryEngine.executeQueryForHistogram(this._normalizeAggregateQuery(e),t)}queryExtent(e){return this.featureQueryEngine.executeQueryForExtent(e)}queryAggregates(e){return this.aggregateQueryEngine.executeQuery(this._normalizeAggregateQuery(e))}queryAggregateCount(e){return this.aggregateQueryEngine.executeQueryForCount(this._normalizeAggregateQuery(e))}queryAggregateIds(e){return this.aggregateQueryEngine.executeQueryForIds(this._normalizeAggregateQuery(e))}queryFeatures(e){return this.featureQueryEngine.executeQuery(e)}async queryVisibleFeatures(e){const t=await this.featureQueryEngine.executeQuery(e),r=t.objectIdFieldName;return t.features=t.features.filter((e=>{const t=e.attributes[r],s=this.getDisplayId(t);return null!=s&&this.attributeStore.isVisible(s)})),t}queryFeatureCount(e){return this.featureQueryEngine.executeQueryForCount(e)}queryLatestObservations(e){return this.featureQueryEngine.executeQueryForLatestObservations(e)}queryObjectIds(e){return this.featureQueryEngine.executeQueryForIds(e)}async queryStatistics(){return this.featureStore.storeStatistics}getObjectId(e){return this.featureStore.lookupObjectId(e,this._storage)}getDisplayId(e){if(null!=this.aggregateStore){const t=this.aggregateStore.getDisplayId(e);if(null==t){const t=this.featureStore.lookupDisplayId(e);return this.aggregateStore.getDisplayIdForReferenceId(t)}return t}return this.featureStore.lookupDisplayId(e)}getFeatures(e){const t=[],r=[];for(const s of e){const e=null!=this.aggregateStore?this.getAggregate(s):null;if(null!=e)if(null!=e.attributes.referenceId){const r=this.getFeature(e.attributes.referenceId);null!=r&&t.push(r)}else r.push(e);else{const e=this.getFeature(s);null!=e&&t.push(e)}}return{features:t,aggregates:r}}getFeature(e){const t=this.featureStore.lookupFeatureByDisplayId(e,this._storage);if(null==t)return null;const r=t.readHydratedGeometry(),s=p(r,t.geometryType,t.hasZ,t.hasM);return{attributes:t.readAttributes(),geometry:s}}getAggregate(e){return null==this.aggregateStore?null:this.aggregateStore.getAggregate(e)}getAggregates(){return null==this.aggregateStore?[]:this.aggregateStore.getAggregates()}async setHighlight(e){const t=e.map((e=>this.getDisplayId(e))).filter(r);return this.attributeStore.setHighlight(e,t)}_normalizeAggregateQuery(e){const t=e.objectIds??[];for(const r of e.aggregateIds??[])t.push(r);return e.objectIds=t,e.aggregateIds=[],e}_lookupObjectIdByGlobalId(e){const t=this.service.globalIdField;if(null==t)throw new Error("Expected globalIdField to be defined");let r=null;if(this.featureStore.forEach((s=>{e===s.readAttribute(t)&&(r=s.getObjectId())})),null==r)throw new Error(`Expected to find a feature with globalId ${e}`);return r}async _repushCurrentLevelTiles(){const e=this.tileStore.tiles.filter((e=>e.level===this._level));e.map((async e=>this._patchTile({type:"append",id:e.key.id,clear:!0,addOrUpdate:null,end:!1})));const t=e.map((async e=>this._patchTile({type:"append",id:e.key.id,addOrUpdate:Q.fromOptimizedFeatures([],this.service),remove:[],end:!0,isRepush:!0,status:C.empty()})));await Promise.all(t)}_maybeForceCleanup(){performance.now()-this._lastCleanup>E&&this._markAndSweep()}_patchTile(e,t){const r=this._updateQueue.push(e,t).catch((e=>{}));return this._updatingHandles.addPromise(r)}async _onTileMessage(e,t){if(a(t),has("esri-2d-update-debug")){const t=e.addOrUpdate?.hasFeatures;console.debug(e.id,`FeatureController:onTileMessage: [clear:${e.clear}, end:${e.end}, features: ${t}]`)}const r=this.tileStore.get(e.id);if(!r)return;if(e.clear)return this.processor.onTileClear(r,e.end);const s=e.status;this._cleanupNeeded=!0;const i=[];for(const a of e.remove??[]){const e=this.featureStore.lookupDisplayId(a);e&&i.push(e)}e.remove=i;try{if(null==e.addOrUpdate)return void this.processor.onTileMessage(r,{...e,addOrUpdate:null},null!=this.aggregateStore,t).catch(o);if(e.addOrUpdate.setArcadeSpatialReference(this.spatialReference),this.featureStore.hasInstance(e.addOrUpdate.instance)&&s.targets.feature||(s.targets.feature=!0,this.featureStore.onTileData(r,e)),!s.storage.data||!s.storage.filters){s.storage.data=!0,s.storage.filters=!0,this.attributeStore.onTileData(r,e);"stream"===this._source.type||this._didEdit?(await this.attributeStore.sendUpdates(),a(t)):this.attributeStore.sendUpdates()}if(null!=this.aggregateStore&&!s.targets.aggregate){s.targets.aggregate=!0;const t=U(this._source)&&this._source.loading,i=!U(this._source)||t||e.end;if(this.aggregateStore.onTileData(r,e,this._storage,this.attributeStore,i),!i)return;s.mesh||(this.attributeStore.onTileData(r,e),await this.attributeStore.sendUpdates())}if(!s.mesh){s.mesh=!0;const i=null!=this.aggregateStore&&"cluster"===this.aggregateStore.type;await this.processor.onTileMessage(r,e,i,t),a(t)}this._maybeForceCleanup()}catch(n){o(n)}}_mark(e,t,r){const s=(4294901760&this._storage.getInstanceId(e))>>>16;e&&(t.add(s),r.set(e))}_markAndSweep(){this._lastCleanup=performance.now();if(!(!("feature"===this._source.type&&"snapshot"===this._source.mode)&&("stream"===this._source.type||this._cleanupNeeded)))return;this._cleanupNeeded=!1;const e=this._storage.getBitset(this._markedIdsBufId),t=new Set;e.clear();for(const r of this.tileStore.tiles)for(const s of this._source.readers(r.id)){const r=s.getCursor();for(;r.next();){let s=r.getDisplayId();if(!s){const e=r.getObjectId();s=this.featureStore.lookupDisplayId(e)}this._mark(s,t,e)}}"symbol"===this.processor.type&&this.processor.forEachBufferId((r=>{this._mark(r,t,e)})),this._updateQueue.forEach((r=>{for(const s of r.remove??[]){const r=this.featureStore.lookupDisplayId(s);this._mark(r,t,e)}})),null!=this.aggregateStore&&(this.aggregateStore.sweepFeatures(e,this.featureStore),"sweepAggregates"in this.aggregateStore&&this.aggregateStore.sweepAggregates(this._storage,this.attributeStore,this._level)),this.featureStore.sweepFeatures(e,this._storage,this.attributeStore),this.featureStore.sweepFeatureSets(t)}};e([d({constructOnly:!0})],x.prototype,"tileStore",void 0),e([d()],x.prototype,"config",void 0),e([d({readOnly:!0})],x.prototype,"fieldsIndex",null),e([d()],x.prototype,"processor",void 0),e([d({constructOnly:!0})],x.prototype,"remoteClient",void 0),e([d({constructOnly:!0})],x.prototype,"service",void 0),e([d()],x.prototype,"spatialReference",null),e([d()],x.prototype,"dataUpdating",null),e([d()],x.prototype,"updating",null),x=e([h("esri.views.2d.layers.features.controllers.FeatureController2D")],x);const R=x;export{R as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.28/esri/copyright.txt for details.
4
4
  */
5
- import e from"../../../../../request.js";import t from"../../../../../core/Error.js";import has from"../../../../../core/has.js";import r from"../../../../../core/Logger.js";import{throwIfAborted as s,isAbortError as i}from"../../../../../core/promiseUtils.js";import{createSourceAdapter as a}from"../controllers/support/sourceAdapters.js";import{DataTileSource as o}from"./DataTileSource.js";import{QueueProcessor as n}from"../../../../support/QueueProcessor.js";const u=4;class c extends o{constructor(e){super(e),this.type="feature",this.mode="on-demand",this._adapter=a(e.serviceInfo),this._queue=new n({concurrency:8,process:async e=>{if(s(e),null!=e.tile){const t=e.tile.key.id,{signal:r}=e,s=has("esri-tiles-debug")?{tile:t.replaceAll("/","."),depth:e.depth}:void 0,i=await this._adapter.executeQuery(e.query,{signal:r,query:{...s,...this._schema?.customParameters}});return i.level=e.tile.key.level,i}return this._adapter.executeQuery(e.query,{...e,query:this._schema?.customParameters})}}),this._patchQueue=new n({concurrency:8,process:async e=>{if(s(e),null!=e.tile){const t=e.tile.key.id,{signal:r}=e,s=has("esri-tiles-debug")?{tile:t.replaceAll("/","."),depth:e.depth}:void 0,i=await this._adapter.executeQuery(e.query,{signal:r,query:{...s,...this._schema?.customParameters}});return i.level=e.tile.key.level,i}return this._adapter.executeQuery(e.query,{...e,query:this._schema?.customParameters})}})}destroy(){super.destroy(),this._adapter.destroy(),this._queue.destroy(),this._patchQueue.destroy()}enqueueQuery(e,t){return this.updatingHandles.addPromise(this._queue.push(e,t))}enqueuePatchQuery(e,t){return this.updatingHandles.addPromise(this._patchQueue.push(e,t))}get maxRecordCountFactor(){const{query:e}=this._serviceInfo.capabilities;return e.supportsMaxRecordCountFactor?u:null}get maxPageSize(){const{query:e}=this._serviceInfo.capabilities;return(e.maxRecordCount??8e3)*(this.maxRecordCountFactor??1)}get pageSize(){return Math.min(8e3,this.maxPageSize)}enableEvent(e,t){}subscribe(e,s){super.subscribe(e,s),this._fetchDataTile(e).catch((s=>{i(s)||r.getLogger("esri.views.2d.layers.features.sources.BaseFeatureSource").error(new t("mapview-query-error","Encountered error when fetching tile",{tile:e,error:s}))}))}unsubscribe(e){super.unsubscribe(e)}readers(e){return this._subscriptions.get(e).readers()}async query(e,t={}){const r=t.query??{};return this._adapter.executeQuery(e,{...t,query:{...r,...this._schema?.customParameters}})}async queryLastEditDate(){const t=this._serviceInfo.source,r={...t.query,f:"json"};return(await e(t.path,{query:r,responseType:"json"})).data.editingInfo.lastEditDate}createTileQuery(e,t={}){const r=this._serviceInfo.geometryType,s=this.createQuery(t);s.quantizationParameters=t.quantizationParameters??e.getQuantizationParameters(),s.resultType="tile",s.geometry=e.extent,this._serviceInfo.capabilities.query.supportsQuantization?"esriGeometryPolyline"===r&&(s.maxAllowableOffset=e.resolution*has("feature-polyline-generalization-factor")):"esriGeometryPolyline"!==r&&"esriGeometryPolygon"!==r||(s.maxAllowableOffset=e.resolution,"esriGeometryPolyline"===r&&(s.maxAllowableOffset*=has("feature-polyline-generalization-factor")));const i=this._serviceInfo.capabilities.query;return s.defaultSpatialReferenceEnabled=i.supportsDefaultSpatialReference,s.compactGeometryEnabled=i.supportsCompactGeometry,s}async _executePatchQuery(e,t,r,s){const i=t.clone();i.outFields=[this._serviceInfo.objectIdField,...r],i.returnCentroid=!1,i.returnGeometry=!1;const a=null!=i.start?i.start/8e3:0,o=s.signal;return await this.enqueuePatchQuery({tile:e,query:i,signal:o,depth:a})}async _resend(e,t){const{query:r,message:i}=e,a=null!=r.outFields?r.outFields:[],o=this._queryInfo.outFields,n=o.filter((e=>!a.includes(e)));if(null!=i.addOrUpdate)if(n.length)try{const e=this._subscriptions.get(i.id).tile,a=await this._executePatchQuery(e,r,n,t);s(t),r.outFields=o,i.addOrUpdate.joinAttributes(a),this._onMessage({...i,end:i.end,type:"append"})}catch(u){}else this._onMessage({...i,type:"append"});else this._onMessage({...i,type:"append"})}async _resendSubscription(e){if(has("esri-2d-update-debug")&&console.debug(e.tile.id,"Resend Subscription"),e.empty)return this._onMessage({id:e.tile.id,addOrUpdate:null,end:!1,type:"append"});const t=e.signal;for(const r of e.requests.done)await this._resend(r,{signal:t});return null!=e.edits?this._onMessage(e.edits):void 0}async resend(){const e=Array.from(this._subscriptions.values());await Promise.all(e.map((e=>this._resendSubscription(e))))}}export{c as BaseFeatureSource};
5
+ import e from"../../../../../request.js";import t from"../../../../../core/Error.js";import has from"../../../../../core/has.js";import r from"../../../../../core/Logger.js";import{throwIfAborted as s,isAbortError as i}from"../../../../../core/promiseUtils.js";import{createSourceAdapter as a}from"../controllers/support/sourceAdapters.js";import{DataTileSource as o}from"./DataTileSource.js";import{QueueProcessor as n}from"../../../../support/QueueProcessor.js";const u=4;class c extends o{constructor(e){super(e),this.type="feature",this.mode="on-demand",this._adapter=a(e.serviceInfo),this._queue=new n({concurrency:8,process:async e=>{if(s(e),null!=e.tile){const t=e.tile.key.id,{signal:r}=e,s=has("esri-tiles-debug")?{tile:t.replaceAll("/","."),depth:e.depth}:void 0,i=await this._adapter.executeQuery(e.query,{signal:r,query:{...s,...this._schema?.customParameters}});return i.level=e.tile.key.level,i}return this._adapter.executeQuery(e.query,{...e,query:this._schema?.customParameters})}}),this._patchQueue=new n({concurrency:8,process:async e=>{if(s(e),null!=e.tile){const t=e.tile.key.id,{signal:r}=e,s=has("esri-tiles-debug")?{tile:t.replaceAll("/","."),depth:e.depth}:void 0,i=await this._adapter.executeQuery(e.query,{signal:r,query:{...s,...this._schema?.customParameters}});return i.level=e.tile.key.level,i}return this._adapter.executeQuery(e.query,{...e,query:this._schema?.customParameters})}})}destroy(){super.destroy(),this._adapter.destroy(),this._queue.destroy(),this._patchQueue.destroy()}enqueueQuery(e,t){return this.updatingHandles.addPromise(this._queue.push(e,t))}enqueuePatchQuery(e,t){return this.updatingHandles.addPromise(this._patchQueue.push(e,t))}get maxRecordCountFactor(){const{query:e}=this._serviceInfo.capabilities;return e.supportsMaxRecordCountFactor?u:null}get maxPageSize(){const{query:e}=this._serviceInfo.capabilities;return(e.maxRecordCount??8e3)*(this.maxRecordCountFactor??1)}get pageSize(){return Math.min(8e3,this.maxPageSize)}enableEvent(e,t){}subscribe(e,s){const a=super.subscribe(e,s);return this._fetchDataTile(e).catch((s=>{i(s)||r.getLogger("esri.views.2d.layers.features.sources.BaseFeatureSource").error(new t("mapview-query-error","Encountered error when fetching tile",{tile:e,error:s}))})),a}unsubscribe(e){super.unsubscribe(e)}readers(e){return this._subscriptions.get(e).readers()}async query(e,t={}){const r=t.query??{};return this._adapter.executeQuery(e,{...t,query:{...r,...this._schema?.customParameters}})}async queryLastEditDate(){const t=this._serviceInfo.source,r={...t.query,f:"json"};return(await e(t.path,{query:r,responseType:"json"})).data.editingInfo.lastEditDate}createTileQuery(e,t={}){const r=this._serviceInfo.geometryType,s=this.createQuery(t);s.quantizationParameters=t.quantizationParameters??e.getQuantizationParameters(),s.resultType="tile",s.geometry=e.extent,this._serviceInfo.capabilities.query.supportsQuantization?"esriGeometryPolyline"===r&&(s.maxAllowableOffset=e.resolution*has("feature-polyline-generalization-factor")):"esriGeometryPolyline"!==r&&"esriGeometryPolygon"!==r||(s.maxAllowableOffset=e.resolution,"esriGeometryPolyline"===r&&(s.maxAllowableOffset*=has("feature-polyline-generalization-factor")));const i=this._serviceInfo.capabilities.query;return s.defaultSpatialReferenceEnabled=i.supportsDefaultSpatialReference,s.compactGeometryEnabled=i.supportsCompactGeometry,s}async _executePatchQuery(e,t,r,s){const i=t.clone();i.outFields=[this._serviceInfo.objectIdField,...r],i.returnCentroid=!1,i.returnGeometry=!1;const a=null!=i.start?i.start/8e3:0,o=s.signal;return await this.enqueuePatchQuery({tile:e,query:i,signal:o,depth:a})}async _resend(e,t){const{query:r,message:i}=e,a=null!=r.outFields?r.outFields:[],o=this._queryInfo.outFields,n=o.filter((e=>!a.includes(e)));if(null!=i.addOrUpdate)if(n.length)try{const e=this._subscriptions.get(i.id).tile,a=await this._executePatchQuery(e,r,n,t);s(t),r.outFields=o,i.addOrUpdate.joinAttributes(a),this._onMessage({...i,end:i.end,type:"append"})}catch(u){}else this._onMessage({...i,type:"append"});else this._onMessage({...i,type:"append"})}async _resendSubscription(e){if(has("esri-2d-update-debug")&&console.debug(e.tile.id,"Resend Subscription"),e.empty)return this._onMessage({id:e.tile.id,addOrUpdate:null,end:!1,type:"append"});const t=e.signal;for(const r of e.requests.done)await this._resend(r,{signal:t});return null!=e.edits?this._onMessage(e.edits):void 0}async resend(){const e=Array.from(this._subscriptions.values());await Promise.all(e.map((e=>this._resendSubscription(e))))}}export{c as BaseFeatureSource};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.28/esri/copyright.txt for details.
4
4
  */
5
- import e from"../../../../../TimeExtent.js";import s from"../../../../../core/Evented.js";import has from"../../../../../core/has.js";import{createResolver as t,ignoreAbortErrors as i,eachAlwaysValues as r}from"../../../../../core/promiseUtils.js";import{diff as o,hasDiff as n,hasDiffAny as u}from"../../../../../core/accessorSupport/diffUtils.js";import{UpdatingHandles as a}from"../../../../../core/support/UpdatingHandles.js";import{isHostedAgolService as c}from"../../../../../layers/support/arcgisLayerUrl.js";import d from"../../../../../rest/support/Query.js";import{DataTileSubscription as h}from"./DataTileSubscription.js";import{UpdateToken as l}from"../support/UpdateToken.js";function p(e,s){const t=new Set;return e&&e.forEach((e=>t.add(e))),s&&s.forEach((e=>t.add(e))),t.has("*")?["*"]:Array.from(t)}class m{constructor(e){this.updatingHandles=new a,this.events=new s,this._resolver=t(),this._didEdit=!1,this._subscriptions=new Map,this._outSR=e.outSR,this._serviceInfo=e.serviceInfo,this._onTileUpdateMessage=e.onMessage}destroy(){for(const e of this._subscriptions.values())e.abort();this.updatingHandles.destroy()}get subscriptions(){return this._subscriptions.values()}async _onMessage(e){const s=this._subscriptions.get(e.id);if(!s)return;const t={...e,remove:e.remove??[],status:e.status??l.empty()};return i(this._onTileUpdateMessage(t,s.options))}update(s,t){const i=t.fields.length;t.outFields=p(this._schema?.outFields,t.outFields),t.outFields=t.outFields.length>=.75*i?["*"]:t.outFields,t.outFields.sort();const r=o(this._schema,t);if(!r)return;has("esri-2d-update-debug")&&console.debug("Applying Update - Source:",r);const a="orderByFields"in this._serviceInfo&&this._serviceInfo.orderByFields?this._serviceInfo.orderByFields:this._serviceInfo.objectIdField+" ASC",d=this._serviceInfo.source,h={returnCentroid:!(null!==d&&"object"==typeof d&&"path"in d&&c(d.path))&&"esriGeometryPolygon"===this._serviceInfo.geometryType,returnGeometry:!0,timeReferenceUnknownClient:"stream"!==this._serviceInfo.type&&this._serviceInfo.timeReferenceUnknownClient,outFields:t.outFields,outSpatialReference:this._outSR,orderByFields:[a],where:t.definitionExpression||"1=1",gdbVersion:t.gdbVersion,historicMoment:t.historicMoment,timeExtent:t.timeExtent?e.fromJSON(t.timeExtent):null},l=this._schema&&n(r,"outFields");this._schema&&u(r,["timeExtent","definitionExpression","gdbVersion","historicMoment","customParameters"])&&(s.why.mesh.push("Layer filter and/or custom parameters changed"),s.why.source.push("Layer filter and/or custom parameters changed"),s.mesh=!0,s.source=!0,s.queryFilter=!0),l&&(s.why.source.push("Layer required fields changed"),s.source=!0),o(h,this._queryInfo)&&(this._queryInfo=h),this._schema=t,this._resolver.resolve()}whenInitialized(){return this._resolver.promise}async applyUpdate(e){if(e.queryFilter||e.source&&this._didEdit)return this.refresh(e.version),void(this._didEdit=!1);this._subscriptions.forEach((s=>s.applyUpdate(e))),await this.resend()}refresh(e,s){for(const t of this._tiles())this.unsubscribe(t),this.subscribe(t,e)}subscribe(e,s){const t=new h(e,s);this._subscriptions.set(e.id,t),this.updatingHandles.addPromise(t.done)}unsubscribe(e){const s=this.getSubscription(e.id);null!=s&&s.abort(),this._subscriptions.delete(e.id)}createQuery(e={}){const s=this._queryInfo.historicMoment?new Date(this._queryInfo.historicMoment):null;return new d({...this._queryInfo,historicMoment:s,...e})}getSubscription(e){return this._subscriptions.has(e)?this._subscriptions.get(e):null}async queryLastEditDate(){throw new Error("Service does not support query type")}async query(e,s){throw new Error("Service does not support query")}*_tiles(){const e=Array.from(this._subscriptions.values());for(const s of e)yield s.tile}async edit(e,s){return this.updatingHandles.addPromise(this._edit(e,s))}async _edit(e,s){const t=Array.from(this._subscriptions.values()),i=t.map((({tile:e})=>e));for(const r of t)r.removeIds(s);if(e.length){const t=i.map((s=>{const t=this.createTileQuery(s);return t.objectIds=e,{tile:s,query:t}})).map((async({tile:e,query:s})=>({tile:e,result:await this.query(s,{query:{tile:has("esri-tiles-debug")?e.id.replaceAll("/","."):void 0}}),query:s}))),o=(await r(t)).map((async({tile:t,result:i})=>{if(!i.hasFeatures&&!s.length&&!e.length)return;const r=this._subscriptions.get(t.key.id);r&&r.edit(i,e)}));await Promise.allSettled(o)}this._didEdit=!0}}export{m as DataTileSource};
5
+ import e from"../../../../../TimeExtent.js";import s from"../../../../../core/Evented.js";import has from"../../../../../core/has.js";import{createResolver as t,ignoreAbortErrors as i,eachAlwaysValues as r}from"../../../../../core/promiseUtils.js";import{diff as o,hasDiff as n,hasDiffAny as u}from"../../../../../core/accessorSupport/diffUtils.js";import{UpdatingHandles as c}from"../../../../../core/support/UpdatingHandles.js";import{isHostedAgolService as a}from"../../../../../layers/support/arcgisLayerUrl.js";import d from"../../../../../rest/support/Query.js";import{DataTileSubscription as h}from"./DataTileSubscription.js";import{UpdateToken as l}from"../support/UpdateToken.js";function p(e,s){const t=new Set;return e&&e.forEach((e=>t.add(e))),s&&s.forEach((e=>t.add(e))),t.has("*")?["*"]:Array.from(t)}class m{constructor(e){this.updatingHandles=new c,this.events=new s,this._resolver=t(),this._didEdit=!1,this._subscriptions=new Map,this._outSR=e.outSR,this._serviceInfo=e.serviceInfo,this._onTileUpdateMessage=e.onMessage}destroy(){for(const e of this._subscriptions.values())e.abort();this.updatingHandles.destroy()}get subscriptions(){return this._subscriptions.values()}async _onMessage(e){const s=this._subscriptions.get(e.id);if(!s)return;const t={...e,remove:e.remove??[],status:e.status??l.empty()};return i(this._onTileUpdateMessage(t,s.options))}update(s,t){const i=t.fields.length;t.outFields=p(this._schema?.outFields,t.outFields),t.outFields=t.outFields.length>=.75*i?["*"]:t.outFields,t.outFields.sort();const r=o(this._schema,t);if(!r)return;has("esri-2d-update-debug")&&console.debug("Applying Update - Source:",r);const c="orderByFields"in this._serviceInfo&&this._serviceInfo.orderByFields?this._serviceInfo.orderByFields:this._serviceInfo.objectIdField+" ASC",d=this._serviceInfo.source,h={returnCentroid:!(null!==d&&"object"==typeof d&&"path"in d&&a(d.path))&&"esriGeometryPolygon"===this._serviceInfo.geometryType,returnGeometry:!0,timeReferenceUnknownClient:"stream"!==this._serviceInfo.type&&this._serviceInfo.timeReferenceUnknownClient,outFields:t.outFields,outSpatialReference:this._outSR,orderByFields:[c],where:t.definitionExpression||"1=1",gdbVersion:t.gdbVersion,historicMoment:t.historicMoment,timeExtent:t.timeExtent?e.fromJSON(t.timeExtent):null},l=this._schema&&n(r,"outFields");this._schema&&u(r,["timeExtent","definitionExpression","gdbVersion","historicMoment","customParameters"])&&(s.why.mesh.push("Layer filter and/or custom parameters changed"),s.why.source.push("Layer filter and/or custom parameters changed"),s.mesh=!0,s.source=!0,s.queryFilter=!0),l&&(s.why.source.push("Layer required fields changed"),s.source=!0),o(h,this._queryInfo)&&(this._queryInfo=h),this._schema=t,this._resolver.resolve()}whenInitialized(){return this._resolver.promise}async applyUpdate(e){if(e.queryFilter||e.source&&this._didEdit)return this.refresh(e.version),void(this._didEdit=!1);this._subscriptions.forEach((s=>s.applyUpdate(e))),await this.resend()}refresh(e,s){for(const t of this._tiles())this.unsubscribe(t),this.subscribe(t,e)}subscribe(e,s){const t=new h(e,s);return this._subscriptions.set(e.id,t),t}unsubscribe(e){const s=this.getSubscription(e.id);null!=s&&s.abort(),this._subscriptions.delete(e.id)}createQuery(e={}){const s=this._queryInfo.historicMoment?new Date(this._queryInfo.historicMoment):null;return new d({...this._queryInfo,historicMoment:s,...e})}getSubscription(e){return this._subscriptions.has(e)?this._subscriptions.get(e):null}async queryLastEditDate(){throw new Error("Service does not support query type")}async query(e,s){throw new Error("Service does not support query")}*_tiles(){const e=Array.from(this._subscriptions.values());for(const s of e)yield s.tile}async edit(e,s){return this.updatingHandles.addPromise(this._edit(e,s))}async _edit(e,s){const t=Array.from(this._subscriptions.values()),i=t.map((({tile:e})=>e));for(const r of t)r.removeIds(s);if(e.length){const t=i.map((s=>{const t=this.createTileQuery(s);return t.objectIds=e,{tile:s,query:t}})).map((async({tile:e,query:s})=>({tile:e,result:await this.query(s,{query:{tile:has("esri-tiles-debug")?e.id.replaceAll("/","."):void 0}}),query:s}))),o=(await r(t)).map((async({tile:t,result:i})=>{if(!i.hasFeatures&&!s.length&&!e.length)return;const r=this._subscriptions.get(t.key.id);r&&r.edit(i,e)}));await Promise.allSettled(o)}this._didEdit=!0}}export{m as DataTileSource};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.28/esri/copyright.txt for details.
4
4
  */
5
- import{handlesGroup as e}from"../../../../../core/handleUtils.js";import"../../../../../core/has.js";import{r as t}from"../../../../../chunks/rbush.js";import{convertFromFeature as s,quantizeOptimizedGeometry as i,quantizeX as n,quantizeY as r}from"../../../../../layers/graphics/featureConversionUtils.js";import o from"../../../../../layers/graphics/OptimizedGeometry.js";import{StreamFeatureManager as a}from"../../../../../layers/graphics/data/StreamFeatureManager.js";import{createConnection as d}from"../../../../../layers/graphics/sources/connections/createConnection.js";import{DataTileSource as c}from"./DataTileSource.js";import{StreamConnectionState as h}from"./StreamConnectionState.js";import{FeatureSetReaderJSON as u}from"../support/FeatureSetReaderJSON.js";import{UpdateToken as l}from"../support/UpdateToken.js";const p=2500;function _(e,t){const s=e.weakClone();if(null!=e.geometry){const i=n(t,e.geometry.coords[0]),a=r(t,e.geometry.coords[1]);s.geometry=new o([],[i,a])}return s}function m(e){return"esriGeometryPoint"===e?_:(t,s)=>{const n=t.weakClone(),r=new o,a=!1,d=!1,c=i(r,t.geometry,a,d,e,s,!1,!1);return n.geometry=c,n}}function g(e){return"esriGeometryPoint"===e?e=>null!=e.geometry?{minX:e.geometry.coords[0],minY:e.geometry.coords[1],maxX:e.geometry.coords[0],maxY:e.geometry.coords[1]}:{minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}:e=>{let t=1/0,s=1/0,i=-1/0,n=-1/0;return null!=e.geometry&&e.geometry.forEachVertex(((e,r)=>{t=Math.min(t,e),s=Math.min(s,r),i=Math.max(i,e),n=Math.max(n,r)})),{minX:t,minY:s,maxX:i,maxY:n}}}function y(e,s){const i=t(9,g(s));return i.load(e),i}function f(e,t){return e.search({minX:t.bounds[0],minY:t.bounds[1],maxX:t.bounds[2],maxY:t.bounds[3]})}class v{constructor(e,t){this.onUpdate=e,this._geometryType=t,this._objectIdToFeature=new Map,this._index=null}get _features(){const e=[];return this._objectIdToFeature.forEach((t=>e.push(t))),e}add(e){this._objectIdToFeature.set(e.objectId,e),this._index=null}get(e){return this._objectIdToFeature.has(e)?this._objectIdToFeature.get(e):null}forEach(e){this._objectIdToFeature.forEach(e)}search(e){return this._index||(this._index=y(this._features,this._geometryType)),f(this._index,e)}clear(){this._index=null,this._objectIdToFeature.clear()}removeById(e){const t=this._objectIdToFeature.get(e);return t?(this._objectIdToFeature.delete(e),this._index=null,t):null}update(e,t){this.onUpdate(e,t)}get size(){return this._objectIdToFeature.size}}class I extends c{constructor(t){super(t),this.type="stream",this._updateIntervalId=0,this._level=0,this._isPaused=!1,this._updateInfo={websocket:0,client:0},this._inUpdate=!1;const{outSR:s}=t,{geometryType:i,objectIdField:n,timeInfo:r,purgeOptions:o,source:c,spatialReference:u,serviceFilter:l,maxReconnectionAttempts:_,maxReconnectionInterval:g,updateInterval:y,customParameters:f,enabledEventTypes:I}=t.serviceInfo,b=new v(this._onUpdate.bind(this),i),T=new a(b,n,r,o),j=d(c,u,s,i,l,_,g,f??{});this._connectionState=new h({connection:j}),this._store=b,this._manager=T,this._connection=j,this._quantize=m(i),this._enabledEventTypes=new Set(I),this._handlesGroup=e([this._connection.on("data-received",(e=>this._onFeature(e))),this._connection.on("message-received",(e=>this._onWebSocketMessage(e)))]),this._initUpdateInterval=()=>{let e=performance.now();this._updateIntervalId=setInterval((()=>{const s=performance.now(),i=s-e;if(i>p){e=s;const t=Math.round(this._updateInfo.client/(i/1e3)),n=Math.round(this._updateInfo.websocket/(i/1e3));this._updateInfo.client=0,this._updateInfo.websocket=0,this.events.emit("updateRate",{client:t,websocket:n})}t.canAcceptRequest()&&!this._inUpdate&&this._manager.checkForUpdates()}),y)},this._isPaused=t.serviceInfo.isPaused,this._isPaused||this._initUpdateInterval()}destroy(){super.destroy(),this._clearUpdateInterval(),this._connection.destroy(),this._handlesGroup?.remove()}_fetchDataTile(){}get connectionStatus(){return this._connectionState.connectionStatus}get errorString(){return this._connectionState.errorString}updateCustomParameters(e){this._connection.updateCustomParameters(e)}pauseStream(){this._isPaused||(this._isPaused=!0,this._clearUpdateInterval())}resumeStream(){this._isPaused&&(this._isPaused=!1,this._initUpdateInterval())}sendMessageToSocket(e){this._connection.sendMessageToSocket(e)}sendMessageToClient(e){this._isPaused&&"type"in e&&"clear"===e.type?(this._store.clear(),this._subscriptions.forEach(((e,t)=>{e.didSend&&e.tile.level===this._level&&this._onMessage({type:"append",id:t,addOrUpdate:null,clear:!0,end:!0})}))):this._connection.sendMessageToClient(e)}enableEvent(e,t){t?this._enabledEventTypes.add(e):this._enabledEventTypes.delete(e)}subscribe(e,t){super.subscribe(e,t);const s=this._subscriptions.get(e.id);s.resolve(),this._level=e.level;const i=this._getTileFeatures(e);this._onMessage({type:"append",id:e.key.id,addOrUpdate:i,end:!0}),s.didSend=!0}unsubscribe(e){super.unsubscribe(e)}*readers(e){const t=this._subscriptions.get(e),{tile:s}=t;yield this._getTileFeatures(s)}createTileQuery(e){throw new Error("Service does not support tile queries")}async resend(){this._subscriptions.forEach((e=>{const{tile:t}=e,s={type:"append",id:t.id,addOrUpdate:this._getTileFeatures(t),end:!0};this._onMessage(s)}))}_getTileFeatures(e){const t=this._store.search(e).map((t=>this._quantize(t,e.transform)));return u.fromOptimizedFeatures(t,this._serviceInfo,e.transform)}_onWebSocketMessage(e){if(this._enabledEventTypes.has("message-received")&&this.events.emit("message-received",e),"type"in e)switch(e.type){case"delete":if(e.objectIds)for(const t of e.objectIds)this._manager.removeById(t);if(e.trackIds)for(const t of e.trackIds)this._manager.removeByTrackId(t);break;case"clear":this._store.forEach((e=>this._manager.removeById(e.objectId)))}}_onFeature(e){this._updateInfo.websocket++;try{this._enabledEventTypes.has("data-received")&&this.events.emit("data-received",e);const t=s(e,this._serviceInfo.geometryType,!1,!1,this._serviceInfo.objectIdField);this._manager.add(t)}catch(t){}}_clearUpdateInterval(){clearInterval(this._updateIntervalId),this._updateIntervalId=0}async _onUpdate(e,t){this._inUpdate=!0;try{null!=e&&(this._updateInfo.client+=e.length),this._subscriptions.forEach(((e,t)=>{e.didSend&&e.tile.level===this._level&&this._onMessage({type:"append",id:t,addOrUpdate:null,clear:!0,end:!1})}));const t=[];this._subscriptions.forEach(((e,s)=>{if(!e.didSend||e.tile.level!==this._level)return;const i=e.tile,n={type:"append",id:s,addOrUpdate:this._getTileFeatures(i),remove:[],end:!1,status:l.empty()};e.requests.stream.enqueue(n),t.push(this._onMessage(n))})),await Promise.all(t),this._subscriptions.forEach(((e,t)=>{e.didSend&&e.tile.level===this._level&&this._onMessage({type:"append",id:t,addOrUpdate:null,end:!0})}))}catch{}this._inUpdate=!1}}export{I as StreamSource};
5
+ import{handlesGroup as e}from"../../../../../core/handleUtils.js";import"../../../../../core/has.js";import{r as t}from"../../../../../chunks/rbush.js";import{convertFromFeature as s,quantizeOptimizedGeometry as i,quantizeX as n,quantizeY as r}from"../../../../../layers/graphics/featureConversionUtils.js";import o from"../../../../../layers/graphics/OptimizedGeometry.js";import{StreamFeatureManager as a}from"../../../../../layers/graphics/data/StreamFeatureManager.js";import{createConnection as d}from"../../../../../layers/graphics/sources/connections/createConnection.js";import{DataTileSource as c}from"./DataTileSource.js";import{StreamConnectionState as h}from"./StreamConnectionState.js";import{FeatureSetReaderJSON as u}from"../support/FeatureSetReaderJSON.js";import{UpdateToken as l}from"../support/UpdateToken.js";const p=2500;function _(e,t){const s=e.weakClone();if(null!=e.geometry){const i=n(t,e.geometry.coords[0]),a=r(t,e.geometry.coords[1]);s.geometry=new o([],[i,a])}return s}function m(e){return"esriGeometryPoint"===e?_:(t,s)=>{const n=t.weakClone(),r=new o,a=!1,d=!1,c=i(r,t.geometry,a,d,e,s,!1,!1);return n.geometry=c,n}}function g(e){return"esriGeometryPoint"===e?e=>null!=e.geometry?{minX:e.geometry.coords[0],minY:e.geometry.coords[1],maxX:e.geometry.coords[0],maxY:e.geometry.coords[1]}:{minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}:e=>{let t=1/0,s=1/0,i=-1/0,n=-1/0;return null!=e.geometry&&e.geometry.forEachVertex(((e,r)=>{t=Math.min(t,e),s=Math.min(s,r),i=Math.max(i,e),n=Math.max(n,r)})),{minX:t,minY:s,maxX:i,maxY:n}}}function y(e,s){const i=t(9,g(s));return i.load(e),i}function f(e,t){return e.search({minX:t.bounds[0],minY:t.bounds[1],maxX:t.bounds[2],maxY:t.bounds[3]})}class v{constructor(e,t){this.onUpdate=e,this._geometryType=t,this._objectIdToFeature=new Map,this._index=null}get _features(){const e=[];return this._objectIdToFeature.forEach((t=>e.push(t))),e}add(e){this._objectIdToFeature.set(e.objectId,e),this._index=null}get(e){return this._objectIdToFeature.has(e)?this._objectIdToFeature.get(e):null}forEach(e){this._objectIdToFeature.forEach(e)}search(e){return this._index||(this._index=y(this._features,this._geometryType)),f(this._index,e)}clear(){this._index=null,this._objectIdToFeature.clear()}removeById(e){const t=this._objectIdToFeature.get(e);return t?(this._objectIdToFeature.delete(e),this._index=null,t):null}update(e,t){this.onUpdate(e,t)}get size(){return this._objectIdToFeature.size}}class I extends c{constructor(t){super(t),this.type="stream",this._updateIntervalId=0,this._level=0,this._isPaused=!1,this._updateInfo={websocket:0,client:0},this._inUpdate=!1;const{outSR:s}=t,{geometryType:i,objectIdField:n,timeInfo:r,purgeOptions:o,source:c,spatialReference:u,serviceFilter:l,maxReconnectionAttempts:_,maxReconnectionInterval:g,updateInterval:y,customParameters:f,enabledEventTypes:I}=t.serviceInfo,b=new v(this._onUpdate.bind(this),i),T=new a(b,n,r,o),j=d(c,u,s,i,l,_,g,f??{});this._connectionState=new h({connection:j}),this._store=b,this._manager=T,this._connection=j,this._quantize=m(i),this._enabledEventTypes=new Set(I),this._handlesGroup=e([this._connection.on("data-received",(e=>this._onFeature(e))),this._connection.on("message-received",(e=>this._onWebSocketMessage(e)))]),this._initUpdateInterval=()=>{let e=performance.now();this._updateIntervalId=setInterval((()=>{const s=performance.now(),i=s-e;if(i>p){e=s;const t=Math.round(this._updateInfo.client/(i/1e3)),n=Math.round(this._updateInfo.websocket/(i/1e3));this._updateInfo.client=0,this._updateInfo.websocket=0,this.events.emit("updateRate",{client:t,websocket:n})}t.canAcceptRequest()&&!this._inUpdate&&this._manager.checkForUpdates()}),y)},this._isPaused=t.serviceInfo.isPaused,this._isPaused||this._initUpdateInterval()}destroy(){super.destroy(),this._clearUpdateInterval(),this._connection.destroy(),this._handlesGroup?.remove()}_fetchDataTile(){}get connectionStatus(){return this._connectionState.connectionStatus}get errorString(){return this._connectionState.errorString}updateCustomParameters(e){this._connection.updateCustomParameters(e)}pauseStream(){this._isPaused||(this._isPaused=!0,this._clearUpdateInterval())}resumeStream(){this._isPaused&&(this._isPaused=!1,this._initUpdateInterval())}sendMessageToSocket(e){this._connection.sendMessageToSocket(e)}sendMessageToClient(e){this._isPaused&&"type"in e&&"clear"===e.type?(this._store.clear(),this._subscriptions.forEach(((e,t)=>{e.didSend&&e.tile.level===this._level&&this._onMessage({type:"append",id:t,addOrUpdate:null,clear:!0,end:!0})}))):this._connection.sendMessageToClient(e)}enableEvent(e,t){t?this._enabledEventTypes.add(e):this._enabledEventTypes.delete(e)}subscribe(e,t){const s=super.subscribe(e,t);this._level=e.level;const i=this._getTileFeatures(e);return this._onMessage({type:"append",id:e.key.id,addOrUpdate:i,end:!0}),s.didSend=!0,s}unsubscribe(e){super.unsubscribe(e)}*readers(e){const t=this._subscriptions.get(e),{tile:s}=t;yield this._getTileFeatures(s)}createTileQuery(e){throw new Error("Service does not support tile queries")}async resend(){this._subscriptions.forEach((e=>{const{tile:t}=e,s={type:"append",id:t.id,addOrUpdate:this._getTileFeatures(t),end:!0};this._onMessage(s)}))}_getTileFeatures(e){const t=this._store.search(e).map((t=>this._quantize(t,e.transform)));return u.fromOptimizedFeatures(t,this._serviceInfo,e.transform)}_onWebSocketMessage(e){if(this._enabledEventTypes.has("message-received")&&this.events.emit("message-received",e),"type"in e)switch(e.type){case"delete":if(e.objectIds)for(const t of e.objectIds)this._manager.removeById(t);if(e.trackIds)for(const t of e.trackIds)this._manager.removeByTrackId(t);break;case"clear":this._store.forEach((e=>this._manager.removeById(e.objectId)))}}_onFeature(e){this._updateInfo.websocket++;try{this._enabledEventTypes.has("data-received")&&this.events.emit("data-received",e);const t=s(e,this._serviceInfo.geometryType,!1,!1,this._serviceInfo.objectIdField);this._manager.add(t)}catch(t){}}_clearUpdateInterval(){clearInterval(this._updateIntervalId),this._updateIntervalId=0}async _onUpdate(e,t){this._inUpdate=!0;try{null!=e&&(this._updateInfo.client+=e.length),this._subscriptions.forEach(((e,t)=>{e.didSend&&e.tile.level===this._level&&this._onMessage({type:"append",id:t,addOrUpdate:null,clear:!0,end:!1})}));const t=[];this._subscriptions.forEach(((e,s)=>{if(!e.didSend||e.tile.level!==this._level)return;const i=e.tile,n={type:"append",id:s,addOrUpdate:this._getTileFeatures(i),remove:[],end:!1,status:l.empty()};e.requests.stream.enqueue(n),t.push(this._onMessage(n))})),await Promise.all(t),this._subscriptions.forEach(((e,t)=>{e.didSend&&e.tile.level===this._level&&this._onMessage({type:"append",id:t,addOrUpdate:null,end:!0})}))}catch{}this._inUpdate=!1}}export{I as StreamSource};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.28/esri/copyright.txt for details.
4
4
  */
5
- import e from"../../../../../core/Error.js";import r from"../../../../../core/Logger.js";const t=r.getLogger("esri.views.2d.layers.features.support.whereUtils"),a={getAttribute:(e,r)=>e.field(r)};async function s(r,s){const n=await import("../../../../../core/sql/WhereClause.js");try{const o=n.WhereClause.create(r,s);if(!o.isStandardized){const r=new e("mapview - bad input","Unable to apply filter's definition expression, as expression is not standardized.",o);t.error(r)}return e=>{const r=e.readArcadeFeature();return o.testFeature(r,a)}}catch(o){return t.warn("mapview-bad-where-clause","Encountered an error when evaluating where clause",r),e=>!0}}export{s as createWhereClause};
5
+ import e from"../../../../../core/Error.js";import r from"../../../../../core/Logger.js";import{parseWhereClause as t}from"../../../../../core/sql.js";const a=r.getLogger("esri.views.2d.layers.features.support.whereUtils"),o={getAttribute:(e,r)=>e.field(r)};async function s(r,s){try{const n=await t(r,s);if(!n.isStandardized){const r=new e("mapview - bad input","Unable to apply filter's definition expression, as expression is not standardized.",n);a.error(r)}return e=>{const r=e.readArcadeFeature();return n.testFeature(r,o)}}catch(n){return a.warn("mapview-bad-where-clause","Encountered an error when evaluating where clause",r),e=>!0}}export{s as createWhereClause};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.28/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../../../chunks/tslib.es6.js";import"../../../../../intl.js";import t from"../../../../../core/Accessor.js";import{unitRGBAFromColor as i,multiplyOpacityToUnitRGBA as r,getContrast as s,multiplyOpacity as a}from"../../../../../core/colorUtils.js";import"../../../../../core/has.js";import{nextHighestPowerOfTen as n}from"../../../../../core/mathUtils.js";import{destroyMaybe as o}from"../../../../../core/maybe.js";import{formatDecimal as l}from"../../../../../core/quantityFormatUtils.js";import{toUnit as h}from"../../../../../core/quantityUtils.js";import{watch as c,syncAndInitial as m,initial as d}from"../../../../../core/reactiveUtils.js";import{convertUnit as p,adaptiveImperialAreaUnit as u,adaptiveMetricAreaUnit as g,adaptiveImperialLengthUnit as _,adaptiveMetricLengthUnit as L}from"../../../../../core/unitUtils.js";import{property as v}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/accessorSupport/ensureType.js";import"../../../../../core/arrayUtils.js";import{subclass as b}from"../../../../../core/accessorSupport/decorators/subclass.js";import{d as f}from"../../../../../chunks/mat4.js";import{a as w}from"../../../../../chunks/mat4f64.js";import{f as S}from"../../../../../chunks/vec3.js";import{c as y}from"../../../../../chunks/vec3f64.js";import{midpoint as j}from"../../support/viewUtils.js";import{LabelVisualElement as C}from"../../../interactive/visualElements/LabelVisualElement.js";import{LineVisualElement as A}from"../../../interactive/visualElements/LineVisualElement.js";import{MeasurementAreaVisualElement as D}from"../../../interactive/visualElements/MeasurementAreaVisualElement.js";import{GeodesicSegment as M,EuclideanSegment as P}from"../../../interactive/visualElements/support/Segment.js";import{RenderOccludedFlag as V}from"../../../webgl-engine/lib/Material.js";import{createStipplePatternSimple as x}from"../../../webgl-engine/materials/lineStippleUtils.js";import{onLocaleChange as U}from"../../../../../intl/locale.js";import{fetchMessageBundle as O}from"../../../../../intl/messages.js";let k=class extends t{get _parameters(){const{accentColor:e,textColor:t}=this.view.effectiveTheme,n=i(e),o=r(e,.5),l=r(s(e),.5),h=s(t);return{accentColor:n,transparentAccentColor:o,transparentContrastColor:l,intersectingLineColor:[1,.2,0,1],textColor:t,textBackgroundColor:a(h,.6),textCalloutColor:a(h,.5),pathLineWidth:3,perimeterLineWidth:2,projectionLineWidth:2,projectionLineStippleSize:5,labelDistance:25}}get visible(){return this.analysisViewData.visible}get testData(){return{labels:{area:this._areaLabel,perimeterLength:this._perimeterLengthLabel}}}constructor(e){super(e),this._path=null,this._intersectedPath=null,this._perimeter=null,this._intersectedPerimeter=null,this._projectionLines=null,this._measurementArea=null,this._areaLabel=null,this._perimeterLengthLabel=null,this._pathSegments=[],this._perimeterSegments=[],this._origin=y(),this._originTransform=w(),this.messages=null,this.viewData=z,this.areaLabel=null,this.perimeterLengthLabel=null,this.loadingMessages=!0}initialize(){const{analysisViewData:e,_parameters:t,view:i}=this;this._path=new A({view:i,attached:!0,width:t.pathLineWidth,polygonOffset:!0,renderOccluded:V.OccludeAndTransparent,isDecoration:!0}),this._intersectedPath=new A({view:i,attached:!0,width:t.pathLineWidth,polygonOffset:!0,renderOccluded:V.OccludeAndTransparent,isDecoration:!0}),this._perimeter=new A({view:i,attached:!0,width:t.perimeterLineWidth,polygonOffset:!0,renderOccluded:V.OccludeAndTransparent,isDecoration:!0}),this._intersectedPerimeter=new A({view:i,attached:!0,width:t.perimeterLineWidth,color:t.intersectingLineColor,polygonOffset:!0,renderOccluded:V.OccludeAndTransparent,isDecoration:!0}),this._projectionLines=new A({view:i,attached:!0,width:t.projectionLineWidth,stipplePattern:x(t.projectionLineStippleSize),polygonOffset:!0,renderOccluded:V.OccludeAndTransparent,isDecoration:!0}),this._measurementArea=new D({view:i,attached:!0,isDecoration:!0});const r={attached:!0,view:i,isDecoration:!0};this._areaLabel=new C({...r,fontSize:q.Large}),this._perimeterLengthLabel=new C({...r,fontSize:q.Small}),this.addHandles([c((()=>[e.mode,this.visible,e.unit,e.measurementData,e.stagedPoint]),(()=>this._update()),m),c((()=>i.state?.camera),(()=>this._updateLabels()),m),U((()=>this._updateMessageBundle())),c((()=>this._parameters),(({accentColor:e,transparentAccentColor:t,transparentContrastColor:i,textColor:r,textBackgroundColor:s,textCalloutColor:a})=>{const{_path:n,_intersectedPath:o,_perimeter:l,_projectionLines:h,_measurementArea:c,_areaLabel:m,_perimeterLengthLabel:d}=this;n.color=e,o.color=e,l.color=e,h.color=e,c.color1=t,c.color2=i,m.textColor=r,m.backgroundColor=s,m.calloutColor=a,d.textColor=r,d.backgroundColor=s,d.calloutColor=a}),d)]),this._updateMessageBundle()}destroy(){this._measurementArea=o(this._measurementArea),this._path=o(this._path),this._intersectedPath=o(this._intersectedPath),this._perimeter=o(this._perimeter),this._intersectedPerimeter=o(this._intersectedPerimeter),this._areaLabel=o(this._areaLabel),this._perimeterLengthLabel=o(this._perimeterLengthLabel),this._projectionLines=o(this._projectionLines),this.set("view",null)}_update(){if(this.destroyed||!this.view.ready||!this.view.renderCoordsHelper)return;const{analysisViewData:{measurementData:e},analysisViewData:t}=this;null!=e&&(this._updateViewData(e,t.path,t.stagedPoint),this._updateOrigin(),this._updatePathSegments(),this._updatePerimeterSegments(),this._updateArea(),this._updateProjectionLines(),this._updateLabels())}_updateViewData(e,t,i){const r=e.validMeasurement,s="geodesic"===e.actualMeasurementMode,a=s?e.geodesicArea:e.area;let o=1;if(a){const t=this._toPreferredAreaUnit(a,this.analysisViewData.unit);o=n(Math.sqrt(t.value)/Math.sqrt(300)),o*=Math.sqrt(p(1,t.unit,"square-meters")),o/=e.unitNormalizer.normalizeDistance(1)}const l={validMeasurement:r,numVertices:e.numVertices,hasStagedVertex:e.hasStagedVertex,path:t,pathVersion:t.version,stagedPoint:i,measurementData:e,mode:e.actualMeasurementMode,positionsGeographic:e.positionsGeographic,positionsRenderCoords:e.positionsRenderCoords,positionsProjected:e.positionsProjectedWorldCoords,positionsFittedRenderCoords:e.positionsFittedRenderCoords,intersectingSegments:s?e.geodesicIntersectingSegments:e.intersectingSegments,triangleIndices:s?e.geodesicTriangleIndices:e.triangleIndices,fittingMode:e.fittingMode,areaCentroid:s?e.geodesicAreaCentroidRenderCoords:e.areaCentroidRenderCoords,pathLengthLabelSegmentIndex:r?0:t.numVertices-2,perimeterLengthLabelSegmentIndex:0,checkerSize:o};this._set("viewData",l)}_updateOrigin(){const e=this.viewData;j(e.positionsRenderCoords,this._origin),f(this._originTransform,this._origin),this._measurementArea.transform=this._originTransform,this._projectionLines.transform=this._originTransform}_createSegments(e){const t=this.viewData,i=this.view.renderCoordsHelper.spatialReference,r=t.mode,s=[],a=[],n=[],o=t.numVertices,l=t.validMeasurement?o:o-1;for(let c=0;c<l;++c){const l=t[e][c],h=t[e][(c+1)%o];let m=null;switch(r){case"euclidean":m=new P(l,h);break;case"geodesic":m=new M(l,h,i)}t.intersectingSegments.has(c)?n.push(m):a.push(m),s.push(m)}let h=null;return t.validMeasurement&&t.hasStagedVertex&&l>=2?h=s[s.length-2]:t.hasStagedVertex&&l>=1&&(h=s[s.length-1]),{all:s,nonIntersecting:a,intersecting:n,stagedSegment:h}}_updatePathSegments(){const{visible:e}=this,t=this._createSegments("positionsRenderCoords");this._path.setGeometryFromSegments(t.nonIntersecting,this._origin),this._path.visible=e,this._intersectedPath.setGeometryFromSegments(t.intersecting,this._origin),this._intersectedPath.visible=e,this._pathSegments=t.all}_updatePerimeterSegments(){const e=this.visible&&"euclidean"===this.viewData.mode,t=this._createSegments("positionsFittedRenderCoords");this._perimeter.setGeometryFromSegments(t.nonIntersecting,this._origin),this._perimeter.visible=e,this._intersectedPerimeter.setGeometryFromSegments(t.intersecting,this._origin),this._intersectedPerimeter.visible=e,this._perimeterSegments=t.all}_updateArea(){const e=this.viewData;switch(e.mode){case"euclidean":this._updateAreaEuclidean(e);break;case"geodesic":this._updateAreaGeodesic()}}_updateAreaEuclidean(e){const t=this.visible;e.validMeasurement&&0===e.intersectingSegments.size&&e.triangleIndices?(this._measurementArea.geometry={uv:e.positionsProjected,position:e.positionsFittedRenderCoords,triangleIndices:e.triangleIndices},this._measurementArea.size=[e.checkerSize,e.checkerSize],this._measurementArea.visible=t):this._measurementArea.visible=!1}_updateAreaGeodesic(){this._measurementArea.visible=!1}_updateProjectionLines(){const e=this.viewData,t=this.visible,i=e.mode,r=e.numVertices;if(r>0&&e.validMeasurement&&"euclidean"===i){const i=[];for(let t=0;t<r;++t){const r=y();S(r,e.positionsRenderCoords[t],this._origin);const s=y();S(s,e.positionsFittedRenderCoords[t],this._origin),i.push([r,s])}this._projectionLines.geometry=i,this._projectionLines.visible=t}else this._projectionLines.geometry=null,this._projectionLines.visible=!1}_updateLabels(){if(this.destroyed)return;const{viewData:e}=this,{measurementData:t,mode:i,path:r}=e;if(!r)return;const s=this.visible,a=this._formatAreaLabel(this.messages,"geodesic"===i?t.geodesicArea:t.area,this.analysisViewData.unit);if(null!=a?(this._areaLabel.geometry={type:"point",point:e.areaCentroid},this._areaLabel.text=a,this._areaLabel.visible=e.validMeasurement&&0===e.intersectingSegments.size&&s):this._areaLabel.visible=!1,this._set("areaLabel",a),e.numVertices>=2&&0===e.intersectingSegments.size){const i="geodesic"===e.mode,r=i?t.geodesicPathLength:t.validMeasurement?t.perimeterLength:t.pathLength,a=this._formatLengthLabel(this.messages,r,this.analysisViewData.unit);this._set("perimeterLengthLabel",a),this._perimeterLengthLabel.distance=this._parameters.labelDistance,this._perimeterLengthLabel.anchor="top",this._perimeterLengthLabel.text=a,this._perimeterLengthLabel.visible=!0;let n=!0;for(let s=0;s<e.numVertices;++s){const r=(e.perimeterLengthLabelSegmentIndex+s)%e.numVertices,a=i||!t.validMeasurement?this._pathSegments[r]:this._perimeterSegments[r];if(n=!0,this._perimeterLengthLabel.geometry={type:"segment",segment:a,sampleLocation:"center"},!this._perimeterLengthLabel.overlaps(this._areaLabel))break;n=!1}this._perimeterLengthLabel.visible=n&&s}else this._perimeterLengthLabel.visible=!1}_toPreferredAreaUnit(e,t){return h(e,this._preferredAreaUnit(e,t))}_preferredAreaUnit(e,t){switch(t){case"metric":return g(e.value,e.unit);case"imperial":return u(e.value,e.unit);default:return t}}_preferredLengthUnit(e,t){const i=this._deriveLengthUnitFromAreaUnit(t);switch(i){case"metric":return L(e.value,e.unit);case"imperial":return _(e.value,e.unit);default:return i}}_deriveLengthUnitFromAreaUnit(e){switch(e){case"metric":case"ares":case"hectares":return"metric";case"imperial":case"acres":return"imperial";case"square-inches":return"inches";case"square-feet":return"feet";case"square-yards":return"yards";case"square-miles":return"miles";case"square-us-feet":return"us-feet";case"square-millimeters":return"millimeters";case"square-centimeters":return"centimeters";case"square-decimeters":return"decimeters";case"square-meters":return"meters";case"square-kilometers":return"kilometers"}throw new Error("unhandled area unit")}_formatAreaLabel(e,t,i){return e&&t&&l(e,t,this._preferredAreaUnit(t,i))}_formatLengthLabel(e,t,i){return e&&t&&l(e,t,this._preferredLengthUnit(t,i))}_updateMessageBundle(){this.loadingMessages=!0,O("esri/core/t9n/Units").then((e=>{this.messages=e,this.view&&this._update()})).finally((()=>{this.loadingMessages=!1}))}};var q;e([v()],k.prototype,"_parameters",null),e([v()],k.prototype,"view",void 0),e([v()],k.prototype,"messages",void 0),e([v()],k.prototype,"analysis",void 0),e([v()],k.prototype,"viewData",void 0),e([v()],k.prototype,"analysisViewData",void 0),e([v({readOnly:!0})],k.prototype,"areaLabel",void 0),e([v({readOnly:!0})],k.prototype,"perimeterLengthLabel",void 0),e([v()],k.prototype,"loadingMessages",void 0),e([v()],k.prototype,"visible",null),k=e([b("esri.views.3d.analysis.AreaMeasurement.support.AreaMeasurementVisualization")],k),function(e){e[e.Small=12]="Small",e[e.Large=16]="Large"}(q||(q={}));const z={validMeasurement:!1,numVertices:0,hasStagedVertex:!1,path:null,pathVersion:-1,stagedPoint:null,measurementData:null,mode:null,positionsGeographic:null,positionsRenderCoords:null,positionsProjected:null,positionsFittedRenderCoords:null,intersectingSegments:null,triangleIndices:null,fittingMode:null,areaCentroid:null,pathLengthLabelSegmentIndex:null,perimeterLengthLabelSegmentIndex:null,checkerSize:null};export{k as AreaMeasurementVisualization};
5
+ import{_ as e}from"../../../../../chunks/tslib.es6.js";import"../../../../../intl.js";import t from"../../../../../core/Accessor.js";import{unitRGBAFromColor as i,multiplyOpacityToUnitRGBA as r,getContrast as s,multiplyOpacity as a}from"../../../../../core/colorUtils.js";import"../../../../../core/has.js";import{nextHighestPowerOfTen as n}from"../../../../../core/mathUtils.js";import{destroyMaybe as o}from"../../../../../core/maybe.js";import{formatDecimal as l}from"../../../../../core/quantityFormatUtils.js";import{toUnit as h}from"../../../../../core/quantityUtils.js";import{watch as c,syncAndInitial as m,initial as d}from"../../../../../core/reactiveUtils.js";import{convertUnit as p,adaptiveImperialAreaUnit as u,adaptiveMetricAreaUnit as g,adaptiveImperialLengthUnit as _,adaptiveMetricLengthUnit as L}from"../../../../../core/unitUtils.js";import{property as v}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/accessorSupport/ensureType.js";import"../../../../../core/arrayUtils.js";import{subclass as b}from"../../../../../core/accessorSupport/decorators/subclass.js";import{d as f}from"../../../../../chunks/mat4.js";import{a as w}from"../../../../../chunks/mat4f64.js";import{f as S}from"../../../../../chunks/vec3.js";import{c as y}from"../../../../../chunks/vec3f64.js";import{midpoint as j}from"../../support/viewUtils.js";import{LabelVisualElement as C}from"../../../interactive/visualElements/LabelVisualElement.js";import{LineVisualElement as A}from"../../../interactive/visualElements/LineVisualElement.js";import{MeasurementAreaVisualElement as D}from"../../../interactive/visualElements/MeasurementAreaVisualElement.js";import{GeodesicSegment as M,EuclideanSegment as P}from"../../../interactive/visualElements/support/Segment.js";import{RenderOccludedFlag as V}from"../../../webgl-engine/lib/Material.js";import{createStipplePatternSimple as x}from"../../../webgl-engine/materials/lineStippleUtils.js";import{onLocaleChange as U}from"../../../../../intl/locale.js";import{fetchMessageBundle as O}from"../../../../../intl/messages.js";let k=class extends t{get _parameters(){const{accentColor:e,textColor:t}=this.view.effectiveTheme,n=i(e),o=r(e,.5),l=r(s(e),.5),h=s(t);return{accentColor:n,transparentAccentColor:o,transparentContrastColor:l,intersectingLineColor:[1,.2,0,1],textColor:t,textBackgroundColor:a(h,.6),textCalloutColor:a(h,.5),pathLineWidth:3,perimeterLineWidth:2,projectionLineWidth:2,projectionLineStippleSize:5,labelDistance:25}}get visible(){return this.analysisViewData.visible}get testData(){return{labels:{area:this._areaLabel,perimeterLength:this._perimeterLengthLabel}}}constructor(e){super(e),this._path=null,this._intersectedPath=null,this._perimeter=null,this._intersectedPerimeter=null,this._projectionLines=null,this._measurementArea=null,this._areaLabel=null,this._perimeterLengthLabel=null,this._pathSegments=[],this._perimeterSegments=[],this._origin=y(),this._originTransform=w(),this.messages=null,this.viewData=z,this.areaLabel=null,this.perimeterLengthLabel=null,this.loadingMessages=!0}initialize(){const{analysisViewData:e,_parameters:t,view:i}=this;this._path=new A({view:i,attached:!0,width:t.pathLineWidth,polygonOffset:!0,renderOccluded:V.OccludeAndTransparent,isDecoration:!0}),this._intersectedPath=new A({view:i,attached:!0,width:t.pathLineWidth,polygonOffset:!0,renderOccluded:V.OccludeAndTransparent,isDecoration:!0}),this._perimeter=new A({view:i,attached:!0,width:t.perimeterLineWidth,polygonOffset:!0,renderOccluded:V.OccludeAndTransparent,isDecoration:!0}),this._intersectedPerimeter=new A({view:i,attached:!0,width:t.perimeterLineWidth,color:t.intersectingLineColor,polygonOffset:!0,renderOccluded:V.OccludeAndTransparent,isDecoration:!0}),this._projectionLines=new A({view:i,attached:!0,width:t.projectionLineWidth,stipplePattern:x(t.projectionLineStippleSize),polygonOffset:!0,renderOccluded:V.OccludeAndTransparent,isDecoration:!0}),this._measurementArea=new D({view:i,attached:!0,isDecoration:!0});const r={attached:!0,view:i,isDecoration:!0};this._areaLabel=new C({...r,fontSize:q.Large}),this._perimeterLengthLabel=new C({...r,fontSize:q.Small}),this.addHandles([c((()=>[e.mode,this.visible,e.unit,e.measurementData,e.stagedPoint]),(()=>this._update()),m),c((()=>i.state?.camera),(()=>this._updateLabels()),m),U((()=>this._updateMessageBundle())),c((()=>this._parameters),(({accentColor:e,transparentAccentColor:t,transparentContrastColor:i,textColor:r,textBackgroundColor:s,textCalloutColor:a})=>{const{_path:n,_intersectedPath:o,_perimeter:l,_projectionLines:h,_measurementArea:c,_areaLabel:m,_perimeterLengthLabel:d}=this;n.color=e,o.color=e,l.color=e,h.color=e,c.color1=t,c.color2=i,m.textColor=r,m.backgroundColor=s,m.calloutColor=a,d.textColor=r,d.backgroundColor=s,d.calloutColor=a}),d)]),this._updateMessageBundle()}destroy(){this._measurementArea=o(this._measurementArea),this._path=o(this._path),this._intersectedPath=o(this._intersectedPath),this._perimeter=o(this._perimeter),this._intersectedPerimeter=o(this._intersectedPerimeter),this._areaLabel=o(this._areaLabel),this._perimeterLengthLabel=o(this._perimeterLengthLabel),this._projectionLines=o(this._projectionLines),this.set("view",null)}_update(){if(this.destroyed||!this.view.ready||!this.view.renderCoordsHelper)return;const{analysisViewData:{measurementData:e},analysisViewData:t}=this;null!=e&&(this._updateViewData(e,t.path,t.stagedPoint),this._updateOrigin(),this._updatePathSegments(),this._updatePerimeterSegments(),this._updateArea(),this._updateProjectionLines(),this._updateLabels())}_updateViewData(e,t,i){const r=e.validMeasurement,s="geodesic"===e.actualMeasurementMode,a=s?e.geodesicArea:e.area;let o=1;if(a){const t=this._toPreferredAreaUnit(a,this.analysisViewData.unit);o=n(Math.sqrt(t.value)/Math.sqrt(300)),o*=Math.sqrt(p(1,t.unit,"square-meters")),o/=e.unitNormalizer.normalizeDistance(1)}const l={validMeasurement:r,numVertices:e.numVertices,hasStagedVertex:e.hasStagedVertex,path:t,pathVersion:t.version,stagedPoint:i,measurementData:e,mode:e.actualMeasurementMode,positionsGeographic:e.positionsGeographic,positionsRenderCoords:e.positionsRenderCoords,positionsProjected:e.positionsProjectedWorldCoords,positionsFittedRenderCoords:e.positionsFittedRenderCoords,intersectingSegments:s?e.geodesicIntersectingSegments:e.intersectingSegments,triangleIndices:s?e.geodesicTriangleIndices:e.triangleIndices,fittingMode:e.fittingMode,areaCentroid:s?e.geodesicAreaCentroidRenderCoords:e.areaCentroidRenderCoords,pathLengthLabelSegmentIndex:r?0:t.numVertices-2,perimeterLengthLabelSegmentIndex:0,checkerSize:o};this._set("viewData",l)}_updateOrigin(){const e=this.viewData;j(e.positionsRenderCoords,this._origin),f(this._originTransform,this._origin),this._measurementArea.transform=this._originTransform,this._projectionLines.transform=this._originTransform}_createSegments(e){const t=this.viewData,i=this.view.renderCoordsHelper.spatialReference,r=t.mode,s=[],a=[],n=[],o=t.numVertices,l=t.validMeasurement?o:o-1;for(let c=0;c<l;++c){const l=t[e][c],h=t[e][(c+1)%o];let m=null;switch(r){case"euclidean":m=new P(l,h);break;case"geodesic":m=new M(l,h,i)}t.intersectingSegments.has(c)?n.push(m):a.push(m),s.push(m)}let h=null;return t.validMeasurement&&t.hasStagedVertex&&l>=2?h=s[s.length-2]:t.hasStagedVertex&&l>=1&&(h=s[s.length-1]),{all:s,nonIntersecting:a,intersecting:n,stagedSegment:h}}_updatePathSegments(){const{visible:e}=this,t=this._createSegments("positionsRenderCoords");this._path.setGeometryFromSegments(t.nonIntersecting,this._origin),this._path.visible=e,this._intersectedPath.setGeometryFromSegments(t.intersecting,this._origin),this._intersectedPath.visible=e,this._pathSegments=t.all}_updatePerimeterSegments(){const e=this.visible&&"euclidean"===this.viewData.mode,t=this._createSegments("positionsFittedRenderCoords");this._perimeter.setGeometryFromSegments(t.nonIntersecting,this._origin),this._perimeter.visible=e,this._intersectedPerimeter.setGeometryFromSegments(t.intersecting,this._origin),this._intersectedPerimeter.visible=e,this._perimeterSegments=t.all}_updateArea(){const e=this.viewData;switch(e.mode){case"euclidean":this._updateAreaEuclidean(e);break;case"geodesic":this._updateAreaGeodesic()}}_updateAreaEuclidean(e){const t=this.visible;e.validMeasurement&&0===e.intersectingSegments.size&&e.triangleIndices?(this._measurementArea.geometry={uv:e.positionsProjected,position:e.positionsFittedRenderCoords,triangleIndices:e.triangleIndices},this._measurementArea.size=[e.checkerSize,e.checkerSize],this._measurementArea.visible=t):this._measurementArea.visible=!1}_updateAreaGeodesic(){this._measurementArea.visible=!1}_updateProjectionLines(){const e=this.viewData,t=this.visible,i=e.mode,r=e.numVertices;if(r>0&&e.validMeasurement&&"euclidean"===i){const i=[];for(let t=0;t<r;++t){const r=y();S(r,e.positionsRenderCoords[t],this._origin);const s=y();S(s,e.positionsFittedRenderCoords[t],this._origin),i.push([r,s])}this._projectionLines.geometry=i,this._projectionLines.visible=t}else this._projectionLines.geometry=null,this._projectionLines.visible=!1}_updateLabels(){if(this.destroyed)return;const{viewData:e}=this,{measurementData:t,mode:i,path:r}=e;if(!r)return;const s=this.visible,a=this._formatAreaLabel(this.messages,"geodesic"===i?t.geodesicArea:t.area,this.analysisViewData.unit);if(null!=a?(this._areaLabel.geometry={type:"point",point:e.areaCentroid},this._areaLabel.text=a,this._areaLabel.visible=e.validMeasurement&&0===e.intersectingSegments.size&&s):this._areaLabel.visible=!1,this._set("areaLabel",a),e.validMeasurement&&0===e.intersectingSegments.size){const i="geodesic"===e.mode,r=i?t.geodesicPathLength:t.validMeasurement?t.perimeterLength:t.pathLength,a=this._formatLengthLabel(this.messages,r,this.analysisViewData.unit);this._set("perimeterLengthLabel",a),this._perimeterLengthLabel.distance=this._parameters.labelDistance,this._perimeterLengthLabel.anchor="top",this._perimeterLengthLabel.text=a,this._perimeterLengthLabel.visible=!0;let n=!0;for(let s=0;s<e.numVertices;++s){const r=(e.perimeterLengthLabelSegmentIndex+s)%e.numVertices,a=i||!t.validMeasurement?this._pathSegments[r]:this._perimeterSegments[r];if(n=!0,this._perimeterLengthLabel.geometry={type:"segment",segment:a,sampleLocation:"center"},!this._perimeterLengthLabel.overlaps(this._areaLabel))break;n=!1}this._perimeterLengthLabel.visible=n&&s}else this._perimeterLengthLabel.visible=!1}_toPreferredAreaUnit(e,t){return h(e,this._preferredAreaUnit(e,t))}_preferredAreaUnit(e,t){switch(t){case"metric":return g(e.value,e.unit);case"imperial":return u(e.value,e.unit);default:return t}}_preferredLengthUnit(e,t){const i=this._deriveLengthUnitFromAreaUnit(t);switch(i){case"metric":return L(e.value,e.unit);case"imperial":return _(e.value,e.unit);default:return i}}_deriveLengthUnitFromAreaUnit(e){switch(e){case"metric":case"ares":case"hectares":return"metric";case"imperial":case"acres":return"imperial";case"square-inches":return"inches";case"square-feet":return"feet";case"square-yards":return"yards";case"square-miles":return"miles";case"square-us-feet":return"us-feet";case"square-millimeters":return"millimeters";case"square-centimeters":return"centimeters";case"square-decimeters":return"decimeters";case"square-meters":return"meters";case"square-kilometers":return"kilometers"}throw new Error("unhandled area unit")}_formatAreaLabel(e,t,i){return e&&t&&l(e,t,this._preferredAreaUnit(t,i))}_formatLengthLabel(e,t,i){return e&&t&&l(e,t,this._preferredLengthUnit(t,i))}_updateMessageBundle(){this.loadingMessages=!0,O("esri/core/t9n/Units").then((e=>{this.messages=e,this.view&&this._update()})).finally((()=>{this.loadingMessages=!1}))}};var q;e([v()],k.prototype,"_parameters",null),e([v()],k.prototype,"view",void 0),e([v()],k.prototype,"messages",void 0),e([v()],k.prototype,"analysis",void 0),e([v()],k.prototype,"viewData",void 0),e([v()],k.prototype,"analysisViewData",void 0),e([v({readOnly:!0})],k.prototype,"areaLabel",void 0),e([v({readOnly:!0})],k.prototype,"perimeterLengthLabel",void 0),e([v()],k.prototype,"loadingMessages",void 0),e([v()],k.prototype,"visible",null),k=e([b("esri.views.3d.analysis.AreaMeasurement.support.AreaMeasurementVisualization")],k),function(e){e[e.Small=12]="Small",e[e.Large=16]="Large"}(q||(q={}));const z={validMeasurement:!1,numVertices:0,hasStagedVertex:!1,path:null,pathVersion:-1,stagedPoint:null,measurementData:null,mode:null,positionsGeographic:null,positionsRenderCoords:null,positionsProjected:null,positionsFittedRenderCoords:null,intersectingSegments:null,triangleIndices:null,fittingMode:null,areaCentroid:null,pathLengthLabelSegmentIndex:null,perimeterLengthLabelSegmentIndex:null,checkerSize:null};export{k as AreaMeasurementVisualization};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.28/esri/copyright.txt for details.
4
4
  */
5
- import{_ as t}from"../../../../chunks/tslib.es6.js";import e from"../../../../Color.js";import"../../../../geometry.js";import{LengthDimensionMeasureType as i}from"../../../../analysis/dimensionUtils.js";import a from"../../../../analysis/LengthDimension.js";import n from"../../../../core/Accessor.js";import s from"../../../../core/Handles.js";import{destroyHandle as o}from"../../../../core/handleUtils.js";import{equals as r}from"../../../../core/lang.js";import{destroyMaybe as p}from"../../../../core/maybe.js";import{memoize as l}from"../../../../core/memoize.js";import{ignoreAbortErrors as u}from"../../../../core/promiseUtils.js";import{watch as d,initial as c,mapCollection as m,sync as h,syncAndInitial as g,when as f}from"../../../../core/reactiveUtils.js";import{property as _}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/accessorSupport/ensureType.js";import{subclass as M}from"../../../../core/accessorSupport/decorators/subclass.js";import{c as y}from"../../../../chunks/vec3f64.js";import{UpdatingHandles as v}from"../../../../core/support/UpdatingHandles.js";import{clonePoint as C}from"../../../../layers/graphics/hydratedFeatures.js";import{reapplyConstraint as S,LengthDimensionConstraint as w,applyConstraint as b,computeConstraint as O,constraintDependencies as P}from"./lengthDimensionConstraintUtils.js";import{LengthDimensionManipulators as D,LengthDimensionPointManipulator as j,pointManipulatorHandles as H,createOffsetManipulator as T,offsetManipulatorHandles as G,LineOfSightOrientationManipulator as z,headingManipulatorHandles as I,rotationManipulatorHandles as x,createMeasureTypeManipulator as V,measureTypeManipulatorHandles as U,updateOffsetManipulatorTransform as R,updateHeadingManipulatorTransform as A,updateRotationManipulatorTransform as k,updateMeasureTypeManipulatorTransform as E,unfocusedOffsetWidth as F,focusedOffsetWidth as L}from"./lengthDimensionManipulatorUtils.js";import{isValidComputation as q,arePointsVerticallyAligned as B,computeGeometryFromDimension as N,computationToGeometryDependencies as J}from"./lengthDimensionUtils.js";import{disabledPointColor as K,pointRadius as Q,getTransparentAccentColor as W,getContrastColor as X,initialOffsetPx as Y}from"./settings.js";import{getRotateHeadingTexture as Z}from"../images/Factory.js";import{SnappingVisualizer3D as $}from"../../interactive/SnappingVisualizer3D.js";import{LineVisualElement as tt}from"../../interactive/visualElements/LineVisualElement.js";import{VerticesVisualElement as et}from"../../interactive/visualElements/VerticesVisualElement.js";import{RenderOccludedFlag as it}from"../../webgl-engine/lib/Material.js";import{ImageMaterial as at}from"../../webgl-engine/materials/ImageMaterial.js";import{createStipplePatternSimple as nt}from"../../webgl-engine/materials/lineStippleUtils.js";import{RibbonLineMaterial as st}from"../../webgl-engine/materials/RibbonLineMaterial.js";import{createCoordinateHelper as ot}from"../../../interactive/coordinateHelper.js";import{EditGeometry as rt}from"../../../interactive/editGeometry/EditGeometry.js";import{EditGeometryOperations as pt}from"../../../interactive/editGeometry/EditGeometryOperations.js";import{acquire as lt}from"../../../interactive/snapping/SceneSnappingManagerPool.js";import{SnappingContext as ut}from"../../../interactive/snapping/SnappingContext.js";import{createSnapDragEventPipelineStep as dt}from"../../../interactive/snapping/SnappingDragPipelineStep.js";import{SnappingOperation as ct}from"../../../interactive/snapping/SnappingOperation.js";import{setupSnappingToggleHandles as mt}from"../../../interactive/snapping/snappingUtils.js";import ht from"../../../../geometry/Point.js";let gt=class extends n{constructor(t){super(t),this._stagedDimension=null,this._computationManipulators=new Map,this._computationHandles=new s,this._orientationManipulatorTexture=null,this._updatingHandles=new v,this._getSnappingContext=l((t=>new ut({elevationInfo:{mode:"absolute-height",offset:0},pointer:t,editGeometryOperations:new pt(new rt("point",ot(!0,!1,this.view.spatialReference))),visualizer:new $})));const{view:i}=t;this._snappingManagerResult=lt(i),this.addHandles(this._snappingManagerResult),this._unfocusedOffsetManipulatorMaterial=this._createOffsetManipulatorMaterial(),this._focusedOffsetManipulatorMaterial=this._createOffsetManipulatorMaterial(),this._thinOffsetManipulatorMaterial=this._createOffsetManipulatorMaterial(),this._thinOffsetManipulatorMaterial.setParameters({stipplePattern:nt(2)}),this._constraintSnappingIndicator=new tt({view:i,attached:!0,width:1,renderOccluded:it.OccludeAndTransparent,stipplePattern:nt(5),isDecoration:!0});const a=e.toUnitRGBA(K);this._stagedStartIndicator=new et({view:i,attached:!1,elevationInfo:{mode:"absolute-height",offset:0},spatialReference:t.view.renderCoordsHelper.spatialReference,color:a,size:2*Q,outlineSize:0,renderOccluded:it.OccludeAndTransparent,isDecoration:!0})}initialize(){const{view:t}=this;this._snappingOperation=new ct({view:t});const i=!t._stage?.renderView.renderingContext.driverTest.svgPremultipliesAlpha.result;this._orientationManipulatorMaterial=new at({transparent:!0,writeDepth:!1,renderOccluded:it.Opaque,isDecoration:!0}),this.addHandles(d((()=>({accentColor:W(t.effectiveTheme),contrastColor:X(t.effectiveTheme)})),(({accentColor:a,contrastColor:n})=>{const s=this._orientationManipulatorTexture,o=Z(t.toolViewManager.textures,{accentColor:a,contrastColor:n,preMultiplyAlpha:i});this._orientationManipulatorMaterial.setParameters({textureId:o.texture.id}),this._orientationManipulatorTexture=o,s?.release();const r=e.toUnitRGBA(a);this._unfocusedOffsetManipulatorMaterial.setParameters({color:r}),this._focusedOffsetManipulatorMaterial.setParameters({color:r}),this._thinOffsetManipulatorMaterial.setParameters({color:r}),this._constraintSnappingIndicator.color=r}),c));const a=m((()=>this.analysisViewData.computations),(({computation:t})=>this._createManipulators(t)));this.addHandles(o(a)),this.addHandles([d((()=>({stagedPoint:this._snappingOperation.stagedPoint,stagedComputation:this._stagedComputation})),(({stagedPoint:t,stagedComputation:e})=>{if(null==e||null==t)return;const i=C(t,new ht);this._applyPointUpdate(e,{endPoint:i})}),h),d((()=>({stagedDimension:this._stagedDimension,selectedComputation:this.analysisViewData.selectedComputation,firstGrabbedManipulator:this.firstGrabbedManipulator})),((t,e)=>{const{stagedDimension:i,selectedComputation:a,firstGrabbedManipulator:n}=t;if(i===e?.stagedDimension&&n===e?.firstGrabbedManipulator){for(const s of[a,e?.selectedComputation])if(null!=s){const e=this._computationManipulators.get(s);null!=e&&this._updateManipulators(s,e,t)}}else for(const[s,o]of this._computationManipulators)this._updateManipulators(s,o,t)}),g),d((()=>this.analysis.style.lineSize),(t=>{this._updateManipulatorStyle(t)}),c),d((()=>this.view.state.camera),(()=>{null!=this._stagedComputation&&this._updateStagedDimensionOffset(this._stagedComputation)})),d((()=>{const t=this._stagedComputation;if(!t)return null;const e=t.elevationAlignedStartPoint,i=y();return null!=e&&this.view.renderCoordsHelper.toRenderCoords(e,i)?i:null}),(t=>{null!=t?(this._stagedStartIndicator.vertices=[t],this._stagedStartIndicator.attached=!0):this._stagedStartIndicator.attached=!1}))]),this.addHandles(this._constraintHandles),this.addHandles(this._snappingIndicatorHandles),mt(this,(()=>{const t=this._activeComputation,e=this._stagedComputation;if(null==t||null!=e){const t=this.view.inputManager.latestPointerType??"mouse",e=this._getSnappingContext(t);this._updatingHandles.addPromise(u(this._snappingOperation.resnap(this._snappingManager,e)))}if(null!=t){const{start:e,end:i}=this._computationManipulators.get(t);if(e.grabbing||i.grabbing){const i=e.grabbing?"start":"end",a=this._computeConstraint(t);S(t,i,{constraint:a,view:this.view})}}}))}destroy(){this._snappingOperation=p(this._snappingOperation),this._computationHandles.destroy(),this._constraintSnappingIndicator.destroy(),this._stagedStartIndicator.destroy(),this._orientationManipulatorTexture?.release()}get updating(){return this._updatingHandles.updating||this._snappingManager.updating}get firstGrabbedManipulator(){return this.parentTool.firstGrabbedManipulator}get hasGrabbedManipulators(){return this.parentTool.hasGrabbedManipulators}get snappingOptions(){return this._snappingManager.options}get _snappingManager(){return this._snappingManagerResult.snappingManager}get _activeComputation(){if(null!=this._stagedComputation)return this._stagedComputation;const{selectedComputation:t}=this.analysisViewData;return this.hasGrabbedManipulators&&null!=t?t:null}get _stagedComputation(){const t=this._stagedDimension,e=this.analysisViewData.computations.at(-1)?.computation;return null==t||null==e||e.dimension!==t?null:e}get _constraintHandles(){return[f((()=>this.analysisViewData.selectedComputation),(t=>{t.previousConstraint=this._computeConstraint(t)}),{...g,equals:r}),d((()=>{const t=this._activeComputation;if(null==t)return null;const{measureType:e,orientation:i}=t.dimension;return{measureType:e,orientation:i,computation:t}}),((t,e)=>{if(null!=t&&null==e){const{measureType:e,orientation:a,computation:n}=t;switch(n.previousConstraint){case w.Horizontal:n.preConstraintProperties={measureType:i.Horizontal,orientation:0};break;case w.Vertical:n.preConstraintProperties={measureType:i.Vertical,orientation:0};break;case w.Direct:n.preConstraintProperties={measureType:i.Direct,orientation:a};break;default:n.preConstraintProperties={measureType:e,orientation:a}}}null==t&&null!=e&&(e.computation.preConstraintProperties=null)}),h)]}get _snappingIndicatorHandles(){const t="snapping-indicator-event-handles";return[d((()=>({stagedComputation:this._stagedComputation,activeComputation:this._activeComputation})),(({stagedComputation:e,activeComputation:i})=>{const a=this._constraintSnappingIndicator;if(this.removeHandles(t),null!=i)if(i===e)a.attached=!0;else{const{start:e,end:n}=this._computationManipulators.get(i),s=()=>{a.attached=e.grabbing||n.grabbing};s(),this.addHandles([e.events.on("grab-changed",s),n.events.on("grab-changed",s)],t)}else a.attached=!1})),d((()=>{const t=this._activeComputation;return null!=t?{geometry:t.geometry,constraint:t.previousConstraint}:{}}),(({geometry:t,constraint:e})=>{const i=this._constraintSnappingIndicator;null!=t&&null!=e&&e!==w.Direct?(i.visible=!0,i.setGeometryFromSegment(t.directSegment)):i.visible=!1}))]}removeStaged(){return null!=this._stagedDimension&&(this.analysis.dimensions.remove(this._stagedDimension),this._stagedDimension=null,!0)}onDeactivate(){this.removeStaged(),this._resetSnappingState()}onClick(t){const{_stagedDimension:e}=this;if(null==e){const e=this._onUnstagedClick(t);return this.analysis.dimensions.add(e),null}return this._onStagedClick(t),e}onPointerMove({mapPoint:t,pointerType:e}){if("touch"===e)return;const i=this._getSnappingContext(e);this._updatingHandles.addPromise(u(this._snappingOperation.snap({point:t},this._snappingManager,i)))}onManipulatorSelectionChanged(){if(null!=this.analysisViewData.selectedComputation){this._computationManipulators.get(this.analysisViewData.selectedComputation).offset.selected||(this.analysisViewData.selectedDimension=null)}}_onUnstagedClick({mapPoint:t,pointerType:e}){let n=t;if("mouse"===e){const i=this._getSnappingContext(e);n=this._snappingManager.update({point:t,context:i})}const s=new a({startPoint:C(n,new ht),endPoint:null,measureType:i.Horizontal});return this._stagedDimension=s,this._resetSnappingState(),s}_onStagedClick({mapPoint:t,pointerType:e}){const i=this._stagedComputation;if(null==i)return;let a=t;if("mouse"===e){const i=this._getSnappingContext(e);a=this._snappingManager.update({point:t,context:i})}const n=C(a,new ht);this._applyPointUpdate(i,{endPoint:n}),this._stagedDimension=null,this._resetSnappingState()}_resetSnappingState(){this._snappingManager.doneSnapping(),this._snappingOperation.abort(),this._snappingOperation.stagedPoint=null}_createManipulators(t){const e=this._setupPointManipulator(t,{isStart:!0}),a=this._setupPointManipulator(t,{isStart:!1}),n=this._setupOffsetManipulator(t),s=this._setupHeadingManipulator(t),o=this._setupRotationManipulator(t),r=this._setupMeasureTypeManipulator(t,i.Direct),p=this._setupMeasureTypeManipulator(t,i.Horizontal),l=this._setupMeasureTypeManipulator(t,i.Vertical),u=new D({start:e,end:a,offset:n,heading:s,rotation:o,direct:r,horizontal:p,vertical:l});return this._setupComputationToManipulatorsSync(t,u),this._computationManipulators.set(t,u),this.manipulators.addMany(u.values()),{manipulators:u,remove:()=>{this._computationHandles.remove(t),this._computationManipulators.delete(t);for(const t of u.values())this.manipulators.remove(t)}}}_setupComputationToManipulatorsSync(t,e){this._computationHandles.add([d((()=>t.geometry),(()=>this._updateManipulators(t,e)),{...g,equals:r})],t)}_setupPointManipulator(t,e){const{view:i}=this,{dimension:a}=t,n=new j(i,{metadata:a}),s=H(n,{isStart:e.isStart,createSnappingPipelineStep:t=>dt({snappingContext:this._getSnappingContext(t),snappingManager:this._snappingManager,updatingHandles:this._updatingHandles}),dimension:a,onUpdate:e=>this._applyPointUpdate(t,e),view:i});return this._computationHandles.add(s,t),n}_setupOffsetManipulator(t){const{view:e}=this,i=T(e,{lineSizePt:this.analysis.style.lineSize,unfocusedMaterial:this._unfocusedOffsetManipulatorMaterial,focusedMaterial:this._focusedOffsetManipulatorMaterial,metadata:t.dimension}),a=G(i,{computation:t,view:e});return this._computationHandles.add(a,t),i}_setupHeadingManipulator(t){const{view:e}=this,i=new z(e,{lineSizePt:this.analysis.style.lineSize,material:this._orientationManipulatorMaterial,metadata:t.dimension}),a=I(i,{computation:t,view:e});return this._computationHandles.add(a,t),i}_setupRotationManipulator(t){const{view:e}=this,i=new z(e,{lineSizePt:this.analysis.style.lineSize,material:this._orientationManipulatorMaterial,metadata:t.dimension}),a=x(i,{computation:t,view:e});return this._computationHandles.add(a,t),i}_setupMeasureTypeManipulator(t,e){const{view:i}=this,a=V(i,{lineSizePt:this.analysis.style.lineSize,unfocusedMaterial:this._unfocusedOffsetManipulatorMaterial,focusedMaterial:this._focusedOffsetManipulatorMaterial,thinOffsetManipulatorMaterial:this._thinOffsetManipulatorMaterial,metadata:t.dimension}),n=U(a,{computation:t,manipulatorMeasureType:e,view:i});return this._computationHandles.add(n,t),a}_updateManipulators(t,e,a={stagedDimension:this._stagedDimension,selectedComputation:this.analysisViewData.selectedComputation,firstGrabbedManipulator:this.firstGrabbedManipulator}){const{stagedDimension:n,selectedComputation:s,firstGrabbedManipulator:o}=a,{start:r,end:p,offset:l,heading:u,rotation:d}=e,c=s===t,m=q(t),{dimension:h}=t;for(const i of e.values()){const t=m&&null==n&&(null==o||i===o);i===l?(i.available=t,i.selected=c):i.available=t&&c}if(!m)return;null!=this._computeConstraint(t)?e.forEachMeasureTypeManipulator((t=>t.available=!1)):e.manipulatorForMeasureType(h.measureType).available=!1;for(const _ of[u,d])h.measureType===i.Direct&&0!==h.offset||(_.available=!1);B(t)?d.available=!1:u.available=!1;const{geometry:g}=t;r.renderLocation=g.directSegment.startRenderSpace,p.renderLocation=g.directSegment.endRenderSpace;const{renderCoordsHelper:f}=this.view;R(l,g,f),u.available&&A(u,t,f),d.available&&k(d,t,f),e.forEachMeasureTypeManipulator(((e,i)=>{e.available&&E(e,t,i,f)}))}_updateManipulatorStyle(t){const e=F(t),i=L(t),a={lineSizePt:t,material:this._orientationManipulatorMaterial};for(const{offset:n,heading:s,rotation:o}of this._computationManipulators.values())n.radius=i/2,s.update(a),o.update(a);this._unfocusedOffsetManipulatorMaterial.setParameters({width:e}),this._focusedOffsetManipulatorMaterial.setParameters({width:i})}_applyPointUpdate(t,e){const{view:i}=this,a=J(t);"startPoint"in e&&(a.elevationAlignedStartPoint=e.startPoint),"endPoint"in e&&(a.elevationAlignedEndPoint=e.endPoint);const n=N(a,i.renderCoordsHelper);if(null==n)return;const s=this._computeConstraint({...a,geometry:n});b(t,e,{...a,constraint:s,unconstrainedGeometry:n,view:i}),t===this._stagedComputation&&this._updateStagedDimensionOffset(t)}_updateStagedDimensionOffset(t){if(null==t.geometry)return;t.geometry.directSegment.eval(.5,ft);const e=this.view.state.camera.computeRenderPixelSizeAt(ft);t.dimension.offset=Y*e}_computeConstraint(t){return O(P(t,this._snappingManager.options),this.view)}_createOffsetManipulatorMaterial(){return new st({width:1,renderOccluded:it.OccludeAndTransparent,writeDepth:!1,hasPolygonOffset:!0,isDecoration:!0})}get testInfo(){const t=t=>this.analysisViewData.computations.find((({computation:e})=>e.dimension===t))?.computation;return{disableManipulatorPartialOcclusion:()=>{this._stagedStartIndicator.renderOccluded=it.Occlude,this.manipulators.forEach((({manipulator:t})=>{for(const{geometry:e}of t.renderObjects)e.material.setParameters({renderOccluded:it.Occlude})}))},getManipulatorsForDimension:e=>this._computationManipulators.get(t(e)),getComputationForDimension:e=>t(e),getConstraintForDimension:e=>{const i=t(e);return null!=i?this._computeConstraint(i):null},stagedDimension:this._stagedDimension,stagedStartIndicator:this._stagedStartIndicator,constraintSnappingIndicator:this._constraintSnappingIndicator,snappingManager:this._snappingManager}}};t([_({constructOnly:!0})],gt.prototype,"analysis",void 0),t([_({constructOnly:!0})],gt.prototype,"analysisViewData",void 0),t([_({constructOnly:!0})],gt.prototype,"manipulators",void 0),t([_({constructOnly:!0})],gt.prototype,"parentTool",void 0),t([_({constructOnly:!0,nonNullable:!0})],gt.prototype,"view",void 0),t([_({readOnly:!0})],gt.prototype,"updating",null),t([_()],gt.prototype,"firstGrabbedManipulator",null),t([_()],gt.prototype,"hasGrabbedManipulators",null),t([_()],gt.prototype,"snappingOptions",null),t([_()],gt.prototype,"_stagedDimension",void 0),t([_()],gt.prototype,"_activeComputation",null),t([_()],gt.prototype,"_stagedComputation",null),gt=t([M("esri.views.3d.analysis.Dimension.LengthDimensionSubTool")],gt);const ft=y();export{gt as LengthDimensionSubTool};
5
+ import{_ as t}from"../../../../chunks/tslib.es6.js";import e from"../../../../Color.js";import"../../../../geometry.js";import{LengthDimensionMeasureType as i}from"../../../../analysis/dimensionUtils.js";import a from"../../../../analysis/LengthDimension.js";import n from"../../../../core/Accessor.js";import s from"../../../../core/Handles.js";import{destroyHandle as o}from"../../../../core/handleUtils.js";import{equals as r}from"../../../../core/lang.js";import{destroyMaybe as p}from"../../../../core/maybe.js";import{memoize as l}from"../../../../core/memoize.js";import{ignoreAbortErrors as u}from"../../../../core/promiseUtils.js";import{watch as d,initial as c,mapCollection as m,sync as h,syncAndInitial as g,when as f}from"../../../../core/reactiveUtils.js";import{property as _}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/accessorSupport/ensureType.js";import{subclass as M}from"../../../../core/accessorSupport/decorators/subclass.js";import{c as y}from"../../../../chunks/vec3f64.js";import{UpdatingHandles as v}from"../../../../core/support/UpdatingHandles.js";import{clonePoint as S}from"../../../../layers/graphics/hydratedFeatures.js";import{reapplyConstraint as C,LengthDimensionConstraint as w,applyConstraint as b,computeConstraint as O,constraintDependencies as P}from"./lengthDimensionConstraintUtils.js";import{LengthDimensionManipulators as D,LengthDimensionPointManipulator as j,pointManipulatorHandles as H,createOffsetManipulator as T,offsetManipulatorHandles as G,LineOfSightOrientationManipulator as z,headingManipulatorHandles as I,rotationManipulatorHandles as x,createMeasureTypeManipulator as V,measureTypeManipulatorHandles as U,updateOffsetManipulatorTransform as R,updateHeadingManipulatorTransform as A,updateRotationManipulatorTransform as k,updateMeasureTypeManipulatorTransform as E,unfocusedOffsetWidth as F,focusedOffsetWidth as L}from"./lengthDimensionManipulatorUtils.js";import{isValidComputation as q,arePointsVerticallyAligned as B,computeGeometryFromDimension as N,computationToGeometryDependencies as J}from"./lengthDimensionUtils.js";import{disabledPointColor as K,pointRadius as Q,getTransparentAccentColor as W,getContrastColor as X,initialOffsetPx as Y}from"./settings.js";import{getRotateHeadingTexture as Z}from"../images/Factory.js";import{SnappingVisualizer3D as $}from"../../interactive/SnappingVisualizer3D.js";import{LineVisualElement as tt}from"../../interactive/visualElements/LineVisualElement.js";import{VerticesVisualElement as et}from"../../interactive/visualElements/VerticesVisualElement.js";import{RenderOccludedFlag as it}from"../../webgl-engine/lib/Material.js";import{ImageMaterial as at}from"../../webgl-engine/materials/ImageMaterial.js";import{createStipplePatternSimple as nt}from"../../webgl-engine/materials/lineStippleUtils.js";import{RibbonLineMaterial as st}from"../../webgl-engine/materials/RibbonLineMaterial.js";import{createCoordinateHelper as ot}from"../../../interactive/coordinateHelper.js";import{EditGeometry as rt}from"../../../interactive/editGeometry/EditGeometry.js";import{EditGeometryOperations as pt}from"../../../interactive/editGeometry/EditGeometryOperations.js";import{acquire as lt}from"../../../interactive/snapping/SceneSnappingManagerPool.js";import{SnappingContext as ut}from"../../../interactive/snapping/SnappingContext.js";import{createSnapDragEventPipelineStep as dt}from"../../../interactive/snapping/SnappingDragPipelineStep.js";import{SnappingOperation as ct}from"../../../interactive/snapping/SnappingOperation.js";import{setupSnappingToggleHandles as mt}from"../../../interactive/snapping/snappingUtils.js";import ht from"../../../../geometry/Point.js";let gt=class extends n{constructor(t){super(t),this._stagedDimension=null,this._computationManipulators=new Map,this._computationHandles=new s,this._orientationManipulatorTexture=null,this._updatingHandles=new v,this._getSnappingContext=l((t=>new ut({elevationInfo:{mode:"absolute-height",offset:0},pointer:t,editGeometryOperations:new pt(new rt("point",ot(!0,!1,this.view.spatialReference))),visualizer:new $})));const{view:i}=t;this._snappingManagerResult=lt(i),this.addHandles(this._snappingManagerResult),this._unfocusedOffsetManipulatorMaterial=this._createOffsetManipulatorMaterial(),this._focusedOffsetManipulatorMaterial=this._createOffsetManipulatorMaterial(),this._thinOffsetManipulatorMaterial=this._createOffsetManipulatorMaterial(),this._thinOffsetManipulatorMaterial.setParameters({stipplePattern:nt(2)}),this._constraintSnappingIndicator=new tt({view:i,attached:!0,width:1,renderOccluded:it.OccludeAndTransparent,stipplePattern:nt(5),isDecoration:!0});const a=e.toUnitRGBA(K);this._stagedStartIndicator=new et({view:i,attached:!1,elevationInfo:{mode:"absolute-height",offset:0},spatialReference:t.view.renderCoordsHelper.spatialReference,color:a,size:2*Q,outlineSize:0,renderOccluded:it.OccludeAndTransparent,isDecoration:!0})}initialize(){const{view:t}=this;this._snappingOperation=new ct({view:t});const i=!t._stage?.renderView.renderingContext.driverTest.svgPremultipliesAlpha.result;this._orientationManipulatorMaterial=new at({transparent:!0,writeDepth:!1,renderOccluded:it.Opaque,isDecoration:!0}),this.addHandles(d((()=>({accentColor:W(t.effectiveTheme),contrastColor:X(t.effectiveTheme)})),(({accentColor:a,contrastColor:n})=>{const s=this._orientationManipulatorTexture,o=Z(t.toolViewManager.textures,{accentColor:a,contrastColor:n,preMultiplyAlpha:i});this._orientationManipulatorMaterial.setParameters({textureId:o.texture.id}),this._orientationManipulatorTexture=o,s?.release();const r=e.toUnitRGBA(a);this._unfocusedOffsetManipulatorMaterial.setParameters({color:r}),this._focusedOffsetManipulatorMaterial.setParameters({color:r}),this._thinOffsetManipulatorMaterial.setParameters({color:r}),this._constraintSnappingIndicator.color=r}),c));const a=m((()=>this.analysisViewData.computations),(({computation:t})=>this._createManipulators(t)));this.addHandles(o(a)),this.addHandles([d((()=>({stagedPoint:this._snappingOperation.stagedPoint,stagedComputation:this._stagedComputation})),(({stagedPoint:t,stagedComputation:e})=>{if(null==e||null==t)return;const i=S(t,new ht);this._applyPointUpdate(e,{endPoint:i})}),h),d((()=>({stagedDimension:this._stagedDimension,selectedComputation:this.analysisViewData.selectedComputation,firstGrabbedManipulator:this.firstGrabbedManipulator})),((t,e)=>{const{stagedDimension:i,selectedComputation:a,firstGrabbedManipulator:n}=t;if(i===e?.stagedDimension&&n===e?.firstGrabbedManipulator){for(const s of[a,e?.selectedComputation])if(null!=s){const e=this._computationManipulators.get(s);null!=e&&this._updateManipulators(s,e,t)}}else for(const[s,o]of this._computationManipulators)this._updateManipulators(s,o,t)}),g),d((()=>this.analysis.style.lineSize),(t=>{this._updateManipulatorStyle(t)}),c),d((()=>this.view.state.camera),(()=>{null!=this._stagedComputation&&this._updateStagedDimensionOffset(this._stagedComputation)})),d((()=>{const t=this._stagedComputation;if(!t)return null;const e=t.elevationAlignedStartPoint,i=y();return null!=e&&this.view.renderCoordsHelper.toRenderCoords(e,i)?i:null}),(t=>{null!=t?(this._stagedStartIndicator.vertices=[t],this._stagedStartIndicator.attached=!0):this._stagedStartIndicator.attached=!1}))]),this.addHandles(this._constraintHandles),this.addHandles(this._snappingIndicatorHandles),mt(this,(()=>{const t=this._activeComputation,e=this._stagedComputation;if(null==t||null!=e){const t=this.view.inputManager.latestPointerType??"mouse",e=this._getSnappingContext(t);this._updatingHandles.addPromise(u(this._snappingOperation.resnap(this._snappingManager,e)))}if(null!=t){const{start:e,end:i}=this._computationManipulators.get(t);if(e.grabbing||i.grabbing){const i=e.grabbing?"start":"end",a=this._computeConstraint(t);C(t,i,{constraint:a,view:this.view})}}}))}destroy(){this._snappingOperation=p(this._snappingOperation),this._computationHandles.destroy(),this._constraintSnappingIndicator.destroy(),this._stagedStartIndicator.destroy(),this._orientationManipulatorTexture?.release()}get updating(){return this._updatingHandles.updating||this._snappingManager.updating}get firstGrabbedManipulator(){return this.parentTool.firstGrabbedManipulator}get hasGrabbedManipulators(){return this.parentTool.hasGrabbedManipulators}get snappingOptions(){return this._snappingManager.options}get _snappingManager(){return this._snappingManagerResult.snappingManager}get _activeComputation(){if(null!=this._stagedComputation)return this._stagedComputation;const{selectedComputation:t}=this.analysisViewData;return this.hasGrabbedManipulators&&null!=t?t:null}get _stagedComputation(){const t=this._stagedDimension,e=this.analysisViewData.computations.at(-1)?.computation;return null==t||null==e||e.dimension!==t?null:e}get _constraintHandles(){return[f((()=>this.analysisViewData.selectedComputation),(t=>{t.previousConstraint=this._computeConstraint(t)}),{...g,equals:r}),d((()=>{const t=this._activeComputation;if(null==t)return null;const{measureType:e,orientation:i}=t.dimension;return{measureType:e,orientation:i,computation:t}}),((t,e)=>{if(null!=t&&null==e){const{measureType:e,orientation:a,computation:n}=t;switch(n.previousConstraint){case w.Horizontal:n.preConstraintProperties={measureType:i.Horizontal,orientation:0};break;case w.Vertical:n.preConstraintProperties={measureType:i.Vertical,orientation:0};break;case w.Direct:n.preConstraintProperties={measureType:i.Direct,orientation:a};break;default:n.preConstraintProperties={measureType:e,orientation:a}}}null==t&&null!=e&&(e.computation.preConstraintProperties=null)}),h)]}get _snappingIndicatorHandles(){const t="snapping-indicator-event-handles";return[d((()=>({stagedComputation:this._stagedComputation,activeComputation:this._activeComputation})),(({stagedComputation:e,activeComputation:i})=>{const a=this._constraintSnappingIndicator;if(this.removeHandles(t),null!=i)if(i===e)a.attached=!0;else{const{start:e,end:n}=this._computationManipulators.get(i),s=()=>{a.attached=e.grabbing||n.grabbing};s(),this.addHandles([e.events.on("grab-changed",s),n.events.on("grab-changed",s)],t)}else a.attached=!1})),d((()=>{const t=this._activeComputation;return null!=t?{geometry:t.geometry,constraint:t.previousConstraint}:{}}),(({geometry:t,constraint:e})=>{const i=this._constraintSnappingIndicator;null!=t&&null!=e&&e!==w.Direct?(i.visible=!0,i.setGeometryFromSegment(t.directSegment)):i.visible=!1}))]}removeStaged(){return null!=this._stagedDimension&&(this.analysis.dimensions.remove(this._stagedDimension),this._stagedDimension=null,!0)}onDeactivate(){this.removeStaged(),this._resetSnappingState()}onClick(t){const{_stagedDimension:e}=this;if(null==e){const e=this._onUnstagedClick(t);return this.analysis.dimensions.add(e),null}return this._onStagedClick(t),e}onPointerMove({mapPoint:t,pointerType:e}){if("touch"===e)return;const i=this._getSnappingContext(e);this._updatingHandles.addPromise(u(this._snappingOperation.snap({point:t},this._snappingManager,i)))}onManipulatorSelectionChanged(){if(null!=this.analysisViewData.selectedComputation){this._computationManipulators.get(this.analysisViewData.selectedComputation).offset.selected||(this.analysisViewData.selectedDimension=null)}}_onUnstagedClick({mapPoint:t,pointerType:e}){let n=t;if("mouse"===e){const i=this._getSnappingContext(e);n=this._snappingManager.update({point:t,context:i})}const s=new a({startPoint:S(n,new ht),endPoint:null,measureType:i.Horizontal});return this._stagedDimension=s,this._resetSnappingState(),s}_onStagedClick({mapPoint:t,pointerType:e}){const i=this._stagedComputation;if(null==i)return;let a=t;if("mouse"===e){const i=this._getSnappingContext(e);a=this._snappingManager.update({point:t,context:i})}const n=S(a,new ht);this._applyPointUpdate(i,{endPoint:n}),this._stagedDimension=null,this._resetSnappingState()}_resetSnappingState(){this._snappingManager.doneSnapping(),this._snappingOperation.abort(),this._snappingOperation.stagedPoint=null}_createManipulators(t){const e=this._setupPointManipulator(t,{isStart:!0}),a=this._setupPointManipulator(t,{isStart:!1}),n=this._setupOffsetManipulator(t),s=this._setupHeadingManipulator(t),o=this._setupRotationManipulator(t),r=this._setupMeasureTypeManipulator(t,i.Direct),p=this._setupMeasureTypeManipulator(t,i.Horizontal),l=this._setupMeasureTypeManipulator(t,i.Vertical),u=new D({start:e,end:a,offset:n,heading:s,rotation:o,direct:r,horizontal:p,vertical:l});return this._setupComputationToManipulatorsSync(t,u),this._computationManipulators.set(t,u),this.manipulators.addMany(u.values()),{manipulators:u,remove:()=>{this._computationHandles.remove(t),this._computationManipulators.delete(t);for(const t of u.values())this.manipulators.remove(t)}}}_setupComputationToManipulatorsSync(t,e){this._computationHandles.add([d((()=>t.geometry),(()=>this._updateManipulators(t,e)),{...g,equals:r})],t)}_setupPointManipulator(t,e){const{view:i}=this,{dimension:a}=t,n=new j(i,{metadata:a}),s=H(n,{isStart:e.isStart,createSnappingPipelineStep:t=>dt({snappingContext:this._getSnappingContext(t),snappingManager:this._snappingManager,updatingHandles:this._updatingHandles}),dimension:a,onUpdate:e=>this._applyPointUpdate(t,e),view:i});return this._computationHandles.add(s,t),n}_setupOffsetManipulator(t){const{view:e}=this,i=T(e,{lineSizePt:this.analysis.style.lineSize,unfocusedMaterial:this._unfocusedOffsetManipulatorMaterial,focusedMaterial:this._focusedOffsetManipulatorMaterial,metadata:t.dimension}),a=G(i,{computation:t,view:e});return this._computationHandles.add(a,t),i}_setupHeadingManipulator(t){const{view:e}=this,i=new z(e,{lineSizePt:this.analysis.style.lineSize,material:this._orientationManipulatorMaterial,metadata:t.dimension}),a=I(i,{computation:t,view:e});return this._computationHandles.add(a,t),i}_setupRotationManipulator(t){const{view:e}=this,i=new z(e,{lineSizePt:this.analysis.style.lineSize,material:this._orientationManipulatorMaterial,metadata:t.dimension}),a=x(i,{computation:t,view:e});return this._computationHandles.add(a,t),i}_setupMeasureTypeManipulator(t,e){const{view:i}=this,a=V(i,{lineSizePt:this.analysis.style.lineSize,unfocusedMaterial:this._unfocusedOffsetManipulatorMaterial,focusedMaterial:this._focusedOffsetManipulatorMaterial,thinOffsetManipulatorMaterial:this._thinOffsetManipulatorMaterial,metadata:t.dimension}),n=U(a,{computation:t,manipulatorMeasureType:e,view:i});return this._computationHandles.add(n,t),a}_updateManipulators(t,e,a={stagedDimension:this._stagedDimension,selectedComputation:this.analysisViewData.selectedComputation,firstGrabbedManipulator:this.firstGrabbedManipulator}){const{stagedDimension:n,selectedComputation:s,firstGrabbedManipulator:o}=a,{start:r,end:p,offset:l,heading:u,rotation:d}=e,c=s===t,m=q(t),{dimension:h}=t;for(const i of e.values()){const t=m&&null==n&&(null==o||i===o);i===l?(i.available=t,i.selected=c):i.available=t&&c}if(!m)return;null!=this._computeConstraint(t)?e.forEachMeasureTypeManipulator((t=>t.available=!1)):e.manipulatorForMeasureType(h.measureType).available=!1;for(const _ of[u,d])h.measureType===i.Direct&&0!==h.offset||(_.available=!1);B(t)?d.available=!1:u.available=!1;const{geometry:g}=t;r.renderLocation=g.directSegment.startRenderSpace,p.renderLocation=g.directSegment.endRenderSpace;const{renderCoordsHelper:f}=this.view;R(l,g,f),u.available&&A(u,t,f),d.available&&k(d,t,f),e.forEachMeasureTypeManipulator(((e,i)=>{e.available&&E(e,t,i,f)}))}_updateManipulatorStyle(t){const e=F(t),i=L(t),a={lineSizePt:t,material:this._orientationManipulatorMaterial};for(const{offset:n,heading:s,rotation:o}of this._computationManipulators.values())n.radius=i/2,s.update(a),o.update(a);this._unfocusedOffsetManipulatorMaterial.setParameters({width:e}),this._focusedOffsetManipulatorMaterial.setParameters({width:i})}_applyPointUpdate(t,e){const{view:i}=this,a=J(t);"startPoint"in e&&(a.elevationAlignedStartPoint=e.startPoint),"endPoint"in e&&(a.elevationAlignedEndPoint=e.endPoint);const n=N(a,i.renderCoordsHelper);if(null==n)return;const s=this._computeConstraint({...a,geometry:n});b(t,e,{...a,constraint:s,unconstrainedGeometry:n,view:i}),t===this._stagedComputation&&this._updateStagedDimensionOffset(t)}_updateStagedDimensionOffset(t){if(null==t.geometry)return;t.geometry.directSegment.eval(.5,ft);const e=this.view.state.camera.computeScreenPixelSizeAt(ft);t.dimension.offset=Y*e}_computeConstraint(t){return O(P(t,this._snappingManager.options),this.view)}_createOffsetManipulatorMaterial(){return new st({width:1,renderOccluded:it.OccludeAndTransparent,writeDepth:!1,hasPolygonOffset:!0,isDecoration:!0})}get testInfo(){const t=t=>this.analysisViewData.computations.find((({computation:e})=>e.dimension===t))?.computation;return{disableManipulatorPartialOcclusion:()=>{this._stagedStartIndicator.renderOccluded=it.Occlude,this.manipulators.forEach((({manipulator:t})=>{for(const{geometry:e}of t.renderObjects)e.material.setParameters({renderOccluded:it.Occlude})}))},getManipulatorsForDimension:e=>this._computationManipulators.get(t(e)),getComputationForDimension:e=>t(e),getConstraintForDimension:e=>{const i=t(e);return null!=i?this._computeConstraint(i):null},stagedDimension:this._stagedDimension,stagedStartIndicator:this._stagedStartIndicator,constraintSnappingIndicator:this._constraintSnappingIndicator,snappingManager:this._snappingManager}}};t([_({constructOnly:!0})],gt.prototype,"analysis",void 0),t([_({constructOnly:!0})],gt.prototype,"analysisViewData",void 0),t([_({constructOnly:!0})],gt.prototype,"manipulators",void 0),t([_({constructOnly:!0})],gt.prototype,"parentTool",void 0),t([_({constructOnly:!0,nonNullable:!0})],gt.prototype,"view",void 0),t([_({readOnly:!0})],gt.prototype,"updating",null),t([_()],gt.prototype,"firstGrabbedManipulator",null),t([_()],gt.prototype,"hasGrabbedManipulators",null),t([_()],gt.prototype,"snappingOptions",null),t([_()],gt.prototype,"_stagedDimension",void 0),t([_()],gt.prototype,"_activeComputation",null),t([_()],gt.prototype,"_stagedComputation",null),gt=t([M("esri.views.3d.analysis.Dimension.LengthDimensionSubTool")],gt);const ft=y();export{gt as LengthDimensionSubTool};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.28/esri/copyright.txt for details.
4
4
  */
5
- import"../../../../geometry.js";import{LengthDimensionMeasureType as e}from"../../../../analysis/dimensionUtils.js";import"../../../../core/has.js";import{h as t,i as n,j as i,f as o,m as r}from"../../../../chunks/vec3.js";import{sv3d as a}from"../../../../geometry/support/vectorStacks.js";import{automaticHeadingFromCamera as s}from"./lengthDimensionManipulatorUtils.js";import{isGeodesicDimension as l,directUp as d,directStartToEnd as c}from"./lengthDimensionUtils.js";import{constraintThresholdPx as m}from"./settings.js";import u from"../../../../geometry/Point.js";var P;function p(e,t){return{enabled:t.effectiveFeatureEnabled,elevationAlignedStartPoint:e.elevationAlignedStartPoint,elevationAlignedEndPoint:e.elevationAlignedEndPoint,geometry:e.geometry}}function f(e,s){if(l(e))return P.Direct;if(!e.enabled)return null;const{geometry:u}=e;if(null==u||t(u.directSegment.startRenderSpace,u.directSegment.endRenderSpace))return null;const{camera:p}=s.state,f=d(a.get(),u,s.renderCoordsHelper),g=c(a.get(),u),v=n(a.get(),f,i(g,f)),y=o(a.get(),g,v),S=r(y),A=r(v),{startRenderSpace:R,endRenderSpace:j}=u.directSegment,z=Math.max(p.computeRenderPixelSizeAt(R)*m,p.computeRenderPixelSizeAt(j)*m)**2;return S<z?P.Vertical:A<z?P.Horizontal:null}function g(e,t,{constraint:n,view:i}){const{unconstrainedGeometry:o}=e;if(null==o)return;const{renderCoordsHelper:r,spatialReference:a}=i,{startRenderSpace:s,endRenderSpace:l}=o.directSegment,d=r.fromRenderCoords(s,new u,a),c=r.fromRenderCoords(l,new u,a);let m;m="start"===t?{startPoint:d}:{endPoint:c},v(e,m,{constraint:n,elevationAlignedStartPoint:e.elevationAlignedStartPoint,elevationAlignedEndPoint:e.elevationAlignedEndPoint,unconstrainedGeometry:o,view:i})}function v(t,n,i){const{constraint:o,elevationAlignedStartPoint:r,elevationAlignedEndPoint:a,unconstrainedGeometry:l,view:d}=i,{dimension:c,previousConstraint:m,preConstraintProperties:u}=t;if(null==r||null==a)return;const p=()=>{"startPoint"in n?c.startPoint=n.startPoint:"endPoint"in n&&(c.endPoint=n.endPoint)};if(null==o)p(),null!=m&&null!=u&&(c.measureType=u.measureType,c.orientation=u.orientation);else switch(c.measureType=e.Direct,o){case P.Horizontal:if(o!==m&&(c.orientation=0),"startPoint"in n){const e=n.startPoint;null!=e&&(e.z=a.z),c.startPoint=e}else if("endPoint"in n){const e=n.endPoint;null!=e&&(e.z=r.z),c.endPoint=e}break;case P.Vertical:if(o!==m&&(c.orientation=s(l,d)),"startPoint"in n){const e=n.startPoint;null!=e&&(e.x=a.x,e.y=a.y),c.startPoint=e}else if("endPoint"in n){const e=n.endPoint;null!=e&&(e.x=r.x,e.y=r.y),c.endPoint=e}break;case P.Direct:o!==m&&null!=u&&(c.orientation=u.orientation),p()}t.previousConstraint=o,t.unconstrainedGeometry=l}!function(e){e[e.Horizontal=0]="Horizontal",e[e.Vertical=1]="Vertical",e[e.Direct=2]="Direct"}(P||(P={}));export{P as LengthDimensionConstraint,v as applyConstraint,f as computeConstraint,p as constraintDependencies,g as reapplyConstraint};
5
+ import"../../../../geometry.js";import{LengthDimensionMeasureType as e}from"../../../../analysis/dimensionUtils.js";import"../../../../core/has.js";import{h as t,i as n,j as i,f as o,m as r}from"../../../../chunks/vec3.js";import{sv3d as a}from"../../../../geometry/support/vectorStacks.js";import{automaticHeadingFromCamera as s}from"./lengthDimensionManipulatorUtils.js";import{isGeodesicDimension as l,directUp as c,directStartToEnd as d}from"./lengthDimensionUtils.js";import{constraintThresholdPx as m}from"./settings.js";import u from"../../../../geometry/Point.js";var P;function p(e,t){return{enabled:t.effectiveFeatureEnabled,elevationAlignedStartPoint:e.elevationAlignedStartPoint,elevationAlignedEndPoint:e.elevationAlignedEndPoint,geometry:e.geometry}}function f(e,s){if(l(e))return P.Direct;if(!e.enabled)return null;const{geometry:u}=e;if(null==u||t(u.directSegment.startRenderSpace,u.directSegment.endRenderSpace))return null;const{camera:p}=s.state,f=c(a.get(),u,s.renderCoordsHelper),g=d(a.get(),u),S=n(a.get(),f,i(g,f)),v=o(a.get(),g,S),y=r(v),A=r(S),{startRenderSpace:j,endRenderSpace:z}=u.directSegment,R=Math.max(p.computeScreenPixelSizeAt(j)*m,p.computeScreenPixelSizeAt(z)*m)**2;return y<R?P.Vertical:A<R?P.Horizontal:null}function g(e,t,{constraint:n,view:i}){const{unconstrainedGeometry:o}=e;if(null==o)return;const{renderCoordsHelper:r,spatialReference:a}=i,{startRenderSpace:s,endRenderSpace:l}=o.directSegment,c=r.fromRenderCoords(s,new u,a),d=r.fromRenderCoords(l,new u,a);let m;m="start"===t?{startPoint:c}:{endPoint:d},S(e,m,{constraint:n,elevationAlignedStartPoint:e.elevationAlignedStartPoint,elevationAlignedEndPoint:e.elevationAlignedEndPoint,unconstrainedGeometry:o,view:i})}function S(t,n,i){const{constraint:o,elevationAlignedStartPoint:r,elevationAlignedEndPoint:a,unconstrainedGeometry:l,view:c}=i,{dimension:d,previousConstraint:m,preConstraintProperties:u}=t;if(null==r||null==a)return;const p=()=>{"startPoint"in n?d.startPoint=n.startPoint:"endPoint"in n&&(d.endPoint=n.endPoint)};if(null==o)p(),null!=m&&null!=u&&(d.measureType=u.measureType,d.orientation=u.orientation);else switch(d.measureType=e.Direct,o){case P.Horizontal:if(o!==m&&(d.orientation=0),"startPoint"in n){const e=n.startPoint;null!=e&&(e.z=a.z),d.startPoint=e}else if("endPoint"in n){const e=n.endPoint;null!=e&&(e.z=r.z),d.endPoint=e}break;case P.Vertical:if(o!==m&&(d.orientation=s(l,c)),"startPoint"in n){const e=n.startPoint;null!=e&&(e.x=a.x,e.y=a.y),d.startPoint=e}else if("endPoint"in n){const e=n.endPoint;null!=e&&(e.x=r.x,e.y=r.y),d.endPoint=e}break;case P.Direct:o!==m&&null!=u&&(d.orientation=u.orientation),p()}t.previousConstraint=o,t.unconstrainedGeometry=l}!function(e){e[e.Horizontal=0]="Horizontal",e[e.Vertical=1]="Vertical",e[e.Direct=2]="Direct"}(P||(P={}));export{P as LengthDimensionConstraint,S as applyConstraint,f as computeConstraint,p as constraintDependencies,g as reapplyConstraint};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.28/esri/copyright.txt for details.
4
4
  */
5
- import e from"../../../../Color.js";import{multiplyOpacity as t,getContrast as r}from"../../../../core/colorUtils.js";import{watch as i,initial as o}from"../../../../core/reactiveUtils.js";import{DidPointerMoveRecentlyFlag as s}from"./sliceToolUtils.js";import{Manipulator3D as n}from"../../interactive/Manipulator3D.js";import{rotateManipulatorDefaults as l,createLineMaterial as a}from"../../interactive/manipulatorUtils.js";import{RenderObject as c}from"../../interactive/RenderObject.js";import{Attribute as m}from"../../webgl-engine/lib/Attribute.js";import{Geometry as u}from"../../webgl-engine/lib/Geometry.js";import{createPolylineGeometry as d}from"../../webgl-engine/lib/GeometryUtil.js";import{RenderOccludedFlag as p}from"../../webgl-engine/lib/Material.js";import{VertexAttribute as f}from"../../webgl-engine/lib/VertexAttribute.js";import{ImageMaterial as j}from"../../webgl-engine/materials/ImageMaterial.js";import{ManipulatorStateFlags as b}from"../../../interactive/interfaces.js";class g extends n{constructor(s,n){const c=new j({transparent:!0,writeDepth:!1,renderOccluded:p.Opaque,isDecoration:!0}),m=l.calloutWidth,u=a(m,{renderOccluded:p.OccludeAndTransparent,isDecoration:!0});super({view:s,...w({imageMaterial:c,calloutMaterial:u})}),this._currentTexture=null,this._themeHandle=i((()=>s.effectiveTheme),(({accentColor:i})=>{const o=t(i,.5),s=r(i),l=this._currentTexture,a=n(o,s);c.setParameters({textureId:a.texture.id}),u.setParameters({color:e.toUnitRGBA(i)}),this._currentTexture=a,l?.release()}),o)}destroy(){this._themeHandle.remove(),this._currentTexture?.release(),super.destroy()}}function w({imageMaterial:e,calloutMaterial:t}){const{focusMultiplier:r,calloutLength:i,discRadius:o}=l,n=o*r,a=(e,t)=>{const r=[0,1,2,2,3,0];return new u(t,[[f.POSITION,new m([i-e,-e,0,i+e,-e,0,i+e,e,0,i-e,e,0],3,!0),r],[f.UV0,new m([0,0,1,0,1,1,0,1],2,!0),r]])},p=d(t,[[0,0,0],[i-o,0,0]]),j=d(t,[[0,0,0],[i-n,0,0]]),g=s;return{autoScaleRenderObjects:!1,collisionPriority:1,collisionType:{type:"disc",direction:[0,0,1],offset:[i,0,0]},focusMultiplier:r,radius:o,renderObjects:[new c(a(o,e),b.Unfocused|g),new c(p,b.Unfocused|g),new c(a(n,e),b.Focused|g),new c(j,b.Focused|g)],state:g}}export{g as RotateManipulator};
5
+ import e from"../../../../Color.js";import{multiplyOpacity as t,getContrast as r}from"../../../../core/colorUtils.js";import{watch as i,initial as o}from"../../../../core/reactiveUtils.js";import{DidPointerMoveRecentlyFlag as s}from"./sliceToolUtils.js";import{Manipulator3D as n}from"../../interactive/Manipulator3D.js";import{rotateManipulatorDefaults as l,createLineMaterial as a}from"../../interactive/manipulatorUtils.js";import{RenderObject as c}from"../../interactive/RenderObject.js";import{Attribute as m}from"../../webgl-engine/lib/Attribute.js";import{Geometry as u}from"../../webgl-engine/lib/Geometry.js";import{createPolylineGeometry as d}from"../../webgl-engine/lib/GeometryUtil.js";import{RenderOccludedFlag as p}from"../../webgl-engine/lib/Material.js";import{VertexAttribute as f}from"../../webgl-engine/lib/VertexAttribute.js";import{ImageMaterial as j}from"../../webgl-engine/materials/ImageMaterial.js";import{ManipulatorStateFlags as b}from"../../../interactive/interfaces.js";class g extends n{constructor(s,n){const c=new j({transparent:!0,writeDepth:!1,renderOccluded:p.Opaque,isDecoration:!0}),m=l.calloutWidth,u=a(m,{renderOccluded:p.OccludeAndTransparent,isDecoration:!0});super({view:s,...w({imageMaterial:c,calloutMaterial:u})}),this._currentTexture=null,this._themeHandle=i((()=>s.effectiveTheme),(({accentColor:i})=>{const o=t(i,.5),s=r(i),l=this._currentTexture,a=n(o,s);c.setParameters({textureId:a.texture.id}),u.setParameters({color:e.toUnitRGBA(i)}),this._currentTexture=a,l?.release()}),o)}destroy(){this._themeHandle.remove(),this._currentTexture?.release(),super.destroy()}}function w({imageMaterial:e,calloutMaterial:t}){const{focusMultiplier:r,calloutLength:i,discRadius:o}=l,n=o*r,a=(e,t)=>{const r=[0,1,2,2,3,0];return new u(t,[[f.POSITION,new m([i-e,-e,0,i+e,-e,0,i+e,e,0,i-e,e,0],r,3,!0)],[f.UV0,new m([0,0,1,0,1,1,0,1],r,2,!0)]])},p=d(t,[[0,0,0],[i-o,0,0]]),j=d(t,[[0,0,0],[i-n,0,0]]),g=s;return{autoScaleRenderObjects:!1,collisionPriority:1,collisionType:{type:"disc",direction:[0,0,1],offset:[i,0,0]},focusMultiplier:r,radius:o,renderObjects:[new c(a(o,e),b.Unfocused|g),new c(p,b.Unfocused|g),new c(a(n,e),b.Focused|g),new c(j,b.Focused|g)],state:g}}export{g as RotateManipulator};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.28/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../chunks/tslib.es6.js";import"../../../core/has.js";import{lerp as t}from"../../../core/mathUtils.js";import{destroyMaybe as s}from"../../../core/maybe.js";import{watch as r,syncAndInitial as i,initial as a,sync as o}from"../../../core/reactiveUtils.js";import{property as n}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/accessorSupport/ensureType.js";import"../../../core/arrayUtils.js";import{subclass as h}from"../../../core/accessorSupport/decorators/subclass.js";import{l,c as d,p}from"../../../chunks/vec3.js";import{f as u}from"../../../chunks/vec3f64.js";import{getReferenceEllipsoid as m}from"../../../geometry/ellipsoidUtils.js";import{isMoon as c,isEarth as _,isMars as g}from"../../../geometry/support/spatialReferenceUtils.js";import{ViewingMode as w}from"../../ViewingMode.js";import{AtmosphereType as f}from"./AtmosphereType.js";import{ChapmanAtmosphere as y}from"./ChapmanAtmosphere.js";import{CloudsComposition as v}from"./CloudsComposition.js";import{isReadyCloudsData as P,CloudsRenderingStages as b}from"./CloudsData.js";import{CloudsGenerator as R}from"./CloudsGenerator.js";import{FadeMode as A}from"./CloudsParameters.js";import{cloudPresets as x}from"./CloudsPresets.js";import{Fog as F,FogParameters as N}from"./Fog.js";import{LocalAtmosphere as W}from"./LocalAtmosphere.js";import j from"./MarsAtmosphere.js";import{Precipitation as C}from"./Precipitation.js";import{Stars as E}from"./Stars.js";import{weatherHeightLimit as M}from"./weather.js";import{SyncRenderPlugin as O,ConsumesDepth as z,ConsumesNone as T}from"../webgl-engine/effects/RenderPlugin.js";import{RenderSlot as S}from"../webgl-engine/lib/RenderSlot.js";import{Update as L}from"../webgl-engine/lib/Update.js";var U;let I=U=class extends O{constructor(e){super(e),this.produces=new Map([[S.ENVIRONMENT_OPAQUE,()=>!(null===this._atmosphere&&null===this._stars)],[S.ENVIRONMENT_TRANSPARENT,()=>!(null===this._atmosphere)]]),this._context=null,this._atmosphere=null,this._oldWeatherParameters=new V,this._newWeatherParameters=new V,this._fadedWeatherParameters=new V,this._weatherParameters=this._newWeatherParameters}initialize(){this.view._stage.addRenderPlugin(this)}destroy(){this.removeHandles(),this.uninitializeRenderContext(),null!=this.view?._stage&&this.view._stage.removeRenderPlugin(this),this._set("view",null)}get atmosphere(){return this._atmosphere}get _atmosphereType(){return null!=this.atmosphere?this.atmosphere.type:f.None}consumes(){return this._atmosphereType===f.Realistic?z:T}updateAnimation(e){return null!=this._precipitation&&this._precipitation.update(e)}get updating(){return null!=this._stars&&this._stars.updating||null!=this._clouds&&this._clouds.running}get weatherVisible(){return l(this.view.state.camera.eye)-m(this.view.spatialReference).radius<=M}get usedMemory(){return this._clouds?.usedMemory??0}get _stars(){const e=this.view,t=e.environment?.starsEnabled??!1,r=this._get("_stars");return t&&null!=this._context?null!=r?r:new E({view:e,requestRender:()=>this._setNeedsRender()}):(s(r),null)}get _precipitation(){const e=this._get("_precipitation");if(!this._precipitationEnabled||null==this._context)return s(e),null;const t=this.view,r=this._context;return null!=e&&e.context===r?e:(s(e),new C({context:r,view:t}))}get _clouds(){const e=this._get("_clouds");if(!this.weatherEnabled||null==this._context)return s(e),null;if(null!=e)return e;const t=this.view,r=this._context;return s(e),new R({context:r,view:t,requestRender:()=>this._setNeedsRender()})}get _cloudsComposition(){const e=this._get("_cloudsComposition");if(!this.weatherEnabled||null==this._context)return s(e),null;const t=this.view.state.viewingMode,r=this._context.renderContext.rctx,i=m(this.view.spatialReference).radius;return null!=e&&e.viewingMode===t&&e.planetRadius===i?e:(s(e),new v({rctx:r,viewingMode:t,planetRadius:i,requestRender:()=>this._setNeedsRender()}))}get _fog(){const e=this._get("_fog");if(!this.weatherEnabled||null==this._context)return s(e),null;if(null!=e)return e;const t=this.view,r=this._context,i=this._context.renderContext.rctx,a=this.view.state.viewingMode;return new F({context:r,view:t,rctx:i,viewingMode:a})}get weatherEnabled(){return!!this.view?.environmentManager?.weatherEnabled}get _precipitationEnabled(){return this.weatherEnabled&&("rainy"===this.view.environment.weather.type||"snowy"===this.view.environment.weather.type)}initializeRenderContext(e=null){this._context=e;const t=()=>this._setNeedsRender();this.addHandles([r((()=>({viewingMode:this.view.state.viewingMode,enabled:this.view.environment.atmosphereEnabled})),(e=>this._updateAtmosphere(e)),i),r((()=>this._stars),t),r((()=>this._precipitation),t),r((()=>this._clouds),(()=>this._updateWeather()),a),r((()=>this._fog),(()=>this._updateFogHaze()),a),r((()=>this.view.state.mode),(()=>{this._setNeedsRender()}),o),r((()=>this._weatherUpdateParameters),(()=>{this._updateWeather(),this._updateFogHaze()}),i)])}uninitializeRenderContext(){this._context=null,this._atmosphere=s(this._atmosphere),this._set("_stars",s(this._stars)),this._set("_precipitation",s(this._precipitation)),this._set("_clouds",s(this._clouds)),this._set("_cloudsComposition",s(this._cloudsComposition)),this._set("_fog",s(this._fog))}prepareRender(e){e.bindParameters.cloudsFade.data=P(this._clouds)?this._clouds:null,"local"!==this.view.viewingMode&&null!=e.bindParameters.cloudsFade.data?.cubeMap&&(this._updateWeatherFading(e.bindParameters,e.time),e.bindParameters.cloudsFade.renderingStage===b.FINISHED&&null!=this._clouds&&0===this._clouds.coverage&&!1===this._clouds.running&&(this._clouds.destroyFrameBufferCube(),e.bindParameters.cloudsFade.data=null))}render(e){switch(e.bindParameters.slot){case S.ENVIRONMENT_OPAQUE:null!=this._stars&&this._stars.render(e),null!=this.atmosphere&&(this.atmosphere.render(e,this.view?._stage?.renderer?.fullResolutionAtmosphere),null!=this._cloudsComposition&&null!=e.bindParameters.cloudsFade.data&&(this.weatherVisible&&null!=this._clouds&&this._clouds.updateWeatherTile(),this._cloudsComposition.render(e)),e.bindParameters.cloudsFade.isFading&&null!=this._context&&null!=e.bindParameters.cloudsFade.data?.cubeMap&&this._context.requestRender());break;case S.ENVIRONMENT_TRANSPARENT:if(null!=this.atmosphere&&(this.atmosphere.renderHaze(e,this._weatherParameters.hazeAmount,this.view?._stage?.renderer?.fullResolutionAtmosphere),this._weatherParameters.fog.amount>0&&null!=this._fog&&this._fog.render(e,this._weatherParameters.fog),null!=this._precipitation)){const t=this.view.environment.weather;"rainy"!==t.type&&"snowy"!==t.type||this._precipitation.render(e,t.precipitation,t.type)}}}updateLightSources(e,t,s,r){if(null!=this._context){const i=this._context.renderContext;i.bindParameters.oldLighting.copyFrom(i.bindParameters.lighting),i.bindParameters.newLighting.noonFactor=t,i.bindParameters.newLighting.globalFactor=s,i.bindParameters.newLighting.set(e);r===L.Faded||i.bindParameters.weatherFading?i.bindParameters.fadeLighting(0):i.bindParameters.fadeLighting(1),this._context.requestRender()}}get _weatherUpdateParameters(){const e=this.weatherEnabled?this.view.environment.weather:null;return null==e?null:"rainy"===e.type||"snowy"===e.type?{type:e.type,weatherAdjustment:e.cloudCover,effect:e.precipitation}:{type:e.type,weatherAdjustment:"foggy"===e.type?e.fogStrength:e.cloudCover}}_updateWeatherFading(e,t){e.cloudsFade.updateFading(e.camera,this.view.state.mode,t,this.view.qualitySettings.fadeDuration),e.cloudsFade.updateParallax(e.camera),e.weatherFading&&(this._updateLighting(e),this._updateFogAtmoshpere(e))}_updateLighting(e){e.cloudsFade.fadeMode!==A.CROSS_FADE&&e.cloudsFade.fadeMode!==A.FADE_IN?e.fadeLighting(0):e.fadeLighting(e.cloudsFade.fadeFactor)}_updateFogAtmoshpere(e){e.cloudsFade.fadeMode!==A.CROSS_FADE&&e.cloudsFade.fadeMode!==A.FADE_IN?this._fadeWeather(0):this._fadeWeather(e.cloudsFade.fadeFactor)}_fadeWeather(e){const{_newWeatherParameters:t,_oldWeatherParameters:s}=this;e>=1?this._weatherParameters=t:(this._fadedWeatherParameters.lerp(s,t,e),this._weatherParameters=this._fadedWeatherParameters)}_updateWeather(){const e=this._weatherUpdateParameters;null!=e&&null!=this._clouds&&(this._clouds.applyPreset(x[e.type],e.weatherAdjustment),this._setNeedsRender())}_setNeedsRender(){null!=this._context&&this._context.requestRender()}_updateFogHaze(){const e=this._weatherUpdateParameters;if(null==this._fog||null==e||null==this._context)return;const s=this._context.renderContext.bindParameters;switch(this._oldWeatherParameters.copyFrom(this._weatherParameters),e.type){case"foggy":this._newWeatherParameters.fog.strength=t(3e-5,.005,e.weatherAdjustment**3),d(this._newWeatherParameters.fog.color,q),this._newWeatherParameters.fog.amount=1,this._newWeatherParameters.hazeAmount=1,this._setNeedsRender();break;case"rainy":this._newWeatherParameters.fog.strength=t(4e-6,2e-4,(e.effect??0)**3),d(this._newWeatherParameters.fog.color,k),this._newWeatherParameters.fog.amount=1,this._newWeatherParameters.hazeAmount=0,this._setNeedsRender();break;case"snowy":this._newWeatherParameters.fog.strength=t(4e-6,2e-4,(e.effect??0)**3),d(this._newWeatherParameters.fog.color,q),this._newWeatherParameters.fog.amount=1,this._newWeatherParameters.hazeAmount=1,this._setNeedsRender();break;default:this._newWeatherParameters.fog.strength=0,this._newWeatherParameters.fog.amount=0,this._newWeatherParameters.hazeAmount=1,this._setNeedsRender()}s.weatherFading?this._fadeWeather(0):this._fadeWeather(1)}_updateAtmosphere(e){const t=this._selectAtmosphereType(e);if(t!==f.None&&this._context){if(!this._atmosphere||this._atmosphere.type!==t){this._atmosphere=s(this._atmosphere);const e=this._getAtmosphereClass(t);e&&(this._atmosphere=new e(this.view,this._context))}}else this._atmosphere=s(this._atmosphere);this._setNeedsRender()}_getAtmosphereClass(e){switch(e){case f.Realistic:return y;case f.Local:return W;case f.Mars:return j;default:case f.None:return null}}_selectAtmosphereType(e){const{enabled:t,viewingMode:s}=e;return!t||c(this.view.spatialReference)?f.None:s===w.Local?f.Local:null!=this._context&&y.isSupported(this._context)&&_(this.view.spatialReference)?f.Realistic:g(this.view.spatialReference)?f.Mars:f.None}get test(){return{atmosphere:this._atmosphere,clouds:this._clouds,selectAtmosphereType:()=>this._selectAtmosphereType({viewingMode:this.view.state.viewingMode,enabled:this.view.environment.atmosphereEnabled}),stubGetAtmosphereClass:e=>{D=U.prototype._getAtmosphereClass,U.prototype._getAtmosphereClass=e},restoreGetAtmosphereClass:()=>{U.prototype._getAtmosphereClass=D}}}};e([n({constructOnly:!0})],I.prototype,"view",void 0),e([n({readOnly:!0})],I.prototype,"atmosphere",null),e([n({readOnly:!0})],I.prototype,"_atmosphereType",null),e([n({type:Boolean,readOnly:!0})],I.prototype,"updating",null),e([n({readOnly:!0})],I.prototype,"weatherVisible",null),e([n()],I.prototype,"_context",void 0),e([n()],I.prototype,"_atmosphere",void 0),e([n({readOnly:!0})],I.prototype,"_stars",null),e([n({readOnly:!0})],I.prototype,"_precipitation",null),e([n({readOnly:!0})],I.prototype,"_clouds",null),e([n({readOnly:!0})],I.prototype,"_cloudsComposition",null),e([n({readOnly:!0})],I.prototype,"_fog",null),e([n({readOnly:!0})],I.prototype,"weatherEnabled",null),e([n({readOnly:!0})],I.prototype,"_precipitationEnabled",null),e([n({readOnly:!0})],I.prototype,"_weatherUpdateParameters",null),I=U=e([h("esri.views.3d.environment.EnvironmentRenderer")],I);class V{constructor(){this.fog=new N,this.hazeAmount=1}copyFrom(e){this.fog.amount=e.fog.amount,this.hazeAmount=e.hazeAmount,this.fog.strength=e.fog.strength,d(this.fog.color,e.fog.color)}lerp(e,s,r){this.fog.amount=t(e.fog.amount,s.fog.amount,r),this.hazeAmount=t(e.hazeAmount,s.hazeAmount,r),this.fog.strength=t(e.fog.strength,s.fog.strength,r),p(this.fog.color,e.fog.color,s.fog.color,r)}}const k=u(.5,.5,.5),q=u(1.5,1.5,1.5);let D;export{I as EnvironmentRenderer,V as WeatherParameters};
5
+ import{_ as e}from"../../../chunks/tslib.es6.js";import"../../../core/has.js";import{lerp as t}from"../../../core/mathUtils.js";import{destroyMaybe as s}from"../../../core/maybe.js";import{watch as r,syncAndInitial as i,initial as a,sync as o}from"../../../core/reactiveUtils.js";import{property as n}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/accessorSupport/ensureType.js";import"../../../core/arrayUtils.js";import{subclass as h}from"../../../core/accessorSupport/decorators/subclass.js";import{l,c as d,p}from"../../../chunks/vec3.js";import{f as u}from"../../../chunks/vec3f64.js";import{getReferenceEllipsoid as m}from"../../../geometry/ellipsoidUtils.js";import{isMoon as c,isEarth as _,isMars as g}from"../../../geometry/support/spatialReferenceUtils.js";import{ViewingMode as w}from"../../ViewingMode.js";import{AtmosphereType as f}from"./AtmosphereType.js";import{ChapmanAtmosphere as y}from"./ChapmanAtmosphere.js";import{CloudsComposition as v}from"./CloudsComposition.js";import{isReadyCloudsData as P,CloudsRenderingStages as b}from"./CloudsData.js";import{CloudsGenerator as R}from"./CloudsGenerator.js";import{FadeMode as A}from"./CloudsParameters.js";import{cloudPresets as x}from"./CloudsPresets.js";import{Fog as F,FogParameters as N}from"./Fog.js";import{LocalAtmosphere as W}from"./LocalAtmosphere.js";import j from"./MarsAtmosphere.js";import{Precipitation as C}from"./Precipitation.js";import{Stars as E}from"./Stars.js";import{weatherHeightLimit as M}from"./weather.js";import{SyncRenderPlugin as O,ConsumesDepth as z,ConsumesNone as T}from"../webgl-engine/effects/RenderPlugin.js";import{RenderSlot as S}from"../webgl-engine/lib/RenderSlot.js";import{Update as L}from"../webgl-engine/lib/Update.js";var U;let I=U=class extends O{constructor(e){super(e),this.produces=new Map([[S.ENVIRONMENT_OPAQUE,()=>!(null===this._atmosphere&&null===this._stars)],[S.ENVIRONMENT_TRANSPARENT,()=>!(null===this._atmosphere)]]),this._context=null,this._atmosphere=null,this._oldWeatherParameters=new V,this._newWeatherParameters=new V,this._fadedWeatherParameters=new V,this._weatherParameters=this._newWeatherParameters}initialize(){this.view._stage.addRenderPlugin(this)}destroy(){this.removeHandles(),this.uninitializeRenderContext(),null!=this.view?._stage&&this.view._stage.removeRenderPlugin(this),this._set("view",null)}get atmosphere(){return this._atmosphere}get _atmosphereType(){return null!=this.atmosphere?this.atmosphere.type:f.None}consumes(){return this._atmosphereType===f.Realistic?z:T}updateAnimation(e){return null!=this._precipitation&&this._precipitation.update(e)}get updating(){return null!=this._stars&&this._stars.updating||null!=this._clouds&&this._clouds.running}get weatherVisible(){return l(this.view.state.camera.eye)-m(this.view.spatialReference).radius<=M}get usedMemory(){return this._clouds?.usedMemory??0}get _stars(){const e=this.view,t=e.environment?.starsEnabled??!1,r=this._get("_stars");return t&&null!=this._context?null!=r?r:new E({view:e,requestRender:()=>this._setNeedsRender()}):(s(r),null)}get _precipitation(){const e=this._get("_precipitation");if(!this._precipitationEnabled||null==this._context)return s(e),null;const t=this.view,r=this._context;return null!=e&&e.context===r?e:(s(e),new C({context:r,view:t}))}get _clouds(){const e=this._get("_clouds");if(!this.weatherEnabled||null==this._context)return s(e),null;if(null!=e)return e;const t=this.view,r=this._context;return s(e),new R({context:r,view:t,requestRender:()=>this._setNeedsRender()})}get _cloudsComposition(){const e=this._get("_cloudsComposition");if(!this.weatherEnabled||null==this._context)return s(e),null;const t=this.view.state.viewingMode,r=this._context.renderContext.rctx,i=m(this.view.spatialReference).radius;return null!=e&&e.viewingMode===t&&e.planetRadius===i?e:(s(e),new v({rctx:r,viewingMode:t,planetRadius:i,requestRender:()=>this._setNeedsRender()}))}get _fog(){const e=this._get("_fog");if(!this.weatherEnabled||null==this._context)return s(e),null;if(null!=e)return e;const t=this.view,r=this._context,i=this._context.renderContext.rctx,a=this.view.state.viewingMode;return new F({context:r,view:t,rctx:i,viewingMode:a})}get weatherEnabled(){return!!this.view?.environmentManager?.weatherEnabled}get _precipitationEnabled(){return this.weatherEnabled&&("rainy"===this.view.environment.weather.type||"snowy"===this.view.environment.weather.type)}initializeRenderContext(e=null){this._context=e;const t=()=>this._setNeedsRender();this.addHandles([r((()=>({viewingMode:this.view.state.viewingMode,enabled:this.view.environment.atmosphereEnabled})),(e=>this._updateAtmosphere(e)),i),r((()=>this._stars),t),r((()=>this._precipitation),t),r((()=>this._clouds),(()=>this._updateWeather()),a),r((()=>this._fog),(()=>this._updateFogHaze()),a),r((()=>this.view.state.mode),(()=>{this._setNeedsRender()}),o),r((()=>this._weatherUpdateParameters),(()=>{this._updateWeather(),this._updateFogHaze()}),i)])}uninitializeRenderContext(){this._context=null,this._atmosphere=s(this._atmosphere),this._set("_stars",s(this._stars)),this._set("_precipitation",s(this._precipitation)),this._set("_clouds",s(this._clouds)),this._set("_cloudsComposition",s(this._cloudsComposition)),this._set("_fog",s(this._fog))}prepareRender(e){e.bindParameters.cloudsFade.data=P(this._clouds)?this._clouds:null,"local"!==this.view.viewingMode&&null!=e.bindParameters.cloudsFade.data?.cubeMap&&(this._updateWeatherFading(e.bindParameters,e.time),e.bindParameters.cloudsFade.renderingStage===b.FINISHED&&null!=this._clouds&&0===this._clouds.coverage&&!1===this._clouds.running&&(this._clouds.destroyFrameBufferCube(),e.bindParameters.cloudsFade.data=null))}renderNode(e){switch(e.bindParameters.slot){case S.ENVIRONMENT_OPAQUE:null!=this._stars&&this._stars.render(e),null!=this.atmosphere&&(this.atmosphere.render(e,this.view?._stage?.renderer?.fullResolutionAtmosphere),null!=this._cloudsComposition&&null!=e.bindParameters.cloudsFade.data&&(this.weatherVisible&&null!=this._clouds&&this._clouds.updateWeatherTile(),this._cloudsComposition.render(e)),e.bindParameters.cloudsFade.isFading&&null!=this._context&&null!=e.bindParameters.cloudsFade.data?.cubeMap&&this._context.requestRender());break;case S.ENVIRONMENT_TRANSPARENT:if(null!=this.atmosphere&&(this.atmosphere.renderHaze(e,this._weatherParameters.hazeAmount,this.view?._stage?.renderer?.fullResolutionAtmosphere),this._weatherParameters.fog.amount>0&&null!=this._fog&&this._fog.render(e,this._weatherParameters.fog),null!=this._precipitation)){const t=this.view.environment.weather;"rainy"!==t.type&&"snowy"!==t.type||this._precipitation.render(e,t.precipitation,t.type)}}}updateLightSources(e,t,s,r){if(null!=this._context){const i=this._context.renderContext;i.bindParameters.oldLighting.copyFrom(i.bindParameters.lighting),i.bindParameters.newLighting.noonFactor=t,i.bindParameters.newLighting.globalFactor=s,i.bindParameters.newLighting.set(e);r===L.Faded||i.bindParameters.weatherFading?i.bindParameters.fadeLighting(0):i.bindParameters.fadeLighting(1),this._context.requestRender()}}get _weatherUpdateParameters(){const e=this.weatherEnabled?this.view.environment.weather:null;return null==e?null:"rainy"===e.type||"snowy"===e.type?{type:e.type,weatherAdjustment:e.cloudCover,effect:e.precipitation}:{type:e.type,weatherAdjustment:"foggy"===e.type?e.fogStrength:e.cloudCover}}_updateWeatherFading(e,t){e.cloudsFade.updateFading(e.camera,this.view.state.mode,t,this.view.qualitySettings.fadeDuration),e.cloudsFade.updateParallax(e.camera),e.weatherFading&&(this._updateLighting(e),this._updateFogAtmoshpere(e))}_updateLighting(e){e.cloudsFade.fadeMode!==A.CROSS_FADE&&e.cloudsFade.fadeMode!==A.FADE_IN?e.fadeLighting(0):e.fadeLighting(e.cloudsFade.fadeFactor)}_updateFogAtmoshpere(e){e.cloudsFade.fadeMode!==A.CROSS_FADE&&e.cloudsFade.fadeMode!==A.FADE_IN?this._fadeWeather(0):this._fadeWeather(e.cloudsFade.fadeFactor)}_fadeWeather(e){const{_newWeatherParameters:t,_oldWeatherParameters:s}=this;e>=1?this._weatherParameters=t:(this._fadedWeatherParameters.lerp(s,t,e),this._weatherParameters=this._fadedWeatherParameters)}_updateWeather(){const e=this._weatherUpdateParameters;null!=e&&null!=this._clouds&&(this._clouds.applyPreset(x[e.type],e.weatherAdjustment),this._setNeedsRender())}_setNeedsRender(){null!=this._context&&this._context.requestRender()}_updateFogHaze(){const e=this._weatherUpdateParameters;if(null==this._fog||null==e||null==this._context)return;const s=this._context.renderContext.bindParameters;switch(this._oldWeatherParameters.copyFrom(this._weatherParameters),e.type){case"foggy":this._newWeatherParameters.fog.strength=t(3e-5,.005,e.weatherAdjustment**3),d(this._newWeatherParameters.fog.color,q),this._newWeatherParameters.fog.amount=1,this._newWeatherParameters.hazeAmount=1,this._setNeedsRender();break;case"rainy":this._newWeatherParameters.fog.strength=t(4e-6,2e-4,(e.effect??0)**3),d(this._newWeatherParameters.fog.color,k),this._newWeatherParameters.fog.amount=1,this._newWeatherParameters.hazeAmount=0,this._setNeedsRender();break;case"snowy":this._newWeatherParameters.fog.strength=t(4e-6,2e-4,(e.effect??0)**3),d(this._newWeatherParameters.fog.color,q),this._newWeatherParameters.fog.amount=1,this._newWeatherParameters.hazeAmount=1,this._setNeedsRender();break;default:this._newWeatherParameters.fog.strength=0,this._newWeatherParameters.fog.amount=0,this._newWeatherParameters.hazeAmount=1,this._setNeedsRender()}s.weatherFading?this._fadeWeather(0):this._fadeWeather(1)}_updateAtmosphere(e){const t=this._selectAtmosphereType(e);if(t!==f.None&&this._context){if(!this._atmosphere||this._atmosphere.type!==t){this._atmosphere=s(this._atmosphere);const e=this._getAtmosphereClass(t);e&&(this._atmosphere=new e(this.view,this._context))}}else this._atmosphere=s(this._atmosphere);this._setNeedsRender()}_getAtmosphereClass(e){switch(e){case f.Realistic:return y;case f.Local:return W;case f.Mars:return j;default:case f.None:return null}}_selectAtmosphereType(e){const{enabled:t,viewingMode:s}=e;return!t||c(this.view.spatialReference)?f.None:s===w.Local?f.Local:null!=this._context&&y.isSupported(this._context)&&_(this.view.spatialReference)?f.Realistic:g(this.view.spatialReference)?f.Mars:f.None}get test(){return{atmosphere:this._atmosphere,clouds:this._clouds,selectAtmosphereType:()=>this._selectAtmosphereType({viewingMode:this.view.state.viewingMode,enabled:this.view.environment.atmosphereEnabled}),stubGetAtmosphereClass:e=>{D=U.prototype._getAtmosphereClass,U.prototype._getAtmosphereClass=e},restoreGetAtmosphereClass:()=>{U.prototype._getAtmosphereClass=D}}}};e([n({constructOnly:!0})],I.prototype,"view",void 0),e([n({readOnly:!0})],I.prototype,"atmosphere",null),e([n({readOnly:!0})],I.prototype,"_atmosphereType",null),e([n({type:Boolean,readOnly:!0})],I.prototype,"updating",null),e([n({readOnly:!0})],I.prototype,"weatherVisible",null),e([n()],I.prototype,"_context",void 0),e([n()],I.prototype,"_atmosphere",void 0),e([n({readOnly:!0})],I.prototype,"_stars",null),e([n({readOnly:!0})],I.prototype,"_precipitation",null),e([n({readOnly:!0})],I.prototype,"_clouds",null),e([n({readOnly:!0})],I.prototype,"_cloudsComposition",null),e([n({readOnly:!0})],I.prototype,"_fog",null),e([n({readOnly:!0})],I.prototype,"weatherEnabled",null),e([n({readOnly:!0})],I.prototype,"_precipitationEnabled",null),e([n({readOnly:!0})],I.prototype,"_weatherUpdateParameters",null),I=U=e([h("esri.views.3d.environment.EnvironmentRenderer")],I);class V{constructor(){this.fog=new N,this.hazeAmount=1}copyFrom(e){this.fog.amount=e.fog.amount,this.hazeAmount=e.hazeAmount,this.fog.strength=e.fog.strength,d(this.fog.color,e.fog.color)}lerp(e,s,r){this.fog.amount=t(e.fog.amount,s.fog.amount,r),this.hazeAmount=t(e.hazeAmount,s.hazeAmount,r),this.fog.strength=t(e.fog.strength,s.fog.strength,r),p(this.fog.color,e.fog.color,s.fog.color,r)}}const k=u(.5,.5,.5),q=u(1.5,1.5,1.5);let D;export{I as EnvironmentRenderer,V as WeatherParameters};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.28/esri/copyright.txt for details.
4
4
  */
5
- import{disposeMaybe as e}from"../../../core/maybe.js";import{h as t}from"../../../chunks/mat4.js";import{a as r}from"../../../chunks/mat4f64.js";import{AtmosphereType as s}from"./AtmosphereType.js";import{S as o}from"../../../chunks/SimpleAtmosphere.glsl.js";import{SimpleAtmosphereTechnique as i}from"./SimpleAtmosphereTechnique.js";import{SimpleAtmosphereTechniqueConfiguration as a,SimpleAtmosphereGeometry as m}from"./SimpleAtmosphereTechniqueConfiguration.js";import{earthAtmosphereTextureSimple as n}from"./resources/SimpleAtmosphereTexture.js";import{glLayout as p}from"../support/buffer/glUtil.js";import{newLayout as c}from"../support/buffer/InterleavedLayout.js";import{Default3D as u}from"../webgl-engine/lib/DefaultVertexAttributeLocations.js";import{createPolySphereData as f}from"../webgl-engine/lib/GeometryUtil.js";import{VertexArrayObject as h}from"../webgl-engine/lib/VertexArrayObject.js";import{VertexAttribute as l}from"../webgl-engine/lib/VertexAttribute.js";import{BufferObject as b}from"../../webgl/BufferObject.js";import{TextureWrapMode as g,PrimitiveType as j,Usage as _}from"../../webgl/enums.js";import{Texture as x}from"../../webgl/Texture.js";import{TextureDescriptor as w}from"../../webgl/TextureDescriptor.js";import{vertexCount as A}from"../../webgl/Util.js";class d{constructor(e,t){this.type=s.Local,this._configuration=new a,this._passParameters=new o,this._configuration.geometry=m.Cylinder,this._technique=t.techniqueRepository.acquire(i,this._configuration);const r=t.renderContext.rctx;this._vao=this._createVertexArrayObject(r),this._vaoCount=A(this._vao,"geometry");const p=new w;p.wrapMode=g.CLAMP_TO_EDGE,p.flipped=!0,p.width=1,p.height=512,this._passParameters.texture=new x(r,p,n)}destroy(){this._passParameters.texture=e(this._passParameters.texture),this._vao.dispose(),this._technique.release()}render(e){const t=e.rctx,r=t.bindTechnique(this._technique,this._passParameters,e.bindParameters);y(T,e.bindParameters.camera.viewMatrix),r.setUniformMatrix4fv("view",T),t.bindVAO(this._vao),r.assertCompatibleVertexAttributeLocations(this._vao),t.drawArrays(j.TRIANGLES,0,this._vaoCount)}renderHaze(){return!1}_createVertexArrayObject(e){const t=f(1,2,!1),r=t[0][1].data,s=t[0][2],o=v.createBuffer(s.length),i=o.position;for(let a=0;a<s.length;++a){const e=3*s[a%3==0?a+2:a%3==2?a-2:a];i.set(a,0,r[e]),i.set(a,1,r[e+1]),i.set(a,2,r[e+2])}return new h(e,u,{geometry:p(v)},{geometry:b.createVertex(e,_.STATIC_DRAW,o.buffer)})}}function y(e,r){t(e,r),e[12]=0,e[13]=0,e[14]=0,e[15]=1}const T=r(),v=c().vec3f(l.POSITION);export{d as LocalAtmosphere};
5
+ import{disposeMaybe as e}from"../../../core/maybe.js";import{h as t}from"../../../chunks/mat4.js";import{a as r}from"../../../chunks/mat4f64.js";import{AtmosphereType as s}from"./AtmosphereType.js";import{S as i}from"../../../chunks/SimpleAtmosphere.glsl.js";import{SimpleAtmosphereTechnique as o}from"./SimpleAtmosphereTechnique.js";import{SimpleAtmosphereTechniqueConfiguration as a,SimpleAtmosphereGeometry as m}from"./SimpleAtmosphereTechniqueConfiguration.js";import{earthAtmosphereTextureSimple as n}from"./resources/SimpleAtmosphereTexture.js";import{glLayout as p}from"../support/buffer/glUtil.js";import{newLayout as c}from"../support/buffer/InterleavedLayout.js";import{Default3D as u}from"../webgl-engine/lib/DefaultVertexAttributeLocations.js";import{createPolySphereData as f}from"../webgl-engine/lib/GeometryUtil.js";import{VertexArrayObject as h}from"../webgl-engine/lib/VertexArrayObject.js";import{VertexAttribute as l}from"../webgl-engine/lib/VertexAttribute.js";import{BufferObject as b}from"../../webgl/BufferObject.js";import{TextureWrapMode as g,PrimitiveType as j,Usage as _}from"../../webgl/enums.js";import{Texture as x}from"../../webgl/Texture.js";import{TextureDescriptor as w}from"../../webgl/TextureDescriptor.js";import{vertexCount as d}from"../../webgl/Util.js";class A{constructor(e,t){this.type=s.Local,this._configuration=new a,this._passParameters=new i,this._configuration.geometry=m.Cylinder,this._technique=t.techniqueRepository.acquire(o,this._configuration);const r=t.renderContext.rctx;this._vao=this._createVertexArrayObject(r),this._vaoCount=d(this._vao,"geometry");const p=new w;p.wrapMode=g.CLAMP_TO_EDGE,p.flipped=!0,p.width=1,p.height=512,this._passParameters.texture=new x(r,p,n)}destroy(){this._passParameters.texture=e(this._passParameters.texture),this._vao.dispose(),this._technique.release()}render(e){const t=e.rctx,r=t.bindTechnique(this._technique,this._passParameters,e.bindParameters);y(T,e.bindParameters.camera.viewMatrix),r.setUniformMatrix4fv("view",T),t.bindVAO(this._vao),r.assertCompatibleVertexAttributeLocations(this._vao),t.drawArrays(j.TRIANGLES,0,this._vaoCount)}renderHaze(){return!1}_createVertexArrayObject(e){const t=f(1,2,!1),{data:r,indices:s}=t[0][1],i=v.createBuffer(s.length),o=i.position;for(let a=0;a<s.length;++a){const e=3*s[a%3==0?a+2:a%3==2?a-2:a];o.set(a,0,r[e]),o.set(a,1,r[e+1]),o.set(a,2,r[e+2])}return new h(e,u,{geometry:p(v)},{geometry:b.createVertex(e,_.STATIC_DRAW,i.buffer)})}}function y(e,r){t(e,r),e[12]=0,e[13]=0,e[14]=0,e[15]=1}const T=r(),v=c().vec3f(l.POSITION);export{A as LocalAtmosphere};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.28/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../core/Collection.js";import r from"../../../core/Logger.js";import{watch as s,initial as n}from"../../../core/reactiveUtils.js";import{property as i}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/accessorSupport/ensureType.js";import"../../../core/arrayUtils.js";import"../../../core/has.js";import{subclass as o}from"../../../core/accessorSupport/decorators/subclass.js";import d from"./RenderContext.js";import{ShaderOutput as a}from"../webgl-engine/core/shaderLibrary/ShaderOutput.js";import{SyncRenderPlugin as c}from"../webgl-engine/effects/RenderPlugin.js";import{RenderSlot as h}from"../webgl-engine/lib/RenderSlot.js";let l=class extends c{constructor(e){super(e),this.produces=new Map([[h.OPAQUE_MATERIAL,()=>this.renderers.some((e=>"function"==typeof e.render))],[h.TRANSPARENT_MATERIAL,()=>this.renderers.some((e=>"function"==typeof e.renderTransparent))]]),this.renderers=new t,this.context=null}initialize(){this.addHandles([s((()=>this.view.ready),(e=>{e?(this.context=new d(this.view),this.view._stage.addRenderPlugin(this)):(this.renderers.forEach((e=>p(e,"dispose",this.context))),this.context=null)}),n)])}destroy(){this.renderers.drain((e=>{this.context&&p(e,"dispose",this.context)})),this.view._stage?.removeRenderPlugin(this),this.context=null}add(e){this.renderers.includes(e)?r.getLogger("esri.views.3d.externalRenderers.ExternalRendererStore").warn("add(): Cannot add external renderer: renderer has already been added"):(this.renderers.add(e),this.context&&(this._webglStateReset(),p(e,"setup",this.context),this.view._stage.renderView.requestRender()))}remove(e){const t=this.renderers.indexOf(e);-1!==t&&(this.renderers.removeAt(t),this.context&&(p(e,"dispose",this.context),this.view._stage.renderView.requestRender()))}initializeRenderContext(e){this.context.rctx=e.renderContext.rctx,this.renderers.length>0&&this._webglStateReset(),this.renderers.forEach((e=>p(e,"setup",this.context)))}uninitializeRenderContext(){}render(e){if(0===this.renderers.length||e.output!==a.Color)return;const t=t=>{this._updateContext(e),this._webglStateReset(),this.renderers.forEach((e=>p(e,t,this.context)))};e.bindParameters.slot===h.OPAQUE_MATERIAL?t("render"):t("renderTransparent")}_updateContext(e){this.context.camera.copyFrom(e.bindParameters.camera),this.context.sunLight=e.bindParameters.lighting.legacy,this.context._renderTargetHelper=e.offscreenRenderingHelper}_webglStateReset(){this.context.rctx.resetState(),this.context._renderTargetHelper?.bindFbo()}};function p(e,t,r){"function"==typeof e[t]&&null!=r&&e[t]?.(r)}e([i({constructOnly:!0})],l.prototype,"view",void 0),l=e([o("esri.views.3d.externalRenderers.StageRenderer")],l);export{l as StageRenderer};
5
+ import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../core/Collection.js";import r from"../../../core/Logger.js";import{watch as s,initial as n}from"../../../core/reactiveUtils.js";import{property as i}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/accessorSupport/ensureType.js";import"../../../core/arrayUtils.js";import"../../../core/has.js";import{subclass as o}from"../../../core/accessorSupport/decorators/subclass.js";import d from"./RenderContext.js";import{ShaderOutput as a}from"../webgl-engine/core/shaderLibrary/ShaderOutput.js";import{SyncRenderPlugin as c}from"../webgl-engine/effects/RenderPlugin.js";import{RenderSlot as h}from"../webgl-engine/lib/RenderSlot.js";let l=class extends c{constructor(e){super(e),this.produces=new Map([[h.OPAQUE_MATERIAL,()=>this.renderers.some((e=>"function"==typeof e.render))],[h.TRANSPARENT_MATERIAL,()=>this.renderers.some((e=>"function"==typeof e.renderTransparent))]]),this.renderers=new t,this.context=null}initialize(){this.addHandles([s((()=>this.view.ready),(e=>{e?(this.context=new d(this.view),this.view._stage.addRenderPlugin(this)):(this.renderers.forEach((e=>p(e,"dispose",this.context))),this.context=null)}),n)])}destroy(){this.renderers.drain((e=>{this.context&&p(e,"dispose",this.context)})),this.view._stage?.removeRenderPlugin(this),this.context=null}add(e){this.renderers.includes(e)?r.getLogger("esri.views.3d.externalRenderers.ExternalRendererStore").warn("add(): Cannot add external renderer: renderer has already been added"):(this.renderers.add(e),this.context&&(this._webglStateReset(),p(e,"setup",this.context),this.view._stage.renderView.requestRender()))}remove(e){const t=this.renderers.indexOf(e);-1!==t&&(this.renderers.removeAt(t),this.context&&(p(e,"dispose",this.context),this.view._stage.renderView.requestRender()))}initializeRenderContext(e){this.context.rctx=e.renderContext.rctx,this.renderers.length>0&&this._webglStateReset(),this.renderers.forEach((e=>p(e,"setup",this.context)))}uninitializeRenderContext(){}renderNode(e){if(0===this.renderers.length||e.output!==a.Color)return;const t=t=>{this._updateContext(e),this._webglStateReset(),this.renderers.forEach((e=>p(e,t,this.context)))};e.bindParameters.slot===h.OPAQUE_MATERIAL?t("render"):t("renderTransparent")}_updateContext(e){this.context.camera.copyFrom(e.bindParameters.camera),this.context.sunLight=e.bindParameters.lighting.legacy,this.context._renderTargetHelper=e.offscreenRenderingHelper}_webglStateReset(){this.context.rctx.resetState(),this.context._renderTargetHelper?.bindFbo()}};function p(e,t,r){"function"==typeof e[t]&&null!=r&&e[t]?.(r)}e([i({constructOnly:!0})],l.prototype,"view",void 0),l=e([o("esri.views.3d.externalRenderers.StageRenderer")],l);export{l as StageRenderer};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.28/esri/copyright.txt for details.
4
4
  */
5
- import{colorVectorToColorAndOpacity as e}from"../../../core/colorUtils.js";import{i as t}from"../../../chunks/mat4.js";import{f as r,b as n,e as o,n as i}from"../../../chunks/vec3.js";import{sv3d as c,sm4d as a}from"../../../geometry/support/vectorStacks.js";import{hydrateGeometry as l}from"../../../layers/graphics/hydratedFeatures.js";import{Manipulator3D as s}from"./Manipulator3D.js";import{RenderObject as u}from"./RenderObject.js";import{computeCentroid as m}from"../layers/graphics/graphicUtils.js";import{Attribute as d}from"../webgl-engine/lib/Attribute.js";import{CullFaceOptions as p}from"../webgl-engine/lib/basicInterfaces.js";import{Geometry as f}from"../webgl-engine/lib/Geometry.js";import{createPolylineGeometry as g,createSphereGeometry as w}from"../webgl-engine/lib/GeometryUtil.js";import{RenderOccludedFlag as b}from"../webgl-engine/lib/Material.js";import{VertexAttribute as j}from"../webgl-engine/lib/VertexAttribute.js";import{ColorMaterial as h}from"../webgl-engine/materials/ColorMaterial.js";import{ImageMaterial as O}from"../webgl-engine/materials/ImageMaterial.js";import{NativeLineMaterial as M}from"../webgl-engine/materials/NativeLineMaterial.js";import{RibbonLineMaterial as y}from"../webgl-engine/materials/RibbonLineMaterial.js";import{ShadedColorMaterial as D}from"../webgl-engine/materials/ShadedColorMaterial.js";import{ManipulatorStateCustomFlags as A,ManipulatorStateFlags as F}from"../../interactive/interfaces.js";function S(t,r=b.OccludeAndTransparent,n=!0){const o=e(t),i=!(t[3]<1);return n?new D({color:o,writeDepth:i,cullFace:p.Back,renderOccluded:r,isDecoration:!0}):new h({color:o,writeDepth:i,cullFace:p.Back,renderOccluded:r,isDecoration:!0})}function v(t,r=b.OccludeAndTransparent){const n=e(t);return new h({color:n,writeDepth:!0,cullFace:p.Front,renderOccluded:r,isDecoration:!0})}const R=Object.freeze({calloutLength:40,calloutWidth:1,discRadius:27,focusMultiplier:1.1});function k(e,t){const r=new s({view:e,autoScaleRenderObjects:!1,collisionPriority:1,metadata:t.metadata});return L(r,t),r}function L(e,t){const r=t.material??new O({transparent:!0,writeDepth:!1,textureId:t.texture?.id,renderOccluded:b.Opaque,isDecoration:!0}),n=t.focusMultiplier??R.focusMultiplier,o=t.calloutLength??R.calloutLength,i=R.discRadius*(t.discScale??1),c=i*n,a=(e,t)=>{const r=[0,1,2,2,3,0];return new f(t,[[j.POSITION,new d([o-e,-e,0,o+e,-e,0,o+e,e,0,o-e,e,0],3,!0),r],[j.UV0,new d([0,0,1,0,1,1,0,1],2,!0),r]])},l=t.calloutWidth??R.calloutWidth,s=new(l>1?y:M)({width:l,color:t.calloutColor,renderOccluded:b.OccludeAndTransparent,isDecoration:!0}),m=g(s,[[0,0,0],[o-i,0,0]]),p=g(s,[[0,0,0],[o-c,0,0]]),w=t.customStateMask??A.None;e.collisionType={type:"disc",direction:[0,0,1],offset:[o,0,0]},e.focusMultiplier=n,e.metadata=t.metadata,e.radius=i,e.renderObjects=[new u(a(i,r),F.Unfocused|w),new u(m,F.Unfocused|w),new u(a(c,r),F.Focused|w),new u(p,F.Focused|w)]}function U(e,t,r=A.None){const n=S(t),o=[new u(w(n,1,32,32),r)];return new s({view:e,renderObjects:o})}const I=Object.freeze({autoScaleRenderObjects:!1,worldSized:!0});function T(e,i,l,s){const u=r(c.get(),e,l),m=x(u,n(c.get(),s,u),l,a.get());t(m,m);const d=o(c.get(),i,m);return Math.atan2(d[1],d[0])}function x(e,t,r,o){const a=i(c.get(),e),l=i(c.get(),t),s=n(c.get(),a,l);return o[0]=a[0],o[1]=a[1],o[2]=a[2],o[3]=0,o[4]=l[0],o[5]=l[1],o[6]=l[2],o[7]=0,o[8]=s[0],o[9]=s[1],o[10]=s[2],o[11]=0,o[12]=r[0],o[13]=r[1],o[14]=r[2],o[15]=1,o}function N(e,t){const r=e.getViewForGraphic(t);return null!=r&&"computeAttachmentOrigin"in r?r.computeAttachmentOrigin(t,e.spatialReference):null}function z(e,t,r){const n=N(e,r);null==n?C(t,r.geometry):t.elevationAlignedLocation=n}function C(e,t){if(null==t)return;const r="mesh"===t.type?t.anchor:m(t);null!=r&&(e.location=l(r))}function G(e,t={}){return e>1?new y({...t,width:e}):new M(t)}export{T as calculateInputRotationTransform,x as calculateTranslateRotateFromBases,G as createLineMaterial,S as createManipulatorMaterial,v as createManipulatorOutlineMaterial,k as createRotateManipulator,U as createSphereManipulator,N as getGraphicAttachmentOrigin,z as placeAtGraphic,R as rotateManipulatorDefaults,L as updateRotateManipulator,I as worldScaledManipulatorSettings};
5
+ import{colorVectorToColorAndOpacity as e}from"../../../core/colorUtils.js";import{i as t}from"../../../chunks/mat4.js";import{f as r,b as n,e as o,n as i}from"../../../chunks/vec3.js";import{sv3d as c,sm4d as a}from"../../../geometry/support/vectorStacks.js";import{hydrateGeometry as l}from"../../../layers/graphics/hydratedFeatures.js";import{Manipulator3D as s}from"./Manipulator3D.js";import{RenderObject as u}from"./RenderObject.js";import{computeCentroid as m}from"../layers/graphics/graphicUtils.js";import{Attribute as d}from"../webgl-engine/lib/Attribute.js";import{CullFaceOptions as p}from"../webgl-engine/lib/basicInterfaces.js";import{Geometry as f}from"../webgl-engine/lib/Geometry.js";import{createPolylineGeometry as g,createSphereGeometry as w}from"../webgl-engine/lib/GeometryUtil.js";import{RenderOccludedFlag as b}from"../webgl-engine/lib/Material.js";import{VertexAttribute as j}from"../webgl-engine/lib/VertexAttribute.js";import{ColorMaterial as h}from"../webgl-engine/materials/ColorMaterial.js";import{ImageMaterial as O}from"../webgl-engine/materials/ImageMaterial.js";import{NativeLineMaterial as M}from"../webgl-engine/materials/NativeLineMaterial.js";import{RibbonLineMaterial as y}from"../webgl-engine/materials/RibbonLineMaterial.js";import{ShadedColorMaterial as D}from"../webgl-engine/materials/ShadedColorMaterial.js";import{ManipulatorStateCustomFlags as A,ManipulatorStateFlags as F}from"../../interactive/interfaces.js";function S(t,r=b.OccludeAndTransparent,n=!0){const o=e(t),i=!(t[3]<1);return n?new D({color:o,writeDepth:i,cullFace:p.Back,renderOccluded:r,isDecoration:!0}):new h({color:o,writeDepth:i,cullFace:p.Back,renderOccluded:r,isDecoration:!0})}function v(t,r=b.OccludeAndTransparent){const n=e(t);return new h({color:n,writeDepth:!0,cullFace:p.Front,renderOccluded:r,isDecoration:!0})}const R=Object.freeze({calloutLength:40,calloutWidth:1,discRadius:27,focusMultiplier:1.1});function k(e,t){const r=new s({view:e,autoScaleRenderObjects:!1,collisionPriority:1,metadata:t.metadata});return L(r,t),r}function L(e,t){const r=t.material??new O({transparent:!0,writeDepth:!1,textureId:t.texture?.id,renderOccluded:b.Opaque,isDecoration:!0}),n=t.focusMultiplier??R.focusMultiplier,o=t.calloutLength??R.calloutLength,i=R.discRadius*(t.discScale??1),c=i*n,a=(e,t)=>{const r=[0,1,2,2,3,0];return new f(t,[[j.POSITION,new d([o-e,-e,0,o+e,-e,0,o+e,e,0,o-e,e,0],r,3,!0)],[j.UV0,new d([0,0,1,0,1,1,0,1],r,2,!0)]])},l=t.calloutWidth??R.calloutWidth,s=new(l>1?y:M)({width:l,color:t.calloutColor,renderOccluded:b.OccludeAndTransparent,isDecoration:!0}),m=g(s,[[0,0,0],[o-i,0,0]]),p=g(s,[[0,0,0],[o-c,0,0]]),w=t.customStateMask??A.None;e.collisionType={type:"disc",direction:[0,0,1],offset:[o,0,0]},e.focusMultiplier=n,e.metadata=t.metadata,e.radius=i,e.renderObjects=[new u(a(i,r),F.Unfocused|w),new u(m,F.Unfocused|w),new u(a(c,r),F.Focused|w),new u(p,F.Focused|w)]}function U(e,t,r=A.None){const n=S(t),o=[new u(w(n,1,32,32),r)];return new s({view:e,renderObjects:o})}const I=Object.freeze({autoScaleRenderObjects:!1,worldSized:!0});function T(e,i,l,s){const u=r(c.get(),e,l),m=x(u,n(c.get(),s,u),l,a.get());t(m,m);const d=o(c.get(),i,m);return Math.atan2(d[1],d[0])}function x(e,t,r,o){const a=i(c.get(),e),l=i(c.get(),t),s=n(c.get(),a,l);return o[0]=a[0],o[1]=a[1],o[2]=a[2],o[3]=0,o[4]=l[0],o[5]=l[1],o[6]=l[2],o[7]=0,o[8]=s[0],o[9]=s[1],o[10]=s[2],o[11]=0,o[12]=r[0],o[13]=r[1],o[14]=r[2],o[15]=1,o}function N(e,t){const r=e.getViewForGraphic(t);return null!=r&&"computeAttachmentOrigin"in r?r.computeAttachmentOrigin(t,e.spatialReference):null}function z(e,t,r){const n=N(e,r);null==n?C(t,r.geometry):t.elevationAlignedLocation=n}function C(e,t){if(null==t)return;const r="mesh"===t.type?t.anchor:m(t);null!=r&&(e.location=l(r))}function G(e,t={}){return e>1?new y({...t,width:e}):new M(t)}export{T as calculateInputRotationTransform,x as calculateTranslateRotateFromBases,G as createLineMaterial,S as createManipulatorMaterial,v as createManipulatorOutlineMaterial,k as createRotateManipulator,U as createSphereManipulator,N as getGraphicAttachmentOrigin,z as placeAtGraphic,R as rotateManipulatorDefaults,L as updateRotateManipulator,I as worldScaledManipulatorSettings};