@arcgis/core 5.1.0-next.71 → 5.1.0-next.73

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 (439) hide show
  1. package/PopupTemplate.js +1 -1
  2. package/assets/esri/core/workers/RemoteClient.js +1 -1
  3. package/assets/esri/core/workers/chunks/003fd7745966fe03510c.js +1 -0
  4. package/assets/esri/core/workers/chunks/00bae4b7e179336e0362.js +1 -0
  5. package/assets/esri/core/workers/chunks/{36031cb53c486630f3c9.js → 026d3fa331caec1ea3d2.js} +1 -1
  6. package/assets/esri/core/workers/chunks/027c3ea756db68e51f0a.js +1 -0
  7. package/assets/esri/core/workers/chunks/041c372e98a6fba90b36.js +1 -0
  8. package/assets/esri/core/workers/chunks/{a5a46d0a0831497cf1b4.js → 0783890816bac45277b9.js} +1 -1
  9. package/assets/esri/core/workers/chunks/07aac6245a0d1adbb2d4.js +1 -0
  10. package/assets/esri/core/workers/chunks/0839da55707f7c4cf780.js +1 -0
  11. package/assets/esri/core/workers/chunks/0ae360bf253adee46737.js +1 -0
  12. package/assets/esri/core/workers/chunks/0c00e5e4bd18467bcecd.js +1 -0
  13. package/assets/esri/core/workers/chunks/0dad0bca8d58b2c63d22.js +1 -0
  14. package/assets/esri/core/workers/chunks/0ef93722524620023f69.js +1 -0
  15. package/assets/esri/core/workers/chunks/127cd8fee3717a473fc5.js +1 -0
  16. package/assets/esri/core/workers/chunks/1286f41f245ef22b3a26.js +1 -0
  17. package/assets/esri/core/workers/chunks/12e575a6d2b008b8fc2b.js +1 -0
  18. package/assets/esri/core/workers/chunks/{c92352b0e39576ca317a.js → 13e60f19f436b8d683ae.js} +1 -1
  19. package/assets/esri/core/workers/chunks/161d60fdac2013c15543.js +1 -0
  20. package/assets/esri/core/workers/chunks/1661684357912726a72a.js +1 -0
  21. package/assets/esri/core/workers/chunks/168de44a789d1cecc1f8.js +1 -0
  22. package/assets/esri/core/workers/chunks/1961b59756933e0a82f2.js +1 -0
  23. package/assets/esri/core/workers/chunks/1d9d7915cf7449e5d468.js +1 -0
  24. package/assets/esri/core/workers/chunks/1f85646936200a399c15.js +1 -0
  25. package/assets/esri/core/workers/chunks/{deb8a0b306d7b9c86b97.js → 2171aaa147aa4d9fc5b5.js} +1 -1
  26. package/assets/esri/core/workers/chunks/235cb82952a18ff8d206.js +1 -0
  27. package/assets/esri/core/workers/chunks/260d4571722cb1ff1366.js +1 -0
  28. package/assets/esri/core/workers/chunks/{3e972ae291df1844017d.js → 266ba61b72a278d93a26.js} +1 -1
  29. package/assets/esri/core/workers/chunks/27b80c386cebadcaca3c.js +1 -0
  30. package/assets/esri/core/workers/chunks/29d3890a5a43d934067a.js +1 -0
  31. package/assets/esri/core/workers/chunks/{7e6ccf9f3e756186e93e.js → 29e76256e3e867e80520.js} +1 -1
  32. package/assets/esri/core/workers/chunks/{333a0038d782d8a34d58.js → 2abf124e2956e4f76688.js} +1 -1
  33. package/assets/esri/core/workers/chunks/2f17438d215bea3ce70f.js +1 -0
  34. package/assets/esri/core/workers/chunks/{f6d5dd2eef0d9918096e.js → 30e710ec4d22c43d4e7e.js} +1 -1
  35. package/assets/esri/core/workers/chunks/30f04dc001eaf838d64c.js +1 -0
  36. package/assets/esri/core/workers/chunks/356cb86606b8c674f947.js +1 -0
  37. package/assets/esri/core/workers/chunks/398e0dd2bc7e1ab84831.js +1 -0
  38. package/assets/esri/core/workers/chunks/3b1052aa30af3f6186cc.js +1 -0
  39. package/assets/esri/core/workers/chunks/3bbf684ee2484eb44c9f.js +1 -0
  40. package/assets/esri/core/workers/chunks/3e87e3ad857d72f6ecbb.js +1 -0
  41. package/assets/esri/core/workers/chunks/{7cb6d8f7eaf762279632.js → 3ea5a18b264628dc37f0.js} +1 -1
  42. package/assets/esri/core/workers/chunks/41809c16544ec25120fa.js +1 -0
  43. package/assets/esri/core/workers/chunks/41913575dd45c65d645e.js +1 -0
  44. package/assets/esri/core/workers/chunks/{628f56c09838eb9c573b.js → 422824e407b550170c8c.js} +1 -1
  45. package/assets/esri/core/workers/chunks/42e483fde18f12da32a6.js +1 -0
  46. package/assets/esri/core/workers/chunks/43ab44d37bc0ea97ef98.js +1 -0
  47. package/assets/esri/core/workers/chunks/46e622857ba92a72a317.js +1 -0
  48. package/assets/esri/core/workers/chunks/47f2113357b2aa4f4f37.js +1 -0
  49. package/assets/esri/core/workers/chunks/488ed9584b527ec47be3.js +1 -0
  50. package/assets/esri/core/workers/chunks/4ad32580e0c0699fde1f.js +1 -0
  51. package/assets/esri/core/workers/chunks/4d0f793dee4ad919221b.js +1 -0
  52. package/assets/esri/core/workers/chunks/4eed175277eb0df3c821.js +1 -0
  53. package/assets/esri/core/workers/chunks/{916a8f3eed1fafdc7242.js → 54d07eadf113f0e4e506.js} +1 -1
  54. package/assets/esri/core/workers/chunks/54ed37ec9682ea739deb.js +1 -0
  55. package/assets/esri/core/workers/chunks/{9187d1caca1fd2d713e0.js → 55369c5bd65bcaf78da1.js} +1 -1
  56. package/assets/esri/core/workers/chunks/56fd3da911c2c4511e5d.js +1 -0
  57. package/assets/esri/core/workers/chunks/59592bb25f226865e88a.js +1 -0
  58. package/assets/esri/core/workers/chunks/{e77d958cb62536b8eebc.js → 5a4d7ba6dc1d4b41d80d.js} +1 -1
  59. package/assets/esri/core/workers/chunks/5c663d5f98bdfa29151b.js +1 -0
  60. package/assets/esri/core/workers/chunks/5d55b4449bcb24cd72b6.js +1 -0
  61. package/assets/esri/core/workers/chunks/5d8fe41a3c06ddb4094b.js +1 -0
  62. package/assets/esri/core/workers/chunks/{fe68c28d3c61f116ff23.js → 5ef37f37e405b3bb5450.js} +1 -1
  63. package/assets/esri/core/workers/chunks/608d707fd9d9f9088473.js +1 -0
  64. package/assets/esri/core/workers/chunks/{ae0a572cbbdd9815ee2e.js → 62b3e933f548ce354b99.js} +1 -1
  65. package/assets/esri/core/workers/chunks/656d6963e8f837fbf28f.js +1 -0
  66. package/assets/esri/core/workers/chunks/{a5afcd633b32e6ee31a7.js → 6a0352d20596ca3f4b64.js} +1 -1
  67. package/assets/esri/core/workers/chunks/6c7ff968bd4fc816442d.js +1 -0
  68. package/assets/esri/core/workers/chunks/6e526c06825ecc6c99c0.js +1 -0
  69. package/assets/esri/core/workers/chunks/6ea8b0d68881d16a2432.js +1 -0
  70. package/assets/esri/core/workers/chunks/7027d93dc5a4595d70c6.js +1 -0
  71. package/assets/esri/core/workers/chunks/70b35b2446558d5280e3.js +1 -0
  72. package/assets/esri/core/workers/chunks/7349cb45a93e6916f115.js +1 -0
  73. package/assets/esri/core/workers/chunks/751609831b283903ba48.js +1 -0
  74. package/assets/esri/core/workers/chunks/76edaeaf8fe344bb77a8.js +1 -0
  75. package/assets/esri/core/workers/chunks/76fe5b821d6b54db5721.js +1 -0
  76. package/assets/esri/core/workers/chunks/7951d93f5f15aa76f49c.js +1 -0
  77. package/assets/esri/core/workers/chunks/80ace1c7203c5059525d.js +1 -0
  78. package/assets/esri/core/workers/chunks/81d30c9062ad0120a863.js +1 -0
  79. package/assets/esri/core/workers/chunks/84772b023d04e415f17f.js +1 -0
  80. package/assets/esri/core/workers/chunks/{123e920e4460124ec3bb.js → 88b480a1d1fb01778798.js} +9 -30
  81. package/assets/esri/core/workers/chunks/88c5f7c712c6b89b5109.js +1 -0
  82. package/assets/esri/core/workers/chunks/88e469b82d2594f23649.js +1 -0
  83. package/assets/esri/core/workers/chunks/8a14e3db28c403b046cf.js +1 -0
  84. package/assets/esri/core/workers/chunks/8a664451845a47048859.js +1 -0
  85. package/assets/esri/core/workers/chunks/8a8242e7cc7e6a9e7876.js +1 -0
  86. package/assets/esri/core/workers/chunks/{4d51261d6131c07402cd.js → 8acee3fba488f202f82f.js} +1 -1
  87. package/assets/esri/core/workers/chunks/{31071a43e2c03984d619.js → 8d75f6f27c1c17c33992.js} +1 -1
  88. package/assets/esri/core/workers/chunks/9444ed8ea117861ae89b.js +1 -0
  89. package/assets/esri/core/workers/chunks/95d82c619dcbec2e1050.js +1 -0
  90. package/assets/esri/core/workers/chunks/96bba4d93a32ad34a1c8.js +1 -0
  91. package/assets/esri/core/workers/chunks/9a38fd68b02b617c45d3.js +1 -0
  92. package/assets/esri/core/workers/chunks/9d434360dfce1e49b7b9.js +1 -0
  93. package/assets/esri/core/workers/chunks/9eb4ae556950e1d0124d.js +2 -0
  94. package/assets/esri/core/workers/chunks/9f4b97204def91567e3c.js +1 -0
  95. package/assets/esri/core/workers/chunks/a37c28e3c4a2be9fd1d5.js +1 -0
  96. package/assets/esri/core/workers/chunks/{c06d021180418f2014de.js → a78bc340a794fd332667.js} +1 -1
  97. package/assets/esri/core/workers/chunks/{1edd39c7c4acdc591d10.js → a809b811121099a87a98.js} +1 -1
  98. package/assets/esri/core/workers/chunks/a8d7f59927bdad564141.js +1 -0
  99. package/assets/esri/core/workers/chunks/{f89976ec97938bf86996.js → abc06d10c7ac8ba5b0e4.js} +1 -1
  100. package/assets/esri/core/workers/chunks/abdf146b35e179b5b245.js +1 -0
  101. package/assets/esri/core/workers/chunks/abe22ae8ee0dcc9efbb7.js +1 -0
  102. package/assets/esri/core/workers/chunks/{fef5dc19736f12dfa99a.js → af5db0372d526e592fcc.js} +1 -1
  103. package/assets/esri/core/workers/chunks/{3b7cda16e656db450f11.js → afc0baf86ece710ef867.js} +1 -1
  104. package/assets/esri/core/workers/chunks/{6ac5ec3ecbca8860338b.js → b54b7cc6b23a70fed700.js} +1 -1
  105. package/assets/esri/core/workers/chunks/b6cadb8a579241adcb86.js +1 -0
  106. package/assets/esri/core/workers/chunks/b702279c48f3009f6dd8.js +1 -0
  107. package/assets/esri/core/workers/chunks/b9848bdbaf3d9ac93d54.js +1 -0
  108. package/assets/esri/core/workers/chunks/be1d6a571f76933dfbb0.js +1 -0
  109. package/assets/esri/core/workers/chunks/{eb3cdc4ff45243fc3cc5.js → bef27a25fbc4a6e19ec0.js} +1 -1
  110. package/assets/esri/core/workers/chunks/bfcdc5c315131aae34d8.js +1 -0
  111. package/assets/esri/core/workers/chunks/c0f624a2ca0d07ef8f8c.js +1 -0
  112. package/assets/esri/core/workers/chunks/c3381b9a36299210ee47.js +1 -0
  113. package/assets/esri/core/workers/chunks/{c2882a9e67124b7c18be.js → c503c79ba5761f7abbeb.js} +1 -1
  114. package/assets/esri/core/workers/chunks/{a65d576e90179a2b5400.js → c5507480344176fad241.js} +1 -1
  115. package/assets/esri/core/workers/chunks/c70df6ed190f9ebcf6aa.js +1 -0
  116. package/assets/esri/core/workers/chunks/cb5e4b9b4a59c2622eb5.js +1 -0
  117. package/assets/esri/core/workers/chunks/cd7159600ce132e32d04.js +1 -0
  118. package/assets/esri/core/workers/chunks/cfe246adb5e6cb6f0cfc.js +1 -0
  119. package/assets/esri/core/workers/chunks/d17fcfc502f0e0fa6523.js +596 -0
  120. package/assets/esri/core/workers/chunks/d201a5dff18a5bb467ab.js +1 -0
  121. package/assets/esri/core/workers/chunks/d65b1234867f7d773d50.js +2 -0
  122. package/assets/esri/core/workers/chunks/{4d8670f6fa8952b7bab6.js → d950d5c2844206502ff0.js} +1 -1
  123. package/assets/esri/core/workers/chunks/db3c484bfa607dec6050.js +1 -0
  124. package/assets/esri/core/workers/chunks/db588bf3256e95c977b7.js +1 -0
  125. package/assets/esri/core/workers/chunks/{967758a05170545cd371.js → dcc719e15b2e0cce1f3b.js} +1 -1
  126. package/assets/esri/core/workers/chunks/{6bb090f3e5c18604cb39.js → dd5b362bded458afa2d6.js} +1 -1
  127. package/assets/esri/core/workers/chunks/dfdd474fddcd1d6091ce.js +1 -0
  128. package/assets/esri/core/workers/chunks/{aa1a3a849aba84cf585b.js → e1bc9ad767e08dc18bbc.js} +1 -1
  129. package/assets/esri/core/workers/chunks/e235ea4293d5d463acfb.js +1 -0
  130. package/assets/esri/core/workers/chunks/e25a684eb9f025bdcc01.js +1 -0
  131. package/assets/esri/core/workers/chunks/e272411e2c9378aa8496.js +1312 -0
  132. package/assets/esri/core/workers/chunks/e43486113aaf72ac4dc1.js +1 -0
  133. package/assets/esri/core/workers/chunks/ea4c3393c5757e309a71.js +1 -0
  134. package/assets/esri/core/workers/chunks/ed216ddeb7f59f510bd0.js +1 -0
  135. package/assets/esri/core/workers/chunks/ef8886dff54063928bcb.js +1 -0
  136. package/assets/esri/core/workers/chunks/{231f502cd15f30d12be2.js → f1673e723b336204ad77.js} +1 -1
  137. package/assets/esri/core/workers/chunks/{d69110ec4078c583a05e.js → f207b3be0714cc50030a.js} +1 -1
  138. package/assets/esri/core/workers/chunks/f5223ffb3be548c9b0a1.js +1 -0
  139. package/assets/esri/core/workers/chunks/f53805c7a84203305b2c.js +1 -0
  140. package/assets/esri/core/workers/chunks/f5c57ff48ca505ed701d.js +1 -0
  141. package/assets/esri/core/workers/chunks/fae147d03ed723ab234d.js +1 -0
  142. package/chunks/CheckerBoard.glsl.js +3 -5
  143. package/chunks/ColorMaterial.glsl.js +4 -6
  144. package/chunks/ComponentShader.glsl.js +42 -44
  145. package/chunks/DefaultMaterial.glsl.js +21 -23
  146. package/chunks/EdgeShader.glsl.js +9 -11
  147. package/chunks/GaussianSplat.glsl.js +8 -8
  148. package/chunks/GlobalIllumination.glsl.js +186 -116
  149. package/chunks/GlobalIlluminationBlur.glsl.js +81 -61
  150. package/chunks/GlobalIlluminationUpscale.glsl.js +66 -0
  151. package/chunks/ImageMaterial.glsl.js +5 -7
  152. package/chunks/LineCallout.glsl.js +9 -12
  153. package/chunks/LineMarker.glsl.js +24 -26
  154. package/chunks/Path.glsl.js +15 -17
  155. package/chunks/Pattern.glsl.js +25 -27
  156. package/chunks/RealisticTree.glsl.js +11 -13
  157. package/chunks/RibbonLine.glsl.js +42 -45
  158. package/chunks/ShadedColorMaterial.glsl.js +8 -9
  159. package/chunks/Water.glsl.js +18 -20
  160. package/config.js +1 -1
  161. package/form/elements/FieldElement.d.ts +3 -2
  162. package/form/elements/inputs/Input.d.ts +1 -1
  163. package/form/elements/inputs/MultipleChoiceInput.d.ts +65 -0
  164. package/form/elements/inputs/MultipleChoiceInput.js +2 -0
  165. package/form/elements/inputs/inputUtils.js +1 -1
  166. package/form/elements/inputs/multipleChoice/Choice.d.ts +30 -0
  167. package/form/elements/inputs/multipleChoice/Choice.js +2 -0
  168. package/form/elements/inputs/multipleChoice/OtherChoice.d.ts +28 -0
  169. package/form/elements/inputs/multipleChoice/OtherChoice.js +2 -0
  170. package/form/elements/inputs.d.ts +11 -2
  171. package/form/elements/inputs.js +1 -1
  172. package/form/support/formUtils.js +1 -1
  173. package/interfaces.d.ts +28 -0
  174. package/kernel.js +1 -1
  175. package/layers/Lyr3DWasmPerSceneView.js +1 -1
  176. package/layers/VoxelWasmPerSceneView.js +1 -1
  177. package/layers/graphics/FlatFeature.js +1 -1
  178. package/layers/graphics/FlatFeatureSet.js +1 -1
  179. package/layers/graphics/OptimizedFeature.js +1 -1
  180. package/layers/graphics/data/AttributesBuilder.js +1 -1
  181. package/layers/graphics/data/QueryEngineResult.js +1 -1
  182. package/layers/graphics/data/flatFeatureQueryEngineAdapter.js +1 -1
  183. package/layers/graphics/data/optimizedFeatureQueryEngineAdapter.js +1 -1
  184. package/layers/graphics/featureConversionUtils.js +1 -1
  185. package/layers/support/LabelClass.js +1 -1
  186. package/layers/support/featureLayerUtils.js +1 -1
  187. package/layers/support/labelUtils.js +1 -1
  188. package/layers/video/videoUtils.js +1 -1
  189. package/package.json +2 -2
  190. package/popupTemplateUtils.js +2 -0
  191. package/renderers/visualVariables/SizeVariable.js +1 -1
  192. package/renderers/visualVariables/support/sizeVariableUtils.js +1 -1
  193. package/rest/query/operations/pbfFeatureServiceParser.js +1 -1
  194. package/rest/support/OutDistance.js +2 -0
  195. package/rest/support/Query.js +1 -1
  196. package/smartMapping/statistics/support/utils.js +1 -1
  197. package/smartMapping/support/adapters/InMemoryLayerAdapter.js +1 -1
  198. package/support/arcadeUtils.js +1 -1
  199. package/support/revision.js +1 -1
  200. package/third-party-notices.txt +7 -29
  201. package/views/2d/engine/webgl/shaderGraph/techniques/mesh/MeshWriter.js +1 -1
  202. package/views/2d/engine/webgl/shaders/sources/shaderRepository.js +1 -1
  203. package/views/2d/layers/FeatureLikeLayerView2D.js +1 -1
  204. package/views/2d/layers/features/layerAdapters/CatalogFootprintLayerAdapter.js +1 -1
  205. package/views/2d/layers/features/layerAdapters/FeatureLayerAdapter.js +1 -1
  206. package/views/2d/layers/features/layerAdapters/InMemoryLayerAdapter.js +1 -1
  207. package/views/2d/layers/features/layerAdapters/KnowledgeGraphSublayerAdapter.js +1 -1
  208. package/views/2d/layers/features/layerAdapters/OGCFeatureLayerAdapter.js +1 -1
  209. package/views/2d/layers/features/layerAdapters/OrientedImageryLayerAdapter.js +1 -1
  210. package/views/2d/layers/features/layerAdapters/SubtypeGroupLayerAdapter.js +1 -1
  211. package/views/2d/layers/features/support/FeatureSetReader.js +1 -1
  212. package/views/2d/layers/features/support/FeatureSetReaderPBF.js +1 -1
  213. package/views/3d/environment/EnvironmentManager.js +1 -1
  214. package/views/3d/layers/FeatureLikeLayerView3D.js +1 -1
  215. package/views/3d/layers/I3SMeshView3D.js +1 -1
  216. package/views/3d/layers/IntegratedMesh3DTilesLayerView3D.js +1 -1
  217. package/views/3d/layers/IntegratedMeshNormals.js +1 -1
  218. package/views/3d/layers/StreamLayerView3D.js +1 -1
  219. package/views/3d/layers/graphics/featureExpressionInfoUtils.js +1 -1
  220. package/views/3d/state/ViewStateManager.js +1 -1
  221. package/views/3d/support/orientedBoundingBox.js +1 -1
  222. package/views/3d/terrain/OverlayRenderer.js +1 -1
  223. package/views/3d/terrain/TerrainRenderer.js +1 -1
  224. package/views/3d/webgl-engine/collections/Component/Material/ComponentMaterial.js +1 -1
  225. package/views/3d/webgl-engine/collections/Component/Material/ComponentMaterialGlobalParameters.js +1 -1
  226. package/views/3d/webgl-engine/collections/Component/Material/ComponentMaterialRepository.js +1 -1
  227. package/views/3d/webgl-engine/collections/Component/Material/ComponentShader.glsl.js +1 -1
  228. package/views/3d/webgl-engine/core/renderPasses/RenderPassManager.js +1 -1
  229. package/views/3d/webgl-engine/core/shaderLibrary/hud/HUD.glsl.js +20 -32
  230. package/views/3d/webgl-engine/core/shaderLibrary/shading/GlobalIlluminationWeights.glsl.js +21 -0
  231. package/views/3d/webgl-engine/core/shaderLibrary/shading/ReadGlobalIllumination.glsl.js +11 -7
  232. package/views/3d/webgl-engine/core/shaderLibrary/shading/VisualVariables.glsl.js +5 -3
  233. package/views/3d/webgl-engine/core/shaderLibrary/terrain/Overlay.glsl.js +1 -1
  234. package/views/3d/webgl-engine/effects/RenderPluginManager.js +1 -1
  235. package/views/3d/webgl-engine/effects/geometry/RenderOccludedRenderNode.js +1 -1
  236. package/views/3d/webgl-engine/effects/globalIllumination/GlobalIllumination.glsl.js +2 -0
  237. package/views/3d/webgl-engine/effects/globalIllumination/GlobalIllumination.js +1 -1
  238. package/views/3d/webgl-engine/effects/globalIllumination/GlobalIlluminationBlur.glsl.js +2 -0
  239. package/views/3d/webgl-engine/effects/globalIllumination/GlobalIlluminationBlurTechnique.js +1 -1
  240. package/views/3d/webgl-engine/effects/globalIllumination/GlobalIlluminationTechnique.js +1 -1
  241. package/views/3d/webgl-engine/effects/globalIllumination/GlobalIlluminationUpscale.glsl.js +2 -0
  242. package/views/3d/webgl-engine/effects/globalIllumination/GlobalIlluminationUpscaleTechnique.js +2 -0
  243. package/views/3d/webgl-engine/effects/glow/GlowRenderNode.js +1 -1
  244. package/views/3d/webgl-engine/lib/BindParameters.js +1 -1
  245. package/views/3d/webgl-engine/lib/Compositor.js +1 -1
  246. package/views/3d/webgl-engine/lib/GaussianSplatRenderNode.js +1 -1
  247. package/views/3d/webgl-engine/lib/RenderFeature.js +1 -1
  248. package/views/3d/webgl-engine/lib/Renderer.js +1 -1
  249. package/views/3d/webgl-engine/lib/SortedRenderGeometryRenderer.js +1 -1
  250. package/views/3d/webgl-engine/lib/Viewshed.js +1 -1
  251. package/views/3d/webgl-engine/lib/edgeRendering/EdgeRenderer.js +1 -1
  252. package/views/3d/webgl-engine/lib/edgeRendering/EdgeShader.glsl.js +1 -1
  253. package/views/3d/webgl-engine/lib/edgeRendering/EdgeShaderTechniqueConfiguration.js +1 -1
  254. package/views/3d/webgl-engine/materials/CheckerBoardMaterial.js +1 -1
  255. package/views/3d/webgl-engine/materials/ColorMaterial.js +1 -1
  256. package/views/3d/webgl-engine/materials/DefaultMaterial.js +1 -1
  257. package/views/3d/webgl-engine/materials/HUDMaterial.js +1 -1
  258. package/views/3d/webgl-engine/materials/HeatmapDensityMaterial.js +1 -1
  259. package/views/3d/webgl-engine/materials/ImageMaterial.js +1 -1
  260. package/views/3d/webgl-engine/materials/LineCalloutMaterial.js +1 -1
  261. package/views/3d/webgl-engine/materials/LineMarkerMaterial.js +1 -1
  262. package/views/3d/webgl-engine/materials/MeasurementArrowMaterial.js +1 -1
  263. package/views/3d/webgl-engine/materials/Path.glsl.js +1 -1
  264. package/views/3d/webgl-engine/materials/PathMaterial.js +1 -1
  265. package/views/3d/webgl-engine/materials/PathTechniqueConfiguration.js +1 -1
  266. package/views/3d/webgl-engine/materials/PatternMaterial.js +1 -1
  267. package/views/3d/webgl-engine/materials/RibbonLineMaterial.js +1 -1
  268. package/views/3d/webgl-engine/materials/ShadedColorMaterial.js +1 -1
  269. package/views/3d/webgl-engine/materials/SlicePlaneMaterial.js +1 -1
  270. package/views/3d/webgl-engine/materials/Water.glsl.js +1 -1
  271. package/views/3d/webgl-engine/materials/WaterMaterial.js +1 -1
  272. package/views/3d/webgl-engine/materials/WaterTechniqueConfiguration.js +1 -1
  273. package/views/3d/webgl-engine/shaders/CheckerBoard.glsl.js +1 -1
  274. package/views/3d/webgl-engine/shaders/CheckerBoardTechniqueConfiguration.js +1 -1
  275. package/views/3d/webgl-engine/shaders/ColorMaterial.glsl.js +1 -1
  276. package/views/3d/webgl-engine/shaders/ColorMaterialTechniqueConfiguration.js +1 -1
  277. package/views/3d/webgl-engine/shaders/DefaultMaterial.glsl.js +1 -1
  278. package/views/3d/webgl-engine/shaders/DefaultMaterialTechniqueConfiguration.js +1 -1
  279. package/views/3d/webgl-engine/shaders/GaussianSplat.glsl.js +1 -1
  280. package/views/3d/webgl-engine/shaders/GaussianSplatTechniqueConfiguration.js +1 -1
  281. package/views/3d/webgl-engine/shaders/HUDMaterialTechniqueConfiguration.js +1 -1
  282. package/views/3d/webgl-engine/shaders/ImageMaterial.glsl.js +1 -1
  283. package/views/3d/webgl-engine/shaders/ImageMaterialTechniqueConfiguration.js +1 -1
  284. package/views/3d/webgl-engine/shaders/LineCallout.glsl.js +1 -1
  285. package/views/3d/webgl-engine/shaders/LineCalloutTechnique.js +1 -1
  286. package/views/3d/webgl-engine/shaders/LineCalloutTechniqueConfiguration.js +1 -1
  287. package/views/3d/webgl-engine/shaders/LineMarker.glsl.js +1 -1
  288. package/views/3d/webgl-engine/shaders/LineMarkerTechnique.js +1 -1
  289. package/views/3d/webgl-engine/shaders/LineMarkerTechniqueConfiguration.js +1 -1
  290. package/views/3d/webgl-engine/shaders/Pattern.glsl.js +1 -1
  291. package/views/3d/webgl-engine/shaders/PatternTechniqueConfiguration.js +1 -1
  292. package/views/3d/webgl-engine/shaders/RealisticTree.glsl.js +1 -1
  293. package/views/3d/webgl-engine/shaders/RibbonLine.glsl.js +1 -1
  294. package/views/3d/webgl-engine/shaders/RibbonLineTechnique.js +1 -1
  295. package/views/3d/webgl-engine/shaders/RibbonLineTechniqueConfiguration.js +1 -1
  296. package/views/3d/webgl-engine/shaders/ShadedColorMaterial.glsl.js +1 -1
  297. package/views/3d/webgl-engine/shaders/ShadedColorMaterialTechniqueConfiguration.js +1 -1
  298. package/views/3d/webgl-engine/statistics/RendererPerformanceInfo.js +1 -1
  299. package/views/VideoView.js +1 -1
  300. package/views/interactive/sketch/SketchOptions.d.ts +3 -1
  301. package/views/interactive/sketch/SketchTooltipOptions.d.ts +6 -0
  302. package/views/layers/FeatureLikeLayerView.js +1 -1
  303. package/views/support/Scheduler.js +1 -1
  304. package/views/video/VideoOperationalDataView.js +1 -1
  305. package/views/webgl/ShaderBuilder.js +1 -1
  306. package/widgets/BatchAttributeForm/BatchAttributeFormViewModel.js +1 -1
  307. package/widgets/BatchAttributeForm/batchAttributeFormUtils.js +1 -1
  308. package/widgets/BatchAttributeForm/inputs/SingleFeatureInputAdapter.js +2 -0
  309. package/widgets/BatchAttributeForm/inputs/TextElementInput.d.ts +28 -4
  310. package/widgets/BatchAttributeForm/inputs/TextElementInput.js +1 -1
  311. package/widgets/BatchAttributeForm/templates/AttachmentElementTemplate.js +2 -0
  312. package/widgets/BatchAttributeForm/templates/support/createBatchFormTemplate.js +1 -1
  313. package/widgets/BatchAttributeForm/templates/support/hashElementTemplate.js +1 -1
  314. package/widgets/BatchAttributeForm/templates/support/templateUtils.js +1 -1
  315. package/widgets/FeatureTable/FeatureTableViewModel.d.ts +19 -3
  316. package/widgets/FeatureTable/FeatureTableViewModel.js +1 -1
  317. package/widgets/FeatureTable/Grid/GridViewModel.js +1 -1
  318. package/widgets/FeatureTable/VisibleElements.d.ts +15 -1
  319. package/widgets/FeatureTable/VisibleElements.js +1 -1
  320. package/widgets/FeatureTable/support/FeatureStore.js +1 -1
  321. package/widgets/FeatureTable.d.ts +15 -1
  322. package/widgets/FeatureTable.js +1 -1
  323. package/widgets/Search/SearchViewModel.js +1 -1
  324. package/widgets/Search/support/layerSearchUtils.js +1 -1
  325. package/widgets/support/widgetUtils.js +1 -1
  326. package/assets/esri/core/workers/chunks/09ecb36e44096e577af8.js +0 -1
  327. package/assets/esri/core/workers/chunks/0ca06ea649bbdb93ff49.js +0 -1
  328. package/assets/esri/core/workers/chunks/10308c9f3f0d709d96bc.js +0 -1
  329. package/assets/esri/core/workers/chunks/141edf5ed890105a079b.js +0 -1
  330. package/assets/esri/core/workers/chunks/160b9a76b75875507c86.js +0 -1
  331. package/assets/esri/core/workers/chunks/16dfdee05704df249e95.js +0 -1
  332. package/assets/esri/core/workers/chunks/17ef955dc48e329aa184.js +0 -1
  333. package/assets/esri/core/workers/chunks/18001536ed345955121a.js +0 -1
  334. package/assets/esri/core/workers/chunks/20e715e3aeb1c3265901.js +0 -1
  335. package/assets/esri/core/workers/chunks/238f51d0b36f998017b8.js +0 -1
  336. package/assets/esri/core/workers/chunks/2cee6d751c5e73fe09d4.js +0 -1
  337. package/assets/esri/core/workers/chunks/314140e2e9b813191907.js +0 -1
  338. package/assets/esri/core/workers/chunks/3158a3487d3e8a61b680.js +0 -1
  339. package/assets/esri/core/workers/chunks/3b1446286a9b87f34761.js +0 -1
  340. package/assets/esri/core/workers/chunks/3f7fd58ee7d71989fc83.js +0 -1
  341. package/assets/esri/core/workers/chunks/41396724040180d2537f.js +0 -1
  342. package/assets/esri/core/workers/chunks/416e031bafc0189544fa.js +0 -1
  343. package/assets/esri/core/workers/chunks/55ee78923987ed17ea8c.js +0 -1
  344. package/assets/esri/core/workers/chunks/56c7d7c7217557375fb6.js +0 -1
  345. package/assets/esri/core/workers/chunks/58b3c888c8bfedbe6443.js +0 -1
  346. package/assets/esri/core/workers/chunks/5a1d975b3e9e6b7eff67.js +0 -1
  347. package/assets/esri/core/workers/chunks/5f6942ac94acd7842926.js +0 -1
  348. package/assets/esri/core/workers/chunks/6118706b9a038e9a06b8.js +0 -1
  349. package/assets/esri/core/workers/chunks/6d15229b3fa84a7acf4d.js +0 -599
  350. package/assets/esri/core/workers/chunks/7314c0131403cac84ad7.js +0 -1
  351. package/assets/esri/core/workers/chunks/73545bb13c70f6a347a4.js +0 -1
  352. package/assets/esri/core/workers/chunks/73a045061e69a22b6869.js +0 -1
  353. package/assets/esri/core/workers/chunks/75669912cddcb5db52c8.js +0 -1
  354. package/assets/esri/core/workers/chunks/7ca32806e47be15109a4.js +0 -1
  355. package/assets/esri/core/workers/chunks/7d6ed65bbcd279448191.js +0 -1
  356. package/assets/esri/core/workers/chunks/81f149e45c79b9b086fb.js +0 -1
  357. package/assets/esri/core/workers/chunks/84fa25f66a6949290221.js +0 -1
  358. package/assets/esri/core/workers/chunks/852aabbf671d2ca9cd33.js +0 -1
  359. package/assets/esri/core/workers/chunks/854fe80272b59fafc2e9.js +0 -1
  360. package/assets/esri/core/workers/chunks/85edbb072a2ce6c1bb30.js +0 -2
  361. package/assets/esri/core/workers/chunks/861817be5e050e9522ab.js +0 -1
  362. package/assets/esri/core/workers/chunks/89345a682dea60ef1643.js +0 -1
  363. package/assets/esri/core/workers/chunks/8985402c328b90af5724.js +0 -1
  364. package/assets/esri/core/workers/chunks/89fdf9ad10ca8fbb08a5.js +0 -1
  365. package/assets/esri/core/workers/chunks/8b094330323d9b16fb5d.js +0 -1
  366. package/assets/esri/core/workers/chunks/90aed8c4b266832f84ca.js +0 -1
  367. package/assets/esri/core/workers/chunks/943cf0653a2b7de16a4f.js +0 -1
  368. package/assets/esri/core/workers/chunks/9776c2db337222ceceef.js +0 -1
  369. package/assets/esri/core/workers/chunks/990853e9df38fdfc58b5.js +0 -1
  370. package/assets/esri/core/workers/chunks/9a21ba0c45a96b94c05e.js +0 -1
  371. package/assets/esri/core/workers/chunks/9a235c92f21df2c17aa8.js +0 -1
  372. package/assets/esri/core/workers/chunks/9b56162ac67c992193ce.js +0 -1
  373. package/assets/esri/core/workers/chunks/9f1f5fb648302c43ad12.js +0 -1
  374. package/assets/esri/core/workers/chunks/a1e6187c239fdc7553ed.js +0 -1
  375. package/assets/esri/core/workers/chunks/a4b6fdbc995be03d2afb.js +0 -1
  376. package/assets/esri/core/workers/chunks/a760be8fa6c6ea6b745c.js +0 -1
  377. package/assets/esri/core/workers/chunks/a8782286ce3c0d6c20e6.js +0 -1
  378. package/assets/esri/core/workers/chunks/a96692514dcaa50340dd.js +0 -1
  379. package/assets/esri/core/workers/chunks/a994a3c912a33b2f4100.js +0 -1
  380. package/assets/esri/core/workers/chunks/aa7aaeae31ddb259e55e.js +0 -1
  381. package/assets/esri/core/workers/chunks/abcc5fb71be2bd94878c.js +0 -1
  382. package/assets/esri/core/workers/chunks/aecb05df4ad1454f5435.js +0 -1
  383. package/assets/esri/core/workers/chunks/aecb105db7cec2c9c4c5.js +0 -1
  384. package/assets/esri/core/workers/chunks/b19f33e026a2a43b17c4.js +0 -1
  385. package/assets/esri/core/workers/chunks/b3950d5f1f3352521504.js +0 -1
  386. package/assets/esri/core/workers/chunks/b3f0600729227b458a75.js +0 -1
  387. package/assets/esri/core/workers/chunks/b5922991d2f450e6a9d9.js +0 -1
  388. package/assets/esri/core/workers/chunks/b8643976a7f984552d94.js +0 -1
  389. package/assets/esri/core/workers/chunks/b8a11d32a4847513619b.js +0 -1
  390. package/assets/esri/core/workers/chunks/b8acb6c2538053c01cc6.js +0 -1
  391. package/assets/esri/core/workers/chunks/ba4259aa050169c1d523.js +0 -1
  392. package/assets/esri/core/workers/chunks/bbaf1d9835671c0165ca.js +0 -1
  393. package/assets/esri/core/workers/chunks/bcefdf9753d9d2f6f1be.js +0 -1
  394. package/assets/esri/core/workers/chunks/c178e2cfc34603661b1d.js +0 -1
  395. package/assets/esri/core/workers/chunks/c3e80c0e29ac6a7a6f80.js +0 -1
  396. package/assets/esri/core/workers/chunks/c79827f879d1d58d3f1b.js +0 -1
  397. package/assets/esri/core/workers/chunks/c92b40a532e708e506cc.js +0 -1
  398. package/assets/esri/core/workers/chunks/cb903ccbce87172a0757.js +0 -1
  399. package/assets/esri/core/workers/chunks/cda2e445eb2ac269abdf.js +0 -1
  400. package/assets/esri/core/workers/chunks/ce44e172e2847fd8df14.js +0 -1
  401. package/assets/esri/core/workers/chunks/cff7e921649aef715c78.js +0 -1
  402. package/assets/esri/core/workers/chunks/d0c3ab70f390cd579fed.js +0 -1
  403. package/assets/esri/core/workers/chunks/d315098b038a96084ff5.js +0 -1
  404. package/assets/esri/core/workers/chunks/d4a9eb4470cc6a1f67fc.js +0 -2
  405. package/assets/esri/core/workers/chunks/d8c0d18f0132872decd3.js +0 -1
  406. package/assets/esri/core/workers/chunks/db0061a6d5bf454cc509.js +0 -1
  407. package/assets/esri/core/workers/chunks/dca595fdd5e1a571e441.js +0 -1
  408. package/assets/esri/core/workers/chunks/dcfafcf4386f2940d000.js +0 -1
  409. package/assets/esri/core/workers/chunks/df8143b72ef94806c992.js +0 -1
  410. package/assets/esri/core/workers/chunks/e2b034c391c603f7f825.js +0 -1
  411. package/assets/esri/core/workers/chunks/e3a73d9acebccd3ba49b.js +0 -1
  412. package/assets/esri/core/workers/chunks/e67bdd8bf38ebe89a344.js +0 -1
  413. package/assets/esri/core/workers/chunks/e797d45eba0884dc7e6f.js +0 -1
  414. package/assets/esri/core/workers/chunks/e81a3da05fcff97b4752.js +0 -1
  415. package/assets/esri/core/workers/chunks/e957d52cb9643961a843.js +0 -1127
  416. package/assets/esri/core/workers/chunks/e9dd60d0220036545ebb.js +0 -1
  417. package/assets/esri/core/workers/chunks/ea6d3b7c7d720aa7bc94.js +0 -1
  418. package/assets/esri/core/workers/chunks/eb9982bc866976fef960.js +0 -1
  419. package/assets/esri/core/workers/chunks/ec4669a0edeca94710e0.js +0 -1
  420. package/assets/esri/core/workers/chunks/ef013a77950c1902de11.js +0 -1
  421. package/assets/esri/core/workers/chunks/ef9d74f8d5a502fda809.js +0 -1
  422. package/assets/esri/core/workers/chunks/f09446b9ff937a84d6d3.js +0 -1
  423. package/assets/esri/core/workers/chunks/f0bc5e8e44d53b73d431.js +0 -1
  424. package/assets/esri/core/workers/chunks/f653970d983f17fb764b.js +0 -1
  425. package/assets/esri/core/workers/chunks/f9edc685099f51363f41.js +0 -1
  426. package/assets/esri/core/workers/chunks/fa687ba2d66fcc2501da.js +0 -1
  427. package/assets/esri/core/workers/chunks/fb9a889ec9fd23739a14.js +0 -1
  428. package/assets/esri/core/workers/chunks/fe1b67ab7748a3aef231.js +0 -1
  429. package/chunks/HUDCompositing.glsl.js +0 -2
  430. package/views/3d/webgl-engine/core/shaderLibrary/shading/EncodingColor.glsl.js +0 -7
  431. package/views/3d/webgl-engine/core/shaderLibrary/shading/MultipassGeometryTest.glsl.js +0 -5
  432. package/views/3d/webgl-engine/core/shaderLibrary/shading/TerrainDepthTest.glsl.js +0 -8
  433. package/views/3d/webgl-engine/effects/fboFormatUtils.js +0 -2
  434. package/views/3d/webgl-engine/shaders/GlobalIllumination.glsl.js +0 -2
  435. package/views/3d/webgl-engine/shaders/GlobalIlluminationBlur.glsl.js +0 -2
  436. package/views/3d/webgl-engine/shaders/HUDCompositing.glsl.js +0 -2
  437. package/views/3d/webgl-engine/shaders/HUDCompositingTechnique.js +0 -2
  438. /package/assets/esri/core/workers/chunks/{85edbb072a2ce6c1bb30.js.LICENSE.txt → 9eb4ae556950e1d0124d.js.LICENSE.txt} +0 -0
  439. /package/assets/esri/core/workers/chunks/{d4a9eb4470cc6a1f67fc.js.LICENSE.txt → d65b1234867f7d773d50.js.LICENSE.txt} +0 -0
@@ -0,0 +1,2 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
+ import{__decorate as t}from"tslib";import{JSONSupport as e}from"../../../../core/JSONSupport.js";import{property as o,subclass as i}from"../../../../core/accessorSupport/decorators.js";var r;let s=r=class extends e{constructor(t){super(t),this.fieldName="",this.hint=null,this.label=null}clone(){return new r({fieldName:this.fieldName,hint:this.hint,label:this.label})}};t([o({type:String,json:{write:!0}})],s.prototype,"fieldName",void 0),t([o({type:String,json:{write:!0}})],s.prototype,"hint",void 0),t([o({type:String,json:{write:!0}})],s.prototype,"label",void 0),s=r=t([i("esri.form.elements.inputs.multipleChoice.OtherChoice")],s);const l=s;export{l as default};
@@ -9,6 +9,7 @@
9
9
  * import DatePickerInput from "@arcgis/core/form/elements/inputs/DatePickerInput.js";
10
10
  * import DateTimeOffsetPickerInput from "@arcgis/core/form/elements/inputs/DateTimeOffsetPickerInput.js";
11
11
  * import DateTimePickerInput from "@arcgis/core/form/elements/inputs/DateTimePickerInput.js";
12
+ * import MultipleChoiceInput from "@arcgis/core/form/elements/inputs/MultipleChoiceInput.js";
12
13
  * import RadioButtonsInput from "@arcgis/core/form/elements/inputs/RadioButtonsInput.js";
13
14
  * import SwitchInput from "@arcgis/core/form/elements/inputs/SwitchInput.js";
14
15
  * import TextAreaInput from "@arcgis/core/form/elements/inputs/TextAreaInput.js";
@@ -19,7 +20,7 @@
19
20
  * You can use this module to import them on a single line:
20
21
  *
21
22
  * ```js
22
- * import { BarcodeScannerInput, ComboBoxInput, DatePickerInput, DateTimeOffsetPickerInput, DateTimePickerInput, RadioButtonsInput, SwitchInput, TextAreaInput, TextBoxInput, TimePickerInput } from "@arcgis/core/form/elements/inputs.js";
23
+ * import { BarcodeScannerInput, ComboBoxInput, DatePickerInput, DateTimeOffsetPickerInput, DateTimePickerInput, MultipleChoiceInput, RadioButtonsInput, SwitchInput, TextAreaInput, TextBoxInput, TimePickerInput } from "@arcgis/core/form/elements/inputs.js";
23
24
  * ```
24
25
  *
25
26
  * This module also allows you to implement [type guards](https://basarat.gitbook.io/typescript/type-system/typeguard)
@@ -47,6 +48,7 @@
47
48
  * @see [DatePickerInput](https://developers.arcgis.com/javascript/latest/references/core/form/elements/inputs/DatePickerInput/)
48
49
  * @see [DateTimeOffsetPickerInput](https://developers.arcgis.com/javascript/latest/references/core/form/elements/inputs/DateTimeOffsetPickerInput/)
49
50
  * @see [DateTimePickerInput](https://developers.arcgis.com/javascript/latest/references/core/form/elements/inputs/DateTimePickerInput/)
51
+ * @see [MultipleChoiceInput](https://developers.arcgis.com/javascript/latest/references/core/form/elements/inputs/MultipleChoiceInput/)
50
52
  * @see [RadioButtonsInput](https://developers.arcgis.com/javascript/latest/references/core/form/elements/inputs/RadioButtonsInput/)
51
53
  * @see [SwitchInput](https://developers.arcgis.com/javascript/latest/references/core/form/elements/inputs/SwitchInput/)
52
54
  * @see [TextAreaInput](https://developers.arcgis.com/javascript/latest/references/core/form/elements/inputs/TextAreaInput/)
@@ -58,6 +60,7 @@ import type ComboBoxInputClass from "./inputs/ComboBoxInput.js";
58
60
  import type DatePickerInputClass from "./inputs/DatePickerInput.js";
59
61
  import type DateTimeOffsetPickerInputClass from "./inputs/DateTimeOffsetPickerInput.js";
60
62
  import type DateTimePickerInputClass from "./inputs/DateTimePickerInput.js";
63
+ import type MultipleChoiceInputClass from "./inputs/MultipleChoiceInput.js";
61
64
  import type RadioButtonsInputClass from "./inputs/RadioButtonsInput.js";
62
65
  import type SwitchInputClass from "./inputs/SwitchInput.js";
63
66
  import type TextAreaInputClass from "./inputs/TextAreaInput.js";
@@ -65,7 +68,7 @@ import type TextBoxInputClass from "./inputs/TextBoxInput.js";
65
68
  import type TimePickerInputClass from "./inputs/TimePickerInput.js";
66
69
 
67
70
  /** Form element input types. */
68
- export type Input = BarcodeScannerInputClass | ComboBoxInputClass | DatePickerInputClass | DateTimeOffsetPickerInputClass | DateTimePickerInputClass | RadioButtonsInputClass | SwitchInputClass | TextAreaInputClass | TextBoxInputClass | TimePickerInputClass;
71
+ export type Input = BarcodeScannerInputClass | ComboBoxInputClass | DatePickerInputClass | DateTimeOffsetPickerInputClass | DateTimePickerInputClass | MultipleChoiceInputClass | RadioButtonsInputClass | SwitchInputClass | TextAreaInputClass | TextBoxInputClass | TimePickerInputClass;
69
72
 
70
73
  /** The `BarcodeScannerInput` class defines the desired user interface is a barcode or QR code scanner. If this type is used in an ArcGIS Maps SDK for JavaScript web application, it will default to the [TextBoxInput](https://developers.arcgis.com/javascript/latest/references/core/form/elements/inputs/TextBoxInput/) type as the API does not support bar code scanning as an input type. */
71
74
  export const BarcodeScannerInput: typeof BarcodeScannerInputClass;
@@ -97,6 +100,12 @@ export const DateTimePickerInput: typeof DateTimePickerInputClass;
97
100
  /** The `DateTimePickerInput` class defines the desired user interface for editing date (including time) fields in a form. */
98
101
  export type DateTimePickerInput = DateTimePickerInputClass;
99
102
 
103
+ /** The `MultipleChoiceInput` class defines the desired user interface for a multiple choice group. */
104
+ export const MultipleChoiceInput: typeof MultipleChoiceInputClass;
105
+
106
+ /** The `MultipleChoiceInput` class defines the desired user interface for a multiple choice group. */
107
+ export type MultipleChoiceInput = MultipleChoiceInputClass;
108
+
100
109
  /** The `RadioButtonsInput` class defines the desired user interface for a radio button group. */
101
110
  export const RadioButtonsInput: typeof RadioButtonsInputClass;
102
111
 
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import t from"./inputs/BarcodeScannerInput.js";import p from"./inputs/ComboBoxInput.js";import i from"./inputs/DatePickerInput.js";import o from"./inputs/DateTimeOffsetPickerInput.js";import r from"./inputs/DateTimePickerInput.js";import e from"./inputs/Input.js";import m from"./inputs/RadioButtonsInput.js";import s from"./inputs/SwitchInput.js";import n from"./inputs/TextAreaInput.js";import u from"./inputs/TextBoxInput.js";import a from"./inputs/TimePickerInput.js";const c=t,f=p,j=i,I=o,k=r,x=m,b=s,d=n,T=u,B=a,P={base:e,key:"type",typeMap:{"barcode-scanner":c,"combo-box":f,"date-picker":j,"datetime-picker":k,"timestampoffset-picker":I,"radio-buttons":x,switch:b,"text-area":d,"text-box":T,"time-picker":B}};export{c as BarcodeScannerInput,f as ComboBoxInput,j as DatePickerInput,I as DateTimeOffsetPickerInput,k as DateTimePickerInput,x as RadioButtonsInput,b as SwitchInput,d as TextAreaInput,T as TextBoxInput,B as TimePickerInput,P as types};
2
+ import t from"./inputs/BarcodeScannerInput.js";import p from"./inputs/ComboBoxInput.js";import i from"./inputs/DatePickerInput.js";import o from"./inputs/DateTimeOffsetPickerInput.js";import e from"./inputs/DateTimePickerInput.js";import r from"./inputs/Input.js";import m from"./inputs/MultipleChoiceInput.js";import s from"./inputs/RadioButtonsInput.js";import n from"./inputs/SwitchInput.js";import u from"./inputs/TextAreaInput.js";import c from"./inputs/TextBoxInput.js";import a from"./inputs/TimePickerInput.js";const f=t,j=p,I=i,k=o,x=e,b=m,d=s,T=n,h=u,l=c,B=a,P={base:r,key:"type",typeMap:{"barcode-scanner":f,"combo-box":j,"date-picker":I,"datetime-picker":x,"multiple-choice":b,"timestampoffset-picker":k,"radio-buttons":d,switch:T,"text-area":h,"text-box":l,"time-picker":B}};export{f as BarcodeScannerInput,j as ComboBoxInput,I as DatePickerInput,k as DateTimeOffsetPickerInput,x as DateTimePickerInput,b as MultipleChoiceInput,d as RadioButtonsInput,T as SwitchInput,h as TextAreaInput,l as TextBoxInput,B as TimePickerInput,P as types};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{ensureOneOfType as t}from"../../core/accessorSupport/ensureType.js";import e from"../elements/AttachmentElement.js";import o from"../elements/Element.js";import p from"../elements/FieldElement.js";import r from"../elements/RelationshipElement.js";import i from"../elements/TextElement.js";import n from"../elements/UtilityNetworkAssociationsElement.js";const s=t=>"field"===t.type,u=t=>"group"===t.type,m=t=>"text"===t.type,y=t=>"relationship"===t.type,l=t=>"utilityNetworkAssociations"===t.type;function a(t){return f(t)||c(t)}function f(t){return"text-area"===t.type}function c(t){return"text-box"===t.type}function h(t){return{typesWithGroup:{base:o,key:"type",typeMap:{attachment:e,field:p,group:t,relationship:r,text:i,utilityNetworkAssociations:n}},typesWithoutGroup:{base:o,key:"type",typeMap:{attachment:e,field:p,relationship:r,text:i,utilityNetworkAssociations:n}}}}function x(t,e,o=!0){if(!t)return null;const p=o?e.typesWithGroup.typeMap:e.typesWithoutGroup.typeMap;return t.filter(t=>p[t.type]).map(t=>p[t.type].fromJSON(t))}function G(t,e,o=!0){if(!t)return null;const p=o?e.typesWithGroup.typeMap:e.typesWithoutGroup.typeMap;return t.filter(t=>p[t.type]).map(t=>t.toJSON())}function W(e,o,p=!0){return e?e.map(e=>t(p?o.typesWithGroup:o.typesWithoutGroup,e)):null}export{h as buildTypeMaps,W as ensureType,x as fromJSON,s as isFieldElement,u as isGroupElement,y as isRelationshipElement,f as isTextAreaInput,c as isTextBoxInput,m as isTextElement,a as isTextInput,l as isUtilityNetworkAssociationsElement,G as toJSON};
2
+ import{ensureOneOfType as t}from"../../core/accessorSupport/ensureType.js";import e from"../elements/AttachmentElement.js";import o from"../elements/Element.js";import p from"../elements/FieldElement.js";import r from"../elements/RelationshipElement.js";import i from"../elements/TextElement.js";import n from"../elements/UtilityNetworkAssociationsElement.js";const s=t=>"field"===t.type,u=t=>"group"===t.type,m=t=>"text"===t.type,y=t=>"attachment"===t.type,l=t=>"relationship"===t.type,a=t=>"utilityNetworkAssociations"===t.type;function f(t){return c(t)||h(t)}function c(t){return"text-area"===t.type}function h(t){return"text-box"===t.type}function x(t){return{typesWithGroup:{base:o,key:"type",typeMap:{attachment:e,field:p,group:t,relationship:r,text:i,utilityNetworkAssociations:n}},typesWithoutGroup:{base:o,key:"type",typeMap:{attachment:e,field:p,relationship:r,text:i,utilityNetworkAssociations:n}}}}function G(t,e,o=!0){if(!t)return null;const p=o?e.typesWithGroup.typeMap:e.typesWithoutGroup.typeMap;return t.filter(t=>p[t.type]).map(t=>p[t.type].fromJSON(t))}function W(t,e,o=!0){if(!t)return null;const p=o?e.typesWithGroup.typeMap:e.typesWithoutGroup.typeMap;return t.filter(t=>p[t.type]).map(t=>t.toJSON())}function j(e,o,p=!0){return e?e.map(e=>t(p?o.typesWithGroup:o.typesWithoutGroup,e)):null}export{x as buildTypeMaps,j as ensureType,G as fromJSON,y as isAttachmentElement,s as isFieldElement,u as isGroupElement,l as isRelationshipElement,c as isTextAreaInput,h as isTextBoxInput,m as isTextElement,f as isTextInput,a as isUtilityNetworkAssociationsElement,W as toJSON};
package/interfaces.d.ts CHANGED
@@ -2082,6 +2082,9 @@ declare namespace __esri {
2082
2082
  /** @deprecated since 5.0. Refactor using \@arcgis/codemod */
2083
2083
  export type inputsDateTimePickerInput = import("./form/elements/inputs.js").DateTimePickerInput;
2084
2084
 
2085
+ /** @deprecated since 5.0. Refactor using \@arcgis/codemod */
2086
+ export type inputsMultipleChoiceInput = import("./form/elements/inputs.js").MultipleChoiceInput;
2087
+
2085
2088
  /** @deprecated since 5.0. Refactor using \@arcgis/codemod */
2086
2089
  export type inputsRadioButtonsInput = import("./form/elements/inputs.js").RadioButtonsInput;
2087
2090
 
@@ -2122,6 +2125,10 @@ declare namespace __esri {
2122
2125
  /** @deprecated since 5.0. Refactor using \@arcgis/codemod */
2123
2126
  export type DateTimePickerInput = import("./form/elements/inputs.js").DateTimePickerInput;
2124
2127
 
2128
+ export const MultipleChoiceInput: import("./form/elements/inputs.js").MultipleChoiceInput;
2129
+ /** @deprecated since 5.0. Refactor using \@arcgis/codemod */
2130
+ export type MultipleChoiceInput = import("./form/elements/inputs.js").MultipleChoiceInput;
2131
+
2125
2132
  export const RadioButtonsInput: import("./form/elements/inputs.js").RadioButtonsInput;
2126
2133
  /** @deprecated since 5.0. Refactor using \@arcgis/codemod */
2127
2134
  export type RadioButtonsInput = import("./form/elements/inputs.js").RadioButtonsInput;
@@ -2178,6 +2185,13 @@ declare namespace __esri {
2178
2185
  export type DateTimePickerInput = import("./form/elements/inputs/DateTimePickerInput.js").default;
2179
2186
  export const DateTimePickerInput: typeof import("./form/elements/inputs/DateTimePickerInput.js").default;
2180
2187
 
2188
+ /** @deprecated since 5.0. Refactor using \@arcgis/codemod */
2189
+ export type MultipleChoiceInputProperties = import("./form/elements/inputs/MultipleChoiceInput.js").MultipleChoiceInputProperties;
2190
+
2191
+ /** @deprecated since 5.0. Refactor using \@arcgis/codemod */
2192
+ export type MultipleChoiceInput = import("./form/elements/inputs/MultipleChoiceInput.js").default;
2193
+ export const MultipleChoiceInput: typeof import("./form/elements/inputs/MultipleChoiceInput.js").default;
2194
+
2181
2195
  /** @deprecated since 5.0. Refactor using \@arcgis/codemod */
2182
2196
  export type RadioButtonsInputProperties = import("./form/elements/inputs/RadioButtonsInput.js").RadioButtonsInputProperties;
2183
2197
 
@@ -2262,6 +2276,20 @@ declare namespace __esri {
2262
2276
  export type VideoInput = import("./form/elements/inputs/attachments/VideoInput.js").default;
2263
2277
  export const VideoInput: typeof import("./form/elements/inputs/attachments/VideoInput.js").default;
2264
2278
 
2279
+ /** @deprecated since 5.0. Refactor using \@arcgis/codemod */
2280
+ export type MultipleChoiceInputChoiceProperties = import("./form/elements/inputs/multipleChoice/Choice.js").ChoiceProperties;
2281
+
2282
+ /** @deprecated since 5.0. Refactor using \@arcgis/codemod */
2283
+ export type MultipleChoiceInputChoice = import("./form/elements/inputs/multipleChoice/Choice.js").default;
2284
+ export const MultipleChoiceInputChoice: typeof import("./form/elements/inputs/multipleChoice/Choice.js").default;
2285
+
2286
+ /** @deprecated since 5.0. Refactor using \@arcgis/codemod */
2287
+ export type MultipleChoiceOtherChoiceProperties = import("./form/elements/inputs/multipleChoice/OtherChoice.js").OtherChoiceProperties;
2288
+
2289
+ /** @deprecated since 5.0. Refactor using \@arcgis/codemod */
2290
+ export type MultipleChoiceOtherChoice = import("./form/elements/inputs/multipleChoice/OtherChoice.js").default;
2291
+ export const MultipleChoiceOtherChoice: typeof import("./form/elements/inputs/multipleChoice/OtherChoice.js").default;
2292
+
2265
2293
  /** @deprecated since 5.0. Refactor using \@arcgis/codemod */
2266
2294
  export type CircleProperties = import("./geometry/Circle.js").CircleProperties;
2267
2295
 
package/kernel.js CHANGED
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import has from"./core/has.js";import{addQueryParameter as o}from"./core/urlUtils.js";export{buildDate,commitHash as revision}from"./support/revision.js";Symbol.dispose??=Symbol("Symbol.dispose"),Symbol.asyncDispose??=Symbol("Symbol.asyncDispose");const e="5.1";let s,r=e;function i(o){s=o}function t(e){const r=s?.findCredential(e);return r?.token?o(e,"token",r.token):e}r="5.1.0-next.71",has("host-webworker")||globalThis.$arcgis||Object.defineProperty(globalThis,"$arcgis",{configurable:!1,enumerable:!0,writable:!1,value:{}}),has("host-webworker");export{t as addTokenParameter,r as fullVersion,s as id,i as setId,e as version};
2
+ import has from"./core/has.js";import{addQueryParameter as o}from"./core/urlUtils.js";export{buildDate,commitHash as revision}from"./support/revision.js";Symbol.dispose??=Symbol("Symbol.dispose"),Symbol.asyncDispose??=Symbol("Symbol.asyncDispose");const e="5.1";let s,r=e;function i(o){s=o}function t(e){const r=s?.findCredential(e);return r?.token?o(e,"token",r.token):e}r="5.1.0-next.73",has("host-webworker")||globalThis.$arcgis||Object.defineProperty(globalThis,"$arcgis",{configurable:!1,enumerable:!0,writable:!1,value:{}}),has("host-webworker");export{t as addTokenParameter,r as fullVersion,s as id,i as setId,e as version};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import i from"../request.js";import{has}from"../applications/Components/baUtils.js";import t from"../core/Accessor.js";import s from"../core/Error.js";import r from"../core/Logger.js";import{createAbortError as a,isAborted as n,isAbortError as o}from"../core/promiseUtils.js";import{watch as l}from"../core/reactiveUtils.js";import{addFrameTask as d}from"../core/scheduling.js";import{property as h,subclass as _}from"../core/accessorSupport/decorators.js";import y from"../geometry/SpatialReference.js";import{isGeographic as c}from"../geometry/support/spatialReferenceUtils.js";import u from"../geometry/support/WKIDUnitConversion.js";import{wasmFailedToInit as m,elevQueriesFull as g,elevQueriesGenericFail as w,invalidLayerView as p}from"./ILyr3DWasmPerSceneView.js";import{Lyr3DWorkerHandle as b}from"./Lyr3DWorkerHandle.js";import{getVCSFromHeightModelInfo as f}from"./support/tiles3DUtils.js";import{loadLyr3DMainWASM as v}from"../libs/lyr3d/Lyr3DModule.js";import{getElevationOffsetInMeters as D}from"../support/elevationInfoUtils.js";import{makeScheduleFunction as M}from"../views/3d/layers/support/makeScheduleFunction.js";const L=3857,k=32662,R=4326,S=5773,C=115700;let W=class extends t{constructor(e){super(e),this._lyr3DMainPromise=null,this._lyr3DMain=null,this._layers=new Map,this._viewSR=null,this._lyr3DBusyCount=0,this._lyr3DInternalMemoryBytes=0,this._isTerrainReady=!1,this._hasLayerThatReplacesTerrain=!1,this._elevationQueries=new Map,this._debugFlags=new Set,this._debugLevel=0,this._wasmNotLoaded="method requiring WASM was called when WASM isn't loaded",this._pulseTaskHandle=null,this._cameraElevationDirty=!0,this._debugFlags.add(0),this._debugFlags.add(1),this._debugFlags.add(2)}_debugLog(e,i,t,s=!0){if(this._debugFlags.has(e)&&this._debugLevel>=i){const e=s?`[js] ${t}`:`${t}`;0===i||1===i?r.getLogger(this).error(e):2===i&&r.getLogger(this).warn(e),r.getLogger(this).info(e)}}get lyr3DInternalMemoryBytes(){return this._lyr3DInternalMemoryBytes}initialize(){this._debugLevel>2&&(r.getLogger(this).level="info"),this._debugLog(0,3,"Lyr3DWasmPerSceneView.initialize()"),this.addHandles([l(()=>this.view.state?.contentCamera,()=>this._updateWasmCamera()),l(()=>this.view.state?.contentCamera.relativeElevation,()=>{this._cameraElevationDirty=!0,this._markAllLayerViewsUpdating()})]),this._pulseTaskHandle=d({preRender:()=>this._pulseTask()})}destroy(){this._debugLog(0,3,"Lyr3DWasmPerSceneView.destroy()"),this._lyr3DMain&&(this._layers.forEach(e=>{e.abortController.abort()}),this._elevationQueries.forEach((e,i)=>{this._lyr3DMain.cancel_elevation_query(i),e.rejectCallback(a())}),this._elevationQueries.clear(),this._lyr3DMain.uninitialize_lyr3d_wasm(),this._lyr3DMain=null);const e=this._workerHandle;e&&e.destroyWasm().then(()=>{this._workerHandle?.destroy(),this._workerHandle=null}),this._pulseTaskHandle?.remove(),this._pulseTaskHandle=null}addLayerView(e){return this._lyr3DMain?this._addLayerView(e):(this._debugLog(0,1,"Lyr3DWasmPerSceneView.add3DTilesLayerView() called when WASM wasn't initialized"),{wasmLayerId:m})}removeLayerView(e){if(!this._lyr3DMain)return this._debugLog(0,1,this._wasmNotLoaded),0;this._doRemoveLayerView(e);const i=this._layers.size;return 0===i&&(this._debugLog(0,3,"Lyr3DWasmPerSceneView.remove3DTilesLayerView() no Lyr3D layers left after removing a layer, destroying"),this.destroy()),i}getValidLayerViewCount(){if(!this._lyr3DMain)return this._debugLog(0,1,this._wasmNotLoaded),0;let e=0;return this._layers.forEach(i=>{i.layerView.wasmLayerId>=0&&++e}),e}setEnabled(e,i){if(!this._lyr3DMain)return void this._debugLog(0,1,this._wasmNotLoaded);const t=this._layers.get(e.wasmLayerId);if(t){this._lyr3DMain.set_enabled(e.wasmLayerId,i),t.needMemoryUsageUpdate=!0;const s=this._isUpdating(t);t.needFrame=!0,s||t.layerView.updatingFlagChanged()}}setLayerOffset(e,i){if(!this._lyr3DMain)return void this._debugLog(0,1,this._wasmNotLoaded);this._layers.get(e.wasmLayerId)&&this._lyr3DMain.set_carto_offset_z(e.wasmLayerId,i)}getAttributionText(){if(!this._lyr3DMain)return this._debugLog(0,1,this._wasmNotLoaded),[];return this._lyr3DMain.get_current_attribution_text().split("|")}onRenderableEvicted(e,i,t){if(!this._lyr3DMain)return void this._debugLog(0,1,this._wasmNotLoaded);this._layers.get(e.wasmLayerId)&&this._lyr3DMain.on_renderable_evicted(e.wasmLayerId,i,t)}setMeshModifications(e,i){if(!this._lyr3DMain)return void this._debugLog(0,1,this._wasmNotLoaded);const t=this._layers.get(e.wasmLayerId);if(t){const s=this._lyr3DMain._malloc(8*i.length),r=new Float64Array(this._lyr3DMain.HEAPF64.buffer,s,i.length);for(let e=0;e<i.length;++e)r[e]=i[e];this._lyr3DMain.set_mesh_modification_polygons(e.wasmLayerId,s,i.length),this._lyr3DMain._free(s);const a=this._isUpdating(t);t.needFrame=!0,a||t.layerView.updatingFlagChanged()}}isUpdating(e){if(!this._lyr3DMain&&this._lyr3DMainPromise)return!0;const i=this._layers.get(e);return!!i&&(i.outstandingJobCount>0||i.outstandingRenderableCount>0||i.needFrame||this._lyr3DBusyCount>0)}initializeWasm(e,i){return this._lyr3DMain?Promise.resolve():this.view.renderSpatialReference?(this._debugLog(0,3,"Lyr3DWasmPerSceneView.initializeWasm()"),this._lyr3DMainPromise||(this._lyr3DMainPromise=v().then(t=>{this._lyr3DMain=t,this._lyr3DMainPromise=null;const s=this._lyr3DMain.addFunction(this._onNewJob.bind(this),"v"),r=this._lyr3DMain.addFunction(this._onNewRenderable.bind(this),"v"),a=this._lyr3DMain.addFunction(this._freeRenderables.bind(this),"viii"),n=this._lyr3DMain.addFunction(this._setRenderableVisibility.bind(this),"viiii"),o=this._lyr3DMain.addFunction(this._onWasmError.bind(this),"viiii"),l=this._lyr3DMain.addFunction(this._onElevQueryComplete.bind(this),"vi");if(!this.view.renderSpatialReference)return void(this._lyr3DMain=null);this._viewSR=this.view.renderSpatialReference?.toJSON();const d="global"===this.view.viewingMode?5:3;if(5===d)this._viewSR.wkid=this._viewSR.latestWkid=R,this._viewSR.vcsWkid=this._viewSR.latestVcsWkid=S;else if(this.view.renderSpatialReference?.isWebMercator)this._viewSR.wkid=this._viewSR.latestWkid=L,this._viewSR.vcsWkid=this._viewSR.latestVcsWkid=S;else if(this.view.renderSpatialReference?.wkid===k)this._viewSR.wkid=this._viewSR.latestWkid=R,this._viewSR.vcsWkid=this._viewSR.latestVcsWkid=S;else if(!this._viewSR.latestVcsWkid&&!this._viewSR.vcsWkid){const e=f(this.view.heightModelInfo);if(e)this._viewSR.vcsWkid=this._viewSR.latestVcsWkid=e;else{const e=this.view.heightModelInfo?.heightModel,i=!e||"gravity-related-height"===e;this._viewSR.vcsWkid=this._viewSR.latestVcsWkid=i?S:C}}const h=has("esri-lyr3D-max-concurrent-requests")??16;return this._lyr3DMain.initialize_lyr3d_wasm(o,s,r,a,n,l,e,i,d,this._cleanUpSR(this._makeSRWasmSerializable(this._viewSR)),Math.max(this._debugLevel,0),h)?(this._workerHandle=new b(M(this.view.resourceController)),this._workerHandle.promise?this._workerHandle.promise:void 0):(this._lyr3DMain=null,void this._debugLog(0,0,"Lyr3d Main WASM failed to initialize",!1))}).catch(e=>{this._debugLog(0,0,`Lyr3d WASM failed to download error = ${e}`,!1)})),this._lyr3DMainPromise):Promise.reject()}get isTerrainReady(){return this._isTerrainReady}setLodPixelThreshold(e,i){this._lyr3DMain?.set_lod_pixel_threshold(i);const t=this._layers.get(e.wasmLayerId);t&&(t.needFrame=!0)}setMaximumGaussianSplatCount(e){this._lyr3DMain.set_maximum_splat_count(e),this._layers.forEach(e=>{"gaussian-splat-3d"===e.layerView.type&&(e.needFrame=!0)})}queryElevation(e,i,t){if(!this._lyr3DMain)return Promise.reject(this._wasmNotLoaded);if(0===i.coordinates.length)return Promise.reject("no coordinates for elevation query");const s="global"===this.view.viewingMode?y.WGS84:this._viewSR.wkid===L?y.WebMercator:y.PlateCarree,r=i.projectSync(s);r&&(i=r);const a=2*i.coordinates.length,n=this._lyr3DMain._malloc(8*a),o=new Float64Array(this._lyr3DMain.HEAPF64.buffer,n,a);for(let y=0;y<i.coordinates.length;++y){const e=i.coordinates[y];o[2*y]=e.x,o[2*y+1]=e.y}const l=t?.maxGeometricError??0,d=this._lyr3DMain.create_elevation_query(e.wasmLayerId,l,n,a);if(this._lyr3DMain._free(n),d===g)return Promise.reject("max mesh elevation query limit exceeded");if(d===w)return Promise.reject("elevation query failed");const h={descriptor:i,signal:t?.signal,resolveCallback:null,rejectCallback:null},_=new Promise((e,i)=>{h.resolveCallback=e,h.rejectCallback=i});return this._elevationQueries.set(d,h),_}_checkForAbortedElevationQueries(){const e=[];this._elevationQueries.forEach((i,t)=>{n(i.signal)&&(this._lyr3DMain.cancel_elevation_query(t),i.rejectCallback(a()),e.push(t))});for(let i=0;i<e.length;++i)this._elevationQueries.delete(e[i])}_pulseTask(){if(this._lyr3DMain){if(this._cameraElevationDirty){const e=this.view.state?.contentCamera.relativeElevation;this._lyr3DMain.set_camera_elevation(e)}this._checkForAbortedElevationQueries();let e=0,i=0;this._layers.forEach(t=>{e+=t.layerView.usedMemory,i+=t.layerView.cachedMemory}),e/=1048576,i/=1048576;const t=this.view.resourceController.memoryController,s=t.usedMemory*t.maxMemory-e-this._lyr3DInternalMemoryBytes/1048576;this._lyr3DBusyCount=this._lyr3DMain.frame_pulse(t.memoryFactor,e,i,s,t.maxMemory),this._lyr3DInternalMemoryBytes=this._lyr3DMain.get_index_memory_bytes(),this._layers.forEach(e=>{this._cameraElevationDirty||(e.needFrame=!1),e.layerView.updatingFlagChanged()}),this._hasLayerThatReplacesTerrain&&!this._isTerrainReady&&(this._isTerrainReady=this._lyr3DMain.is_terrain_ready(),this._isTerrainReady&&this.notifyChange("isTerrainReady")),this._cameraElevationDirty=!1}}_isUpdating(e){return e.outstandingJobCount>0||e.outstandingRenderableCount>0||e.needFrame||this._lyr3DBusyCount>0}_incrementJobCount(e,i){if(i.isForElevationQuery)return;const t=this._isUpdating(e);e.outstandingJobCount+=1,t||e.layerView.updatingFlagChanged()}_decrementJobCount(e,i){if(i.isForElevationQuery)return;const t=this._isUpdating(e);e.outstandingJobCount-=1;t!==this._isUpdating(e)&&e.layerView.updatingFlagChanged()}_incrementRenderableCount(e){const i=this._isUpdating(e);e.outstandingRenderableCount+=1,i||e.layerView.updatingFlagChanged()}_decrementRenderableCount(e){const i=this._isUpdating(e);e.outstandingRenderableCount-=1;i!==this._isUpdating(e)&&e.layerView.updatingFlagChanged()}_onJobFailed(e,i,t){i.error.length&&this._debugLog(1,1,i.error,!1),this._lyr3DMain&&this._lyr3DMain.on_job_failed(t.jobId,t.desc),this._decrementJobCount(e,t)}_onJobSucceeded(e,i,t){if(this._lyr3DMain){if(e.layerView.destroyed)return void this._lyr3DMain.on_job_failed(t.jobId,t.desc);const s=i.data.byteLength,r=this._lyr3DMain._malloc(s);new Uint8Array(this._lyr3DMain.HEAPU8.buffer,r,s).set(i.data),this._lyr3DMain.on_job_completed(t.jobId,i.jobDescJson,r,s),this._lyr3DMain._free(r)}this._decrementJobCount(e,t)}_getRequestPromises(e,t,s,r){const a=[];for(const n of e){const e=new URL(n);if("integrated-mesh-3dtiles"===r.type){if(e.origin===s.origin&&e.pathname===s.pathname){if(r.rootTileset){a.push(Promise.resolve(r.rootTileset.slice()));continue}}else r.session&&e.searchParams.set("session",r.session)}a.push(i(e.toString(),t).then(e=>e.data))}return a}_getInitialPromise(e,i,t,s,r,a,n){const l=this._getRequestPromises(e.urls,i,t,s);return Promise.all(l).then(e=>(r.inputs=e,this._workerHandle.invoke(r,a))).then(e=>e).catch(i=>{let t=1;return o(i)?this._debugLog(1,2,`job ${e.jobId} was cancelled.`):n&&400===i.details?.httpStatus?(t=3,this._debugLog(1,2,"Session expired, trying to create new Session.")):this._debugLog(1,1,`job ${e.jobId} failed with error ${i}.`),{status:t,error:"",jobDescJson:"",data:new Uint8Array(0),missingInputUrls:[],inputs:[]}})}async _onNewJob(){const e=this._lyr3DMain.get_next_job(),i=this._layers.get(e.layerId);if(!i)return;this._incrementJobCount(i,e);const t=i.abortController.signal,s=i.layerView.layer,r="integrated-mesh-3dtiles"===s.type?s.key:null,a="integrated-mesh-3dtiles"===s.type?s.session:null,n={responseType:"array-buffer",signal:t,query:{...i.customParameters,token:i.apiKey,key:r}},l={id:e.jobId,inputs:[],jobDescJson:e.desc.slice(),isMissingResourceCase:!1},d=new URL(s.url),h=r=>{if(1===r.status)this._onJobFailed(i,r,e);else if(0===r.status)this._onJobSucceeded(i,r,e);else if(2===r.status){const a=this._getRequestPromises(r.missingInputUrls,n,d,s);Promise.all(a).then(e=>{l.jobDescJson=r.jobDescJson,r.originalInputs?l.inputs=r.originalInputs:l.inputs=[],l.isMissingResourceCase=!0;for(const i of e)l.inputs.push(i);return this._workerHandle.invoke(l,t)}).then(t=>{1===t.status?this._onJobFailed(i,t,e):0===t.status&&this._onJobSucceeded(i,t,e)}).catch(t=>{this._decrementJobCount(i,e),o(t)?this._debugLog(1,2,`job ${e.jobId} was cancelled.`):this._debugLog(1,1,`job ${e.jobId} failed with error ${t}.`),this._lyr3DMain&&this._lyr3DMain.on_job_failed(e.jobId,e.desc)})}};try{const i=await this._getInitialPromise(e,n,d,s,l,t,a);if(3===i.status&&"integrated-mesh-3dtiles"===s.type){a===s.session&&null!==s.session&&await s.requestRootAndSession(t);h(await this._getInitialPromise(e,n,d,s,l,t,s.session))}else h(i)}catch(_){_&&this._debugLog(1,1,_.toString(),!1),this._lyr3DMain&&this._lyr3DMain.on_job_failed(e.jobId,e.desc),this._decrementJobCount(i,e)}}_onNewRenderable(){const e=this._lyr3DMain.get_next_renderable(),{meshData:i}=e;i.data&&i.data.byteLength>0&&(i.data=i.data.slice());const t=this._layers.get(e.layerId);t&&(this._incrementRenderableCount(t),t.layerView.createRenderable(e).then(i=>{const s=i.numGaussians??0;this._lyr3DMain?.on_renderable_created(!0,e.layerId,e.handle,i.memUsageBytes,s),this._decrementRenderableCount(t)}).catch(i=>{o(i)||this._debugLog(2,1,`createRenderable failed with error ${i}.`),this._lyr3DMain?.on_renderable_created(!1,e.layerId,e.handle,0,0),this._decrementRenderableCount(t)}))}_freeRenderables(e,i,t){if(t<1)return;const s=this._layers.get(e);if(!s)return;const r=s.layerView,a=[],n=new Uint32Array(this._lyr3DMain.HEAPU32.buffer,i,t);for(let o=0;o<t;++o)a.push(n[o]);for(let o=0;o<t;++o)r.freeRenderable(a[o])}_setRenderableVisibility(e,i,t,s){if(s<1)return;const r=this._layers.get(e);if(!r)return;const a=r.layerView,n=[],o=[],l=new Uint32Array(this._lyr3DMain.HEAPU32.buffer,i,s),d=new Uint8Array(this._lyr3DMain.HEAPU8.buffer,t,s);for(let h=0;h<s;++h)n.push(l[h]),o.push(!!(1&d[h]));a.setRenderableVisibility(n,o,s)}_onWasmError(e,i,t,s){this._lyr3DMain&&this._debugLog(t,s,this._lyr3DMain.UTF8ToString(e,i),!1)}_onElevQueryComplete(e){const i=this._elevationQueries.get(e),t=this._lyr3DMain.get_elevation_query_result(e);if(i)if(t.succeeded&&t.zs){const s=t.zs.slice(),r=i.descriptor.clone();for(let e=0;e<s.length;++e)r.coordinates[e].z=s[e];this._debugLog(2,3,`Success EQ ${e}, number points ${s.length}.`),i.resolveCallback(r),this._elevationQueries.delete(e)}else i.rejectCallback(new s("elevation-query:error",t?.error??"Elevation query failed")),this._elevationQueries.delete(e);else this._debugLog(2,1,`_onElevQueryComplete called for unknown queryId ${e}.`)}_doRemoveLayerView(e){const i=this._layers.get(e.wasmLayerId);return!!i&&(i.abortController.abort(),this._lyr3DMain.remove_layer(e.wasmLayerId),this._is3DTilesIMLayerView(e)&&e.layer.replacesTerrain&&(this._hasLayerThatReplacesTerrain=!1,this._isTerrainReady=!1,this.notifyChange("isTerrainReady")),this._layers.delete(e.wasmLayerId),!0)}_is3DTilesIMLayerView(e){return"integrated-mesh-3dtiles"===e.layer.type}_isGaussianSplatLayerView(e){return"gaussian-splat"===e.layer.type}_isGaussianSplatLayer(e){return"gaussian-splat"===e.type}_toWasmQuality(e){switch(e){case"low":return 1;case"medium":return 2;case"high":return 3}}_addLayerView(e){const i=e.layer;if(!i.url||!i.rootTilesetJSON)return{wasmLayerId:p};const t="integrated-mesh-3dtiles"===i.type?0:2,s=this._lyr3DMain.validate_root_tileset(JSON.stringify(i.rootTilesetJSON),t);if(0!==s.errorCode)return{wasmLayerId:p,check:s};const a=this._lyr3DMain.get_next_layer_id(),n=new AbortController;this._layers.set(a,{layerView:e,abortController:n,needMemoryUsageUpdate:!1,outstandingJobCount:0,outstandingRenderableCount:0,customParameters:i.customParameters,apiKey:i.apiKey,needFrame:!0});const o=D(i.elevationInfo),l=this._toWasmQuality(this.view?.qualityProfile),d=e=>r.getLogger(this).error("add-spatial-reference-error","Error when adding SR:",e);let h=!1;if(this._isGaussianSplatLayerView(e)&&this._isGaussianSplatLayer(i)){let t=i.spatialReference;if(e.useEsriCrs&&i.esriCrsSpatialReference){t=i.esriCrsSpatialReference;const s=c(t);let r=1,a=1;!s&&t.wkid&&-1!==t.wkid&&(r=u.values[u[t.wkid]],a=e.metersPerVCSUnit),this._workerHandle.addSpatialReferenceInfo(this._cleanUpSR(this._makeSRWasmSerializable(t)),s,r,a).catch(d),t.vcsWkid&&this._viewSR.vcsWkid&&this._viewSR.vcsWkid!==t.vcsWkid&&this._workerHandle.addSpatialReferenceInfo(this._cleanUpSR(this._makeSRWasmSerializable(this._viewSR)),!1,1,1).catch(d)}h=this._lyr3DMain.add_gaussian_splat_layer(l,i.url,a,o)}else this._is3DTilesIMLayerView(e)&&(h=this._lyr3DMain.add_3dtiles_layer(l,i.url,a,o,e.layer.replacesTerrain),h&&e.layer.replacesTerrain&&(this._hasLayerThatReplacesTerrain=!0,this._isTerrainReady=!1,this.notifyChange("isTerrainReady")));return h?(this._updateWasmCamera(),e.updatingFlagChanged(),{wasmLayerId:a}):(this._layers.delete(a),{wasmLayerId:p})}_updateWasmCamera(){const e=this.view.state?.contentCamera;if(!e||!this._lyr3DMain)return;const{eye:i,center:t,up:s,near:r,far:a,fovY:n}=e,o=[e.viewport[2],e.viewport[3]],l=e.width/e.height;this._lyr3DMain.set_camera_parameters({eye:i,center:t,up:s,near:r,far:a,fov:n,aspectRatio:l,viewport:o}),this._markAllLayerViewsUpdating()}_markAllLayerViewsUpdating(){this._layers.forEach(e=>{const i=this._isUpdating(e);e.needFrame=!0,i||e.layerView.updatingFlagChanged()})}_makeSRWasmSerializable(e){return{wkid:e?.wkid??-1,latestWkid:e?.latestWkid??-1,vcsWkid:e?.vcsWkid??-1,latestVcsWkid:e?.latestVcsWkid??-1,wkt:e?.wkt??""}}_cleanUpSR(e){return-1===e?.wkid&&e.latestWkid&&-1!==e.latestWkid?e.wkid=e.latestWkid:-1===e?.latestWkid&&e.wkid&&-1!==e.wkid&&(e.latestWkid=e.wkid),-1===e?.vcsWkid&&e.latestVcsWkid&&-1!==e.latestVcsWkid?e.vcsWkid=e.latestVcsWkid:-1===e?.latestVcsWkid&&e.vcsWkid&&-1!==e.vcsWkid&&(e.latestVcsWkid=e.vcsWkid),e}};e([h({constructOnly:!0})],W.prototype,"view",void 0),e([h({readOnly:!0})],W.prototype,"isTerrainReady",null),W=e([_("esri.layers.Lyr3DWasmPerSceneView")],W);const V=W;export{V as default};
2
+ import{__decorate as e}from"tslib";import i from"../request.js";import{has}from"../applications/Components/baUtils.js";import t from"../core/Accessor.js";import s from"../core/Error.js";import r from"../core/Logger.js";import{someMap as a}from"../core/MapUtils.js";import{createAbortError as n,isAborted as o,isAbortError as l}from"../core/promiseUtils.js";import{watch as d}from"../core/reactiveUtils.js";import{property as h,subclass as _}from"../core/accessorSupport/decorators.js";import y from"../geometry/SpatialReference.js";import{isGeographic as u}from"../geometry/support/spatialReferenceUtils.js";import c from"../geometry/support/WKIDUnitConversion.js";import{wasmFailedToInit as g,elevQueriesFull as m,elevQueriesGenericFail as p,invalidLayerView as w}from"./ILyr3DWasmPerSceneView.js";import{Lyr3DWorkerHandle as b}from"./Lyr3DWorkerHandle.js";import{getVCSFromHeightModelInfo as f}from"./support/tiles3DUtils.js";import{loadLyr3DMainWASM as v}from"../libs/lyr3d/Lyr3DModule.js";import{getElevationOffsetInMeters as D}from"../support/elevationInfoUtils.js";import{makeScheduleFunction as M}from"../views/3d/layers/support/makeScheduleFunction.js";import{TaskPriority as L}from"../views/support/Scheduler.js";import{Yield as k}from"../views/support/Yield.js";const R=3857,C=32662,S=4326,W=5773,V=115700;let j=class extends t{constructor(e){super(e),this._lyr3DMainPromise=null,this._lyr3DMain=null,this._layers=new Map,this._viewSR=null,this._lyr3DBusyCount=0,this._lyr3DInternalMemoryBytes=0,this._isTerrainReady=!1,this._hasLayerThatReplacesTerrain=!1,this._elevationQueries=new Map,this._pendingJobCompleted=new Array,this._pendingJobFailed=new Array,this._pendingRenderableCreated=new Array,this._debugFlags=new Set,this._debugLevel=0,this._wasmNotLoaded="method requiring WASM was called when WASM isn't loaded",this._pulseTaskHandle=null,this._cameraDirty=!0,this._cameraElevationDirty=!0,this._debugFlags.add(0),this._debugFlags.add(1),this._debugFlags.add(2)}_debugLog(e,i,t,s=!0){if(this._debugFlags.has(e)&&this._debugLevel>=i){const e=s?`[js] ${t}`:`${t}`;0===i||1===i?r.getLogger(this).error(e):2===i&&r.getLogger(this).warn(e),r.getLogger(this).info(e)}}get lyr3DInternalMemoryBytes(){return this._lyr3DInternalMemoryBytes}initialize(){this._debugLevel>2&&(r.getLogger(this).level="info"),this._debugLog(0,3,"Lyr3DWasmPerSceneView.initialize()"),this.addHandles([d(()=>this.view.state?.contentCamera,()=>this._updateWasmCamera()),d(()=>this.view.state?.contentCamera.relativeElevation,()=>{this._cameraElevationDirty=!0,this._markAllLayerViewsUpdating()})]),this._pulseTaskHandle=this.view.resourceController.scheduler.registerTask(L.LYR3D,this)}destroy(){this._debugLog(0,3,"Lyr3DWasmPerSceneView.destroy()"),this._lyr3DMain&&(this._layers.forEach(e=>{e.abortController.abort()}),this._elevationQueries.forEach((e,i)=>{this._lyr3DMain.cancel_elevation_query(i),e.rejectCallback(n())}),this._elevationQueries.clear(),this._lyr3DMain.uninitialize_lyr3d_wasm(),this._lyr3DMain=null),this._pendingJobCompleted.length=0,this._pendingJobFailed.length=0,this._pendingRenderableCreated.length=0;const e=this._workerHandle;e&&e.destroyWasm().then(()=>{this._workerHandle?.destroy(),this._workerHandle=null}),this._pulseTaskHandle?.remove(),this._pulseTaskHandle=null}get readyToRun(){return this._hasPendingPulseWork()}runTask(e){return this._pulseTask(e),k}_hasPendingPulseWork(){return!!this._lyr3DMain&&(this._cameraDirty||this._cameraElevationDirty||this._pendingJobCompleted.length>0||this._pendingJobFailed.length>0||this._pendingRenderableCreated.length>0||this._elevationQueries.size>0||a(this._layers,e=>this._isUpdating(e)))}addLayerView(e){return this._lyr3DMain?this._addLayerView(e):(this._debugLog(0,1,"Lyr3DWasmPerSceneView.add3DTilesLayerView() called when WASM wasn't initialized"),{wasmLayerId:g})}removeLayerView(e){if(!this._lyr3DMain)return this._debugLog(0,1,this._wasmNotLoaded),0;this._doRemoveLayerView(e);const i=this._layers.size;return 0===i&&(this._debugLog(0,3,"Lyr3DWasmPerSceneView.remove3DTilesLayerView() no Lyr3D layers left after removing a layer, destroying"),this.destroy()),i}getValidLayerViewCount(){if(!this._lyr3DMain)return this._debugLog(0,1,this._wasmNotLoaded),0;let e=0;return this._layers.forEach(i=>{i.layerView.wasmLayerId>=0&&++e}),e}setEnabled(e,i){if(!this._lyr3DMain)return void this._debugLog(0,1,this._wasmNotLoaded);const t=this._layers.get(e.wasmLayerId);if(t){this._lyr3DMain.set_enabled(e.wasmLayerId,i),t.needMemoryUsageUpdate=!0;const s=this._isUpdating(t);t.needFrame=!0,s||t.layerView.updatingFlagChanged()}}setLayerOffset(e,i){if(!this._lyr3DMain)return void this._debugLog(0,1,this._wasmNotLoaded);const t=this._layers.get(e.wasmLayerId);t&&(this._lyr3DMain.set_carto_offset_z(e.wasmLayerId,i),t.needFrame=!0,t.layerView.updatingFlagChanged())}getAttributionText(){if(!this._lyr3DMain)return this._debugLog(0,1,this._wasmNotLoaded),[];return this._lyr3DMain.get_current_attribution_text().split("|")}onRenderableEvicted(e,i,t){if(!this._lyr3DMain)return void this._debugLog(0,1,this._wasmNotLoaded);this._layers.get(e.wasmLayerId)&&this._lyr3DMain.on_renderable_evicted(e.wasmLayerId,i,t)}setMeshModifications(e,i){if(!this._lyr3DMain)return void this._debugLog(0,1,this._wasmNotLoaded);const t=this._layers.get(e.wasmLayerId);if(t){const s=this._lyr3DMain._malloc(8*i.length),r=new Float64Array(this._lyr3DMain.HEAPF64.buffer,s,i.length);for(let e=0;e<i.length;++e)r[e]=i[e];this._lyr3DMain.set_mesh_modification_polygons(e.wasmLayerId,s,i.length),this._lyr3DMain._free(s);const a=this._isUpdating(t);t.needFrame=!0,a||t.layerView.updatingFlagChanged()}}isUpdating(e){if(!this._lyr3DMain&&this._lyr3DMainPromise)return!0;const i=this._layers.get(e);return!!i&&(i.outstandingJobCount>0||i.outstandingRenderableCount>0||i.needFrame||this._lyr3DBusyCount>0)}initializeWasm(e,i){return this._lyr3DMain?Promise.resolve():this.view.renderSpatialReference?(this._debugLog(0,3,"Lyr3DWasmPerSceneView.initializeWasm()"),this._lyr3DMainPromise||(this._lyr3DMainPromise=v().then(t=>{this._lyr3DMain=t,this._lyr3DMainPromise=null;const s=this._lyr3DMain.addFunction(this._onNewJob.bind(this),"v"),r=this._lyr3DMain.addFunction(this._onNewRenderable.bind(this),"v"),a=this._lyr3DMain.addFunction(this._freeRenderables.bind(this),"viii"),n=this._lyr3DMain.addFunction(this._setRenderableVisibility.bind(this),"viiii"),o=this._lyr3DMain.addFunction(this._onWasmError.bind(this),"viiii"),l=this._lyr3DMain.addFunction(this._onElevQueryComplete.bind(this),"vi");if(!this.view.renderSpatialReference)return void(this._lyr3DMain=null);this._viewSR=this.view.renderSpatialReference?.toJSON();const d="global"===this.view.viewingMode?5:3;if(5===d)this._viewSR.wkid=this._viewSR.latestWkid=S,this._viewSR.vcsWkid=this._viewSR.latestVcsWkid=W;else if(this.view.renderSpatialReference?.isWebMercator)this._viewSR.wkid=this._viewSR.latestWkid=R,this._viewSR.vcsWkid=this._viewSR.latestVcsWkid=W;else if(this.view.renderSpatialReference?.wkid===C)this._viewSR.wkid=this._viewSR.latestWkid=S,this._viewSR.vcsWkid=this._viewSR.latestVcsWkid=W;else if(!this._viewSR.latestVcsWkid&&!this._viewSR.vcsWkid){const e=f(this.view.heightModelInfo);if(e)this._viewSR.vcsWkid=this._viewSR.latestVcsWkid=e;else{const e=this.view.heightModelInfo?.heightModel,i=!e||"gravity-related-height"===e;this._viewSR.vcsWkid=this._viewSR.latestVcsWkid=i?W:V}}const h=has("esri-lyr3D-max-concurrent-requests")??16;return this._lyr3DMain.initialize_lyr3d_wasm(o,s,r,a,n,l,e,i,d,this._cleanUpSR(this._makeSRWasmSerializable(this._viewSR)),Math.max(this._debugLevel,0),h)?(this._workerHandle=new b(M(this.view.resourceController)),this._workerHandle.promise?this._workerHandle.promise:void 0):(this._lyr3DMain=null,void this._debugLog(0,0,"Lyr3d Main WASM failed to initialize",!1))}).catch(e=>{this._debugLog(0,0,`Lyr3d WASM failed to download error = ${e}`,!1)})),this._lyr3DMainPromise):Promise.reject()}get isTerrainReady(){return this._isTerrainReady}setLodPixelThreshold(e,i){this._lyr3DMain?.set_lod_pixel_threshold(i);const t=this._layers.get(e.wasmLayerId);t&&(t.needFrame=!0,t.layerView.updatingFlagChanged())}setMaximumGaussianSplatCount(e){this._lyr3DMain.set_maximum_splat_count(e),this._layers.forEach(e=>{"gaussian-splat-3d"===e.layerView.type&&(e.needFrame=!0,e.layerView.updatingFlagChanged())})}queryElevation(e,i,t){if(!this._lyr3DMain)return Promise.reject(this._wasmNotLoaded);if(0===i.coordinates.length)return Promise.reject("no coordinates for elevation query");const s="global"===this.view.viewingMode?y.WGS84:this._viewSR.wkid===R?y.WebMercator:y.PlateCarree,r=i.projectSync(s);r&&(i=r);const a=2*i.coordinates.length,n=this._lyr3DMain._malloc(8*a),o=new Float64Array(this._lyr3DMain.HEAPF64.buffer,n,a);for(let y=0;y<i.coordinates.length;++y){const e=i.coordinates[y];o[2*y]=e.x,o[2*y+1]=e.y}const l=t?.maxGeometricError??0,d=this._lyr3DMain.create_elevation_query(e.wasmLayerId,l,n,a);if(this._lyr3DMain._free(n),d===m)return Promise.reject("max mesh elevation query limit exceeded");if(d===p)return Promise.reject("elevation query failed");const h={descriptor:i,signal:t?.signal,resolveCallback:null,rejectCallback:null},_=new Promise((e,i)=>{h.resolveCallback=e,h.rejectCallback=i});return this._elevationQueries.set(d,h),_}_checkForAbortedElevationQueries(){const e=[];this._elevationQueries.forEach((i,t)=>{o(i.signal)&&(this._lyr3DMain.cancel_elevation_query(t),i.rejectCallback(n()),e.push(t))});for(let i=0;i<e.length;++i)this._elevationQueries.delete(e[i])}_pulseTask(e){const i=this._lyr3DMain;if(i){if(this._cameraDirty){const e=this.view.state?.contentCamera;if(e){const{eye:t,center:s,up:r,near:a,far:n,fovY:o}=e,l=[e.viewport[2],e.viewport[3]],d={eye:t,center:s,up:r,near:a,far:n,fov:o,aspectRatio:e.width/e.height,viewport:l};i.set_camera_parameters(d),this._cameraDirty=!1}}if(this._cameraElevationDirty){const e=this.view.state?.contentCamera.relativeElevation;i.set_camera_elevation(e)}this._checkForAbortedElevationQueries();let t=0,s=0;this._layers.forEach(e=>{t+=e.layerView.usedMemory,s+=e.layerView.cachedMemory}),t/=1048576,s/=1048576;const r=this.view.resourceController.memoryController,a=r.usedMemory*r.maxMemory-t-this._lyr3DInternalMemoryBytes/1048576;this._lyr3DBusyCount=this._lyr3DMain.frame_pulse(r.memoryFactor,t,s,a,r.maxMemory),this._lyr3DInternalMemoryBytes=this._lyr3DMain.get_index_memory_bytes(),this._layers.forEach(e=>{this._cameraElevationDirty||(e.needFrame=!1),e.layerView.updatingFlagChanged()}),this._hasLayerThatReplacesTerrain&&!this._isTerrainReady&&(this._isTerrainReady=this._lyr3DMain.is_terrain_ready(),this._isTerrainReady&&this.notifyChange("isTerrainReady")),this._flushPendingWasmCalls(e),this._cameraElevationDirty=!1}}_isUpdating(e){return e.outstandingJobCount>0||e.outstandingRenderableCount>0||e.needFrame||this._cameraDirty||this._lyr3DBusyCount>0}_incrementJobCount(e,i){if(i.isForElevationQuery)return;const t=this._isUpdating(e);e.outstandingJobCount+=1,t||e.layerView.updatingFlagChanged()}_decrementJobCount(e,i){if(i.isForElevationQuery)return;const t=this._isUpdating(e);e.outstandingJobCount-=1;t!==this._isUpdating(e)&&e.layerView.updatingFlagChanged()}_incrementRenderableCount(e){const i=this._isUpdating(e);e.outstandingRenderableCount+=1,i||e.layerView.updatingFlagChanged()}_decrementRenderableCount(e){const i=this._isUpdating(e);e.outstandingRenderableCount-=1;i!==this._isUpdating(e)&&e.layerView.updatingFlagChanged()}_flushPendingWasmCalls(e){this._lyr3DMain&&(this._flushPendingCalls(this._pendingJobFailed,e),this._flushPendingCalls(this._pendingJobCompleted,e),this._flushPendingCalls(this._pendingRenderableCreated,e))}_flushPendingCalls(e,i){for(;!i.done&&e.length>0;){e.shift()(this._lyr3DMain),i.madeProgress()}}_onJobFailed(e,i,t){i.error.length&&this._debugLog(1,1,i.error,!1),this._lyr3DMain&&!e.layerView.destroyed&&this._pendingJobFailed.push(e=>e.on_job_failed(t.jobId,t.desc)),this._decrementJobCount(e,t)}_onJobSucceeded(e,i,t){if(this._lyr3DMain){if(e.layerView.destroyed)return void this._pendingJobFailed.push(e=>e.on_job_failed(t.jobId,t.desc));const{data:s}=i,r=e=>{const r=s.byteLength,a=e._malloc(r);try{new Uint8Array(e.HEAPU8.buffer,a,r).set(s),e.on_job_completed(t.jobId,i.jobDescJson,a,r)}finally{e._free(a)}};this._pendingJobCompleted.push(r)}this._decrementJobCount(e,t)}_getRequestPromises(e,t,s,r){const a=[];for(const n of e){const e=new URL(n);if("integrated-mesh-3dtiles"===r.type){if(e.origin===s.origin&&e.pathname===s.pathname){if(r.rootTileset){a.push(Promise.resolve(r.rootTileset.slice()));continue}}else r.session&&e.searchParams.set("session",r.session)}a.push(i(e.toString(),t).then(e=>e.data))}return a}_getInitialPromise(e,i,t,s,r,a,n){const o=this._getRequestPromises(e.urls,i,t,s);return Promise.all(o).then(e=>(r.inputs=e,this._workerHandle.invoke(r,a))).then(e=>e).catch(i=>{let t=1;return l(i)?this._debugLog(1,2,`job ${e.jobId} was cancelled.`):n&&400===i.details?.httpStatus?(t=3,this._debugLog(1,2,"Session expired, trying to create new Session.")):this._debugLog(1,1,`job ${e.jobId} failed with error ${i}.`),{status:t,error:"",jobDescJson:"",data:new Uint8Array(0),missingInputUrls:[],inputs:[]}})}async _onNewJob(){const e=this._lyr3DMain.get_next_job(),i=this._layers.get(e.layerId);if(!i)return;this._incrementJobCount(i,e);const t=i.abortController.signal,s=i.layerView.layer,r="integrated-mesh-3dtiles"===s.type?s.key:null,a="integrated-mesh-3dtiles"===s.type?s.session:null,n={responseType:"array-buffer",signal:t,query:{...i.customParameters,token:i.apiKey,key:r}},o={id:e.jobId,inputs:[],jobDescJson:e.desc.slice(),isMissingResourceCase:!1},d=new URL(s.url),h=r=>{if(1===r.status)this._onJobFailed(i,r,e);else if(0===r.status)this._onJobSucceeded(i,r,e);else if(2===r.status){const a=this._getRequestPromises(r.missingInputUrls,n,d,s);Promise.all(a).then(e=>{o.jobDescJson=r.jobDescJson,r.originalInputs?o.inputs=r.originalInputs:o.inputs=[],o.isMissingResourceCase=!0;for(const i of e)o.inputs.push(i);return this._workerHandle.invoke(o,t)}).then(t=>{1===t.status?this._onJobFailed(i,t,e):0===t.status&&this._onJobSucceeded(i,t,e)}).catch(t=>{this._decrementJobCount(i,e),l(t)?this._debugLog(1,2,`job ${e.jobId} was cancelled.`):this._debugLog(1,1,`job ${e.jobId} failed with error ${t}.`),this._lyr3DMain&&this._pendingJobFailed.push(i=>i.on_job_failed(e.jobId,e.desc))})}};try{const i=await this._getInitialPromise(e,n,d,s,o,t,a);if(3===i.status&&"integrated-mesh-3dtiles"===s.type){a===s.session&&null!==s.session&&await s.requestRootAndSession(t);h(await this._getInitialPromise(e,n,d,s,o,t,s.session))}else h(i)}catch(_){_&&this._debugLog(1,1,_.toString(),!1),this._lyr3DMain&&this._pendingJobFailed.push(i=>i.on_job_failed(e.jobId,e.desc)),this._decrementJobCount(i,e)}}_onNewRenderable(){const e=this._lyr3DMain.get_next_renderable(),{meshData:i}=e;i.data&&i.data.byteLength>0&&(i.data=i.data.slice());const t=this._layers.get(e.layerId);t&&(this._incrementRenderableCount(t),t.layerView.createRenderable(e).then(i=>{const s=i.numGaussians??0;if(this._lyr3DMain&&!t.layerView.destroyed){const{layerId:t,handle:r}=e,{memUsageBytes:a}=i;this._pendingRenderableCreated.push(e=>e.on_renderable_created(!0,t,r,a,s))}this._decrementRenderableCount(t)}).catch(i=>{if(l(i)||this._debugLog(2,1,`createRenderable failed with error ${i}.`),this._lyr3DMain&&!t.layerView.destroyed){const{layerId:i,handle:t}=e;this._pendingRenderableCreated.push(e=>e.on_renderable_created(!1,i,t,0,0))}this._decrementRenderableCount(t)}))}_freeRenderables(e,i,t){if(t<1)return;const s=this._layers.get(e);if(!s)return;const r=s.layerView,a=[],n=new Uint32Array(this._lyr3DMain.HEAPU32.buffer,i,t);for(let o=0;o<t;++o)a.push(n[o]);for(let o=0;o<t;++o)r.freeRenderable(a[o])}_setRenderableVisibility(e,i,t,s){if(s<1)return;const r=this._layers.get(e);if(!r)return;const a=r.layerView,n=[],o=[],l=new Uint32Array(this._lyr3DMain.HEAPU32.buffer,i,s),d=new Uint8Array(this._lyr3DMain.HEAPU8.buffer,t,s);for(let h=0;h<s;++h)n.push(l[h]),o.push(!!(1&d[h]));a.setRenderableVisibility(n,o,s)}_onWasmError(e,i,t,s){this._lyr3DMain&&this._debugLog(t,s,this._lyr3DMain.UTF8ToString(e,i),!1)}_onElevQueryComplete(e){const i=this._elevationQueries.get(e),t=this._lyr3DMain.get_elevation_query_result(e);if(i)if(t.succeeded&&t.zs){const s=t.zs.slice(),r=i.descriptor.clone();for(let e=0;e<s.length;++e)r.coordinates[e].z=s[e];this._debugLog(2,3,`Success EQ ${e}, number points ${s.length}.`),i.resolveCallback(r),this._elevationQueries.delete(e)}else i.rejectCallback(new s("elevation-query:error",t?.error??"Elevation query failed")),this._elevationQueries.delete(e);else this._debugLog(2,1,`_onElevQueryComplete called for unknown queryId ${e}.`)}_doRemoveLayerView(e){const i=this._layers.get(e.wasmLayerId);return!!i&&(i.abortController.abort(),this._lyr3DMain.remove_layer(e.wasmLayerId),this._is3DTilesIMLayerView(e)&&e.layer.replacesTerrain&&(this._hasLayerThatReplacesTerrain=!1,this._isTerrainReady=!1,this.notifyChange("isTerrainReady")),this._layers.delete(e.wasmLayerId),!0)}_is3DTilesIMLayerView(e){return"integrated-mesh-3dtiles"===e.layer.type}_isGaussianSplatLayerView(e){return"gaussian-splat"===e.layer.type}_isGaussianSplatLayer(e){return"gaussian-splat"===e.type}_toWasmQuality(e){switch(e){case"low":return 1;case"medium":return 2;case"high":return 3}}_addLayerView(e){const i=e.layer;if(!i.url||!i.rootTilesetJSON)return{wasmLayerId:w};const t="integrated-mesh-3dtiles"===i.type?0:2,s=this._lyr3DMain.validate_root_tileset(JSON.stringify(i.rootTilesetJSON),t);if(0!==s.errorCode)return{wasmLayerId:w,check:s};const a=this._lyr3DMain.get_next_layer_id(),n=new AbortController;this._layers.set(a,{layerView:e,abortController:n,needMemoryUsageUpdate:!1,outstandingJobCount:0,outstandingRenderableCount:0,customParameters:i.customParameters,apiKey:i.apiKey,needFrame:!0});const o=D(i.elevationInfo),l=this._toWasmQuality(this.view?.qualityProfile),d=e=>r.getLogger(this).error("add-spatial-reference-error","Error when adding SR:",e);let h=!1;if(this._isGaussianSplatLayerView(e)&&this._isGaussianSplatLayer(i)){let t=i.spatialReference;if(e.useEsriCrs&&i.esriCrsSpatialReference){t=i.esriCrsSpatialReference;const s=u(t);let r=1,a=1;!s&&t.wkid&&-1!==t.wkid&&(r=c.values[c[t.wkid]],a=e.metersPerVCSUnit),this._workerHandle.addSpatialReferenceInfo(this._cleanUpSR(this._makeSRWasmSerializable(t)),s,r,a).catch(d),t.vcsWkid&&this._viewSR.vcsWkid&&this._viewSR.vcsWkid!==t.vcsWkid&&this._workerHandle.addSpatialReferenceInfo(this._cleanUpSR(this._makeSRWasmSerializable(this._viewSR)),!1,1,1).catch(d)}h=this._lyr3DMain.add_gaussian_splat_layer(l,i.url,a,o)}else this._is3DTilesIMLayerView(e)&&(h=this._lyr3DMain.add_3dtiles_layer(l,i.url,a,o,e.layer.replacesTerrain),h&&e.layer.replacesTerrain&&(this._hasLayerThatReplacesTerrain=!0,this._isTerrainReady=!1,this.notifyChange("isTerrainReady")));return h?(this._updateWasmCamera(),e.updatingFlagChanged(),{wasmLayerId:a}):(this._layers.delete(a),{wasmLayerId:w})}_updateWasmCamera(){const e=this.view.state?.contentCamera;e&&this._lyr3DMain&&(this._cameraDirty=!0,this._markAllLayerViewsUpdating())}_markAllLayerViewsUpdating(){this._layers.forEach(e=>{const i=this._isUpdating(e);e.needFrame=!0,i||e.layerView.updatingFlagChanged()})}_makeSRWasmSerializable(e){return{wkid:e?.wkid??-1,latestWkid:e?.latestWkid??-1,vcsWkid:e?.vcsWkid??-1,latestVcsWkid:e?.latestVcsWkid??-1,wkt:e?.wkt??""}}_cleanUpSR(e){return-1===e?.wkid&&e.latestWkid&&-1!==e.latestWkid?e.wkid=e.latestWkid:-1===e?.latestWkid&&e.wkid&&-1!==e.wkid&&(e.latestWkid=e.wkid),-1===e?.vcsWkid&&e.latestVcsWkid&&-1!==e.latestVcsWkid?e.vcsWkid=e.latestVcsWkid:-1===e?.latestVcsWkid&&e.vcsWkid&&-1!==e.vcsWkid&&(e.latestVcsWkid=e.vcsWkid),e}};e([h({constructOnly:!0})],j.prototype,"view",void 0),e([h({readOnly:!0})],j.prototype,"isTerrainReady",null),j=e([_("esri.layers.Lyr3DWasmPerSceneView")],j);const I=j;export{I as default};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import t from"../request.js";import has from"../core/has.js";import s from"../core/Logger.js";import{isAbortError as r}from"../core/promiseUtils.js";import{watch as i,initial as a}from"../core/reactiveUtils.js";import{convertTime as n}from"../core/timeUtils.js";import{property as o,subclass as l}from"../core/accessorSupport/decorators.js";import{distance as h}from"../core/libs/gl-matrix-2/math/vec3.js";import{create as d}from"../core/libs/gl-matrix-2/factories/vec3f64.js";import{renderSRFromViewSR as u}from"../geometry/support/coordinateSystem.js";import{loadVoxelWASM as _}from"../libs/vxl/VxlModule.js";import{InternalRenderCategory as c}from"../views/3d/webgl.js";import{VoxelGraphic as m}from"../views/3d/layers/VoxelGraphic.js";import{VoxelTarget as f}from"../views/3d/layers/i3s/Intersector.js";import{Frustum as p}from"../views/3d/state/Frustum.js";import{RenderCoordsHelper as g}from"../views/3d/support/RenderCoordsHelper.js";import y from"../views/3d/webgl/RenderNode.js";import{IntersectorResult as x}from"../views/3d/webgl-engine/lib/IntersectorResult.js";let v=class extends y{constructor(e){super(e),this._havePreparedWithAllLayers=!1,this.produces="disabled",this.consumes={required:[c.VOXEL]},this._vxlPromise=null,this._moreToLoad=!1,this._viewportWidth=-1,this._viewportHeight=-1,this._newLayers=[],this._layers=new Map,this._renderTargetToRestore=null,this._lastFrameWasStationary=!1,this._wasmMemBlockSizes=[512,1024,2048,4096,8192,16384,32768,65536],this._wasmMemBlocks=new Map,this._dbgFlags=new Set,this._captureFrustum=!1,this._frustum=null,this._frustumRenderableId=-1,this._renderCoordsHelper=null,this.type=9,this.slicePlaneEnabled=!0,this.isGround=!1,this.layerViewUid=[]}_dbg(e,t){this._dbgFlags.has(e)&&(4===e?s.getLogger(this).error(t):s.getLogger(this).warn(t))}initialize(){this._dbg(1,"--initialize--");for(const e of this._wasmMemBlockSizes)this._wasmMemBlocks.set(e,0);this.addHandles([i(()=>"local"===this.view.viewingMode,e=>{e?(this._dbg(1,"view switched to local view, enabling rendering"),this.produces=c.VOXEL,this.view.sceneIntersectionHelper.addIntersectionHandler(this)):(this._dbg(1,"view switched to global view, disabling rendering"),this.view.sceneIntersectionHelper.removeIntersectionHandler(this),this.produces="disabled")},a),i(()=>this.view?.qualityProfile,e=>{this._dbg(3,"qualityProfile changed to "+e),this._vxl?.set_quality(this._toWasmQuality(e))},a),i(()=>this.view?.timeExtent,()=>{if(this._vxl){const e=this._getTimeArgs(this.view?.timeExtent);this._dbg(3,"sceneView timeExtent changed to useTime="+e.hasTime+" st="+e.startTime+" et="+e.endTime),this._vxl.set_scene_time_extent(e.startTime,e.endTime,e.hasTime),this.requestRender(1)}},a),i(()=>this.view?.stationary,e=>{this._vxl&&e&&!this._lastFrameWasStationary&&this.requestRender(1)})])}get _rctx(){return this.renderContext?.rctx}get _halfIntTexturesAvailable(){return!!this._rctx?.capabilities.textureNorm16}get _textureFloatLinearAvailable(){return!!this._rctx?.capabilities.textureFloatLinear}_restoreFramebuffer(){if(!this._renderTargetToRestore||!this._rctx)return;const e=this._renderTargetToRestore.fbo;if(!!!this._rctx)return void this._dbg(4,"no context in restoreFramebuffer!");this._rctx.bindFramebuffer(e,!0);const t=this._renderTargetToRestore.viewport;this._rctx.setViewport(t.x,t.y,t.width,t.height)}_bindPreviousDepthToSlot(e,t){if(!this._rctx||!this._renderTargetToRestore)return 0;const s=this._renderTargetToRestore.fbo?.depthStencilTexture;return s?(0===t?this._rctx.bindTexture(null,e,!0):this._rctx.bindTexture(s,e,!0),1):(this._dbg(4,"no depth/stencil texture exists!"),0)}_modifyResourceCount(e,t,s){if(!this._rctx)return void this._dbg(4,"modifyAllocation callback has no rendering context!");const r=e;1===s?this._rctx.instanceCounter.increment(r,t):this._rctx.instanceCounter.decrement(r,t)}_setBlendState(e,t,s,r){this._rctx?(this._rctx.setBlendingEnabled(1===e),this._rctx.setBlendFunction(t,s),this._rctx.setBlendEquation(r)):this._dbg(4,"setBlendState callback has no rendering context!")}_setFrontFace(e){this._rctx?this._rctx.setFrontFace(e):this._dbg(4,"setFrontFace callback has no rendering context!")}_setDepthStencilStateFunction(e,t,s){this._rctx?(this._rctx.setDepthFunction(s),this._rctx.setDepthTestEnabled(1===e),this._rctx.setDepthWriteEnabled(1===t),this._rctx.setStencilTestEnabled(!1),this._rctx.setStencilFunction(519,0,255),this._rctx.setStencilOpSeparate(1028,7680,7682,7680),this._rctx.setStencilOpSeparate(1029,7680,7683,7680)):this._dbg(4,"setDepthStencilStateFunction callback has no rendering context!")}_setRasterizerState(e){if(this._rctx)switch(e){case 1:this._rctx.setFaceCullingEnabled(!1);break;case 3:this._rctx.setCullFace(1029),this._rctx.setFaceCullingEnabled(!0);break;case 2:this._rctx.setCullFace(1028),this._rctx.setFaceCullingEnabled(!0)}else this._dbg(4,"setRasterizerState callback has no rendering context!")}_setViewport(e,t,s,r){this._rctx?this._rctx.setViewport(e,t,s,r):this._dbg(4,"setViewport callback has no rendering context!")}_updateMemoryUsage(){this._layers.forEach((e,t)=>{if(e.needMemoryUsageUpdate){const s=this._vxl?.estimate_memory_usage(t)??0;s>=0&&(e.needMemoryUsageUpdate=!1,e.layerView.setUsedMemory(s))}})}_syncRequestsResponses(){this._vxl&&this._layers.forEach((e,s)=>{const i=[];e.responses.forEach((t,r)=>{i.push(r),this._dbg(2,"responding for requestID:"+r+" size:"+t.size),this._vxl?.respond(s,r,t),0!==t.requestType&&4!==t.requestType||(e.needMemoryUsageUpdate=!0)});const a=e.responses;for(const t of i)a.delete(t);const n=this._vxl.get_new_requests(s),o=e.abortController.signal;for(const l in n){e.outstandingRequestCount+=1,1===e.outstandingRequestCount&&e.layerView.updatingFlagChanged();const s=n[l],i={responseType:"array-buffer",signal:o,query:{...e.layerView.layer.customParameters,token:e.layerView.layer.apiKey}};this._dbg(2,"making requestID:"+l+" url:"+s.url),t(s.url,i).then(t=>{e.outstandingRequestCount-=1,0===e.outstandingRequestCount&&e.layerView.updatingFlagChanged(),this._dbg(2,"have response for requestID:"+l);let r=0;if(t.data.byteLength>0&&this._vxl){r=this._vxl._malloc(t.data.byteLength);const e=new Uint8Array(this._vxl.HEAPU8.buffer,r,t.data.byteLength),s=new Uint8Array(t.data);for(let r=0;r<t.data.byteLength;++r)e[r]=s[r]}a.set(+l,{responseType:s.responseType,ptr:r,size:t.data.byteLength,success:!0,requestType:s.requestType})}).catch(t=>{e.outstandingRequestCount-=1,0===e.outstandingRequestCount&&e.layerView.updatingFlagChanged(),r(t)||(this._dbg(4,`requestID:${l} failed, error=${t.toString()}`),a.set(+l,{responseType:s.responseType,ptr:0,size:0,success:!1,requestType:s.requestType}))})}})}updateWasmCamera(e){this._vxl?.set_projection_matrix.apply(this._vxl,e.projectionMatrix),this._vxl?.set_view_matrix.apply(this._vxl,e.viewMatrix),this._vxl?.set_near_far(e.near,e.far)}isUpdating(e){if(!this._vxl&&this._vxlPromise)return!0;const t=this._layers.get(e);return!!t&&t.outstandingRequestCount>0}getLayerTimes(e){const t=[];return this._vxl?(this._layers.forEach((s,r)=>{if(s.layerView.wasmLayerId===e.wasmLayerId){const s=this._vxl.get_layer_epoch_times(r,e.layer.currentVariableId);for(let e=0;e<s.length;++e)t.push(s[e])}}),t):t}getCurrentLayerTimeIndex(e){let t=0;return this._layers.forEach((s,r)=>{s.layerView.wasmLayerId===e.wasmLayerId&&(t=this._vxl?.get_layer_current_time_id(r)??0)}),t}setEnabled(e,t){this._layers.forEach((s,r)=>{s.layerView.wasmLayerId===e.wasmLayerId&&(this._vxl?.set_enabled(r,t),s.needMemoryUsageUpdate=!0,this.requestRender(1))})}setIsInScaleRange(e,t){const s=this._layers.get(e.wasmLayerId);s&&t!==s.isInScaleRange&&(s.isInScaleRange=t,this._vxl?.set_is_in_scale_range(e.wasmLayerId,t),s.needMemoryUsageUpdate=!t,this.requestRender(1))}setStaticSections(e,t){const s={mask:1,staticSections:t};return this._doMaskedUIUpdate(e,s,!0)}setCurrentVariable(e,t){const s={mask:1024,currentVariable:t};return this._doMaskedUIUpdate(e,s,!0)}setRenderMode(e,t){const s={mask:8192,renderMode:t};return this._doMaskedUIUpdate(e,s,!0)}setVerticalExaggerationAndOffset(e,t,s,r){const i={mask:256,volStyleDesc:{volumeId:t,verticalExaggeration:s,verticalOffset:r}};return this._doMaskedUIUpdate(e,i,!0)}setVariableStyles(e,t){const s={mask:32768,variableStyles:t};return this._doMaskedUIUpdate(e,s,!0)}setVolumeStyles(e,t){const s={mask:65536,volumeStyles:t};return this._doMaskedUIUpdate(e,s,!0)}setEnableDynamicSections(e,t){const s={mask:4096,containerIsVisible:t,container:1};return this._doMaskedUIUpdate(e,s,!0)}setEnableIsosurfaces(e,t){const s={mask:4096,containerIsVisible:t,container:0};return this._doMaskedUIUpdate(e,s,!0)}setEnableSections(e,t){const s={mask:4096,containerIsVisible:t,container:2};return this._doMaskedUIUpdate(e,s,!0)}setAnalysisSlice(e,t,s,r){const i={mask:131072,analysisSlice:{point:s,normal:r,enabled:t}};return this._doMaskedUIUpdate(e,i,!0)}updateLayerTimeProperties(e){if(!this._vxl)return;const t=this._layers.get(e.wasmLayerId);if(t){const s=t.layerView.layer;let r=0;s.timeOffset&&(r=n(s.timeOffset.value,s.timeOffset.unit,"seconds"));const i=this._getTimeArgs(s.timeExtent);this._vxl?.set_layer_time_properties(e.wasmLayerId,i.startTime,i.endTime,i.hasTime,s.useViewTime,r),this.requestRender(1)}}_doMaskedUIUpdate(e,t,s){if(!this._vxl)return!1;let r=!1;return this._layers.forEach((s,i)=>{if(s.layerView.wasmLayerId===e.wasmLayerId){const e={str:JSON.stringify(t),byteCount:0,ptr:0,isReusable:!1};this._allocateBlock(e)&&(r=1===this._vxl?.handle_masked_ui_update(i,e.ptr,e.byteCount),e.isReusable||this._vxl?._free(e.ptr))}}),r&&s&&this.requestRender(1),r}_addTriangleToWasmBuffer(e,t,s,r,i){return e[3*t]=s[0],e[3*t+1]=s[1],e[3*t+2]=s[2],e[3*(t+=1)]=r[0],e[3*t+1]=r[1],e[3*t+2]=r[2],e[3*(t+=1)]=i[0],e[3*t+1]=i[1],e[3*t+2]=i[2],t+=1}_addNormalToWasmBuffer(e,t,s){return e[3*t]=s[0],e[3*t+1]=s[1],e[3*t+2]=s[2],t+=1}_doCaptureFrustum(){if(!this._vxl)return;const e=36,t=e/3,s=this._vxl._malloc(3*e*Float32Array.BYTES_PER_ELEMENT),r=new Float32Array(this._vxl.HEAPF32.buffer,s,3*e),i=this._vxl._malloc(3*t*Float32Array.BYTES_PER_ELEMENT),a=new Float32Array(this._vxl.HEAPF32.buffer,i,e),n=this._frustum.points[0],o=this._frustum.points[1],l=this._frustum.points[2],h=this._frustum.points[3],d=this._frustum.points[4],u=this._frustum.points[5],_=this._frustum.points[6],c=this._frustum.points[7];let m=0,f=0;const p=this._frustum.planes[4];m=this._addTriangleToWasmBuffer(r,m,l,o,n),f=this._addNormalToWasmBuffer(a,f,p),m=this._addTriangleToWasmBuffer(r,m,n,h,l),f=this._addNormalToWasmBuffer(a,f,p);const g=this._frustum.planes[5];m=this._addTriangleToWasmBuffer(r,m,d,u,_),f=this._addNormalToWasmBuffer(a,f,g),m=this._addTriangleToWasmBuffer(r,m,_,c,d),f=this._addNormalToWasmBuffer(a,f,g);const y=this._frustum.planes[3];m=this._addTriangleToWasmBuffer(r,m,_,l,h),f=this._addNormalToWasmBuffer(a,f,y),m=this._addTriangleToWasmBuffer(r,m,h,c,_),f=this._addNormalToWasmBuffer(a,f,y);const x=this._frustum.planes[2];m=this._addTriangleToWasmBuffer(r,m,n,o,u),f=this._addNormalToWasmBuffer(a,f,x),m=this._addTriangleToWasmBuffer(r,m,u,d,n),f=this._addNormalToWasmBuffer(a,f,x);const v=this._frustum.planes[0];m=this._addTriangleToWasmBuffer(r,m,h,n,d),f=this._addNormalToWasmBuffer(a,f,v),m=this._addTriangleToWasmBuffer(r,m,d,c,h),f=this._addNormalToWasmBuffer(a,f,v);const b=this._frustum.planes[1];m=this._addTriangleToWasmBuffer(r,m,l,_,u),f=this._addNormalToWasmBuffer(a,f,b),this._addTriangleToWasmBuffer(r,m,u,o,l),this._addNormalToWasmBuffer(a,f,b),-1!==this._frustumRenderableId&&this._vxl.remove_generic_mesh(this._frustumRenderableId),this._frustumRenderableId=this._vxl.add_generic_mesh(s,3*e,i,e,255,0,0,64),this._vxl._free(s),this._vxl._free(i),this._captureFrustum=!1,this.requestRender(1)}captureFrustum(){null===this._renderCoordsHelper&&(this._renderCoordsHelper=g.create(2,u(!1,this.view.spatialReference))),null===this._frustum&&(this._frustum=new p(this._renderCoordsHelper)),this._captureFrustum=!0,this.requestRender(1)}toggleFullVolumeExtentDraw(e){this._vxl&&this._layers.forEach((t,s)=>{t.layerView.wasmLayerId===e.wasmLayerId&&(this._vxl?.toggle_full_volume_extent_draw(s),this.requestRender(1))})}dropQueryRenderTarget(){this._vxl?.drop_query_rt()}addVoxelLayer(e){if(!this._vxl){const t={layerView:e,resolveCallback:null,rejectCallback:null},s=new Promise((e,s)=>{t.resolveCallback=e,t.rejectCallback=s});return this._newLayers.push(t),s}const t=this._addVoxelLayer(e,this._vxl);return t<0?Promise.reject(-1):Promise.resolve(t)}removeVoxelLayer(e){if(!this._vxl){const t=this._newLayers.findIndex(t=>e.uid===t.layerView.uid);t>=0&&(this._newLayers[t].resolveCallback(-1),this._newLayers.splice(t,1));const s=this._newLayers.length;return 0===s&&(this._dbg(1,"No voxel layers left after removing a layer, destroying render node"),this.destroy()),s}let t=-1;this._layers.forEach((s,r)=>{if(s.layerView.wasmLayerId===e.wasmLayerId){t=r,s.abortController.abort(),this._vxl?.remove_layer(t);const i=this.layerViewUid.indexOf(e.uid);-1!==i&&this.layerViewUid.splice(i,1)}}),t>=0&&this._layers.delete(t);const s=this._layers.size;return 0===s&&(this._dbg(1,"No voxel layers left after removing a layer, destroying render node"),this.destroy()),s}_getBlockSize(e){for(const t of this._wasmMemBlockSizes)if(e<t)return t;return-1}_allocateBlock(e){if(!this._vxl)return!1;e.byteCount=this._vxl.lengthBytesUTF8(e.str)+1;const t=this._getBlockSize(e.byteCount);return t<0?(e.isReusable=!1,e.ptr=this._vxl._malloc(e.byteCount)):(e.isReusable=!0,e.ptr=this._wasmMemBlocks.get(t),0===e.ptr&&(e.ptr=this._vxl._malloc(t),this._wasmMemBlocks.set(t,e.ptr))),0!==e.ptr&&(this._vxl.stringToUTF8(e.str,e.ptr,e.byteCount),!0)}_getTimeArgs(e){let t=-Number.MAX_VALUE,s=Number.MAX_VALUE,r=!1;return null!=e&&(e.isAllTime?r=!0:(null!=e.start&&(r=!0,t=e.start.getTime()/1e3),null!=e.end&&(r=!0,s=e.end.getTime()/1e3))),{startTime:t,endTime:s,hasTime:r}}_addVoxelLayer(e,t){const r=e.layer;let i=-1;const a=r.getConfiguration();if(a.length<1)return-1;const o={str:a,byteCount:0,ptr:0,isReusable:!1};if(!this._allocateBlock(o))return-1;const l=this._getTimeArgs(r.timeExtent),h=this.view.spatialReference.isWGS84&&r.spatialReference.isWGS84?111319.49079327357:1;let d=0;if(r.timeOffset&&(d=n(r.timeOffset.value,r.timeOffset.unit,"seconds")),i=t.add_layer(r.serviceRoot,o.ptr,o.byteCount,h,h,l.startTime,l.endTime,l.hasTime,r.useViewTime,d,this._toWasmQuality(this.view.qualityProfile)),o.isReusable||t._free(o.ptr),i>=0){r.test?.constantUpscaling&&(this._setUpscalingLimits(0,.25,.25),this._setUpscalingLimits(1,.5,.5),this._setUpscalingLimits(2,.75,.75));const t=new AbortController;if(this._layers.set(i,{layerView:e,responses:new Map,outstandingRequestCount:0,abortController:t,needMemoryUsageUpdate:!1,isInScaleRange:!0}),this.layerViewUid.push(e.uid),!this._halfIntTexturesAvailable||has("mac")){const t=[];let r="";for(const s of e.layer.variables)"Int16"!==s.renderingFormat.type&&"UInt16"!==s.renderingFormat.type||(t.push(s.name),s.id===e.layer.currentVariableId&&(r=s.name));""!==r&&s.getLogger(this).error("#addVoxelLayer_error()",e.layer,`The voxel layer '${e.layer.title}' cannot render the current variable '${r}' in this browser`),t.length>0&&s.getLogger(this).warn("#addVoxelLayer_warning()",e.layer,`The voxel layer '${e.layer.title}' cannot render the variables '${t.toString()}' in this browser`)}if(!this._textureFloatLinearAvailable){const t=[];let r="";for(const s of e.layer.variables)"Float32"===s.renderingFormat.type&&(t.push(s.name),s.id===e.layer.currentVariableId&&(r=s.name));""!==r&&s.getLogger(this).error("#addVoxelLayer_error()",e.layer,`The voxel layer '${e.layer.title}' cannot render the current variable '${r}' in this browser`),t.length>0&&s.getLogger(this).warn("#addVoxelLayer_warning()",e.layer,`The voxel layer '${e.layer.title}' cannot render the variables '${t.toString()}' in this browser`)}return has("esri-mobile")&&s.getLogger(this).warnOnce("Mobile support differs across devices. Voxel layer might not display as expected."),i}return-1}_prepareRender(){if(!this._vxl)return void this._initializeWasm();const e=this.bindParameters.camera.viewForward,t=this.bindParameters.camera.eye;this._vxl.update_camera_pos_and_direction(t[0],t[1],t[2],e[0],e[1],e[2]);const s=this._vxl.cull();this._dbg(2,"missingResourceCount="+s),this._moreToLoad=s>0,this._havePreparedWithAllLayers=0===this._newLayers.length,this._updateMemoryUsage()}render(){this._prepareRender();const e=this.bindRenderTarget();if(!this._vxl||!this._rctx)return this.requestRender(1),e;for(const s of this._newLayers){const e=this._addVoxelLayer(s.layerView,this._vxl);-1===e?s.rejectCallback(-1):s.resolveCallback(e)}if(this._newLayers=[],0===this._layers.size)return this._dbg(4,"No voxel layers but RenderNode is being asked to render!"),e;this._lastFrameWasStationary=this.view.stationary,this._syncRequestsResponses(),this._beforeDraw(this._rctx),this._vxl.begin_color_frame(!this.view.stage.renderer.isFeatureEnabled(2),this.bindParameters.lighting.mainLight.direction[0],this.bindParameters.lighting.mainLight.direction[1],this.bindParameters.lighting.mainLight.direction[2]);const t=this._renderTargetToRestore.viewport;return t.width===this._viewportWidth&&t.height===this._viewportHeight||(this._viewportWidth=t.width,this._viewportHeight=t.height,this._vxl.set_viewport(t.width,t.height),this._layers.forEach(e=>e.needMemoryUsageUpdate=!0)),0===t.x&&0===t.y||this._dbg(4,"Unsupported viewport parameters detected!"),this.updateWasmCamera(this.bindParameters.camera),this._captureFrustum&&(this._frustum.update(this.bindParameters.camera),this._doCaptureFrustum()),this._vxl.draw(),this._afterDraw(this._rctx,this._vxl),(this._moreToLoad||!this._havePreparedWithAllLayers&&this._layers.size>0)&&this.requestRender(1),e}destroy(){this._dbg(1,"--destroy--"),this._vxl&&(this._layers.forEach(e=>{e.abortController.abort()}),this._wasmMemBlocks.forEach(e=>{0!==e&&this._vxl?._free(e)}),this._vxl.uninitialize_voxel_wasm(),this._vxl=null)}_initializeWasm(){if(this._vxl||this._vxlPromise||!this._rctx?.gl)return;const e=this._rctx.gl;this._vxlPromise=_(e).then(t=>{if(t.specialHTMLTargets.jsAPI3DRenderingContext=e,this._vxl=t,this._vxlPromise=null,this._newLayers.length<=0)return this._dbg(1," no voxel layers left after WASM downloaded, removing RenderNode and destroying"),void this.destroy();const s=this._getTimeArgs(this.view?.timeExtent),r=this._vxl.addFunction(this._restoreFramebuffer.bind(this),"v"),i=this._vxl.addFunction(this._setBlendState.bind(this),"viiii"),a=this._vxl.addFunction(this._setFrontFace.bind(this),"vi"),n=this._vxl.addFunction(this._setRasterizerState.bind(this),"vi"),o=this._vxl.addFunction(this._setDepthStencilStateFunction.bind(this),"viii"),l=this._vxl.addFunction(this._setViewport.bind(this),"viiii"),h=this._vxl.addFunction(this._bindPreviousDepthToSlot.bind(this),"iii"),d=this._vxl.addFunction(this._modifyResourceCount.bind(this),"viii"),u=this._halfIntTexturesAvailable&&!has("mac"),_=this._textureFloatLinearAvailable;this._vxl.initialize_voxel_wasm(r,i,a,n,o,l,h,d,s.startTime,s.endTime,s.hasTime,u,_),this.requestRender(1)}).catch(()=>{for(const e of this._newLayers)e.rejectCallback(-2);this._dbg(4," WASM failed to download, destroying render node"),this.destroy()})}pickDepth(e,t,s){if(!this._vxl||!this._rctx||0===this._layers.size)return null;const r=s.viewport[3]-t;if(e<0||e>s.viewport[2]||t<0||t>s.viewport[3])return this._dbg(4,`[js] pickDepth: outOfRange, screenXY=[${e.toFixed(0)}, ${r.toFixed(0)}]]`),null;this._beforeDraw(this._rctx);const i=s.viewForward,a=s.eye;this._vxl.update_camera_pos_and_direction(a[0],a[1],a[2],i[0],i[1],i[2]),this.updateWasmCamera(s),this._vxl.begin_frame();const n=this._vxl.pick_depth(e,r);if(this._afterDraw(this._rctx,this._vxl),n.success){return n.distanceToCamera}return null}pickObject(e,t,s,r){if(!this._vxl||!this._rctx||0===this._layers.size)return null;const i=Math.round(e),a=Math.round(t);if(i<0||i>s.viewport[2]||a<0||a>s.viewport[3])return this._dbg(4,`[js] pickObject: outOfRange, screenXY=[${i}, ${a}], vp=[${s.viewport.toString()}]`),null;this._beforeDraw(this._rctx);const n=s.viewForward,o=s.eye;this._vxl.update_camera_pos_and_direction(o[0],o[1],o[2],n[0],n[1],n[2]),this.updateWasmCamera(s),this._vxl.begin_frame();let l=null;if(0===r.length)l=this._vxl.pick_object(i,a,0,0);else{const e={str:JSON.stringify({layerIds:r}),byteCount:0,ptr:0,isReusable:!1};this._allocateBlock(e)&&(l=this._vxl.pick_object(i,a,e.ptr,e.byteCount),e.isReusable||this._vxl._free(e.ptr))}return this._afterDraw(this._rctx,this._vxl),l}async getOtherFieldPopupValues(e,s){if(!this._vxl)return[];for(const r of e){const e=r.gpuResult;if(!e)continue;const i=this._layers.get(e.layerId);if(!i||!i.layerView.layer.url)continue;const a=i.layerView.layer,n={responseType:"array-buffer",signal:i.abortController.signal,query:{...i.layerView.layer.customParameters,token:i.layerView.layer.apiKey}},o=e.voxelSpacePosition,l=[Math.floor(o[0]/32),Math.floor(o[1]/32),Math.floor(o[2]/32)],h=[-4&l[0],-4&l[1],-4&l[2]];let d=0;if(e.epochTime){const t=this._vxl.get_layer_epoch_times(i.layerView.wasmLayerId,a.currentVariableId);for(let s=0;s<t.length;++s)if(t[s]===e.epochTime/1e3){d=s;break}}const u=[],_={varIds:[],ptrs:[],sizes:[]};for(const r of s){const e=a.variables.findIndex(e=>e.name===r);if(-1===e)continue;const s=a.variables.getItemAt(e)?.id;if(null==s)continue;const i=`${a.url}/variables/${s}/${d}/bundles/0/${h[0]}-${h[1]}-${h[2]}`;u.push(t(i,n).then(e=>e.data)),_.varIds.push(s)}const c=await Promise.allSettled(u),m=c.length;for(let t=0;t<m;++t){const e=c[t];if("fulfilled"===e.status){const t=e.value,s=this._vxl._malloc(t.byteLength);new Uint8Array(this._vxl.HEAPU8.buffer,s,t.byteLength).set(new Uint8Array(t)),_.ptrs.push(s),_.sizes.push(t.byteLength)}else _.varIds.splice(t,1)}const f=this._vxl.get_other_field_popup_values(e,_);for(let t=0;t<_.ptrs.length;++t)this._vxl._free(_.ptrs[t]);if(f.continuousValues)for(const t in f.continuousValues)r.attributes[t]=f.continuousValues[t];if(f.uniqueValues)for(const t in f.uniqueValues)r.attributes[t]=f.uniqueValues[t]}return e}_beforeDraw(e){this._renderTargetToRestore={fbo:e.boundFramebuffer,viewport:e.getViewport()},e.setPolygonOffsetFillEnabled(!1),e.setScissorTestEnabled(!1),e.setColorMask(!0,!0,!0,!0)}_afterDraw(e,t){this._renderTargetToRestore.fbo=null,e.externalTextureUnitUpdate(t.get_texture_units_bound_in_frame(),t.get_active_texture_unit()),e.externalVertexArrayObjectUpdate(),e.externalVertexBufferUpdate(),e.externalProgramUpdate()}intersect(e,t,s,r,i){if(!this._vxl||!this._rctx||0===this._layers.size||!e.options.selectionMode||e.options.isFiltered||!e.camera)return;if(null==i||i[0]<0||i[0]>e.camera.viewport[2]||i[1]<0||i[1]>e.camera.viewport[3])return this._dbg(4,i?`[js] VoxelWasmPerScene.intersect: outOfRange, screenXY=[${i[0].toFixed(0)}, ${i[1].toFixed(0)}]`:"[js] VoxelWasmPerScene.intersect: outOfRange, screenXY=null"),null;const a=[];this._layers.forEach(t=>{e.options.filteredLayerViewUids.includes(t.layerView.uid)&&a.push(t.layerView.wasmLayerId)});const n=this.pickObject(i[0],i[1],e.camera,a);if(null==n||-1===n.layerId)return;const o=this._layers.get(n.layerId);if(o){const t=o.layerView.layer.uid,i=n.distanceToCamera/h(s,r),a=d();a[0]=n.worldX,a[1]=n.worldY,a[2]=n.worldZ;const l={},u=o.layerView.layer,_=u.variables.findIndex(e=>e.id===u.currentVariableId);if(_>=0){const e=u.variables.getItemAt(_);null!=e&&(null!=n.continuousValue?l[e.name]=n.continuousValue:null!=n.uniqueValueLabel&&null!=n.uniqueValue?l[e.name]=`${n.uniqueValueLabel} (${n.uniqueValue})`:null!=n.uniqueValue&&(l[e.name]=`${n.uniqueValue}`),e.description.length>0?l["Voxel.CurrentVariable"]=e.description:e.name?.length>0&&(l["Voxel.CurrentVariable"]=e.name))}if(l["Voxel.Position"]=`[${n.voxelSpacePosition.toString()}]`,null!=n.epochTime&&null!=n.nativeTime&&null!=n.nativeTimeUnits){const e=new Date(n.epochTime);l["Voxel.LocalTime"]=e,l["Voxel.SourceTime"]=`${n.nativeTime.toLocaleString()} ${n.nativeTimeUnits}`}null!=n.depth&&(l["Voxel.Depth"]=n.depth);const c=n.faceNormal;l["Voxel.WorldPosition"]=`[${a[0]}, ${a[1]}, ${a[2]}]`;const m=e=>{const s=new f(a,t,()=>this._createVoxelGraphic(o.layerView.layer,l,n));e.set(this.type,s,i,c)},p=e.results,g=2===e.options.store;if((null==p.min.distance||i<p.min.distance)&&m(p.min),(null==p.max.distance||i>p.max.distance)&&m(p.max),g){const t=new x(e.ray);m(t),e.results.all.push(t)}}}_createVoxelGraphic(e,t,s){return new m({layer:e,sourceLayer:e,origin:e.graphicOrigin,attributes:t,gpuResult:s})}_toWasmQuality(e){switch(e){case"low":return 0;case"medium":return 1;case"high":return 2}}_setUpscalingLimits(e,t,s){this._vxl&&this._vxl.set_upscaling_limits(e,t,s)}};e([o()],v.prototype,"produces",void 0),e([o()],v.prototype,"consumes",void 0),v=e([l("esri.layers.VoxelWasmPerSceneView")],v);const b=v;export{b as default};
2
+ import{__decorate as e}from"tslib";import t from"../request.js";import has from"../core/has.js";import s from"../core/Logger.js";import{isAbortError as r}from"../core/promiseUtils.js";import{watch as i,initial as a}from"../core/reactiveUtils.js";import{convertTime as n}from"../core/timeUtils.js";import{property as o,subclass as l}from"../core/accessorSupport/decorators.js";import{distance as h}from"../core/libs/gl-matrix-2/math/vec3.js";import{create as d}from"../core/libs/gl-matrix-2/factories/vec3f64.js";import{renderSRFromViewSR as u}from"../geometry/support/coordinateSystem.js";import{loadVoxelWASM as _}from"../libs/vxl/VxlModule.js";import{InternalRenderCategory as c}from"../views/3d/webgl.js";import{VoxelGraphic as m}from"../views/3d/layers/VoxelGraphic.js";import{VoxelTarget as f}from"../views/3d/layers/i3s/Intersector.js";import{Frustum as p}from"../views/3d/state/Frustum.js";import{RenderCoordsHelper as g}from"../views/3d/support/RenderCoordsHelper.js";import y from"../views/3d/webgl/RenderNode.js";import{IntersectorResult as x}from"../views/3d/webgl-engine/lib/IntersectorResult.js";let v=class extends y{constructor(e){super(e),this._havePreparedWithAllLayers=!1,this.produces="disabled",this.consumes={required:[c.VOXEL]},this._vxlPromise=null,this._moreToLoad=!1,this._viewportWidth=-1,this._viewportHeight=-1,this._newLayers=[],this._layers=new Map,this._renderTargetToRestore=null,this._lastFrameWasStationary=!1,this._wasmMemBlockSizes=[512,1024,2048,4096,8192,16384,32768,65536],this._wasmMemBlocks=new Map,this._dbgFlags=new Set,this._captureFrustum=!1,this._frustum=null,this._frustumRenderableId=-1,this._renderCoordsHelper=null,this.type=9,this.slicePlaneEnabled=!0,this.isGround=!1,this.layerViewUid=[]}_dbg(e,t){this._dbgFlags.has(e)&&(4===e?s.getLogger(this).error(t):s.getLogger(this).warn(t))}initialize(){this._dbg(1,"--initialize--");for(const e of this._wasmMemBlockSizes)this._wasmMemBlocks.set(e,0);this.addHandles([i(()=>"local"===this.view.viewingMode,e=>{e?(this._dbg(1,"view switched to local view, enabling rendering"),this.produces=c.VOXEL,this.view.sceneIntersectionHelper.addIntersectionHandler(this)):(this._dbg(1,"view switched to global view, disabling rendering"),this.view.sceneIntersectionHelper.removeIntersectionHandler(this),this.produces="disabled")},a),i(()=>this.view?.qualityProfile,e=>{this._dbg(3,"qualityProfile changed to "+e),this._vxl?.set_quality(this._toWasmQuality(e))},a),i(()=>this.view?.timeExtent,()=>{if(this._vxl){const e=this._getTimeArgs(this.view?.timeExtent);this._dbg(3,"sceneView timeExtent changed to useTime="+e.hasTime+" st="+e.startTime+" et="+e.endTime),this._vxl.set_scene_time_extent(e.startTime,e.endTime,e.hasTime),this.requestRender(1)}},a),i(()=>this.view?.stationary,e=>{this._vxl&&e&&!this._lastFrameWasStationary&&this.requestRender(1)})])}get _rctx(){return this.renderContext?.rctx}get _halfIntTexturesAvailable(){return!!this._rctx?.capabilities.textureNorm16}get _textureFloatLinearAvailable(){return!!this._rctx?.capabilities.textureFloatLinear}_restoreFramebuffer(){if(!this._renderTargetToRestore||!this._rctx)return;const e=this._renderTargetToRestore.fbo;if(!!!this._rctx)return void this._dbg(4,"no context in restoreFramebuffer!");this._rctx.bindFramebuffer(e,!0);const t=this._renderTargetToRestore.viewport;this._rctx.setViewport(t.x,t.y,t.width,t.height)}_bindPreviousDepthToSlot(e,t){if(!this._rctx||!this._renderTargetToRestore)return 0;const s=this._renderTargetToRestore.fbo?.depthStencilTexture;return s?(0===t?this._rctx.bindTexture(null,e,!0):this._rctx.bindTexture(s,e,!0),1):(this._dbg(4,"no depth/stencil texture exists!"),0)}_modifyResourceCount(e,t,s){if(!this._rctx)return void this._dbg(4,"modifyAllocation callback has no rendering context!");const r=e;1===s?this._rctx.instanceCounter.increment(r,t):this._rctx.instanceCounter.decrement(r,t)}_setBlendState(e,t,s,r){this._rctx?(this._rctx.setBlendingEnabled(1===e),this._rctx.setBlendFunction(t,s),this._rctx.setBlendEquation(r)):this._dbg(4,"setBlendState callback has no rendering context!")}_setFrontFace(e){this._rctx?this._rctx.setFrontFace(e):this._dbg(4,"setFrontFace callback has no rendering context!")}_setDepthStencilStateFunction(e,t,s){this._rctx?(this._rctx.setDepthFunction(s),this._rctx.setDepthTestEnabled(1===e),this._rctx.setDepthWriteEnabled(1===t),this._rctx.setStencilTestEnabled(!1),this._rctx.setStencilFunction(519,0,255),this._rctx.setStencilOpSeparate(1028,7680,7682,7680),this._rctx.setStencilOpSeparate(1029,7680,7683,7680)):this._dbg(4,"setDepthStencilStateFunction callback has no rendering context!")}_setRasterizerState(e){if(this._rctx)switch(e){case 1:this._rctx.setFaceCullingEnabled(!1);break;case 3:this._rctx.setCullFace(1029),this._rctx.setFaceCullingEnabled(!0);break;case 2:this._rctx.setCullFace(1028),this._rctx.setFaceCullingEnabled(!0)}else this._dbg(4,"setRasterizerState callback has no rendering context!")}_setViewport(e,t,s,r){this._rctx?this._rctx.setViewport(e,t,s,r):this._dbg(4,"setViewport callback has no rendering context!")}_updateMemoryUsage(){this._layers.forEach((e,t)=>{if(e.needMemoryUsageUpdate){const s=this._vxl?.estimate_memory_usage(t)??0;s>=0&&(e.needMemoryUsageUpdate=!1,e.layerView.setUsedMemory(s))}})}_syncRequestsResponses(){this._vxl&&this._layers.forEach((e,s)=>{const i=[];e.responses.forEach((t,r)=>{i.push(r),this._dbg(2,"responding for requestID:"+r+" size:"+t.size),this._vxl?.respond(s,r,t),0!==t.requestType&&4!==t.requestType||(e.needMemoryUsageUpdate=!0)});const a=e.responses;for(const t of i)a.delete(t);const n=this._vxl.get_new_requests(s),o=e.abortController.signal;for(const l in n){e.outstandingRequestCount+=1,1===e.outstandingRequestCount&&e.layerView.updatingFlagChanged();const s=n[l],i={responseType:"array-buffer",signal:o,query:{...e.layerView.layer.customParameters,token:e.layerView.layer.apiKey}};this._dbg(2,"making requestID:"+l+" url:"+s.url),t(s.url,i).then(t=>{e.outstandingRequestCount-=1,0===e.outstandingRequestCount&&e.layerView.updatingFlagChanged(),this._dbg(2,"have response for requestID:"+l);let r=0;if(t.data.byteLength>0&&this._vxl){r=this._vxl._malloc(t.data.byteLength);const e=new Uint8Array(this._vxl.HEAPU8.buffer,r,t.data.byteLength),s=new Uint8Array(t.data);for(let r=0;r<t.data.byteLength;++r)e[r]=s[r]}a.set(+l,{responseType:s.responseType,ptr:r,size:t.data.byteLength,success:!0,requestType:s.requestType})}).catch(t=>{e.outstandingRequestCount-=1,0===e.outstandingRequestCount&&e.layerView.updatingFlagChanged(),r(t)||(this._dbg(4,`requestID:${l} failed, error=${t.toString()}`),a.set(+l,{responseType:s.responseType,ptr:0,size:0,success:!1,requestType:s.requestType}))})}})}updateWasmCamera(e){this._vxl?.set_projection_matrix.apply(this._vxl,e.projectionMatrix),this._vxl?.set_view_matrix.apply(this._vxl,e.viewMatrix),this._vxl?.set_near_far(e.near,e.far)}isUpdating(e){if(!this._vxl&&this._vxlPromise)return!0;const t=this._layers.get(e);return!!t&&t.outstandingRequestCount>0}getLayerTimes(e){const t=[];return this._vxl?(this._layers.forEach((s,r)=>{if(s.layerView.wasmLayerId===e.wasmLayerId){const s=this._vxl.get_layer_epoch_times(r,e.layer.currentVariableId);for(let e=0;e<s.length;++e)t.push(s[e])}}),t):t}getCurrentLayerTimeIndex(e){let t=0;return this._layers.forEach((s,r)=>{s.layerView.wasmLayerId===e.wasmLayerId&&(t=this._vxl?.get_layer_current_time_id(r)??0)}),t}setEnabled(e,t){this._layers.forEach((s,r)=>{s.layerView.wasmLayerId===e.wasmLayerId&&(this._vxl?.set_enabled(r,t),s.needMemoryUsageUpdate=!0,this.requestRender(1))})}setIsInScaleRange(e,t){const s=this._layers.get(e.wasmLayerId);s&&t!==s.isInScaleRange&&(s.isInScaleRange=t,this._vxl?.set_is_in_scale_range(e.wasmLayerId,t),s.needMemoryUsageUpdate=!t,this.requestRender(1))}setStaticSections(e,t){const s={mask:1,staticSections:t};return this._doMaskedUIUpdate(e,s,!0)}setCurrentVariable(e,t){const s={mask:1024,currentVariable:t};return this._doMaskedUIUpdate(e,s,!0)}setRenderMode(e,t){const s={mask:8192,renderMode:t};return this._doMaskedUIUpdate(e,s,!0)}setVerticalExaggerationAndOffset(e,t,s,r){const i={mask:256,volStyleDesc:{volumeId:t,verticalExaggeration:s,verticalOffset:r}};return this._doMaskedUIUpdate(e,i,!0)}setVariableStyles(e,t){const s={mask:32768,variableStyles:t};return this._doMaskedUIUpdate(e,s,!0)}setVolumeStyles(e,t){const s={mask:65536,volumeStyles:t};return this._doMaskedUIUpdate(e,s,!0)}setEnableDynamicSections(e,t){const s={mask:4096,containerIsVisible:t,container:1};return this._doMaskedUIUpdate(e,s,!0)}setEnableIsosurfaces(e,t){const s={mask:4096,containerIsVisible:t,container:0};return this._doMaskedUIUpdate(e,s,!0)}setEnableSections(e,t){const s={mask:4096,containerIsVisible:t,container:2};return this._doMaskedUIUpdate(e,s,!0)}setAnalysisSlice(e,t,s,r){const i={mask:131072,analysisSlice:{point:s,normal:r,enabled:t}};return this._doMaskedUIUpdate(e,i,!0)}updateLayerTimeProperties(e){if(!this._vxl)return;const t=this._layers.get(e.wasmLayerId);if(t){const s=t.layerView.layer;let r=0;s.timeOffset&&(r=n(s.timeOffset.value,s.timeOffset.unit,"seconds"));const i=this._getTimeArgs(s.timeExtent);this._vxl?.set_layer_time_properties(e.wasmLayerId,i.startTime,i.endTime,i.hasTime,s.useViewTime,r),this.requestRender(1)}}_doMaskedUIUpdate(e,t,s){if(!this._vxl)return!1;let r=!1;return this._layers.forEach((s,i)=>{if(s.layerView.wasmLayerId===e.wasmLayerId){const e={str:JSON.stringify(t),byteCount:0,ptr:0,isReusable:!1};this._allocateBlock(e)&&(r=1===this._vxl?.handle_masked_ui_update(i,e.ptr,e.byteCount),e.isReusable||this._vxl?._free(e.ptr))}}),r&&s&&this.requestRender(1),r}_addTriangleToWasmBuffer(e,t,s,r,i){return e[3*t]=s[0],e[3*t+1]=s[1],e[3*t+2]=s[2],e[3*(t+=1)]=r[0],e[3*t+1]=r[1],e[3*t+2]=r[2],e[3*(t+=1)]=i[0],e[3*t+1]=i[1],e[3*t+2]=i[2],t+=1}_addNormalToWasmBuffer(e,t,s){return e[3*t]=s[0],e[3*t+1]=s[1],e[3*t+2]=s[2],t+=1}_doCaptureFrustum(){if(!this._vxl)return;const e=36,t=e/3,s=this._vxl._malloc(3*e*Float32Array.BYTES_PER_ELEMENT),r=new Float32Array(this._vxl.HEAPF32.buffer,s,3*e),i=this._vxl._malloc(3*t*Float32Array.BYTES_PER_ELEMENT),a=new Float32Array(this._vxl.HEAPF32.buffer,i,e),n=this._frustum.points[0],o=this._frustum.points[1],l=this._frustum.points[2],h=this._frustum.points[3],d=this._frustum.points[4],u=this._frustum.points[5],_=this._frustum.points[6],c=this._frustum.points[7];let m=0,f=0;const p=this._frustum.planes[4];m=this._addTriangleToWasmBuffer(r,m,l,o,n),f=this._addNormalToWasmBuffer(a,f,p),m=this._addTriangleToWasmBuffer(r,m,n,h,l),f=this._addNormalToWasmBuffer(a,f,p);const g=this._frustum.planes[5];m=this._addTriangleToWasmBuffer(r,m,d,u,_),f=this._addNormalToWasmBuffer(a,f,g),m=this._addTriangleToWasmBuffer(r,m,_,c,d),f=this._addNormalToWasmBuffer(a,f,g);const y=this._frustum.planes[3];m=this._addTriangleToWasmBuffer(r,m,_,l,h),f=this._addNormalToWasmBuffer(a,f,y),m=this._addTriangleToWasmBuffer(r,m,h,c,_),f=this._addNormalToWasmBuffer(a,f,y);const x=this._frustum.planes[2];m=this._addTriangleToWasmBuffer(r,m,n,o,u),f=this._addNormalToWasmBuffer(a,f,x),m=this._addTriangleToWasmBuffer(r,m,u,d,n),f=this._addNormalToWasmBuffer(a,f,x);const v=this._frustum.planes[0];m=this._addTriangleToWasmBuffer(r,m,h,n,d),f=this._addNormalToWasmBuffer(a,f,v),m=this._addTriangleToWasmBuffer(r,m,d,c,h),f=this._addNormalToWasmBuffer(a,f,v);const b=this._frustum.planes[1];m=this._addTriangleToWasmBuffer(r,m,l,_,u),f=this._addNormalToWasmBuffer(a,f,b),this._addTriangleToWasmBuffer(r,m,u,o,l),this._addNormalToWasmBuffer(a,f,b),-1!==this._frustumRenderableId&&this._vxl.remove_generic_mesh(this._frustumRenderableId),this._frustumRenderableId=this._vxl.add_generic_mesh(s,3*e,i,e,255,0,0,64),this._vxl._free(s),this._vxl._free(i),this._captureFrustum=!1,this.requestRender(1)}captureFrustum(){null===this._renderCoordsHelper&&(this._renderCoordsHelper=g.create(2,u(!1,this.view.spatialReference))),null===this._frustum&&(this._frustum=new p(this._renderCoordsHelper)),this._captureFrustum=!0,this.requestRender(1)}toggleFullVolumeExtentDraw(e){this._vxl&&this._layers.forEach((t,s)=>{t.layerView.wasmLayerId===e.wasmLayerId&&(this._vxl?.toggle_full_volume_extent_draw(s),this.requestRender(1))})}dropQueryRenderTarget(){this._vxl?.drop_query_rt()}addVoxelLayer(e){if(!this._vxl){const t={layerView:e,resolveCallback:null,rejectCallback:null},s=new Promise((e,s)=>{t.resolveCallback=e,t.rejectCallback=s});return this._newLayers.push(t),s}const t=this._addVoxelLayer(e,this._vxl);return t<0?Promise.reject(-1):Promise.resolve(t)}removeVoxelLayer(e){if(!this._vxl){const t=this._newLayers.findIndex(t=>e.uid===t.layerView.uid);t>=0&&(this._newLayers[t].resolveCallback(-1),this._newLayers.splice(t,1));const s=this._newLayers.length;return 0===s&&(this._dbg(1,"No voxel layers left after removing a layer, destroying render node"),this.destroy()),s}let t=-1;this._layers.forEach((s,r)=>{if(s.layerView.wasmLayerId===e.wasmLayerId){t=r,s.abortController.abort(),this._vxl?.remove_layer(t);const i=this.layerViewUid.indexOf(e.uid);-1!==i&&this.layerViewUid.splice(i,1)}}),t>=0&&this._layers.delete(t);const s=this._layers.size;return 0===s&&(this._dbg(1,"No voxel layers left after removing a layer, destroying render node"),this.destroy()),s}_getBlockSize(e){for(const t of this._wasmMemBlockSizes)if(e<t)return t;return-1}_allocateBlock(e){if(!this._vxl)return!1;e.byteCount=this._vxl.lengthBytesUTF8(e.str)+1;const t=this._getBlockSize(e.byteCount);return t<0?(e.isReusable=!1,e.ptr=this._vxl._malloc(e.byteCount)):(e.isReusable=!0,e.ptr=this._wasmMemBlocks.get(t),0===e.ptr&&(e.ptr=this._vxl._malloc(t),this._wasmMemBlocks.set(t,e.ptr))),0!==e.ptr&&(this._vxl.stringToUTF8(e.str,e.ptr,e.byteCount),!0)}_getTimeArgs(e){let t=-Number.MAX_VALUE,s=Number.MAX_VALUE,r=!1;return null!=e&&(e.isAllTime?r=!0:(null!=e.start&&(r=!0,t=e.start.getTime()/1e3),null!=e.end&&(r=!0,s=e.end.getTime()/1e3))),{startTime:t,endTime:s,hasTime:r}}_addVoxelLayer(e,t){const r=e.layer;let i=-1;const a=r.getConfiguration();if(a.length<1)return-1;const o={str:a,byteCount:0,ptr:0,isReusable:!1};if(!this._allocateBlock(o))return-1;const l=this._getTimeArgs(r.timeExtent),h=this.view.spatialReference.isWGS84&&r.spatialReference.isWGS84?111319.49079327357:1;let d=0;if(r.timeOffset&&(d=n(r.timeOffset.value,r.timeOffset.unit,"seconds")),i=t.add_layer(r.serviceRoot,o.ptr,o.byteCount,h,h,l.startTime,l.endTime,l.hasTime,r.useViewTime,d,this._toWasmQuality(this.view.qualityProfile)),o.isReusable||t._free(o.ptr),i>=0){r.test?.constantUpscaling&&(this._setUpscalingLimits(0,.25,.25),this._setUpscalingLimits(1,.5,.5),this._setUpscalingLimits(2,.75,.75));const t=new AbortController;if(this._layers.set(i,{layerView:e,responses:new Map,outstandingRequestCount:0,abortController:t,needMemoryUsageUpdate:!1,isInScaleRange:!0}),this.layerViewUid.push(e.uid),!this._halfIntTexturesAvailable||has("mac")){const t=[];let r="";for(const s of e.layer.variables)"Int16"!==s.renderingFormat.type&&"UInt16"!==s.renderingFormat.type||(t.push(s.name),s.id===e.layer.currentVariableId&&(r=s.name));""!==r&&s.getLogger(this).error("#addVoxelLayer_error()",e.layer,`The voxel layer '${e.layer.title}' cannot render the current variable '${r}' in this browser`),t.length>0&&s.getLogger(this).warn("#addVoxelLayer_warning()",e.layer,`The voxel layer '${e.layer.title}' cannot render the variables '${t.toString()}' in this browser`)}if(!this._textureFloatLinearAvailable){const t=[];let r="";for(const s of e.layer.variables)"Float32"===s.renderingFormat.type&&(t.push(s.name),s.id===e.layer.currentVariableId&&(r=s.name));""!==r&&s.getLogger(this).error("#addVoxelLayer_error()",e.layer,`The voxel layer '${e.layer.title}' cannot render the current variable '${r}' in this browser`),t.length>0&&s.getLogger(this).warn("#addVoxelLayer_warning()",e.layer,`The voxel layer '${e.layer.title}' cannot render the variables '${t.toString()}' in this browser`)}return has("esri-mobile")&&s.getLogger(this).warnOnce("Mobile support differs across devices. Voxel layer might not display as expected."),i}return-1}_prepareRender(){if(!this._vxl)return void this._initializeWasm();const e=this.bindParameters.camera.viewForward,t=this.bindParameters.camera.eye;this._vxl.update_camera_pos_and_direction(t[0],t[1],t[2],e[0],e[1],e[2]);const s=this._vxl.cull();this._dbg(2,"missingResourceCount="+s),this._moreToLoad=s>0,this._havePreparedWithAllLayers=0===this._newLayers.length,this._updateMemoryUsage()}render(){this._prepareRender();const e=this.bindRenderTarget();if(!this._vxl||!this._rctx)return this.requestRender(1),e;for(const s of this._newLayers){const e=this._addVoxelLayer(s.layerView,this._vxl);-1===e?s.rejectCallback(-1):s.resolveCallback(e)}if(this._newLayers=[],0===this._layers.size)return this._dbg(4,"No voxel layers but RenderNode is being asked to render!"),e;this._lastFrameWasStationary=this.view.stationary,this._syncRequestsResponses(),this._beforeDraw(this._rctx),this._vxl.begin_color_frame(!this.view.stage.renderer.isFeatureEnabled(1),this.bindParameters.lighting.mainLight.direction[0],this.bindParameters.lighting.mainLight.direction[1],this.bindParameters.lighting.mainLight.direction[2]);const t=this._renderTargetToRestore.viewport;return t.width===this._viewportWidth&&t.height===this._viewportHeight||(this._viewportWidth=t.width,this._viewportHeight=t.height,this._vxl.set_viewport(t.width,t.height),this._layers.forEach(e=>e.needMemoryUsageUpdate=!0)),0===t.x&&0===t.y||this._dbg(4,"Unsupported viewport parameters detected!"),this.updateWasmCamera(this.bindParameters.camera),this._captureFrustum&&(this._frustum.update(this.bindParameters.camera),this._doCaptureFrustum()),this._vxl.draw(),this._afterDraw(this._rctx,this._vxl),(this._moreToLoad||!this._havePreparedWithAllLayers&&this._layers.size>0)&&this.requestRender(1),e}destroy(){this._dbg(1,"--destroy--"),this._vxl&&(this._layers.forEach(e=>{e.abortController.abort()}),this._wasmMemBlocks.forEach(e=>{0!==e&&this._vxl?._free(e)}),this._vxl.uninitialize_voxel_wasm(),this._vxl=null)}_initializeWasm(){if(this._vxl||this._vxlPromise||!this._rctx?.gl)return;const e=this._rctx.gl;this._vxlPromise=_(e).then(t=>{if(t.specialHTMLTargets.jsAPI3DRenderingContext=e,this._vxl=t,this._vxlPromise=null,this._newLayers.length<=0)return this._dbg(1," no voxel layers left after WASM downloaded, removing RenderNode and destroying"),void this.destroy();const s=this._getTimeArgs(this.view?.timeExtent),r=this._vxl.addFunction(this._restoreFramebuffer.bind(this),"v"),i=this._vxl.addFunction(this._setBlendState.bind(this),"viiii"),a=this._vxl.addFunction(this._setFrontFace.bind(this),"vi"),n=this._vxl.addFunction(this._setRasterizerState.bind(this),"vi"),o=this._vxl.addFunction(this._setDepthStencilStateFunction.bind(this),"viii"),l=this._vxl.addFunction(this._setViewport.bind(this),"viiii"),h=this._vxl.addFunction(this._bindPreviousDepthToSlot.bind(this),"iii"),d=this._vxl.addFunction(this._modifyResourceCount.bind(this),"viii"),u=this._halfIntTexturesAvailable&&!has("mac"),_=this._textureFloatLinearAvailable;this._vxl.initialize_voxel_wasm(r,i,a,n,o,l,h,d,s.startTime,s.endTime,s.hasTime,u,_),this.requestRender(1)}).catch(()=>{for(const e of this._newLayers)e.rejectCallback(-2);this._dbg(4," WASM failed to download, destroying render node"),this.destroy()})}pickDepth(e,t,s){if(!this._vxl||!this._rctx||0===this._layers.size)return null;const r=s.viewport[3]-t;if(e<0||e>s.viewport[2]||t<0||t>s.viewport[3])return this._dbg(4,`[js] pickDepth: outOfRange, screenXY=[${e.toFixed(0)}, ${r.toFixed(0)}]]`),null;this._beforeDraw(this._rctx);const i=s.viewForward,a=s.eye;this._vxl.update_camera_pos_and_direction(a[0],a[1],a[2],i[0],i[1],i[2]),this.updateWasmCamera(s),this._vxl.begin_frame();const n=this._vxl.pick_depth(e,r);if(this._afterDraw(this._rctx,this._vxl),n.success){return n.distanceToCamera}return null}pickObject(e,t,s,r){if(!this._vxl||!this._rctx||0===this._layers.size)return null;const i=Math.round(e),a=Math.round(t);if(i<0||i>s.viewport[2]||a<0||a>s.viewport[3])return this._dbg(4,`[js] pickObject: outOfRange, screenXY=[${i}, ${a}], vp=[${s.viewport.toString()}]`),null;this._beforeDraw(this._rctx);const n=s.viewForward,o=s.eye;this._vxl.update_camera_pos_and_direction(o[0],o[1],o[2],n[0],n[1],n[2]),this.updateWasmCamera(s),this._vxl.begin_frame();let l=null;if(0===r.length)l=this._vxl.pick_object(i,a,0,0);else{const e={str:JSON.stringify({layerIds:r}),byteCount:0,ptr:0,isReusable:!1};this._allocateBlock(e)&&(l=this._vxl.pick_object(i,a,e.ptr,e.byteCount),e.isReusable||this._vxl._free(e.ptr))}return this._afterDraw(this._rctx,this._vxl),l}async getOtherFieldPopupValues(e,s){if(!this._vxl)return[];for(const r of e){const e=r.gpuResult;if(!e)continue;const i=this._layers.get(e.layerId);if(!i||!i.layerView.layer.url)continue;const a=i.layerView.layer,n={responseType:"array-buffer",signal:i.abortController.signal,query:{...i.layerView.layer.customParameters,token:i.layerView.layer.apiKey}},o=e.voxelSpacePosition,l=[Math.floor(o[0]/32),Math.floor(o[1]/32),Math.floor(o[2]/32)],h=[-4&l[0],-4&l[1],-4&l[2]];let d=0;if(e.epochTime){const t=this._vxl.get_layer_epoch_times(i.layerView.wasmLayerId,a.currentVariableId);for(let s=0;s<t.length;++s)if(t[s]===e.epochTime/1e3){d=s;break}}const u=[],_={varIds:[],ptrs:[],sizes:[]};for(const r of s){const e=a.variables.findIndex(e=>e.name===r);if(-1===e)continue;const s=a.variables.getItemAt(e)?.id;if(null==s)continue;const i=`${a.url}/variables/${s}/${d}/bundles/0/${h[0]}-${h[1]}-${h[2]}`;u.push(t(i,n).then(e=>e.data)),_.varIds.push(s)}const c=await Promise.allSettled(u),m=c.length;for(let t=0;t<m;++t){const e=c[t];if("fulfilled"===e.status){const t=e.value,s=this._vxl._malloc(t.byteLength);new Uint8Array(this._vxl.HEAPU8.buffer,s,t.byteLength).set(new Uint8Array(t)),_.ptrs.push(s),_.sizes.push(t.byteLength)}else _.varIds.splice(t,1)}const f=this._vxl.get_other_field_popup_values(e,_);for(let t=0;t<_.ptrs.length;++t)this._vxl._free(_.ptrs[t]);if(f.continuousValues)for(const t in f.continuousValues)r.attributes[t]=f.continuousValues[t];if(f.uniqueValues)for(const t in f.uniqueValues)r.attributes[t]=f.uniqueValues[t]}return e}_beforeDraw(e){this._renderTargetToRestore={fbo:e.boundFramebuffer,viewport:e.getViewport()},e.setPolygonOffsetFillEnabled(!1),e.setScissorTestEnabled(!1),e.setColorMask(!0,!0,!0,!0)}_afterDraw(e,t){this._renderTargetToRestore.fbo=null,e.externalTextureUnitUpdate(t.get_texture_units_bound_in_frame(),t.get_active_texture_unit()),e.externalVertexArrayObjectUpdate(),e.externalVertexBufferUpdate(),e.externalProgramUpdate()}intersect(e,t,s,r,i){if(!this._vxl||!this._rctx||0===this._layers.size||!e.options.selectionMode||e.options.isFiltered||!e.camera)return;if(null==i||i[0]<0||i[0]>e.camera.viewport[2]||i[1]<0||i[1]>e.camera.viewport[3])return this._dbg(4,i?`[js] VoxelWasmPerScene.intersect: outOfRange, screenXY=[${i[0].toFixed(0)}, ${i[1].toFixed(0)}]`:"[js] VoxelWasmPerScene.intersect: outOfRange, screenXY=null"),null;const a=[];this._layers.forEach(t=>{e.options.filteredLayerViewUids.includes(t.layerView.uid)&&a.push(t.layerView.wasmLayerId)});const n=this.pickObject(i[0],i[1],e.camera,a);if(null==n||-1===n.layerId)return;const o=this._layers.get(n.layerId);if(o){const t=o.layerView.layer.uid,i=n.distanceToCamera/h(s,r),a=d();a[0]=n.worldX,a[1]=n.worldY,a[2]=n.worldZ;const l={},u=o.layerView.layer,_=u.variables.findIndex(e=>e.id===u.currentVariableId);if(_>=0){const e=u.variables.getItemAt(_);null!=e&&(null!=n.continuousValue?l[e.name]=n.continuousValue:null!=n.uniqueValueLabel&&null!=n.uniqueValue?l[e.name]=`${n.uniqueValueLabel} (${n.uniqueValue})`:null!=n.uniqueValue&&(l[e.name]=`${n.uniqueValue}`),e.description.length>0?l["Voxel.CurrentVariable"]=e.description:e.name?.length>0&&(l["Voxel.CurrentVariable"]=e.name))}if(l["Voxel.Position"]=`[${n.voxelSpacePosition.toString()}]`,null!=n.epochTime&&null!=n.nativeTime&&null!=n.nativeTimeUnits){const e=new Date(n.epochTime);l["Voxel.LocalTime"]=e,l["Voxel.SourceTime"]=`${n.nativeTime.toLocaleString()} ${n.nativeTimeUnits}`}null!=n.depth&&(l["Voxel.Depth"]=n.depth);const c=n.faceNormal;l["Voxel.WorldPosition"]=`[${a[0]}, ${a[1]}, ${a[2]}]`;const m=e=>{const s=new f(a,t,()=>this._createVoxelGraphic(o.layerView.layer,l,n));e.set(this.type,s,i,c)},p=e.results,g=2===e.options.store;if((null==p.min.distance||i<p.min.distance)&&m(p.min),(null==p.max.distance||i>p.max.distance)&&m(p.max),g){const t=new x(e.ray);m(t),e.results.all.push(t)}}}_createVoxelGraphic(e,t,s){return new m({layer:e,sourceLayer:e,origin:e.graphicOrigin,attributes:t,gpuResult:s})}_toWasmQuality(e){switch(e){case"low":return 0;case"medium":return 1;case"high":return 2}}_setUpscalingLimits(e,t,s){this._vxl&&this._vxl.set_upscaling_limits(e,t,s)}};e([o()],v.prototype,"produces",void 0),e([o()],v.prototype,"consumes",void 0),v=e([l("esri.layers.VoxelWasmPerSceneView")],v);const b=v;export{b as default};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{estimateAttributesMemory as t}from"../../core/memoryEstimations.js";import{convertFlatToOptimizedGeometry as e,convertOptimizedGeometryToFlat as r}from"../../geometry/FlatGeometry.js";import{getCentroidOptimizedGeometry as i}from"./centroid.js";class s{constructor(t=null,e={},r,i,s=0){this.geometry=t,this.attributes=e,this.centroid=r,this.objectId=i,this.displayId=s}weakClone(){return new s(this.geometry,this.attributes,this.centroid,this.objectId,this.displayId)}clone(){return new s(this.geometry?.clone(),{...this.attributes},this.centroid?.clone(),this.objectId,this.displayId)}get usedMemory(){return 128+t(this.attributes)+(this.geometry?.usedMemory??0)}ensureCentroid(t){return this.centroid??=i(this.geometry&&e(this.geometry)),this.centroid}}function o(t,{geometry:e,attributes:i,centroid:o,objectId:n,displayId:d},h){return new s(e&&r(t,e,h),i,o,n,d)}export{s as FlatFeature,o as convertOptimizedFeatureToFlat};
2
+ import{estimateAttributesMemory as t}from"../../core/memoryEstimations.js";import{convertFlatToOptimizedGeometry as e,convertOptimizedGeometryToFlat as i}from"../../geometry/FlatGeometry.js";import{getCentroidOptimizedGeometry as s}from"./centroid.js";class r{constructor(t=null,e={},i,s,r=0,o=null){this.geometry=t,this.attributes=e,this.centroid=i,this.objectId=s,this.displayId=r,this.distance=o}weakClone(){return new r(this.geometry,this.attributes,this.centroid,this.objectId,this.displayId,this.distance)}clone(){return new r(this.geometry?.clone(),{...this.attributes},this.centroid?.clone(),this.objectId,this.displayId,this.distance)}get usedMemory(){return 128+t(this.attributes)+(this.geometry?.usedMemory??0)}ensureCentroid(t){return this.centroid??=s(this.geometry&&e(this.geometry)),this.centroid}}function o(t,{geometry:e,attributes:s,centroid:o,objectId:n,displayId:d,distance:h},c){return new r(e&&i(t,e,c),s,o,n,d,h)}export{r as FlatFeature,o as convertOptimizedFeatureToFlat};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{convertGeometryToFlat as e,convertOptimizedGeometryToFlat as t}from"../../geometry/FlatGeometry.js";import{featureGeometryTypeKebabDictionary as r}from"../../geometry/support/typeUtils.js";import{FlatFeature as s,convertOptimizedFeatureToFlat as i}from"./FlatFeature.js";import a from"./OptimizedGeometry.js";import{createFeatureId as o}from"./data/createFeatureId.js";class l{constructor(){this.globalIdFieldName=null,this.geohashFieldName=null,this.geometryProperties=null,this.geometryType=null,this.spatialReference=null,this.hasZ=!1,this.hasM=!1,this.features=[],this.fields=[],this.transform=null,this.exceededTransferLimit=!1,this.uniqueIdField=null,this.queryGeometryType=null,this.queryGeometry=null}weakClone(){const e=new l;return e.globalIdFieldName=this.globalIdFieldName,e.geohashFieldName=this.geohashFieldName,e.geometryProperties=this.geometryProperties,e.geometryType=this.geometryType,e.spatialReference=this.spatialReference,e.hasZ=this.hasZ,e.hasM=this.hasM,e.features=this.features,e.fields=this.fields,e.transform=this.transform,e.exceededTransferLimit=this.exceededTransferLimit,e.uniqueIdField=this.uniqueIdField,e.queryGeometry=this.queryGeometry,e.queryGeometryType=this.queryGeometryType,e}}function m(e){const s=r.fromJSON(e.geometryType),a=new l;return a.globalIdFieldName=e.globalIdFieldName,a.geohashFieldName=e.geohashFieldName,a.geometryProperties=e.geometryProperties,a.geometryType=e.geometryType,a.spatialReference=e.spatialReference,a.hasZ=e.hasZ,a.hasM=e.hasM,a.features=e.features.map(t=>i(s,t,e.spatialReference)),a.fields=e.fields,a.transform=e.transform,a.exceededTransferLimit=e.exceededTransferLimit,a.uniqueIdField=e.uniqueIdField,a.queryGeometry=e.queryGeometry&&t(s,e.queryGeometry),a.queryGeometryType=e.queryGeometryType,a}function n({exceededTransferLimit:t,features:r,fields:i,geometryType:m,hasM:n,hasZ:y,spatialReference:d,transform:h},u){const f=new l;f.exceededTransferLimit=t??!1;for(const l of r??[]){let t,r;m&&(t=l.geometry&&e(l.geometry),r=l.centroid&&new a([],[l.centroid.x,l.centroid.y]));const i=o(l,u);f.features.push(new s(t,l.attributes,r,i))}return f.fields=i??f.fields,f.geometryType=m??null,f.hasM=n??!1,f.hasZ=y??!1,f.spatialReference=d??null,f.transform=h??null,f}export{l as FlatFeatureSet,n as convertFeatureSetToFlat,m as convertOptimizedFeatureSetToFlat};
2
+ import{convertGeometryToFlat as e,convertOptimizedGeometryToFlat as t}from"../../geometry/FlatGeometry.js";import{featureGeometryTypeKebabDictionary as r}from"../../geometry/support/typeUtils.js";import{FlatFeature as s,convertOptimizedFeatureToFlat as i}from"./FlatFeature.js";import a from"./OptimizedGeometry.js";import{createFeatureId as o}from"./data/createFeatureId.js";class l{constructor(){this.globalIdFieldName=null,this.geohashFieldName=null,this.geometryProperties=null,this.geometryType=null,this.spatialReference=null,this.hasZ=!1,this.hasM=!1,this.features=[],this.fields=[],this.transform=null,this.exceededTransferLimit=!1,this.uniqueIdField=null,this.queryGeometryType=null,this.queryGeometry=null}weakClone(){const e=new l;return e.globalIdFieldName=this.globalIdFieldName,e.geohashFieldName=this.geohashFieldName,e.geometryProperties=this.geometryProperties,e.geometryType=this.geometryType,e.spatialReference=this.spatialReference,e.hasZ=this.hasZ,e.hasM=this.hasM,e.features=this.features,e.fields=this.fields,e.transform=this.transform,e.exceededTransferLimit=this.exceededTransferLimit,e.uniqueIdField=this.uniqueIdField,e.queryGeometry=this.queryGeometry,e.queryGeometryType=this.queryGeometryType,e}}function m(e){const s=r.fromJSON(e.geometryType),a=new l;return a.globalIdFieldName=e.globalIdFieldName,a.geohashFieldName=e.geohashFieldName,a.geometryProperties=e.geometryProperties,a.geometryType=e.geometryType,a.spatialReference=e.spatialReference,a.hasZ=e.hasZ,a.hasM=e.hasM,a.features=e.features.map(t=>i(s,t,e.spatialReference)),a.fields=e.fields,a.transform=e.transform,a.exceededTransferLimit=e.exceededTransferLimit,a.uniqueIdField=e.uniqueIdField,a.queryGeometry=e.queryGeometry&&t(s,e.queryGeometry),a.queryGeometryType=e.queryGeometryType,a}function n({exceededTransferLimit:t,features:r,fields:i,geometryType:m,hasM:n,hasZ:y,spatialReference:d,transform:h},u){const f=new l;f.exceededTransferLimit=t??!1;for(const l of r??[]){let t,r;m&&(t=l.geometry&&e(l.geometry),r=l.centroid&&new a([],[l.centroid.x,l.centroid.y]));const i=o(l,u),n=void 0;f.features.push(new s(t,l.attributes,r,i,n,l.distance))}return f.fields=i??f.fields,f.geometryType=m??null,f.hasM=n??!1,f.hasZ=y??!1,f.spatialReference=d??null,f.transform=h??null,f}export{l as FlatFeatureSet,n as convertFeatureSetToFlat,m as convertOptimizedFeatureSetToFlat};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{estimateAttributesMemory as t}from"../../core/memoryEstimations.js";import{getCentroidOptimizedGeometry as e}from"./centroid.js";import r from"./OptimizedGeometry.js";class o{constructor(t=null,e={},r,o,s=0){this.geometry=t,this.attributes=e,this.centroid=r,this.objectId=o,this.displayId=s}static fromJSON(t){const e=t.geometry?r.fromJSON(t.geometry):null,s=t.centroid?r.fromJSON(t.centroid):null,i=t.objectId;return new o(e,t.attributes,s,i)}weakClone(){const t=new o(this.geometry,this.attributes,this.centroid,this.objectId);return t.displayId=this.displayId,t}clone(){const t=this.geometry?.clone(),e=new o(t,{...this.attributes},this.centroid?.clone(),this.objectId);return e.displayId=this.displayId,e}ensureCentroid(t){return this.centroid??=e(this.geometry),this.centroid}get usedMemory(){return 128+t(this.attributes)+(this.geometry?.usedMemory??0)}}function s(t){return!!t.geometry?.coords?.length}class i extends o{}export{o as OptimizedFeature,i as OptimizedFeatureWithGeometry,s as hasGeometry};
2
+ import{estimateAttributesMemory as t}from"../../core/memoryEstimations.js";import{getCentroidOptimizedGeometry as e}from"./centroid.js";import i from"./OptimizedGeometry.js";class r{constructor(t=null,e={},i,r,s=0,o=null){this.geometry=t,this.attributes=e,this.centroid=i,this.objectId=r,this.displayId=s,this.distance=o}static fromJSON(t){const e=t.geometry?i.fromJSON(t.geometry):null,s=t.centroid?i.fromJSON(t.centroid):null,o=t.objectId;return new r(e,t.attributes,s,o,void 0,t.distance)}weakClone(){return new r(this.geometry,this.attributes,this.centroid,this.objectId,this.displayId,this.distance)}clone(){return new r(this.geometry?.clone(),{...this.attributes},this.centroid?.clone(),this.objectId,this.displayId,this.distance)}ensureCentroid(t){return this.centroid??=e(this.geometry),this.centroid}get usedMemory(){return 128+t(this.attributes)+(this.geometry?.usedMemory??0)}}function s(t){return!!t.geometry?.coords?.length}class o extends r{}export{r as OptimizedFeature,o as OptimizedFeatureWithGeometry,s as hasGeometry};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{timeOnlyToMilliseconds as t}from"../../../core/timeUtils.js";import{getExpressionFromFieldName as e,getWhereClause as i,getAliasFromFieldName as s}from"./attributeSupport.js";import{getGeometry as a}from"./geometryUtils.js";import{isDateOnlyField as l,isTimestampOffsetField as r,isTimeOnlyField as n}from"../../support/fieldUtils.js";import{processNullValue as u,getNormalizedValue as o}from"../../../statistics/utils.js";import{loadArcade as d}from"../../../support/loadArcade.js";class c{constructor(t,a,l){this._fieldDataCache=new Map,this._returnDistinctMap=new Map,this.returnDistinctValues=t.returnDistinctValues??!1,this.fieldsIndex=l,this.featureAdapter=a;const r=t.outFields;if(r&&!r.includes("*")){this.outFields=r;let t=0;for(const a of r){const r=e(a),n=this.fieldsIndex.get(r),u=n?null:i(r,l),o=n?n.name:s(a)||"FIELD_EXP_"+t++;this._fieldDataCache.set(a,{alias:o,clause:u})}}}countDistinctValues(t){return this.returnDistinctValues?(t.forEach(t=>this.getAttributes(t)),this._returnDistinctMap.size):t.length}getAttributes(t){const e=this._processAttributesForOutFields(t);return this._processAttributesForDistinctValues(e)}getFieldValue(t,e,s){if(s)return this.featureAdapter.getAttribute(t,s.name);const a=e;let l=null;return this._fieldDataCache.has(a)?l=this._fieldDataCache.get(a)?.clause:s||(l=i(e,this.fieldsIndex),this._fieldDataCache.set(a,{alias:a,clause:l})),l?.calculateValue(t,this.featureAdapter)}getDataValues(e,i,s=!0){const a=i.normalizationType,d=i.normalizationTotal,c=this.fieldsIndex.get(i.field),f=l(c)||r(c),h=n(c);return e.map(e=>{let l=i.field&&this.getFieldValue(e,i.field,this.fieldsIndex.get(i.field));if(i.field2?(l=`${u(l)}${i.fieldDelimiter}${u(this.getFieldValue(e,i.field2,this.fieldsIndex.get(i.field2)))}`,i.field3&&(l=`${l}${i.fieldDelimiter}${u(this.getFieldValue(e,i.field3,this.fieldsIndex.get(i.field3)))}`)):"string"==typeof l&&s&&(f?l=l?new Date(l).getTime():null:h&&(l=l?t(l):null)),a&&Number.isFinite(l)){const t="field"===a&&i.normalizationField?this.getFieldValue(e,i.normalizationField,this.fieldsIndex.get(i.normalizationField)):null;l=o(l,a,t,d)}return l})}async getExpressionValues(t,e,i,s,l){const{arcadeUtils:r}=await d(),n=r.hasGeometryOperations(e);n&&await r.enableGeometryOperations();const u=r.createFunction(e),o=r.getViewInfo(i),c={fields:this.fieldsIndex.fields};return t.map(t=>{const e={attributes:this.featureAdapter.getAttributes(t),layer:c,geometry:n?{...a(s.geometryType,this.featureAdapter.getGeometry(t)),spatialReference:i?.spatialReference}:null},d=r.createExecContext(e,o,l);return r.executeFunction(u,d)})}validateItem(t,e){return this._fieldDataCache.has(e)||this._fieldDataCache.set(e,{alias:e,clause:i(e,this.fieldsIndex)}),this._fieldDataCache.get(e)?.clause?.testFeature(t,this.featureAdapter)??!1}validateItems(t,e){return this._fieldDataCache.has(e)||this._fieldDataCache.set(e,{alias:e,clause:i(e,this.fieldsIndex)}),this._fieldDataCache.get(e)?.clause?.testSet(t,this.featureAdapter)??!1}_processAttributesForOutFields(t){const e=this.outFields;if(!e?.length)return this.featureAdapter.getAttributes(t);const i={};for(const s of e){const{alias:e,clause:a}=this._fieldDataCache.get(s);i[e]=a?a.calculateValue(t,this.featureAdapter):this.featureAdapter.getAttribute(t,e)}return i}_processAttributesForDistinctValues(t){if(null==t||!this.returnDistinctValues)return t;const e=this.outFields,i=[];if(e)for(const l of e){const{alias:e}=this._fieldDataCache.get(l);i.push(t[e])}else for(const l in t)i.push(t[l]);const s=`${(e||["*"]).join(",")}=${i.join(",")}`;let a=this._returnDistinctMap.get(s)||0;return this._returnDistinctMap.set(s,++a),a>1?null:t}}export{c as default};
2
+ import{timeOnlyToMilliseconds as t}from"../../../core/timeUtils.js";import{getExpressionFromFieldName as e,getWhereClause as i,getAliasFromFieldName as s}from"./attributeSupport.js";import{getGeometry as a}from"./geometryUtils.js";import{isDateOnlyField as l,isTimestampOffsetField as r,isTimeOnlyField as n}from"../../support/fieldUtils.js";import{processNullValue as u,getNormalizedValue as o}from"../../../statistics/utils.js";import{loadArcade as d}from"../../../support/loadArcade.js";class c{constructor(t,a,l){this._fieldDataCache=new Map,this._returnDistinctMap=new Map,this.returnDistinctValues=t.returnDistinctValues??!1,this.fieldsIndex=l,this.featureAdapter=a;const r=t.outFields;if(r&&!r.includes("*")){this.outFields=r;let t=0;for(const a of r){const r=e(a),n=this.fieldsIndex.get(r),u=n?null:i(r,l),o=n?n.name:s(a)||"FIELD_EXP_"+t++;this._fieldDataCache.set(a,{alias:o,clause:u})}}}countDistinctValues(t){return this.returnDistinctValues?(t.forEach(t=>this.getAttributes(t)),this._returnDistinctMap.size):t.length}getAttributes(t){const e=this._processAttributesForOutFields(t);return this._processAttributesForDistinctValues(e)}getFieldValue(t,e,s){if(s)return this.featureAdapter.getAttribute(t,s.name);const a=e;let l=null;return this._fieldDataCache.has(a)?l=this._fieldDataCache.get(a)?.clause:s||(l=i(e,this.fieldsIndex),this._fieldDataCache.set(a,{alias:a,clause:l})),l?.calculateValue(t,this.featureAdapter)}getDataValues(e,i,s=!0){const a=i.normalizationType,d=i.normalizationTotal,c=this.fieldsIndex.get(i.field),f=l(c)||r(c),h=n(c);return e.map(e=>{let l=i.field&&this.getFieldValue(e,i.field,this.fieldsIndex.get(i.field));if(i.field2?(l=`${u(l)}${i.fieldDelimiter}${u(this.getFieldValue(e,i.field2,this.fieldsIndex.get(i.field2)))}`,i.field3&&(l=`${l}${i.fieldDelimiter}${u(this.getFieldValue(e,i.field3,this.fieldsIndex.get(i.field3)))}`)):"string"==typeof l&&s&&(f?l=l?new Date(l).getTime():null:h&&(l=l?t(l):null)),a&&Number.isFinite(l)){const t="field"===a&&i.normalizationField?this.getFieldValue(e,i.normalizationField,this.fieldsIndex.get(i.normalizationField)):null;l=o(l,a,t,d)}return l})}async getExpressionValues(t,e,i,s,l){const{arcadeUtils:r}=await d(),n=r.hasGeometryOperations(e);n&&await r.enableGeometryOperations();const u=r.createFunction(e),o=r.getViewInfo(i),c={fields:this.fieldsIndex.fields};return t.map(t=>{const e={attributes:this.featureAdapter.getAttributes(t),layer:c,geometry:n?{...a(s.geometryType,this.featureAdapter.getGeometry(t)),spatialReference:i.spatialReference}:null},d=r.createExecContext(e,o,l);return r.executeFunction(u,d)})}validateItem(t,e){return this._fieldDataCache.has(e)||this._fieldDataCache.set(e,{alias:e,clause:i(e,this.fieldsIndex)}),this._fieldDataCache.get(e)?.clause?.testFeature(t,this.featureAdapter)??!1}validateItems(t,e){return this._fieldDataCache.has(e)||this._fieldDataCache.set(e,{alias:e,clause:i(e,this.fieldsIndex)}),this._fieldDataCache.get(e)?.clause?.testSet(t,this.featureAdapter)??!1}_processAttributesForOutFields(t){const e=this.outFields;if(!e?.length)return this.featureAdapter.getAttributes(t);const i={};for(const s of e){const{alias:e,clause:a}=this._fieldDataCache.get(s);i[e]=a?a.calculateValue(t,this.featureAdapter):this.featureAdapter.getAttribute(t,e)}return i}_processAttributesForDistinctValues(t){if(null==t||!this.returnDistinctValues)return t;const e=this.outFields,i=[];if(e)for(const l of e){const{alias:e}=this._fieldDataCache.get(l);i.push(t[e])}else for(const l in t)i.push(t[l]);const s=`${(e||["*"]).join(",")}=${i.join(",")}`;let a=this._returnDistinctMap.get(s)||0;return this._returnDistinctMap.set(s,++a),a>1?null:t}}export{c as default};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{insertSortedStableTopN as e}from"../../../core/arrayUtils.js";import{clone as t}from"../../../core/lang.js";import{polygonCentroid as i,extentCentroid as s}from"../../../geometry/support/centroid.js";import{getPolygonExtent as a,getGeometryExtent as r}from"../../../geometry/support/extentUtils.js";import{toQuantizationTransform as n}from"../../../geometry/support/quantizationUtils.js";import{isValid as o,equals as l}from"../../../geometry/support/spatialReferenceUtils.js";import{closestPointOnCurve as u}from"../../../geometry/support/curves/closestPointOnCurve.js";import{getEndpoint as c,isCoordinate as m,cloneCurve as d}from"../../../geometry/support/curves/curveUtils.js";import p from"./AttributesBuilder.js";import{cleanFromGeometryEngine as f,getGeometry as h,transformCentroid as y}from"./geometryUtils.js";import{project as g}from"./projectionSupport.js";import{getDateInNumber as x}from"./queryUtils.js";import{SnappingCandidateEdge as F,SnappingCandidateVertex as T}from"./SnappingCandidate.js";import{isDateField as I,isDateOnlyField as _,isTimestampOffsetField as v,isStringField as V,isTimeOnlyField as S}from"../../support/fieldUtils.js";import b from"../../../rest/support/AutoIntervalBinParameters.js";import z from"../../../rest/support/DateBinParameters.js";import{unitsDict as R}from"../../../rest/support/DateBinUtils.js";import B from"../../../rest/support/FixedBoundariesBinParameters.js";import M from"../../../rest/support/FixedIntervalBinParameters.js";import{calculateStringStatistics as A,calculateStatistics as w,processSummaryStatisticsResult as N,calculateUniqueValuesCount as D,createUVResult as P,calculateClassBreaks as q,resolveCBResult as O,calculateHistogram as j,calculatePercentile as C,binIndex as G,getBinParams as Z,isNullCountSupported as E,getAttributeComparator as H}from"../../../statistics/utils.js";import{utc as U}from"../../../time/constants.js";import{DateTime as k}from"luxon";const J="bin";class Q{constructor(e,t,i){this.items=e,this.query=t,this.geometryType=i.geometryType,this.hasZ=!!t.returnZ&&i.hasZ,this.hasM=!!t.returnM&&i.hasM,this.fieldsIndex=i.fieldsIndex,this.objectIdField=i.objectIdField,this.spatialReference=i.spatialReference,this.featureAdapter=i.featureAdapter}get size(){return this.items.length}createQueryResponseForCount(){const e=new p(this.query,this.featureAdapter,this.fieldsIndex);if(!this.query.outStatistics)return e.countDistinctValues(this.items);const{groupByFieldsForStatistics:t,having:i,outStatistics:s}=this.query,a=t?.length;if(!!!a)return 1;const r=new Map,n=new Map,o=new Set;for(const l of s){const{statisticType:s}=l,a="exceedslimit"!==s?l.onStatisticField:void 0;if(!n.has(a)){const i=[];for(const s of t){const t=this._getAttributeValues(e,s,this.items,r);i.push(t)}n.set(a,this._calculateUniqueValues(i,this.items,e.returnDistinctValues))}const u=n.get(a);for(const t in u){const{data:s,items:a}=u[t],r=s.join(",");i&&!e.validateItems(a,i)||o.add(r)}}return o.size}async createQueryResponse(){let e;if(this.query.outStatistics){e=this.query.outStatistics.some(e=>"exceedslimit"===e.statisticType)?this._createExceedsLimitQueryResponse():await this._createStatisticsQueryResponse(this.query,this.items)}else e=this._createFeatureQueryResponse(this.query);if(this.query.returnQueryGeometry){const t=this.query.geometry;o(this.query.outSR)&&!l(t.spatialReference,this.query.outSR)?e.queryGeometry=f({spatialReference:this.query.outSR,...g(t,t.spatialReference,this.query.outSR)}):e.queryGeometry=f({spatialReference:this.query.outSR,...t})}return e}createSnappingResponse(e,t,i){const s=this.featureAdapter,{point:a}=e,r="number"==typeof e.distance?e.distance:e.distance.x,n="number"==typeof e.distance?e.distance:e.distance.y;function o(e,t){const i=(e-a.x)/r,s=(t-a.y)/n;return i*i+s*s}const l={candidates:[]},p="esriGeometryPolygon"===this.geometryType,f="esriGeometryPolyline"===this.geometryType||"esriGeometryPoint"===this.geometryType,h=this._getPointCreator(t,this.spatialReference,i),y=new X(null,0),g=new X(null,0),x={x:0,y:0,z:0};for(const u of this.items){const e=s.getObjectId(u),t=s.getGeometryWithCurves?.(u);if(null!=t){_(t,e);continue}const i=s.getGeometry(u);null==i||I(i,e)}return l.candidates.sort((e,t)=>e.distance-t.distance),l;function I(t,i){const{coords:s,stride:r}=t,n=t.isPoint?L:t.lengths;if(y.coords=s,g.coords=s,e.returnEdge){let e=0;for(let t=0;t<n.length;t++){const s=n[t],u=e;for(let t=0;t<s;t++,e+=r){if(!p&&t===s-1)continue;if(y.coordsIndex=e,g.coordsIndex=t===s-1?u:e+r,!Y(x,a,y,g))continue;const n=o(x.x,x.y);n<=1&&l.candidates.push(new F(i,h(x),Math.sqrt(n),h(y),h(g)))}}}if("all"===e.vertexMode){let e=0;for(let t=0;t<n.length;t++){const s=n[t],a=e,u=g;u.coordsIndex=a;for(let t=0;t<s;t++,e+=r){if(y.coordsIndex=e,p&&t===s-1&&y.x===u.x&&y.y===u.y)continue;const a=o(y.x,y.y);a<=1&&l.candidates.push(new T(i,h(y),Math.sqrt(a)))}}}else if(f&&"ends"===e.vertexMode){let e=0;const t=[];for(let i=0;i<n.length;i++){t.push(e);const s=n[i];e+=s*r,s>1&&t.push(e-r)}for(const s of t){y.coordsIndex=s;const e=o(y.x,y.y);e<=1&&l.candidates.push(new T(i,h(y),Math.sqrt(e)))}}}function _(t,i){const{candidates:s}=l,r={x:0,y:0,z:0};if(e.returnEdge){const e=[a.x,a.y],n=new X(e,0),l=new X(e,0);for(const{segments:a}of t.parts)for(const{start:t,curve:p}of a){const{curvePoint:a}=u(t,p,e),f=o(...a);if(f>1)continue;[r.x,r.y]=a,n.coords=t,l.coords=c(p);const y=m(p)?null:d(p);s.push(new F(i,h(r),Math.sqrt(f),h(n),h(l),!1,y))}}function n(e){r.x=t.vertexXY[2*e],r.y=t.vertexXY[2*e+1];const a=o(r.x,r.y);a>1||(r.z=t.vertexZ?.[e]??0,s.push(new T(i,h(r),Math.sqrt(a))))}if("all"===e.vertexMode){const{vertexCount:e}=t;for(let t=0;t<e;++t)n(t);return}if("ends"===e.vertexMode)switch(t.type){case"point":n(0);break;case"polyline":for(let e=0;e<t.partCount;++e){const i=t.partOffsets[e],s=t.partOffsets[e+1]-1;n(i),s!==i&&n(s)}}}}_getPointCreator(e,t,i){const s=null==i||l(t,i)?e=>e:e=>g(e,t,i),{hasZ:a}=this,r=0;return a&&e?({x:e,y:t,z:i})=>s({x:e,y:t,z:i}):({x:e,y:t})=>s({x:e,y:t,z:r})}async createSummaryStatisticsResponse(e){const{field:t,valueExpression:i,normalizationField:s,normalizationType:a,normalizationTotal:r,minValue:n,maxValue:o,scale:l,timeZone:u,outStatisticTypes:c}=e,m=this.fieldsIndex.get(t),d=I(m)||_(m)||v(m),p=await this._getDataValues({field:t,valueExpression:i,normalizationField:s,normalizationType:a,normalizationTotal:r,scale:l,timeZone:u},this.items),f=E({normalizationType:a,normalizationField:s,minValue:n,maxValue:o}),h={value:.5,fieldType:m?.type},y=V(m)?A({values:p,supportsNullCount:f,percentileParams:h,outStatisticTypes:c}):w({values:p,minValue:n,maxValue:o,useSampleStdDev:!a,supportsNullCount:f,percentileParams:h,outStatisticTypes:c});return N(y,c,d)}async createUniqueValuesResponse(e){const{field:t,valueExpression:i,domains:s,returnAllCodedValues:a,scale:r,timeZone:n}=e,o=await this._getDataValues({field:t,field2:e.field2,field3:e.field3,fieldDelimiter:e.fieldDelimiter,valueExpression:i,scale:r,timeZone:n},this.items,!1),l=D(o);return P(l,s,a,e.fieldDelimiter)}async createClassBreaksResponse(e){const{field:t,valueExpression:i,normalizationField:s,normalizationType:a,normalizationTotal:r,classificationMethod:n,standardDeviationInterval:o,minValue:l,maxValue:u,numClasses:c,scale:m,timeZone:d}=e,p=await this._getDataValues({field:t,valueExpression:i,normalizationField:s,normalizationType:a,normalizationTotal:r,scale:m,timeZone:d},this.items),f=q(p,{field:t,normalizationField:s,normalizationType:a,normalizationTotal:r,classificationMethod:n,standardDeviationInterval:o,minValue:l,maxValue:u,numClasses:c});return O(f,n)}async createHistogramResponse(e){const{field:t,valueExpression:i,normalizationField:s,normalizationType:a,normalizationTotal:r,classificationMethod:n,standardDeviationInterval:o,minValue:l,maxValue:u,numBins:c,scale:m,timeZone:d}=e,p=await this._getDataValues({field:t,valueExpression:i,normalizationField:s,normalizationType:a,normalizationTotal:r,scale:m,timeZone:d},this.items);return j(p,{field:t,normalizationField:s,normalizationType:a,normalizationTotal:r,classificationMethod:n,standardDeviationInterval:o,minValue:l,maxValue:u,numBins:c})}_sortFeatures(e,t,i){if(e.length>1&&t?.length)for(const s of t.slice().reverse()){const{compare:t,fieldOrExpression:a,fieldInfo:r}=W(s,this.fieldsIndex);e.sort((e,s)=>t(i(e,a,r),i(s,a,r)))}}_topNFeatures(t,i,s,a){if(t.length>1&&i?.length){const r=i.map(e=>{const{compare:t,fieldOrExpression:i,fieldInfo:s}=W(e,this.fieldsIndex);return(e,r)=>t(a(e,i,s),a(r,i,s))}).reduceRight((e,t)=>(i,s)=>{const a=t(i,s);return 0===a||Number.isNaN(a)?e(i,s):a}),n=[];for(const i of t)e(n,i,s,r);return n}return t.slice(0,s)}_createFeatureQueryResponse(e){const{items:t,geometryType:i,hasM:s,hasZ:a,objectIdField:r,spatialReference:o}=this,{outFields:l,outSR:u,quantizationParameters:c,resultRecordCount:m,resultOffset:d,returnZ:p,returnM:h}=e,y=null!=m&&t.length>(d||0)+m,g=l&&(l.includes("*")?[...this.fieldsIndex.fields]:l.map(e=>this.fieldsIndex.get(e)));return{exceededTransferLimit:y,features:this._createFeatures(e,t),fields:g,geometryType:i,hasM:s&&h,hasZ:a&&p,objectIdFieldName:r,spatialReference:f(u||o),transform:c&&n(c)||null}}_createFeatures(e,t){const i=new p(e,this.featureAdapter,this.fieldsIndex),{hasM:s,hasZ:a}=this,{orderByFields:r,quantizationParameters:o,returnGeometry:l,returnCentroid:u,maxAllowableOffset:c,resultOffset:m,resultRecordCount:d,returnZ:f=!1,returnM:g=!1}=e,x=a&&f,F=s&&g;let T;const I=m||0,_=null!=d?I+d:null;null!=_&&_<=5e3&&_<t.length?T=this._topNFeatures(t,r,_,(e,t,s)=>i.getFieldValue(e,t,s)):(T=[...t],this._sortFeatures(T,r,(e,t,s)=>i.getFieldValue(e,t,s))),(I>0||null!=_)&&(T=T.slice(I,_??void 0));const v=[];let V=0;if(this.geometryType&&(l||u)){const e=n(o)??void 0,t="esriGeometryPolygon"===this.geometryType||"esriGeometryPolyline"===this.geometryType;if(l&&!u)for(const s of T){const a=this.featureAdapter.getGeometry(s),r=this._addFeatureJSONMetadata(s,{attributes:i.getAttributes(s),geometry:h(this.geometryType,a,c,e,x,F)});t&&a&&!r.geometry&&(r.centroid=y(this,this.featureAdapter.getCentroid(s,this),e)),v[V++]=r}else if(!l&&u)for(const s of T)v[V++]=this._addFeatureJSONMetadata(s,{attributes:i.getAttributes(s),centroid:y(this,this.featureAdapter.getCentroid(s,this),e)});else for(const s of T)v[V++]=this._addFeatureJSONMetadata(s,{attributes:i.getAttributes(s),centroid:y(this,this.featureAdapter.getCentroid(s,this),e),geometry:h(this.geometryType,this.featureAdapter.getGeometry(s),c,e,x,F)})}else for(const n of T){const e=i.getAttributes(n);e&&(v[V++]=this._addFeatureJSONMetadata(n,{attributes:e}))}return v}_addFeatureJSONMetadata(e,t){const i=this.featureAdapter.getMetadata?.(e);return void 0!==i&&(t.metadata=i),t}_createExceedsLimitQueryResponse(){let e=!1,t=Number.POSITIVE_INFINITY,i=Number.POSITIVE_INFINITY,s=Number.POSITIVE_INFINITY;for(const a of this.query.outStatistics??[])if("exceedslimit"===a.statisticType){t=null!=a.maxPointCount?a.maxPointCount:Number.POSITIVE_INFINITY,i=null!=a.maxRecordCount?a.maxRecordCount:Number.POSITIVE_INFINITY,s=null!=a.maxVertexCount?a.maxVertexCount:Number.POSITIVE_INFINITY;break}if("esriGeometryPoint"===this.geometryType)e=this.items.length>t;else if(this.items.length>i)e=!0;else{e=this.items.reduce((e,t)=>{const i=this.featureAdapter.getGeometry(t);return e+(i?.size??0)},0)>s}return{fields:[{name:"exceedslimit",type:"esriFieldTypeInteger",alias:"exceedslimit",sqlType:"sqlTypeInteger",domain:null,defaultValue:null}],features:[{attributes:{exceedslimit:Number(e)}}]}}async _createStatisticsQueryResponse(e,t,i={attributes:{}}){const s=[],a=new Map,r=new Map,n=new Map,o=new Map,l=new p(e,this.featureAdapter,this.fieldsIndex),u=e.outStatistics,{groupByFieldsForStatistics:c,having:m,orderByFields:d,resultRecordCount:f}=e,h=c?.length,y=!!h,g=y?c[0]:null,x=y&&!this.fieldsIndex.get(g);for(const p of u??[]){const{outStatisticFieldName:e,statisticType:u}=p,d=p,f="exceedslimit"!==u?p.onStatisticField:void 0,F="percentile_disc"===u||"percentile_cont"===u,T="EnvelopeAggregate"===u||"CentroidAggregate"===u||"ConvexHullAggregate"===u,I=y&&1===h&&(f===g||x)&&"count"===u;if(y){if(!n.has(f)){const e=[];for(const i of c){const s=this._getAttributeValues(l,i,t,a);e.push(s)}n.set(f,this._calculateUniqueValues(e,t,!T&&l.returnDistinctValues))}const i=n.get(f);if(!i)continue;const s=Object.keys(i);for(const r of s){const{count:s,data:n,items:u,itemPositions:p}=i[r],h=n.join(",");if(!m||l.validateItems(u,m)){const i=o.get(h)||{attributes:{}};if(T){i.aggregateGeometries||(i.aggregateGeometries={});const{aggregateGeometries:e,outStatisticFieldName:t}=await this._getAggregateGeometry(d,u);i.aggregateGeometries[t]=e}else{let r=null;if(I)r=s;else{const e=this._getAttributeValues(l,f,t,a),i=p.map(t=>e[t]);r=F&&"statisticParameters"in d?this._getPercentileValue(d,i):this._getStatisticValue(d,i,null,l.returnDistinctValues)}i.attributes[e]=r}let r=0;c.forEach((e,t)=>i.attributes[this.fieldsIndex.get(e)?e:"EXPR_"+ ++r]=n[t]),o.set(h,i)}}}else if(T){i.aggregateGeometries||(i.aggregateGeometries={});const{aggregateGeometries:e,outStatisticFieldName:s}=await this._getAggregateGeometry(d,t);i.aggregateGeometries[s]=e}else{const s=this._getAttributeValues(l,f,t,a);i.attributes[e]=F&&"statisticParameters"in d?this._getPercentileValue(d,s):this._getStatisticValue(d,s,r,l.returnDistinctValues)}const _="min"!==u&&"max"!==u||!V(this.fieldsIndex.get(f))&&!this._isAnyDateField(f)?null:this.fieldsIndex.get(f)?.type;s.push({name:e,alias:e,type:_||"esriFieldTypeDouble"})}const F=y?Array.from(o.values()):[i];return this._sortFeatures(F,d,(e,t)=>e.attributes[t]),f&&(F.length=Math.min(f,F.length)),{fields:s,features:F}}_isAnyDateField(e){const t=this.fieldsIndex.get(e);return I(t)||_(t)||v(t)||S(t)}async _getAggregateGeometry(e,t){const{convexHull:n,union:o}=await import("../../../geometry/geometryEngineJSON.js"),{statisticType:l,outStatisticFieldName:u}=e,{featureAdapter:c,spatialReference:m,geometryType:d}=this,p=t.map(e=>h(d,c.getGeometry(e))),f=n(m,p,!0)[0],y={aggregateGeometries:null,outStatisticFieldName:null};if("EnvelopeAggregate"===l){const e=f?a(f):r(o(m,p));y.aggregateGeometries={...e,spatialReference:m},y.outStatisticFieldName=u||"extent"}else if("CentroidAggregate"===l){const e=f?i(f):s(r(o(m,p)));y.aggregateGeometries={x:e[0],y:e[1],spatialReference:m},y.outStatisticFieldName=u||"centroid"}else"ConvexHullAggregate"===l&&(y.aggregateGeometries=f,y.outStatisticFieldName=u||"convexHull");return y}_getStatisticValue(e,t,i,s){const{onStatisticField:a,statisticType:r}=e;let n=null;n=i?.has(a)?i.get(a):V(this.fieldsIndex.get(a))||this._isAnyDateField(a)?A({values:t,returnDistinct:s}):w({values:s?[...new Set(t)]:t,minValue:null,maxValue:null,useSampleStdDev:!0}),i&&i.set(a,n);return n["var"===r?"variance":r]}_getPercentileValue(e,t){const{onStatisticField:i,statisticParameters:s,statisticType:a}=e,{value:r,orderBy:n}=s,o=this.fieldsIndex.get(i);return C(t,{value:r,orderBy:n,fieldType:o?.type,isDiscrete:"percentile_disc"===a})}_getAttributeValues(e,t,i,s){if(s.has(t))return s.get(t);const a=this.fieldsIndex.get(t),r=i.map(i=>e.getFieldValue(i,t,a));return s.set(t,r),r}_calculateUniqueValues(e,t,i){const s={},a=t.length;for(let r=0;r<a;r++){const a=t[r],n=[];for(const t of e)n.push(t[r]);const o=n.join(",");null==s[o]?s[o]={count:1,data:n,items:[a],itemPositions:[r]}:(i||s[o].count++,s[o].items.push(a),s[o].itemPositions.push(r))}return s}async _getDataValues(e,i,s=!0){const a=new p(this.query,this.featureAdapter,this.fieldsIndex),{valueExpression:r,scale:n,timeZone:o}=e;return r?a.getExpressionValues(i,r,{viewingMode:"map",scale:n,spatialReference:this.query.outSR||this.spatialReference},{geometryType:this.geometryType,hasZ:this.hasZ,hasM:this.hasM},o):a.getDataValues(i,t(e),s)}_calculateHistogramBins(e,t,i){if(null==t.min&&null==t.max)return[];const s=t.intervals,a=t.min??0,r=t.max??0,n=s.map(([e,t])=>({minValue:e,maxValue:t,count:0,items:[]}));for(let o=0;o<e.length;o++){const t=e[o],l=i[o];if(null!=t&&t>=a&&t<=r){const e=G(s,t);e>-1&&(n[e].count++,n[e].items.push(l))}}return n}async createQueryBinsResponse(e){const t=e.bin?.splitBy;if(!t)return this._createBinsResponse(e);const{value:i,outAlias:s,valueType:a}=t,r=[],n=[{name:s??i,alias:s??i,type:a??"esriFieldTypeString"},{name:J,alias:J,type:"esriFieldTypeInteger"}],o=new p(e,this.featureAdapter,this.fieldsIndex),l=new Map,u=[...this.items];this._sortFeatures(u,[i],(e,t,i)=>o.getFieldValue(e,t,i));const c=this._getAttributeValues(o,i,u,l),m=this._calculateUniqueValues([c],u,o.returnDistinctValues);for(const d in m){const{items:t}=m[d],a=await this._createBinsResponse(e,t);if(r.push(...a.features.map(e=>({...e,attributes:{...e.attributes,[s??i]:d}}))),a.fields)for(const e of a.fields)n.some(t=>t.name===e.name)||n.push(e)}return{fields:n,features:r}}async _createBinsResponse(e,t){const i=e.bin;switch(t=t??this.items,i.type){case"autoIntervalBin":return this._createAutoIntervalBinsResponse(b.fromJSON(i),e,t);case"dateBin":return this._createDateBinsResponse(z.fromJSON(i),e,t);case"fixedBoundariesBin":return this._createFixedBoundariesBinsResponse(B.fromJSON(i),e,t);case"fixedIntervalBin":return this._createFixedIntervalBinsResponse(M.fromJSON(i),e,t)}}async _createAutoIntervalBinsResponse(e,t,i){const{field:s,normalizationField:a,numBins:r,normalizationType:n,normalizationTotal:o,start:l,end:u}=e,c=await this._getDataValues({field:e.field||e.expression,normalizationField:e.normalizationField,normalizationType:e.normalizationType,normalizationTotal:e.normalizationTotal,timeZone:t.outTimeReference?.ianaTimeZone},i),m=Z(c,{field:s,normalizationField:a,normalizationType:n,normalizationTotal:o,numBins:r,minValue:x(n?e.normalizationMinValue:l,!1),maxValue:x(n?e.normalizationMaxValue:u,!1)}),d=this._calculateHistogramBins(c,m,i);return this._createFeaturesFromHistogramBins(d,t)}async _createDateBinsResponse(e,t,i){const{field:s,interval:a,start:r,end:n,snapToData:o,returnFullIntervalBin:l,offset:u,firstDayOfWeek:c}=e,m=a.unit,d=await this._getDataValues({field:s||e.expression,timeZone:t.outTimeReference?.ianaTimeZone},i),p=S(this.fieldsIndex.get(s)),f=R.toJSON(m),h=d.filter(Boolean).sort((e,t)=>e-t),y=null!=r?x(r,p):h[0],g=null!=n?x(n,p):h[h.length-1],F=[];if(null!=y&&null!=g){const e={zone:t.outTimeReference?.ianaTimeZone??U},i=u?.unit?R.toJSON(u.unit):"milliseconds",s={[i]:u?.value||0},r=k.fromMillis(y,e).minus(s),n=k.fromMillis(g,e).minus(s),m="number"==typeof c&&c>=1&&c<=7?c:7,d=(e,t)=>{const i=(e.weekday-t+7)%7;return e.minus({days:i}).startOf("day")};if("last"===o){let e="week"===f?((e,t)=>d(e,t).plus({days:7}))(n,m):n;for(;e>r;){const t=e.minus({[f]:a.value});if(t<r){F.unshift([l?t.plus(s).toMillis():r.plus(s).toMillis(),e.plus(s).toMillis()]);break}F.unshift([t.plus(s).toMillis(),e.plus(s).toMillis()]),e=t}}else{let e="first"===o?r:"week"===f?d(r,m):r.startOf(f);for(;e<=n;){const t=e.plus({[f]:a.value});if(t>n){F.push([e.plus(s).toMillis(),l?t.plus(s).toMillis():n.plus(s).toMillis()]);break}F.push([e.plus(s).toMillis(),t.plus(s).toMillis()]),e=t}}}const T=this._calculateHistogramBins(d,{intervals:F,min:y,max:g},i);return this._createFeaturesFromHistogramBins(T,t)}async _createFixedBoundariesBinsResponse(e,t,i){const{field:s}=e,a=await this._getDataValues({field:s||e.expression,timeZone:t.outTimeReference?.ianaTimeZone},i),r=S(this.fieldsIndex.get(s)),n=e.boundaries.map(e=>x(e,r)).sort((e,t)=>e-t),o=[];for(let c=0;c<n.length-1;c++)o.push([n[c],n[c+1]]);const l={intervals:o,min:n.at(0),max:n.at(-1)},u=this._calculateHistogramBins(a,l,i);return this._createFeaturesFromHistogramBins(u,t)}async _createFixedIntervalBinsResponse(e,t,i){const{field:s,interval:a,normalizationType:r,start:n,end:o}=e,l=await this._getDataValues({field:s||e.expression,normalizationField:e.normalizationField,normalizationType:r,normalizationTotal:e.normalizationTotal,timeZone:t.outTimeReference?.ianaTimeZone},i),u=S(this.fieldsIndex.get(s)),c=Z(l,{field:s,classificationMethod:"defined-interval",definedInterval:a,minValue:x(r?e.normalizationMinValue:n,u),maxValue:x(r?e.normalizationMaxValue:o,u)},!0),m=this._calculateHistogramBins(l,c,i);return this._createFeaturesFromHistogramBins(m,t)}async _createFeaturesFromHistogramBins(e,t){const{upperBoundaryAlias:i,lowerBoundaryAlias:s}=t,a=s||"lowerBoundary",r=i||"upperBoundary",n=[],o=[{name:a,alias:a,type:"esriFieldTypeDouble"},{name:r,alias:r,type:"esriFieldTypeDouble"}],l=t.bin?.stackBy?.value,u=t.bin?.stackBy?.outAlias;l&&o.push({name:J,alias:J,type:"esriFieldTypeInteger"},{name:u??l,alias:u??l,type:"esriFieldTypeString"});let c=0;const m="dateBin"===t.bin.type,d=t.outTimeReference?.ianaTimeZone;for(const p of e){const{minValue:e,maxValue:i,items:s}=p,f={attributes:{}};let h;if(f.attributes[a]=m&&d&&null!=e?k.fromMillis(e,{zone:d}).toISO():e,t.bin.hideUpperBound||(f.attributes[r]=m&&d&&null!=i?k.fromMillis(i,{zone:d}).toISO():i),l?(h=await this._createStatisticsQueryResponse({...t,groupByFieldsForStatistics:[l],orderByFields:[l]},s),f.attributes[J]=++c,"flat"===t.bin.jsonStyle?n.push(...h.features.map(({attributes:{EXPR_1:e,...t},...i})=>({...i,attributes:u??e?{...t,[u??e]:e,...f.attributes}:{...t,...f.attributes}}))):(f.stackedAttributes=h.features.map(({attributes:{EXPR_1:e,...t}})=>u??e?{...t,[u??e]:e}:t),n.push(f))):(t.bin?.splitBy&&(f.attributes[J]=++c),h=await this._createStatisticsQueryResponse(t,s,f),n.push(f)),h.fields)for(const t of h.fields)o.some(e=>e.name===t.name)||o.push(t)}return"desc"===t.binOrder&&n.reverse(),{fields:o,features:n}}}function Y(e,t,i,s){const a=s.x-i.x,r=s.y-i.y,n=t.x-i.x,o=t.y-i.y,l=a*a+r*r;if(0===l)return!1;const u=n*a+o*r,c=Math.min(1,Math.max(0,u/l));return e.x=i.x+a*c,e.y=i.y+r*c,!0}class X{constructor(e,t){this.coords=e,this.coordsIndex=t}get x(){return this.coords[this.coordsIndex]}get y(){return this.coords[this.coordsIndex+1]}get z(){return this.coords[this.coordsIndex+2]}}const L=[1];function W(e,t){const i=e.split(" "),s=i[0],a=t.get(s),r=!!i[1]&&"desc"===i[1].toLowerCase();return{compare:H(a?.type,r,"case-insensitive"),fieldOrExpression:s,fieldInfo:a}}export{Q as QueryEngineResult};
2
+ import{insertSortedStableTopN as e}from"../../../core/arrayUtils.js";import{clone as t}from"../../../core/lang.js";import i from"../../../geometry/SpatialReference.js";import{polygonCentroid as s,extentCentroid as a}from"../../../geometry/support/centroid.js";import{getPolygonExtent as r,getGeometryExtent as n}from"../../../geometry/support/extentUtils.js";import{toQuantizationTransform as o}from"../../../geometry/support/quantizationUtils.js";import{isValid as l,equals as u}from"../../../geometry/support/spatialReferenceUtils.js";import{closestPointOnCurve as c}from"../../../geometry/support/curves/closestPointOnCurve.js";import{getEndpoint as m,isCoordinate as d,cloneCurve as p}from"../../../geometry/support/curves/curveUtils.js";import f from"./AttributesBuilder.js";import{cleanFromGeometryEngine as h,getGeometry as y,transformCentroid as g}from"./geometryUtils.js";import{project as x}from"./projectionSupport.js";import{getDateInNumber as F}from"./queryUtils.js";import{SnappingCandidateEdge as T,SnappingCandidateVertex as I}from"./SnappingCandidate.js";import{isDateField as _,isDateOnlyField as v,isTimestampOffsetField as V,isStringField as S,isTimeOnlyField as b}from"../../support/fieldUtils.js";import R from"../../../rest/support/AutoIntervalBinParameters.js";import z from"../../../rest/support/DateBinParameters.js";import{unitsDict as B}from"../../../rest/support/DateBinUtils.js";import M from"../../../rest/support/FixedBoundariesBinParameters.js";import A from"../../../rest/support/FixedIntervalBinParameters.js";import{calculateStringStatistics as w,calculateStatistics as N,processSummaryStatisticsResult as D,calculateUniqueValuesCount as P,createUVResult as q,calculateClassBreaks as O,resolveCBResult as j,calculateHistogram as C,calculatePercentile as G,binIndex as Z,getBinParams as E,isNullCountSupported as H,getAttributeComparator as U}from"../../../statistics/utils.js";import{utc as k}from"../../../time/constants.js";import{DateTime as J}from"luxon";const Q="bin";class Y{constructor(e,t,i){this.items=e,this.query=t,this.geometryType=i.geometryType,this.hasZ=!!t.returnZ&&i.hasZ,this.hasM=!!t.returnM&&i.hasM,this.fieldsIndex=i.fieldsIndex,this.objectIdField=i.objectIdField,this.spatialReference=i.spatialReference,this.featureAdapter=i.featureAdapter}get size(){return this.items.length}createQueryResponseForCount(){const e=new f(this.query,this.featureAdapter,this.fieldsIndex);if(!this.query.outStatistics)return e.countDistinctValues(this.items);const{groupByFieldsForStatistics:t,having:i,outStatistics:s}=this.query,a=t?.length;if(!!!a)return 1;const r=new Map,n=new Map,o=new Set;for(const l of s){const{statisticType:s}=l,a="exceedslimit"!==s?l.onStatisticField:void 0;if(!n.has(a)){const i=[];for(const s of t){const t=this._getAttributeValues(e,s,this.items,r);i.push(t)}n.set(a,this._calculateUniqueValues(i,this.items,e.returnDistinctValues))}const u=n.get(a);for(const t in u){const{data:s,items:a}=u[t],r=s.join(",");i&&!e.validateItems(a,i)||o.add(r)}}return o.size}async createQueryResponse(){let e;if(this.query.outStatistics){e=this.query.outStatistics.some(e=>"exceedslimit"===e.statisticType)?this._createExceedsLimitQueryResponse():await this._createStatisticsQueryResponse(this.query,this.items)}else e=this._createFeatureQueryResponse(this.query);if(this.query.returnQueryGeometry){const t=this.query.geometry;l(this.query.outSR)&&!u(t.spatialReference,this.query.outSR)?e.queryGeometry=h({spatialReference:this.query.outSR,...x(t,t.spatialReference,this.query.outSR)}):e.queryGeometry=h({spatialReference:this.query.outSR,...t})}return e}createSnappingResponse(e,t,i){const s=this.featureAdapter,{point:a}=e,r="number"==typeof e.distance?e.distance:e.distance.x,n="number"==typeof e.distance?e.distance:e.distance.y;function o(e,t){const i=(e-a.x)/r,s=(t-a.y)/n;return i*i+s*s}const l={candidates:[]},u="esriGeometryPolygon"===this.geometryType,f="esriGeometryPolyline"===this.geometryType||"esriGeometryPoint"===this.geometryType,h=this._getPointCreator(t,this.spatialReference,i),y=new L(null,0),g=new L(null,0),x={x:0,y:0,z:0};for(const c of this.items){const e=s.getObjectId(c),t=s.getGeometryWithCurves?.(c);if(null!=t){_(t,e);continue}const i=s.getGeometry(c);null==i||F(i,e)}return l.candidates.sort((e,t)=>e.distance-t.distance),l;function F(t,i){const{coords:s,stride:r}=t,n=t.isPoint?W:t.lengths;if(y.coords=s,g.coords=s,e.returnEdge){let e=0;for(let t=0;t<n.length;t++){const s=n[t],c=e;for(let t=0;t<s;t++,e+=r){if(!u&&t===s-1)continue;if(y.coordsIndex=e,g.coordsIndex=t===s-1?c:e+r,!X(x,a,y,g))continue;const n=o(x.x,x.y);n<=1&&l.candidates.push(new T(i,h(x),Math.sqrt(n),h(y),h(g)))}}}if("all"===e.vertexMode){let e=0;for(let t=0;t<n.length;t++){const s=n[t],a=e,c=g;c.coordsIndex=a;for(let t=0;t<s;t++,e+=r){if(y.coordsIndex=e,u&&t===s-1&&y.x===c.x&&y.y===c.y)continue;const a=o(y.x,y.y);a<=1&&l.candidates.push(new I(i,h(y),Math.sqrt(a)))}}}else if(f&&"ends"===e.vertexMode){let e=0;const t=[];for(let i=0;i<n.length;i++){t.push(e);const s=n[i];e+=s*r,s>1&&t.push(e-r)}for(const s of t){y.coordsIndex=s;const e=o(y.x,y.y);e<=1&&l.candidates.push(new I(i,h(y),Math.sqrt(e)))}}}function _(t,i){const{candidates:s}=l,r={x:0,y:0,z:0};if(e.returnEdge){const e=[a.x,a.y],n=new L(e,0),l=new L(e,0);for(const{segments:a}of t.parts)for(const{start:t,curve:u}of a){const{curvePoint:a}=c(t,u,e),f=o(...a);if(f>1)continue;[r.x,r.y]=a,n.coords=t,l.coords=m(u);const y=d(u)?null:p(u);s.push(new T(i,h(r),Math.sqrt(f),h(n),h(l),!1,y))}}function n(e){r.x=t.vertexXY[2*e],r.y=t.vertexXY[2*e+1];const a=o(r.x,r.y);a>1||(r.z=t.vertexZ?.[e]??0,s.push(new I(i,h(r),Math.sqrt(a))))}if("all"===e.vertexMode){const{vertexCount:e}=t;for(let t=0;t<e;++t)n(t);return}if("ends"===e.vertexMode)switch(t.type){case"point":n(0);break;case"polyline":for(let e=0;e<t.partCount;++e){const i=t.partOffsets[e],s=t.partOffsets[e+1]-1;n(i),s!==i&&n(s)}}}}_getPointCreator(e,t,i){const s=null==i||u(t,i)?e=>e:e=>x(e,t,i),{hasZ:a}=this,r=0;return a&&e?({x:e,y:t,z:i})=>s({x:e,y:t,z:i}):({x:e,y:t})=>s({x:e,y:t,z:r})}async createSummaryStatisticsResponse(e){const{field:t,valueExpression:i,normalizationField:s,normalizationType:a,normalizationTotal:r,minValue:n,maxValue:o,scale:l,timeZone:u,outStatisticTypes:c}=e,m=this.fieldsIndex.get(t),d=_(m)||v(m)||V(m),p=await this._getDataValues({field:t,valueExpression:i,normalizationField:s,normalizationType:a,normalizationTotal:r,scale:l,timeZone:u},this.items),f=H({normalizationType:a,normalizationField:s,minValue:n,maxValue:o}),h={value:.5,fieldType:m?.type},y=S(m)?w({values:p,supportsNullCount:f,percentileParams:h,outStatisticTypes:c}):N({values:p,minValue:n,maxValue:o,useSampleStdDev:!a,supportsNullCount:f,percentileParams:h,outStatisticTypes:c});return D(y,c,d)}async createUniqueValuesResponse(e){const{field:t,valueExpression:i,domains:s,returnAllCodedValues:a,scale:r,timeZone:n}=e,o=await this._getDataValues({field:t,field2:e.field2,field3:e.field3,fieldDelimiter:e.fieldDelimiter,valueExpression:i,scale:r,timeZone:n},this.items,!1),l=P(o);return q(l,s,a,e.fieldDelimiter)}async createClassBreaksResponse(e){const{field:t,valueExpression:i,normalizationField:s,normalizationType:a,normalizationTotal:r,classificationMethod:n,standardDeviationInterval:o,minValue:l,maxValue:u,numClasses:c,scale:m,timeZone:d}=e,p=await this._getDataValues({field:t,valueExpression:i,normalizationField:s,normalizationType:a,normalizationTotal:r,scale:m,timeZone:d},this.items),f=O(p,{field:t,normalizationField:s,normalizationType:a,normalizationTotal:r,classificationMethod:n,standardDeviationInterval:o,minValue:l,maxValue:u,numClasses:c});return j(f,n)}async createHistogramResponse(e){const{field:t,valueExpression:i,normalizationField:s,normalizationType:a,normalizationTotal:r,classificationMethod:n,standardDeviationInterval:o,minValue:l,maxValue:u,numBins:c,scale:m,timeZone:d}=e,p=await this._getDataValues({field:t,valueExpression:i,normalizationField:s,normalizationType:a,normalizationTotal:r,scale:m,timeZone:d},this.items);return C(p,{field:t,normalizationField:s,normalizationType:a,normalizationTotal:r,classificationMethod:n,standardDeviationInterval:o,minValue:l,maxValue:u,numBins:c})}_sortFeatures(e,t,i){if(e.length>1&&t?.length)for(const s of t.slice().reverse()){const{compare:t,fieldOrExpression:a,fieldInfo:r}=K(s,this.fieldsIndex);e.sort((e,s)=>t(i(e,a,r),i(s,a,r)))}}_topNFeatures(t,i,s,a){if(t.length>1&&i?.length){const r=i.map(e=>{const{compare:t,fieldOrExpression:i,fieldInfo:s}=K(e,this.fieldsIndex);return(e,r)=>t(a(e,i,s),a(r,i,s))}).reduceRight((e,t)=>(i,s)=>{const a=t(i,s);return 0===a||Number.isNaN(a)?e(i,s):a}),n=[];for(const i of t)e(n,i,s,r);return n}return t.slice(0,s)}_createFeatureQueryResponse(e){const{items:t,geometryType:i,hasM:s,hasZ:a,objectIdField:r,spatialReference:n}=this,{outFields:l,outSR:u,quantizationParameters:c,resultRecordCount:m,resultOffset:d,returnZ:p,returnM:f}=e,y=null!=m&&t.length>(d||0)+m,g=l&&(l.includes("*")?[...this.fieldsIndex.fields]:l.map(e=>this.fieldsIndex.get(e)));return{exceededTransferLimit:y,features:this._createFeatures(e,t),fields:g,geometryType:i,hasM:s&&f,hasZ:a&&p,objectIdFieldName:r,spatialReference:h(u||n),transform:c&&o(c)||null}}_createFeatures(e,t){const i=new f(e,this.featureAdapter,this.fieldsIndex),{hasM:s,hasZ:a}=this,{orderByFields:r,quantizationParameters:n,returnGeometry:l,returnCentroid:u,maxAllowableOffset:c,resultOffset:m,resultRecordCount:d,returnZ:p=!1,returnM:h=!1}=e,x=a&&p,F=s&&h;let T;const I=m||0,_=null!=d?I+d:null;null!=_&&_<=5e3&&_<t.length?T=this._topNFeatures(t,r,_,(e,t,s)=>i.getFieldValue(e,t,s)):(T=[...t],this._sortFeatures(T,r,(e,t,s)=>i.getFieldValue(e,t,s))),(I>0||null!=_)&&(T=T.slice(I,_??void 0));const v=[];let V=0;if(this.geometryType&&(l||u)){const e=o(n)??void 0,t="esriGeometryPolygon"===this.geometryType||"esriGeometryPolyline"===this.geometryType;if(l&&!u)for(const s of T){const a=this.featureAdapter.getGeometry(s),r=this._addFeatureJSONMetadata(s,{attributes:i.getAttributes(s),geometry:y(this.geometryType,a,c,e,x,F)});t&&a&&!r.geometry&&(r.centroid=g(this,this.featureAdapter.getCentroid(s,this),e)),v[V++]=r}else if(!l&&u)for(const s of T)v[V++]=this._addFeatureJSONMetadata(s,{attributes:i.getAttributes(s),centroid:g(this,this.featureAdapter.getCentroid(s,this),e)});else for(const s of T)v[V++]=this._addFeatureJSONMetadata(s,{attributes:i.getAttributes(s),centroid:g(this,this.featureAdapter.getCentroid(s,this),e),geometry:y(this.geometryType,this.featureAdapter.getGeometry(s),c,e,x,F)})}else for(const o of T){const e=i.getAttributes(o);e&&(v[V++]=this._addFeatureJSONMetadata(o,{attributes:e}))}return v}_addFeatureJSONMetadata(e,t){const i=this.featureAdapter.getMetadata?.(e);return void 0!==i&&(t.metadata=i),t}_createExceedsLimitQueryResponse(){let e=!1,t=Number.POSITIVE_INFINITY,i=Number.POSITIVE_INFINITY,s=Number.POSITIVE_INFINITY;for(const a of this.query.outStatistics??[])if("exceedslimit"===a.statisticType){t=null!=a.maxPointCount?a.maxPointCount:Number.POSITIVE_INFINITY,i=null!=a.maxRecordCount?a.maxRecordCount:Number.POSITIVE_INFINITY,s=null!=a.maxVertexCount?a.maxVertexCount:Number.POSITIVE_INFINITY;break}if("esriGeometryPoint"===this.geometryType)e=this.items.length>t;else if(this.items.length>i)e=!0;else{e=this.items.reduce((e,t)=>{const i=this.featureAdapter.getGeometry(t);return e+(i?.size??0)},0)>s}return{fields:[{name:"exceedslimit",type:"esriFieldTypeInteger",alias:"exceedslimit",sqlType:"sqlTypeInteger",domain:null,defaultValue:null}],features:[{attributes:{exceedslimit:Number(e)}}]}}async _createStatisticsQueryResponse(e,t,i={attributes:{}}){const s=[],a=new Map,r=new Map,n=new Map,o=new Map,l=new f(e,this.featureAdapter,this.fieldsIndex),u=e.outStatistics,{groupByFieldsForStatistics:c,having:m,orderByFields:d,resultRecordCount:p}=e,h=c?.length,y=!!h,g=y?c[0]:null,x=y&&!this.fieldsIndex.get(g);for(const f of u??[]){const{outStatisticFieldName:e,statisticType:u}=f,d=f,p="exceedslimit"!==u?f.onStatisticField:void 0,F="percentile_disc"===u||"percentile_cont"===u,T="EnvelopeAggregate"===u||"CentroidAggregate"===u||"ConvexHullAggregate"===u,I=y&&1===h&&(p===g||x)&&"count"===u;if(y){if(!n.has(p)){const e=[];for(const i of c){const s=this._getAttributeValues(l,i,t,a);e.push(s)}n.set(p,this._calculateUniqueValues(e,t,!T&&l.returnDistinctValues))}const i=n.get(p);if(!i)continue;const s=Object.keys(i);for(const r of s){const{count:s,data:n,items:u,itemPositions:f}=i[r],h=n.join(",");if(!m||l.validateItems(u,m)){const i=o.get(h)||{attributes:{}};if(T){i.aggregateGeometries||(i.aggregateGeometries={});const{aggregateGeometries:e,outStatisticFieldName:t}=await this._getAggregateGeometry(d,u);i.aggregateGeometries[t]=e}else{let r=null;if(I)r=s;else{const e=this._getAttributeValues(l,p,t,a),i=f.map(t=>e[t]);r=F&&"statisticParameters"in d?this._getPercentileValue(d,i):this._getStatisticValue(d,i,null,l.returnDistinctValues)}i.attributes[e]=r}let r=0;c.forEach((e,t)=>i.attributes[this.fieldsIndex.get(e)?e:"EXPR_"+ ++r]=n[t]),o.set(h,i)}}}else if(T){i.aggregateGeometries||(i.aggregateGeometries={});const{aggregateGeometries:e,outStatisticFieldName:s}=await this._getAggregateGeometry(d,t);i.aggregateGeometries[s]=e}else{const s=this._getAttributeValues(l,p,t,a);i.attributes[e]=F&&"statisticParameters"in d?this._getPercentileValue(d,s):this._getStatisticValue(d,s,r,l.returnDistinctValues)}const _="min"!==u&&"max"!==u||!S(this.fieldsIndex.get(p))&&!this._isAnyDateField(p)?null:this.fieldsIndex.get(p)?.type;s.push({name:e,alias:e,type:_||"esriFieldTypeDouble"})}const F=y?Array.from(o.values()):[i];return this._sortFeatures(F,d,(e,t)=>e.attributes[t]),p&&(F.length=Math.min(p,F.length)),{fields:s,features:F}}_isAnyDateField(e){const t=this.fieldsIndex.get(e);return _(t)||v(t)||V(t)||b(t)}async _getAggregateGeometry(e,t){const{convexHull:i,union:o}=await import("../../../geometry/geometryEngineJSON.js"),{statisticType:l,outStatisticFieldName:u}=e,{featureAdapter:c,spatialReference:m,geometryType:d}=this,p=t.map(e=>y(d,c.getGeometry(e))),f=i(m,p,!0)[0],h={aggregateGeometries:null,outStatisticFieldName:null};if("EnvelopeAggregate"===l){const e=f?r(f):n(o(m,p));h.aggregateGeometries={...e,spatialReference:m},h.outStatisticFieldName=u||"extent"}else if("CentroidAggregate"===l){const e=f?s(f):a(n(o(m,p)));h.aggregateGeometries={x:e[0],y:e[1],spatialReference:m},h.outStatisticFieldName=u||"centroid"}else"ConvexHullAggregate"===l&&(h.aggregateGeometries=f,h.outStatisticFieldName=u||"convexHull");return h}_getStatisticValue(e,t,i,s){const{onStatisticField:a,statisticType:r}=e;let n=null;n=i?.has(a)?i.get(a):S(this.fieldsIndex.get(a))||this._isAnyDateField(a)?w({values:t,returnDistinct:s}):N({values:s?[...new Set(t)]:t,minValue:null,maxValue:null,useSampleStdDev:!0}),i&&i.set(a,n);return n["var"===r?"variance":r]}_getPercentileValue(e,t){const{onStatisticField:i,statisticParameters:s,statisticType:a}=e,{value:r,orderBy:n}=s,o=this.fieldsIndex.get(i);return G(t,{value:r,orderBy:n,fieldType:o?.type,isDiscrete:"percentile_disc"===a})}_getAttributeValues(e,t,i,s){if(s.has(t))return s.get(t);const a=this.fieldsIndex.get(t),r=i.map(i=>e.getFieldValue(i,t,a));return s.set(t,r),r}_calculateUniqueValues(e,t,i){const s={},a=t.length;for(let r=0;r<a;r++){const a=t[r],n=[];for(const t of e)n.push(t[r]);const o=n.join(",");null==s[o]?s[o]={count:1,data:n,items:[a],itemPositions:[r]}:(i||s[o].count++,s[o].items.push(a),s[o].itemPositions.push(r))}return s}async _getDataValues(e,s,a=!0){const r=new f(this.query,this.featureAdapter,this.fieldsIndex),{valueExpression:n,scale:o,timeZone:l}=e,u=i.fromJSON(this.query.outSR||this.spatialReference);return n?r.getExpressionValues(s,n,{viewingMode:"map",scale:o,spatialReference:u},{geometryType:this.geometryType,hasZ:this.hasZ,hasM:this.hasM},l):r.getDataValues(s,t(e),a)}_calculateHistogramBins(e,t,i){if(null==t.min&&null==t.max)return[];const s=t.intervals,a=t.min??0,r=t.max??0,n=s.map(([e,t])=>({minValue:e,maxValue:t,count:0,items:[]}));for(let o=0;o<e.length;o++){const t=e[o],l=i[o];if(null!=t&&t>=a&&t<=r){const e=Z(s,t);e>-1&&(n[e].count++,n[e].items.push(l))}}return n}async createQueryBinsResponse(e){const t=e.bin?.splitBy;if(!t)return this._createBinsResponse(e);const{value:i,outAlias:s,valueType:a}=t,r=[],n=[{name:s??i,alias:s??i,type:a??"esriFieldTypeString"},{name:Q,alias:Q,type:"esriFieldTypeInteger"}],o=new f(e,this.featureAdapter,this.fieldsIndex),l=new Map,u=[...this.items];this._sortFeatures(u,[i],(e,t,i)=>o.getFieldValue(e,t,i));const c=this._getAttributeValues(o,i,u,l),m=this._calculateUniqueValues([c],u,o.returnDistinctValues);for(const d in m){const{items:t}=m[d],a=await this._createBinsResponse(e,t);if(r.push(...a.features.map(e=>({...e,attributes:{...e.attributes,[s??i]:d}}))),a.fields)for(const e of a.fields)n.some(t=>t.name===e.name)||n.push(e)}return{fields:n,features:r}}async _createBinsResponse(e,t){const i=e.bin;switch(t=t??this.items,i.type){case"autoIntervalBin":return this._createAutoIntervalBinsResponse(R.fromJSON(i),e,t);case"dateBin":return this._createDateBinsResponse(z.fromJSON(i),e,t);case"fixedBoundariesBin":return this._createFixedBoundariesBinsResponse(M.fromJSON(i),e,t);case"fixedIntervalBin":return this._createFixedIntervalBinsResponse(A.fromJSON(i),e,t)}}async _createAutoIntervalBinsResponse(e,t,i){const{field:s,normalizationField:a,numBins:r,normalizationType:n,normalizationTotal:o,start:l,end:u}=e,c=await this._getDataValues({field:e.field||e.expression,normalizationField:e.normalizationField,normalizationType:e.normalizationType,normalizationTotal:e.normalizationTotal,timeZone:t.outTimeReference?.ianaTimeZone},i),m=E(c,{field:s,normalizationField:a,normalizationType:n,normalizationTotal:o,numBins:r,minValue:F(n?e.normalizationMinValue:l,!1),maxValue:F(n?e.normalizationMaxValue:u,!1)}),d=this._calculateHistogramBins(c,m,i);return this._createFeaturesFromHistogramBins(d,t)}async _createDateBinsResponse(e,t,i){const{field:s,interval:a,start:r,end:n,snapToData:o,returnFullIntervalBin:l,offset:u,firstDayOfWeek:c}=e,m=a.unit,d=await this._getDataValues({field:s||e.expression,timeZone:t.outTimeReference?.ianaTimeZone},i),p=b(this.fieldsIndex.get(s)),f=B.toJSON(m),h=d.filter(Boolean).sort((e,t)=>e-t),y=null!=r?F(r,p):h[0],g=null!=n?F(n,p):h[h.length-1],x=[];if(null!=y&&null!=g){const e={zone:t.outTimeReference?.ianaTimeZone??k},i=u?.unit?B.toJSON(u.unit):"milliseconds",s={[i]:u?.value||0},r=J.fromMillis(y,e).minus(s),n=J.fromMillis(g,e).minus(s),m="number"==typeof c&&c>=1&&c<=7?c:7,d=(e,t)=>{const i=(e.weekday-t+7)%7;return e.minus({days:i}).startOf("day")};if("last"===o){let e="week"===f?((e,t)=>d(e,t).plus({days:7}))(n,m):n;for(;e>r;){const t=e.minus({[f]:a.value});if(t<r){x.unshift([l?t.plus(s).toMillis():r.plus(s).toMillis(),e.plus(s).toMillis()]);break}x.unshift([t.plus(s).toMillis(),e.plus(s).toMillis()]),e=t}}else{let e="first"===o?r:"week"===f?d(r,m):r.startOf(f);for(;e<=n;){const t=e.plus({[f]:a.value});if(t>n){x.push([e.plus(s).toMillis(),l?t.plus(s).toMillis():n.plus(s).toMillis()]);break}x.push([e.plus(s).toMillis(),t.plus(s).toMillis()]),e=t}}}const T=this._calculateHistogramBins(d,{intervals:x,min:y,max:g},i);return this._createFeaturesFromHistogramBins(T,t)}async _createFixedBoundariesBinsResponse(e,t,i){const{field:s}=e,a=await this._getDataValues({field:s||e.expression,timeZone:t.outTimeReference?.ianaTimeZone},i),r=b(this.fieldsIndex.get(s)),n=e.boundaries.map(e=>F(e,r)).sort((e,t)=>e-t),o=[];for(let c=0;c<n.length-1;c++)o.push([n[c],n[c+1]]);const l={intervals:o,min:n.at(0),max:n.at(-1)},u=this._calculateHistogramBins(a,l,i);return this._createFeaturesFromHistogramBins(u,t)}async _createFixedIntervalBinsResponse(e,t,i){const{field:s,interval:a,normalizationType:r,start:n,end:o}=e,l=await this._getDataValues({field:s||e.expression,normalizationField:e.normalizationField,normalizationType:r,normalizationTotal:e.normalizationTotal,timeZone:t.outTimeReference?.ianaTimeZone},i),u=b(this.fieldsIndex.get(s)),c=E(l,{field:s,classificationMethod:"defined-interval",definedInterval:a,minValue:F(r?e.normalizationMinValue:n,u),maxValue:F(r?e.normalizationMaxValue:o,u)},!0),m=this._calculateHistogramBins(l,c,i);return this._createFeaturesFromHistogramBins(m,t)}async _createFeaturesFromHistogramBins(e,t){const{upperBoundaryAlias:i,lowerBoundaryAlias:s}=t,a=s||"lowerBoundary",r=i||"upperBoundary",n=[],o=[{name:a,alias:a,type:"esriFieldTypeDouble"},{name:r,alias:r,type:"esriFieldTypeDouble"}],l=t.bin?.stackBy?.value,u=t.bin?.stackBy?.outAlias;l&&o.push({name:Q,alias:Q,type:"esriFieldTypeInteger"},{name:u??l,alias:u??l,type:"esriFieldTypeString"});let c=0;const m="dateBin"===t.bin.type,d=t.outTimeReference?.ianaTimeZone;for(const p of e){const{minValue:e,maxValue:i,items:s}=p,f={attributes:{}};let h;if(f.attributes[a]=m&&d&&null!=e?J.fromMillis(e,{zone:d}).toISO():e,t.bin.hideUpperBound||(f.attributes[r]=m&&d&&null!=i?J.fromMillis(i,{zone:d}).toISO():i),l?(h=await this._createStatisticsQueryResponse({...t,groupByFieldsForStatistics:[l],orderByFields:[l]},s),f.attributes[Q]=++c,"flat"===t.bin.jsonStyle?n.push(...h.features.map(({attributes:{EXPR_1:e,...t},...i})=>({...i,attributes:u??e?{...t,[u??e]:e,...f.attributes}:{...t,...f.attributes}}))):(f.stackedAttributes=h.features.map(({attributes:{EXPR_1:e,...t}})=>u??e?{...t,[u??e]:e}:t),n.push(f))):(t.bin?.splitBy&&(f.attributes[Q]=++c),h=await this._createStatisticsQueryResponse(t,s,f),n.push(f)),h.fields)for(const t of h.fields)o.some(e=>e.name===t.name)||o.push(t)}return"desc"===t.binOrder&&n.reverse(),{fields:o,features:n}}}function X(e,t,i,s){const a=s.x-i.x,r=s.y-i.y,n=t.x-i.x,o=t.y-i.y,l=a*a+r*r;if(0===l)return!1;const u=n*a+o*r,c=Math.min(1,Math.max(0,u/l));return e.x=i.x+a*c,e.y=i.y+r*c,!0}class L{constructor(e,t){this.coords=e,this.coordsIndex=t}get x(){return this.coords[this.coordsIndex]}get y(){return this.coords[this.coordsIndex+1]}get z(){return this.coords[this.coordsIndex+2]}}const W=[1];function K(e,t){const i=e.split(" "),s=i[0],a=t.get(s),r=!!i[1]&&"desc"===i[1].toLowerCase();return{compare:U(a?.type,r,"case-insensitive"),fieldOrExpression:s,fieldInfo:a}}export{Y as QueryEngineResult};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{convertFlatToOptimizedGeometry as t,convertOptimizedGeometryToFlat as e}from"../../../geometry/FlatGeometry.js";import{featureGeometryTypeKebabDictionary as r}from"../../../geometry/support/typeUtils.js";import{FlatFeature as o}from"../FlatFeature.js";const m={getObjectId:t=>t.objectId,getAttributes:t=>t.attributes,getAttribute:(t,e)=>t.attributes[e],cloneWithGeometry:(t,m,i)=>new o(e(r.fromJSON(i),m),t.attributes,null,t.objectId),getGeometry:e=>e.geometry&&t(e.geometry),getGeometryWithCurves:t=>t.geometry,getCentroid:(t,e)=>t.ensureCentroid(e)};export{m as flatFeatureQueryEngineAdapter};
2
+ import{convertFlatToOptimizedGeometry as t,convertOptimizedGeometryToFlat as e}from"../../../geometry/FlatGeometry.js";import{featureGeometryTypeKebabDictionary as r}from"../../../geometry/support/typeUtils.js";import{FlatFeature as o}from"../FlatFeature.js";const m={getObjectId:t=>t.objectId,getAttributes:t=>t.attributes,getAttribute:(t,e)=>t.attributes[e],cloneWithGeometry:(t,m,i)=>new o(e(r.fromJSON(i),m),t.attributes,null,t.objectId,t.displayId,t.distance),getGeometry:e=>e.geometry&&t(e.geometry),getGeometryWithCurves:t=>t.geometry,getCentroid:(t,e)=>t.ensureCentroid(e)};export{m as flatFeatureQueryEngineAdapter};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{OptimizedFeature as t}from"../OptimizedFeature.js";const e={getObjectId:t=>t.objectId,getAttributes:t=>t.attributes,getAttribute:(t,e)=>t.attributes[e],cloneWithGeometry:(e,r,o)=>new t(r,e.attributes,null,e.objectId),getGeometry:t=>t.geometry,getCentroid:(t,e)=>t.ensureCentroid(e)};export{e as optimizedFeatureQueryEngineAdapter};
2
+ import{OptimizedFeature as t}from"../OptimizedFeature.js";const e={getObjectId:t=>t.objectId,getAttributes:t=>t.attributes,getAttribute:(t,e)=>t.attributes[e],cloneWithGeometry:(e,r,i)=>new t(r,e.attributes,null,e.objectId,e.displayId,e.distance),getGeometry:t=>t.geometry,getCentroid:(t,e)=>t.ensureCentroid(e)};export{e as optimizedFeatureQueryEngineAdapter};