@arcgis/core 5.1.0-next.110 → 5.1.0-next.112

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 (312) hide show
  1. package/analysis/ElevationProfile/ElevationProfileGroup.d.ts +3 -0
  2. package/analysis/ElevationProfile/ElevationProfileLineQuery.d.ts +1 -0
  3. package/analysis/ElevationProfileAnalysis.d.ts +5 -0
  4. package/analysis/ShadowCast/DiscreteOptions.d.ts +2 -2
  5. package/analysis/ShadowCast/TotalDurationOptions.d.ts +13 -4
  6. package/analysis/ShadowCastAnalysis.d.ts +8 -5
  7. package/arcade/Dictionary.js +1 -1
  8. package/arcade/Feature.js +1 -1
  9. package/arcade/Pixel.js +1 -1
  10. package/arcade/Voxel.js +1 -1
  11. package/arcade/arcade.js +1 -1
  12. package/arcade/arcadeAsyncRuntime.js +1 -1
  13. package/arcade/arcadeCompiler.js +1 -1
  14. package/arcade/arcadeEnvironment.js +1 -1
  15. package/arcade/arcadeRuntime.js +1 -1
  16. package/arcade/compilerUtils.js +1 -1
  17. package/arcade/containerUtils.js +1 -1
  18. package/arcade/debug.js +1 -1
  19. package/arcade/enum.js +1 -1
  20. package/arcade/executionError.js +1 -1
  21. package/arcade/functions/convertdirection.js +1 -1
  22. package/arcade/functions/date.js +1 -1
  23. package/arcade/functions/feature.js +1 -1
  24. package/arcade/functions/featuresetbase.js +1 -1
  25. package/arcade/functions/featuresetgeom.js +1 -1
  26. package/arcade/functions/featuresetstats.js +1 -1
  27. package/arcade/functions/featuresetstring.js +1 -1
  28. package/arcade/functions/geomasync.js +1 -1
  29. package/arcade/functions/geometry.js +1 -1
  30. package/arcade/functions/geomsync.js +1 -1
  31. package/arcade/functions/knowledgegraph.js +1 -1
  32. package/arcade/functions/maths.js +1 -1
  33. package/arcade/functions/stats.js +1 -1
  34. package/arcade/functions/string.js +1 -1
  35. package/arcade/functions/track.js +1 -1
  36. package/arcade/geometry/constructors.js +1 -1
  37. package/arcade/geometry/functions.js +1 -1
  38. package/arcade/geometry/unitConversion.js +1 -1
  39. package/arcade.js +1 -1
  40. package/assets/components/assets/icon/returnToDefault16.json +1 -0
  41. package/assets/components/assets/icon/returnToDefault24.json +1 -0
  42. package/assets/components/assets/icon/returnToDefault32.json +1 -0
  43. package/assets/components/assets/icon/reviewMap16.json +1 -0
  44. package/assets/components/assets/icon/reviewMap24.json +1 -0
  45. package/assets/components/assets/icon/reviewMap32.json +1 -0
  46. package/assets/esri/core/workers/RemoteClient.js +1 -1
  47. package/assets/esri/core/workers/chunks/03babc21d1781142a974.js +1 -0
  48. package/assets/esri/core/workers/chunks/08efd64acdfe46985293.js +1 -0
  49. package/assets/esri/core/workers/chunks/0b76534b60014d74ecb9.js +1 -0
  50. package/assets/esri/core/workers/chunks/{622bdd1b9d5d292ec12b.js → 0e6a388d51d9dbae46ba.js} +1 -1
  51. package/assets/esri/core/workers/chunks/{34e026549ba2822b8ebd.js → 13d43a0683c42b94feb6.js} +1 -1
  52. package/assets/esri/core/workers/chunks/{4f9ea7544b2d0e88a05c.js → 13f0e08de2dfab07d212.js} +1 -1
  53. package/assets/esri/core/workers/chunks/{35bbd63319d8aa9f31cc.js → 169c9eb6cd000e067c4b.js} +1 -1
  54. package/assets/esri/core/workers/chunks/{d4014213c476bf8099af.js → 18c4207b1cb0777560ba.js} +1 -1
  55. package/assets/esri/core/workers/chunks/{58c15c42e6a618386a2f.js → 1c8c8050d60205cf2156.js} +1 -1
  56. package/assets/esri/core/workers/chunks/1f537c05c2f643acb5e7.js +1 -0
  57. package/assets/esri/core/workers/chunks/241aeff6afd074ce105b.js +1 -0
  58. package/assets/esri/core/workers/chunks/{ddebc1dc10a2d207389f.js → 282f3d364411efac7b80.js} +1 -1
  59. package/assets/esri/core/workers/chunks/{d6d5ee9d0d998d730f81.js → 2bd334f9ab89334df713.js} +1 -1
  60. package/assets/esri/core/workers/chunks/340c68d09d2e8bef6727.js +2 -0
  61. package/assets/esri/core/workers/chunks/{17604cbd4d24158e2c16.js → 3835097520296b0517af.js} +1 -1
  62. package/assets/esri/core/workers/chunks/481dc7503587972a6bd2.js +2 -0
  63. package/assets/esri/core/workers/chunks/{9f4a9b193485f88d4461.js → 4afe76de6e82e86fe697.js} +1 -1
  64. package/assets/esri/core/workers/chunks/{ac408c62565e2c8b5975.js → 4c5cdd2712c938fafc5d.js} +1 -1
  65. package/assets/esri/core/workers/chunks/{ece30bfd5c49b8d99752.js → 5e5c7cc74ff1c9603aff.js} +1 -1
  66. package/assets/esri/core/workers/chunks/{502c3da8c49bf885f51d.js → 63ea9035dcf9ce45560c.js} +1 -1
  67. package/assets/esri/core/workers/chunks/{33ec193e6d7a0cb9d8dd.js → 6b66a6f69aa03338c346.js} +1 -1
  68. package/assets/esri/core/workers/chunks/{56b6b68d9459b1edea43.js → 6c97b5bc408f051606d2.js} +1 -1
  69. package/assets/esri/core/workers/chunks/{94eab215bab3e4e0e5b5.js → 711d1873c760313e287f.js} +1 -1
  70. package/assets/esri/core/workers/chunks/{4e13d639419ac64f7563.js → 7c077e1a63ab97bf3e87.js} +1 -1
  71. package/assets/esri/core/workers/chunks/86f2de7dda7992ae706c.js +1 -0
  72. package/assets/esri/core/workers/chunks/{a29cd1f5c7bb4f6a5a4f.js → 8d4881c879c86b353e08.js} +1 -1
  73. package/assets/esri/core/workers/chunks/{6e21675bbd7a44070771.js → 8ff83c59462dea6e3427.js} +1 -1
  74. package/assets/esri/core/workers/chunks/979bab62cad788180770.js +1 -0
  75. package/assets/esri/core/workers/chunks/9890c85a238879490926.js +1 -0
  76. package/assets/esri/core/workers/chunks/9ebc461529d5286fa2c2.js +2 -0
  77. package/assets/esri/core/workers/chunks/a95398214e530f896a2d.js +1 -0
  78. package/assets/esri/core/workers/chunks/{fc1fe1f58a65a1694c09.js → b02a68bbab07557cf02d.js} +1 -1
  79. package/assets/esri/core/workers/chunks/ba31616de9d73d83d867.js +1 -0
  80. package/assets/esri/core/workers/chunks/c7662455252b48531da1.js +1 -0
  81. package/assets/esri/core/workers/chunks/ca92176d5348e2c533d7.js +1 -0
  82. package/assets/esri/core/workers/chunks/cd5206e19d86c60e3cf0.js +1 -0
  83. package/assets/esri/core/workers/chunks/{bfb417d72d0c90e116fe.js → cedf3e316d6f89cf7005.js} +1 -1
  84. package/assets/esri/core/workers/chunks/d02aa7438f46c1c2167a.js +2 -0
  85. package/assets/esri/core/workers/chunks/d33a08e5f589355c57a3.js +1 -0
  86. package/assets/esri/core/workers/chunks/dd29fd1b3da90d3ca6b1.js +1 -0
  87. package/assets/esri/core/workers/chunks/e0036fa0324a96a88248.js +1 -0
  88. package/assets/esri/core/workers/chunks/{55334ad3618899cdbf78.js → e5854a3f69dffaf9464d.js} +2 -2
  89. package/assets/esri/core/workers/chunks/ed939fd5d3827a3f70e0.js +1 -0
  90. package/assets/esri/core/workers/chunks/fe8334352d256d691a95.js +1 -0
  91. package/assets/esri/themes/base/widgets/_BatchAttributeForm.scss +7 -0
  92. package/assets/esri/themes/dark/main.css +1 -1
  93. package/assets/esri/themes/light/main.css +1 -1
  94. package/assets/esri/themes/light/view.css +1 -1
  95. package/assets/esri/views/3d/analysis/ShadowCast/t9n/ShadowCastAnalysis.json +1 -1
  96. package/assets/esri/views/3d/analysis/ShadowCast/t9n/ShadowCastAnalysis_ar.json +1 -1
  97. package/assets/esri/views/3d/analysis/ShadowCast/t9n/ShadowCastAnalysis_en.json +1 -1
  98. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm.json +1 -1
  99. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_ar.json +1 -1
  100. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_bg.json +1 -1
  101. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_bs.json +1 -1
  102. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_ca.json +1 -1
  103. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_cs.json +1 -1
  104. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_da.json +1 -1
  105. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_de.json +1 -1
  106. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_el.json +1 -1
  107. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_en.json +1 -1
  108. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_es.json +1 -1
  109. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_et.json +1 -1
  110. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_fi.json +1 -1
  111. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_fr.json +1 -1
  112. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_he.json +1 -1
  113. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_hr.json +1 -1
  114. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_hu.json +1 -1
  115. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_id.json +1 -1
  116. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_it.json +1 -1
  117. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_ja.json +1 -1
  118. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_ko.json +1 -1
  119. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_lt.json +1 -1
  120. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_lv.json +1 -1
  121. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_nl.json +1 -1
  122. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_no.json +1 -1
  123. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_pl.json +1 -1
  124. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_pt-BR.json +1 -1
  125. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_pt-PT.json +1 -1
  126. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_ro.json +1 -1
  127. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_ru.json +1 -1
  128. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_sk.json +1 -1
  129. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_sl.json +1 -1
  130. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_sr.json +1 -1
  131. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_sv.json +1 -1
  132. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_th.json +1 -1
  133. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_tr.json +1 -1
  134. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_uk.json +1 -1
  135. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_vi.json +1 -1
  136. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_zh-CN.json +1 -1
  137. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_zh-HK.json +1 -1
  138. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_zh-TW.json +1 -1
  139. package/chunks/aiServices.js +1 -1
  140. package/chunks/arcade.js +1 -1
  141. package/chunks/array.js +1 -1
  142. package/chunks/languageUtils.js +1 -1
  143. package/config.js +1 -1
  144. package/identity/IdentityModal.js +1 -1
  145. package/kernel.js +1 -1
  146. package/layers/IntegratedMesh3DTilesLayer.js +1 -1
  147. package/layers/Lyr3DWasmPerSceneView.js +1 -1
  148. package/layers/graphics/data/QueryEngineCapabilities.js +1 -1
  149. package/layers/graphics/sources/parquet/PortalParquetLayerFileProvider.js +1 -1
  150. package/layers/support/SceneModification.js +1 -1
  151. package/layers/support/SceneModifications.js +1 -1
  152. package/layers/support/parquetUtils.js +1 -1
  153. package/package.json +2 -2
  154. package/renderers/ClassBreaksRenderer.js +1 -1
  155. package/renderers/UniqueValueRenderer.js +1 -1
  156. package/rest/print.js +1 -1
  157. package/rest/support/TranslateContent.js +1 -1
  158. package/rest/support/TranslateParameters.js +1 -1
  159. package/rest/support/TranslateResult.js +1 -1
  160. package/rest/translate.js +1 -1
  161. package/rest/utils.js +1 -1
  162. package/support/arcadeUtils.js +1 -1
  163. package/support/revision.js +1 -1
  164. package/views/2d/engine/webgl/shaders/sources/shaderRepository.js +1 -1
  165. package/views/3d/analysis/ShadowCast/ShadowCastTooltip.js +1 -1
  166. package/views/3d/analysis/ShadowCastAnalysisView3D.js +1 -1
  167. package/views/3d/layers/GaussianSplatLayerView3D.js +1 -1
  168. package/views/3d/layers/IntegratedMesh3DTilesLayerView3D.js +1 -1
  169. package/views/3d/layers/graphics/Graphics3DPathSymbolLayer.js +1 -1
  170. package/views/3d/layers/support/Tiles3DMeshIntersectionHandler.js +1 -1
  171. package/views/3d/state/controllers/PinchAndPanControllerGlobal.js +1 -1
  172. package/views/3d/state/controllers/PinchAndPanControllerLocal.js +1 -1
  173. package/views/3d/state/utils/navigationUtils.js +1 -1
  174. package/views/3d/support/QualityProfile.js +1 -1
  175. package/views/3d/support/gaussianSplatting/GaussianSplatFadeHelper.js +1 -1
  176. package/views/3d/webgl-engine/effects/debug/RenderNodeVisualizer.js +1 -1
  177. package/views/3d/webgl-engine/lib/PathBuilder.js +1 -1
  178. package/views/3d/webgl-engine/lib/PathCapBuilder.js +1 -1
  179. package/views/3d/webgl-engine/lib/PathEvaluator.js +2 -0
  180. package/views/3d/webgl-engine/lib/PathExtruder.js +1 -1
  181. package/views/3d/webgl-engine/lib/PathFrame2D.js +2 -0
  182. package/views/3d/webgl-engine/lib/PathGeometryData.js +1 -1
  183. package/views/3d/webgl-engine/lib/PathVertex.js +1 -1
  184. package/views/3d/webgl-engine/lib/PathVertexInfo.js +2 -0
  185. package/views/3d/webgl-engine/shaders/GaussianSplatTechniqueConfiguration.js +1 -1
  186. package/views/DOMContainer.d.ts +2 -0
  187. package/views/LinkChartView.d.ts +47 -0
  188. package/views/MapView.d.ts +1 -85
  189. package/views/VideoView.d.ts +8 -1
  190. package/views/View2D.d.ts +78 -2
  191. package/views/draw/support/Reshape.js +1 -1
  192. package/views/interactive/tooltip/components/TooltipEditableField.js +1 -1
  193. package/views/interactive/tooltip/content/TooltipContent.js +1 -1
  194. package/views/types.d.ts +2 -3
  195. package/views/ui/DefaultUI.d.ts +1 -0
  196. package/widgets/Attachments.js +1 -1
  197. package/widgets/BasemapGallery.js +1 -1
  198. package/widgets/BasemapLayerList.js +1 -1
  199. package/widgets/BasemapToggle.js +1 -1
  200. package/widgets/BatchAttributeForm/BatchAttributeFormViewModel.d.ts +10 -1
  201. package/widgets/BatchAttributeForm/BatchAttributeFormViewModel.js +1 -1
  202. package/widgets/BatchAttributeForm/css.js +1 -1
  203. package/widgets/BatchAttributeForm/inputs/AttachmentElementInput.d.ts +25 -1
  204. package/widgets/BatchAttributeForm/inputs/AttachmentElementInput.js +1 -1
  205. package/widgets/BatchAttributeForm/inputs/FieldInput.js +1 -1
  206. package/widgets/BatchAttributeForm/inputs/support/createBatchFormInputs.js +1 -1
  207. package/widgets/BatchAttributeForm/templates/support/createBatchFormTemplate.js +1 -1
  208. package/widgets/BatchAttributeForm.js +1 -1
  209. package/widgets/Bookmarks.js +1 -1
  210. package/widgets/BuildingExplorer/BuildingDisciplinesTree/BuildingDisciplinesNode.js +1 -1
  211. package/widgets/BuildingExplorer/BuildingLevelPicker/BuildingLevelPicker.js +1 -1
  212. package/widgets/BuildingExplorer/BuildingLevelPicker/Label.js +1 -1
  213. package/widgets/BuildingExplorer/BuildingLevelPicker/LevelItem.js +1 -1
  214. package/widgets/BuildingExplorer/BuildingPhasePicker/BuildingPhasePicker.js +1 -1
  215. package/widgets/CatalogLayerList.js +1 -1
  216. package/widgets/Compass.js +1 -1
  217. package/widgets/CoordinateConversion.js +1 -1
  218. package/widgets/Daylight.js +1 -1
  219. package/widgets/DirectionalPad.js +1 -1
  220. package/widgets/Directions.js +1 -1
  221. package/widgets/Editor/components/FeatureList.js +1 -1
  222. package/widgets/Editor/components/FooterActions.js +1 -1
  223. package/widgets/Editor/components/PendingFeatureList.js +1 -1
  224. package/widgets/Editor/components/Prompt.js +1 -1
  225. package/widgets/Editor/components/UpdateFeaturePanelContent.js +1 -1
  226. package/widgets/ElevationProfile/components/LegendItem.js +1 -1
  227. package/widgets/ElevationProfile.js +1 -1
  228. package/widgets/Expand.js +1 -1
  229. package/widgets/Feature/FeatureMedia.js +1 -1
  230. package/widgets/FeatureForm/FeatureFormUtilityNetworkAssociations/FeatureFormUtilityNetworkAssociationList.js +1 -1
  231. package/widgets/FeatureForm/FeatureFormUtilityNetworkAssociations/UtilityNetworkAssociationItemList.js +1 -1
  232. package/widgets/FeatureForm.js +1 -1
  233. package/widgets/FeatureTable.js +1 -1
  234. package/widgets/Features/FeaturesDrillIn.js +1 -1
  235. package/widgets/Features.js +1 -1
  236. package/widgets/FloorFilter.js +1 -1
  237. package/widgets/FovOverlay.js +1 -1
  238. package/widgets/Fullscreen.js +1 -1
  239. package/widgets/Home.js +1 -1
  240. package/widgets/LayerList/LayerListItem.js +1 -1
  241. package/widgets/LayerList.js +1 -1
  242. package/widgets/Locate.js +1 -1
  243. package/widgets/NavigationToggle.js +1 -1
  244. package/widgets/OrientedImageryViewer/components/ImageLocationWidget.js +1 -1
  245. package/widgets/OrientedImageryViewer/components/ImageMeasurementWidget.js +1 -1
  246. package/widgets/OrientedImageryViewer/components/ImageOverlays.js +1 -1
  247. package/widgets/OrientedImageryViewer/components/NavigationActions.js +1 -1
  248. package/widgets/OrientedImageryViewer/components/NavigationUI360.js +1 -1
  249. package/widgets/OrientedImageryViewer/components/SequentialNavigationUI.js +1 -1
  250. package/widgets/OrientedImageryViewer/components/SketchTools.js +1 -1
  251. package/widgets/OrientedImageryViewer/components/VideoEnhancementTools.js +1 -1
  252. package/widgets/OrientedImageryViewer.js +1 -1
  253. package/widgets/PanoramicVideoViewer.js +1 -1
  254. package/widgets/Print/PrintViewModel.js +1 -1
  255. package/widgets/Print.js +1 -1
  256. package/widgets/Search.js +1 -1
  257. package/widgets/Sketch/support/ResponsiveToolbar/OverflowGroup.js +1 -1
  258. package/widgets/Sketch/support/ResponsiveToolbar/SplitButton.js +1 -1
  259. package/widgets/Sketch.js +1 -1
  260. package/widgets/Slice.js +1 -1
  261. package/widgets/Slider.js +1 -1
  262. package/widgets/Swipe.js +1 -1
  263. package/widgets/TableList.js +1 -1
  264. package/widgets/TimeSlider.js +1 -1
  265. package/widgets/TimeZoneLabel.js +1 -1
  266. package/widgets/Track.js +1 -1
  267. package/widgets/UtilityNetworkAssociations.js +1 -1
  268. package/widgets/UtilityNetworkTrace/UtilityNetworkTraceFeature.js +1 -1
  269. package/widgets/UtilityNetworkTrace/UtilityNetworkTraceFeaturesDrillIn.js +1 -1
  270. package/widgets/UtilityNetworkTrace.js +1 -1
  271. package/widgets/UtilityNetworkValidateTopology.js +1 -1
  272. package/widgets/ValuePicker.js +1 -1
  273. package/widgets/VideoPlayer/components/PlayerActionsGroup.js +1 -1
  274. package/widgets/VideoPlayer/components/PlayerControlsGroup.js +1 -1
  275. package/widgets/VideoPlayer/components/SettingsButton.js +1 -1
  276. package/widgets/Weather.js +1 -1
  277. package/widgets/Zoom.js +1 -1
  278. package/widgets/smartMapping/SmartMappingSliderBase.js +1 -1
  279. package/widgets/support/ColorPicker.js +1 -1
  280. package/widgets/support/ContingentValuesManager.js +1 -1
  281. package/widgets/support/FilterBuilder.js +1 -1
  282. package/widgets/support/GridControls.js +1 -1
  283. package/widgets/support/ItemList.js +1 -1
  284. package/widgets/support/LabeledSwitch.js +1 -1
  285. package/widgets/support/SelectionList.js +1 -1
  286. package/assets/esri/core/workers/chunks/1d1929f98d941179be29.js +0 -2
  287. package/assets/esri/core/workers/chunks/286bf3be9f524bde9529.js +0 -1
  288. package/assets/esri/core/workers/chunks/36ecb0082b8804b10fbf.js +0 -1
  289. package/assets/esri/core/workers/chunks/41a95ad470ec42ecd5a2.js +0 -1
  290. package/assets/esri/core/workers/chunks/547dc6ccb989bd962661.js +0 -1
  291. package/assets/esri/core/workers/chunks/549d348ca181d06aefb7.js +0 -2
  292. package/assets/esri/core/workers/chunks/56d9d3f108ff6e719dd4.js +0 -1
  293. package/assets/esri/core/workers/chunks/5c44638670e40e092ce3.js +0 -1
  294. package/assets/esri/core/workers/chunks/63934843c9f4ef779a07.js +0 -1
  295. package/assets/esri/core/workers/chunks/69c9eb93553b006b640d.js +0 -2
  296. package/assets/esri/core/workers/chunks/8330302096d4312a4393.js +0 -1
  297. package/assets/esri/core/workers/chunks/885eac78a76184efa1e5.js +0 -1
  298. package/assets/esri/core/workers/chunks/95dee5853c6e89f15ea9.js +0 -1
  299. package/assets/esri/core/workers/chunks/9da2f2b67837b491cfa3.js +0 -1
  300. package/assets/esri/core/workers/chunks/a913a1c83a667ed0e711.js +0 -1
  301. package/assets/esri/core/workers/chunks/b69d1d528e271568cbd8.js +0 -2
  302. package/assets/esri/core/workers/chunks/bc249bb667f0564ad093.js +0 -1
  303. package/assets/esri/core/workers/chunks/c8b96104641cb4afd4df.js +0 -1
  304. package/assets/esri/core/workers/chunks/cdb48d198145493f76f3.js +0 -1
  305. package/assets/esri/core/workers/chunks/e2bb95d601789bbda73b.js +0 -1
  306. package/assets/esri/core/workers/chunks/f1bb426400dac02880f1.js +0 -1
  307. package/assets/esri/core/workers/chunks/f3f984c62311c20a9db8.js +0 -1
  308. /package/assets/esri/core/workers/chunks/{69c9eb93553b006b640d.js.LICENSE.txt → 340c68d09d2e8bef6727.js.LICENSE.txt} +0 -0
  309. /package/assets/esri/core/workers/chunks/{549d348ca181d06aefb7.js.LICENSE.txt → 481dc7503587972a6bd2.js.LICENSE.txt} +0 -0
  310. /package/assets/esri/core/workers/chunks/{1d1929f98d941179be29.js.LICENSE.txt → 9ebc461529d5286fa2c2.js.LICENSE.txt} +0 -0
  311. /package/assets/esri/core/workers/chunks/{b69d1d528e271568cbd8.js.LICENSE.txt → d02aa7438f46c1c2167a.js.LICENSE.txt} +0 -0
  312. /package/assets/esri/core/workers/chunks/{55334ad3618899cdbf78.js.LICENSE.txt → e5854a3f69dffaf9464d.js.LICENSE.txt} +0 -0
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{ArcadeDate as e,createDateTimeZone as t}from"../arcade/ArcadeDate.js";import{ArcadeModule as r}from"../arcade/ArcadeModule.js";import{ArcadeExecutionError as n}from"../arcade/executionError.js";import{ArcadeFunction as i}from"../arcade/FunctionWrapper.js";import a from"../arcade/ImmutableArray.js";import o from"../arcade/ImmutablePathArray.js";import u from"../arcade/ImmutablePointArray.js";import{esriFieldToJson as s,layerGeometryEsriRestConstants as l}from"../arcade/featureset/support/shared.js";import{format as f,parse as c}from"../core/number.js";import{DateOnly as m}from"../core/sql/DateOnly.js";import{TimeOnly as d}from"../core/sql/TimeOnly.js";import y from"../geometry/Extent.js";import p from"../geometry/Geometry.js";import g from"../geometry/Multipoint.js";import h from"../geometry/Point.js";import b from"../geometry/Polygon.js";import N from"../geometry/Polyline.js";import{isClockwise as S}from"../geometry/support/coordsUtils.js";import{fromJSON as Z}from"../geometry/support/jsonUtils.js";import{getLocale as T}from"../intl/locale.js";import{isBoolean as A,isNumber as k,isString as D,isDate as C,isArray as O,isInteger as j}from"../support/guards.js";import{DateTime as x}from"luxon";import{isGraphic as F}from"../support/graphicInstanceUtils.js";class w{constructor(e){this.value=e}}class J{constructor(e){this.value=e}}const M={type:"VOID"},R=Symbol("BREAK"),P=Symbol("CONTINUE");function v(e,t,r){return""===t||null==t||t===r||t===r?e:e=e.split(t).join(r)}function I(e){return e instanceof i}function _(e){return e instanceof r}function Y(e){return!!D(e)||(!!k(e)||(!!te(e)||(!!re(e)||(!!ne(e)||(!!A(e)||(null===e||e===M))))))}function L(e,t){return void 0===e?t:e}function G(e){return null==e?"":O(e)||ee(e)?"Array":te(e)?"Date":ne(e)?"Time":re(e)?"DateOnly":D(e)?"String":A(e)?"Boolean":k(e)?"Number":"esri.arcade.Attachment"===e?.declaredClass?"Attachment":"esri.arcade.Portal"===e?.declaredClass?"Portal":"esri.arcade.Dictionary"===e?.declaredClass?"Dictionary":X(e)?"KnowledgeGraph":e instanceof r?"Module":q(e)?"Feature":e instanceof h?"Point":e instanceof b?"Polygon":e instanceof N?"Polyline":e instanceof g?"Multipoint":e instanceof y?"Extent":I(e)?"Function":H(e)?"FeatureSet":Q(e)?"FeatureSetCollection":E(e)?"Voxel":U(e)?"Pixel":e===M?"":"number"==typeof e&&isNaN(e)?"Number":"Unrecognized Type"}function V(e){return e===M}function z(e){return e instanceof p}function q(e){return"esri.arcade.Feature"===e?.arcadeDeclaredClass}function E(e){return"esri.arcade.Voxel"===e?.arcadeDeclaredClass}function U(e){return"esri.arcade.Pixel"===e?.arcadeDeclaredClass}function H(e){return"esri.arcade.featureset.support.FeatureSet"===e?.declaredRootClass}function W(e){return"esri.arcade.Dictionary"===e?.declaredClass}function $(e){return"esri.arcade.Portal"===e?.declaredClass}function B(e){return"esri.arcade.Attachment"===e?.declaredClass}function K(e){return W(e)||q(e)||E(e)||U(e)}function Q(e){return"esri.arcade.featureSetCollection"===e?.declaredRootClass}function X(e){return"esri.rest.knowledgeGraph.KnowledgeGraph"===e?.declaredClass}function ee(e){return e instanceof a}function te(t){return t instanceof e}function re(e){return e instanceof m}function ne(e){return e instanceof d}function ie(e){return null!=e&&"object"==typeof e}function ae(e,t,r,i,a){if(e.length<t||e.length>r)throw new n(i,"WrongNumberOfParameters",a)}function oe(e){return null==e||V(e)||""===e}function ue(e){return e<0?-Math.round(-e):Math.round(e)}function se(e,t){return isNaN(e)||null==t||""===t?e.toString():(t=v(t,"‰",""),t=v(t,"¤",""),f(e,{pattern:t}))}function le(e,t){return null==t||""===t?e.toISOString(!0):e.toFormat(fe(t),{locale:T(),numberingSystem:"latn"})}function fe(e,t=!1){e=e.replaceAll(/LTS|LT|L{1,4}|l{1,4}/g,"[$&]");let r="";const n=/(\[[^[]*\])|(\\)?([Hh]mm(ss)?|Mo|M{1,4}|Do|DDDo|D{1,4}|d{2,4}|do?|w[o|w]?|W[o|W]?|Qo?|N{1,5}|YYYYYY|YYYYY|YYYY|YY|y{2,4}|yo?|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|kk?|mm?|ss?|S{1,9}|x|X|zz?|Z{1,5}|.)/g;for(const i of e.match(n)||[])switch(i){case"D":r+="d";break;case"DD":r+="dd";break;case"DDD":r+="o";break;case"d":r+="c";break;case"ddd":r+="ccc";break;case"dddd":r+="cccc";break;case"M":r+="L";break;case"MM":r+="LL";break;case"MMM":r+="LLL";break;case"MMMM":r+="LLLL";break;case"YY":r+="yy";break;case"Y":case"YYYY":r+="yyyy";break;case"Q":r+="q";break;case"Z":r+="Z";break;case"ZZ":r+="ZZ";break;case"ZZZ":r+="ZZZ";break;case"ZZZZ":r+=t?"[ZZZZ]":"ZZZZ";break;case"ZZZZZ":r+=t?"[ZZZZZ]":"ZZZZZ";break;case"S":r+="'S'";break;case"SS":r+="'SS'";break;case"SSS":r+="u";break;case"A":case"a":r+="a";break;case"m":case"mm":case"h":case"hh":case"H":case"HH":case"s":case"ss":case"X":case"x":r+=i;break;default:i.length>=2&&i.startsWith("[")&&i.endsWith("]")?r+=`'${i.slice(1,-1)}'`:r+=`'${i}'`}return r}function ce(e,t,r){switch(r){case">":return e>t;case"<":return e<t;case">=":return e>=t;case"<=":return e<=t}return!1}function me(t,r,i){if(null===t){if(null===r||r===M)return ce(null,null,i);if(k(r))return ce(0,r,i);if(D(r))return ce(0,Ne(r),i);if(A(r))return ce(0,Ne(r),i);if(te(r))return ce(0,r.toNumber(),i);if(ne(r))return ce(t,r.toNumber(),i);if(re(r))return ce(t,r.toNumber(),i)}if(t===M){if(null===r||r===M)return ce(null,null,i);if(k(r))return ce(0,r,i);if(D(r))return ce(0,Ne(r),i);if(A(r))return ce(0,Ne(r),i);if(te(r))return ce(0,r.toNumber(),i);if(ne(r))return ce(t,r.toNumber(),i);if(re(r))return ce(t,r.toNumber(),i)}else if(k(t)){if(k(r))return ce(t,r,i);if(A(r))return ce(t,Ne(r),i);if(null===r||r===M)return ce(t,0,i);if(D(r))return ce(t,Ne(r),i);if(te(r))return ce(t,r.toNumber(),i);if(ne(r))return ce(t,r.toNumber(),i);if(re(r))return ce(t,r.toNumber(),i)}else if(D(t)){if(D(r))return ce(pe(t),pe(r),i);if(te(r))return ce(Ne(t),r.toNumber(),i);if(ne(r))return ce(Ne(t),r.toNumber(),i);if(re(r))return ce(Ne(t),r.toNumber(),i);if(k(r))return ce(Ne(t),r,i);if(null===r||r===M)return ce(Ne(t),0,i);if(A(r))return ce(Ne(t),Ne(r),i)}else if(te(t)){if(te(r))return t.timeZone!==r.timeZone&&(t.isUnknownTimeZone?t=e.arcadeDateAndZoneToArcadeDate(t,r.timeZone):r.isUnknownTimeZone&&(r=e.arcadeDateAndZoneToArcadeDate(r,t.timeZone))),ce(t.toNumber(),r.toNumber(),i);if(null===r||r===M)return ce(t.toNumber(),0,i);if(k(r))return ce(t.toNumber(),r,i);if(A(r))return ce(t.toNumber(),Ne(r),i);if(D(r))return ce(t.toNumber(),Ne(r),i);if(ne(r))throw new n(null,"CannotCompareDateAndTime",null);if(re(r))return ce(t.toNumber(),r.toNumber(),i)}else if(A(t)){if(A(r))return ce(t,r,i);if(k(r))return ce(Ne(t),Ne(r),i);if(te(r))return ce(Ne(t),r.toNumber(),i);if(ne(r))return ce(Ne(t),r.toNumber(),i);if(re(r))return ce(Ne(t),r.toNumber(),i);if(null===r||r===M)return ce(Ne(t),0,i);if(D(r))return ce(Ne(t),Ne(r),i)}else if(re(t)){if(te(r))return ce(t.toNumber(),r.toNumber(),i);if(null===r||r===M)return ce(t.toNumber(),0,i);if(k(r))return ce(t.toNumber(),r,i);if(A(r))return ce(t.toNumber(),Ne(r),i);if(D(r))return ce(t.toNumber(),Ne(r),i);if(ne(r))throw new n(null,"CannotCompareDateAndTime",null);if(re(r))return ce(t.toNumber(),r.toNumber(),i)}else if(ne(t)){if(te(r))throw new n(null,"CannotCompareDateAndTime",null);if(null===r||r===M)return ce(t.toNumber(),0,i);if(k(r))return ce(t.toNumber(),r,i);if(A(r))return ce(t.toNumber(),Ne(r),i);if(D(r))return ce(t.toNumber(),Ne(r),i);if(ne(r))return ce(t.toNumber(),r.toNumber(),i);if(re(r))throw new n(null,"CannotCompareDateAndTime",null)}return!!de(t,r)&&("<="===i||">="===i)}function de(e,t){if(e===t)return!0;if(null===e&&t===M||null===t&&e===M)return!0;if(te(e)&&te(t))return e.equals(t);if(ne(e)&&ne(t))return e.equals(t);if(re(e)&&re(t))return e.equals(t);if(e instanceof o)return e.equalityTest(t);if(e instanceof u)return e.equalityTest(t);if(e instanceof h&&t instanceof h){const r=e.cache._arcadeCacheId,n=t.cache._arcadeCacheId;if(null!=r)return r===n}if(ie(e)&&ie(t)){if(e._arcadeCacheId===t._arcadeCacheId&&void 0!==e._arcadeCacheId&&null!==e._arcadeCacheId)return!0;if(e._underlyingGraphic===t._underlyingGraphic&&void 0!==e._underlyingGraphic&&null!==e._underlyingGraphic)return!0}return!1}function ye(e,{useNumbersForDates:t}){let r="";for(const n in e){""!==r&&(r+=",");const i=e[n];null==i?r+=JSON.stringify(n)+":null":A(i)||k(i)||D(i)?r+=JSON.stringify(n)+":"+JSON.stringify(i):z(i)?r+=JSON.stringify(n)+":"+he(i):ne(i)||re(i)?r+=`${JSON.stringify(n)}:${JSON.stringify(i.toString())}`:ee(i)||Array.isArray(i)?r+=JSON.stringify(n)+":"+he(i,null,t):te(i)?r+=t?JSON.stringify(n)+":"+JSON.stringify(i.getTime()):JSON.stringify(n)+":"+i.stringify():null!==i&&"object"==typeof i&&"castToText"in i&&(r+=JSON.stringify(n)+":"+i.castToText(t))}return"{"+r+"}"}function pe(e,t){if(D(e))return e;if(null===e)return"";if(k(e))return se(e,t);if(A(e))return e.toString();if(te(e))return le(e,t);if(ne(e))return e.toFormat(t);if(re(e))return e.toFormat(t);if(e instanceof p)return JSON.stringify(e.toJSON());if(O(e)){const t=[];for(let r=0;r<e.length;r++)t[r]=be(e[r]);return"["+t.join(",")+"]"}if(e instanceof a){const t=[];for(let r=0;r<e.length();r++)t[r]=be(e.get(r));return"["+t.join(",")+"]"}return null!==e&&"object"==typeof e&&"castToText"in e?e.castToText():I(e)?"object, Function":e===M?"":_(e)?"object, Module":""}function ge(e){const t=[];if(e instanceof a){for(let r=0;r<e.length();r++)t[r]=Ne(e.get(r));return t}if(!O(e))return null;for(let r=0;r<e.length;r++)t[r]=Ne(e[r]);return t}function he(e,t,r=!1){if(D(e))return e;if(null===e)return"";if(k(e))return se(e,t);if(A(e))return e.toString();if(te(e))return le(e,t);if(ne(e))return e.toFormat(t);if(re(e))return e.toFormat(t);if(e instanceof p)return e instanceof y?'{"xmin":'+e.xmin.toString()+',"ymin":'+e.ymin.toString()+","+(e.hasZ?'"zmin":'+e.zmin.toString()+",":"")+(e.hasM?'"mmin":'+e.mmin.toString()+",":"")+'"xmax":'+e.xmax.toString()+',"ymax":'+e.ymax.toString()+","+(e.hasZ?'"zmax":'+e.zmax.toString()+",":"")+(e.hasM?'"mmax":'+e.mmax.toString()+",":"")+'"spatialReference":'+Fe(e.spatialReference)+"}":Fe(e.toJSON(),(e,t)=>e.key===t.key?0:"spatialReference"===e.key?1:"spatialReference"===t.key||e.key<t.key?-1:e.key>t.key?1:0);if(O(e)){const t=[];for(let n=0;n<e.length;n++)t[n]=be(e[n],r);return"["+t.join(",")+"]"}if(e instanceof a){const t=[];for(let n=0;n<e.length();n++)t[n]=be(e.get(n),r);return"["+t.join(",")+"]"}return null!==e&&"object"==typeof e&&"castToText"in e?e.castToText(r):I(e)?"object, Function":e===M?"":_(e)?"object, Module":""}function be(e,t=!1){if(null===e)return"null";if(A(e)||D(e))return JSON.stringify(e);if(k(e))return e.toString();if(e instanceof p)return he(e,null,t);if(e instanceof a)return he(e,null,t);if(Array.isArray(e))return he(e,null,t);if(te(e))return t?JSON.stringify(e.getTime()):JSON.stringify(le(e,""));if(ne(e))return JSON.stringify(e.toString());if(re(e))return JSON.stringify(e.toString());if(null!==e&&"object"==typeof e){if("castToText"in e)return e.castToText(t)}else if(e===M)return"null";return"null"}function Ne(e,t){return k(e)?e:null===e||""===e?0:te(e)||re(e)||ne(e)?NaN:A(e)?e?1:0:O(e)||""===e||void 0===e?NaN:void 0!==t&&D(e)?(t=v(t,"‰",""),t=v(t,"¤",""),c(e,{pattern:t})):e===M?0:Number(e)}function Se(t,r){if(te(t))return t;if(D(t)){const n=Ze(t,r);if(n)return e.dateTimeToArcadeDate(n)}return null}function Ze(e,r){const n=/ (\d\d)/,i=t(r);let a=x.fromISO(e,{zone:i});return a.isValid||n.test(e)&&(e=e.replace(n,"T$1"),a=x.fromISO(e,{zone:r}),a.isValid)?a:null}function Te(e){return A(e)?e:D(e)?"true"===(e=e.toLowerCase()):!!k(e)&&(0!==e&&!isNaN(e))}function Ae(e,t){const r=JSON.parse(e);return r&&!r.spatialReference&&(r.spatialReference=t),Z(r)}function ke(e,t){return null==e?null:(null!==e.spatialReference&&void 0!==e.spatialReference||(e.spatialReference=t),e)}function De(e){if(null===e)return null;if(e instanceof h)return"NaN"===e.x||null===e.x||isNaN(e.x)?null:e;if(e instanceof b){if(0===(e.curveRings??e.rings).length)return null;for(const t of e.curveRings??e.rings)if(t.length>0)return e;return null}if(e instanceof N){if(0===(e.curvePaths??e.paths).length)return null;for(const t of e.curvePaths??e.paths)if(t.length>0)return e;return null}return e instanceof g?0===e.points.length?null:e:e instanceof y?"NaN"===e.xmin||null===e.xmin||isNaN(e.xmin)?null:e:null}function Ce(e,t){if(!e)return t;if(!e.domain)return t;let r=null,n=null;if(te(t))r=t.toNumber();else if(re(t))r=t.toString();else if(ne(t))r=t.toStorageString();else if("string"===e.field.type||"esriFieldTypeString"===e.field.type)r=pe(t);else{if(null==t)return null;if(""===t)return t;r=Ne(t)}for(let i=0;i<e.domain.codedValues.length;i++){const t=e.domain.codedValues[i];t.code===r&&(n=t)}return null===n?pe(t):n.name}function Oe(e,t){if(!e)return t;if(!e.domain)return t;let r=null;const n=pe(t);for(let i=0;i<e.domain.codedValues.length;i++){const t=e.domain.codedValues[i];t.name===n&&(r=t)}return null===r?t:r.code}function je(e,t,r=null,i=null){if(!t)return null;if(!t.fields)return null;let a,o,u=null;for(let n=0;n<t.fields.length;n++){const r=t.fields[n];r.name.toLowerCase()===e.toString().toLowerCase()&&(u=r)}if(null===u)throw new n(null,"FieldNotFound",null,{key:e});let s=t.typeIdField,l="id",f=t.types;if(t.subtypeField&&(s=t.subtypeField,l="code",f=t.subtypes??[]),null===i&&r&&s)i=r.hasField(s)?r.field(s):null;else if(s&&null!==i){let e=!1;for(const t of f||[])if(i===t[l]){e=!0;break}if(!e)for(const t of f||[])if(i===t.name){i=t[l],e=!0;break}e||(i=null,r&&s&&(i=r.hasField(s)?r.field(s):null))}return null!=i&&f.some(e=>e[l]===i&&(a=e.domains?.[u.name],a&&"inherited"===a.type&&(a=xe(u.name,t),o=!0),!0)),o||a||(a=xe(e,t)),{field:u,domain:a}}function xe(e,t){let r;return t.fields.some(t=>(t.name.toLowerCase()===e.toLowerCase()&&(r=t.domain),!!r)),r}function Fe(e,t){t||(t={}),"function"==typeof t&&(t={cmp:t});const r="boolean"==typeof t.cycles&&t.cycles,n=t.cmp&&(i=t.cmp,function(e){return function(t,r){const n={key:t,value:e[t]},a={key:r,value:e[r]};return i(n,a)}});var i;const a=[];return function e(t){if(t?.toJSON&&"function"==typeof t.toJSON&&(t=t.toJSON()),void 0===t)return;if("number"==typeof t)return isFinite(t)?""+t:"null";if("object"!=typeof t)return JSON.stringify(t);let i,o;if(Array.isArray(t)){for(o="[",i=0;i<t.length;i++)i&&(o+=","),o+=e(t[i])||"null";return o+"]"}if(null===t)return"null";if(a.includes(t)){if(r)return JSON.stringify("__cycle__");throw new TypeError("Converting circular structure to JSON")}const u=a.push(t)-1,s=Object.keys(t).sort(n?.(t));for(o="",i=0;i<s.length;i++){const r=s[i],n=e(t[r]);n&&(o&&(o+=","),o+=JSON.stringify(r)+":"+n)}return a.splice(u,1),"{"+o+"}"}(e)}function we(e){if(null===e)return null;const t=[];for(const r of e)q(r)?t.push(r.geometry()):t.push(r);return t}function Je(e,t){if(!(t instanceof h))throw new n(null,"InvalidParameter",null);e.push(t.hasZ?t.hasM?[t.x,t.y,t.z,t.m]:[t.x,t.y,t.z]:[t.x,t.y])}function Me(e,t){if(O(e)||ee(e)){let r=!1,i=!1,a=[],o=t;if(O(e)){for(const t of e)Je(a,t);a.length>0&&(o=e[0].spatialReference,r=e[0].hasZ,i=e[0].hasM)}else if(e instanceof u)a=e._elements,a.length>0&&(r=e._hasZ,i=e._hasM,o=e.get(0).spatialReference);else{if(!ee(e))throw new n(null,"InvalidParameter",null);for(const t of e.toArray())Je(a,t);a.length>0&&(o=e.get(0).spatialReference,r=!0===e.get(0).hasZ,i=!0===e.get(0).hasM)}if(0===a.length)return null;return S(a)||(a=a.slice().reverse()),new b({rings:[a],spatialReference:o,hasZ:r,hasM:i})}return e}function Re(e,t){if(O(e)||ee(e)){let r=!1,n=!1,i=[],a=t;if(O(e)){for(const t of e)Je(i,t);i.length>0&&(a=e[0].spatialReference,r=!0===e[0].hasZ,n=!0===e[0].hasM)}else if(e instanceof u)i=e._elements,i.length>0&&(r=e._hasZ,n=e._hasM,a=e.get(0).spatialReference);else if(ee(e)){for(const t of e.toArray())Je(i,t);i.length>0&&(a=e.get(0).spatialReference,r=!0===e.get(0).hasZ,n=!0===e.get(0).hasM)}return 0===i.length?null:new N({paths:[i],spatialReference:a,hasZ:r,hasM:n})}return e}function Pe(e,t){if(O(e)||ee(e)){let r=!1,n=!1,i=[],a=t;if(O(e)){for(const t of e)Je(i,t);i.length>0&&(a=e[0].spatialReference,r=!0===e[0].hasZ,n=!0===e[0].hasM)}else if(e instanceof u)i=e._elements,i.length>0&&(r=e._hasZ,n=e._hasM,a=e.get(0).spatialReference);else if(ee(e)){for(const t of e.toArray())Je(i,t);i.length>0&&(a=e.get(0).spatialReference,r=!0===e.get(0).hasZ,n=!0===e.get(0).hasM)}return 0===i.length?null:new g({points:i,spatialReference:a,hasZ:r,hasM:n})}return e}function ve(e,t=!0){if(null==e)return[];if(O(e)){const r=[];for(const n of e){const e=pe(n);(t||""!==e)&&r.push(e)}return r}if(ee(e)){const r=[];for(let n=0;n<e.length();n++){const i=pe(e.get(n));(t||""!==i)&&r.push(i)}return r}if(Y(e)){const r=pe(e);if(t||""!==r)return[r]}return[]}let Ie=0;function _e(){return Ie++,Ie%100==0?(Ie=0,new Promise(e=>{setTimeout(()=>{e()},0)})):Promise.resolve()}function Ye(e,t,r){switch(r){case"&":return e&t;case"|":return e|t;case"^":return e^t;case"<<":return e<<t;case">>":return e>>t;case">>>":return e>>>t}}function Le(e,t=null){return null==e?null:A(e)||k(e)||D(e)?e:e instanceof p?!0===t?.keepGeometryType?e:e.toJSON():e instanceof a?e.toArray().map(e=>Le(e,t)):Array.isArray(e)?e.map(e=>Le(e,t)):C(e)?e:te(e)?e.toJSDate():ne(e)?e.toString():re(e)?e.toJSDate():null!==e&&"object"==typeof e&&void 0!==e.castAsJson?e.castAsJson(t):null}async function Ge(e,t,r,n,i){const a=await Ve(e,t,r);i[n]=a}async function Ve(e,t=null,r=null){if(e instanceof a&&(e=e.toArray()),null==e)return null;if(Y(e)||e instanceof p||C(e)||te(e))return Le(e,r);if(Array.isArray(e)){const n=[],i=[];for(const a of e)null===a||Y(a)||a instanceof p||C(a)||te(a)?i.push(Le(a,r)):(i.push(null),n.push(Ge(a,t,r,i.length-1,i)));return n.length>0&&await Promise.all(n),i}return null!==e&&"object"==typeof e&&void 0!==e.castAsJsonAsync?e.castAsJsonAsync(t,r):null}function ze(e){return qe(e)?e.parent:e}function qe(e){return e&&"declaredClass"in e&&"esri.layers.support.SubtypeSublayer"===e.declaredClass}function Ee(e){return e&&"declaredClass"in e&&"esri.layers.SubtypeGroupLayer"===e.declaredClass}function Ue(e,t,r){const n=ze(e.fullSchema());if(null===n)return null;if(!n.fields)return null;return je(t,n,e,r)}function He(e){const t=ze(e.fullSchema());return null===t?null:t.fields?t.subtypeField?{subtypeField:t.subtypeField,subtypes:t.subtypes?t.subtypes.map(e=>({name:e.name,code:e.code})):[]}:t.typeIdField?{subtypeField:t.typeIdField,subtypes:t.types?t.types.map(e=>({name:e.name,code:e.id})):[]}:null:null}function We(e,t,r,n){const i=ze(e.fullSchema());if(null===i)return null;if(!i.fields)return null;const a=je(t,i,e,n);if(void 0===r)try{r=e.field(t)}catch(o){return null}return Ce(a,r)}function $e(e,t,r,n){const i=ze(e.fullSchema());if(null===i)return null;if(!i.fields)return null;if(void 0===r){try{r=e.field(t)}catch(a){return null}return r}return Oe(je(t,i,e,n),r)}function Be(e){return e?.timeZone??"system"}function Ke(e){const t=ze(e.fullSchema());if(null===t)return null;if(!t.fields)return null;const r=[];for(const n of t.fields)r.push(s(n));return{objectIdField:t.objectIdField,globalIdField:t.globalIdField??"",geometryType:void 0===l[t.geometryType]?"":l[t.geometryType],fields:r}}const Qe="1.35",Xe=Object.freeze(Object.defineProperty({__proto__:null,ImplicitResult:J,ReturnResult:w,absRound:ue,arcadeVersion:Qe,autoCastArrayOfPointsToMultiPoint:Pe,autoCastArrayOfPointsToPolygon:Me,autoCastArrayOfPointsToPolyline:Re,autoCastFeatureToGeometry:we,binaryOperator:Ye,breakResult:R,castAsJson:Le,castAsJsonAsync:Ve,castRecordToText:ye,continueResult:P,defaultTimeZone:Be,defaultUndefined:L,equalityTest:de,featureDomainCodeLookup:$e,featureDomainValueLookup:We,featureFullDomain:Ue,featureSchema:Ke,featureSubtypes:He,fixNullGeometry:De,fixSpatialReference:ke,formatDate:le,formatNumber:se,getDomain:je,getDomainCode:Oe,getDomainValue:Ce,getType:G,greaterThanLessThan:me,isArray:O,isAttachment:B,isBoolean:A,isDate:te,isDateOnly:re,isDictionary:W,isDictionaryLike:K,isEmpty:oe,isFeature:q,isFeatureSet:H,isFeatureSetCollection:Q,isFunctionParameter:I,isGeometry:z,isGraphic:F,isImmutableArray:ee,isInteger:j,isJsDate:C,isKnowledgeGraph:X,isModule:_,isNumber:k,isObject:ie,isPixel:U,isPortal:$,isSimpleType:Y,isString:D,isSubtypeGrouplayer:Ee,isSubtypeSublayer:qe,isTime:ne,isVoid:V,isVoxel:E,multiReplace:v,parseGeometryFromJson:Ae,pcCheck:ae,stableStringify:Fe,standardiseDateFormat:fe,tick:_e,toBoolean:Te,toDate:Se,toNumber:Ne,toNumberArray:ge,toString:pe,toStringArray:ve,toStringExplicit:he,voidOperation:M},Symbol.toStringTag,{value:"Module"}));export{E as $,Ce as A,G as B,me as C,B as D,te as E,re as F,W as G,K as H,J as I,oe as J,q as K,H as L,Q as M,I as N,z as O,ee as P,X as Q,w as R,_ as S,ie as T,U,$ as V,Y as W,Ee as X,qe as Y,ne as Z,V as _,ue as a,Xe as a0,v as a1,Ae as a2,ae as a3,Fe as a4,fe as a5,_e as a6,Te as a7,Se as a8,Ne as a9,ge as aa,pe as ab,ve as ac,he as ad,M as ae,Qe as b,Pe as c,Me as d,Re as e,we as f,Ye as g,R as h,Le as i,Ve as j,ye as k,P as l,Be as m,L as n,de as o,$e as p,We as q,Ue as r,Ke as s,He as t,De as u,ke as v,le as w,se as x,je as y,Oe as z};
2
+ import{ArcadeDate as e,createDateTimeZone as t}from"../arcade/ArcadeDate.js";import{ArcadeModule as r}from"../arcade/ArcadeModule.js";import{ArcadeExecutionError as n}from"../arcade/executionError.js";import{ArcadeFunction as i}from"../arcade/FunctionWrapper.js";import a from"../arcade/ImmutableArray.js";import o from"../arcade/ImmutablePathArray.js";import u from"../arcade/ImmutablePointArray.js";import{esriFieldToJson as s,layerGeometryEsriRestConstants as l}from"../arcade/featureset/support/shared.js";import{format as f,parse as c}from"../core/number.js";import{DateOnly as m}from"../core/sql/DateOnly.js";import{TimeOnly as d}from"../core/sql/TimeOnly.js";import y from"../geometry/Extent.js";import p from"../geometry/Geometry.js";import g from"../geometry/Multipoint.js";import h from"../geometry/Point.js";import b from"../geometry/Polygon.js";import N from"../geometry/Polyline.js";import{isClockwise as S}from"../geometry/support/coordsUtils.js";import{fromJSON as Z}from"../geometry/support/jsonUtils.js";import{getLocale as T}from"../intl/locale.js";import{isBoolean as A,isNumber as k,isString as D,isDate as C,isArray as O,isInteger as j}from"../support/guards.js";import{DateTime as x}from"luxon";import{isGraphic as F}from"../support/graphicInstanceUtils.js";class w{constructor(e){this.value=e}}class J{constructor(e){this.value=e}}const M={type:"VOID"},R=Symbol("BREAK"),P=Symbol("CONTINUE");function v(e,t,r){return""===t||null==t||t===r||t===r?e:e=e.split(t).join(r)}function I(e){return e instanceof i}function _(e){return e instanceof r}function Y(e){return!!D(e)||(!!k(e)||(!!te(e)||(!!re(e)||(!!ne(e)||(!!A(e)||(null===e||e===M))))))}function L(e,t){return void 0===e?t:e}function G(e){return null==e?"":O(e)||ee(e)?"Array":te(e)?"Date":ne(e)?"Time":re(e)?"DateOnly":D(e)?"String":A(e)?"Boolean":k(e)?"Number":"esri.arcade.Attachment"===e?.declaredClass?"Attachment":"esri.arcade.Portal"===e?.declaredClass?"Portal":"esri.arcade.Dictionary"===e?.declaredClass?"Dictionary":X(e)?"KnowledgeGraph":e instanceof r?"Module":q(e)?"Feature":e instanceof h?"Point":e instanceof b?"Polygon":e instanceof N?"Polyline":e instanceof g?"Multipoint":e instanceof y?"Extent":I(e)?"Function":H(e)?"FeatureSet":Q(e)?"FeatureSetCollection":E(e)?"Voxel":U(e)?"Pixel":e===M?"":"number"==typeof e&&isNaN(e)?"Number":"Unrecognized Type"}function V(e){return e===M}function z(e){return e instanceof p}function q(e){return"esri.arcade.Feature"===e?.arcadeDeclaredClass}function E(e){return"esri.arcade.Voxel"===e?.arcadeDeclaredClass}function U(e){return"esri.arcade.Pixel"===e?.arcadeDeclaredClass}function H(e){return"esri.arcade.featureset.support.FeatureSet"===e?.declaredRootClass}function W(e){return"esri.arcade.Dictionary"===e?.declaredClass}function $(e){return"esri.arcade.Portal"===e?.declaredClass}function B(e){return"esri.arcade.Attachment"===e?.declaredClass}function K(e){return W(e)||q(e)||E(e)||U(e)}function Q(e){return"esri.arcade.featureSetCollection"===e?.declaredRootClass}function X(e){return"esri.rest.knowledgeGraph.KnowledgeGraph"===e?.declaredClass}function ee(e){return e instanceof a}function te(t){return t instanceof e}function re(e){return e instanceof m}function ne(e){return e instanceof d}function ie(e){return null!=e&&"object"==typeof e}function ae(e,t,r,i){if(e.length<t||e.length>r)throw new n("WrongNumberOfParameters",i)}function oe(e){return null==e||V(e)||""===e}function ue(e){return e<0?-Math.round(-e):Math.round(e)}function se(e,t){return isNaN(e)||null==t||""===t?e.toString():(t=v(t,"‰",""),t=v(t,"¤",""),f(e,{pattern:t}))}function le(e,t){return null==t||""===t?e.toISOString(!0):e.toFormat(fe(t),{locale:T(),numberingSystem:"latn"})}function fe(e,t=!1){e=e.replaceAll(/LTS|LT|L{1,4}|l{1,4}/g,"[$&]");let r="";const n=/(\[[^[]*\])|(\\)?([Hh]mm(ss)?|Mo|M{1,4}|Do|DDDo|D{1,4}|d{2,4}|do?|w[o|w]?|W[o|W]?|Qo?|N{1,5}|YYYYYY|YYYYY|YYYY|YY|y{2,4}|yo?|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|kk?|mm?|ss?|S{1,9}|x|X|zz?|Z{1,5}|.)/g;for(const i of e.match(n)||[])switch(i){case"D":r+="d";break;case"DD":r+="dd";break;case"DDD":r+="o";break;case"d":r+="c";break;case"ddd":r+="ccc";break;case"dddd":r+="cccc";break;case"M":r+="L";break;case"MM":r+="LL";break;case"MMM":r+="LLL";break;case"MMMM":r+="LLLL";break;case"YY":r+="yy";break;case"Y":case"YYYY":r+="yyyy";break;case"Q":r+="q";break;case"Z":r+="Z";break;case"ZZ":r+="ZZ";break;case"ZZZ":r+="ZZZ";break;case"ZZZZ":r+=t?"[ZZZZ]":"ZZZZ";break;case"ZZZZZ":r+=t?"[ZZZZZ]":"ZZZZZ";break;case"S":r+="'S'";break;case"SS":r+="'SS'";break;case"SSS":r+="u";break;case"A":case"a":r+="a";break;case"m":case"mm":case"h":case"hh":case"H":case"HH":case"s":case"ss":case"X":case"x":r+=i;break;default:i.length>=2&&i.startsWith("[")&&i.endsWith("]")?r+=`'${i.slice(1,-1)}'`:r+=`'${i}'`}return r}function ce(e,t,r){switch(r){case">":return e>t;case"<":return e<t;case">=":return e>=t;case"<=":return e<=t}return!1}function me(t,r,i){if(null===t){if(null===r||r===M)return ce(null,null,i);if(k(r))return ce(0,r,i);if(D(r))return ce(0,Ne(r),i);if(A(r))return ce(0,Ne(r),i);if(te(r))return ce(0,r.toNumber(),i);if(ne(r))return ce(t,r.toNumber(),i);if(re(r))return ce(t,r.toNumber(),i)}if(t===M){if(null===r||r===M)return ce(null,null,i);if(k(r))return ce(0,r,i);if(D(r))return ce(0,Ne(r),i);if(A(r))return ce(0,Ne(r),i);if(te(r))return ce(0,r.toNumber(),i);if(ne(r))return ce(t,r.toNumber(),i);if(re(r))return ce(t,r.toNumber(),i)}else if(k(t)){if(k(r))return ce(t,r,i);if(A(r))return ce(t,Ne(r),i);if(null===r||r===M)return ce(t,0,i);if(D(r))return ce(t,Ne(r),i);if(te(r))return ce(t,r.toNumber(),i);if(ne(r))return ce(t,r.toNumber(),i);if(re(r))return ce(t,r.toNumber(),i)}else if(D(t)){if(D(r))return ce(pe(t),pe(r),i);if(te(r))return ce(Ne(t),r.toNumber(),i);if(ne(r))return ce(Ne(t),r.toNumber(),i);if(re(r))return ce(Ne(t),r.toNumber(),i);if(k(r))return ce(Ne(t),r,i);if(null===r||r===M)return ce(Ne(t),0,i);if(A(r))return ce(Ne(t),Ne(r),i)}else if(te(t)){if(te(r))return t.timeZone!==r.timeZone&&(t.isUnknownTimeZone?t=e.arcadeDateAndZoneToArcadeDate(t,r.timeZone):r.isUnknownTimeZone&&(r=e.arcadeDateAndZoneToArcadeDate(r,t.timeZone))),ce(t.toNumber(),r.toNumber(),i);if(null===r||r===M)return ce(t.toNumber(),0,i);if(k(r))return ce(t.toNumber(),r,i);if(A(r))return ce(t.toNumber(),Ne(r),i);if(D(r))return ce(t.toNumber(),Ne(r),i);if(ne(r))throw new n("CannotCompareDateAndTime",null);if(re(r))return ce(t.toNumber(),r.toNumber(),i)}else if(A(t)){if(A(r))return ce(t,r,i);if(k(r))return ce(Ne(t),Ne(r),i);if(te(r))return ce(Ne(t),r.toNumber(),i);if(ne(r))return ce(Ne(t),r.toNumber(),i);if(re(r))return ce(Ne(t),r.toNumber(),i);if(null===r||r===M)return ce(Ne(t),0,i);if(D(r))return ce(Ne(t),Ne(r),i)}else if(re(t)){if(te(r))return ce(t.toNumber(),r.toNumber(),i);if(null===r||r===M)return ce(t.toNumber(),0,i);if(k(r))return ce(t.toNumber(),r,i);if(A(r))return ce(t.toNumber(),Ne(r),i);if(D(r))return ce(t.toNumber(),Ne(r),i);if(ne(r))throw new n("CannotCompareDateAndTime",null);if(re(r))return ce(t.toNumber(),r.toNumber(),i)}else if(ne(t)){if(te(r))throw new n("CannotCompareDateAndTime",null);if(null===r||r===M)return ce(t.toNumber(),0,i);if(k(r))return ce(t.toNumber(),r,i);if(A(r))return ce(t.toNumber(),Ne(r),i);if(D(r))return ce(t.toNumber(),Ne(r),i);if(ne(r))return ce(t.toNumber(),r.toNumber(),i);if(re(r))throw new n("CannotCompareDateAndTime",null)}return!!de(t,r)&&("<="===i||">="===i)}function de(e,t){if(e===t)return!0;if(null===e&&t===M||null===t&&e===M)return!0;if(te(e)&&te(t))return e.equals(t);if(ne(e)&&ne(t))return e.equals(t);if(re(e)&&re(t))return e.equals(t);if(e instanceof o)return e.equalityTest(t);if(e instanceof u)return e.equalityTest(t);if(e instanceof h&&t instanceof h){const r=e.cache._arcadeCacheId,n=t.cache._arcadeCacheId;if(null!=r)return r===n}if(ie(e)&&ie(t)){if(e._arcadeCacheId===t._arcadeCacheId&&void 0!==e._arcadeCacheId&&null!==e._arcadeCacheId)return!0;if(e._underlyingGraphic===t._underlyingGraphic&&void 0!==e._underlyingGraphic&&null!==e._underlyingGraphic)return!0}return!1}function ye(e,{useNumbersForDates:t}){let r="";for(const n in e){""!==r&&(r+=",");const i=e[n];null==i?r+=JSON.stringify(n)+":null":A(i)||k(i)||D(i)?r+=JSON.stringify(n)+":"+JSON.stringify(i):z(i)?r+=JSON.stringify(n)+":"+he(i):ne(i)||re(i)?r+=`${JSON.stringify(n)}:${JSON.stringify(i.toString())}`:ee(i)||Array.isArray(i)?r+=JSON.stringify(n)+":"+he(i,null,t):te(i)?r+=t?JSON.stringify(n)+":"+JSON.stringify(i.getTime()):JSON.stringify(n)+":"+i.stringify():null!==i&&"object"==typeof i&&"castToText"in i&&(r+=JSON.stringify(n)+":"+i.castToText(t))}return"{"+r+"}"}function pe(e,t){if(D(e))return e;if(null===e)return"";if(k(e))return se(e,t);if(A(e))return e.toString();if(te(e))return le(e,t);if(ne(e))return e.toFormat(t);if(re(e))return e.toFormat(t);if(e instanceof p)return JSON.stringify(e.toJSON());if(O(e)){const t=[];for(let r=0;r<e.length;r++)t[r]=be(e[r]);return"["+t.join(",")+"]"}if(e instanceof a){const t=[];for(let r=0;r<e.length();r++)t[r]=be(e.get(r));return"["+t.join(",")+"]"}return null!==e&&"object"==typeof e&&"castToText"in e?e.castToText():I(e)?"object, Function":e===M?"":_(e)?"object, Module":""}function ge(e){const t=[];if(e instanceof a){for(let r=0;r<e.length();r++)t[r]=Ne(e.get(r));return t}if(!O(e))return null;for(let r=0;r<e.length;r++)t[r]=Ne(e[r]);return t}function he(e,t,r=!1){if(D(e))return e;if(null===e)return"";if(k(e))return se(e,t);if(A(e))return e.toString();if(te(e))return le(e,t);if(ne(e))return e.toFormat(t);if(re(e))return e.toFormat(t);if(e instanceof p)return e instanceof y?'{"xmin":'+e.xmin.toString()+',"ymin":'+e.ymin.toString()+","+(e.hasZ?'"zmin":'+e.zmin.toString()+",":"")+(e.hasM?'"mmin":'+e.mmin.toString()+",":"")+'"xmax":'+e.xmax.toString()+',"ymax":'+e.ymax.toString()+","+(e.hasZ?'"zmax":'+e.zmax.toString()+",":"")+(e.hasM?'"mmax":'+e.mmax.toString()+",":"")+'"spatialReference":'+Fe(e.spatialReference)+"}":Fe(e.toJSON(),(e,t)=>e.key===t.key?0:"spatialReference"===e.key?1:"spatialReference"===t.key||e.key<t.key?-1:e.key>t.key?1:0);if(O(e)){const t=[];for(let n=0;n<e.length;n++)t[n]=be(e[n],r);return"["+t.join(",")+"]"}if(e instanceof a){const t=[];for(let n=0;n<e.length();n++)t[n]=be(e.get(n),r);return"["+t.join(",")+"]"}return null!==e&&"object"==typeof e&&"castToText"in e?e.castToText(r):I(e)?"object, Function":e===M?"":_(e)?"object, Module":""}function be(e,t=!1){if(null===e)return"null";if(A(e)||D(e))return JSON.stringify(e);if(k(e))return e.toString();if(e instanceof p)return he(e,null,t);if(e instanceof a)return he(e,null,t);if(Array.isArray(e))return he(e,null,t);if(te(e))return t?JSON.stringify(e.getTime()):JSON.stringify(le(e,""));if(ne(e))return JSON.stringify(e.toString());if(re(e))return JSON.stringify(e.toString());if(null!==e&&"object"==typeof e){if("castToText"in e)return e.castToText(t)}else if(e===M)return"null";return"null"}function Ne(e,t){return k(e)?e:null===e||""===e?0:te(e)||re(e)||ne(e)?NaN:A(e)?e?1:0:O(e)||""===e||void 0===e?NaN:void 0!==t&&D(e)?(t=v(t,"‰",""),t=v(t,"¤",""),c(e,{pattern:t})):e===M?0:Number(e)}function Se(t,r){if(te(t))return t;if(D(t)){const n=Ze(t,r);if(n)return e.dateTimeToArcadeDate(n)}return null}function Ze(e,r){const n=/ (\d\d)/,i=t(r);let a=x.fromISO(e,{zone:i});return a.isValid||n.test(e)&&(e=e.replace(n,"T$1"),a=x.fromISO(e,{zone:r}),a.isValid)?a:null}function Te(e){return A(e)?e:D(e)?"true"===(e=e.toLowerCase()):!!k(e)&&(0!==e&&!isNaN(e))}function Ae(e,t){const r=JSON.parse(e);return r&&!r.spatialReference&&(r.spatialReference=t),Z(r)}function ke(e,t){return null==e?null:(null!==e.spatialReference&&void 0!==e.spatialReference||(e.spatialReference=t),e)}function De(e){if(null===e)return null;if(e instanceof h)return"NaN"===e.x||null===e.x||isNaN(e.x)?null:e;if(e instanceof b){if(0===(e.curveRings??e.rings).length)return null;for(const t of e.curveRings??e.rings)if(t.length>0)return e;return null}if(e instanceof N){if(0===(e.curvePaths??e.paths).length)return null;for(const t of e.curvePaths??e.paths)if(t.length>0)return e;return null}return e instanceof g?0===e.points.length?null:e:e instanceof y?"NaN"===e.xmin||null===e.xmin||isNaN(e.xmin)?null:e:null}function Ce(e,t){if(!e)return t;if(!e.domain)return t;let r=null,n=null;if(te(t))r=t.toNumber();else if(re(t))r=t.toString();else if(ne(t))r=t.toStorageString();else if("string"===e.field.type||"esriFieldTypeString"===e.field.type)r=pe(t);else{if(null==t)return null;if(""===t)return t;r=Ne(t)}for(let i=0;i<e.domain.codedValues.length;i++){const t=e.domain.codedValues[i];t.code===r&&(n=t)}return null===n?pe(t):n.name}function Oe(e,t){if(!e)return t;if(!e.domain)return t;let r=null;const n=pe(t);for(let i=0;i<e.domain.codedValues.length;i++){const t=e.domain.codedValues[i];t.name===n&&(r=t)}return null===r?t:r.code}function je(e,t,r=null,i=null){if(!t)return null;if(!t.fields)return null;let a,o,u=null;for(let n=0;n<t.fields.length;n++){const r=t.fields[n];r.name.toLowerCase()===e.toString().toLowerCase()&&(u=r)}if(null===u)throw new n("FieldNotFound",null,{key:e});let s=t.typeIdField,l="id",f=t.types;if(t.subtypeField&&(s=t.subtypeField,l="code",f=t.subtypes??[]),null===i&&r&&s)i=r.hasField(s)?r.field(s):null;else if(s&&null!==i){let e=!1;for(const t of f||[])if(i===t[l]){e=!0;break}if(!e)for(const t of f||[])if(i===t.name){i=t[l],e=!0;break}e||(i=null,r&&s&&(i=r.hasField(s)?r.field(s):null))}return null!=i&&f.some(e=>e[l]===i&&(a=e.domains?.[u.name],a&&"inherited"===a.type&&(a=xe(u.name,t),o=!0),!0)),o||a||(a=xe(e,t)),{field:u,domain:a}}function xe(e,t){let r;return t.fields.some(t=>(t.name.toLowerCase()===e.toLowerCase()&&(r=t.domain),!!r)),r}function Fe(e,t){t||(t={}),"function"==typeof t&&(t={cmp:t});const r="boolean"==typeof t.cycles&&t.cycles,n=t.cmp&&(i=t.cmp,function(e){return function(t,r){const n={key:t,value:e[t]},a={key:r,value:e[r]};return i(n,a)}});var i;const a=[];return function e(t){if(t?.toJSON&&"function"==typeof t.toJSON&&(t=t.toJSON()),void 0===t)return;if("number"==typeof t)return isFinite(t)?""+t:"null";if("object"!=typeof t)return JSON.stringify(t);let i,o;if(Array.isArray(t)){for(o="[",i=0;i<t.length;i++)i&&(o+=","),o+=e(t[i])||"null";return o+"]"}if(null===t)return"null";if(a.includes(t)){if(r)return JSON.stringify("__cycle__");throw new TypeError("Converting circular structure to JSON")}const u=a.push(t)-1,s=Object.keys(t).sort(n?.(t));for(o="",i=0;i<s.length;i++){const r=s[i],n=e(t[r]);n&&(o&&(o+=","),o+=JSON.stringify(r)+":"+n)}return a.splice(u,1),"{"+o+"}"}(e)}function we(e){if(null===e)return null;const t=[];for(const r of e)q(r)?t.push(r.geometry()):t.push(r);return t}function Je(e,t){if(!(t instanceof h))throw new n("InvalidParameter",null);e.push(t.hasZ?t.hasM?[t.x,t.y,t.z,t.m]:[t.x,t.y,t.z]:[t.x,t.y])}function Me(e,t){if(O(e)||ee(e)){let r=!1,i=!1,a=[],o=t;if(O(e)){for(const t of e)Je(a,t);a.length>0&&(o=e[0].spatialReference,r=e[0].hasZ,i=e[0].hasM)}else if(e instanceof u)a=e._elements,a.length>0&&(r=e._hasZ,i=e._hasM,o=e.get(0).spatialReference);else{if(!ee(e))throw new n("InvalidParameter",null);for(const t of e.toArray())Je(a,t);a.length>0&&(o=e.get(0).spatialReference,r=!0===e.get(0).hasZ,i=!0===e.get(0).hasM)}if(0===a.length)return null;return S(a)||(a=a.slice().reverse()),new b({rings:[a],spatialReference:o,hasZ:r,hasM:i})}return e}function Re(e,t){if(O(e)||ee(e)){let r=!1,n=!1,i=[],a=t;if(O(e)){for(const t of e)Je(i,t);i.length>0&&(a=e[0].spatialReference,r=!0===e[0].hasZ,n=!0===e[0].hasM)}else if(e instanceof u)i=e._elements,i.length>0&&(r=e._hasZ,n=e._hasM,a=e.get(0).spatialReference);else if(ee(e)){for(const t of e.toArray())Je(i,t);i.length>0&&(a=e.get(0).spatialReference,r=!0===e.get(0).hasZ,n=!0===e.get(0).hasM)}return 0===i.length?null:new N({paths:[i],spatialReference:a,hasZ:r,hasM:n})}return e}function Pe(e,t){if(O(e)||ee(e)){let r=!1,n=!1,i=[],a=t;if(O(e)){for(const t of e)Je(i,t);i.length>0&&(a=e[0].spatialReference,r=!0===e[0].hasZ,n=!0===e[0].hasM)}else if(e instanceof u)i=e._elements,i.length>0&&(r=e._hasZ,n=e._hasM,a=e.get(0).spatialReference);else if(ee(e)){for(const t of e.toArray())Je(i,t);i.length>0&&(a=e.get(0).spatialReference,r=!0===e.get(0).hasZ,n=!0===e.get(0).hasM)}return 0===i.length?null:new g({points:i,spatialReference:a,hasZ:r,hasM:n})}return e}function ve(e,t=!0){if(null==e)return[];if(O(e)){const r=[];for(const n of e){const e=pe(n);(t||""!==e)&&r.push(e)}return r}if(ee(e)){const r=[];for(let n=0;n<e.length();n++){const i=pe(e.get(n));(t||""!==i)&&r.push(i)}return r}if(Y(e)){const r=pe(e);if(t||""!==r)return[r]}return[]}let Ie=0;function _e(){return Ie++,Ie%100==0?(Ie=0,new Promise(e=>{setTimeout(()=>{e()},0)})):Promise.resolve()}function Ye(e,t,r){switch(r){case"&":return e&t;case"|":return e|t;case"^":return e^t;case"<<":return e<<t;case">>":return e>>t;case">>>":return e>>>t}}function Le(e,t=null){return null==e?null:A(e)||k(e)||D(e)?e:e instanceof p?!0===t?.keepGeometryType?e:e.toJSON():e instanceof a?e.toArray().map(e=>Le(e,t)):Array.isArray(e)?e.map(e=>Le(e,t)):C(e)?e:te(e)?e.toJSDate():ne(e)?e.toString():re(e)?e.toJSDate():null!==e&&"object"==typeof e&&void 0!==e.castAsJson?e.castAsJson(t):null}async function Ge(e,t,r,n,i){const a=await Ve(e,t,r);i[n]=a}async function Ve(e,t=null,r=null){if(e instanceof a&&(e=e.toArray()),null==e)return null;if(Y(e)||e instanceof p||C(e)||te(e))return Le(e,r);if(Array.isArray(e)){const n=[],i=[];for(const a of e)null===a||Y(a)||a instanceof p||C(a)||te(a)?i.push(Le(a,r)):(i.push(null),n.push(Ge(a,t,r,i.length-1,i)));return n.length>0&&await Promise.all(n),i}return null!==e&&"object"==typeof e&&void 0!==e.castAsJsonAsync?e.castAsJsonAsync(t,r):null}function ze(e){return qe(e)?e.parent:e}function qe(e){return e&&"declaredClass"in e&&"esri.layers.support.SubtypeSublayer"===e.declaredClass}function Ee(e){return e&&"declaredClass"in e&&"esri.layers.SubtypeGroupLayer"===e.declaredClass}function Ue(e,t,r){const n=ze(e.fullSchema());if(null===n)return null;if(!n.fields)return null;return je(t,n,e,r)}function He(e){const t=ze(e.fullSchema());return null===t?null:t.fields?t.subtypeField?{subtypeField:t.subtypeField,subtypes:t.subtypes?t.subtypes.map(e=>({name:e.name,code:e.code})):[]}:t.typeIdField?{subtypeField:t.typeIdField,subtypes:t.types?t.types.map(e=>({name:e.name,code:e.id})):[]}:null:null}function We(e,t,r,n){const i=ze(e.fullSchema());if(null===i)return null;if(!i.fields)return null;const a=je(t,i,e,n);if(void 0===r)try{r=e.field(t)}catch(o){return null}return Ce(a,r)}function $e(e,t,r,n){const i=ze(e.fullSchema());if(null===i)return null;if(!i.fields)return null;if(void 0===r){try{r=e.field(t)}catch(a){return null}return r}return Oe(je(t,i,e,n),r)}function Be(e){return e?.timeZone??"system"}function Ke(e){const t=ze(e.fullSchema());if(null===t)return null;if(!t.fields)return null;const r=[];for(const n of t.fields)r.push(s(n));return{objectIdField:t.objectIdField,globalIdField:t.globalIdField??"",geometryType:void 0===l[t.geometryType]?"":l[t.geometryType],fields:r}}const Qe="1.35",Xe=Object.freeze(Object.defineProperty({__proto__:null,ImplicitResult:J,ReturnResult:w,absRound:ue,arcadeVersion:Qe,autoCastArrayOfPointsToMultiPoint:Pe,autoCastArrayOfPointsToPolygon:Me,autoCastArrayOfPointsToPolyline:Re,autoCastFeatureToGeometry:we,binaryOperator:Ye,breakResult:R,castAsJson:Le,castAsJsonAsync:Ve,castRecordToText:ye,continueResult:P,defaultTimeZone:Be,defaultUndefined:L,equalityTest:de,featureDomainCodeLookup:$e,featureDomainValueLookup:We,featureFullDomain:Ue,featureSchema:Ke,featureSubtypes:He,fixNullGeometry:De,fixSpatialReference:ke,formatDate:le,formatNumber:se,getDomain:je,getDomainCode:Oe,getDomainValue:Ce,getType:G,greaterThanLessThan:me,isArray:O,isAttachment:B,isBoolean:A,isDate:te,isDateOnly:re,isDictionary:W,isDictionaryLike:K,isEmpty:oe,isFeature:q,isFeatureSet:H,isFeatureSetCollection:Q,isFunctionParameter:I,isGeometry:z,isGraphic:F,isImmutableArray:ee,isInteger:j,isJsDate:C,isKnowledgeGraph:X,isModule:_,isNumber:k,isObject:ie,isPixel:U,isPortal:$,isSimpleType:Y,isString:D,isSubtypeGrouplayer:Ee,isSubtypeSublayer:qe,isTime:ne,isVoid:V,isVoxel:E,multiReplace:v,parseGeometryFromJson:Ae,pcCheck:ae,stableStringify:Fe,standardiseDateFormat:fe,tick:_e,toBoolean:Te,toDate:Se,toNumber:Ne,toNumberArray:ge,toString:pe,toStringArray:ve,toStringExplicit:he,voidOperation:M},Symbol.toStringTag,{value:"Module"}));export{E as $,Ce as A,G as B,me as C,B as D,te as E,re as F,W as G,K as H,J as I,oe as J,q as K,H as L,Q as M,I as N,z as O,ee as P,X as Q,w as R,_ as S,ie as T,U,$ as V,Y as W,Ee as X,qe as Y,ne as Z,V as _,ue as a,Xe as a0,v as a1,Ae as a2,ae as a3,Fe as a4,fe as a5,_e as a6,Te as a7,Se as a8,Ne as a9,ge as aa,pe as ab,ve as ac,he as ad,M as ae,Qe as b,Pe as c,Me as d,Re as e,we as f,Ye as g,R as h,Le as i,Ve as j,ye as k,P as l,Be as m,L as n,de as o,$e as p,We as q,Ue as r,Ke as s,He as t,De as u,ke as v,le as w,se as x,je as y,Oe as z};
package/config.js CHANGED
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import"./core/has.js";import{deepMerge as e}from"./core/object.js";const s={apiKey:void 0,apiKeys:{scopes:[]},applicationName:"",applicationUrl:globalThis.location?.href,assetsPath:"",fontsUrl:"https://static.arcgis.com/fonts",geometryServiceUrl:"https://utility.arcgisonline.com/arcgis/rest/services/Geometry/GeometryServer",geoRSSServiceUrl:"https://utility.arcgis.com/sharing/rss",kmlServiceUrl:"https://utility.arcgis.com/sharing/kml",userPrivilegesApplied:!0,portalUrl:"https://www.arcgis.com",respectPrefersReducedMotion:!0,routeServiceUrl:"https://route-api.arcgis.com/arcgis/rest/services/World/Route/NAServer/Route_World",workers:{loaderConfig:{has:{},paths:{},map:{},packages:[]}},request:{crossOriginNoCorsDomains:null,httpsDomains:["arcgis.com","arcgisonline.com","esrikr.com","premiumservices.blackbridge.com","esripremium.accuweather.com","gbm.digitalglobe.com","firstlook.digitalglobe.com","msi.digitalglobe.com"],interceptors:[],internalInterceptors:[],maxUrlLength:2e3,priority:"high",proxyRules:[],proxyUrl:null,timeout:62e3,trustedServers:[],useIdentity:!0},log:{interceptors:[],level:null}};if(globalThis.esriConfig&&(e(s,globalThis.esriConfig,!0),delete s.has),!s.assetsPath){{const e="5.1.0-next.110";s.assetsPath=`https://cdn.jsdelivr.net/npm/@arcgis/core@${e}/assets`}s.defaultAssetsPath=s.assetsPath}export{s as default};
2
+ import"./core/has.js";import{deepMerge as e}from"./core/object.js";const s={apiKey:void 0,apiKeys:{scopes:[]},applicationName:"",applicationUrl:globalThis.location?.href,assetsPath:"",fontsUrl:"https://static.arcgis.com/fonts",geometryServiceUrl:"https://utility.arcgisonline.com/arcgis/rest/services/Geometry/GeometryServer",geoRSSServiceUrl:"https://utility.arcgis.com/sharing/rss",kmlServiceUrl:"https://utility.arcgis.com/sharing/kml",userPrivilegesApplied:!0,portalUrl:"https://www.arcgis.com",respectPrefersReducedMotion:!0,routeServiceUrl:"https://route-api.arcgis.com/arcgis/rest/services/World/Route/NAServer/Route_World",workers:{loaderConfig:{has:{},paths:{},map:{},packages:[]}},request:{crossOriginNoCorsDomains:null,httpsDomains:["arcgis.com","arcgisonline.com","esrikr.com","premiumservices.blackbridge.com","esripremium.accuweather.com","gbm.digitalglobe.com","firstlook.digitalglobe.com","msi.digitalglobe.com"],interceptors:[],internalInterceptors:[],maxUrlLength:2e3,priority:"high",proxyRules:[],proxyUrl:null,timeout:62e3,trustedServers:[],useIdentity:!0},log:{interceptors:[],level:null}};if(globalThis.esriConfig&&(e(s,globalThis.esriConfig,!0),delete s.has),!s.assetsPath){{const e="5.1.0-next.112";s.assetsPath=`https://cdn.jsdelivr.net/npm/@arcgis/core@${e}/assets`}s.defaultAssetsPath=s.assetsPath}export{s as default};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{__decorate as t}from"tslib";import{substitute as e}from"../intl.js";import{property as o,subclass as i}from"../core/accessorSupport/decorators.js";import{getCalciteModeClass as s}from"../support/modeUtils.js";import n from"../widgets/Widget.js";import{loadCalciteComponents as r}from"../widgets/support/componentsUtils.js";import{messageBundle as l,tsx as a}from"../widgets/support/widget.js";import{setFocus as c}from"../widgets/support/widgetUtils.js";const p="esri-identity-modal",d={base:p,info:`${p}__info`,notice:`${p}__notice`},u="ArcGIS Online";let m=class extends n{constructor(t,e){super(t,e),this.container=document.createElement("div"),this.error=null,this.oAuthPrompt=!1,this.open=!1,this.signingIn=!1,this.server=null,this.resource=null,this._usernameInputNode=null,this._passwordInputNode=null,document.body.appendChild(this.container)}loadDependencies(){return r({button:()=>import("@esri/calcite-components/dist/components/calcite-button"),dialog:()=>import("@esri/calcite-components/dist/components/calcite-dialog"),input:()=>import("@esri/calcite-components/dist/components/calcite-input"),label:()=>import("@esri/calcite-components/dist/components/calcite-label"),notice:()=>import("@esri/calcite-components/dist/components/calcite-notice")})}get title(){return this.commonMessages?.auth.signIn}render(){const{open:t,title:o,messages:i,signingIn:n,oAuthPrompt:r,server:l,resource:c,error:p}=this,{info:m,oAuthInfo:h,lblItem:g,invalidUser:b,noAuthService:v,lblUser:f,lblPwd:_,lblCancel:I,lblSigning:y,lblOk:w}=i;return a("div",{class:this.classes(d.base,s(this.container))},a("form",{bind:this,onsubmit:this._submit},a("calcite-dialog",{bind:this,heading:o,modal:!0,open:t,outsideCloseDisabled:!0,scale:"s",width:"s",onCalciteDialogClose:this._cancel,onCalciteDialogOpen:this._focusUsernameInput},a("div",{class:d.info},e(r?h:m,{server:l&&/\.arcgis\.com/i.test(l)?u:l,resource:`(${c||g})`})),p?a("calcite-notice",{class:d.notice,icon:"exclamation-mark-triangle",kind:"danger",open:!0},a("div",{slot:"message"},p.details?.httpStatus?b:v)):null,r?null:[a("calcite-label",null,f,a("calcite-input",{afterCreate:t=>this._usernameInputNode=t,autocomplete:"off",bind:this,name:"username",required:!0,spellcheck:!1,type:"text",value:""})),a("calcite-label",null,_,a("calcite-input",{afterCreate:t=>this._passwordInputNode=t,bind:this,name:"password",required:!0,type:"password",value:""}))],a("calcite-button",{appearance:"outline",bind:this,onclick:this._cancel,slot:"footer-end",type:"button"},I),a("calcite-button",{loading:!!n,slot:"footer-end",type:"submit"},n?y:w))))}_focusUsernameInput(){return c(()=>this._usernameInputNode)}_cancel(){this._set("signingIn",!1),this.open=!1,this._usernameInputNode&&(this._usernameInputNode.value=""),this._passwordInputNode&&(this._passwordInputNode.value=""),this.emit("cancel")}_submit(t){t.preventDefault(),this._set("signingIn",!0);const e=this.oAuthPrompt?{}:{username:this._usernameInputNode?.value,password:this._passwordInputNode?.value};this.emit("submit",e)}};t([o({readOnly:!0})],m.prototype,"container",void 0),t([o(),l("esri/t9n/common")],m.prototype,"commonMessages",void 0),t([o()],m.prototype,"error",void 0),t([o(),l("esri/identity/t9n/identity")],m.prototype,"messages",void 0),t([o()],m.prototype,"oAuthPrompt",void 0),t([o()],m.prototype,"open",void 0),t([o()],m.prototype,"signingIn",void 0),t([o()],m.prototype,"server",void 0),t([o({readOnly:!0})],m.prototype,"title",null),t([o()],m.prototype,"resource",void 0),m=t([i("esri.identity.IdentityModal")],m);const h=m;export{h as default};
2
+ import{__decorate as t}from"tslib";import{substitute as e}from"../intl.js";import{property as o,subclass as i}from"../core/accessorSupport/decorators.js";import{getCalciteModeClass as s}from"../support/modeUtils.js";import n from"../widgets/Widget.js";import{loadCalciteComponents as r}from"../widgets/support/componentsUtils.js";import{messageBundle as l,tsx as a}from"../widgets/support/widget.js";import{setFocus as c}from"../widgets/support/widgetUtils.js";const p="esri-identity-modal",d={base:p,info:`${p}__info`,notice:`${p}__notice`},u="ArcGIS Online";let m=class extends n{constructor(t,e){super(t,e),this.container=document.createElement("div"),this.error=null,this.oAuthPrompt=!1,this.open=!1,this.signingIn=!1,this.server=null,this.resource=null,this._usernameInputNode=null,this._passwordInputNode=null,document.body.appendChild(this.container)}loadDependencies(){return r({button:()=>import("@esri/calcite-components/dist/components/calcite-button"),dialog:()=>import("@esri/calcite-components/dist/components/calcite-dialog"),input:()=>import("@esri/calcite-components/dist/components/calcite-input"),label:()=>import("@esri/calcite-components/dist/components/calcite-label"),notice:()=>import("@esri/calcite-components/dist/components/calcite-notice")})}get title(){return this.commonMessages?.auth.signIn}render(){const{open:t,title:o,messages:i,signingIn:n,oAuthPrompt:r,server:l,resource:c,error:p}=this,{info:m,oAuthInfo:h,lblItem:g,invalidUser:b,noAuthService:v,lblUser:f,lblPwd:_,lblCancel:I,lblSigning:y,lblOk:w}=i;return a("div",{class:this.classes(d.base,s(this.container))},a("form",{bind:this,onsubmit:this._submit},a("calcite-dialog",{bind:this,heading:o,modal:!0,open:t,outsideCloseDisabled:!0,scale:"s",width:"s",onCalciteDialogClose:this._cancel,onCalciteDialogOpen:this._focusUsernameInput},a("div",{class:d.info},e(r?h:m,{server:l&&/\.arcgis\.com/i.test(l)?u:l,resource:`(${c||g})`})),p?a("calcite-notice",{class:d.notice,icon:"exclamation-mark-triangle",kind:"danger",open:!0},a("div",{slot:"message"},p.details?.httpStatus?b:v)):null,r?null:[a("calcite-label",null,f,a("calcite-input",{afterCreate:t=>this._usernameInputNode=t,autocomplete:"off",bind:this,name:"username",required:!0,spellcheck:!1,type:"text",value:""})),a("calcite-label",null,_,a("calcite-input",{afterCreate:t=>this._passwordInputNode=t,bind:this,name:"password",required:!0,type:"password",value:""}))],a("calcite-button",{appearance:"outline",bind:this,slot:"footer-end",type:"button",onclick:this._cancel},I),a("calcite-button",{loading:!!n,slot:"footer-end",type:"submit"},n?y:w))))}_focusUsernameInput(){return c(()=>this._usernameInputNode)}_cancel(){this._set("signingIn",!1),this.open=!1,this._usernameInputNode&&(this._usernameInputNode.value=""),this._passwordInputNode&&(this._passwordInputNode.value=""),this.emit("cancel")}_submit(t){t.preventDefault(),this._set("signingIn",!0);const e=this.oAuthPrompt?{}:{username:this._usernameInputNode?.value,password:this._passwordInputNode?.value};this.emit("submit",e)}};t([o({readOnly:!0})],m.prototype,"container",void 0),t([o(),l("esri/t9n/common")],m.prototype,"commonMessages",void 0),t([o()],m.prototype,"error",void 0),t([o(),l("esri/identity/t9n/identity")],m.prototype,"messages",void 0),t([o()],m.prototype,"oAuthPrompt",void 0),t([o()],m.prototype,"open",void 0),t([o()],m.prototype,"signingIn",void 0),t([o()],m.prototype,"server",void 0),t([o({readOnly:!0})],m.prototype,"title",null),t([o()],m.prototype,"resource",void 0),m=t([i("esri.identity.IdentityModal")],m);const h=m;export{h as default};
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.110",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.112",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 t from"../request.js";import{ClonableMixin as o}from"../core/Clonable.js";import r from"../core/Error.js";import has from"../core/has.js";import i from"../core/Logger.js";import{MultiOriginJSONSupportMixin as s}from"../core/MultiOriginJSONSupport.js";import{throwIfAbortError as a}from"../core/promiseUtils.js";import{on as n,sync as l}from"../core/reactiveUtils.js";import{property as p,subclass as m}from"../core/accessorSupport/decorators.js";import{persistable as c}from"../core/accessorSupport/decorators/persistable.js";import d from"../geometry/Extent.js";import u from"../geometry/SpatialReference.js";import h from"./Layer.js";import{APIKeyMixin as f}from"./mixins/APIKeyMixin.js";import{ArcGISService as y}from"./mixins/ArcGISService.js";import{CustomParametersMixin as g}from"./mixins/CustomParametersMixin.js";import{OperationalLayer as S}from"./mixins/OperationalLayer.js";import{PortalLayer as _}from"./mixins/PortalLayer.js";import{ScaleRangeLayer as v}from"./mixins/ScaleRangeLayer.js";import{elevationInfo as j,url as T}from"./support/commonProperties.js";import w from"./support/SceneModifications.js";import{default3DTilesSpatialReference as b,default3DTilesFullExtent as L,initFullExtent as x}from"./support/tiles3DUtils.js";import P from"../portal/Portal.js";import{logInvalidElevationInfoWarning as I,elevationModeRequiredMessage as k,featureExpressionUnsupportedMessage as R}from"../support/elevationInfoUtils.js";import{a as D}from"../chunks/persistableUrlUtils.js";import{isBasemap as U}from"../support/userTypeGuards/isBasemap.js";import{initialize as E,switchMeshModificationPolygonVCSSync as O}from"../views/3d/layers/Lyr3DWorker.js";import{toWasmModification as M,fromWasmModification as q}from"../views/3d/layers/SceneLayerWorkerHandle.js";import{reader as A}from"../core/accessorSupport/decorators/reader.js";let G=class extends(y(S(_(v(s(g(f(o(h))))))))){readModifications(e,t,o){this._modificationsSource={url:D(e,o),context:o}}initialize(){this.addHandles(n(()=>this.modifications,"after-changes",()=>this.modifications=this.modifications,l))}constructor(e){super(e),this.operationalLayerType="IntegratedMesh3DTilesLayer",this.modifications=null,this._modificationsSource=null,this.spatialReference=b,this.fullExtent=L,this.url=null,this.type="integrated-mesh-3dtiles",this.path=null,this.minScale=0,this.maxScale=0,this._rootTilesetJSON=null,this._rootTileset=null,this._key=null,this._session=null,this._rootRequestPromise=null,this.queryElevationCallback=null}set elevationInfo(e){null!=e&&"absolute-height"!==e.mode||this._set("elevationInfo",e),this._validateElevationInfo(e)}async load(e){return this.addResolvingPromise(this._doLoad(e)),this}get rootTilesetJSON(){return this._rootTilesetJSON}get rootTileset(){return this._rootTileset}get key(){return this._key}get session(){return this._session}_findSessionParameter(e){const t=[e];for(;t?.length>0;){const e=t.pop();if(!e)return;for(const[r,i]of Object.entries(e)){if("uri"===r)try{const e=new URL("https://tmp"+i).searchParams.get("session");if(e)return e}catch(o){}"object"==typeof i&&null!==i&&t.push(i)}}return null}async requestRootAndSession(e){const o=(e,t)=>new r("3dtiles-init:"+e,t);return this._rootRequestPromise||(this._rootRequestPromise=new Promise((r,s)=>{this.url||s(o("url-missing","Layer url missing")),this._key=this.customParameters?this.customParameters.key:null;new Promise((e,r)=>{if(this.replacesTerrain&&!this._key){const i=this.portalItem?.portal||this.parent?.portalItem?.portal||P.getDefault();i.signIn().then(()=>{i.g3dTilesEnabled?t(i.restUrl+"/portals/self/modules/g3dtiles",{responseType:"json",query:{f:"json"}}).then(t=>{this._key=t.data.keyString,e()},()=>r(o("g3dtiles-key-error","Error fetching Google 3D Tiles key from portal"))):r(o("g3dTilesEnabled-false","Google 3D Tiles are not enabled on Portal "+i.url))},()=>r(o("sign-in-failed","Error signing in to Portal")))}else e()}).then(()=>{t(this.url,{query:this._key?{key:this._key,token:this.apiKey}:{token:this.apiKey},responseType:"array-buffer",signal:e}).then(e=>{try{this._rootTilesetJSON=JSON.parse((new TextDecoder).decode(e.data))}catch(t){return void s(o("root-parse-failed","Error parsing root tile, details: "+t))}this._rootTilesetJSON?(this._session=this._findSessionParameter(this._rootTilesetJSON),this._rootTileset=e.data,this.fullExtent=x(this._rootTilesetJSON),r(),this._rootRequestPromise=null):s(o("root-is-null","Root tile is null."))},e=>{a(e),s(o("root-load-failed","Error loading root tile")),this._rootRequestPromise=null,i.getLogger("IntegratedMesh3DTilesLayer").error("Layer loading failed",e)})},e=>s(e))})),this._rootRequestPromise}async _doLoad(e){const t=null!=e?e.signal:null;if(this.isUsedAsGroundLayer&&!has("enable-feature:basemap-groundlayers"))throw new r("3dtiles-init:not-supported-in-groundlayers","Layer is not supported in basemap.");try{await this.loadFromPortal({supportedTypes:["3DTiles Service"],validateItem:e=>{if(e.typeKeywords?.includes("IntegratedMesh"))return!0;throw new r("portal:invalid-layer-item-type","Invalid layer item, expected '${expectedType}' ",{expectedType:"3DTiles Service containing IntegratedMesh"})}},e)}catch(o){a(o)}if(null!=this._modificationsSource){const t=await w.fromUrl(this._modificationsSource.url,this.spatialReference,e);if(t&&t.length>0){await E();try{const e=M(null,t.toArray(),this.spatialReference),o=O({modifications:e,inVCS:115700});o.success&&o.modifications&&q(o.modifications,t)}catch(s){i.getLogger(this).error("convert-mesh-modification-z-error","Error when converting:",s)}null!=this._modificationsSource&&this.setAtOrigin("modifications",t,this._modificationsSource.context.origin),this._modificationsSource=null}}await this.requestRootAndSession(t)}async beforeSave(){if(null==this._modificationsSource){const{modifications:e}=this;return void(e&&e.length>0&&await E())}await this.load().then(()=>{},()=>{})}get hasAttributionData(){return!1}_validateElevationInfo(e){const t="Integrated mesh 3d tiles layers";I(i.getLogger(this),k(t,"absolute-height",e)),I(i.getLogger(this),R(t,e))}get replacesTerrain(){return!!has("enable-feature:basemap-groundlayers")&&this.hasGoogleUrl&&this.isUsedAsGroundLayer}get isUsedAsGroundLayer(){return U(this.parent)}get hasGoogleUrl(){return!!this.url?.match(/.+\.googleapis.com/)}};e([p({type:["IntegratedMesh3DTilesLayer"]})],G.prototype,"operationalLayerType",void 0),e([p({type:w,clonable:e=>e?.clone()??null}),c({origins:["web-scene","portal-item"],type:"resource",prefix:"modifications"})],G.prototype,"modifications",void 0),e([p({clonable:e=>e?{...e}:null})],G.prototype,"_modificationsSource",void 0),e([A(["web-scene","portal-item"],"modifications")],G.prototype,"readModifications",null),e([p({type:u})],G.prototype,"spatialReference",void 0),e([p({type:d})],G.prototype,"fullExtent",void 0),e([p(j)],G.prototype,"elevationInfo",null),e([p({type:["show","hide"]})],G.prototype,"listMode",void 0),e([p(T)],G.prototype,"url",void 0),e([p({readOnly:!0})],G.prototype,"type",void 0),e([p({type:String,json:{origins:{"web-scene":{read:!0,write:!0},"portal-item":{read:!0,write:!0}},read:!1}})],G.prototype,"path",void 0),e([p({type:Number,json:{name:"layerDefinition.minScale",write:!0,origins:{service:{read:!1,write:!1}}}})],G.prototype,"minScale",void 0),e([p({type:Number,json:{name:"layerDefinition.maxScale",write:!0,origins:{service:{read:!1,write:!1}}}})],G.prototype,"maxScale",void 0),e([p({readOnly:!0})],G.prototype,"hasAttributionData",null),e([p()],G.prototype,"replacesTerrain",null),e([p()],G.prototype,"isUsedAsGroundLayer",null),e([p()],G.prototype,"hasGoogleUrl",null),G=e([m("esri.layers.IntegratedMesh3DTilesLayer")],G);const N=G;export{N as default};
2
+ import{__decorate as e}from"tslib";import t from"../request.js";import{ClonableMixin as r}from"../core/Clonable.js";import i from"../core/Error.js";import has from"../core/has.js";import o from"../core/Logger.js";import{MultiOriginJSONSupportMixin as s}from"../core/MultiOriginJSONSupport.js";import{throwIfAbortError as n}from"../core/promiseUtils.js";import{on as a,sync as l}from"../core/reactiveUtils.js";import{property as p,subclass as c}from"../core/accessorSupport/decorators.js";import{persistable as m}from"../core/accessorSupport/decorators/persistable.js";import u from"../geometry/Extent.js";import d from"../geometry/SpatialReference.js";import h from"./Layer.js";import{APIKeyMixin as f}from"./mixins/APIKeyMixin.js";import{ArcGISService as y}from"./mixins/ArcGISService.js";import{CustomParametersMixin as g}from"./mixins/CustomParametersMixin.js";import{OperationalLayer as S}from"./mixins/OperationalLayer.js";import{PortalLayer as _}from"./mixins/PortalLayer.js";import{ScaleRangeLayer as v}from"./mixins/ScaleRangeLayer.js";import{elevationInfo as j,url as T}from"./support/commonProperties.js";import x from"./support/SceneModifications.js";import{default3DTilesSpatialReference as w,default3DTilesFullExtent as b,initFullExtent as R,hasEsriCrs as L}from"./support/tiles3DUtils.js";import E from"../portal/Portal.js";import{logInvalidElevationInfoWarning as P,elevationModeRequiredMessage as k,featureExpressionUnsupportedMessage as I}from"../support/elevationInfoUtils.js";import{a as O}from"../chunks/persistableUrlUtils.js";import{isBasemap as D}from"../support/userTypeGuards/isBasemap.js";import{initialize as U,switchMeshModificationPolygonVCSSync as M}from"../views/3d/layers/Lyr3DWorker.js";import{toWasmModification as C,fromWasmModification as G}from"../views/3d/layers/SceneLayerWorkerHandle.js";import{reader as N}from"../core/accessorSupport/decorators/reader.js";let q=class extends(y(S(_(v(s(g(f(r(h))))))))){readModifications(e,t,r){this._modificationsSource={url:O(e,r),context:r}}initialize(){this.addHandles(a(()=>this.modifications,"after-changes",()=>this.modifications=this.modifications,l))}constructor(e){super(e),this.operationalLayerType="IntegratedMesh3DTilesLayer",this.modifications=null,this._modificationsSource=null,this.spatialReference=w,this.fullExtent=b,this.esriCrsSpatialReference=null,this.esriCrsFullExtent=null,this.url=null,this.type="integrated-mesh-3dtiles",this.path=null,this.minScale=0,this.maxScale=0,this._rootTilesetJSON=null,this._rootTileset=null,this._key=null,this._session=null,this._rootRequestPromise=null,this.queryElevationCallback=null}get supportedSpatialReferences(){return this.initialized&&this.esriCrsSpatialReference?[w,this.esriCrsSpatialReference]:[w]}get fullExtents(){return this.initialized&&this.esriCrsFullExtent?[b,this.esriCrsFullExtent]:[b]}set elevationInfo(e){null!=e&&"absolute-height"!==e.mode||this._set("elevationInfo",e),this._validateElevationInfo(e)}async load(e){return this.addResolvingPromise(this._doLoad(e)),this}get rootTilesetJSON(){return this._rootTilesetJSON}get rootTileset(){return this._rootTileset}get key(){return this._key}get session(){return this._session}_findSessionParameter(e){const t=[e];for(;t?.length>0;){const e=t.pop();if(!e)return;for(const[i,o]of Object.entries(e)){if("uri"===i)try{const e=new URL("https://tmp"+o).searchParams.get("session");if(e)return e}catch(r){}"object"==typeof o&&null!==o&&t.push(o)}}return null}async requestRootAndSession(e){const r=(e,t)=>new i("3dtiles-init:"+e,t);return this._rootRequestPromise||(this._rootRequestPromise=new Promise((i,s)=>{this.url||s(r("url-missing","Layer url missing")),this._key=this.customParameters?this.customParameters.key:null;new Promise((e,i)=>{if(this.replacesTerrain&&!this._key){const o=this.portalItem?.portal||this.parent?.portalItem?.portal||E.getDefault();o.signIn().then(()=>{o.g3dTilesEnabled?t(o.restUrl+"/portals/self/modules/g3dtiles",{responseType:"json",query:{f:"json"}}).then(t=>{this._key=t.data.keyString,e()},()=>i(r("g3dtiles-key-error","Error fetching Google 3D Tiles key from portal"))):i(r("g3dTilesEnabled-false","Google 3D Tiles are not enabled on Portal "+o.url))},()=>i(r("sign-in-failed","Error signing in to Portal")))}else e()}).then(()=>{t(this.url,{query:this._key?{key:this._key,token:this.apiKey}:{token:this.apiKey},responseType:"array-buffer",signal:e}).then(e=>{try{this._rootTilesetJSON=JSON.parse((new TextDecoder).decode(e.data))}catch(t){return void s(r("root-parse-failed","Error parsing root tile, details: "+t))}if(!this._rootTilesetJSON)return void s(r("root-is-null","Root tile is null."));this._session=this._findSessionParameter(this._rootTilesetJSON),this._rootTileset=e.data,this.fullExtent=R(this._rootTilesetJSON);L(this._rootTilesetJSON)&&(this.esriCrsFullExtent=R(this._rootTilesetJSON,!0),this.esriCrsSpatialReference=this.esriCrsFullExtent.spatialReference,this.spatialReference=this.esriCrsSpatialReference),i(),this._rootRequestPromise=null},e=>{n(e),s(r("root-load-failed","Error loading root tile")),this._rootRequestPromise=null,o.getLogger("IntegratedMesh3DTilesLayer").error("Layer loading failed",e)})},e=>s(e))})),this._rootRequestPromise}_haveWGS84ZModifications(e){for(const t of e){if(!t.geometry?.spatialReference)return!0;if(115700===t.geometry?.spatialReference.vcsWkid&&4326===t.geometry?.spatialReference.wkid)return!0}return!1}async _doLoad(e){const t=null!=e?e.signal:null;if(this.isUsedAsGroundLayer&&!has("enable-feature:basemap-groundlayers"))throw new i("3dtiles-init:not-supported-in-groundlayers","Layer is not supported in basemap.");try{await this.loadFromPortal({supportedTypes:["3DTiles Service"],validateItem:e=>{if(e.typeKeywords?.includes("IntegratedMesh"))return!0;throw new i("portal:invalid-layer-item-type","Invalid layer item, expected '${expectedType}' ",{expectedType:"3DTiles Service containing IntegratedMesh"})}},e)}catch(r){n(r)}if(null!=this._modificationsSource){const t=await x.fromUrl(this._modificationsSource.url,this.spatialReference,e,!0);if(this._haveWGS84ZModifications(t)){await U();try{const e=C(null,t.toArray(),d.WGS84),r=M({modifications:e,inVCS:115700});r.success&&r.modifications&&G(r.modifications,t)}catch(s){o.getLogger(this).error("convert-mesh-modification-z-error","Error when converting:",s)}}this.setAtOrigin("modifications",t,this._modificationsSource.context.origin),this._modificationsSource=null}await this.requestRootAndSession(t)}async beforeSave(){if(null==this._modificationsSource){const{modifications:e}=this;return void(e&&e.length>0&&await U())}await this.load().then(()=>{},()=>{})}get hasAttributionData(){return!1}_validateElevationInfo(e){const t="Integrated mesh 3d tiles layers";P(o.getLogger(this),k(t,"absolute-height",e)),P(o.getLogger(this),I(t,e))}get replacesTerrain(){return!!has("enable-feature:basemap-groundlayers")&&this.hasGoogleUrl&&this.isUsedAsGroundLayer}get isUsedAsGroundLayer(){return D(this.parent)}get hasGoogleUrl(){return!!this.url?.match(/.+\.googleapis.com/)}};e([p({type:["IntegratedMesh3DTilesLayer"]})],q.prototype,"operationalLayerType",void 0),e([p({type:x,clonable:e=>e?.clone()??null}),m({origins:["web-scene","portal-item"],type:"resource",prefix:"modifications"})],q.prototype,"modifications",void 0),e([p({clonable:e=>e?{...e}:null})],q.prototype,"_modificationsSource",void 0),e([N(["web-scene","portal-item"],"modifications")],q.prototype,"readModifications",null),e([p({type:d})],q.prototype,"spatialReference",void 0),e([p({type:u})],q.prototype,"fullExtent",void 0),e([p({readOnly:!0})],q.prototype,"supportedSpatialReferences",null),e([p({type:[u]})],q.prototype,"fullExtents",null),e([p(j)],q.prototype,"elevationInfo",null),e([p({type:["show","hide"]})],q.prototype,"listMode",void 0),e([p(T)],q.prototype,"url",void 0),e([p({readOnly:!0})],q.prototype,"type",void 0),e([p({type:String,json:{origins:{"web-scene":{read:!0,write:!0},"portal-item":{read:!0,write:!0}},read:!1}})],q.prototype,"path",void 0),e([p({type:Number,json:{name:"layerDefinition.minScale",write:!0,origins:{service:{read:!1,write:!1}}}})],q.prototype,"minScale",void 0),e([p({type:Number,json:{name:"layerDefinition.maxScale",write:!0,origins:{service:{read:!1,write:!1}}}})],q.prototype,"maxScale",void 0),e([p({readOnly:!0})],q.prototype,"hasAttributionData",null),e([p()],q.prototype,"replacesTerrain",null),e([p()],q.prototype,"isUsedAsGroundLayer",null),e([p()],q.prototype,"hasGoogleUrl",null),q=e([c("esri.layers.IntegratedMesh3DTilesLayer")],q);const A=q;export{A 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 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 f}from"./Lyr3DWorkerHandle.js";import{getVCSFromHeightModelInfo as b}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 R}from"../views/support/Scheduler.js";import{Yield as k}from"../views/support/Yield.js";const L=3857,C=32662,S=4326,W=5773;let j=class extends t{constructor(e){super(e),this._lyr3DMainPromise=null,this._lyr3DMain=null,this._layers=new Map,this._viewSR=null,this._haveAddedViewSRForNoOpPrj=!1,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._jobDataBufferPtr=0,this._jobDataBufferCapacity=0,this._debugFlags=new Set,this._debugLevel=2,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 viewSR(){return this._viewSR}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(R.LYR3D,this)}destroy(){this._debugLog(0,3,"Lyr3DWasmPerSceneView.destroy()"),this._lyr3DMain&&(this._jobDataBufferPtr&&(this._lyr3DMain._free(this._jobDataBufferPtr),this._jobDataBufferPtr=0,this._jobDataBufferCapacity=0),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();let d="global"===this.view.viewingMode?6:4;6===d?(this._viewSR.wkid=this._viewSR.latestWkid=S,this._viewSR.vcsWkid=this._viewSR.latestVcsWkid=W,this._viewSR.wkt=""):(this._viewSR.vcsWkid||(this._viewSR.vcsWkid=b(this.view.heightModelInfo)),this.view.renderSpatialReference?.isWebMercator?(this._viewSR.wkid=this._viewSR.latestWkid=L,this._viewSR.vcsWkid||(this._viewSR.vcsWkid=this._viewSR.latestVcsWkid=W)):this.view.renderSpatialReference?.wkid===C?(this._viewSR.wkid=this._viewSR.latestWkid=S,d=3,this._viewSR.vcsWkid||(this._viewSR.vcsWkid=this._viewSR.latestVcsWkid=W)):this._viewSR.vcsWkid||this._viewSR.latestVcsWkid||(this._viewSR.vcsWkid=this._viewSR.latestVcsWkid=-1));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 f(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===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===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=this._ensureJobDataBuffer(r);new Uint8Array(e.HEAPU8.buffer,a,r).set(s),e.on_job_completed(t.jobId,i.jobDescJson,a,r)};this._pendingJobCompleted.push(r)}this._decrementJobCount(e,t)}_ensureJobDataBuffer(e){return e<=this._jobDataBufferCapacity&&this._jobDataBufferPtr||(this._jobDataBufferPtr&&this._lyr3DMain._free(this._jobDataBufferPtr),this._jobDataBufferPtr=this._lyr3DMain._malloc(e),this._jobDataBufferCapacity=e),this._jobDataBufferPtr}_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=>{if(this._lyr3DMain&&!t.layerView.destroyed){const{layerId:t,handle:s}=e;this._pendingRenderableCreated.push(e=>{const r=i(),{memUsageBytes:a}=r;e.on_renderable_created(!0,t,s,a,r.numGaussians??0)})}}).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))}}).finally(()=>{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),!this._haveAddedViewSRForNoOpPrj&&t.vcsWkid&&this._viewSR.vcsWkid&&-1!==this._viewSR.vcsWkid&&this._viewSR.vcsWkid!==t.vcsWkid&&(this._workerHandle.addSpatialReferenceInfo(this._cleanUpSR(this._makeSRWasmSerializable(this._viewSR)),!1,1,1).catch(d),this._haveAddedViewSRForNoOpPrj=!0)}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 V=j;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 f}from"./Lyr3DWorkerHandle.js";import{getVCSFromHeightModelInfo as b}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 R}from"../views/support/Yield.js";const k=3857,C=32662,S=4326,W=5773;let j=class extends t{constructor(e){super(e),this._lyr3DMainPromise=null,this._lyr3DMain=null,this._layers=new Map,this._viewSR=null,this._haveAddedViewSRForNoOpPrj=!1,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._jobDataBufferPtr=0,this._jobDataBufferCapacity=0,this._debugFlags=new Set,this._debugLevel=2,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 viewSR(){return this._viewSR}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._jobDataBufferPtr&&(this._lyr3DMain._free(this._jobDataBufferPtr),this._jobDataBufferPtr=0,this._jobDataBufferCapacity=0),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),R}_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();let d="global"===this.view.viewingMode?6:4;6===d?(this._viewSR.wkid=this._viewSR.latestWkid=S,this._viewSR.vcsWkid=this._viewSR.latestVcsWkid=W,this._viewSR.wkt=""):(this._viewSR.vcsWkid||(this._viewSR.vcsWkid=b(this.view.heightModelInfo)),this.view.renderSpatialReference?.isWebMercator?(this._viewSR.wkid=this._viewSR.latestWkid=k,this._viewSR.vcsWkid||(this._viewSR.vcsWkid=this._viewSR.latestVcsWkid=W)):this.view.renderSpatialReference?.wkid===C?(this._viewSR.wkid=this._viewSR.latestWkid=S,d=3,this._viewSR.vcsWkid||(this._viewSR.vcsWkid=this._viewSR.latestVcsWkid=W)):this._viewSR.vcsWkid||this._viewSR.latestVcsWkid||(this._viewSR.vcsWkid=this._viewSR.latestVcsWkid=-1));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 f(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===k?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=this._ensureJobDataBuffer(r);new Uint8Array(e.HEAPU8.buffer,a,r).set(s),e.on_job_completed(t.jobId,i.jobDescJson,a,r)};this._pendingJobCompleted.push(r)}this._decrementJobCount(e,t)}_ensureJobDataBuffer(e){return e<=this._jobDataBufferCapacity&&this._jobDataBufferPtr||(this._jobDataBufferPtr&&this._lyr3DMain._free(this._jobDataBufferPtr),this._jobDataBufferPtr=this._lyr3DMain._malloc(e),this._jobDataBufferCapacity=e),this._jobDataBufferPtr}_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=>{if(this._lyr3DMain&&!t.layerView.destroyed){const{layerId:t,handle:s}=e;this._pendingRenderableCreated.push(e=>{const r=i(),{memUsageBytes:a}=r;e.on_renderable_created(!0,t,s,a,r.numGaussians??0)})}}).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))}}).finally(()=>{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}_is3DTilesIMLayer(e){return"integrated-mesh-3dtiles"===e.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)||this._is3DTilesIMLayerView(e)&&this._is3DTilesIMLayer(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),!this._haveAddedViewSRForNoOpPrj&&t.vcsWkid&&this._viewSR.vcsWkid&&-1!==this._viewSR.vcsWkid&&this._viewSR.vcsWkid!==t.vcsWkid&&(this._workerHandle.addSpatialReferenceInfo(this._cleanUpSR(this._makeSRWasmSerializable(this._viewSR)),!1,1,1).catch(d),this._haveAddedViewSRForNoOpPrj=!0)}this._isGaussianSplatLayerView(e)?h=this._lyr3DMain.add_gaussian_splat_layer(l,i.url,a,o):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 V=j;export{V as default};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- const t={supportsStatistics:!0,supportsPercentileStatistics:!0,supportsSpatialAggregationStatistics:!0,supportedSpatialAggregationStatistics:{envelope:!0,centroid:!0,convexHull:!0},supportsStatisticsAggregatedIds:!0,supportsCentroid:!0,supportsCentroidOnDegeneratedQuantizedGeometry:!0,supportsCacheHint:!0,supportsCurrentUser:!1,supportsDegeneratedQuantizedGeometry:!1,supportsDistance:!0,supportsOutDistance:!0,supportsDistinct:!0,supportsExtent:!0,supportsGeometryProperties:!1,supportsHavingClause:!0,supportsOrderBy:!0,supportsPagination:!0,supportsPaginationOnAggregatedQueries:!1,supportsQuantization:!0,supportsQuantizationEditMode:!1,supportsQueryGeometry:!0,supportsResultType:!0,supportsReturnMesh:!1,supportsReturnExceededLimitGeometries:!1,supportsSqlExpression:!0,supportsMaxRecordCountFactor:!1,supportsStandardizedQueriesOnly:!0,supportsTopFeaturesQuery:!1,supportsQueryByAnonymous:!0,supportsQueryByOthers:!0,supportsHistoricMoment:!1,supportsFormatPBF:!1,supportsFormatPBFWithCurves:!1,supportsDisjointSpatialRelationship:!0,supportsDefaultSpatialReference:!1,supportsFullTextSearch:!1,supportsCompactGeometry:!1,maxRecordCountFactor:void 0,maxRecordCount:void 0,maxUniqueIDCount:void 0,relativeTimeBinWindow:0,standardMaxRecordCount:void 0,standardMaxRecordCountNoGeometry:void 0,tileMaxRecordCount:void 0,supportsTrueCurve:!1},s={supportsDate:!0,supportsFixedInterval:!0,supportsAutoInterval:!0,supportsFixedBoundaries:!0,supportsStackBy:!0,supportsSplitBy:!0,supportsSnapToData:!1,supportsReturnFullIntervalBin:!1,supportsFirstDayOfWeek:!1,supportsNormalization:!0,supportedStatistics:{count:!0,sum:!0,avg:!0,var:!0,stddev:!0,min:!0,max:!0,percentileContinuous:!0,percentileDiscrete:!0,envelope:!0,centroid:!0,convexHull:!0},supportedNormalizationTypes:{field:!0,log:!0,naturalLog:!0,percentOfTotal:!0,squareRoot:!0}};export{s as queryBinsCapabilities,t as queryCapabilities};
2
+ const t={supportsStatistics:!0,supportsPercentileStatistics:!0,supportsSpatialAggregationStatistics:!0,supportedSpatialAggregationStatistics:{envelope:!0,centroid:!0,convexHull:!0},supportsStatisticsAggregatedIds:!0,supportsCentroid:!0,supportsCentroidOnDegeneratedQuantizedGeometry:!0,supportsCacheHint:!0,supportsCurrentUser:!1,supportsDegeneratedQuantizedGeometry:!1,supportsDistance:!0,supportsOutDistance:!1,supportsDistinct:!0,supportsExtent:!0,supportsGeometryProperties:!1,supportsHavingClause:!0,supportsOrderBy:!0,supportsPagination:!0,supportsPaginationOnAggregatedQueries:!1,supportsQuantization:!0,supportsQuantizationEditMode:!1,supportsQueryGeometry:!0,supportsResultType:!0,supportsReturnMesh:!1,supportsReturnExceededLimitGeometries:!1,supportsSqlExpression:!0,supportsMaxRecordCountFactor:!1,supportsStandardizedQueriesOnly:!0,supportsTopFeaturesQuery:!1,supportsQueryByAnonymous:!0,supportsQueryByOthers:!0,supportsHistoricMoment:!1,supportsFormatPBF:!1,supportsFormatPBFWithCurves:!1,supportsDisjointSpatialRelationship:!0,supportsDefaultSpatialReference:!1,supportsFullTextSearch:!1,supportsCompactGeometry:!1,maxRecordCountFactor:void 0,maxRecordCount:void 0,maxUniqueIDCount:void 0,relativeTimeBinWindow:0,standardMaxRecordCount:void 0,standardMaxRecordCountNoGeometry:void 0,tileMaxRecordCount:void 0,supportsTrueCurve:!1},s={supportsDate:!0,supportsFixedInterval:!0,supportsAutoInterval:!0,supportsFixedBoundaries:!0,supportsStackBy:!0,supportsSplitBy:!0,supportsSnapToData:!1,supportsReturnFullIntervalBin:!1,supportsFirstDayOfWeek:!1,supportsNormalization:!0,supportedStatistics:{count:!0,sum:!0,avg:!0,var:!0,stddev:!0,min:!0,max:!0,percentileContinuous:!0,percentileDiscrete:!0,envelope:!0,centroid:!0,convexHull:!0},supportedNormalizationTypes:{field:!0,log:!0,naturalLog:!0,percentOfTotal:!0,squareRoot:!0}};export{s as queryBinsCapabilities,t as queryCapabilities};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import t from"../../../../request.js";import{FileProvider as e}from"./FileProvider.js";const s=100;class r extends e{constructor(t,e){super(e),this._schema=t}get _baseUrl(){return this._schema.itemCdnUrl??this._schema.itemUrl}async getFileList(){const t=await this._getResources();return Array.from(t.keys())}async getResource(t){const e=(await this._getResources()).get(t);if(!e)throw new Error(`Resource ${t} not found.`);return e}async fetchLength(t){return(await this.getResource(t)).size}async fetchRange(t,e,s,r){try{return await super.fetchRange(t,e,s,r)}catch{this._invalidate()}return super.fetchRange(t,e,s,r)}async _resolveFileUrl(t){return(await this.getResource(t)).signedUrl}_invalidate(){this._resources=null,this._itemData=null}async _getResources(){return this._resources||(this._resources=this._fetchResources()),await this._resources}async _getItemData(){return this._itemData||(this._itemData=this._fetchItemData()),await this._itemData}async _fetchItemData(){const{data:e}=await t(`${this._baseUrl}/data`);return e}async _fetchResources(){const e=this._getItemData(),r=new Map;let a=1;for(;-1!==a;){const i=await t(`${this._baseUrl}/resources`,{query:{f:"json",start:a,num:s}}),c=`${(await e).directory}/`;for(const t of i.data.resources)t.resource.startsWith(c)&&r.set(t.resource,t);a=i.data.nextStart}return r}}export{r as PortalParquetResourcesFileProvider};
2
+ import e from"../../../../request.js";import{FileProvider as t}from"./FileProvider.js";const r=100;class s extends t{constructor(e,t){super(t),this._schema=e}get _baseUrl(){return this._schema.itemCdnUrl??this._schema.itemUrl}async getFileList(){const e=await this._getResources();return Array.from(e.keys())}async getResource(e){const t=(await this._getResources()).get(e);if(!t)throw new Error(`Resource ${e} not found.`);return t}async fetchLength(e){return(await this.getResource(e)).size}async fetchRange(e,t,r,s){try{return await super.fetchRange(e,t,r,s)}catch{this._invalidate()}return super.fetchRange(e,t,r,s)}async _resolveFileUrl(e){return(await this.getResource(e)).signedUrl}_invalidate(){this._resources=null}async _getResources(){return this._resources||(this._resources=this._fetchResources()),await this._resources}async _fetchResources(){const t=new Map;let s=1;const n=o(this._schema.itemMetadata.url);for(;-1!==s;){const o=await e(`${this._baseUrl}/resources`,{query:{f:"json",start:s,num:r}});for(const e of o.data.resources)e.resource.startsWith(n)&&t.set(e.resource,e);s=o.data.nextStart}return t}}function o(e){const t=e.split("/").filter(Boolean),r=t.indexOf("resources");if(-1===r||r===t.length-1)throw new Error(`URL does not contain a resources directory name: ${e}`);return`${t.slice(r+1).map(e=>decodeURIComponent(e)).join("/")}/`}export{s as PortalParquetResourcesFileProvider};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import{JSONSupport as t}from"../../core/JSONSupport.js";import{clone as r}from"../../core/lang.js";import o from"../../core/Warning.js";import{property as i,subclass as s}from"../../core/accessorSupport/decorators.js";import{persistable as a}from"../../core/accessorSupport/decorators/persistable.js";import c from"../../geometry/Polygon.js";import{canProjectWithoutEngine as n,projectPolygon as p}from"../../geometry/projectionUtils.js";import{isInitialized as l,switchMeshModificationPolygonVCSSync as m}from"../../views/3d/layers/Lyr3DWorker.js";import{toWasmModification as f,fromWasmModification as y}from"../../views/3d/layers/SceneLayerWorkerHandle.js";import{writer as d}from"../../core/accessorSupport/decorators/writer.js";var u;let g=u=class extends t{constructor(e){super(e),this.geometry=null,this.type="clip"}writeGeometry(e,t,r,i){if(i.layer?.spatialReference&&115700===i.layer?.spatialReference.vcsWkid)this._write3DTilesModificationGeometry(e,t,r,i);else if(i.layer?.spatialReference&&!i.layer.spatialReference.equals(this.geometry.spatialReference)){if(!n(e.spatialReference,i.layer.spatialReference))return void(i?.messages&&i.messages.push(new o("scenemodification:unsupported","Scene modifications with incompatible spatial references are not supported",{modification:this,spatialReference:i.layer.spatialReference,context:i})));const s=new c;p(e,s,i.layer.spatialReference),t[r]=s.toJSON(i)}else t[r]=e.toJSON(i)}_write3DTilesModificationGeometry(e,t,r,i){if(i.layer?.spatialReference&&115700===i.layer?.spatialReference.vcsWkid){let e=!0;if(l()){const o=f(null,[this],i.layer?.spatialReference);if(o.length>1){const s=m({modifications:o,inVCS:5773});if(s.success&&s.modifications){const o=[this.clone()];y(s.modifications,o),1===o.length&&o[0].geometry&&(o[0].geometry.spatialReference=i.layer?.spatialReference,t[r]=o[0].geometry.toJSON(i),e=!1)}}}e&&i?.messages&&i.messages.push(new o("scenemodification:unsupported","Scene modifications with incompatible spatial references are not supported",{modification:this,spatialReference:i.layer.spatialReference,context:i}))}}clone(){return new u({geometry:r(this.geometry),type:this.type})}};e([i({type:c}),a()],g.prototype,"geometry",void 0),e([d(["web-scene","portal-item"],"geometry")],g.prototype,"writeGeometry",null),e([i({type:["clip","mask","replace"],nonNullable:!0}),a()],g.prototype,"type",void 0),g=u=e([s("esri.layers.support.SceneModification")],g);export{g as default};
2
+ import{__decorate as e}from"tslib";import{JSONSupport as r}from"../../core/JSONSupport.js";import{clone as t}from"../../core/lang.js";import o from"../../core/Warning.js";import{property as s,subclass as i}from"../../core/accessorSupport/decorators.js";import{persistable as a}from"../../core/accessorSupport/decorators/persistable.js";import n from"../../geometry/Polygon.js";import{canProjectWithoutEngine as p,projectPolygon as c}from"../../geometry/projectionUtils.js";import l from"../../geometry/SpatialReference.js";import{equals as m}from"../../geometry/support/spatialReferenceUtils.js";import{isInitialized as f,switchMeshModificationPolygonVCSSync as y}from"../../views/3d/layers/Lyr3DWorker.js";import{toWasmModification as d,fromWasmModification as u}from"../../views/3d/layers/SceneLayerWorkerHandle.js";import{writer as g}from"../../core/accessorSupport/decorators/writer.js";var S;let h=S=class extends r{constructor(e){super(e),this.geometry=null,this.type="clip"}writeGeometry(e,r,t,s){if(this._needWGS84Conversion(s))this._doWGS84Conversion(r,t,s);else if(s.layer?.spatialReference&&!s.layer.spatialReference.equals(this.geometry.spatialReference)){if(!p(e.spatialReference,s.layer.spatialReference))return void(s?.messages&&s.messages.push(new o("scenemodification:unsupported","Scene modifications with incompatible spatial references are not supported",{modification:this,spatialReference:s.layer.spatialReference,context:s})));const i=new n;c(e,i,s.layer.spatialReference),r[t]=i.toJSON(s)}else r[t]=e.toJSON(s)}_needWGS84Conversion(e){if("integrated-mesh-3dtiles"===e.layer?.type){const r=e.layer;return!r.esriCrsSpatialReference||!m(r.esriCrsSpatialReference,this.geometry.spatialReference)}return!1}_doWGS84Conversion(e,r,t){let s=!0;if(f()){const o=d(null,[this],l.WGS84);if(o.length>1){const i=y({modifications:o,inVCS:5773});if(i.success&&i.modifications){const o=[this.clone()];u(i.modifications,o),1===o.length&&o[0].geometry&&(o[0].geometry.spatialReference=t.layer?.spatialReference,e[r]=o[0].geometry.toJSON(t),s=!1)}}}s&&t?.messages&&t.messages.push(new o("scenemodification:unsupported","Scene modifications with incompatible spatial references are not supported",{modification:this,spatialReference:t.layer?.spatialReference,context:t}))}clone(){return new S({geometry:t(this.geometry),type:this.type})}};e([s({type:n}),a()],h.prototype,"geometry",void 0),e([g(["web-scene","portal-item"],"geometry")],h.prototype,"writeGeometry",null),e([s({type:["clip","mask","replace"],nonNullable:!0}),a()],h.prototype,"type",void 0),h=S=e([i("esri.layers.support.SceneModification")],h);export{h as default};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{__decorate as r}from"tslib";import o from"../../request.js";import t from"../../core/Collection.js";import{JSONSupportMixin as e}from"../../core/JSONSupport.js";import{urlToObject as s}from"../../core/urlUtils.js";import{property as i,subclass as n}from"../../core/accessorSupport/decorators.js";import c from"./SceneModification.js";var m;let p=m=class extends(e(t.ofType(c))){constructor(r){super(r),this.url=null}clone(){return new m({url:this.url,items:this.items.map(r=>r.clone())})}toJSON(r){return this.toArray().map(o=>o.toJSON(r)).filter(r=>!!r.geometry)}static fromJSON(r,o){const t=new m;for(const e of r)t.add(c.fromJSON(e,o));return t}static async fromUrl(r,t,e){const i={url:s(r),origin:"service"},n=await o(r,{responseType:"json",signal:e?.signal}),p=t.toJSON(),a=[];for(const o of n.data)a.push(c.fromJSON({...o,geometry:{spatialReference:p,...o.geometry}},i));return new m({url:r,items:a})}};r([i({type:String})],p.prototype,"url",void 0),p=m=r([n("esri.layers.support.SceneModifications")],p);export{p as default};
2
+ import{__decorate as r}from"tslib";import e from"../../request.js";import o from"../../core/Collection.js";import{JSONSupportMixin as t}from"../../core/JSONSupport.js";import{urlToObject as s}from"../../core/urlUtils.js";import{property as i,subclass as n}from"../../core/accessorSupport/decorators.js";import a from"./SceneModification.js";var c;let m=c=class extends(t(o.ofType(a))){constructor(r){super(r),this.url=null}clone(){return new c({url:this.url,items:this.items.map(r=>r.clone())})}toJSON(r){return this.toArray().map(e=>e.toJSON(r)).filter(r=>!!r.geometry)}static fromJSON(r,e){const o=new c;for(const t of r)o.add(a.fromJSON(t,e));return o}static async fromUrl(r,o,t,i=!1){const n={url:s(r),origin:"service"},m=await e(r,{responseType:"json",signal:t?.signal}),l=o.toJSON(),p=[];for(const e of m.data){let r=l;i&&e.geometry.spatialReference&&(r=e.geometry.spatialReference),p.push(a.fromJSON({...e,geometry:{spatialReference:r,...e.geometry}},n))}return new c({url:r,items:p})}};r([i({type:String})],m.prototype,"url",void 0),m=c=r([n("esri.layers.support.SceneModifications")],m);export{m as default};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import e from"../../core/Collection.js";import t from"../../core/Error.js";import{JSONMap as o}from"../../core/jsonMap.js";import i from"../../geometry/SpatialReference.js";import{createFileProvider as r}from"../graphics/sources/parquet/createFileProvider.js";import n from"./Field.js";import{isNumericField as s}from"./fieldUtils.js";import l from"./GeometryEncodingLocation.js";import a from"./GeometryEncodingWkb.js";import{inferLocationInfo as p}from"./locationUtils.js";import c from"./ParquetFilesData.js";import{createParquetFile as u,readGeoMetadata as m,readGeodisplayMetadata as d}from"../../libs/parquet/parquet.js";const f=new o({esriGeometryPoint:"point",esriGeometryPolygon:"polygon",esriGeometryPolyline:"polyline",esriGeometryMultipoint:"multipoint"}),y=new Set(["uncompressed","snappy","gzip"]);function g(e){return f.toJSON(e)}function w(e){return f.fromJSON(e)}async function h(t,o={}){const i=Array.isArray(t)?new c({urls:new e(t)}):t,n=await k(i,o);return b(r(n,()=>o.customParameters),{data:i})}async function b(e,o){if(o.geometryType&&o.spatialReference&&o.geometryEncoding&&o.fields)return o;const r=await e.getFileList();if(!r.length)throw new t("parquet:bad-input","At least one url must be specified");const l=await u(r[0],{provider:e});for(const i of l.compressionCodecs())if(!y.has(i))throw new t("parquet:unsupported",`Compression codec ${i} is unsupported. Must be of type ${Array.from(y).join(",")}`);const a=m(l),p={...o,file:l};if(null==p.fields&&(p.fields=l.fields(!1).map(e=>n.fromJSON({name:e.name,alias:e.name,type:e.type}))),null!=p.geometryEncoding){const e=p.geometryEncoding;switch(e.type){case"wkb":{const o=p.fields.find(t=>t.name===e.field);if(!o)throw new t("parquet:unsupported",`Geometry encoding references field ${e.field} which does not exist`);if("blob"!==o.type)throw new t("parquet:unsupported",`Invalid field type for geometry encoding. Found ${o.type} but expected 'blob'`);break}case"location":for(const o of[e.xField,e.yField])if(null!=o){const e=p.fields.find(e=>e.name===o);if(!e)throw new t("parquet:unsupported",`Geometry encoding references field ${o} which does not exist`);if(!s(e))throw new t("parquet:unsupported",`Invalid field type for location geometry encoding. Found ${e.type} but expected a numeric`)}}}null==p.geometryEncoding&&(p.geometryEncoding=q(a,p.fields));const c=d(l);if(c&&(p.displayOptimization=c),p.geometryEncoding)switch(p.geometryEncoding.type){case"location":null==p.spatialReference&&(p.spatialReference=i.WGS84),null==p.geometryType&&(p.geometryType="point");break;case"wkb":{if(!a)return p;const e=a.primary_column,t=a.columns[e];if(p.geometryType||(p.geometryType=F(t)),p.spatialReference||(p.spatialReference=P(t)),p.fields)for(const o of Object.keys(a.columns))p.fields=p.fields.filter(e=>e.name!==o)}}if(p.displayOptimization){const e=p.displayOptimization.index;if(!p.spatialReference&&e.wkid&&(p.spatialReference=new i({wkid:e.wkid})),!p.geometryType)switch(e.type){case"z":p.geometryType="point";break;case"xz":p.geometryType=e.geometryType}}return p}function q(e,t){if(null!=e){const t=e.primary_column,o=e.columns[t];return new a({field:t,orientation:"counterclockwise"===o.orientation?"counter-clockwise":null})}const o=t.filter(e=>s(e)).map(e=>e.name),i=p(o);return i.latitudeFieldName&&i.longitudeFieldName?new l({xField:i.longitudeFieldName,yField:i.latitudeFieldName}):null}function j(e){switch(e){case"Point":return"point";case"Polygon":case"MultiPolygon":return"polygon";case"LineString":return"polyline";case"MultiPoint":return"multipoint";default:return null}}function F(e){const{geometry_types:o}=e,i=new Set;for(const t of o){const e=j(t);e&&i.add(e)}if(i.size>1)throw new t("parquet:unsupported","Parquet mixed geometry types are not supported",{geometryTypes:i});return 1===i.size?i.values().next().value:void 0}function P(e){const t=e.crs?.id?.code;return t&&"number"==typeof t?new i({wkid:t}):void 0}async function k(e,o){switch(e.type){case"files":return{type:"urls",urls:e.urls.toArray()};case"portal-item":{const i=await e.portalItem.load(o);switch(i.type){case"Apache Parquet":return{type:"portal-parquet-file",itemUrl:i.itemUrl,itemCdnUrl:i.itemCdnUrl,modified:i.modified,size:i.size};case"Parquet layer":case"Parquet Layer":return{type:"portal-parquet-layer",itemUrl:i.itemUrl,itemCdnUrl:i.itemCdnUrl,modified:i.modified};default:throw new t("parquet:bad-item",`Item of type ${i.type} is not supported`,i)}}}}export{b as completeParquetLayerInfo,k as createFileProviderSchema,w as fromParquetJSONGeometryType,h as getParquetLayerInfo,f as parquetGeometryTypeKebabDict,g as toParquetJSONGeometryType};
2
+ import e from"../../core/Collection.js";import t from"../../core/Error.js";import{JSONMap as o}from"../../core/jsonMap.js";import r from"../../geometry/SpatialReference.js";import{createFileProvider as i}from"../graphics/sources/parquet/createFileProvider.js";import n from"./Field.js";import{isNumericField as s}from"./fieldUtils.js";import a from"./GeometryEncodingLocation.js";import l from"./GeometryEncodingWkb.js";import{inferLocationInfo as p}from"./locationUtils.js";import c from"./ParquetFilesData.js";import{createParquetFile as u,readGeoMetadata as m,readGeodisplayMetadata as d}from"../../libs/parquet/parquet.js";const f=new o({esriGeometryPoint:"point",esriGeometryPolygon:"polygon",esriGeometryPolyline:"polyline",esriGeometryMultipoint:"multipoint"}),y=new Set(["uncompressed","snappy","gzip"]);function g(e){return f.toJSON(e)}function w(e){return f.fromJSON(e)}async function h(t,o={}){const r=Array.isArray(t)?new c({urls:new e(t)}):t,n=await k(r,o);return q(i(n,()=>o.customParameters),{data:r})}async function q(e,o){if(o.geometryType&&o.spatialReference&&o.geometryEncoding&&o.fields)return o;const i=await e.getFileList();if(!i.length)throw new t("parquet:bad-input","At least one url must be specified");const a=await u(i[0],{provider:e});for(const r of a.compressionCodecs())if(!y.has(r))throw new t("parquet:unsupported",`Compression codec ${r} is unsupported. Must be of type ${Array.from(y).join(",")}`);const l=m(a),p={...o,file:a};if(null==p.fields&&(p.fields=a.fields(!1).map(e=>n.fromJSON({name:e.name,alias:e.name,type:e.type}))),null!=p.geometryEncoding){const e=p.geometryEncoding;switch(e.type){case"wkb":{const o=p.fields.find(t=>t.name===e.field);if(!o)throw new t("parquet:unsupported",`Geometry encoding references field ${e.field} which does not exist`);if("blob"!==o.type)throw new t("parquet:unsupported",`Invalid field type for geometry encoding. Found ${o.type} but expected 'blob'`);break}case"location":for(const o of[e.xField,e.yField])if(null!=o){const e=p.fields.find(e=>e.name===o);if(!e)throw new t("parquet:unsupported",`Geometry encoding references field ${o} which does not exist`);if(!s(e))throw new t("parquet:unsupported",`Invalid field type for location geometry encoding. Found ${e.type} but expected a numeric`)}}}null==p.geometryEncoding&&(p.geometryEncoding=b(l,p.fields));const c=d(a);if(c&&(p.displayOptimization=c),p.geometryEncoding)switch(p.geometryEncoding.type){case"location":null==p.spatialReference&&(p.spatialReference=r.WGS84),null==p.geometryType&&(p.geometryType="point");break;case"wkb":{if(!l)return p;const e=l.primary_column,t=l.columns[e];if(p.geometryType||(p.geometryType=j(t)),p.spatialReference||(p.spatialReference=F(t)),p.fields)for(const o of Object.keys(l.columns))p.fields=p.fields.filter(e=>e.name!==o)}}if(p.displayOptimization){const e=p.displayOptimization.index;if(!p.spatialReference&&e.wkid&&(p.spatialReference=new r({wkid:e.wkid})),!p.geometryType)switch(e.type){case"z":p.geometryType="point";break;case"xz":p.geometryType=e.geometryType}}return p}function b(e,t){if(null!=e){const t=e.primary_column,o=e.columns[t];return new l({field:t,orientation:"counterclockwise"===o.orientation?"counter-clockwise":null})}const o=t.filter(e=>s(e)).map(e=>e.name),r=p(o);return r.latitudeFieldName&&r.longitudeFieldName?new a({xField:r.longitudeFieldName,yField:r.latitudeFieldName}):null}function P(e){switch(e){case"Point":return"point";case"Polygon":case"MultiPolygon":return"polygon";case"LineString":return"polyline";case"MultiPoint":return"multipoint";default:return null}}function j(e){const{geometry_types:o}=e,r=new Set;for(const t of o){const e=P(t);e&&r.add(e)}if(r.size>1)throw new t("parquet:unsupported","Parquet mixed geometry types are not supported",{geometryTypes:r});return 1===r.size?r.values().next().value:void 0}function F(e){const t=e.crs?.id?.code;return t&&"number"==typeof t?new r({wkid:t}):void 0}async function k(e,o){switch(e.type){case"files":return{type:"urls",urls:e.urls.toArray()};case"portal-item":{const r=await e.portalItem.load(o);switch(r.type){case"Apache Parquet":return{type:"portal-parquet-file",itemUrl:r.itemUrl,itemCdnUrl:r.itemCdnUrl,modified:r.modified,size:r.size};case"Parquet layer":case"Parquet Layer":case"Parquet feature layer":case"Parquet Feature Layer":if(!r.url)throw new t("parquet:bad-item",`Item of type ${r.type} must have a url defined`,r);return{type:"portal-parquet-layer",itemUrl:r.itemUrl,itemCdnUrl:r.itemCdnUrl,itemMetadata:{modified:r.modified,url:r.url}};default:throw new t("parquet:bad-item",`Item of type ${r.type} is not supported`,r)}}}}export{q as completeParquetLayerInfo,k as createFileProviderSchema,w as fromParquetJSONGeometryType,h as getParquetLayerInfo,f as parquetGeometryTypeKebabDict,g as toParquetJSONGeometryType};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arcgis/core",
3
- "version": "5.1.0-next.110",
3
+ "version": "5.1.0-next.112",
4
4
  "homepage": "https://js.arcgis.com",
5
5
  "description": "ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API",
6
6
  "keywords": [
@@ -21,7 +21,7 @@
21
21
  "@amcharts/amcharts5": "~5.17.2",
22
22
  "@arcgis/toolkit": "^5.1.0-next.111",
23
23
  "@esri/arcgis-html-sanitizer": "~4.1.0",
24
- "@esri/calcite-components": "^5.1.0-next.54",
24
+ "@esri/calcite-components": "^5.1.0-next.60",
25
25
  "@vaadin/grid": "~25.1.3",
26
26
  "@zip.js/zip.js": "~2.8.26",
27
27
  "luxon": "~3.7.2",
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import{JSONMap as s}from"../core/jsonMap.js";import{clone as t}from"../core/lang.js";import o from"../core/Logger.js";import{property as i,cast as l,subclass as r}from"../core/accessorSupport/decorators.js";import{ensureString as a,ensureType as n}from"../core/accessorSupport/ensureType.js";import{collectArcadeFieldNames as u,collectField as p}from"../layers/support/fieldUtils.js";import c from"./Renderer.js";import{VisualVariablesMixin as m}from"./mixins/VisualVariablesMixin.js";import d from"./support/ClassBreakInfo.js";import{rendererBackgroundFillSymbolProperty as f,rendererSymbolProperty as h}from"./support/commonProperties.js";import y from"./support/RendererLegendOptions.js";import{getScaleDependentSymbol as g}from"./support/scaleDependentSymbolUtils.js";import{loadArcade as x}from"../support/loadArcade.js";import{ensureType as k}from"../symbols/support/typeUtils.js";import{reader as I}from"../core/accessorSupport/decorators/reader.js";import{writer as b}from"../core/accessorSupport/decorators/writer.js";import{enumeration as v}from"../core/accessorSupport/decorators/enumeration.js";var B;const V="log",F="percent-of-total",S="field",E=new s({esriNormalizeByLog:V,esriNormalizeByPercentOfTotal:F,esriNormalizeByField:S}),w=n(d);let j=B=class extends(m(c)){constructor(e){super(e),this._compiledValueExpression={valueExpression:null,compiledFunction:null},this.backgroundFillSymbol=null,this.classBreakInfos=null,this.defaultLabel=null,this.defaultSymbol=null,this.field=null,this.isMaxInclusive=!0,this.legendOptions=null,this.normalizationField=null,this.normalizationTotal=null,this.type="class-breaks",this.valueExpression=null,this.valueExpressionTitle=null,this._set("classBreakInfos",[])}readClassBreakInfos(e,s,t){if(!Array.isArray(e))return;let o=s.minValue;return e.map(e=>{const s=new d;return s.read(e,t),null==s.minValue&&(s.minValue=o),null==s.maxValue&&(s.maxValue=s.minValue),o=s.maxValue,s})}writeClassBreakInfos(e,s,t,o){const i=e.map(e=>e.write({},o));this._areClassBreaksConsecutive()&&i.forEach(e=>delete e.classMinValue),s[t]=i}castField(e){return null==e?e:"function"==typeof e?(o.getLogger(this).error(".field: field must be a string value"),null):a(e)}get minValue(){return this.classBreakInfos&&this.classBreakInfos[0]&&this.classBreakInfos[0].minValue||0}get normalizationType(){let e=this._get("normalizationType");const s=!!this.normalizationField,t=null!=this.normalizationTotal;return s||t?(e=s&&S||t&&F||null,s&&t&&o.getLogger(this).warn("warning: both normalizationField and normalizationTotal are set!")):e!==S&&e!==F||(e=null),e}set normalizationType(e){this._set("normalizationType",e)}addClassBreakInfo(e,s,o){let i=null;i="number"==typeof e?new d({minValue:e,maxValue:s,symbol:k(o)}):w(t(e)),this.classBreakInfos.push(i),1===this.classBreakInfos.length&&this.notifyChange("minValue")}removeClassBreakInfo(e,s){const t=this.classBreakInfos.length;for(let o=0;o<t;o++){const t=[this.classBreakInfos[o].minValue,this.classBreakInfos[o].maxValue];if(t[0]===e&&t[1]===s){this.classBreakInfos.splice(o,1);break}}}getBreakIndex(e,s){return this.valueExpression&&null==s?.arcade&&o.getLogger(this).warn(""),this.valueExpression?this._getBreakIndexForExpression(e,s):this._getBreakIndexForField(e)}async getClassBreakInfo(e,s){let t=s;this.valueExpression&&null==s?.arcade&&(t={...t,arcade:await x()});const o=this.getBreakIndex(e,t);return-1!==o?this.classBreakInfos[o]:null}getSymbol(e,s){if(this.valueExpression&&null==s?.arcade)return void o.getLogger(this).error("#getSymbol()","Please use getSymbolAsync if valueExpression is used");const t=this.getBreakIndex(e,s);return-1===t?this.defaultSymbol:g(this.classBreakInfos[t],s?.scale)??this.defaultSymbol}async getSymbolAsync(e,s){let t=s;if(this.valueExpression&&null==s?.arcade){const e=await x(),{arcadeUtils:s}=e;s.hasGeometryOperations(this.valueExpression)&&await s.enableGeometryOperations(),t={...t,arcade:e}}const o=this.getBreakIndex(e,t);return-1===o?this.defaultSymbol:g(this.classBreakInfos[o],s?.scale)??this.defaultSymbol}get symbols(){const e=[];return this.classBreakInfos.forEach(s=>{s.symbol&&e.push(s.symbol),e.push(...s.alternateSymbols??[])}),this.defaultSymbol&&e.push(this.defaultSymbol),e}get arcadeRequired(){return this.arcadeRequiredForVisualVariables||!!this.valueExpression}clone(){return new B({field:this.field,backgroundFillSymbol:this.backgroundFillSymbol?.clone(),defaultLabel:this.defaultLabel,defaultSymbol:this.defaultSymbol?.clone(),valueExpression:this.valueExpression,valueExpressionTitle:this.valueExpressionTitle,classBreakInfos:t(this.classBreakInfos),isMaxInclusive:this.isMaxInclusive,normalizationField:this.normalizationField,normalizationTotal:this.normalizationTotal,normalizationType:this.normalizationType,visualVariables:t(this.visualVariables),legendOptions:t(this.legendOptions),authoringInfo:t(this.authoringInfo)})}async collectRequiredFields(e,s){const t=[this.collectVVRequiredFields(e,s),this.collectSymbolFields(e,s)];await Promise.all(t)}async collectSymbolFields(e,s){const t=[...this.symbols.map(t=>t.collectRequiredFields(e,s)),u(e,s,null,this.valueExpression)];p(e,s,this.field),p(e,s,this.normalizationField),await Promise.all(t)}_getBreakIndexForExpression(e,s){const{viewingMode:t,scale:o,spatialReference:i,arcade:l,timeZone:r}=s??{},{valueExpression:a}=this;let n=this._compiledValueExpression.valueExpression===a?this._compiledValueExpression.compiledFunction:null;const u=l.arcadeUtils;if(!n){const e=u.createSyntaxTree(a);n=u.createFunction(e),this._compiledValueExpression.compiledFunction=n}this._compiledValueExpression.valueExpression=a;const p=u.executeFunction(n,u.createExecContext(e,u.getViewInfo({viewingMode:t,scale:o,spatialReference:i}),r));return this._getBreakIndexfromInfos(p)}_getBreakIndexForField(e){const s=this.field,t=e.attributes,o=this.normalizationType;let i=parseFloat(t[s]);if(o){const e=this.normalizationTotal,s=parseFloat(this.normalizationField?t[this.normalizationField]:void 0);if(o===V)i=Math.log(i)*Math.LOG10E;else if(o!==F||null==e||isNaN(e)){if(o===S&&!isNaN(s)){if(isNaN(i)||isNaN(s))return-1;i/=s}}else i=i/e*100}return this._getBreakIndexfromInfos(i)}_getBreakIndexfromInfos(e){const s=this.isMaxInclusive;if(null!=e&&"number"==typeof e&&!isNaN(e))for(let t=0;t<this.classBreakInfos.length;t++){const o=[this.classBreakInfos[t].minValue,this.classBreakInfos[t].maxValue];if(o[0]<=e&&(s?e<=o[1]:e<o[1]))return t}return-1}_areClassBreaksConsecutive(){const e=this.classBreakInfos,s=e.length;for(let t=1;t<s;t++)if(e[t-1].maxValue!==e[t].minValue)return!1;return!0}};e([i(f)],j.prototype,"backgroundFillSymbol",void 0),e([i({type:[d],json:{write:{isRequired:!0}}})],j.prototype,"classBreakInfos",void 0),e([I("classBreakInfos")],j.prototype,"readClassBreakInfos",null),e([b("classBreakInfos")],j.prototype,"writeClassBreakInfos",null),e([i({type:String,json:{write:!0}})],j.prototype,"defaultLabel",void 0),e([i(h)],j.prototype,"defaultSymbol",void 0),e([i({type:String,json:{write:!0}})],j.prototype,"field",void 0),e([l("field")],j.prototype,"castField",null),e([i({type:Boolean})],j.prototype,"isMaxInclusive",void 0),e([i({type:y,json:{write:!0}})],j.prototype,"legendOptions",void 0),e([i({type:Number,readOnly:!0,value:null,json:{read:!1,write:{overridePolicy(){return 0!==this.classBreakInfos.length&&this._areClassBreaksConsecutive()?{enabled:!0}:{enabled:!1}}}}})],j.prototype,"minValue",null),e([i({type:String,json:{write:!0}})],j.prototype,"normalizationField",void 0),e([i({type:Number,json:{write:!0}})],j.prototype,"normalizationTotal",void 0),e([i({type:E.apiValues,value:null,json:{type:E.jsonValues,read:E.read,write:E.write}})],j.prototype,"normalizationType",null),e([v({classBreaks:"class-breaks"})],j.prototype,"type",void 0),e([i({type:String,json:{write:!0}})],j.prototype,"valueExpression",void 0),e([i({type:String,json:{write:!0}})],j.prototype,"valueExpressionTitle",void 0),j=B=e([r("esri.renderers.ClassBreaksRenderer")],j);export{j as default};
2
+ import{__decorate as e}from"tslib";import{JSONMap as s}from"../core/jsonMap.js";import{clone as t}from"../core/lang.js";import o from"../core/Logger.js";import{property as i,cast as l,subclass as r}from"../core/accessorSupport/decorators.js";import{ensureString as a,ensureType as n}from"../core/accessorSupport/ensureType.js";import{collectArcadeFieldNames as u,collectField as p}from"../layers/support/fieldUtils.js";import c from"./Renderer.js";import{VisualVariablesMixin as m}from"./mixins/VisualVariablesMixin.js";import d from"./support/ClassBreakInfo.js";import{rendererBackgroundFillSymbolProperty as f,rendererSymbolProperty as h}from"./support/commonProperties.js";import y from"./support/RendererLegendOptions.js";import{getScaleDependentSymbol as g}from"./support/scaleDependentSymbolUtils.js";import{loadArcade as x}from"../support/loadArcade.js";import{ensureType as k}from"../symbols/support/typeUtils.js";import{reader as I}from"../core/accessorSupport/decorators/reader.js";import{writer as b}from"../core/accessorSupport/decorators/writer.js";import{enumeration as v}from"../core/accessorSupport/decorators/enumeration.js";var B;const V="log",F="percent-of-total",S="field",E=new s({esriNormalizeByLog:V,esriNormalizeByPercentOfTotal:F,esriNormalizeByField:S}),w=n(d);let j=B=class extends(m(c)){constructor(e){super(e),this._compiledValueExpression={valueExpression:null,compiledFunction:null},this.backgroundFillSymbol=null,this.classBreakInfos=null,this.defaultLabel=null,this.defaultSymbol=null,this.field=null,this.isMaxInclusive=!0,this.legendOptions=null,this.normalizationField=null,this.normalizationTotal=null,this.type="class-breaks",this.valueExpression=null,this.valueExpressionTitle=null,this._set("classBreakInfos",[])}readClassBreakInfos(e,s,t){if(!Array.isArray(e))return;let o=s.minValue;return e.map(e=>{const s=new d;return s.read(e,t),null==s.minValue&&(s.minValue=o),null==s.maxValue&&(s.maxValue=s.minValue),o=s.maxValue,s})}writeClassBreakInfos(e,s,t,o){const i=e.map(e=>e.write({},o));this._areClassBreaksConsecutive()&&i.forEach(e=>delete e.classMinValue),s[t]=i}castField(e){return null==e?e:"function"==typeof e?(o.getLogger(this).error(".field: field must be a string value"),null):a(e)}get minValue(){return this.classBreakInfos&&this.classBreakInfos[0]&&this.classBreakInfos[0].minValue||0}get normalizationType(){let e=this._get("normalizationType");const s=!!this.normalizationField,t=null!=this.normalizationTotal;return s||t?(e=s&&S||t&&F||null,s&&t&&o.getLogger(this).warn("warning: both normalizationField and normalizationTotal are set!")):e!==S&&e!==F||(e=null),e}set normalizationType(e){this._set("normalizationType",e)}addClassBreakInfo(e,s,o){let i=null;i="number"==typeof e?new d({minValue:e,maxValue:s,symbol:k(o)}):w(t(e)),this.classBreakInfos.push(i),1===this.classBreakInfos.length&&this.notifyChange("minValue")}removeClassBreakInfo(e,s){const t=this.classBreakInfos.length;for(let o=0;o<t;o++){const t=[this.classBreakInfos[o].minValue,this.classBreakInfos[o].maxValue];if(t[0]===e&&t[1]===s){this.classBreakInfos.splice(o,1);break}}}getBreakIndex(e,s){return this.valueExpression&&null==s?.arcade&&o.getLogger(this).warn(""),this.valueExpression?this._getBreakIndexForExpression(e,s):this._getBreakIndexForField(e)}async getClassBreakInfo(e,s){let t=s;this.valueExpression&&null==s?.arcade&&(t={...t,arcade:await x()});const o=this.getBreakIndex(e,t);return-1!==o?this.classBreakInfos[o]:null}getSymbol(e,s){if(this.valueExpression&&null==s?.arcade)return void o.getLogger(this).error("#getSymbol()","Please use getSymbolAsync if valueExpression is used");const t=this.getBreakIndex(e,s);return-1===t?this.defaultSymbol:g(this.classBreakInfos[t],s?.scale)??this.defaultSymbol}async getSymbolAsync(e,s){let t=s;if(this.valueExpression&&null==s?.arcade){const e=await x(),{arcadeUtils:s}=e;s.hasGeometryOperations(this.valueExpression)&&await s.enableGeometryOperations(),t={...t,arcade:e}}const o=this.getBreakIndex(e,t);return-1===o?this.defaultSymbol:g(this.classBreakInfos[o],t?.scale)??this.defaultSymbol}get symbols(){const e=[];return this.classBreakInfos.forEach(s=>{s.symbol&&e.push(s.symbol),e.push(...s.alternateSymbols??[])}),this.defaultSymbol&&e.push(this.defaultSymbol),e}get arcadeRequired(){return this.arcadeRequiredForVisualVariables||!!this.valueExpression}clone(){return new B({field:this.field,backgroundFillSymbol:this.backgroundFillSymbol?.clone(),defaultLabel:this.defaultLabel,defaultSymbol:this.defaultSymbol?.clone(),valueExpression:this.valueExpression,valueExpressionTitle:this.valueExpressionTitle,classBreakInfos:t(this.classBreakInfos),isMaxInclusive:this.isMaxInclusive,normalizationField:this.normalizationField,normalizationTotal:this.normalizationTotal,normalizationType:this.normalizationType,visualVariables:t(this.visualVariables),legendOptions:t(this.legendOptions),authoringInfo:t(this.authoringInfo)})}async collectRequiredFields(e,s){const t=[this.collectVVRequiredFields(e,s),this.collectSymbolFields(e,s)];await Promise.all(t)}async collectSymbolFields(e,s){const t=[...this.symbols.map(t=>t.collectRequiredFields(e,s)),u(e,s,null,this.valueExpression)];p(e,s,this.field),p(e,s,this.normalizationField),await Promise.all(t)}_getBreakIndexForExpression(e,s){const{viewingMode:t,scale:o,spatialReference:i,arcade:l,timeZone:r}=s??{},{valueExpression:a}=this;let n=this._compiledValueExpression.valueExpression===a?this._compiledValueExpression.compiledFunction:null;const u=l.arcadeUtils;if(!n){const e=u.createSyntaxTree(a);n=u.createFunction(e),this._compiledValueExpression.compiledFunction=n}this._compiledValueExpression.valueExpression=a;const p=u.executeFunction(n,u.createExecContext(e,u.getViewInfo({viewingMode:t,scale:o,spatialReference:i}),r));return this._getBreakIndexfromInfos(p)}_getBreakIndexForField(e){const s=this.field,t=e.attributes,o=this.normalizationType;let i=parseFloat(t[s]);if(o){const e=this.normalizationTotal,s=parseFloat(this.normalizationField?t[this.normalizationField]:void 0);if(o===V)i=Math.log(i)*Math.LOG10E;else if(o!==F||null==e||isNaN(e)){if(o===S&&!isNaN(s)){if(isNaN(i)||isNaN(s))return-1;i/=s}}else i=i/e*100}return this._getBreakIndexfromInfos(i)}_getBreakIndexfromInfos(e){const s=this.isMaxInclusive;if(null!=e&&"number"==typeof e&&!isNaN(e))for(let t=0;t<this.classBreakInfos.length;t++){const o=[this.classBreakInfos[t].minValue,this.classBreakInfos[t].maxValue];if(o[0]<=e&&(s?e<=o[1]:e<o[1]))return t}return-1}_areClassBreaksConsecutive(){const e=this.classBreakInfos,s=e.length;for(let t=1;t<s;t++)if(e[t-1].maxValue!==e[t].minValue)return!1;return!0}};e([i(f)],j.prototype,"backgroundFillSymbol",void 0),e([i({type:[d],json:{write:{isRequired:!0}}})],j.prototype,"classBreakInfos",void 0),e([I("classBreakInfos")],j.prototype,"readClassBreakInfos",null),e([b("classBreakInfos")],j.prototype,"writeClassBreakInfos",null),e([i({type:String,json:{write:!0}})],j.prototype,"defaultLabel",void 0),e([i(h)],j.prototype,"defaultSymbol",void 0),e([i({type:String,json:{write:!0}})],j.prototype,"field",void 0),e([l("field")],j.prototype,"castField",null),e([i({type:Boolean})],j.prototype,"isMaxInclusive",void 0),e([i({type:y,json:{write:!0}})],j.prototype,"legendOptions",void 0),e([i({type:Number,readOnly:!0,value:null,json:{read:!1,write:{overridePolicy(){return 0!==this.classBreakInfos.length&&this._areClassBreaksConsecutive()?{enabled:!0}:{enabled:!1}}}}})],j.prototype,"minValue",null),e([i({type:String,json:{write:!0}})],j.prototype,"normalizationField",void 0),e([i({type:Number,json:{write:!0}})],j.prototype,"normalizationTotal",void 0),e([i({type:E.apiValues,value:null,json:{type:E.jsonValues,read:E.read,write:E.write}})],j.prototype,"normalizationType",null),e([v({classBreaks:"class-breaks"})],j.prototype,"type",void 0),e([i({type:String,json:{write:!0}})],j.prototype,"valueExpression",void 0),e([i({type:String,json:{write:!0}})],j.prototype,"valueExpressionTitle",void 0),j=B=e([r("esri.renderers.ClassBreaksRenderer")],j);export{j 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{clone as t}from"../core/lang.js";import s from"../core/Logger.js";import{deepMerge as i}from"../core/object.js";import{watch as l}from"../core/reactiveUtils.js";import{property as o,cast as r,subclass as u}from"../core/accessorSupport/decorators.js";import{diff as n}from"../core/accessorSupport/diffUtils.js";import{ensureString as a,ensureType as p}from"../core/accessorSupport/ensureType.js";import{collectArcadeFieldNames as f,collectField as d}from"../layers/support/fieldUtils.js";import c from"../portal/Portal.js";import h from"./Renderer.js";import{VisualVariablesMixin as m}from"./mixins/VisualVariablesMixin.js";import{rendererBackgroundFillSymbolProperty as y,rendererSymbolProperty as b}from"./support/commonProperties.js";import v from"./support/RendererLegendOptions.js";import{getScaleDependentSymbol as _}from"./support/scaleDependentSymbolUtils.js";import g from"./support/UniqueValue.js";import V from"./support/UniqueValueClass.js";import q from"./support/UniqueValueGroup.js";import I from"./support/UniqueValueInfo.js";import{loadArcade as S}from"../support/loadArcade.js";import{a as w,c as U}from"../chunks/persistableUrlUtils.js";import j from"../symbols/WebStyleSymbol.js";import{fetchStyle as F}from"../symbols/support/styleUtils.js";import{ensureType as O}from"../symbols/support/typeUtils.js";import{addPropertyUnsupportedError as G}from"../webdoc/support/unsupportedErrors.js";import{enumeration as D}from"../core/accessorSupport/decorators/enumeration.js";import{writer as x}from"../core/accessorSupport/decorators/writer.js";import{reader as E}from"../core/accessorSupport/decorators/reader.js";var M;const R="uvInfos-watcher",L="uvGroups-watcher",N=",",P=p(I);function C(e){const{field1:t,field2:s,field3:i,fieldDelimiter:l,uniqueValueInfos:o,valueExpression:r}=e,u=!(!t||!s);return[{classes:(o??[]).map(e=>{const{alternateSymbols:o,symbol:n,label:a,value:p,description:f}=e,[d,c,h]=u?p?.toString()?.split(l||"")||[]:[p],m=[];return(t||r)&&m.push(d),s&&m.push(c),i&&m.push(h),{alternateSymbols:o,symbol:n,label:a,values:[m],description:f}})}]}function z(e){return null!=e&&""!==e&&("string"!=typeof e||""!==e.trim()&&"<null>"!==e.toLowerCase())||(e=null),e+""}let A=M=class extends(m(h)){constructor(e){super(e),this._valueInfoMap={},this._isDefaultSymbolDerived=!1,this._isInfosSource=null,this.type="unique-value",this.backgroundFillSymbol=null,this.orderByClassesEnabled=!1,this.valueExpressionTitle=null,this.legendOptions=null,this.defaultLabel=null,this.portal=null,this.styleOrigin=null,this.diff={uniqueValueInfos(e,t){if(!e&&!t)return;if(!e||!t)return{type:"complete",oldValue:e,newValue:t};let s=!1;const i={type:"collection",added:[],removed:[],changed:[],unchanged:[]};for(let l=0;l<t.length;l++){const o=e.find(e=>e.value===t[l].value);o?n(o,t[l])?(i.changed.push({type:"complete",oldValue:o,newValue:t[l]}),s=!0):i.unchanged.push({oldValue:o,newValue:t[l]}):(i.added.push(t[l]),s=!0)}for(let l=0;l<e.length;l++){t.find(t=>t.value===e[l].value)||(i.removed.push(e[l]),s=!0)}return s?i:void 0}},this._set("uniqueValueInfos",[]),this._set("uniqueValueGroups",[])}get _cache(){return{compiledFunc:null}}set field(e){this._set("field",e),this._updateFieldDelimiter(),this._updateUniqueValues()}castField(e){return null==e||"function"==typeof e?e:a(e)}writeField(e,t,i,l){"string"==typeof e?t[i]=e:l?.messages?G(l,"UniqueValueRenderer.field","set to a function cannot be written to JSON"):s.getLogger(this).error(".field: cannot write field to JSON since it's not a string value")}set field2(e){this._set("field2",e),this._updateFieldDelimiter(),this._updateUniqueValues()}set field3(e){this._set("field3",e),this._updateUniqueValues()}set valueExpression(e){this._set("valueExpression",e),this._updateUniqueValues()}set defaultSymbol(e){this._isDefaultSymbolDerived=!1,this._set("defaultSymbol",e)}set fieldDelimiter(e){this._set("fieldDelimiter",e),this._updateUniqueValues()}readPortal(e,t,s){return s.portal||c.getDefault()}readStyleOrigin(e,t,s){if(t.styleName)return Object.freeze({styleName:t.styleName});if(t.styleUrl){const e=w(t.styleUrl,s);return Object.freeze({styleUrl:e})}}writeStyleOrigin(e,t,s,i){e.styleName?t.styleName=e.styleName:e.styleUrl&&(t.styleUrl=U(e.styleUrl,i))}set uniqueValueGroups(e){this.styleOrigin?s.getLogger(this).error("#uniqueValueGroups=","Cannot modify unique value groups of a UniqueValueRenderer created from a web style"):(this._set("uniqueValueGroups",e),this._updateInfosFromGroups(),this._isInfosSource=!1,this._watchUniqueValueGroups())}set uniqueValueInfos(e){this.styleOrigin?s.getLogger(this).error("#uniqueValueInfos=","Cannot modify unique value infos of a UniqueValueRenderer created from a web style"):(this._set("uniqueValueInfos",e),this._updateValueInfoMap(),this._updateGroupsFromInfos(),this._isInfosSource=!0,this._watchUniqueValueInfos())}addUniqueValueInfo(e,t){if(this.styleOrigin)return void s.getLogger(this).error("#addUniqueValueInfo()","Cannot modify unique value infos of a UniqueValueRenderer created from a web style");let i;i="object"==typeof e?P(e):new I({value:e,symbol:O(t)}),this.uniqueValueInfos?.push(i),this._valueInfoMap[z(i.value)]=i,this._updateGroupsFromInfos(),this._isInfosSource=!0,this._watchUniqueValueInfos()}removeUniqueValueInfo(e){if(this.styleOrigin)return void s.getLogger(this).error("#removeUniqueValueInfo()","Cannot modify unique value infos of a UniqueValueRenderer created from a web style");const t=this.uniqueValueInfos;if(t)for(let s=0;s<t.length;s++){const i=t[s];if(String(i.value)===String(e)){delete this._valueInfoMap[z(e)],t.splice(s,1);break}}this._updateGroupsFromInfos(),this._isInfosSource=!0,this._watchUniqueValueInfos()}async getUniqueValueInfo(e,t){let s=t;return this.valueExpression&&null==t?.arcade&&(s={...s,arcade:await S()}),this._getUniqueValueInfo(e,s)}getSymbol(e,t){if(this.valueExpression&&null==t?.arcade)return void s.getLogger(this).error("#getSymbol()","Please use getSymbolAsync if valueExpression is used");const i=this._getUniqueValueInfo(e,t);return _(i,t?.scale)??this.defaultSymbol}async getSymbolAsync(e,t){let s=t;if(this.valueExpression&&null==s?.arcade){const e=await S(),{arcadeUtils:t}=e;t.hasGeometryOperations(this.valueExpression)&&await t.enableGeometryOperations(),s={...s,arcade:e}}const i=this._getUniqueValueInfo(e,t);return _(i,t?.scale)??this.defaultSymbol}get symbols(){const e=[];if(this._isInfosSource)for(const t of this.uniqueValueInfos??[])t.symbol&&e.push(t.symbol),e.push(...t.alternateSymbols??[]);else for(const t of this.uniqueValueGroups??[])for(const s of t.classes??[])s.symbol&&e.push(s.symbol),e.push(...s.alternateSymbols??[]);return this.defaultSymbol&&e.push(this.defaultSymbol),e}clone(){const e=new M({field:this.field,field2:this.field2,field3:this.field3,defaultLabel:this.defaultLabel,defaultSymbol:t(this.defaultSymbol),orderByClassesEnabled:this.orderByClassesEnabled,valueExpression:this.valueExpression,valueExpressionTitle:this.valueExpressionTitle,fieldDelimiter:this.fieldDelimiter,visualVariables:t(this.visualVariables),legendOptions:t(this.legendOptions),authoringInfo:t(this.authoringInfo),backgroundFillSymbol:t(this.backgroundFillSymbol)});this._isDefaultSymbolDerived&&(e._isDefaultSymbolDerived=!0),e._set("portal",this.portal);const s=t(this.uniqueValueInfos),i=t(this.uniqueValueGroups);return this.styleOrigin&&(e._set("styleOrigin",Object.freeze(t(this.styleOrigin))),Object.freeze(s),Object.freeze(i)),e._set("uniqueValueInfos",s),e._updateValueInfoMap(),e._set("uniqueValueGroups",i),e._isInfosSource=this._isInfosSource,e._watchUniqueValueInfosAndGroups(),e}get arcadeRequired(){return this.arcadeRequiredForVisualVariables||!!this.valueExpression}async collectRequiredFields(e,t){const s=[this.collectVVRequiredFields(e,t),this.collectSymbolFields(e,t)];await Promise.all(s)}async collectSymbolFields(e,t){const s=[...this.symbols.map(s=>s.collectRequiredFields(e,t)),f(e,t,null,this.valueExpression)];d(e,t,this.field),d(e,t,this.field2),d(e,t,this.field3),await Promise.all(s)}populateFromStyle(){return F(this.styleOrigin,{portal:this.portal}).then(e=>{const t=[];return this._valueInfoMap={},e?.data&&Array.isArray(e.data.items)&&e.data.items.forEach(s=>{const i=new j({styleUrl:e.styleUrl,styleName:e.styleName,portal:this.portal,name:s.name});this.defaultSymbol||s.name!==e.data.defaultItem||(this.defaultSymbol=i,this._isDefaultSymbolDerived=!0);const l=new I({value:s.name,symbol:i});t.push(l),this._valueInfoMap[z(s.name)]=l}),this._set("uniqueValueInfos",Object.freeze(t)),this._updateGroupsFromInfos(!0),this._isInfosSource=null,this._watchUniqueValueInfos(),!this.defaultSymbol&&this.uniqueValueInfos?.length&&(this.defaultSymbol=this.uniqueValueInfos[0].symbol,this._isDefaultSymbolDerived=!0),this})}_updateFieldDelimiter(){this.field&&this.field2&&!this.fieldDelimiter&&this._set("fieldDelimiter",N)}_updateUniqueValues(){null!=this._isInfosSource&&(this._isInfosSource?this._updateGroupsFromInfos():this._updateInfosFromGroups())}_updateValueInfoMap(){this._valueInfoMap={};const{uniqueValueInfos:e}=this;if(e)for(const t of e)this._valueInfoMap[z(t.value)]=t}_watchUniqueValueInfosAndGroups(){this._watchUniqueValueInfos(),this._watchUniqueValueGroups()}_watchUniqueValueInfos(){this.removeHandles(R);const{uniqueValueInfos:e}=this;if(e){const t=[];for(const s of e)t.push(l(()=>({symbol:s.symbol,alternateSymbols:s.alternateSymbols,value:s.value,label:s.label,description:s.description}),(e,t)=>{e!==t&&(this._updateGroupsFromInfos(),this._isInfosSource=!0)},{sync:!0}));this.addHandles(t,R)}}_watchUniqueValueGroups(){this.removeHandles(L);const{uniqueValueGroups:e}=this;if(e){const t=[];for(const s of e){t.push(l(()=>({classes:s.classes}),(e,t)=>{e!==t&&(this._updateInfosFromGroups(),this._isInfosSource=!1)},{sync:!0}));for(const e of s.classes??[])t.push(l(()=>({symbol:e.symbol,alternateSymbols:e.alternateSymbols,values:e.values,label:e.label,description:e.description}),(e,t)=>{e!==t&&(this._updateInfosFromGroups(),this._isInfosSource=!1)},{sync:!0}))}this.addHandles(t,L)}}_updateInfosFromGroups(){if(!this.uniqueValueGroups)return this._set("uniqueValueInfos",null),this._updateValueInfoMap(),void this._watchUniqueValueInfos();const e=[],{field:t,field2:s,field3:i,fieldDelimiter:l,uniqueValueGroups:o,valueExpression:r}=this;if(!t&&!r)return this._set("uniqueValueInfos",e),this._updateValueInfoMap(),void this._watchUniqueValueInfos();const u=!(!t||!s);for(const n of o)for(const t of n.classes??[]){const{alternateSymbols:o,symbol:r,label:n,values:a,description:p}=t;for(const t of a??[]){const{value:a,value2:f,value3:d}=t,c=[a];s&&c.push(f),i&&c.push(d);const h=u?c.join(l||""):c[0]??void 0;e.push(new I({alternateSymbols:o,symbol:r,label:n,value:h,description:p}))}}this._set("uniqueValueInfos",e),this._updateValueInfoMap(),this._watchUniqueValueInfos()}_updateGroupsFromInfos(e=!1){if(!this.uniqueValueInfos)return this._set("uniqueValueGroups",null),void this._watchUniqueValueGroups();const{field:t,field2:s,valueExpression:i,fieldDelimiter:l,uniqueValueInfos:o}=this;if(!t&&!i||!o.length)return this._set("uniqueValueGroups",[]),void this._watchUniqueValueGroups();const r=!(!t||!s),u=o.map(e=>{const{alternateSymbols:t,symbol:s,label:i,value:o,description:u}=e,[n,a,p]=r?o?.toString()?.split(l||"")||[]:[o];return new V({alternateSymbols:t,symbol:s,label:i,description:u,values:[new g({value:n,value2:a,value3:p})]})}),n=[new q({classes:u})];e&&Object.freeze(n),this._set("uniqueValueGroups",n),this._watchUniqueValueGroups()}_getUniqueValueInfo(e,t){return this.valueExpression?this._getUnqiueValueInfoForExpression(e,t):this._getUnqiueValueInfoForFields(e)}_getUnqiueValueInfoForExpression(e,t){const{viewingMode:s,scale:i,spatialReference:l,arcade:o,timeZone:r}=t??{};let u=this._cache.compiledFunc;const n=o.arcadeUtils;if(!u){const e=n.createSyntaxTree(this.valueExpression);u=n.createFunction(e),this._cache.compiledFunc=u}const a=n.executeFunction(u,n.createExecContext(e,n.getViewInfo({viewingMode:s,scale:i,spatialReference:l}),r));return this._valueInfoMap[z(a)]}_getUnqiueValueInfoForFields(e){const t=this.field,s=e.attributes;let i;if(this.field2){const e=this.field2,l=this.field3,o=[];t&&o.push(s[t]),e&&o.push(s[e]),l&&o.push(s[l]),i=o.join(this.fieldDelimiter||"")}else t&&(i=s[t]);return this._valueInfoMap[z(i)]}static fromPortalStyle(e,t){const i=new M(t?.properties);i._set("styleOrigin",Object.freeze({styleName:e})),i._set("portal",t?.portal||c.getDefault());const l=i.populateFromStyle();return l.catch(t=>{s.getLogger(this.prototype).error(`#fromPortalStyle('${e}'[, ...])`,"Failed to create unique value renderer from style name",t)}),l}static fromStyleUrl(e,t){const i=new M(t?.properties);i._set("styleOrigin",Object.freeze({styleUrl:e}));const l=i.populateFromStyle();return l.catch(t=>{s.getLogger(this.prototype).error(`#fromStyleUrl('${e}'[, ...])`,"Failed to create unique value renderer from style URL",t)}),l}};e([o({readOnly:!0})],A.prototype,"_cache",null),e([D({uniqueValue:"unique-value"})],A.prototype,"type",void 0),e([o(y)],A.prototype,"backgroundFillSymbol",void 0),e([o({value:null,json:{type:String,read:{source:"field1"},write:{target:"field1"}}})],A.prototype,"field",null),e([r("field")],A.prototype,"castField",null),e([x("field")],A.prototype,"writeField",null),e([o({type:String,value:null,json:{write:!0}})],A.prototype,"field2",null),e([o({type:String,value:null,json:{write:!0}})],A.prototype,"field3",null),e([o({type:Boolean,json:{name:"drawInClassOrder",default:!1,write:!0,origins:{"web-scene":{write:!1}}}})],A.prototype,"orderByClassesEnabled",void 0),e([o({type:String,value:null,json:{write:!0}})],A.prototype,"valueExpression",null),e([o({type:String,json:{write:!0}})],A.prototype,"valueExpressionTitle",void 0),e([o({type:v,json:{write:!0}})],A.prototype,"legendOptions",void 0),e([o({type:String,json:{write:!0}})],A.prototype,"defaultLabel",void 0),e([o(i({...b},{json:{write:{overridePolicy(){return{enabled:!this._isDefaultSymbolDerived}}},origins:{"web-scene":{write:{overridePolicy(){return{enabled:!this._isDefaultSymbolDerived}}}}}}}))],A.prototype,"defaultSymbol",null),e([o({type:String,value:null,json:{write:!0}})],A.prototype,"fieldDelimiter",null),e([o({type:c,readOnly:!0})],A.prototype,"portal",void 0),e([E("portal",["styleName"])],A.prototype,"readPortal",null),e([o({readOnly:!0,json:{write:{enabled:!1,overridePolicy:()=>({enabled:!0})}}})],A.prototype,"styleOrigin",void 0),e([E("styleOrigin",["styleName","styleUrl"])],A.prototype,"readStyleOrigin",null),e([x("styleOrigin",{styleName:{type:String},styleUrl:{type:String}})],A.prototype,"writeStyleOrigin",null),e([o({type:[q],json:{read:{source:["uniqueValueGroups","uniqueValueInfos"],reader:(e,t,s)=>(t.uniqueValueGroups||C(t)).map(e=>q.fromJSON(e,s))},write:{overridePolicy(){return this.styleOrigin?{enabled:!1}:{enabled:!0}}}}})],A.prototype,"uniqueValueGroups",null),e([o({type:[I],json:{read:!1,write:{isRequired:!0,overridePolicy(){return this.styleOrigin?{enabled:!1}:{enabled:!0,isRequired:!0}}}}})],A.prototype,"uniqueValueInfos",null),A=M=e([u("esri.renderers.UniqueValueRenderer")],A);export{A as default};
2
+ import{__decorate as e}from"tslib";import{clone as t}from"../core/lang.js";import s from"../core/Logger.js";import{deepMerge as i}from"../core/object.js";import{watch as l}from"../core/reactiveUtils.js";import{property as o,cast as r,subclass as u}from"../core/accessorSupport/decorators.js";import{diff as n}from"../core/accessorSupport/diffUtils.js";import{ensureString as a,ensureType as p}from"../core/accessorSupport/ensureType.js";import{collectArcadeFieldNames as f,collectField as d}from"../layers/support/fieldUtils.js";import c from"../portal/Portal.js";import h from"./Renderer.js";import{VisualVariablesMixin as m}from"./mixins/VisualVariablesMixin.js";import{rendererBackgroundFillSymbolProperty as y,rendererSymbolProperty as b}from"./support/commonProperties.js";import v from"./support/RendererLegendOptions.js";import{getScaleDependentSymbol as _}from"./support/scaleDependentSymbolUtils.js";import g from"./support/UniqueValue.js";import V from"./support/UniqueValueClass.js";import q from"./support/UniqueValueGroup.js";import I from"./support/UniqueValueInfo.js";import{loadArcade as S}from"../support/loadArcade.js";import{a as w,c as U}from"../chunks/persistableUrlUtils.js";import j from"../symbols/WebStyleSymbol.js";import{fetchStyle as F}from"../symbols/support/styleUtils.js";import{ensureType as O}from"../symbols/support/typeUtils.js";import{addPropertyUnsupportedError as G}from"../webdoc/support/unsupportedErrors.js";import{enumeration as D}from"../core/accessorSupport/decorators/enumeration.js";import{writer as x}from"../core/accessorSupport/decorators/writer.js";import{reader as E}from"../core/accessorSupport/decorators/reader.js";var M;const R="uvInfos-watcher",L="uvGroups-watcher",N=",",P=p(I);function C(e){const{field1:t,field2:s,field3:i,fieldDelimiter:l,uniqueValueInfos:o,valueExpression:r}=e,u=!(!t||!s);return[{classes:(o??[]).map(e=>{const{alternateSymbols:o,symbol:n,label:a,value:p,description:f}=e,[d,c,h]=u?p?.toString()?.split(l||"")||[]:[p],m=[];return(t||r)&&m.push(d),s&&m.push(c),i&&m.push(h),{alternateSymbols:o,symbol:n,label:a,values:[m],description:f}})}]}function z(e){return null!=e&&""!==e&&("string"!=typeof e||""!==e.trim()&&"<null>"!==e.toLowerCase())||(e=null),e+""}let A=M=class extends(m(h)){constructor(e){super(e),this._valueInfoMap={},this._isDefaultSymbolDerived=!1,this._isInfosSource=null,this.type="unique-value",this.backgroundFillSymbol=null,this.orderByClassesEnabled=!1,this.valueExpressionTitle=null,this.legendOptions=null,this.defaultLabel=null,this.portal=null,this.styleOrigin=null,this.diff={uniqueValueInfos(e,t){if(!e&&!t)return;if(!e||!t)return{type:"complete",oldValue:e,newValue:t};let s=!1;const i={type:"collection",added:[],removed:[],changed:[],unchanged:[]};for(let l=0;l<t.length;l++){const o=e.find(e=>e.value===t[l].value);o?n(o,t[l])?(i.changed.push({type:"complete",oldValue:o,newValue:t[l]}),s=!0):i.unchanged.push({oldValue:o,newValue:t[l]}):(i.added.push(t[l]),s=!0)}for(let l=0;l<e.length;l++){t.find(t=>t.value===e[l].value)||(i.removed.push(e[l]),s=!0)}return s?i:void 0}},this._set("uniqueValueInfos",[]),this._set("uniqueValueGroups",[])}get _cache(){return{compiledFunc:null}}set field(e){this._set("field",e),this._updateFieldDelimiter(),this._updateUniqueValues()}castField(e){return null==e||"function"==typeof e?e:a(e)}writeField(e,t,i,l){"string"==typeof e?t[i]=e:l?.messages?G(l,"UniqueValueRenderer.field","set to a function cannot be written to JSON"):s.getLogger(this).error(".field: cannot write field to JSON since it's not a string value")}set field2(e){this._set("field2",e),this._updateFieldDelimiter(),this._updateUniqueValues()}set field3(e){this._set("field3",e),this._updateUniqueValues()}set valueExpression(e){this._set("valueExpression",e),this._updateUniqueValues()}set defaultSymbol(e){this._isDefaultSymbolDerived=!1,this._set("defaultSymbol",e)}set fieldDelimiter(e){this._set("fieldDelimiter",e),this._updateUniqueValues()}readPortal(e,t,s){return s.portal||c.getDefault()}readStyleOrigin(e,t,s){if(t.styleName)return Object.freeze({styleName:t.styleName});if(t.styleUrl){const e=w(t.styleUrl,s);return Object.freeze({styleUrl:e})}}writeStyleOrigin(e,t,s,i){e.styleName?t.styleName=e.styleName:e.styleUrl&&(t.styleUrl=U(e.styleUrl,i))}set uniqueValueGroups(e){this.styleOrigin?s.getLogger(this).error("#uniqueValueGroups=","Cannot modify unique value groups of a UniqueValueRenderer created from a web style"):(this._set("uniqueValueGroups",e),this._updateInfosFromGroups(),this._isInfosSource=!1,this._watchUniqueValueGroups())}set uniqueValueInfos(e){this.styleOrigin?s.getLogger(this).error("#uniqueValueInfos=","Cannot modify unique value infos of a UniqueValueRenderer created from a web style"):(this._set("uniqueValueInfos",e),this._updateValueInfoMap(),this._updateGroupsFromInfos(),this._isInfosSource=!0,this._watchUniqueValueInfos())}addUniqueValueInfo(e,t){if(this.styleOrigin)return void s.getLogger(this).error("#addUniqueValueInfo()","Cannot modify unique value infos of a UniqueValueRenderer created from a web style");let i;i="object"==typeof e?P(e):new I({value:e,symbol:O(t)}),this.uniqueValueInfos?.push(i),this._valueInfoMap[z(i.value)]=i,this._updateGroupsFromInfos(),this._isInfosSource=!0,this._watchUniqueValueInfos()}removeUniqueValueInfo(e){if(this.styleOrigin)return void s.getLogger(this).error("#removeUniqueValueInfo()","Cannot modify unique value infos of a UniqueValueRenderer created from a web style");const t=this.uniqueValueInfos;if(t)for(let s=0;s<t.length;s++){const i=t[s];if(String(i.value)===String(e)){delete this._valueInfoMap[z(e)],t.splice(s,1);break}}this._updateGroupsFromInfos(),this._isInfosSource=!0,this._watchUniqueValueInfos()}async getUniqueValueInfo(e,t){let s=t;return this.valueExpression&&null==t?.arcade&&(s={...s,arcade:await S()}),this._getUniqueValueInfo(e,s)}getSymbol(e,t){if(this.valueExpression&&null==t?.arcade)return void s.getLogger(this).error("#getSymbol()","Please use getSymbolAsync if valueExpression is used");const i=this._getUniqueValueInfo(e,t);return _(i,t?.scale)??this.defaultSymbol}async getSymbolAsync(e,t){let s=t;if(this.valueExpression&&null==s?.arcade){const e=await S(),{arcadeUtils:t}=e;t.hasGeometryOperations(this.valueExpression)&&await t.enableGeometryOperations(),s={...s,arcade:e}}const i=this._getUniqueValueInfo(e,s);return _(i,s?.scale)??this.defaultSymbol}get symbols(){const e=[];if(this._isInfosSource)for(const t of this.uniqueValueInfos??[])t.symbol&&e.push(t.symbol),e.push(...t.alternateSymbols??[]);else for(const t of this.uniqueValueGroups??[])for(const s of t.classes??[])s.symbol&&e.push(s.symbol),e.push(...s.alternateSymbols??[]);return this.defaultSymbol&&e.push(this.defaultSymbol),e}clone(){const e=new M({field:this.field,field2:this.field2,field3:this.field3,defaultLabel:this.defaultLabel,defaultSymbol:t(this.defaultSymbol),orderByClassesEnabled:this.orderByClassesEnabled,valueExpression:this.valueExpression,valueExpressionTitle:this.valueExpressionTitle,fieldDelimiter:this.fieldDelimiter,visualVariables:t(this.visualVariables),legendOptions:t(this.legendOptions),authoringInfo:t(this.authoringInfo),backgroundFillSymbol:t(this.backgroundFillSymbol)});this._isDefaultSymbolDerived&&(e._isDefaultSymbolDerived=!0),e._set("portal",this.portal);const s=t(this.uniqueValueInfos),i=t(this.uniqueValueGroups);return this.styleOrigin&&(e._set("styleOrigin",Object.freeze(t(this.styleOrigin))),Object.freeze(s),Object.freeze(i)),e._set("uniqueValueInfos",s),e._updateValueInfoMap(),e._set("uniqueValueGroups",i),e._isInfosSource=this._isInfosSource,e._watchUniqueValueInfosAndGroups(),e}get arcadeRequired(){return this.arcadeRequiredForVisualVariables||!!this.valueExpression}async collectRequiredFields(e,t){const s=[this.collectVVRequiredFields(e,t),this.collectSymbolFields(e,t)];await Promise.all(s)}async collectSymbolFields(e,t){const s=[...this.symbols.map(s=>s.collectRequiredFields(e,t)),f(e,t,null,this.valueExpression)];d(e,t,this.field),d(e,t,this.field2),d(e,t,this.field3),await Promise.all(s)}populateFromStyle(){return F(this.styleOrigin,{portal:this.portal}).then(e=>{const t=[];return this._valueInfoMap={},e?.data&&Array.isArray(e.data.items)&&e.data.items.forEach(s=>{const i=new j({styleUrl:e.styleUrl,styleName:e.styleName,portal:this.portal,name:s.name});this.defaultSymbol||s.name!==e.data.defaultItem||(this.defaultSymbol=i,this._isDefaultSymbolDerived=!0);const l=new I({value:s.name,symbol:i});t.push(l),this._valueInfoMap[z(s.name)]=l}),this._set("uniqueValueInfos",Object.freeze(t)),this._updateGroupsFromInfos(!0),this._isInfosSource=null,this._watchUniqueValueInfos(),!this.defaultSymbol&&this.uniqueValueInfos?.length&&(this.defaultSymbol=this.uniqueValueInfos[0].symbol,this._isDefaultSymbolDerived=!0),this})}_updateFieldDelimiter(){this.field&&this.field2&&!this.fieldDelimiter&&this._set("fieldDelimiter",N)}_updateUniqueValues(){null!=this._isInfosSource&&(this._isInfosSource?this._updateGroupsFromInfos():this._updateInfosFromGroups())}_updateValueInfoMap(){this._valueInfoMap={};const{uniqueValueInfos:e}=this;if(e)for(const t of e)this._valueInfoMap[z(t.value)]=t}_watchUniqueValueInfosAndGroups(){this._watchUniqueValueInfos(),this._watchUniqueValueGroups()}_watchUniqueValueInfos(){this.removeHandles(R);const{uniqueValueInfos:e}=this;if(e){const t=[];for(const s of e)t.push(l(()=>({symbol:s.symbol,alternateSymbols:s.alternateSymbols,value:s.value,label:s.label,description:s.description}),(e,t)=>{e!==t&&(this._updateGroupsFromInfos(),this._isInfosSource=!0)},{sync:!0}));this.addHandles(t,R)}}_watchUniqueValueGroups(){this.removeHandles(L);const{uniqueValueGroups:e}=this;if(e){const t=[];for(const s of e){t.push(l(()=>({classes:s.classes}),(e,t)=>{e!==t&&(this._updateInfosFromGroups(),this._isInfosSource=!1)},{sync:!0}));for(const e of s.classes??[])t.push(l(()=>({symbol:e.symbol,alternateSymbols:e.alternateSymbols,values:e.values,label:e.label,description:e.description}),(e,t)=>{e!==t&&(this._updateInfosFromGroups(),this._isInfosSource=!1)},{sync:!0}))}this.addHandles(t,L)}}_updateInfosFromGroups(){if(!this.uniqueValueGroups)return this._set("uniqueValueInfos",null),this._updateValueInfoMap(),void this._watchUniqueValueInfos();const e=[],{field:t,field2:s,field3:i,fieldDelimiter:l,uniqueValueGroups:o,valueExpression:r}=this;if(!t&&!r)return this._set("uniqueValueInfos",e),this._updateValueInfoMap(),void this._watchUniqueValueInfos();const u=!(!t||!s);for(const n of o)for(const t of n.classes??[]){const{alternateSymbols:o,symbol:r,label:n,values:a,description:p}=t;for(const t of a??[]){const{value:a,value2:f,value3:d}=t,c=[a];s&&c.push(f),i&&c.push(d);const h=u?c.join(l||""):c[0]??void 0;e.push(new I({alternateSymbols:o,symbol:r,label:n,value:h,description:p}))}}this._set("uniqueValueInfos",e),this._updateValueInfoMap(),this._watchUniqueValueInfos()}_updateGroupsFromInfos(e=!1){if(!this.uniqueValueInfos)return this._set("uniqueValueGroups",null),void this._watchUniqueValueGroups();const{field:t,field2:s,valueExpression:i,fieldDelimiter:l,uniqueValueInfos:o}=this;if(!t&&!i||!o.length)return this._set("uniqueValueGroups",[]),void this._watchUniqueValueGroups();const r=!(!t||!s),u=o.map(e=>{const{alternateSymbols:t,symbol:s,label:i,value:o,description:u}=e,[n,a,p]=r?o?.toString()?.split(l||"")||[]:[o];return new V({alternateSymbols:t,symbol:s,label:i,description:u,values:[new g({value:n,value2:a,value3:p})]})}),n=[new q({classes:u})];e&&Object.freeze(n),this._set("uniqueValueGroups",n),this._watchUniqueValueGroups()}_getUniqueValueInfo(e,t){return this.valueExpression?this._getUnqiueValueInfoForExpression(e,t):this._getUnqiueValueInfoForFields(e)}_getUnqiueValueInfoForExpression(e,t){const{viewingMode:s,scale:i,spatialReference:l,arcade:o,timeZone:r}=t??{};let u=this._cache.compiledFunc;const n=o.arcadeUtils;if(!u){const e=n.createSyntaxTree(this.valueExpression);u=n.createFunction(e),this._cache.compiledFunc=u}const a=n.executeFunction(u,n.createExecContext(e,n.getViewInfo({viewingMode:s,scale:i,spatialReference:l}),r));return this._valueInfoMap[z(a)]}_getUnqiueValueInfoForFields(e){const t=this.field,s=e.attributes;let i;if(this.field2){const e=this.field2,l=this.field3,o=[];t&&o.push(s[t]),e&&o.push(s[e]),l&&o.push(s[l]),i=o.join(this.fieldDelimiter||"")}else t&&(i=s[t]);return this._valueInfoMap[z(i)]}static fromPortalStyle(e,t){const i=new M(t?.properties);i._set("styleOrigin",Object.freeze({styleName:e})),i._set("portal",t?.portal||c.getDefault());const l=i.populateFromStyle();return l.catch(t=>{s.getLogger(this.prototype).error(`#fromPortalStyle('${e}'[, ...])`,"Failed to create unique value renderer from style name",t)}),l}static fromStyleUrl(e,t){const i=new M(t?.properties);i._set("styleOrigin",Object.freeze({styleUrl:e}));const l=i.populateFromStyle();return l.catch(t=>{s.getLogger(this.prototype).error(`#fromStyleUrl('${e}'[, ...])`,"Failed to create unique value renderer from style URL",t)}),l}};e([o({readOnly:!0})],A.prototype,"_cache",null),e([D({uniqueValue:"unique-value"})],A.prototype,"type",void 0),e([o(y)],A.prototype,"backgroundFillSymbol",void 0),e([o({value:null,json:{type:String,read:{source:"field1"},write:{target:"field1"}}})],A.prototype,"field",null),e([r("field")],A.prototype,"castField",null),e([x("field")],A.prototype,"writeField",null),e([o({type:String,value:null,json:{write:!0}})],A.prototype,"field2",null),e([o({type:String,value:null,json:{write:!0}})],A.prototype,"field3",null),e([o({type:Boolean,json:{name:"drawInClassOrder",default:!1,write:!0,origins:{"web-scene":{write:!1}}}})],A.prototype,"orderByClassesEnabled",void 0),e([o({type:String,value:null,json:{write:!0}})],A.prototype,"valueExpression",null),e([o({type:String,json:{write:!0}})],A.prototype,"valueExpressionTitle",void 0),e([o({type:v,json:{write:!0}})],A.prototype,"legendOptions",void 0),e([o({type:String,json:{write:!0}})],A.prototype,"defaultLabel",void 0),e([o(i({...b},{json:{write:{overridePolicy(){return{enabled:!this._isDefaultSymbolDerived}}},origins:{"web-scene":{write:{overridePolicy(){return{enabled:!this._isDefaultSymbolDerived}}}}}}}))],A.prototype,"defaultSymbol",null),e([o({type:String,value:null,json:{write:!0}})],A.prototype,"fieldDelimiter",null),e([o({type:c,readOnly:!0})],A.prototype,"portal",void 0),e([E("portal",["styleName"])],A.prototype,"readPortal",null),e([o({readOnly:!0,json:{write:{enabled:!1,overridePolicy:()=>({enabled:!0})}}})],A.prototype,"styleOrigin",void 0),e([E("styleOrigin",["styleName","styleUrl"])],A.prototype,"readStyleOrigin",null),e([x("styleOrigin",{styleName:{type:String},styleUrl:{type:String}})],A.prototype,"writeStyleOrigin",null),e([o({type:[q],json:{read:{source:["uniqueValueGroups","uniqueValueInfos"],reader:(e,t,s)=>(t.uniqueValueGroups||C(t)).map(e=>q.fromJSON(e,s))},write:{overridePolicy(){return this.styleOrigin?{enabled:!1}:{enabled:!0}}}}})],A.prototype,"uniqueValueGroups",null),e([o({type:[I],json:{read:!1,write:{isRequired:!0,overridePolicy(){return this.styleOrigin?{enabled:!1}:{enabled:!0,isRequired:!0}}}}})],A.prototype,"uniqueValueInfos",null),A=M=e([u("esri.renderers.UniqueValueRenderer")],A);export{A as default};