@arcgis/core 4.25.0-next.20220718 → 4.25.0-next.20220721

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 (284) hide show
  1. package/Camera.js +1 -1
  2. package/analysis/DimensioningAnalysis.js +1 -1
  3. package/analysis/LineOfSightAnalysis.js +1 -1
  4. package/analysis/SliceAnalysis.js +1 -1
  5. package/arcade/featureset/support/RecentlyUsedCache.js +1 -1
  6. package/arcade/functions/featuresetgeom.js +1 -1
  7. package/assets/esri/core/workers/RemoteClient.js +1 -1
  8. package/assets/esri/core/workers/chunks/1751de504354d98ac3fd.js +1 -0
  9. package/assets/esri/core/workers/chunks/1f4f1896880bfa6801c5.js +1 -0
  10. package/assets/esri/core/workers/chunks/290cd411d0d18b1d0efd.js +1 -0
  11. package/assets/esri/core/workers/chunks/{ab3bd5fecdb97f2d690e.js → 3b5be512567d9c1c6fe6.js} +1 -1
  12. package/assets/esri/core/workers/chunks/{c3236a7058e64ea3b939.js → 3c9da9b88777700879aa.js} +1 -1
  13. package/assets/esri/core/workers/chunks/{f96e8724ae3458f5e262.js → 4a7aa1b9de61eb013647.js} +1 -1
  14. package/assets/esri/core/workers/chunks/4cb64ccb5fba126f9a66.js +1 -0
  15. package/assets/esri/core/workers/chunks/{68f19e58aae01791944e.js → 579ba109718bc2554008.js} +1 -1
  16. package/assets/esri/core/workers/chunks/59845b02b07a8ed7ce81.js +1 -0
  17. package/assets/esri/core/workers/chunks/{c705f907ce60a646d9aa.js → 652d36523efbe5c9ebb2.js} +1 -1
  18. package/assets/esri/core/workers/chunks/888d8e4471c9a2cd5009.js +1 -0
  19. package/assets/esri/core/workers/chunks/9493a8e5d6001b6bf275.js +1 -0
  20. package/assets/esri/core/workers/chunks/9d824cdfbcdf3cb3246f.js +1 -0
  21. package/assets/esri/core/workers/chunks/bf348f6f52701fa6016e.js +987 -0
  22. package/assets/esri/core/workers/chunks/d02881954c0cc0d39dfb.js +1 -0
  23. package/assets/esri/core/workers/chunks/{1ecbf642debc2207b762.js → da54483123f377e9b3e1.js} +1 -1
  24. package/assets/esri/core/workers/chunks/{61b71b8e028eda10ccab.js → e4ad2cf5d6bded02e392.js} +1 -1
  25. package/assets/esri/core/workers/chunks/{3bfab05ae07ac18a75fe.js → f298a70f3b6f27675d53.js} +1 -1
  26. package/assets/esri/core/workers/chunks/{d499cce61c1c5c367380.js → f40290cfad3fe6fb4ef9.js} +1 -1
  27. package/assets/esri/layers/support/rasterFormats/lerc-wasm.wasm +0 -0
  28. package/assets/esri/themes/base/widgets/_Tooltip.scss +1 -1
  29. package/assets/esri/themes/dark/main.css +1 -1
  30. package/assets/esri/themes/light/main.css +1 -1
  31. package/assets/esri/themes/light/view.css +1 -1
  32. package/chunks/ComponentShader.glsl.js +39 -33
  33. package/chunks/Laserlines.glsl.js +4 -4
  34. package/chunks/Precipitation.glsl.js +2 -2
  35. package/chunks/RibbonLine.glsl.js +46 -44
  36. package/chunks/Stars.glsl.js +2 -2
  37. package/chunks/Terrain.glsl.js +25 -17
  38. package/chunks/boundedPlane.js +1 -1
  39. package/chunks/lerc-wasm.js +1 -1
  40. package/chunks/mat2d.js +1 -1
  41. package/chunks/quatf32.js +1 -1
  42. package/core/BidiEngine.js +1 -1
  43. package/core/accessorSupport/watch.js +1 -1
  44. package/core/libs/gl-matrix-2/factories/quatf32.js +1 -1
  45. package/core/libs/gl-matrix-2/math/mat2d.js +1 -1
  46. package/core/perspectiveUtils.js +1 -1
  47. package/core/promiseUtils.js +1 -1
  48. package/core/reactiveUtils.js +1 -1
  49. package/core/unitUtils.js +1 -1
  50. package/geometry/projection.js +1 -1
  51. package/geometry/projectionEllipsoid.js +1 -1
  52. package/geometry/support/MeshTexture.js +1 -1
  53. package/geometry/support/axisAngleDegrees.js +1 -1
  54. package/geometry/support/coordinateSystem.js +1 -1
  55. package/geometry/support/geodesicUtils.js +1 -1
  56. package/geometry/support/meshUtils/exporters/gltf/index.js +1 -1
  57. package/geometry/support/meshUtils/loadExternal.js +1 -1
  58. package/geometry/support/meshUtils/loadGLTFMesh.js +1 -1
  59. package/geometry/support/scaleUtils.js +1 -1
  60. package/geometry/support/spatialReferenceUtils.js +1 -1
  61. package/identity/IdentityManagerBase.js +1 -1
  62. package/identity/IdentityModal.js +1 -1
  63. package/interfaces.d.ts +3 -33
  64. package/layers/FeatureLayer.js +1 -1
  65. package/layers/effects/parser.js +1 -1
  66. package/layers/graphics/hydratedFeatures.js +1 -1
  67. package/layers/graphics/sources/support/sourceUtils.js +1 -1
  68. package/layers/mixins/ArcGISImageService.js +1 -1
  69. package/layers/ogc/wfsUtils.js +1 -1
  70. package/layers/support/ContingentValue.js +1 -1
  71. package/layers/support/ElevationQuery.js +1 -1
  72. package/layers/support/PixelBlock.js +1 -1
  73. package/layers/support/kmlUtils.js +1 -1
  74. package/layers/support/rasterDatasets/CloudRaster.js +1 -1
  75. package/layers/support/rasterDatasets/EphemeralBlockCache.js +1 -1
  76. package/layers/support/rasterDatasets/ImageServerRaster.js +1 -1
  77. package/layers/support/rasterDatasets/multipartParser.js +1 -1
  78. package/layers/support/rasterFormats/ImageCanvasDecoder.js +1 -1
  79. package/layers/support/rasterFormats/JpgPlus.js +1 -1
  80. package/layers/support/rasterFormats/Lerc.js +1 -1
  81. package/layers/support/rasterFormats/RasterCodec.js +1 -1
  82. package/layers/support/rasterFormats/Raw.js +1 -1
  83. package/layers/support/rasterFormats/TiffTags.js +1 -1
  84. package/layers/support/rasterFunctions/vectorFieldUtils.js +1 -1
  85. package/layers/support/vectorTileLayerLoader.js +1 -1
  86. package/layers/support/wmtsUtils.js +1 -1
  87. package/package.json +1 -1
  88. package/renderers/RasterShadedReliefRenderer.js +1 -1
  89. package/renderers/RasterStretchRenderer.js +1 -1
  90. package/renderers/UniqueValueRenderer.js +1 -1
  91. package/renderers/support/AuthoringInfo.js +1 -1
  92. package/renderers/support/RasterSymbolizer.js +1 -1
  93. package/rest/query/operations/query.js +1 -1
  94. package/rest/query/operations/queryTopFeatures.js +1 -1
  95. package/rest/support/DirectionsFeatureSet.js +1 -1
  96. package/rest/support/ImageHistogramParameters.js +1 -1
  97. package/rest/support/ImageSampleParameters.js +1 -1
  98. package/smartMapping/labels/clusters.js +1 -1
  99. package/smartMapping/renderers/relationship.js +1 -1
  100. package/smartMapping/support/adapters/support/utils.js +1 -1
  101. package/support/basemapUtils.js +1 -1
  102. package/support/revision.js +1 -1
  103. package/symbols/LabelSymbol3D.js +1 -1
  104. package/symbols/PointSymbol3D.js +1 -1
  105. package/symbols/cim/CIMCursor.js +1 -1
  106. package/symbols/cim/CIMSymbolDrawHelper.js +1 -1
  107. package/symbols/cim/CIMSymbolRasterizer.js +1 -1
  108. package/symbols/support/previewSymbol3D.js +1 -1
  109. package/symbols/support/webStyleSymbolUtils.js +1 -1
  110. package/views/2d/ViewState.js +1 -1
  111. package/views/2d/engine/vectorTiles/Feature.js +1 -1
  112. package/views/2d/engine/vectorTiles/style/StyleRepository.js +1 -1
  113. package/views/2d/engine/webgl/SDFConverter.js +1 -1
  114. package/views/2d/engine/webgl/TurboLine.js +1 -1
  115. package/views/2d/engine/webgl/brushes/BrushClip.js +1 -1
  116. package/views/2d/engine/webgl/brushes/BrushOverlay.js +1 -1
  117. package/views/2d/engine/webgl/brushes/WGLGeometryBrushLabel.js +1 -1
  118. package/views/2d/engine/webgl/brushes/WGLGeometryBrushLine.js +1 -1
  119. package/views/2d/engine/webgl/brushes/WGLGeometryBrushText.js +1 -1
  120. package/views/2d/engine/webgl/collisions/MetricReader.js +1 -1
  121. package/views/2d/engine/webgl/cpuMapped/DisplayRecordReader.js +1 -1
  122. package/views/2d/engine/webgl/cpuMapped/FreeList.js +1 -1
  123. package/views/2d/engine/webgl/mesh/heuristics.js +1 -1
  124. package/views/2d/engine/webgl/mesh/templates/WGLDynamicFillTemplate.js +1 -1
  125. package/views/2d/engine/webgl/mesh/templates/WGLDynamicLineTemplate.js +1 -1
  126. package/views/2d/engine/webgl/mesh/templates/WGLDynamicMarkerTemplate.js +1 -1
  127. package/views/2d/engine/webgl/mesh/templates/WGLDynamicTextTemplate.js +1 -1
  128. package/views/2d/engine/webgl/mesh/templates/WGLFillTemplate.js +1 -1
  129. package/views/2d/engine/webgl/mesh/templates/WGLLineTemplate.js +1 -1
  130. package/views/2d/engine/webgl/mesh/templates/WGLMarkerTemplate.js +1 -1
  131. package/views/2d/engine/webgl/mesh/templates/shapingUtils.js +1 -1
  132. package/views/2d/engine/webgl/shaders/sources/shaderRepository.js +1 -1
  133. package/views/2d/input/MapViewInputManager.js +1 -1
  134. package/views/2d/layers/features/createSymbolSchema.js +1 -1
  135. package/views/2d/viewpointUtils.js +1 -1
  136. package/views/3d/analysis/LineOfSight/LineOfSightController.js +1 -1
  137. package/views/3d/analysis/LineOfSight/LineOfSightIntersectionResult.js +1 -1
  138. package/views/3d/analysis/LineOfSight/LineOfSightRayIntersector.js +1 -1
  139. package/views/3d/analysis/LineOfSight/LineOfSightTool.js +1 -1
  140. package/views/3d/analysis/LineOfSight/LineOfSightVisualization.js +1 -1
  141. package/views/3d/analysis/LineOfSightAnalysisView3D.js +1 -1
  142. package/views/3d/analysis/Slice/SliceTool.js +1 -1
  143. package/views/3d/analysis/Slice/sliceToolUtils.js +1 -1
  144. package/views/3d/camera/constraintUtils/distance.js +1 -1
  145. package/views/3d/environment/ChapmanAtmosphereTechniqueConfiguration.js +1 -1
  146. package/views/3d/environment/CloudsComposition.js +1 -1
  147. package/views/3d/environment/FogTechnique.js +1 -1
  148. package/views/3d/glTF/internal/Resource.js +1 -1
  149. package/views/3d/input/SceneInputManager.js +1 -1
  150. package/views/3d/interactive/editingTools/dragEventPipeline3D.js +1 -1
  151. package/views/3d/interactive/editingTools/draw/DrawGraphicTool3D.js +1 -1
  152. package/views/3d/interactive/editingTools/reshapeGraphic/edgeOffsetUtils.js +1 -1
  153. package/views/3d/interactive/editingTools/transformGraphic/GraphicScaleRotateTransform.js +1 -1
  154. package/views/3d/interactive/editingTools/transformGraphic/GraphicTransformTool.js +1 -1
  155. package/views/3d/interactive/editingTools/transformGraphic/ScaleRotateObjectSymbol3DAdapter.js +1 -1
  156. package/views/3d/interactive/measurementTools/directLineMeasurement3D/DirectLineMeasurement3DTool.js +1 -1
  157. package/views/3d/layers/FeatureLayerViewBase3D.js +1 -1
  158. package/views/3d/layers/GraphicsLayerView3D.js +1 -1
  159. package/views/3d/layers/graphics/Graphics3DCore.js +1 -1
  160. package/views/3d/layers/graphics/Graphics3DExtrudeSymbolLayer.js +1 -1
  161. package/views/3d/layers/graphics/Graphics3DLineCalloutSymbolLayer.js +1 -1
  162. package/views/3d/layers/graphics/Graphics3DLineSymbolLayer.js +1 -1
  163. package/views/3d/layers/graphics/Graphics3DMeshFillSymbolLayer.js +1 -1
  164. package/views/3d/layers/graphics/Graphics3DObjectSymbolLayer.js +1 -1
  165. package/views/3d/layers/graphics/Graphics3DPathSymbolLayer.js +1 -1
  166. package/views/3d/layers/graphics/Graphics3DPolygonFillSymbolLayer.js +1 -1
  167. package/views/3d/layers/graphics/lineUtils.js +1 -1
  168. package/views/3d/layers/i3s/I3SGeometryUtil.js +1 -1
  169. package/views/3d/layers/i3s/I3SIndex.js +1 -1
  170. package/views/3d/layers/i3s/IDBCache.js +1 -1
  171. package/views/3d/layers/i3s/IDBMockCache.js +1 -1
  172. package/views/3d/layers/i3s/PointRenderer.js +1 -1
  173. package/views/3d/layers/support/featureTileQuery3D.js +1 -1
  174. package/views/3d/state/ViewState.js +1 -1
  175. package/views/3d/support/cameraUtils.js +1 -1
  176. package/views/3d/support/orientedBoundingBox.js +1 -1
  177. package/views/3d/support/viewpointUtils.js +1 -1
  178. package/views/3d/terrain/Overlay.js +1 -1
  179. package/views/3d/terrain/OverlayRenderTarget.js +1 -1
  180. package/views/3d/terrain/OverlayRenderer.js +1 -1
  181. package/views/3d/terrain/TerrainRenderer.js +1 -1
  182. package/views/3d/terrain/TerrainSurface.js +1 -1
  183. package/views/3d/terrain/TilingSchemeLogic.js +1 -1
  184. package/views/3d/terrain/interfaces.js +1 -1
  185. package/views/3d/webgl-engine/collections/Component/ComponentObject.js +1 -1
  186. package/views/3d/webgl-engine/collections/Component/DepthRange.js +1 -1
  187. package/views/3d/webgl-engine/collections/Component/Material/ComponentMaterial.js +1 -1
  188. package/views/3d/webgl-engine/collections/Component/Material/ComponentTechniqueConfiguration.js +1 -1
  189. package/views/3d/webgl-engine/collections/Component/Material/shader/ComponentShader.glsl.js +1 -1
  190. package/views/3d/webgl-engine/collections/Component/RenderGeometry.js +1 -1
  191. package/views/3d/webgl-engine/core/renderPasses/AllRenderPasses.js +1 -1
  192. package/views/3d/webgl-engine/core/renderPasses/RenderPassManager.js +1 -1
  193. package/views/3d/webgl-engine/core/shaderLibrary/ShaderOutput.js +1 -1
  194. package/views/3d/webgl-engine/core/shaderLibrary/Slice.glsl.js +2 -2
  195. package/views/3d/webgl-engine/core/shaderLibrary/attributes/InstancedDoublePrecision.glsl.js +2 -2
  196. package/views/3d/webgl-engine/core/shaderLibrary/attributes/ObjectAndLayerIdColor.glsl.js +9 -0
  197. package/views/3d/webgl-engine/core/shaderLibrary/default/DefaultMaterialAuxiliaryPasses.glsl.js +18 -17
  198. package/views/3d/webgl-engine/lib/DefaultVertexAttributeLocations.js +1 -1
  199. package/views/3d/webgl-engine/lib/Geometry.js +1 -1
  200. package/views/3d/webgl-engine/lib/Intersector.js +1 -1
  201. package/views/3d/webgl-engine/lib/ObjectAndLayerIdRenderHelper.js +5 -0
  202. package/views/3d/webgl-engine/lib/Octree.js +1 -1
  203. package/views/3d/webgl-engine/lib/OffscreenRendering.js +1 -1
  204. package/views/3d/webgl-engine/lib/PathGeometry.js +1 -1
  205. package/views/3d/webgl-engine/lib/Renderer.js +1 -1
  206. package/views/3d/webgl-engine/lib/TextureTechniqueConfiguration.js +1 -1
  207. package/views/3d/webgl-engine/lib/VertexAttribute.js +1 -1
  208. package/views/3d/webgl-engine/lib/geometryDataUtils.js +1 -1
  209. package/views/3d/webgl-engine/lib/lodRendering/InstanceData.js +1 -1
  210. package/views/3d/webgl-engine/lib/lodRendering/LodRenderer.js +1 -1
  211. package/views/3d/webgl-engine/lib/lodRendering/RenderInstanceData.js +1 -1
  212. package/views/3d/webgl-engine/materials/DefaultMaterial.js +1 -1
  213. package/views/3d/webgl-engine/materials/NativeLineMaterial.js +1 -1
  214. package/views/3d/webgl-engine/materials/PathMaterial.js +1 -1
  215. package/views/3d/webgl-engine/materials/RibbonLineMaterial.js +1 -1
  216. package/views/3d/webgl-engine/materials/ShadedColorMaterial.js +1 -1
  217. package/views/3d/webgl-engine/materials/internal/bufferWriterUtils.js +1 -1
  218. package/views/3d/webgl-engine/parts/RenderView.js +1 -1
  219. package/views/3d/webgl-engine/parts/ScreenshotManager.js +1 -1
  220. package/views/3d/webgl-engine/shaders/DefaultMaterialTechnique.js +1 -1
  221. package/views/3d/webgl-engine/shaders/DefaultMaterialTechniqueConfiguration.js +1 -1
  222. package/views/3d/webgl-engine/shaders/LaserlinePathTechniqueConfiguration.js +1 -1
  223. package/views/3d/webgl-engine/shaders/RibbonLine.glsl.js +1 -1
  224. package/views/3d/webgl-engine/shaders/RibbonLineTechnique.js +1 -1
  225. package/views/3d/webgl-engine/shaders/RibbonLineTechniqueConfiguration.js +1 -1
  226. package/views/DOMContainer.js +1 -1
  227. package/views/MapView.js +1 -1
  228. package/views/SceneView.js +1 -1
  229. package/views/View.js +1 -1
  230. package/views/analysis/analysisViewUtils.js +1 -1
  231. package/views/animation/pointToPoint/apex/planning.js +1 -1
  232. package/views/draw/PolygonDrawAction.js +1 -1
  233. package/views/draw/PolylineDrawAction.js +1 -1
  234. package/views/draw/support/createUtils.js +1 -1
  235. package/views/draw/support/surfaceCoordinateSystems.js +1 -1
  236. package/views/input/InputManager.js +1 -1
  237. package/views/input/handlers/LatestPointer.js +1 -1
  238. package/views/input/handlers/MultiTouch.js +5 -0
  239. package/views/interactive/editGeometry/operations/OffsetEdgeVertex.js +1 -1
  240. package/views/interactive/snapping/featureSources/GraphicsSnappingSource.js +1 -1
  241. package/views/interactive/snapping/featureSources/featureServiceSource/FeatureServiceTileCache.js +1 -1
  242. package/views/interactive/tooltip/Tooltip.js +1 -1
  243. package/views/interactive/tooltip/support/measurements.js +1 -1
  244. package/views/layers/GroupLayerView.js +1 -1
  245. package/views/navigation/FilteredFiniteDifference.js +1 -1
  246. package/views/navigation/MomentumEstimator.js +1 -1
  247. package/views/navigation/PanPlanarMomentumEstimator.js +1 -1
  248. package/views/navigation/PanSphericalMomentumEstimator.js +1 -1
  249. package/views/navigation/RotationMomentumEstimator.js +1 -1
  250. package/views/support/GroundViewElevationSampler.js +1 -1
  251. package/views/support/euclideanAreaMeasurementUtils.js +1 -1
  252. package/views/support/euclideanLengthMeasurementUtils.js +1 -1
  253. package/views/support/screenshotUtils.js +1 -1
  254. package/views/webgl/BufferObject.js +1 -1
  255. package/views/webgl/FramebufferObject.js +1 -1
  256. package/views/webgl/Texture.js +1 -1
  257. package/views/webgl/capabilities/Capabilities.js +1 -1
  258. package/views/webgl/capabilities.js +1 -1
  259. package/views/webgl/renderState.js +1 -1
  260. package/webscene/spec-certification/api.js +1 -1
  261. package/widgets/CoordinateConversion/support/formatUtils.js +1 -1
  262. package/widgets/ElevationProfile/ElevationProfileController.js +1 -1
  263. package/widgets/ElevationProfile/ElevationProfileLineInput.js +1 -1
  264. package/widgets/ElevationProfile/ElevationProfileLineView.js +1 -1
  265. package/widgets/ElevationProfile/support/chartUtils.js +1 -1
  266. package/widgets/ElevationProfile/support/geometryUtils.js +1 -1
  267. package/widgets/Expand.js +1 -1
  268. package/widgets/Legend/support/sizeRampUtils.js +1 -1
  269. package/widgets/LineOfSight/LineOfSightViewModel.js +1 -1
  270. package/widgets/Popup/PopupViewModel.js +1 -1
  271. package/widgets/Popup/actionUtils.js +1 -1
  272. package/widgets/ScaleRangeSlider.js +1 -1
  273. package/widgets/Slider/SliderViewModel.js +1 -1
  274. package/widgets/Widget.js +1 -1
  275. package/assets/esri/core/workers/chunks/04ea469cb081e181ca82.js +0 -1
  276. package/assets/esri/core/workers/chunks/16c2626ca47132700519.js +0 -1
  277. package/assets/esri/core/workers/chunks/1e4e5d147263e98536bc.js +0 -1
  278. package/assets/esri/core/workers/chunks/35083def3c658d1ae9ff.js +0 -1
  279. package/assets/esri/core/workers/chunks/40032d2bf404a46b8f80.js +0 -1
  280. package/assets/esri/core/workers/chunks/613e82a3e13442685ac4.js +0 -1
  281. package/assets/esri/core/workers/chunks/64b4f1dbf61439cde801.js +0 -1
  282. package/assets/esri/core/workers/chunks/abd68b7ba3be4696611c.js +0 -1
  283. package/assets/esri/core/workers/chunks/b8a062c0c9c626acf61e.js +0 -982
  284. package/assets/esri/core/workers/chunks/e08686088be0aaca1a99.js +0 -1
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.25/esri/copyright.txt for details.
4
4
  */
5
- import{JSONMap as t}from"../../../core/jsonMap.js";import{isNone as e,unwrap as n,isSome as r}from"../../../core/maybe.js";import o from"../PixelBlock.js";import{isValidPixelBlock as a}from"./pixelUtils.js";const s=new Map;s.set("meter-per-second",1),s.set("kilometer-per-hour",.277778),s.set("knots",.514444),s.set("feet-per-second",.3048),s.set("mile-per-hour",.44704);const i=180/Math.PI,h=5,l=new t({esriMetersPerSecond:"meter-per-second",esriKilometersPerHour:"kilometer-per-hour",esriKnots:"knots",esriFeetPerSecond:"feet-per-second",esriMilesPerHour:"mile-per-hour"});function c(t,e){return s.get(t)/s.get(e)||1}function u(t){return(450-t)%360}function f(t,e="geographic"){const[n,r]=t,o=Math.sqrt(n*n+r*r);let a=Math.atan2(r,n)*i;return a=(360+a)%360,"geographic"===e&&(a=u(a)),[o,a]}function p(t,e="geographic"){let n=t[1];"geographic"===e&&(n=u(n)),n%=360;const r=t[0];return[r*Math.cos(n/i),r*Math.sin(n/i)]}function m(t,r,o,s="geographic"){if(!a(t)||e(o))return t;const i="vector-magdir"===r?t.clone():n(d(t,r)),h=i.pixels[1];for(let e=0;e<h.length;e++)h[e]="geographic"===s?(h[e]+o[e]+270)%360:(h[e]+360-o[e])%360;return"vector-magdir"===r?i:d(i,"vector-magdir")}function d(t,e,n="geographic",r=1){if(!a(t))return t;const{pixels:s,width:i,height:h}=t,l=i*h,c=s[0],u=s[1],m=t.pixelType.startsWith("f")?t.pixelType:"f32",d=o.createEmptyBand(m,l),M=o.createEmptyBand(m,l);let g=0;for(let o=0;o<h;o++)for(let t=0;t<i;t++)"vector-uv"===e?([d[g],M[g]]=f([c[g],u[g]],n),d[g]*=r):([d[g],M[g]]=p([c[g],u[g]],n),d[g]*=r,M[g]*=r),g++;const x=new o({pixelType:m,width:t.width,height:t.height,mask:t.mask,validPixelCount:t.validPixelCount,maskIsAlpha:t.maskIsAlpha,pixels:[d,M]});return x.updateStatistics(),x}function M(t,e,n=1){if(1===n||!a(t))return t;const r=t.clone(),{pixels:o,width:s,height:i}=r,h=o[0],l=o[1];let c=0;for(let a=0;a<i;a++)for(let t=0;t<s;t++)"vector-uv"===e?(h[c]*=n,l[c]*=n):h[c]*=n,c++;return r.updateStatistics(),r}function g(t,n,r,o,a){if(e(a)||!a.spatialReference.equals(t.spatialReference))return{extent:t,width:Math.round(n/o),height:Math.round(r/o),resolution:t.width/n};const s=a.xmin,i=a.ymax,h=(t.xmax-t.xmin)/n*o,l=(t.ymax-t.ymin)/r*o,c=(h+l)/2;return t.xmin=s+Math.floor((t.xmin-s)/h)*h,t.xmax=s+Math.ceil((t.xmax-s)/h)*h,t.ymin=i+Math.floor((t.ymin-i)/l)*l,t.ymax=i+Math.ceil((t.ymax-i)/l)*l,{extent:t,width:Math.round(t.width/h),height:Math.round(t.height/l),resolution:c}}const x=k(0,0,0);function k(t=0,e=0,n=Math.PI,r=!0){r&&(n=(2*Math.PI-n)%(2*Math.PI));const o=r?-1:1,a=13*o,s=-7*o,i=-2*o,h=-16*o,l=21.75,[c,u]=y(0,e+a,n,l),[f,p]=y(t-5.5,e+s,n,l),[m,d]=y(t+5.5,e+s,n,l),[M,g]=y(t-1.5,e+i,n,l),[x,k]=y(t+1.5,e+i,n,l),[w,P]=y(t-1.5,e+h,n,l),[b,I]=y(t+1.5,e+h,n,l);return[c,u,f,p,M,g,x,k,m,d,w,P,b,I]}function w(t=0,e=Math.PI,n=!0){n&&(e=(2*Math.PI-e)%(2*Math.PI));const r=10,o=n?-1:1,a=5*o,s=20*o,i=25*o,l=45,c=0,u=0,f=2,p=0,m=f*o;let[d,M]=[c+r/2,u-s],[g,x]=[d+f,M],[k,w]=[g-p,x+m],[P,b]=[c-r/2,u-i],[I,v]=[P+p,b-m],A=Math.ceil(t/h),_=Math.floor(A/10);A-=8*_;const U=[],S=[];for(let h=0;h<A/2;h++,_--){_<=0&&A%2==1&&h===(A-1)/2&&(P=c,I=P+p,b=(b+M)/2,v=b-m);const[t,n]=y(P,b,e,l);if(_>0){const[r,o]=y(g,b,e,l),[a,s]=y(d,M,e,l);U.push(r),U.push(o),U.push(t),U.push(n),U.push(a),U.push(s)}else{const[r,o]=y(g,x,e,l),[a,s]=y(k,w,e,l),[i,h]=y(I,v,e,l);S.push(t),S.push(n),S.push(i),S.push(h),S.push(a),S.push(s),S.push(r),S.push(o)}b+=a,M+=a,x+=a,w+=a,v+=a}const[D,F]=y(c+r/2,u+s,e,l),j=r/2+f,[N,J]=y(c+j,u+s,e,l),[O,q]=y(c+r/2,u-i,e,l),[B,E]=y(c+j,u-i,e,l);return{pennants:U,barbs:S,shaft:[D,F,N,J,O,q,B,E]}}function y(t,e,n,r=1){const o=Math.sqrt(t*t+e*e)/r,a=(2*Math.PI+Math.atan2(e,t))%(2*Math.PI);return[o,(2*Math.PI+a-n)%(2*Math.PI)]}const P=[0,1,3,6,10,16,21,27,33,40,47,55,63],b=[0,.5,1,1.5,2],I=[0,.25,.5,1,1.5,2,2.5,3,3.5,4];function v(t,e,n,r){const o=c(r||"knots",n);let a;for(a=1;a<e.length;a++)if(a===e.length-1){if(t<e[a]*o)break}else if(t<=e[a]*o)break;return Math.min(a-1,e.length-2)}function A(t,e,n,r,o){let a=0;switch(e){case"beaufort_kn":a=v(t,P,"knots",n);break;case"beaufort_km":a=v(t,P,"kilometer-per-hour",n);break;case"beaufort_ft":a=v(t,P,"feet-per-second",n);break;case"beaufort_m":a=v(t,P,"meter-per-second",n);break;case"classified_arrow":a=v(t,o,r,n);break;case"ocean_current_m":a=v(t,b,"meter-per-second",n);break;case"ocean_current_kn":a=v(t,I,"knots",n)}return a}function _(t,e){const{style:n,inputUnit:o,outputUnit:a,breakValues:s}=e,i=l.fromJSON(o),h=l.fromJSON(a),c=7*6,u=15;let f=0,p=0;const{width:m,height:d,mask:M}=t,g=t.pixels[0],k=t.pixels[1],w=r(M)?M.filter((t=>t>0)).length:m*d,y=new Float32Array(w*c),P=new Uint32Array(u*w);for(let r=0;r<d;r++)for(let t=0;t<m;t++){const e=r*m+t;if(!M||M[r*m+t]){const o=(k[e]+360)%360/180*Math.PI??2*Math.PI*Math.random(),a=A(g[e],n,i,h,s);for(let n=0;n<x.length;n+=2)y[f++]=(t+.5)/m,y[f++]=(r+.5)/d,y[f++]=x[n],y[f++]=x[n+1]+o,y[f++]=a,y[f++]=g[e];const l=7*(f/c-1);P[p++]=l,P[p++]=l+1,P[p++]=l+2,P[p++]=l+0,P[p++]=l+4,P[p++]=l+3,P[p++]=l+0,P[p++]=l+2,P[p++]=l+3,P[p++]=l+2,P[p++]=l+5,P[p++]=l+3,P[p++]=l+5,P[p++]=l+6,P[p++]=l+3}}return{vertexData:y,indexData:P}}const U=[];function S(t,e){if(0===U.length)for(let h=0;h<30;h++)U.push(w(5*h,0));const n=c(l.fromJSON(e.inputUnit),"knots"),{width:r,height:o,mask:a}=t,s=t.pixels[0],i=t.pixels[1],u=6,f=[],p=[];let m=0,d=0;for(let l=0;l<o;l++)for(let t=0;t<r;t++){const e=l*r+t,c=s[e]*n;if((!a||a[l*r+t])&&c>=h){const n=(i[e]+360)%360/180*Math.PI??2*Math.PI*Math.random(),{pennants:a,barbs:s,shaft:h}=U[Math.min(Math.floor(c/5),29)];if(a.length+s.length===0)continue;let M=f.length/u;const g=(t+.5)/r,x=(l+.5)/o;for(let t=0;t<a.length;t+=2)f[m++]=g,f[m++]=x,f[m++]=a[t],f[m++]=a[t+1]+n,f[m++]=0,f[m++]=c;for(let t=0;t<s.length;t+=2)f[m++]=g,f[m++]=x,f[m++]=s[t],f[m++]=s[t+1]+n,f[m++]=0,f[m++]=c;for(let t=0;t<h.length;t+=2)f[m++]=g,f[m++]=x,f[m++]=h[t],f[m++]=h[t+1]+n,f[m++]=0,f[m++]=c;for(let t=0;t<a.length/6;t++)p[d++]=M,p[d++]=M+1,p[d++]=M+2,M+=3;for(let t=0;t<s.length/8;t++)p[d++]=M,p[d++]=M+1,p[d++]=M+2,p[d++]=M+1,p[d++]=M+2,p[d++]=M+3,M+=4;p[d++]=M+0,p[d++]=M+1,p[d++]=M+2,p[d++]=M+1,p[d++]=M+3,p[d++]=M+2,M+=4}}return{vertexData:new Float32Array(f),indexData:new Uint32Array(p)}}function D(t,e){const n=4*6;let r=0,o=0;const{width:a,height:s,mask:i}=t,u=t.pixels[0],f=[],p=[],m=c(l.fromJSON(e.inputUnit),"knots"),d="wind_speed"===e.style?h:Number.MAX_VALUE;for(let h=0;h<s;h++)for(let t=0;t<a;t++){const e=u[h*a+t]*m;if((!i||i[h*a+t])&&e<d){for(let n=0;n<4;n++)f[r++]=(t+.5)/a,f[r++]=(h+.5)/s,f[r++]=n<2?-.5:.5,f[r++]=n%2==0?-.5:.5,f[r++]=0,f[r++]=e;const i=4*(r/n-1);p[o++]=i,p[o++]=i+1,p[o++]=i+2,p[o++]=i+1,p[o++]=i+2,p[o++]=i+3}}return{vertexData:new Float32Array(f),indexData:new Uint32Array(p)}}function F(t,e){return"simple_scalar"===e.style?D(t,e):"wind_speed"===e.style?S(t,e):_(t,e)}function j(t,e,n,r=[0,0],a=.5){const{width:s,height:i,mask:h}=t,[l,c]=t.pixels,[u,m]=r,d=Math.round((s-u)/n),M=Math.round((i-m)/n),g=d*M,x=new Float32Array(g),k=new Float32Array(g),w=new Uint8Array(g),y="vector-uv"===e;for(let o=0;o<M;o++)for(let t=0;t<d;t++){let e=0;const r=o*d+t,M=Math.max(0,o*n+m),g=Math.max(0,t*n+u),P=Math.min(i,M+n),b=Math.min(s,g+n);for(let t=M;t<P;t++)for(let n=g;n<b;n++){const o=t*s+n;if(!h||h[o]){e++;const t=y?[l[o],c[o]]:[l[o],(360+c[o])%360],[n,a]=y?t:p(t);x[r]+=n,k[r]+=a}}if(e>=(P-M)*(b-g)*(1-a)){w[r]=1;const[t,n]=f([x[r]/e,k[r]/e]);x[r]=t,k[r]=n}else w[r]=0,x[r]=0,k[r]=0}const P=new o({width:d,height:M,pixels:[x,k],mask:w});return P.updateStatistics(),P}export{m as convertToLocalDirections,d as convertVectorFieldData,M as convertVectorFieldUnit,F as createVFMesh,D as createVFMeshScalar,c as getUnitConversionFactor,j as sampleVectorField,g as snapImageToSymbolTile,l as unitKebabDict,f as uvComponentToVector};
5
+ import{JSONMap as t}from"../../../core/jsonMap.js";import{isNone as e,unwrap as n,isSome as r}from"../../../core/maybe.js";import o from"../PixelBlock.js";import{isValidPixelBlock as s}from"./pixelUtils.js";const i=new Map;i.set("meter-per-second",1),i.set("kilometer-per-hour",.277778),i.set("knots",.514444),i.set("feet-per-second",.3048),i.set("mile-per-hour",.44704);const a=180/Math.PI,h=5,l=new t({esriMetersPerSecond:"meter-per-second",esriKilometersPerHour:"kilometer-per-hour",esriKnots:"knots",esriFeetPerSecond:"feet-per-second",esriMilesPerHour:"mile-per-hour"});function c(t,e){return i.get(t)/i.get(e)||1}function u(t){return(450-t)%360}function f(t,e="geographic"){const[n,r]=t,o=Math.sqrt(n*n+r*r);let s=Math.atan2(r,n)*a;return s=(360+s)%360,"geographic"===e&&(s=u(s)),[o,s]}function p(t,e="geographic"){let n=t[1];"geographic"===e&&(n=u(n)),n%=360;const r=t[0];return[r*Math.cos(n/a),r*Math.sin(n/a)]}function m(t,r,o,i="geographic"){if(!s(t)||e(o))return t;const a="vector-magdir"===r?t.clone():n(d(t,r)),h=a.pixels[1];for(let e=0;e<h.length;e++)h[e]="geographic"===i?(h[e]+o[e]+270)%360:(h[e]+360-o[e])%360;return"vector-magdir"===r?a:d(a,"vector-magdir")}function d(t,e,n="geographic",r=1){if(!s(t))return t;const{pixels:i,width:a,height:h}=t,l=a*h,c=i[0],u=i[1],m=t.pixelType.startsWith("f")?t.pixelType:"f32",d=o.createEmptyBand(m,l),g=o.createEmptyBand(m,l);let x=0;for(let o=0;o<h;o++)for(let t=0;t<a;t++)"vector-uv"===e?([d[x],g[x]]=f([c[x],u[x]],n),d[x]*=r):([d[x],g[x]]=p([c[x],u[x]],n),d[x]*=r,g[x]*=r),x++;const M=new o({pixelType:m,width:t.width,height:t.height,mask:t.mask,validPixelCount:t.validPixelCount,maskIsAlpha:t.maskIsAlpha,pixels:[d,g]});return M.updateStatistics(),M}function g(t,e,n=1){if(1===n||!s(t))return t;const r=t.clone(),{pixels:o,width:i,height:a}=r,h=o[0],l=o[1];let c=0;for(let s=0;s<a;s++)for(let t=0;t<i;t++)"vector-uv"===e?(h[c]*=n,l[c]*=n):h[c]*=n,c++;return r.updateStatistics(),r}function x(t,n,r,o,s){if(e(s)||!s.spatialReference.equals(t.spatialReference))return{extent:t,width:Math.round(n/o),height:Math.round(r/o),resolution:t.width/n};const i=s.xmin,a=s.ymax,h=(t.xmax-t.xmin)/n*o,l=(t.ymax-t.ymin)/r*o,c=(h+l)/2;return t.xmin=i+Math.floor((t.xmin-i)/h)*h,t.xmax=i+Math.ceil((t.xmax-i)/h)*h,t.ymin=a+Math.floor((t.ymin-a)/l)*l,t.ymax=a+Math.ceil((t.ymax-a)/l)*l,{extent:t,width:Math.round(t.width/h),height:Math.round(t.height/l),resolution:c}}const M=k(0,0,0);function k(t=0,e=0,n=Math.PI,r=!0){r&&(n=(2*Math.PI-n)%(2*Math.PI));const o=r?-1:1,s=13*o,i=-7*o,a=-2*o,h=-16*o,l=21.75,[c,u]=y(0,e+s,n,l),[f,p]=y(t-5.5,e+i,n,l),[m,d]=y(t+5.5,e+i,n,l),[g,x]=y(t-1.5,e+a,n,l),[M,k]=y(t+1.5,e+a,n,l),[w,P]=y(t-1.5,e+h,n,l),[b,I]=y(t+1.5,e+h,n,l);return[c,u,f,p,g,x,M,k,m,d,w,P,b,I]}function w(t=0,e=Math.PI,n=!0){n&&(e=(2*Math.PI-e)%(2*Math.PI));const r=10,o=n?-1:1,s=5*o,i=20*o,a=25*o,l=45,c=0,u=0,f=2,p=0,m=f*o;let[d,g]=[c+r/2,u-i],[x,M]=[d+f,g],[k,w]=[x-p,M+m],[P,b]=[c-r/2,u-a],[I,v]=[P+p,b-m],A=Math.ceil(t/h),_=Math.floor(A/10);A-=8*_;const U=[],S=[];for(let h=0;h<A/2;h++,_--){_<=0&&A%2==1&&h===(A-1)/2&&(P=c,I=P+p,b=(b+g)/2,v=b-m);const[t,n]=y(P,b,e,l);if(_>0){const[r,o]=y(x,b,e,l),[s,i]=y(d,g,e,l);U.push(r),U.push(o),U.push(t),U.push(n),U.push(s),U.push(i)}else{const[r,o]=y(x,M,e,l),[s,i]=y(k,w,e,l),[a,h]=y(I,v,e,l);S.push(t),S.push(n),S.push(a),S.push(h),S.push(s),S.push(i),S.push(r),S.push(o)}b+=s,g+=s,M+=s,w+=s,v+=s}const[D,F]=y(c+r/2,u+i,e,l),j=r/2+f,[N,J]=y(c+j,u+i,e,l),[O,q]=y(c+r/2,u-a,e,l),[B,E]=y(c+j,u-a,e,l);return{pennants:U,barbs:S,shaft:[D,F,N,J,O,q,B,E]}}function y(t,e,n,r=1){const o=Math.sqrt(t*t+e*e)/r,s=(2*Math.PI+Math.atan2(e,t))%(2*Math.PI);return[o,(2*Math.PI+s-n)%(2*Math.PI)]}const P=[0,1,3,6,10,16,21,27,33,40,47,55,63],b=[0,.5,1,1.5,2],I=[0,.25,.5,1,1.5,2,2.5,3,3.5,4];function v(t,e,n,r){const o=c(r||"knots",n);let s;for(s=1;s<e.length;s++)if(s===e.length-1){if(t<e[s]*o)break}else if(t<=e[s]*o)break;return Math.min(s-1,e.length-2)}function A(t,e,n,r,o){let s=0;switch(e){case"beaufort_kn":s=v(t,P,"knots",n);break;case"beaufort_km":s=v(t,P,"kilometer-per-hour",n);break;case"beaufort_ft":s=v(t,P,"feet-per-second",n);break;case"beaufort_m":s=v(t,P,"meter-per-second",n);break;case"classified_arrow":s=v(t,o,r,n);break;case"ocean_current_m":s=v(t,b,"meter-per-second",n);break;case"ocean_current_kn":s=v(t,I,"knots",n)}return s}function _(t,e){const{style:n,inputUnit:o,outputUnit:s,breakValues:i}=e,a=l.fromJSON(o),h=l.fromJSON(s),c=7*6,u=15;let f=0,p=0;const{width:m,height:d,mask:g}=t,x=t.pixels[0],k=t.pixels[1],w=r(g)?g.filter((t=>t>0)).length:m*d,y=new Float32Array(w*c),P=new Uint32Array(u*w);for(let r=0;r<d;r++)for(let t=0;t<m;t++){const e=r*m+t;if(!g||g[r*m+t]){const o=(k[e]+360)%360/180*Math.PI,s=A(x[e],n,a,h,i);for(let n=0;n<M.length;n+=2)y[f++]=(t+.5)/m,y[f++]=(r+.5)/d,y[f++]=M[n],y[f++]=M[n+1]+o,y[f++]=s,y[f++]=x[e];const l=7*(f/c-1);P[p++]=l,P[p++]=l+1,P[p++]=l+2,P[p++]=l+0,P[p++]=l+4,P[p++]=l+3,P[p++]=l+0,P[p++]=l+2,P[p++]=l+3,P[p++]=l+2,P[p++]=l+5,P[p++]=l+3,P[p++]=l+5,P[p++]=l+6,P[p++]=l+3}}return{vertexData:y,indexData:P}}const U=[];function S(t,e){if(0===U.length)for(let h=0;h<30;h++)U.push(w(5*h,0));const n=c(l.fromJSON(e.inputUnit),"knots"),{width:r,height:o,mask:s}=t,i=t.pixels[0],a=t.pixels[1],u=6,f=[],p=[];let m=0,d=0;for(let l=0;l<o;l++)for(let t=0;t<r;t++){const e=l*r+t,c=i[e]*n;if((!s||s[l*r+t])&&c>=h){const n=(a[e]+360)%360/180*Math.PI,{pennants:s,barbs:i,shaft:h}=U[Math.min(Math.floor(c/5),29)];if(s.length+i.length===0)continue;let g=f.length/u;const x=(t+.5)/r,M=(l+.5)/o;for(let t=0;t<s.length;t+=2)f[m++]=x,f[m++]=M,f[m++]=s[t],f[m++]=s[t+1]+n,f[m++]=0,f[m++]=c;for(let t=0;t<i.length;t+=2)f[m++]=x,f[m++]=M,f[m++]=i[t],f[m++]=i[t+1]+n,f[m++]=0,f[m++]=c;for(let t=0;t<h.length;t+=2)f[m++]=x,f[m++]=M,f[m++]=h[t],f[m++]=h[t+1]+n,f[m++]=0,f[m++]=c;for(let t=0;t<s.length/6;t++)p[d++]=g,p[d++]=g+1,p[d++]=g+2,g+=3;for(let t=0;t<i.length/8;t++)p[d++]=g,p[d++]=g+1,p[d++]=g+2,p[d++]=g+1,p[d++]=g+2,p[d++]=g+3,g+=4;p[d++]=g+0,p[d++]=g+1,p[d++]=g+2,p[d++]=g+1,p[d++]=g+3,p[d++]=g+2,g+=4}}return{vertexData:new Float32Array(f),indexData:new Uint32Array(p)}}function D(t,e){const n=4*6;let r=0,o=0;const{width:s,height:i,mask:a}=t,u=t.pixels[0],f=[],p=[],m=c(l.fromJSON(e.inputUnit),"knots"),d="wind_speed"===e.style?h:Number.MAX_VALUE;for(let h=0;h<i;h++)for(let t=0;t<s;t++){const e=u[h*s+t]*m;if((!a||a[h*s+t])&&e<d){for(let n=0;n<4;n++)f[r++]=(t+.5)/s,f[r++]=(h+.5)/i,f[r++]=n<2?-.5:.5,f[r++]=n%2==0?-.5:.5,f[r++]=0,f[r++]=e;const a=4*(r/n-1);p[o++]=a,p[o++]=a+1,p[o++]=a+2,p[o++]=a+1,p[o++]=a+2,p[o++]=a+3}}return{vertexData:new Float32Array(f),indexData:new Uint32Array(p)}}function F(t,e){return"simple_scalar"===e.style?D(t,e):"wind_speed"===e.style?S(t,e):_(t,e)}function j(t,e,n,r=[0,0],s=.5){const{width:i,height:a,mask:h}=t,[l,c]=t.pixels,[u,m]=r,d=Math.round((i-u)/n),g=Math.round((a-m)/n),x=d*g,M=new Float32Array(x),k=new Float32Array(x),w=new Uint8Array(x),y="vector-uv"===e;for(let o=0;o<g;o++)for(let t=0;t<d;t++){let e=0;const r=o*d+t,g=Math.max(0,o*n+m),x=Math.max(0,t*n+u),P=Math.min(a,g+n),b=Math.min(i,x+n);for(let t=g;t<P;t++)for(let n=x;n<b;n++){const o=t*i+n;if(!h||h[o]){e++;const t=y?[l[o],c[o]]:[l[o],(360+c[o])%360],[n,s]=y?t:p(t);M[r]+=n,k[r]+=s}}if(e>=(P-g)*(b-x)*(1-s)){w[r]=1;const[t,n]=f([M[r]/e,k[r]/e]);M[r]=t,k[r]=n}else w[r]=0,M[r]=0,k[r]=0}const P=new o({width:d,height:g,pixels:[M,k],mask:w});return P.updateStatistics(),P}export{m as convertToLocalDirections,d as convertVectorFieldData,g as convertVectorFieldUnit,F as createVFMesh,D as createVFMeshScalar,c as getUnitConversionFactor,j as sampleVectorField,x as snapImageToSymbolTile,l as unitKebabDict,f as uvComponentToVector};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.25/esri/copyright.txt for details.
4
4
  */
5
- import e from"../../config.js";import r from"../../request.js";import{throwIfAborted as t}from"../../core/promiseUtils.js";import{removeTrailingSlash as s,getOrigin as o,isProtocolRelative as l,isAbsolute as n,join as i,normalize as u,removeFile as c,getAppBaseUrl as a,addQueryParameters as f}from"../../core/urlUtils.js";import p from"../../views/2d/engine/vectorTiles/style/VectorTileSource.js";const y=e.defaults&&e.defaults.io.corsEnabledServers;async function m(e,r){const t={source:null,sourceBase:null,sourceUrl:null,validatedSource:null,style:null,styleBase:null,styleUrl:null,sourceNameToSource:{},primarySourceName:"",spriteFormat:"png"},[s,o]="string"==typeof e?[e,null]:[null,e.jsonUrl];await S(t,"esri",e,o,r);const l={layerDefinition:t.validatedSource,url:s,serviceUrl:t.sourceUrl,style:t.style,styleUrl:t.styleUrl,spriteUrl:t.style.sprite&&h(t.styleBase,t.style.sprite),spriteFormat:t.spriteFormat,glyphsUrl:t.style.glyphs&&h(t.styleBase,t.style.glyphs),sourceNameToSource:t.sourceNameToSource,primarySourceName:t.primarySourceName};return d(l.spriteUrl),d(l.glyphsUrl),l}function d(e){if(!e)return;const r=o(e);y&&!y.includes(r)&&y.push(r)}function h(...e){let r;for(let t=0;t<e.length;++t)if(l(e[t])){if(r){const s=r.split("://")[0];r=s+":"+e[t].trim()}}else r=n(e[t])?e[t]:i(r,e[t]);return s(r)}async function S(e,s,o,l,n){let i,c,a;if(t(n),"string"==typeof o){const e=u(o);d(e),a=await r(e,{...n,responseType:"json",query:{f:"json",...n?.query}}),a.ssl&&(i&&(i=i.replace(/^http:/i,"https:")),c&&(c=c.replace(/^http:/i,"https:"))),i=e,c=e}else a={data:o},i=o.jsonUrl||null,c=l;const f=a.data;if(U(f))return e.styleUrl=i||null,x(e,f,c,n);if(w(f))return e.sourceUrl?g(e,f,c,!1,s,n):(e.sourceUrl=i||null,g(e,f,c,!0,s,n));throw new Error("You must specify the URL or the JSON for a service or for a style.")}function U(e){return!!e.sources}function w(e){return!U(e)}async function x(e,r,t,s){const o=t?c(t):a();e.styleBase=o,e.style=r,e.styleUrl&&d(e.styleUrl),r["sprite-format"]&&"webp"===r["sprite-format"].toLowerCase()&&(e.spriteFormat="webp");const l=[];if(r.sources&&r.sources.esri){const t=r.sources.esri;t.url?await S(e,"esri",h(o,t.url),void 0,s):l.push(S(e,"esri",t,o,s))}for(const n of Object.keys(r.sources))"esri"!==n&&"vector"===r.sources[n].type&&(r.sources[n].url?l.push(S(e,n,h(o,r.sources[n].url),void 0,s)):r.sources[n].tiles&&l.push(S(e,n,r.sources[n],o,s)));await Promise.all(l)}async function g(e,r,t,o,l,n){const i=t?s(t)+"/":a(),u=v(r,i),c=new p(l,f(i,n?.query),u);if(!o&&e.primarySourceName in e.sourceNameToSource){const r=e.sourceNameToSource[e.primarySourceName];if(!r.isCompatibleWith(c))return;null!=c.fullExtent&&(null!=r.fullExtent?r.fullExtent.union(c.fullExtent):r.fullExtent=c.fullExtent.clone()),r.tileInfo.lods.length<c.tileInfo.lods.length&&(r.tileInfo=c.tileInfo)}if(o?(e.sourceBase=i,e.source=r,e.validatedSource=u,e.primarySourceName=l,e.sourceUrl&&d(e.sourceUrl)):d(i),e.sourceNameToSource[l]=c,!e.style){if(null==r.defaultStyles)throw new Error;return"string"==typeof r.defaultStyles?S(e,"",h(i,r.defaultStyles,"root.json"),void 0,n):S(e,"",r.defaultStyles,h(i,"root.json"),n)}}function v(e,r){if(e.hasOwnProperty("tileInfo"))return e;const t={xmin:-20037507.067161843,ymin:-20037507.067161843,xmax:20037507.067161843,ymax:20037507.067161843,spatialReference:{wkid:102100}},s=512;let o=78271.51696400007,l=295828763.7957775;const n=[],i=e.hasOwnProperty("minzoom")?+e.minzoom:0,u=e.hasOwnProperty("maxzoom")?+e.maxzoom:22;for(let c=0;c<=u;c++)c>=i&&n.push({level:c,scale:l,resolution:o}),o/=2,l/=2;for(const c of e.tiles)d(h(r,c));return{capabilities:"TilesOnly",initialExtent:t,fullExtent:t,minScale:0,maxScale:0,tiles:e.tiles,tileInfo:{rows:s,cols:s,dpi:96,format:"pbf",origin:{x:-20037508.342787,y:20037508.342787},lods:n,spatialReference:{wkid:102100}}}}export{m as loadMetadata};
5
+ import e from"../../config.js";import r from"../../request.js";import{throwIfAborted as t}from"../../core/promiseUtils.js";import{getOrigin as s,isProtocolRelative as o,isAbsolute as l,join as n,removeTrailingSlash as i,normalize as u,removeFile as c,getAppBaseUrl as a,addQueryParameters as f}from"../../core/urlUtils.js";import p from"../../views/2d/engine/vectorTiles/style/VectorTileSource.js";const y=e.defaults&&e.defaults.io.corsEnabledServers;async function m(e,r){const t={source:null,sourceBase:null,sourceUrl:null,validatedSource:null,style:null,styleBase:null,styleUrl:null,sourceNameToSource:{},primarySourceName:"",spriteFormat:"png"},[s,o]="string"==typeof e?[e,null]:[null,e.jsonUrl];await S(t,"esri",e,o,r);const l={layerDefinition:t.validatedSource,url:s,serviceUrl:t.sourceUrl,style:t.style,styleUrl:t.styleUrl,spriteUrl:t.style.sprite&&h(t.styleBase,t.style.sprite),spriteFormat:t.spriteFormat,glyphsUrl:t.style.glyphs&&h(t.styleBase,t.style.glyphs),sourceNameToSource:t.sourceNameToSource,primarySourceName:t.primarySourceName};return d(l.spriteUrl),d(l.glyphsUrl),l}function d(e){if(!e)return;const r=s(e);y&&!y.includes(r)&&y.push(r)}function h(...e){let r;for(let t=0;t<e.length;++t)if(o(e[t])){if(r){const s=r.split("://")[0];r=s+":"+e[t].trim()}}else r=l(e[t])?e[t]:n(r,e[t]);return i(r)}async function S(e,s,o,l,n){let i,c,a;if(t(n),"string"==typeof o){const e=u(o);d(e),a=await r(e,{...n,responseType:"json",query:{f:"json",...n?.query}}),a.ssl&&(i&&(i=i.replace(/^http:/i,"https:")),c&&(c=c.replace(/^http:/i,"https:"))),i=e,c=e}else a={data:o},i=o.jsonUrl||null,c=l;const f=a.data;if(U(f))return e.styleUrl=i||null,x(e,f,c,n);if(w(f))return e.sourceUrl?g(e,f,c,!1,s,n):(e.sourceUrl=i||null,g(e,f,c,!0,s,n));throw new Error("You must specify the URL or the JSON for a service or for a style.")}function U(e){return!!e.sources}function w(e){return!U(e)}async function x(e,r,t,s){const o=t?c(t):a();e.styleBase=o,e.style=r,e.styleUrl&&d(e.styleUrl),r["sprite-format"]&&"webp"===r["sprite-format"].toLowerCase()&&(e.spriteFormat="webp");const l=[];if(r.sources&&r.sources.esri){const t=r.sources.esri;t.url?await S(e,"esri",h(o,t.url),void 0,s):l.push(S(e,"esri",t,o,s))}for(const n of Object.keys(r.sources))"esri"!==n&&"vector"===r.sources[n].type&&(r.sources[n].url?l.push(S(e,n,h(o,r.sources[n].url),void 0,s)):r.sources[n].tiles&&l.push(S(e,n,r.sources[n],o,s)));await Promise.all(l)}async function g(e,r,t,s,o,l){const n=t?i(t)+"/":a(),u=v(r,n),c=new p(o,f(n,l?.query),u);if(!s&&e.primarySourceName in e.sourceNameToSource){const r=e.sourceNameToSource[e.primarySourceName];if(!r.isCompatibleWith(c))return;null!=c.fullExtent&&(null!=r.fullExtent?r.fullExtent.union(c.fullExtent):r.fullExtent=c.fullExtent.clone()),r.tileInfo.lods.length<c.tileInfo.lods.length&&(r.tileInfo=c.tileInfo)}if(s?(e.sourceBase=n,e.source=r,e.validatedSource=u,e.primarySourceName=o,e.sourceUrl&&d(e.sourceUrl)):d(n),e.sourceNameToSource[o]=c,!e.style){if(null==r.defaultStyles)throw new Error;return"string"==typeof r.defaultStyles?S(e,"",h(n,r.defaultStyles,"root.json"),void 0,l):S(e,"",r.defaultStyles,h(n,"root.json"),l)}}function v(e,r){if(e.hasOwnProperty("tileInfo"))return e;const t={xmin:-20037507.067161843,ymin:-20037507.067161843,xmax:20037507.067161843,ymax:20037507.067161843,spatialReference:{wkid:102100}},s=512;let o=78271.51696400007,l=295828763.7957775;const n=[],i=e.hasOwnProperty("minzoom")?+e.minzoom:0,u=e.hasOwnProperty("maxzoom")?+e.maxzoom:22;for(let c=0;c<=u;c++)c>=i&&n.push({level:c,scale:l,resolution:o}),o/=2,l/=2;for(const c of e.tiles)d(h(r,c));return{capabilities:"TilesOnly",initialExtent:t,fullExtent:t,minScale:0,maxScale:0,tiles:e.tiles,tileInfo:{rows:s,cols:s,dpi:96,format:"pbf",origin:{x:-20037508.342787,y:20037508.342787},lods:n,spatialReference:{wkid:102100}}}}export{m as loadMetadata};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.25/esri/copyright.txt for details.
4
4
  */
5
- import e from"../../core/Error.js";import{isSome as t}from"../../core/maybe.js";import n from"../../geometry/Extent.js";import i from"../../geometry/Point.js";import{getReferenceEllipsoidFromWKID as r}from"../../geometry/projectionEllipsoid.js";import o from"../../geometry/support/WKIDUnitConversion.js";import{isAxesOrderReversedForWkid as l}from"../ogc/crsUtils.js";import{visitXML as s}from"../ogc/xmlUtils.js";import a from"./TileInfo.js";const c=90.71428571428571;function u(t){const n=t.replace(/ows:/gi,"");if(!m("Contents",(new DOMParser).parseFromString(n,"text/xml").documentElement))throw new e("wmtslayer:wmts-capabilities-xml-is-not-valid","the wmts get capabilities response is not compliant",{text:t})}function p(t,n){t=t.replace(/ows:/gi,"");const i=(new DOMParser).parseFromString(t,"text/xml").documentElement,r=new Map,o=new Map,l=m("Contents",i);if(!l)throw new e("wmtslayer:wmts-capabilities-xml-is-not-valid");const s=m("OperationsMetadata",i)?.querySelector("[name='GetTile']"),a=s?.getElementsByTagName("Get"),c=a&&Array.prototype.slice.call(a),u=n?.url?.indexOf("https")>-1??!1;let p,f,d=n.serviceMode,x=n&&n.url;if(c&&c.length&&c.some((e=>{const t=m("Constraint",e);return!t||w("AllowedValues","Value",d,t)?(x=e.attributes[0].nodeValue,!0):(!t||w("AllowedValues","Value","RESTful",t)||w("AllowedValues","Value","REST",t)?f=e.attributes[0].nodeValue:t&&!w("AllowedValues","Value","KVP",t)||(p=e.attributes[0].nodeValue),!1)})),!x)if(f)x=f,d="RESTful";else if(p)x=p,d="KVP";else{const e=m("ServiceMetadataURL",i);x=e&&e.getAttribute("xlink:href")}const M=x.indexOf("1.0.0/");-1===M&&"RESTful"===d?x+="/":M>-1&&(x=x.substring(0,M)),"KVP"===d&&(x+=M>-1?"":"?"),u&&(x=x.replace(/^http:/i,"https:"));const T=h("ServiceIdentification>ServiceTypeVersion",i),y=h("ServiceIdentification>AccessConstraints",i),S=/^none$/i.test(y)?null:y,R=g("Layer",l),V=g("TileMatrixSet",l),b=R.map((e=>{const t=h("Identifier",e);return r.set(t,e),C(t,e,V,u,T)}));return{copyright:S,dimensionMap:o,layerMap:r,layers:b,serviceMode:d,tileUrl:x}}function f(e){return e.layers.forEach((e=>{e.tileMatrixSets.forEach((e=>{const t=e.tileInfo;96!==t.dpi&&(t.lods.forEach((n=>{n.scale=96*n.scale/t.dpi,n.resolution=U(t.spatialReference.wkid,n.scale*c/96,e.id)})),t.dpi=96)}))})),e}function d(e){return e.nodeType===Node.ELEMENT_NODE}function m(e,t){for(let n=0;n<t.childNodes.length;n++){const i=t.childNodes[n];if(d(i)&&i.nodeName===e)return i}return null}function g(e,t){const n=[];for(let i=0;i<t.childNodes.length;i++){const r=t.childNodes[i];d(r)&&r.nodeName===e&&n.push(r)}return n}function x(e,t){const n=[];for(let i=0;i<t.childNodes.length;i++){const r=t.childNodes[i];d(r)&&r.nodeName===e&&n.push(r)}return n.map((e=>e.textContent))}function h(e,t){return e.split(">").forEach((e=>{t&&(t=m(e,t))})),t&&t.textContent}function w(e,t,n,i){let r;return Array.prototype.slice.call(i.childNodes).some((i=>{if(i.nodeName.includes(e)){const e=m(t,i),o=e&&e.textContent;if(o===n||n.split(":")&&n.split(":")[1]===o)return r=i,!0}return!1})),r}function C(e,t,n,i,r){const o=h("Abstract",t),l=x("Format",t);return{id:e,fullExtent:R(t),fullExtents:V(t),description:o,formats:l,styles:b(t,i),title:h("Title",t),tileMatrixSets:E(r,t,n)}}function M(e,t){const n=[],i=e.layerMap?.get(t);if(!i)return;const r=g("ResourceURL",i),o=g("Dimension",i);let l,s,a,c;return o.length&&(l=h("Identifier",o[0]),s=x("Default",o[0])||x("Value",o[0])),o.length>1&&(a=h("Identifier",o[1]),c=x("Default",o[1])||x("Value",o[1])),e.dimensionMap.set(t,{dimensions:s,dimensions2:c}),r.forEach((e=>{let t=e.getAttribute("template");if("tile"===e.getAttribute("resourceType")){if(l&&s.length)if(t.includes("{"+l+"}"))t=t.replace("{"+l+"}","{dimensionValue}");else{const e=t.toLowerCase().indexOf("{"+l.toLowerCase()+"}");e>-1&&(t=t.substring(0,e)+"{dimensionValue}"+t.substring(e+l.length+2))}if(a&&c.length)if(t.includes("{"+a+"}"))t=t.replace("{"+a+"}","{dimensionValue2}");else{const e=t.toLowerCase().indexOf("{"+a.toLowerCase()+"}");e>-1&&(t=t.substring(0,e)+"{dimensionValue2}"+t.substring(e+a.length+2))}n.push({template:t,format:e.getAttribute("format"),resourceType:"tile"})}})),n}function T(e,t,n,i,r,o,l,s){const a=y(e,t,i);if(!(a?.length>0))return"";const{dimensionMap:c}=e,u=c.get(t).dimensions?.[0],p=c.get(t).dimensions2?.[0];return a[l%a.length].template.replace(/\{Style\}/gi,r).replace(/\{TileMatrixSet\}/gi,n).replace(/\{TileMatrix\}/gi,o).replace(/\{TileRow\}/gi,""+l).replace(/\{TileCol\}/gi,""+s).replace(/\{dimensionValue\}/gi,u).replace(/\{dimensionValue2\}/gi,p)}function y(e,t,n){const i=M(e,t),r=i.filter((e=>e.format===n));return r.length?r:i}function S(e,t,n,i){const{dimensionMap:r}=e,o=M(e,t);let l="";if(o&&o.length>0){const e=r.get(t).dimensions&&r.get(t).dimensions[0],s=r.get(t).dimensions2&&r.get(t).dimensions2[0];l=o[0].template,l.indexOf(".xxx")===l.length-4&&(l=l.slice(0,l.length-4)),l=l.replace(/\{Style\}/gi,i),l=l.replace(/\{TileMatrixSet\}/gi,n),l=l.replace(/\{TileMatrix\}/gi,"{level}"),l=l.replace(/\{TileRow\}/gi,"{row}"),l=l.replace(/\{TileCol\}/gi,"{col}"),l=l.replace(/\{dimensionValue\}/gi,e),l=l.replace(/\{dimensionValue2\}/gi,s)}return l}function R(e){const t=m("WGS84BoundingBox",e),n=t?h("LowerCorner",t).split(" "):["-180","-90"],i=t?h("UpperCorner",t).split(" "):["180","90"];return{xmin:parseFloat(n[0]),ymin:parseFloat(n[1]),xmax:parseFloat(i[0]),ymax:parseFloat(i[1]),spatialReference:{wkid:4326}}}function V(e){const t=[];return s(e,{BoundingBox:e=>{if(!e.getAttribute("crs"))return;const n=e.getAttribute("crs").toLowerCase(),i=I(n),r=n.includes("epsg")&&l(i.wkid);let o,a,c,u;s(e,{LowerCorner:e=>{[o,a]=e.textContent.split(" ").map((e=>Number.parseFloat(e))),r&&([o,a]=[a,o])},UpperCorner:e=>{[c,u]=e.textContent.split(" ").map((e=>Number.parseFloat(e))),r&&([c,u]=[u,c])}}),t.push({xmin:o,ymin:a,xmax:c,ymax:u,spatialReference:i})}}),t}function b(e,t){return g("Style",e).map((e=>{const n=m("LegendURL",e),i=m("Keywords",e),r=i&&x("Keyword",i);let o=n&&n.getAttribute("xlink:href");t&&(o=o&&o.replace(/^http:/i,"https:"));return{abstract:h("Abstract",e),id:h("Identifier",e),isDefault:"true"===e.getAttribute("isDefault"),keywords:r,legendUrl:o,title:h("Title",e)}}))}function E(e,t,n){return g("TileMatrixSetLink",t).map((t=>L(e,t,n)))}function L(e,t,n){const i=m("TileMatrixSet",t).textContent,r=x("TileMatrix",t),o=n.find((e=>{const t=m("Identifier",e),n=t&&t.textContent;return!!(n===i||i.split(":")&&i.split(":")[1]===n)})),l=m("TileMatrixSetLimits",t),s=l&&g("TileMatrixLimits",l),c=new Map;if(s?.length)for(const a of s){const e=m("TileMatrix",a).textContent,t=+m("MinTileRow",a).textContent,n=+m("MaxTileRow",a).textContent,i=+m("MinTileCol",a).textContent,r=+m("MaxTileCol",a).textContent;c.set(e,{minCol:i,maxCol:r,minRow:t,maxRow:n})}const u=h("SupportedCRS",o).toLowerCase(),p=N(o,u),f=p.spatialReference,d=m("TileMatrix",o),C=[parseInt(h("TileWidth",d),10),parseInt(h("TileHeight",d),10)],M=[];if(r.length)r.forEach(((e,t)=>{const n=w("TileMatrix","Identifier",e,o);M.push(D(n,u,t,i,c))}));else{g("TileMatrix",o).forEach(((e,t)=>{M.push(D(e,u,t,i,c))}))}const T=F(e,o,p,C,M[0]).toJSON(),y=new a({dpi:96,spatialReference:f,size:C,origin:p,lods:M}).toJSON();return{id:i,fullExtent:T,tileInfo:y}}function I(e){e=e.toLowerCase();let n=parseInt(e.split(":").pop(),10);900913!==n&&3857!==n||(n=102100);const i=k(e);return t(i)&&(n=i),{wkid:n}}function N(e,t){return A(m("TileMatrix",e),t)}function A(e,t){const n=I(t),[r,o]=h("TopLeftCorner",e).split(" ").map((e=>parseFloat(e))),s=t.includes("epsg")&&l(n.wkid);return new i(s?{x:o,y:r,spatialReference:n}:{x:r,y:o,spatialReference:n})}function F(e,t,i,r,o){const l=m("BoundingBox",t);let s,a,c,u,p,f;if(l&&(s=h("LowerCorner",l).split(" "),a=h("UpperCorner",l).split(" ")),s&&s.length>1&&a&&a.length>1)c=parseFloat(s[0]),p=parseFloat(s[1]),u=parseFloat(a[0]),f=parseFloat(a[1]);else{const e=m("TileMatrix",t),n=parseInt(h("MatrixWidth",e),10),l=parseInt(h("MatrixHeight",e),10);c=i.x,f=i.y,u=c+n*r[0]*o.resolution,p=f-l*r[1]*o.resolution}return v(e,i.spatialReference)?new n(p,c,f,u,i.spatialReference):new n(c,p,u,f,i.spatialReference)}function v(e,t){return"1.0.0"===e&&l(t.wkid)}var O;function k(e){return e.includes("crs84")||e.includes("crs:84")?O.CRS84:e.includes("crs83")||e.includes("crs:83")?O.CRS83:e.includes("crs27")||e.includes("crs:27")?O.CRS27:null}function D(e,t,n,i,r){const o=I(t),l=h("Identifier",e);let s=parseFloat(h("ScaleDenominator",e));const a=U(o.wkid,s,i);s*=96/c;const u=+h("MatrixWidth",e),p=+h("MatrixHeight",e),{maxCol:f=u-1,maxRow:d=p-1,minCol:m=0,minRow:g=0}=r.get(l)??{},{x,y:w}=A(e,t);return{cols:[m,f],level:n,levelValue:l,origin:[x,w],scale:s,resolution:a,rows:[g,d]}}function U(e,t,n){let i;return i=o.hasOwnProperty(""+e)?o.values[o[e]]:"default028mm"===n?6370997*Math.PI/180:r(e).metersPerDegree,7*t/25e3/i}!function(e){e[e.CRS84=4326]="CRS84",e[e.CRS83=4269]="CRS83",e[e.CRS27=4267]="CRS27"}(O||(O={}));export{T as getTileUrlFromResourceUrls,S as getTileUrlTemplateFromResourceUrls,y as getTileUrlTemplates,p as parseCapabilities,f as parseResourceInfo,u as validateCapabilities};
5
+ import e from"../../core/Error.js";import{isSome as t}from"../../core/maybe.js";import n from"../../geometry/Extent.js";import i from"../../geometry/Point.js";import{getReferenceEllipsoidFromWKID as r}from"../../geometry/projectionEllipsoid.js";import o from"../../geometry/support/WKIDUnitConversion.js";import{isAxesOrderReversedForWkid as l}from"../ogc/crsUtils.js";import{visitXML as s}from"../ogc/xmlUtils.js";import a from"./TileInfo.js";const c=90.71428571428571;function u(t){const n=t.replace(/ows:/gi,"");if(!m("Contents",(new DOMParser).parseFromString(n,"text/xml").documentElement))throw new e("wmtslayer:wmts-capabilities-xml-is-not-valid","the wmts get capabilities response is not compliant",{text:t})}function p(t,n){t=t.replace(/ows:/gi,"");const i=(new DOMParser).parseFromString(t,"text/xml").documentElement,r=new Map,o=new Map,l=m("Contents",i);if(!l)throw new e("wmtslayer:wmts-capabilities-xml-is-not-valid");const s=m("OperationsMetadata",i)?.querySelector("[name='GetTile']"),a=s?.getElementsByTagName("Get"),c=a&&Array.prototype.slice.call(a),u=n?.url?.indexOf("https")>-1;let p,f,d=n.serviceMode,x=n&&n.url;if(c&&c.length&&c.some((e=>{const t=m("Constraint",e);return!t||w("AllowedValues","Value",d,t)?(x=e.attributes[0].nodeValue,!0):(!t||w("AllowedValues","Value","RESTful",t)||w("AllowedValues","Value","REST",t)?f=e.attributes[0].nodeValue:t&&!w("AllowedValues","Value","KVP",t)||(p=e.attributes[0].nodeValue),!1)})),!x)if(f)x=f,d="RESTful";else if(p)x=p,d="KVP";else{const e=m("ServiceMetadataURL",i);x=e&&e.getAttribute("xlink:href")}const M=x.indexOf("1.0.0/");-1===M&&"RESTful"===d?x+="/":M>-1&&(x=x.substring(0,M)),"KVP"===d&&(x+=M>-1?"":"?"),u&&(x=x.replace(/^http:/i,"https:"));const T=h("ServiceIdentification>ServiceTypeVersion",i),y=h("ServiceIdentification>AccessConstraints",i),S=/^none$/i.test(y)?null:y,R=g("Layer",l),V=g("TileMatrixSet",l),b=R.map((e=>{const t=h("Identifier",e);return r.set(t,e),C(t,e,V,u,T)}));return{copyright:S,dimensionMap:o,layerMap:r,layers:b,serviceMode:d,tileUrl:x}}function f(e){return e.layers.forEach((e=>{e.tileMatrixSets.forEach((e=>{const t=e.tileInfo;96!==t.dpi&&(t.lods.forEach((n=>{n.scale=96*n.scale/t.dpi,n.resolution=U(t.spatialReference.wkid,n.scale*c/96,e.id)})),t.dpi=96)}))})),e}function d(e){return e.nodeType===Node.ELEMENT_NODE}function m(e,t){for(let n=0;n<t.childNodes.length;n++){const i=t.childNodes[n];if(d(i)&&i.nodeName===e)return i}return null}function g(e,t){const n=[];for(let i=0;i<t.childNodes.length;i++){const r=t.childNodes[i];d(r)&&r.nodeName===e&&n.push(r)}return n}function x(e,t){const n=[];for(let i=0;i<t.childNodes.length;i++){const r=t.childNodes[i];d(r)&&r.nodeName===e&&n.push(r)}return n.map((e=>e.textContent))}function h(e,t){return e.split(">").forEach((e=>{t&&(t=m(e,t))})),t&&t.textContent}function w(e,t,n,i){let r;return Array.prototype.slice.call(i.childNodes).some((i=>{if(i.nodeName.includes(e)){const e=m(t,i),o=e&&e.textContent;if(o===n||n.split(":")&&n.split(":")[1]===o)return r=i,!0}return!1})),r}function C(e,t,n,i,r){const o=h("Abstract",t),l=x("Format",t);return{id:e,fullExtent:R(t),fullExtents:V(t),description:o,formats:l,styles:b(t,i),title:h("Title",t),tileMatrixSets:E(r,t,n)}}function M(e,t){const n=[],i=e.layerMap?.get(t);if(!i)return;const r=g("ResourceURL",i),o=g("Dimension",i);let l,s,a,c;return o.length&&(l=h("Identifier",o[0]),s=x("Default",o[0])||x("Value",o[0])),o.length>1&&(a=h("Identifier",o[1]),c=x("Default",o[1])||x("Value",o[1])),e.dimensionMap.set(t,{dimensions:s,dimensions2:c}),r.forEach((e=>{let t=e.getAttribute("template");if("tile"===e.getAttribute("resourceType")){if(l&&s.length)if(t.includes("{"+l+"}"))t=t.replace("{"+l+"}","{dimensionValue}");else{const e=t.toLowerCase().indexOf("{"+l.toLowerCase()+"}");e>-1&&(t=t.substring(0,e)+"{dimensionValue}"+t.substring(e+l.length+2))}if(a&&c.length)if(t.includes("{"+a+"}"))t=t.replace("{"+a+"}","{dimensionValue2}");else{const e=t.toLowerCase().indexOf("{"+a.toLowerCase()+"}");e>-1&&(t=t.substring(0,e)+"{dimensionValue2}"+t.substring(e+a.length+2))}n.push({template:t,format:e.getAttribute("format"),resourceType:"tile"})}})),n}function T(e,t,n,i,r,o,l,s){const a=y(e,t,i);if(!(a?.length>0))return"";const{dimensionMap:c}=e,u=c.get(t).dimensions?.[0],p=c.get(t).dimensions2?.[0];return a[l%a.length].template.replace(/\{Style\}/gi,r).replace(/\{TileMatrixSet\}/gi,n).replace(/\{TileMatrix\}/gi,o).replace(/\{TileRow\}/gi,""+l).replace(/\{TileCol\}/gi,""+s).replace(/\{dimensionValue\}/gi,u).replace(/\{dimensionValue2\}/gi,p)}function y(e,t,n){const i=M(e,t),r=i.filter((e=>e.format===n));return r.length?r:i}function S(e,t,n,i){const{dimensionMap:r}=e,o=M(e,t);let l="";if(o&&o.length>0){const e=r.get(t).dimensions&&r.get(t).dimensions[0],s=r.get(t).dimensions2&&r.get(t).dimensions2[0];l=o[0].template,l.indexOf(".xxx")===l.length-4&&(l=l.slice(0,l.length-4)),l=l.replace(/\{Style\}/gi,i),l=l.replace(/\{TileMatrixSet\}/gi,n),l=l.replace(/\{TileMatrix\}/gi,"{level}"),l=l.replace(/\{TileRow\}/gi,"{row}"),l=l.replace(/\{TileCol\}/gi,"{col}"),l=l.replace(/\{dimensionValue\}/gi,e),l=l.replace(/\{dimensionValue2\}/gi,s)}return l}function R(e){const t=m("WGS84BoundingBox",e),n=t?h("LowerCorner",t).split(" "):["-180","-90"],i=t?h("UpperCorner",t).split(" "):["180","90"];return{xmin:parseFloat(n[0]),ymin:parseFloat(n[1]),xmax:parseFloat(i[0]),ymax:parseFloat(i[1]),spatialReference:{wkid:4326}}}function V(e){const t=[];return s(e,{BoundingBox:e=>{if(!e.getAttribute("crs"))return;const n=e.getAttribute("crs").toLowerCase(),i=I(n),r=n.includes("epsg")&&l(i.wkid);let o,a,c,u;s(e,{LowerCorner:e=>{[o,a]=e.textContent.split(" ").map((e=>Number.parseFloat(e))),r&&([o,a]=[a,o])},UpperCorner:e=>{[c,u]=e.textContent.split(" ").map((e=>Number.parseFloat(e))),r&&([c,u]=[u,c])}}),t.push({xmin:o,ymin:a,xmax:c,ymax:u,spatialReference:i})}}),t}function b(e,t){return g("Style",e).map((e=>{const n=m("LegendURL",e),i=m("Keywords",e),r=i&&x("Keyword",i);let o=n&&n.getAttribute("xlink:href");t&&(o=o&&o.replace(/^http:/i,"https:"));return{abstract:h("Abstract",e),id:h("Identifier",e),isDefault:"true"===e.getAttribute("isDefault"),keywords:r,legendUrl:o,title:h("Title",e)}}))}function E(e,t,n){return g("TileMatrixSetLink",t).map((t=>L(e,t,n)))}function L(e,t,n){const i=m("TileMatrixSet",t).textContent,r=x("TileMatrix",t),o=n.find((e=>{const t=m("Identifier",e),n=t&&t.textContent;return!!(n===i||i.split(":")&&i.split(":")[1]===n)})),l=m("TileMatrixSetLimits",t),s=l&&g("TileMatrixLimits",l),c=new Map;if(s?.length)for(const a of s){const e=m("TileMatrix",a).textContent,t=+m("MinTileRow",a).textContent,n=+m("MaxTileRow",a).textContent,i=+m("MinTileCol",a).textContent,r=+m("MaxTileCol",a).textContent;c.set(e,{minCol:i,maxCol:r,minRow:t,maxRow:n})}const u=h("SupportedCRS",o).toLowerCase(),p=N(o,u),f=p.spatialReference,d=m("TileMatrix",o),C=[parseInt(h("TileWidth",d),10),parseInt(h("TileHeight",d),10)],M=[];if(r.length)r.forEach(((e,t)=>{const n=w("TileMatrix","Identifier",e,o);M.push(D(n,u,t,i,c))}));else{g("TileMatrix",o).forEach(((e,t)=>{M.push(D(e,u,t,i,c))}))}const T=F(e,o,p,C,M[0]).toJSON(),y=new a({dpi:96,spatialReference:f,size:C,origin:p,lods:M}).toJSON();return{id:i,fullExtent:T,tileInfo:y}}function I(e){e=e.toLowerCase();let n=parseInt(e.split(":").pop(),10);900913!==n&&3857!==n||(n=102100);const i=k(e);return t(i)&&(n=i),{wkid:n}}function N(e,t){return A(m("TileMatrix",e),t)}function A(e,t){const n=I(t),[r,o]=h("TopLeftCorner",e).split(" ").map((e=>parseFloat(e))),s=t.includes("epsg")&&l(n.wkid);return new i(s?{x:o,y:r,spatialReference:n}:{x:r,y:o,spatialReference:n})}function F(e,t,i,r,o){const l=m("BoundingBox",t);let s,a,c,u,p,f;if(l&&(s=h("LowerCorner",l).split(" "),a=h("UpperCorner",l).split(" ")),s&&s.length>1&&a&&a.length>1)c=parseFloat(s[0]),p=parseFloat(s[1]),u=parseFloat(a[0]),f=parseFloat(a[1]);else{const e=m("TileMatrix",t),n=parseInt(h("MatrixWidth",e),10),l=parseInt(h("MatrixHeight",e),10);c=i.x,f=i.y,u=c+n*r[0]*o.resolution,p=f-l*r[1]*o.resolution}return v(e,i.spatialReference)?new n(p,c,f,u,i.spatialReference):new n(c,p,u,f,i.spatialReference)}function v(e,t){return"1.0.0"===e&&l(t.wkid)}var O;function k(e){return e.includes("crs84")||e.includes("crs:84")?O.CRS84:e.includes("crs83")||e.includes("crs:83")?O.CRS83:e.includes("crs27")||e.includes("crs:27")?O.CRS27:null}function D(e,t,n,i,r){const o=I(t),l=h("Identifier",e);let s=parseFloat(h("ScaleDenominator",e));const a=U(o.wkid,s,i);s*=96/c;const u=+h("MatrixWidth",e),p=+h("MatrixHeight",e),{maxCol:f=u-1,maxRow:d=p-1,minCol:m=0,minRow:g=0}=r.get(l)??{},{x,y:w}=A(e,t);return{cols:[m,f],level:n,levelValue:l,origin:[x,w],scale:s,resolution:a,rows:[g,d]}}function U(e,t,n){let i;return i=o.hasOwnProperty(""+e)?o.values[o[e]]:"default028mm"===n?6370997*Math.PI/180:r(e).metersPerDegree,7*t/25e3/i}!function(e){e[e.CRS84=4326]="CRS84",e[e.CRS83=4269]="CRS83",e[e.CRS27=4267]="CRS27"}(O||(O={}));export{T as getTileUrlFromResourceUrls,S as getTileUrlTemplateFromResourceUrls,y as getTileUrlTemplates,p as parseCapabilities,f as parseResourceInfo,u as validateCapabilities};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arcgis/core",
3
- "version": "4.25.0-next.20220718",
3
+ "version": "4.25.0-next.20220721",
4
4
  "homepage": "https://js.arcgis.com",
5
5
  "description": "ArcGIS API for JavaScript: A complete 2D and 3D mapping and data visualization API",
6
6
  "keywords": [
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.25/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../chunks/tslib.es6.js";import{JSONSupport as r}from"../core/JSONSupport.js";import{clone as o}from"../core/lang.js";import{property as t}from"../core/accessorSupport/decorators/property.js";import"../core/accessorSupport/ensureType.js";import{enumeration as i}from"../core/accessorSupport/decorators/enumeration.js";import{reader as s}from"../core/accessorSupport/decorators/reader.js";import{subclass as p}from"../core/accessorSupport/decorators/subclass.js";import{types as a,fromJSON as l}from"../rest/support/colorRamps.js";var c;let d=c=class extends r{constructor(e){super(e),this.altitude=45,this.azimuth=315,this.colorRamp=null,this.hillshadeType="multi-directional",this.pixelSizePower=.664,this.pixelSizeFactor=.024,this.scalingType="none",this.type="raster-shaded-relief",this.zFactor=1}readColorRamp(e){return l(e)}clone(){return new c({hillshadeType:this.hillshadeType,altitude:this.altitude,azimuth:this.azimuth,zFactor:this.zFactor,scalingType:this.scalingType,pixelSizeFactor:this.pixelSizeFactor,pixelSizePower:this.pixelSizePower,colorRamp:o(this.colorRamp)})}};e([t({type:Number,json:{write:!0}})],d.prototype,"altitude",void 0),e([t({type:Number,json:{write:!0}})],d.prototype,"azimuth",void 0),e([t({types:a,json:{write:!0}})],d.prototype,"colorRamp",void 0),e([s("colorRamp")],d.prototype,"readColorRamp",null),e([t({type:["traditional","multi-directional"],json:{write:!0}})],d.prototype,"hillshadeType",void 0),e([t({type:Number,json:{write:!0}})],d.prototype,"pixelSizePower",void 0),e([t({type:Number,json:{write:!0}})],d.prototype,"pixelSizeFactor",void 0),e([t({type:["none","adjusted"],json:{write:!0}})],d.prototype,"scalingType",void 0),e([i({rasterShadedRelief:"raster-shaded-relief"})],d.prototype,"type",void 0),e([t({type:Number,json:{write:!0}})],d.prototype,"zFactor",void 0),d=c=e([p("esri.renderers.RasterShadedReliefRenderer")],d);const m=d;export{m as default};
5
+ import{_ as e}from"../chunks/tslib.es6.js";import{JSONSupport as r}from"../core/JSONSupport.js";import{clone as o}from"../core/lang.js";import{property as t}from"../core/accessorSupport/decorators/property.js";import"../core/accessorSupport/ensureType.js";import{enumeration as i}from"../core/accessorSupport/decorators/enumeration.js";import{reader as s}from"../core/accessorSupport/decorators/reader.js";import{subclass as p}from"../core/accessorSupport/decorators/subclass.js";import{fromJSON as a,types as l}from"../rest/support/colorRamps.js";var c;let d=c=class extends r{constructor(e){super(e),this.altitude=45,this.azimuth=315,this.colorRamp=null,this.hillshadeType="multi-directional",this.pixelSizePower=.664,this.pixelSizeFactor=.024,this.scalingType="none",this.type="raster-shaded-relief",this.zFactor=1}readColorRamp(e){return a(e)}clone(){return new c({hillshadeType:this.hillshadeType,altitude:this.altitude,azimuth:this.azimuth,zFactor:this.zFactor,scalingType:this.scalingType,pixelSizeFactor:this.pixelSizeFactor,pixelSizePower:this.pixelSizePower,colorRamp:o(this.colorRamp)})}};e([t({type:Number,json:{write:!0}})],d.prototype,"altitude",void 0),e([t({type:Number,json:{write:!0}})],d.prototype,"azimuth",void 0),e([t({types:l,json:{write:!0}})],d.prototype,"colorRamp",void 0),e([s("colorRamp")],d.prototype,"readColorRamp",null),e([t({type:["traditional","multi-directional"],json:{write:!0}})],d.prototype,"hillshadeType",void 0),e([t({type:Number,json:{write:!0}})],d.prototype,"pixelSizePower",void 0),e([t({type:Number,json:{write:!0}})],d.prototype,"pixelSizeFactor",void 0),e([t({type:["none","adjusted"],json:{write:!0}})],d.prototype,"scalingType",void 0),e([i({rasterShadedRelief:"raster-shaded-relief"})],d.prototype,"type",void 0),e([t({type:Number,json:{write:!0}})],d.prototype,"zFactor",void 0),d=c=e([p("esri.renderers.RasterShadedReliefRenderer")],d);const m=d;export{m as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.25/esri/copyright.txt for details.
4
4
  */
5
- import{_ as t}from"../chunks/tslib.es6.js";import{JSONSupport as e}from"../core/JSONSupport.js";import{clone as r}from"../core/lang.js";import{property as o}from"../core/accessorSupport/decorators/property.js";import"../core/accessorSupport/ensureType.js";import{enumeration as s}from"../core/accessorSupport/decorators/enumeration.js";import{reader as i}from"../core/accessorSupport/decorators/reader.js";import{subclass as a}from"../core/accessorSupport/decorators/subclass.js";import{writer as p}from"../core/accessorSupport/decorators/writer.js";import{stretchTypeJSONDict as m,stretchTypeFunctionEnum as n}from"./support/stretchRendererUtils.js";import{types as c,fromJSON as u}from"../rest/support/colorRamps.js";var d;let h=d=class extends e{constructor(t){super(t),this.colorRamp=null,this.computeGamma=!1,this.dynamicRangeAdjustment=!1,this.gamma=[],this.maxPercent=null,this.minPercent=null,this.numberOfStandardDeviations=null,this.outputMax=null,this.outputMin=null,this.sigmoidStrengthLevel=null,this.statistics=[],this.histograms=null,this.useGamma=!1,this.stretchType="none",this.type="raster-stretch"}readColorRamp(t){if(t)return u(t)}writeStatistics(t,e,r){t?.length&&(Array.isArray(t[0])||(t=t.map((t=>[t.min,t.max,t.avg,t.stddev]))),e[r]=t)}readStretchType(t,e){let r=e.stretchType;return"number"==typeof r&&(r=n[r]),m.read(r)}clone(){return new d({stretchType:this.stretchType,outputMin:this.outputMin,outputMax:this.outputMax,useGamma:this.useGamma,computeGamma:this.computeGamma,statistics:r(this.statistics),gamma:r(this.gamma),sigmoidStrengthLevel:this.sigmoidStrengthLevel,numberOfStandardDeviations:this.numberOfStandardDeviations,minPercent:this.minPercent,maxPercent:this.maxPercent,colorRamp:r(this.colorRamp),histograms:r(this.histograms),dynamicRangeAdjustment:this.dynamicRangeAdjustment})}};t([o({types:c,json:{write:!0}})],h.prototype,"colorRamp",void 0),t([i("colorRamp")],h.prototype,"readColorRamp",null),t([o({type:Boolean,json:{write:!0}})],h.prototype,"computeGamma",void 0),t([o({type:Boolean,json:{write:{target:"dra"},read:{source:"dra"}}})],h.prototype,"dynamicRangeAdjustment",void 0),t([o({type:[Number],json:{write:!0}})],h.prototype,"gamma",void 0),t([o({type:Number,json:{write:!0}})],h.prototype,"maxPercent",void 0),t([o({type:Number,json:{write:!0}})],h.prototype,"minPercent",void 0),t([o({type:Number,json:{write:!0}})],h.prototype,"numberOfStandardDeviations",void 0),t([o({type:Number,json:{read:{source:"max"},write:{target:"max"}}})],h.prototype,"outputMax",void 0),t([o({type:Number,json:{read:{source:"min"},write:{target:"min"}}})],h.prototype,"outputMin",void 0),t([o({type:Number,json:{write:!0}})],h.prototype,"sigmoidStrengthLevel",void 0),t([o({json:{type:[[Number]],write:!0}})],h.prototype,"statistics",void 0),t([o()],h.prototype,"histograms",void 0),t([p("statistics")],h.prototype,"writeStatistics",null),t([o({type:Boolean,json:{write:!0}})],h.prototype,"useGamma",void 0),t([o({type:m.apiValues,json:{type:m.jsonValues,write:m.write}})],h.prototype,"stretchType",void 0),t([i("stretchType",["stretchType"])],h.prototype,"readStretchType",null),t([s({rasterStretch:"raster-stretch"})],h.prototype,"type",void 0),h=d=t([a("esri.renderers.RasterStretchRenderer")],h);const y=h;export{y as default};
5
+ import{_ as t}from"../chunks/tslib.es6.js";import{JSONSupport as e}from"../core/JSONSupport.js";import{clone as r}from"../core/lang.js";import{property as o}from"../core/accessorSupport/decorators/property.js";import"../core/accessorSupport/ensureType.js";import{enumeration as s}from"../core/accessorSupport/decorators/enumeration.js";import{reader as i}from"../core/accessorSupport/decorators/reader.js";import{subclass as a}from"../core/accessorSupport/decorators/subclass.js";import{writer as p}from"../core/accessorSupport/decorators/writer.js";import{stretchTypeJSONDict as m,stretchTypeFunctionEnum as n}from"./support/stretchRendererUtils.js";import{fromJSON as c,types as u}from"../rest/support/colorRamps.js";var d;let h=d=class extends e{constructor(t){super(t),this.colorRamp=null,this.computeGamma=!1,this.dynamicRangeAdjustment=!1,this.gamma=[],this.maxPercent=null,this.minPercent=null,this.numberOfStandardDeviations=null,this.outputMax=null,this.outputMin=null,this.sigmoidStrengthLevel=null,this.statistics=[],this.histograms=null,this.useGamma=!1,this.stretchType="none",this.type="raster-stretch"}readColorRamp(t){if(t)return c(t)}writeStatistics(t,e,r){t?.length&&(Array.isArray(t[0])||(t=t.map((t=>[t.min,t.max,t.avg,t.stddev]))),e[r]=t)}readStretchType(t,e){let r=e.stretchType;return"number"==typeof r&&(r=n[r]),m.read(r)}clone(){return new d({stretchType:this.stretchType,outputMin:this.outputMin,outputMax:this.outputMax,useGamma:this.useGamma,computeGamma:this.computeGamma,statistics:r(this.statistics),gamma:r(this.gamma),sigmoidStrengthLevel:this.sigmoidStrengthLevel,numberOfStandardDeviations:this.numberOfStandardDeviations,minPercent:this.minPercent,maxPercent:this.maxPercent,colorRamp:r(this.colorRamp),histograms:r(this.histograms),dynamicRangeAdjustment:this.dynamicRangeAdjustment})}};t([o({types:u,json:{write:!0}})],h.prototype,"colorRamp",void 0),t([i("colorRamp")],h.prototype,"readColorRamp",null),t([o({type:Boolean,json:{write:!0}})],h.prototype,"computeGamma",void 0),t([o({type:Boolean,json:{write:{target:"dra"},read:{source:"dra"}}})],h.prototype,"dynamicRangeAdjustment",void 0),t([o({type:[Number],json:{write:!0}})],h.prototype,"gamma",void 0),t([o({type:Number,json:{write:!0}})],h.prototype,"maxPercent",void 0),t([o({type:Number,json:{write:!0}})],h.prototype,"minPercent",void 0),t([o({type:Number,json:{write:!0}})],h.prototype,"numberOfStandardDeviations",void 0),t([o({type:Number,json:{read:{source:"max"},write:{target:"max"}}})],h.prototype,"outputMax",void 0),t([o({type:Number,json:{read:{source:"min"},write:{target:"min"}}})],h.prototype,"outputMin",void 0),t([o({type:Number,json:{write:!0}})],h.prototype,"sigmoidStrengthLevel",void 0),t([o({json:{type:[[Number]],write:!0}})],h.prototype,"statistics",void 0),t([o()],h.prototype,"histograms",void 0),t([p("statistics")],h.prototype,"writeStatistics",null),t([o({type:Boolean,json:{write:!0}})],h.prototype,"useGamma",void 0),t([o({type:m.apiValues,json:{type:m.jsonValues,write:m.write}})],h.prototype,"stretchType",void 0),t([i("stretchType",["stretchType"])],h.prototype,"readStretchType",null),t([s({rasterStretch:"raster-stretch"})],h.prototype,"type",void 0),h=d=t([a("esri.renderers.RasterStretchRenderer")],h);const y=h;export{y as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.25/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../chunks/tslib.es6.js";import{ensureType as t}from"../symbols.js";import i from"../core/Error.js";import{clone as r}from"../core/lang.js";import s from"../core/Logger.js";import{isNone as l,unwrapOr as o,unwrap as n}from"../core/maybe.js";import{deepMerge as a}from"../core/object.js";import{property as u}from"../core/accessorSupport/decorators/property.js";import{cast as p}from"../core/accessorSupport/decorators/cast.js";import{enumeration as f}from"../core/accessorSupport/decorators/enumeration.js";import{reader as d}from"../core/accessorSupport/decorators/reader.js";import{subclass as c}from"../core/accessorSupport/decorators/subclass.js";import{writer as y}from"../core/accessorSupport/decorators/writer.js";import{diff as m}from"../core/accessorSupport/diffUtils.js";import{ensureType as h,ensureString as b}from"../core/accessorSupport/ensureType.js";import{collectArcadeFieldNames as g,collectField as v}from"../layers/support/fieldUtils.js";import S from"../portal/Portal.js";import V from"./Renderer.js";import{VisualVariablesMixin as q}from"./mixins/VisualVariablesMixin.js";import{rendererBackgroundFillSymbolProperty as I,rendererSymbolProperty as j}from"./support/commonProperties.js";import{LegendOptions as _}from"./support/LegendOptions.js";import w from"./support/UniqueValueInfo.js";import{loadArcade as O}from"../support/arcadeOnDemand.js";import{f as U,t as F}from"../chunks/persistableUrlUtils.js";import{fetchStyle as x}from"../symbols/support/styleUtils.js";import D from"../symbols/WebStyleSymbol.js";var E;const M="esri.renderers.UniqueValueRenderer",N=s.getLogger(M),R=h(w);let P=E=class extends(q(V)){constructor(e){super(e),this._valueInfoMap={},this._isDefaultSymbolDerived=!1,this.type="unique-value",this.backgroundFillSymbol=null,this.field=null,this.field2=null,this.field3=null,this.valueExpression=null,this.valueExpressionTitle=null,this.legendOptions=null,this.defaultLabel=null,this.fieldDelimiter=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 i=!1;const r={type:"collection",added:[],removed:[],changed:[],unchanged:[]};for(let s=0;s<t.length;s++){const l=e.find((e=>e.value===t[s].value));l?m(l,t[s])?(r.changed.push({type:"complete",oldValue:l,newValue:t[s]}),i=!0):r.unchanged.push({oldValue:l,newValue:t[s]}):(r.added.push(t[s]),i=!0)}for(let s=0;s<e.length;s++){t.find((t=>t.value===e[s].value))||(r.removed.push(e[s]),i=!0)}return i?r:void 0}},this._set("uniqueValueInfos",[])}get _cache(){return{compiledFunc:null}}castField(e){return null==e||"function"==typeof e?e:b(e)}writeField(e,t,r,s){"string"==typeof e?t[r]=e:s&&s.messages?s.messages.push(new i("property:unsupported","UniqueValueRenderer.field set to a function cannot be written to JSON")):N.error(".field: cannot write field to JSON since it's not a string value")}set defaultSymbol(e){this._isDefaultSymbolDerived=!1,this._set("defaultSymbol",e)}readPortal(e,t,i){return i.portal||S.getDefault()}readStyleOrigin(e,t,i){if(t.styleName)return Object.freeze({styleName:t.styleName});if(t.styleUrl){const e=U(t.styleUrl,i);return Object.freeze({styleUrl:e})}}writeStyleOrigin(e,t,i,r){e.styleName?t.styleName=e.styleName:e.styleUrl&&(t.styleUrl=F(e.styleUrl,r))}set uniqueValueInfos(e){this.styleOrigin?N.error("#uniqueValueInfos=","Cannot modify unique value infos of a UniqueValueRenderer created from a web style"):(this._set("uniqueValueInfos",e),this._updateValueInfoMap())}addUniqueValueInfo(e,i){if(this.styleOrigin)return void N.error("#addUniqueValueInfo()","Cannot modify unique value infos of a UniqueValueRenderer created from a web style");let r;r="object"==typeof e?R(e):new w({value:e,symbol:t(i)}),this.uniqueValueInfos.push(r),this._valueInfoMap[r.value]=r}removeUniqueValueInfo(e){if(this.styleOrigin)N.error("#removeUniqueValueInfo()","Cannot modify unique value infos of a UniqueValueRenderer created from a web style");else for(let t=0;t<this.uniqueValueInfos.length;t++){if(this.uniqueValueInfos[t].value===e+""){delete this._valueInfoMap[e],this.uniqueValueInfos.splice(t,1);break}}}async getUniqueValueInfo(e,t){let i=t;return this.valueExpression&&(l(t)||l(t.arcade))&&(i={...i,arcade:await O()}),this._getUniqueValueInfo(e,i)}getSymbol(e,t){if(this.valueExpression&&(l(t)||l(t.arcade)))return void N.error("#getSymbol()","Please use getSymbolAsync if valueExpression is used");const i=this._getUniqueValueInfo(e,t);return i&&i.symbol||this.defaultSymbol}async getSymbolAsync(e,t){let i=t;if(this.valueExpression&&(l(i)||l(i.arcade))){const e=await O(),{arcadeUtils:t}=e;t.hasGeometryOperations(this.valueExpression)&&await t.enableGeometryOperations(),i={...i,arcade:e}}const r=this._getUniqueValueInfo(e,i);return r&&r.symbol||this.defaultSymbol}getSymbols(){const e=[];for(const t of this.uniqueValueInfos)t.symbol&&e.push(t.symbol);return this.defaultSymbol&&e.push(this.defaultSymbol),e}getAttributeHash(){return this.visualVariables&&this.visualVariables.reduce(((e,t)=>e+t.getAttributeHash()),"")}getMeshHash(){return`${JSON.stringify(this.backgroundFillSymbol)}.${JSON.stringify(this.defaultSymbol)}.${this.uniqueValueInfos.reduce(((e,t)=>e+t.getMeshHash()),"")}.${`${this.field}.${this.field2}.${this.field3}.${this.fieldDelimiter}`}.${this.valueExpression}`}clone(){const e=new E({field:this.field,field2:this.field2,field3:this.field3,defaultLabel:this.defaultLabel,defaultSymbol:r(this.defaultSymbol),valueExpression:this.valueExpression,valueExpressionTitle:this.valueExpressionTitle,fieldDelimiter:this.fieldDelimiter,visualVariables:r(this.visualVariables),legendOptions:r(this.legendOptions),authoringInfo:this.authoringInfo&&this.authoringInfo.clone(),backgroundFillSymbol:r(this.backgroundFillSymbol)});this._isDefaultSymbolDerived&&(e._isDefaultSymbolDerived=!0),e._set("portal",this.portal);const t=r(this.uniqueValueInfos);return this.styleOrigin&&(e._set("styleOrigin",Object.freeze(r(this.styleOrigin))),Object.freeze(t)),e._set("uniqueValueInfos",t),e._updateValueInfoMap(),e}get arcadeRequired(){return this.arcadeRequiredForVisualVariables||!!this.valueExpression}async collectRequiredFields(e,t){const i=[this.collectVVRequiredFields(e,t),this.collectSymbolFields(e,t)];await Promise.all(i)}async collectSymbolFields(e,t){const i=[...this.getSymbols().map((i=>i.collectRequiredFields(e,t))),g(e,t,this.valueExpression)];v(e,t,this.field),v(e,t,this.field2),v(e,t,this.field3),await Promise.all(i)}populateFromStyle(){return x(this.styleOrigin,{portal:this.portal}).then((e=>{const t=[];return this._valueInfoMap={},e&&e.data&&Array.isArray(e.data.items)&&e.data.items.forEach((i=>{const r=new D({styleUrl:e.styleUrl,styleName:e.styleName,portal:this.portal,name:i.name});this.defaultSymbol||i.name!==e.data.defaultItem||(this.defaultSymbol=r,this._isDefaultSymbolDerived=!0);const s=new w({value:i.name,symbol:r});t.push(s),this._valueInfoMap[i.name]=s})),this._set("uniqueValueInfos",Object.freeze(t)),!this.defaultSymbol&&this.uniqueValueInfos.length&&(this.defaultSymbol=this.uniqueValueInfos[0].symbol,this._isDefaultSymbolDerived=!0),this}))}_updateValueInfoMap(){this._valueInfoMap={},this.uniqueValueInfos.forEach((e=>this._valueInfoMap[e.value+""]=e))}_getUniqueValueInfo(e,t){return this.valueExpression?this._getUnqiueValueInfoForExpression(e,t):this._getUnqiueValueInfoForFields(e)}_getUnqiueValueInfoForExpression(e,t){const{viewingMode:i,scale:r,spatialReference:s,arcade:l}=o(t,{});let a=this._cache.compiledFunc;const u=n(l).arcadeUtils;if(!a){const e=u.createSyntaxTree(this.valueExpression);a=u.createFunction(e),this._cache.compiledFunc=a}const p=u.executeFunction(a,u.createExecContext(e,u.getViewInfo({viewingMode:i,scale:r,spatialReference:s})));return this._valueInfoMap[p+""]}_getUnqiueValueInfoForFields(e){const t=this.field,i=e.attributes;let r;if("function"!=typeof t&&this.field2){const e=this.field2,s=this.field3,l=[];t&&l.push(i[t]),e&&l.push(i[e]),s&&l.push(i[s]),r=l.join(this.fieldDelimiter||"")}else"function"==typeof t?r=t(e):t&&(r=i[t]);return this._valueInfoMap[r+""]}static fromPortalStyle(e,t){const i=new E(t&&t.properties);i._set("styleOrigin",Object.freeze({styleName:e})),i._set("portal",t&&t.portal||S.getDefault());const r=i.populateFromStyle();return r.catch((t=>{N.error(`#fromPortalStyle('${e}'[, ...])`,"Failed to create unique value renderer from style name",t)})),r}static fromStyleUrl(e,t){const i=new E(t&&t.properties);i._set("styleOrigin",Object.freeze({styleUrl:e}));const r=i.populateFromStyle();return r.catch((t=>{N.error(`#fromStyleUrl('${e}'[, ...])`,"Failed to create unique value renderer from style URL",t)})),r}};e([u({readOnly:!0})],P.prototype,"_cache",null),e([f({uniqueValue:"unique-value"})],P.prototype,"type",void 0),e([u(I)],P.prototype,"backgroundFillSymbol",void 0),e([u({json:{type:String,read:{source:"field1"},write:{target:"field1"}}})],P.prototype,"field",void 0),e([p("field")],P.prototype,"castField",null),e([y("field")],P.prototype,"writeField",null),e([u({type:String,json:{write:!0}})],P.prototype,"field2",void 0),e([u({type:String,json:{write:!0}})],P.prototype,"field3",void 0),e([u({type:String,json:{write:!0}})],P.prototype,"valueExpression",void 0),e([u({type:String,json:{write:!0}})],P.prototype,"valueExpressionTitle",void 0),e([u({type:_,json:{write:!0}})],P.prototype,"legendOptions",void 0),e([u({type:String,json:{write:!0}})],P.prototype,"defaultLabel",void 0),e([u(a({...j},{json:{write:{overridePolicy(){return{enabled:!this._isDefaultSymbolDerived}}},origins:{"web-scene":{write:{overridePolicy(){return{enabled:!this._isDefaultSymbolDerived}}}}}}}))],P.prototype,"defaultSymbol",null),e([u({type:String,json:{write:!0}})],P.prototype,"fieldDelimiter",void 0),e([u({type:S,readOnly:!0})],P.prototype,"portal",void 0),e([d("portal",["styleName"])],P.prototype,"readPortal",null),e([u({readOnly:!0,json:{write:{enabled:!1,overridePolicy:()=>({enabled:!0})}}})],P.prototype,"styleOrigin",void 0),e([d("styleOrigin",["styleName","styleUrl"])],P.prototype,"readStyleOrigin",null),e([y("styleOrigin",{styleName:{type:String},styleUrl:{type:String}})],P.prototype,"writeStyleOrigin",null),e([u({type:[w],json:{write:{overridePolicy(){return this.styleOrigin?{enabled:!1}:{enabled:!0}}}}})],P.prototype,"uniqueValueInfos",null),P=E=e([c(M)],P);const $=P;export{$ as default};
5
+ import{_ as e}from"../chunks/tslib.es6.js";import{ensureType as t}from"../symbols.js";import i from"../core/Error.js";import{clone as r}from"../core/lang.js";import s from"../core/Logger.js";import{isNone as l,unwrapOr as o,unwrap as n}from"../core/maybe.js";import{deepMerge as a}from"../core/object.js";import{property as u}from"../core/accessorSupport/decorators/property.js";import{cast as p}from"../core/accessorSupport/decorators/cast.js";import{enumeration as f}from"../core/accessorSupport/decorators/enumeration.js";import{reader as d}from"../core/accessorSupport/decorators/reader.js";import{subclass as c}from"../core/accessorSupport/decorators/subclass.js";import{writer as y}from"../core/accessorSupport/decorators/writer.js";import{diff as m}from"../core/accessorSupport/diffUtils.js";import{ensureType as h,ensureString as b}from"../core/accessorSupport/ensureType.js";import{collectArcadeFieldNames as g,collectField as v}from"../layers/support/fieldUtils.js";import S from"../portal/Portal.js";import V from"./Renderer.js";import{VisualVariablesMixin as q}from"./mixins/VisualVariablesMixin.js";import{rendererSymbolProperty as I,rendererBackgroundFillSymbolProperty as j}from"./support/commonProperties.js";import{LegendOptions as _}from"./support/LegendOptions.js";import w from"./support/UniqueValueInfo.js";import{loadArcade as O}from"../support/arcadeOnDemand.js";import{f as U,t as F}from"../chunks/persistableUrlUtils.js";import{fetchStyle as x}from"../symbols/support/styleUtils.js";import D from"../symbols/WebStyleSymbol.js";var E;const M="esri.renderers.UniqueValueRenderer",N=s.getLogger(M),R=h(w);let P=E=class extends(q(V)){constructor(e){super(e),this._valueInfoMap={},this._isDefaultSymbolDerived=!1,this.type="unique-value",this.backgroundFillSymbol=null,this.field=null,this.field2=null,this.field3=null,this.valueExpression=null,this.valueExpressionTitle=null,this.legendOptions=null,this.defaultLabel=null,this.fieldDelimiter=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 i=!1;const r={type:"collection",added:[],removed:[],changed:[],unchanged:[]};for(let s=0;s<t.length;s++){const l=e.find((e=>e.value===t[s].value));l?m(l,t[s])?(r.changed.push({type:"complete",oldValue:l,newValue:t[s]}),i=!0):r.unchanged.push({oldValue:l,newValue:t[s]}):(r.added.push(t[s]),i=!0)}for(let s=0;s<e.length;s++){t.find((t=>t.value===e[s].value))||(r.removed.push(e[s]),i=!0)}return i?r:void 0}},this._set("uniqueValueInfos",[])}get _cache(){return{compiledFunc:null}}castField(e){return null==e||"function"==typeof e?e:b(e)}writeField(e,t,r,s){"string"==typeof e?t[r]=e:s&&s.messages?s.messages.push(new i("property:unsupported","UniqueValueRenderer.field set to a function cannot be written to JSON")):N.error(".field: cannot write field to JSON since it's not a string value")}set defaultSymbol(e){this._isDefaultSymbolDerived=!1,this._set("defaultSymbol",e)}readPortal(e,t,i){return i.portal||S.getDefault()}readStyleOrigin(e,t,i){if(t.styleName)return Object.freeze({styleName:t.styleName});if(t.styleUrl){const e=U(t.styleUrl,i);return Object.freeze({styleUrl:e})}}writeStyleOrigin(e,t,i,r){e.styleName?t.styleName=e.styleName:e.styleUrl&&(t.styleUrl=F(e.styleUrl,r))}set uniqueValueInfos(e){this.styleOrigin?N.error("#uniqueValueInfos=","Cannot modify unique value infos of a UniqueValueRenderer created from a web style"):(this._set("uniqueValueInfos",e),this._updateValueInfoMap())}addUniqueValueInfo(e,i){if(this.styleOrigin)return void N.error("#addUniqueValueInfo()","Cannot modify unique value infos of a UniqueValueRenderer created from a web style");let r;r="object"==typeof e?R(e):new w({value:e,symbol:t(i)}),this.uniqueValueInfos.push(r),this._valueInfoMap[r.value]=r}removeUniqueValueInfo(e){if(this.styleOrigin)N.error("#removeUniqueValueInfo()","Cannot modify unique value infos of a UniqueValueRenderer created from a web style");else for(let t=0;t<this.uniqueValueInfos.length;t++){if(this.uniqueValueInfos[t].value===e+""){delete this._valueInfoMap[e],this.uniqueValueInfos.splice(t,1);break}}}async getUniqueValueInfo(e,t){let i=t;return this.valueExpression&&(l(t)||l(t.arcade))&&(i={...i,arcade:await O()}),this._getUniqueValueInfo(e,i)}getSymbol(e,t){if(this.valueExpression&&(l(t)||l(t.arcade)))return void N.error("#getSymbol()","Please use getSymbolAsync if valueExpression is used");const i=this._getUniqueValueInfo(e,t);return i&&i.symbol||this.defaultSymbol}async getSymbolAsync(e,t){let i=t;if(this.valueExpression&&(l(i)||l(i.arcade))){const e=await O(),{arcadeUtils:t}=e;t.hasGeometryOperations(this.valueExpression)&&await t.enableGeometryOperations(),i={...i,arcade:e}}const r=this._getUniqueValueInfo(e,i);return r&&r.symbol||this.defaultSymbol}getSymbols(){const e=[];for(const t of this.uniqueValueInfos)t.symbol&&e.push(t.symbol);return this.defaultSymbol&&e.push(this.defaultSymbol),e}getAttributeHash(){return this.visualVariables&&this.visualVariables.reduce(((e,t)=>e+t.getAttributeHash()),"")}getMeshHash(){return`${JSON.stringify(this.backgroundFillSymbol)}.${JSON.stringify(this.defaultSymbol)}.${this.uniqueValueInfos.reduce(((e,t)=>e+t.getMeshHash()),"")}.${`${this.field}.${this.field2}.${this.field3}.${this.fieldDelimiter}`}.${this.valueExpression}`}clone(){const e=new E({field:this.field,field2:this.field2,field3:this.field3,defaultLabel:this.defaultLabel,defaultSymbol:r(this.defaultSymbol),valueExpression:this.valueExpression,valueExpressionTitle:this.valueExpressionTitle,fieldDelimiter:this.fieldDelimiter,visualVariables:r(this.visualVariables),legendOptions:r(this.legendOptions),authoringInfo:this.authoringInfo&&this.authoringInfo.clone(),backgroundFillSymbol:r(this.backgroundFillSymbol)});this._isDefaultSymbolDerived&&(e._isDefaultSymbolDerived=!0),e._set("portal",this.portal);const t=r(this.uniqueValueInfos);return this.styleOrigin&&(e._set("styleOrigin",Object.freeze(r(this.styleOrigin))),Object.freeze(t)),e._set("uniqueValueInfos",t),e._updateValueInfoMap(),e}get arcadeRequired(){return this.arcadeRequiredForVisualVariables||!!this.valueExpression}async collectRequiredFields(e,t){const i=[this.collectVVRequiredFields(e,t),this.collectSymbolFields(e,t)];await Promise.all(i)}async collectSymbolFields(e,t){const i=[...this.getSymbols().map((i=>i.collectRequiredFields(e,t))),g(e,t,this.valueExpression)];v(e,t,this.field),v(e,t,this.field2),v(e,t,this.field3),await Promise.all(i)}populateFromStyle(){return x(this.styleOrigin,{portal:this.portal}).then((e=>{const t=[];return this._valueInfoMap={},e&&e.data&&Array.isArray(e.data.items)&&e.data.items.forEach((i=>{const r=new D({styleUrl:e.styleUrl,styleName:e.styleName,portal:this.portal,name:i.name});this.defaultSymbol||i.name!==e.data.defaultItem||(this.defaultSymbol=r,this._isDefaultSymbolDerived=!0);const s=new w({value:i.name,symbol:r});t.push(s),this._valueInfoMap[i.name]=s})),this._set("uniqueValueInfos",Object.freeze(t)),!this.defaultSymbol&&this.uniqueValueInfos.length&&(this.defaultSymbol=this.uniqueValueInfos[0].symbol,this._isDefaultSymbolDerived=!0),this}))}_updateValueInfoMap(){this._valueInfoMap={},this.uniqueValueInfos.forEach((e=>this._valueInfoMap[e.value+""]=e))}_getUniqueValueInfo(e,t){return this.valueExpression?this._getUnqiueValueInfoForExpression(e,t):this._getUnqiueValueInfoForFields(e)}_getUnqiueValueInfoForExpression(e,t){const{viewingMode:i,scale:r,spatialReference:s,arcade:l}=o(t,{});let a=this._cache.compiledFunc;const u=n(l).arcadeUtils;if(!a){const e=u.createSyntaxTree(this.valueExpression);a=u.createFunction(e),this._cache.compiledFunc=a}const p=u.executeFunction(a,u.createExecContext(e,u.getViewInfo({viewingMode:i,scale:r,spatialReference:s})));return this._valueInfoMap[p+""]}_getUnqiueValueInfoForFields(e){const t=this.field,i=e.attributes;let r;if("function"!=typeof t&&this.field2){const e=this.field2,s=this.field3,l=[];t&&l.push(i[t]),e&&l.push(i[e]),s&&l.push(i[s]),r=l.join(this.fieldDelimiter||"")}else"function"==typeof t?r=t(e):t&&(r=i[t]);return this._valueInfoMap[r+""]}static fromPortalStyle(e,t){const i=new E(t&&t.properties);i._set("styleOrigin",Object.freeze({styleName:e})),i._set("portal",t&&t.portal||S.getDefault());const r=i.populateFromStyle();return r.catch((t=>{N.error(`#fromPortalStyle('${e}'[, ...])`,"Failed to create unique value renderer from style name",t)})),r}static fromStyleUrl(e,t){const i=new E(t&&t.properties);i._set("styleOrigin",Object.freeze({styleUrl:e}));const r=i.populateFromStyle();return r.catch((t=>{N.error(`#fromStyleUrl('${e}'[, ...])`,"Failed to create unique value renderer from style URL",t)})),r}};e([u({readOnly:!0})],P.prototype,"_cache",null),e([f({uniqueValue:"unique-value"})],P.prototype,"type",void 0),e([u(j)],P.prototype,"backgroundFillSymbol",void 0),e([u({json:{type:String,read:{source:"field1"},write:{target:"field1"}}})],P.prototype,"field",void 0),e([p("field")],P.prototype,"castField",null),e([y("field")],P.prototype,"writeField",null),e([u({type:String,json:{write:!0}})],P.prototype,"field2",void 0),e([u({type:String,json:{write:!0}})],P.prototype,"field3",void 0),e([u({type:String,json:{write:!0}})],P.prototype,"valueExpression",void 0),e([u({type:String,json:{write:!0}})],P.prototype,"valueExpressionTitle",void 0),e([u({type:_,json:{write:!0}})],P.prototype,"legendOptions",void 0),e([u({type:String,json:{write:!0}})],P.prototype,"defaultLabel",void 0),e([u(a({...I},{json:{write:{overridePolicy(){return{enabled:!this._isDefaultSymbolDerived}}},origins:{"web-scene":{write:{overridePolicy(){return{enabled:!this._isDefaultSymbolDerived}}}}}}}))],P.prototype,"defaultSymbol",null),e([u({type:String,json:{write:!0}})],P.prototype,"fieldDelimiter",void 0),e([u({type:S,readOnly:!0})],P.prototype,"portal",void 0),e([d("portal",["styleName"])],P.prototype,"readPortal",null),e([u({readOnly:!0,json:{write:{enabled:!1,overridePolicy:()=>({enabled:!0})}}})],P.prototype,"styleOrigin",void 0),e([d("styleOrigin",["styleName","styleUrl"])],P.prototype,"readStyleOrigin",null),e([y("styleOrigin",{styleName:{type:String},styleUrl:{type:String}})],P.prototype,"writeStyleOrigin",null),e([u({type:[w],json:{write:{overridePolicy(){return this.styleOrigin?{enabled:!1}:{enabled:!0}}}}})],P.prototype,"uniqueValueInfos",null),P=E=e([c(M)],P);const $=P;export{$ as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.25/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../chunks/tslib.es6.js";import{JSONMap as t}from"../../core/jsonMap.js";import{JSONSupport as i}from"../../core/JSONSupport.js";import{clone as s}from"../../core/lang.js";import{property as r}from"../../core/accessorSupport/decorators/property.js";import{Integer as l}from"../../core/accessorSupport/ensureType.js";import{reader as a}from"../../core/accessorSupport/decorators/reader.js";import{subclass as o}from"../../core/accessorSupport/decorators/subclass.js";import{AuthoringInfoFieldInfo as n}from"./AuthoringInfoFieldInfo.js";import u from"./AuthoringInfoVisualVariable.js";import{types as p,fromJSON as c}from"../../rest/support/colorRamps.js";var d;const h=new t({esriClassifyDefinedInterval:"defined-interval",esriClassifyEqualInterval:"equal-interval",esriClassifyManual:"manual",esriClassifyNaturalBreaks:"natural-breaks",esriClassifyQuantile:"quantile",esriClassifyStandardDeviation:"standard-deviation"}),m=new t({pieChart:"pie-chart",classedSize:"class-breaks-size",classedColor:"class-breaks-color",univariateColorSize:"univariate-color-size",relationship:"relationship",predominance:"predominance",dotDensity:"dot-density",flow:"flow"}),y=new t({classedSize:"class-breaks-size",classedColor:"class-breaks-color",univariateColorSize:"univariate-color-size",relationship:"relationship",predominance:"predominance",dotDensity:"dot-density"}),f=["inches","feet","yards","miles","nautical-miles","millimeters","centimeters","decimeters","meters","kilometers","decimal-degrees"],v=["high-to-low","above-and-below","above","below","90-10"],w=["flow-line","wave-front"],b=["caret","circle-caret","arrow","circle-arrow","plus-minus","circle-plus-minus","square","circle","triangle","happy-sad","thumb","custom"];let g=d=class extends i{constructor(e){super(e),this.colorRamp=null,this.lengthUnit=null,this.maxSliderValue=null,this.minSliderValue=null,this.visualVariables=null}get classificationMethod(){const e=this._get("classificationMethod"),t=this.type;return t&&"relationship"!==t?"class-breaks-size"===t||"class-breaks-color"===t?e||"manual":null:e}set classificationMethod(e){this._set("classificationMethod",e)}readColorRamp(e){if(e)return c(e)}get fields(){return this.type&&"predominance"!==this.type?null:this._get("fields")}set fields(e){this._set("fields",e)}get field1(){return this.type&&"relationship"!==this.type?null:this._get("field1")}set field1(e){this._set("field1",e)}get field2(){return this.type&&"relationship"!==this.type?null:this._get("field2")}set field2(e){this._set("field2",e)}get flowTheme(){return"flow"===this.type?this._get("flowTheme"):null}set flowTheme(e){this._set("flowTheme",e)}get focus(){return this.type&&"relationship"!==this.type?null:this._get("focus")}set focus(e){this._set("focus",e)}get numClasses(){return this.type&&"relationship"!==this.type?null:this._get("numClasses")}set numClasses(e){this._set("numClasses",e)}get statistics(){return"univariate-color-size"===this.type&&"above-and-below"===this.univariateTheme?this._get("statistics"):null}set statistics(e){this._set("statistics",e)}get standardDeviationInterval(){const e=this.type;return e&&"relationship"!==e&&"class-breaks-size"!==e&&"class-breaks-color"!==e||this.classificationMethod&&"standard-deviation"!==this.classificationMethod?null:this._get("standardDeviationInterval")}set standardDeviationInterval(e){this._set("standardDeviationInterval",e)}get type(){return this._get("type")}set type(e){let t=e;"classed-size"===e?t="class-breaks-size":"classed-color"===e&&(t="class-breaks-color"),this._set("type",t)}get univariateSymbolStyle(){return"univariate-color-size"===this.type&&"above-and-below"===this.univariateTheme?this._get("univariateSymbolStyle"):null}set univariateSymbolStyle(e){this._set("univariateSymbolStyle",e)}get univariateTheme(){return"univariate-color-size"===this.type?this._get("univariateTheme"):null}set univariateTheme(e){this._set("univariateTheme",e)}clone(){return new d({classificationMethod:this.classificationMethod,colorRamp:s(this.colorRamp),fields:this.fields&&this.fields.slice(0),field1:s(this.field1),field2:s(this.field2),focus:this.focus,numClasses:this.numClasses,maxSliderValue:this.maxSliderValue,minSliderValue:this.minSliderValue,lengthUnit:this.lengthUnit,statistics:this.statistics,standardDeviationInterval:this.standardDeviationInterval,type:this.type,visualVariables:this.visualVariables&&this.visualVariables.map((e=>e.clone())),univariateSymbolStyle:this.univariateSymbolStyle,univariateTheme:this.univariateTheme,flowTheme:this.flowTheme})}};e([r({type:h.apiValues,value:null,json:{type:h.jsonValues,read:h.read,write:h.write,origins:{"web-document":{default:"manual",type:h.jsonValues,read:h.read,write:h.write}}}})],g.prototype,"classificationMethod",null),e([r({types:p,json:{write:!0}})],g.prototype,"colorRamp",void 0),e([a("colorRamp")],g.prototype,"readColorRamp",null),e([r({type:[String],value:null,json:{write:!0}})],g.prototype,"fields",null),e([r({type:n,value:null,json:{write:!0}})],g.prototype,"field1",null),e([r({type:n,value:null,json:{write:!0}})],g.prototype,"field2",null),e([r({type:w,value:null,json:{write:!0,origins:{"web-scene":{write:!1}}}})],g.prototype,"flowTheme",null),e([r({type:["HH","HL","LH","LL"],value:null,json:{write:!0}})],g.prototype,"focus",null),e([r({type:Number,value:null,json:{type:l,write:!0}})],g.prototype,"numClasses",null),e([r({type:f,json:{type:f,read:!1,write:!1,origins:{"web-scene":{read:!0,write:!0}}}})],g.prototype,"lengthUnit",void 0),e([r({type:Number,json:{write:!0,origins:{"web-scene":{write:!1,read:!1}}}})],g.prototype,"maxSliderValue",void 0),e([r({type:Number,json:{write:!0,origins:{"web-scene":{write:!1,read:!1}}}})],g.prototype,"minSliderValue",void 0),e([r({type:Object,value:null,json:{write:!0,origins:{"web-scene":{write:!1,read:!1}}}})],g.prototype,"statistics",null),e([r({type:[.25,.33,.5,1],value:null,json:{type:[.25,.33,.5,1],write:!0}})],g.prototype,"standardDeviationInterval",null),e([r({type:m.apiValues,value:null,json:{type:m.jsonValues,read:m.read,write:m.write,origins:{"web-scene":{type:y.jsonValues,write:{writer:y.write,overridePolicy:e=>({enabled:"flow"!==e})}}}}})],g.prototype,"type",null),e([r({type:[u],json:{write:!0}})],g.prototype,"visualVariables",void 0),e([r({type:b,value:null,json:{write:!0,origins:{"web-scene":{write:!1}}}})],g.prototype,"univariateSymbolStyle",null),e([r({type:v,value:null,json:{write:!0,origins:{"web-scene":{write:!1}}}})],g.prototype,"univariateTheme",null),g=d=e([o("esri.renderers.support.AuthoringInfo")],g);const j=g;export{j as default};
5
+ import{_ as e}from"../../chunks/tslib.es6.js";import{JSONMap as t}from"../../core/jsonMap.js";import{JSONSupport as i}from"../../core/JSONSupport.js";import{clone as s}from"../../core/lang.js";import{property as r}from"../../core/accessorSupport/decorators/property.js";import{Integer as l}from"../../core/accessorSupport/ensureType.js";import{reader as a}from"../../core/accessorSupport/decorators/reader.js";import{subclass as o}from"../../core/accessorSupport/decorators/subclass.js";import{AuthoringInfoFieldInfo as n}from"./AuthoringInfoFieldInfo.js";import u from"./AuthoringInfoVisualVariable.js";import{fromJSON as p,types as c}from"../../rest/support/colorRamps.js";var d;const h=new t({esriClassifyDefinedInterval:"defined-interval",esriClassifyEqualInterval:"equal-interval",esriClassifyManual:"manual",esriClassifyNaturalBreaks:"natural-breaks",esriClassifyQuantile:"quantile",esriClassifyStandardDeviation:"standard-deviation"}),m=new t({pieChart:"pie-chart",classedSize:"class-breaks-size",classedColor:"class-breaks-color",univariateColorSize:"univariate-color-size",relationship:"relationship",predominance:"predominance",dotDensity:"dot-density",flow:"flow"}),y=new t({classedSize:"class-breaks-size",classedColor:"class-breaks-color",univariateColorSize:"univariate-color-size",relationship:"relationship",predominance:"predominance",dotDensity:"dot-density"}),f=["inches","feet","yards","miles","nautical-miles","millimeters","centimeters","decimeters","meters","kilometers","decimal-degrees"],v=["high-to-low","above-and-below","above","below","90-10"],w=["flow-line","wave-front"],b=["caret","circle-caret","arrow","circle-arrow","plus-minus","circle-plus-minus","square","circle","triangle","happy-sad","thumb","custom"];let g=d=class extends i{constructor(e){super(e),this.colorRamp=null,this.lengthUnit=null,this.maxSliderValue=null,this.minSliderValue=null,this.visualVariables=null}get classificationMethod(){const e=this._get("classificationMethod"),t=this.type;return t&&"relationship"!==t?"class-breaks-size"===t||"class-breaks-color"===t?e||"manual":null:e}set classificationMethod(e){this._set("classificationMethod",e)}readColorRamp(e){if(e)return p(e)}get fields(){return this.type&&"predominance"!==this.type?null:this._get("fields")}set fields(e){this._set("fields",e)}get field1(){return this.type&&"relationship"!==this.type?null:this._get("field1")}set field1(e){this._set("field1",e)}get field2(){return this.type&&"relationship"!==this.type?null:this._get("field2")}set field2(e){this._set("field2",e)}get flowTheme(){return"flow"===this.type?this._get("flowTheme"):null}set flowTheme(e){this._set("flowTheme",e)}get focus(){return this.type&&"relationship"!==this.type?null:this._get("focus")}set focus(e){this._set("focus",e)}get numClasses(){return this.type&&"relationship"!==this.type?null:this._get("numClasses")}set numClasses(e){this._set("numClasses",e)}get statistics(){return"univariate-color-size"===this.type&&"above-and-below"===this.univariateTheme?this._get("statistics"):null}set statistics(e){this._set("statistics",e)}get standardDeviationInterval(){const e=this.type;return e&&"relationship"!==e&&"class-breaks-size"!==e&&"class-breaks-color"!==e||this.classificationMethod&&"standard-deviation"!==this.classificationMethod?null:this._get("standardDeviationInterval")}set standardDeviationInterval(e){this._set("standardDeviationInterval",e)}get type(){return this._get("type")}set type(e){let t=e;"classed-size"===e?t="class-breaks-size":"classed-color"===e&&(t="class-breaks-color"),this._set("type",t)}get univariateSymbolStyle(){return"univariate-color-size"===this.type&&"above-and-below"===this.univariateTheme?this._get("univariateSymbolStyle"):null}set univariateSymbolStyle(e){this._set("univariateSymbolStyle",e)}get univariateTheme(){return"univariate-color-size"===this.type?this._get("univariateTheme"):null}set univariateTheme(e){this._set("univariateTheme",e)}clone(){return new d({classificationMethod:this.classificationMethod,colorRamp:s(this.colorRamp),fields:this.fields&&this.fields.slice(0),field1:s(this.field1),field2:s(this.field2),focus:this.focus,numClasses:this.numClasses,maxSliderValue:this.maxSliderValue,minSliderValue:this.minSliderValue,lengthUnit:this.lengthUnit,statistics:this.statistics,standardDeviationInterval:this.standardDeviationInterval,type:this.type,visualVariables:this.visualVariables&&this.visualVariables.map((e=>e.clone())),univariateSymbolStyle:this.univariateSymbolStyle,univariateTheme:this.univariateTheme,flowTheme:this.flowTheme})}};e([r({type:h.apiValues,value:null,json:{type:h.jsonValues,read:h.read,write:h.write,origins:{"web-document":{default:"manual",type:h.jsonValues,read:h.read,write:h.write}}}})],g.prototype,"classificationMethod",null),e([r({types:c,json:{write:!0}})],g.prototype,"colorRamp",void 0),e([a("colorRamp")],g.prototype,"readColorRamp",null),e([r({type:[String],value:null,json:{write:!0}})],g.prototype,"fields",null),e([r({type:n,value:null,json:{write:!0}})],g.prototype,"field1",null),e([r({type:n,value:null,json:{write:!0}})],g.prototype,"field2",null),e([r({type:w,value:null,json:{write:!0,origins:{"web-scene":{write:!1}}}})],g.prototype,"flowTheme",null),e([r({type:["HH","HL","LH","LL"],value:null,json:{write:!0}})],g.prototype,"focus",null),e([r({type:Number,value:null,json:{type:l,write:!0}})],g.prototype,"numClasses",null),e([r({type:f,json:{type:f,read:!1,write:!1,origins:{"web-scene":{read:!0,write:!0}}}})],g.prototype,"lengthUnit",void 0),e([r({type:Number,json:{write:!0,origins:{"web-scene":{write:!1,read:!1}}}})],g.prototype,"maxSliderValue",void 0),e([r({type:Number,json:{write:!0,origins:{"web-scene":{write:!1,read:!1}}}})],g.prototype,"minSliderValue",void 0),e([r({type:Object,value:null,json:{write:!0,origins:{"web-scene":{write:!1,read:!1}}}})],g.prototype,"statistics",null),e([r({type:[.25,.33,.5,1],value:null,json:{type:[.25,.33,.5,1],write:!0}})],g.prototype,"standardDeviationInterval",null),e([r({type:m.apiValues,value:null,json:{type:m.jsonValues,read:m.read,write:m.write,origins:{"web-scene":{type:y.jsonValues,write:{writer:y.write,overridePolicy:e=>({enabled:"flow"!==e})}}}}})],g.prototype,"type",null),e([r({type:[u],json:{write:!0}})],g.prototype,"visualVariables",void 0),e([r({type:b,value:null,json:{write:!0,origins:{"web-scene":{write:!1}}}})],g.prototype,"univariateSymbolStyle",null),e([r({type:v,value:null,json:{write:!0,origins:{"web-scene":{write:!1}}}})],g.prototype,"univariateTheme",null),g=d=e([o("esri.renderers.support.AuthoringInfo")],g);const j=g;export{j as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.25/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../chunks/tslib.es6.js";import{toHSV as t}from"../../core/colorUtils.js";import{JSONSupport as r}from"../../core/JSONSupport.js";import s from"../../core/Logger.js";import{unwrap as a,isSome as o,isNone as n}from"../../core/maybe.js";import{property as i}from"../../core/accessorSupport/decorators/property.js";import"../../core/arrayUtils.js";import"../../core/has.js";import"../../core/accessorSupport/ensureType.js";import{subclass as l}from"../../core/accessorSupport/decorators/subclass.js";import u from"../../layers/support/RasterInfo.js";import{isValidPixelBlock as c,extractBands as p,colorize as d,remapColor as h,lookupPixels as m,createColormapLUT as f}from"../../layers/support/rasterFunctions/pixelUtils.js";import{stretch as b,getStretchCutoff as y,createStretchLUT as g,computeGammaValues as S,createHistogramEqualizationLUT as k}from"../../layers/support/rasterFunctions/stretchUtils.js";import{hillshade as x,tintHillshade as I,calculateHillshadeParams as R}from"../../layers/support/rasterFunctions/surfaceUtils.js";import{convertColorRampToColormap as C}from"./colorRampUtils.js";function L(e,t){const{attributeTable:r,bandCount:s}=e;if(n(r)||s>1)return!1;if(t){if(null==r.fields.find((e=>e.name.toLowerCase()===t.toLowerCase())))return!1}return!0}function _(e){const{bandCount:t,dataType:r,pixelType:s}=e;return"elevation"===r||"generic"===r&&1===t&&("s16"===s||"f32"===s||"f64"===s)}function V(e){const{bandCount:t,colormap:r}=e;return o(r)&&r.length&&1===t}let v=class extends r{constructor(e){super(e)}bind(){const{rendererJSON:e}=this;if(!e)return{success:!1};let t;switch(this.lookup={rendererJSON:{}},e.type){case"uniqueValue":t=this._updateUVRenderer(e);break;case"rasterColormap":t=this._updateColormapRenderer(e);break;case"rasterStretch":t=this._updateStretchRenderer(e);break;case"classBreaks":t=this._updateClassBreaksRenderer(e);break;case"rasterShadedRelief":t=this._updateShadedReliefRenderer(e);break;case"vectorField":t=this._updateVectorFieldRenderer();break;case"flowRenderer":t=this._updateFlowRenderer()}return t}symbolize(e){let t=e&&e.pixelBlock;if(!O(t))return t;if(e.simpleStretchParams&&"rasterStretch"===this.rendererJSON.type)return this.simpleStretch(t,e.simpleStretchParams);try{let r;switch(t.pixels.length>3&&(t=p(t,[0,1,2])),this.rendererJSON.type){case"uniqueValue":case"rasterColormap":r=this._symbolizeColormap(t);break;case"classBreaks":r=this._symbolizeClassBreaks(t);break;case"rasterStretch":r=this._symbolizeStretch(t,e.bandIds);break;case"rasterShadedRelief":{const{extent:s}=e,a=s.spatialReference.isGeographic,o={x:(s.xmax-s.xmin)/t.width,y:(s.ymax-s.ymin)/t.height};r=this._symbolizeShadedRelief(t,{isGCS:a,resolution:o});break}}return r}catch(r){return s.getLogger(this.declaredClass).error("symbolize",r.message),t}}simpleStretch(e,t){if(!O(e))return e;try{return e.pixels.length>3&&(e=p(e,[0,1,2])),b(e,t)}catch(r){return s.getLogger(this.declaredClass).error("symbolize",r.message),e}}generateWebGLParameters(e){if(["uniqueValue","rasterColormap","classBreaks"].includes(this.rendererJSON.type)){const{indexedColormap:e,offset:t}=this.lookup?.colormapLut||{};return{colormap:e,colormapOffset:t,type:"lut"}}const{pixelBlock:t,isGCS:r,resolution:s,bandIds:a}=e,{rendererJSON:o}=this;return"rasterStretch"===o.type?this._generateStretchWebGLParams(t,o,a):"rasterShadedRelief"===o.type?this._generateShadedReliefWebGLParams(o,r,s):"vectorField"===o.type?this._generateVectorFieldWebGLParams(o):null}_isLUTChanged(e){if(!this.lookup||!this.lookup.rendererJSON)return!0;if("colorRamp"in this.rendererJSON){const t=this.rendererJSON.colorRamp;return e?JSON.stringify(t)!==JSON.stringify(this.lookup.rendererJSON.colorRamp):(this.rendererJSON,this.lookup.rendererJSON,JSON.stringify(this.rendererJSON)!==JSON.stringify(this.lookup.rendererJSON))}return JSON.stringify(this.rendererJSON)!==JSON.stringify(this.lookup.rendererJSON)}_symbolizeColormap(e){if(this._isLUTChanged()){if(!this.bind().success)return e}return d(e,this.lookup.colormapLut)}_symbolizeClassBreaks(e){const{canUseIndexedLUT:t}=this._analyzeClassBreaks(this.rendererJSON);if(this._isLUTChanged()){if(!this.bind().success)return e}return t?d(e,this.lookup.colormapLut):h(e,this.lookup.remapLut)}_symbolizeStretch(e,t){const{rasterInfo:r}=this,{pixelType:s,bandCount:o}=r,n=this.rendererJSON,i=["u8","u16","s8","s16"].includes(s);let l,u;const{dra:c}=n,{gamma:p}=this.lookup;if("histogramEqualization"===n.stretchType){const s=c?null:this.lookup.histogramLut,a=y(n,{rasterInfo:r,pixelBlock:e,bandIds:t,returnHistogramLut:!s}),o=b(e,{...a,gamma:p});u=m(o,{lut:c?a.histogramLut:s,offset:0})}else if(i){if(c){const a=y(n,{rasterInfo:r,pixelBlock:e,bandIds:t});l=g({pixelType:s,...a,gamma:p})}else if(this._isLUTChanged()){if(!this.bind().success)return e;l=this.lookup?this.lookup.stretchLut:null}else l=this.lookup?this.lookup.stretchLut:null;if(!l)return e;o>1&&t?.length===a(e)?.pixels.length&&l?.lut.length===o&&(l={lut:t.map((e=>l.lut[e])),offset:l.offset}),u=m(e,l)}else{const s=y(n,{rasterInfo:r,pixelBlock:e,bandIds:t});u=b(e,{...s,gamma:p})}if(n.colorRamp){if(this._isLUTChanged(!0)){if(!this.bind().success)return e}u=d(u,this.lookup.colormapLut)}return u}_symbolizeShadedRelief(e,t){const r=this.rendererJSON,s={...r,...t},o=x(e,s);if(!r.colorRamp)return o;let n;if(this._isLUTChanged(!0)){if(!this.bind().success)return o;n=this.lookup?this.lookup.hsvMap:null}else n=this.lookup?this.lookup.hsvMap:null;if(!n)return o;const i=a(this.rasterInfo.statistics)?.[0]??{min:0,max:8e3};return I(o,e,n,i),o}_isVectorFieldData(){const{bandCount:e,dataType:t}=this.rasterInfo;return 2===e&&("vector-magdir"===t||"vector-uv"===t)}_updateVectorFieldRenderer(){return this._isVectorFieldData()?{success:!0}:{success:!1,error:`Unsupported data type "${this.rasterInfo.dataType}"; VectorFieldRenderer only supports "vector-magdir" and "vector-uv".`}}_updateFlowRenderer(){return this._isVectorFieldData()?{success:!0}:{success:!1,error:`Unsupported data type "${this.rasterInfo.dataType}"; FlowRenderer only supports "vector-magdir" and "vector-uv".`}}_updateUVRenderer(e){const{bandCount:t,attributeTable:r,pixelType:s}=this.rasterInfo,a=e.field1;if(!a)return{success:!1,error:"Unsupported renderer; missing UniqueValueRenderer.field."};const n=e.defaultSymbol,i=1===t&&["u8","s8"].includes(s);if(!L(this.rasterInfo,a)&&!i)return{success:!1,error:"Unsupported data; UniqueValueRenderer is only supported on single band data with a valid raster attribute table."};const l=[];if(o(r)){const t=r.fields.find((e=>"value"===e.name.toLowerCase()));if(!t)return{success:!1,error:"Unsupported data; the data's raster attribute table does not have a value field."};r.features.forEach((r=>{const s=e.uniqueValueInfos.find((e=>String(e.value)===String(r.attributes[a])))?.symbol?.color;s?l.push([r.attributes[t.name]].concat(s)):n&&l.push([r.attributes[t.name]].concat(n.color))}))}else{if("value"!==a.toLowerCase())return{success:!1,error:'Unsupported renderer; UniqueValueRenderer.field must be "Value" when raster attribute table is not availalbe.'};e.uniqueValueInfos.forEach((e=>{const t=e?.symbol?.color;t?l.push([parseInt(""+e.value,10)].concat(t)):n&&l.push([parseInt(""+e.value,10)].concat(n.color))}))}if(0===l.length)return{success:!1,error:"Invalid UniqueValueRenderer. Cannot find matching records in the raster attribute table."};const u=f({colormap:l});return this.lookup={rendererJSON:e,colormapLut:u},this.canRenderInWebGL=!0,{success:!0}}_updateColormapRenderer(e){if(!V(this.rasterInfo))return{success:!1,error:"Unsupported data; the data source does not have a colormap."};const t=e.colormapInfos.map((e=>[e.value].concat(e.color))).sort(((e,t)=>e[0]-t[0]));if(!t||0===t.length)return{success:!1,error:"Unsupported renderer; ColormapRenderer must have meaningful colormapInfos."};const r=f({colormap:t});return this.lookup={rendererJSON:e,colormapLut:r},this.canRenderInWebGL=!0,{success:!0}}_updateShadedReliefRenderer(e){if(!_(this.rasterInfo))return{success:!1,error:`Unsupported data type "${this.rasterInfo.dataType}"; ShadedReliefRenderer only supports "elevation", or single band float/s16 data.`};if(e.colorRamp){const r=C(e.colorRamp,256,!0),s=f({colormap:r}),a=[],o=s.indexedColormap;for(let e=0;e<o.length;e+=4){const r=t({r:o[e],g:o[e+1],b:o[e+2]});a.push([r.h/60,r.s/100,255*r.v/100])}this.lookup={rendererJSON:e,colormapLut:s,hsvMap:a}}else this.lookup=null;return this.canRenderInWebGL=!0,{success:!0}}_analyzeClassBreaks(e){const{attributeTable:t,pixelType:r}=this.rasterInfo,s=o(t)?t.fields.find((e=>"value"===e.name.toLowerCase())):null,a=o(t)?t.fields.find((t=>t.name.toLowerCase()===e.field.toLowerCase())):null,n=null!=s&&null!==a;return{canUseIndexedLUT:["u8","u16","s8","s16"].includes(r)||n,tableValueField:s,tableBreakField:a}}_updateClassBreaksRenderer(e){const{attributeTable:t}=this.rasterInfo,{canUseIndexedLUT:r,tableValueField:s,tableBreakField:a}=this._analyzeClassBreaks(e),n=e.classBreakInfos;if(!n?.length)return{success:!1,error:"Unsupported renderer; missing or invalid ClassBreaksRenderer.classBreakInfos."};const i=n.sort(((e,t)=>e.classMaxValue-t.classMaxValue)),l=i[i.length-1];let u=e.minValue;if(!r){const t=[];for(let e=0;e<i.length;e++)t.push({value:i[e].classMinValue??u,mappedColor:i[e].symbol.color}),u=i[e].classMaxValue;return t.push({value:l.classMaxValue,mappedColor:l.symbol.color}),this.lookup={rendererJSON:e,remapLut:t},this.canRenderInWebGL=!1,{success:!0}}const c=[];if(o(t)&&null!=s&&null!==a&&s!==a){const r=s.name,o=a.name,n=i[i.length-1],{classMaxValue:l}=n;u=e.minValue;for(const e of t.features){const t=e.attributes[r],s=e.attributes[o],a=s===l?n:s<u?null:i.find((({classMaxValue:e})=>e>s));a&&c.push([t].concat(a.symbol.color))}}else{u=Math.floor(e.minValue);for(let e=0;e<i.length;e++){const t=i[e];for(let e=u;e<t.classMaxValue;e++)c.push([e].concat(t.symbol.color));u=Math.ceil(t.classMaxValue)}l.classMaxValue===u&&c.push([l.classMaxValue].concat(l.symbol.color))}const p=f({colormap:c,fillUnspecified:!1});return this.lookup={rendererJSON:e,colormapLut:p},this.canRenderInWebGL=!0,{success:!0}}_isHistogramRequired(e){return"percentClip"===e||"histogramEqualization"===e}_isValidRasterStatistics(e){return o(e)&&e.length>0&&null!=e[0].min&&null!=e[0].max}_updateStretchRenderer(e){let{stretchType:t,dra:r}=e;if(!("none"===t||e.statistics?.length||this._isValidRasterStatistics(this.rasterInfo.statistics)||r))return{success:!1,error:"Unsupported renderer; StretchRenderer.statistics is required when dynamic range adjustment is not used."};const s=a(e.histograms||this.rasterInfo.histograms);!this._isHistogramRequired(e.stretchType)||s?.length||r||(t="minMax");const{computeGamma:o,useGamma:n,colorRamp:i}=e;let{gamma:l}=e;if(n&&o&&!l?.length){const t=e.statistics?.length?e.statistics:a(this.rasterInfo.statistics);l=S(this.rasterInfo.pixelType,t)}const u=this.rasterInfo.pixelType,c=!r&&["u8","u16","s8","s16"].includes(u);if("histogramEqualization"===t){const t=s.map((e=>k(e)));this.lookup={rendererJSON:e,histogramLut:t}}else if(c){const t=y(e,{rasterInfo:this.rasterInfo}),r=g({pixelType:u,...t,gamma:n?l:null});this.lookup={rendererJSON:e,stretchLut:r}}if(i){const t=C(i,256,!0);this.lookup||(this.lookup={rendererJSON:e}),this.lookup.colormapLut=f({colormap:t}),this.lookup.rendererJSON=e}return this.lookup.gamma=n&&l?.length?l:null,this.canRenderInWebGL=!0,{success:!0}}_generateStretchWebGLParams(e,t,r){let s=null,a=null;const n=this.lookup&&this.lookup.colormapLut;t.colorRamp&&n&&(s=n.indexedColormap,a=n.offset),"histogramEqualization"===t.stretchType&&(t={...t,stretchType:"minMax"});const{gamma:i}=this.lookup,l=!!(t.useGamma&&i&&i.some((e=>1!==e))),{minCutOff:u,maxCutOff:c,outMin:p,outMax:d}=y(t,{rasterInfo:this.rasterInfo,pixelBlock:e,bandIds:r});let h=0;o(e)&&(h=e.getPlaneCount(),2===h&&((e=e.clone()).statistics=[e.statistics[0]],e.pixels=[e.pixels[0]]));const m=Math.min(3,r?.length||h||this.rasterInfo.bandCount),f=new Float32Array(m),b=s||l?1:255;let g;for(g=0;g<m;g++)f[g]=(d-p)/(c[g]-u[g])/b;const S=new Float32Array(m);if(l)for(g=0;g<m;g++)i[g]>1?i[g]>2?S[g]=6.5+(i[g]-2)**2.5:S[g]=6.5+100*(2-i[g])**4:S[g]=1;return{bandCount:m,outMin:p/b,outMax:d/b,minCutOff:u,maxCutOff:c,factor:f,useGamma:l,gamma:l?i:[1,1,1],gammaCorrection:l?S:[1,1,1],colormap:s,colormapOffset:a,stretchType:t.stretchType,type:"stretch"}}_generateShadedReliefWebGLParams(e,t,r){let s=null,o=null;const n=this.lookup&&this.lookup.colormapLut;e.colorRamp&&n&&(s=n.indexedColormap,o=n.offset);const i={...e,isGCS:t,resolution:r},l=R(i),u=a(this.rasterInfo.statistics)?.[0];return{...l,minValue:u?.min??0,maxValue:u?.max??8e3,hillshadeType:"traditional"===e.hillshadeType?0:1,type:"hillshade",colormap:s,colormapOffset:o}}_generateVectorFieldWebGLParams(e){const{style:t,inputUnit:r,outputUnit:s,visualVariables:a,symbolTileSize:n,flowRepresentation:i}=e;let l;const u=this.rasterInfo.statistics?.[0].min??0,c=this.rasterInfo.statistics?.[0].max??50,p=a?.find((e=>"sizeInfo"===e.type))??{type:"sizeInfo",field:"Magnitude",maxDataValue:c,maxSize:.8*n,minDataValue:u,minSize:.2*n},d=p.minDataValue??u,h=p.maxDataValue??c,m=o(p.maxSize)&&o(p.minSize)?[p.minSize/n,p.maxSize/n]:[.2,.8];if("wind_speed"===t){const e=(m[0]+m[1])/2;m[0]=m[1]=e}const f=o(d)&&o(h)?[d,h]:null;if("classified_arrow"===t)if(o(d)&&o(h)&&o(p)){l=[];const e=(p.maxDataValue-p.minDataValue)/5;for(let t=0;t<6;t++)l.push(p.minDataValue+e*t)}else l=[0,1e-6,3.5,7,10.5,14];const b="flow_to"===i===("ocean_current_kn"===t||"ocean_current_m"===t)?0:Math.PI,y=a?.find((e=>"rotationInfo"===e.type));return{breakValues:l,dataRange:f,inputUnit:r,outputUnit:s,symbolTileSize:n,symbolPercentRange:m,style:t||"single_arrow",rotation:b,rotationType:this.rasterInfo.storageInfo?.tileInfo&&"vector-uv"===this.rasterInfo.dataType?"geographic":y?.rotationType||e.rotationType,type:"vectorField"}}};function O(e){return c(e)&&0!==e.validPixelCount}e([i({json:{write:!0}})],v.prototype,"rendererJSON",void 0),e([i({type:u,json:{write:!0}})],v.prototype,"rasterInfo",void 0),e([i({json:{write:!0}})],v.prototype,"lookup",void 0),e([i()],v.prototype,"canRenderInWebGL",void 0),v=e([l("esri.renderers.support.RasterSymbolizer")],v);const T=v;export{T as default};
5
+ import{_ as e}from"../../chunks/tslib.es6.js";import{toHSV as t}from"../../core/colorUtils.js";import{JSONSupport as r}from"../../core/JSONSupport.js";import s from"../../core/Logger.js";import{unwrap as a,isSome as o,isNone as n}from"../../core/maybe.js";import{property as i}from"../../core/accessorSupport/decorators/property.js";import"../../core/arrayUtils.js";import"../../core/has.js";import"../../core/accessorSupport/ensureType.js";import{subclass as l}from"../../core/accessorSupport/decorators/subclass.js";import u from"../../layers/support/RasterInfo.js";import{extractBands as c,colorize as p,remapColor as d,lookupPixels as h,createColormapLUT as m,isValidPixelBlock as f}from"../../layers/support/rasterFunctions/pixelUtils.js";import{stretch as b,getStretchCutoff as y,createStretchLUT as g,computeGammaValues as S,createHistogramEqualizationLUT as k}from"../../layers/support/rasterFunctions/stretchUtils.js";import{hillshade as x,tintHillshade as I,calculateHillshadeParams as R}from"../../layers/support/rasterFunctions/surfaceUtils.js";import{convertColorRampToColormap as C}from"./colorRampUtils.js";function L(e,t){const{attributeTable:r,bandCount:s}=e;if(n(r)||s>1)return!1;if(t){if(null==r.fields.find((e=>e.name.toLowerCase()===t.toLowerCase())))return!1}return!0}function _(e){const{bandCount:t,dataType:r,pixelType:s}=e;return"elevation"===r||"generic"===r&&1===t&&("s16"===s||"f32"===s||"f64"===s)}function V(e){const{bandCount:t,colormap:r}=e;return o(r)&&r.length&&1===t}let v=class extends r{constructor(e){super(e)}bind(){const{rendererJSON:e}=this;if(!e)return{success:!1};let t;switch(this.lookup={rendererJSON:{}},e.type){case"uniqueValue":t=this._updateUVRenderer(e);break;case"rasterColormap":t=this._updateColormapRenderer(e);break;case"rasterStretch":t=this._updateStretchRenderer(e);break;case"classBreaks":t=this._updateClassBreaksRenderer(e);break;case"rasterShadedRelief":t=this._updateShadedReliefRenderer(e);break;case"vectorField":t=this._updateVectorFieldRenderer();break;case"flowRenderer":t=this._updateFlowRenderer()}return t}symbolize(e){let t=e&&e.pixelBlock;if(!O(t))return t;if(e.simpleStretchParams&&"rasterStretch"===this.rendererJSON.type)return this.simpleStretch(t,e.simpleStretchParams);try{let r;switch(t.pixels.length>3&&(t=c(t,[0,1,2])),this.rendererJSON.type){case"uniqueValue":case"rasterColormap":r=this._symbolizeColormap(t);break;case"classBreaks":r=this._symbolizeClassBreaks(t);break;case"rasterStretch":r=this._symbolizeStretch(t,e.bandIds);break;case"rasterShadedRelief":{const{extent:s}=e,a=s.spatialReference.isGeographic,o={x:(s.xmax-s.xmin)/t.width,y:(s.ymax-s.ymin)/t.height};r=this._symbolizeShadedRelief(t,{isGCS:a,resolution:o});break}}return r}catch(r){return s.getLogger(this.declaredClass).error("symbolize",r.message),t}}simpleStretch(e,t){if(!O(e))return e;try{return e.pixels.length>3&&(e=c(e,[0,1,2])),b(e,t)}catch(r){return s.getLogger(this.declaredClass).error("symbolize",r.message),e}}generateWebGLParameters(e){if(["uniqueValue","rasterColormap","classBreaks"].includes(this.rendererJSON.type)){const{indexedColormap:e,offset:t}=this.lookup?.colormapLut||{};return{colormap:e,colormapOffset:t,type:"lut"}}const{pixelBlock:t,isGCS:r,resolution:s,bandIds:a}=e,{rendererJSON:o}=this;return"rasterStretch"===o.type?this._generateStretchWebGLParams(t,o,a):"rasterShadedRelief"===o.type?this._generateShadedReliefWebGLParams(o,r,s):"vectorField"===o.type?this._generateVectorFieldWebGLParams(o):null}_isLUTChanged(e){if(!this.lookup||!this.lookup.rendererJSON)return!0;if("colorRamp"in this.rendererJSON){const t=this.rendererJSON.colorRamp;return e?JSON.stringify(t)!==JSON.stringify(this.lookup.rendererJSON.colorRamp):(this.rendererJSON,this.lookup.rendererJSON,JSON.stringify(this.rendererJSON)!==JSON.stringify(this.lookup.rendererJSON))}return JSON.stringify(this.rendererJSON)!==JSON.stringify(this.lookup.rendererJSON)}_symbolizeColormap(e){if(this._isLUTChanged()){if(!this.bind().success)return e}return p(e,this.lookup.colormapLut)}_symbolizeClassBreaks(e){const{canUseIndexedLUT:t}=this._analyzeClassBreaks(this.rendererJSON);if(this._isLUTChanged()){if(!this.bind().success)return e}return t?p(e,this.lookup.colormapLut):d(e,this.lookup.remapLut)}_symbolizeStretch(e,t){const{rasterInfo:r}=this,{pixelType:s,bandCount:o}=r,n=this.rendererJSON,i=["u8","u16","s8","s16"].includes(s);let l,u;const{dra:c}=n,{gamma:d}=this.lookup;if("histogramEqualization"===n.stretchType){const s=c?null:this.lookup.histogramLut,a=y(n,{rasterInfo:r,pixelBlock:e,bandIds:t,returnHistogramLut:!s}),o=b(e,{...a,gamma:d});u=h(o,{lut:c?a.histogramLut:s,offset:0})}else if(i){if(c){const a=y(n,{rasterInfo:r,pixelBlock:e,bandIds:t});l=g({pixelType:s,...a,gamma:d})}else if(this._isLUTChanged()){if(!this.bind().success)return e;l=this.lookup?this.lookup.stretchLut:null}else l=this.lookup?this.lookup.stretchLut:null;if(!l)return e;o>1&&t?.length===a(e)?.pixels.length&&l?.lut.length===o&&(l={lut:t.map((e=>l.lut[e])),offset:l.offset}),u=h(e,l)}else{const s=y(n,{rasterInfo:r,pixelBlock:e,bandIds:t});u=b(e,{...s,gamma:d})}if(n.colorRamp){if(this._isLUTChanged(!0)){if(!this.bind().success)return e}u=p(u,this.lookup.colormapLut)}return u}_symbolizeShadedRelief(e,t){const r=this.rendererJSON,s={...r,...t},o=x(e,s);if(!r.colorRamp)return o;let n;if(this._isLUTChanged(!0)){if(!this.bind().success)return o;n=this.lookup?this.lookup.hsvMap:null}else n=this.lookup?this.lookup.hsvMap:null;if(!n)return o;const i=a(this.rasterInfo.statistics)?.[0]??{min:0,max:8e3};return I(o,e,n,i),o}_isVectorFieldData(){const{bandCount:e,dataType:t}=this.rasterInfo;return 2===e&&("vector-magdir"===t||"vector-uv"===t)}_updateVectorFieldRenderer(){return this._isVectorFieldData()?{success:!0}:{success:!1,error:`Unsupported data type "${this.rasterInfo.dataType}"; VectorFieldRenderer only supports "vector-magdir" and "vector-uv".`}}_updateFlowRenderer(){return this._isVectorFieldData()?{success:!0}:{success:!1,error:`Unsupported data type "${this.rasterInfo.dataType}"; FlowRenderer only supports "vector-magdir" and "vector-uv".`}}_updateUVRenderer(e){const{bandCount:t,attributeTable:r,pixelType:s}=this.rasterInfo,a=e.field1;if(!a)return{success:!1,error:"Unsupported renderer; missing UniqueValueRenderer.field."};const n=e.defaultSymbol,i=1===t&&["u8","s8"].includes(s);if(!L(this.rasterInfo,a)&&!i)return{success:!1,error:"Unsupported data; UniqueValueRenderer is only supported on single band data with a valid raster attribute table."};const l=[];if(o(r)){const t=r.fields.find((e=>"value"===e.name.toLowerCase()));if(!t)return{success:!1,error:"Unsupported data; the data's raster attribute table does not have a value field."};r.features.forEach((r=>{const s=e.uniqueValueInfos.find((e=>String(e.value)===String(r.attributes[a])))?.symbol?.color;s?l.push([r.attributes[t.name]].concat(s)):n&&l.push([r.attributes[t.name]].concat(n.color))}))}else{if("value"!==a.toLowerCase())return{success:!1,error:'Unsupported renderer; UniqueValueRenderer.field must be "Value" when raster attribute table is not availalbe.'};e.uniqueValueInfos.forEach((e=>{const t=e?.symbol?.color;t?l.push([parseInt(""+e.value,10)].concat(t)):n&&l.push([parseInt(""+e.value,10)].concat(n.color))}))}if(0===l.length)return{success:!1,error:"Invalid UniqueValueRenderer. Cannot find matching records in the raster attribute table."};const u=m({colormap:l});return this.lookup={rendererJSON:e,colormapLut:u},this.canRenderInWebGL=!0,{success:!0}}_updateColormapRenderer(e){if(!V(this.rasterInfo))return{success:!1,error:"Unsupported data; the data source does not have a colormap."};const t=e.colormapInfos.map((e=>[e.value].concat(e.color))).sort(((e,t)=>e[0]-t[0]));if(!t||0===t.length)return{success:!1,error:"Unsupported renderer; ColormapRenderer must have meaningful colormapInfos."};const r=m({colormap:t});return this.lookup={rendererJSON:e,colormapLut:r},this.canRenderInWebGL=!0,{success:!0}}_updateShadedReliefRenderer(e){if(!_(this.rasterInfo))return{success:!1,error:`Unsupported data type "${this.rasterInfo.dataType}"; ShadedReliefRenderer only supports "elevation", or single band float/s16 data.`};if(e.colorRamp){const r=C(e.colorRamp,256,!0),s=m({colormap:r}),a=[],o=s.indexedColormap;for(let e=0;e<o.length;e+=4){const r=t({r:o[e],g:o[e+1],b:o[e+2]});a.push([r.h/60,r.s/100,255*r.v/100])}this.lookup={rendererJSON:e,colormapLut:s,hsvMap:a}}else this.lookup=null;return this.canRenderInWebGL=!0,{success:!0}}_analyzeClassBreaks(e){const{attributeTable:t,pixelType:r}=this.rasterInfo,s=o(t)?t.fields.find((e=>"value"===e.name.toLowerCase())):null,a=o(t)?t.fields.find((t=>t.name.toLowerCase()===e.field.toLowerCase())):null,n=null!=s&&null!==a;return{canUseIndexedLUT:["u8","u16","s8","s16"].includes(r)||n,tableValueField:s,tableBreakField:a}}_updateClassBreaksRenderer(e){const{attributeTable:t}=this.rasterInfo,{canUseIndexedLUT:r,tableValueField:s,tableBreakField:a}=this._analyzeClassBreaks(e),n=e.classBreakInfos;if(!n?.length)return{success:!1,error:"Unsupported renderer; missing or invalid ClassBreaksRenderer.classBreakInfos."};const i=n.sort(((e,t)=>e.classMaxValue-t.classMaxValue)),l=i[i.length-1];let u=e.minValue;if(!r){const t=[];for(let e=0;e<i.length;e++)t.push({value:i[e].classMinValue??u,mappedColor:i[e].symbol.color}),u=i[e].classMaxValue;return t.push({value:l.classMaxValue,mappedColor:l.symbol.color}),this.lookup={rendererJSON:e,remapLut:t},this.canRenderInWebGL=!1,{success:!0}}const c=[];if(o(t)&&null!=s&&null!==a&&s!==a){const r=s.name,o=a.name,n=i[i.length-1],{classMaxValue:l}=n;u=e.minValue;for(const e of t.features){const t=e.attributes[r],s=e.attributes[o],a=s===l?n:s<u?null:i.find((({classMaxValue:e})=>e>s));a&&c.push([t].concat(a.symbol.color))}}else{u=Math.floor(e.minValue);for(let e=0;e<i.length;e++){const t=i[e];for(let e=u;e<t.classMaxValue;e++)c.push([e].concat(t.symbol.color));u=Math.ceil(t.classMaxValue)}l.classMaxValue===u&&c.push([l.classMaxValue].concat(l.symbol.color))}const p=m({colormap:c,fillUnspecified:!1});return this.lookup={rendererJSON:e,colormapLut:p},this.canRenderInWebGL=!0,{success:!0}}_isHistogramRequired(e){return"percentClip"===e||"histogramEqualization"===e}_isValidRasterStatistics(e){return o(e)&&e.length>0&&null!=e[0].min&&null!=e[0].max}_updateStretchRenderer(e){let{stretchType:t,dra:r}=e;if(!("none"===t||e.statistics?.length||this._isValidRasterStatistics(this.rasterInfo.statistics)||r))return{success:!1,error:"Unsupported renderer; StretchRenderer.statistics is required when dynamic range adjustment is not used."};const s=a(e.histograms||this.rasterInfo.histograms);!this._isHistogramRequired(e.stretchType)||s?.length||r||(t="minMax");const{computeGamma:o,useGamma:n,colorRamp:i}=e;let{gamma:l}=e;if(n&&o&&!l?.length){const t=e.statistics?.length?e.statistics:a(this.rasterInfo.statistics);l=S(this.rasterInfo.pixelType,t)}const u=this.rasterInfo.pixelType,c=!r&&["u8","u16","s8","s16"].includes(u);if("histogramEqualization"===t){const t=s.map((e=>k(e)));this.lookup={rendererJSON:e,histogramLut:t}}else if(c){const t=y(e,{rasterInfo:this.rasterInfo}),r=g({pixelType:u,...t,gamma:n?l:null});this.lookup={rendererJSON:e,stretchLut:r}}if(i){const t=C(i,256,!0);this.lookup||(this.lookup={rendererJSON:e}),this.lookup.colormapLut=m({colormap:t}),this.lookup.rendererJSON=e}return this.lookup.gamma=n&&l?.length?l:null,this.canRenderInWebGL=!0,{success:!0}}_generateStretchWebGLParams(e,t,r){let s=null,a=null;const n=this.lookup&&this.lookup.colormapLut;t.colorRamp&&n&&(s=n.indexedColormap,a=n.offset),"histogramEqualization"===t.stretchType&&(t={...t,stretchType:"minMax"});const{gamma:i}=this.lookup,l=!!(t.useGamma&&i&&i.some((e=>1!==e))),{minCutOff:u,maxCutOff:c,outMin:p,outMax:d}=y(t,{rasterInfo:this.rasterInfo,pixelBlock:e,bandIds:r});let h=0;o(e)&&(h=e.getPlaneCount(),2===h&&((e=e.clone()).statistics=[e.statistics[0]],e.pixels=[e.pixels[0]]));const m=Math.min(3,r?.length||h||this.rasterInfo.bandCount),f=new Float32Array(m),b=s||l?1:255;let g;for(g=0;g<m;g++)f[g]=(d-p)/(c[g]-u[g])/b;const S=new Float32Array(m);if(l)for(g=0;g<m;g++)i[g]>1?i[g]>2?S[g]=6.5+(i[g]-2)**2.5:S[g]=6.5+100*(2-i[g])**4:S[g]=1;return{bandCount:m,outMin:p/b,outMax:d/b,minCutOff:u,maxCutOff:c,factor:f,useGamma:l,gamma:l?i:[1,1,1],gammaCorrection:l?S:[1,1,1],colormap:s,colormapOffset:a,stretchType:t.stretchType,type:"stretch"}}_generateShadedReliefWebGLParams(e,t,r){let s=null,o=null;const n=this.lookup&&this.lookup.colormapLut;e.colorRamp&&n&&(s=n.indexedColormap,o=n.offset);const i={...e,isGCS:t,resolution:r},l=R(i),u=a(this.rasterInfo.statistics)?.[0];return{...l,minValue:u?.min??0,maxValue:u?.max??8e3,hillshadeType:"traditional"===e.hillshadeType?0:1,type:"hillshade",colormap:s,colormapOffset:o}}_generateVectorFieldWebGLParams(e){const{style:t,inputUnit:r,outputUnit:s,visualVariables:a,symbolTileSize:n,flowRepresentation:i}=e;let l;const u=this.rasterInfo.statistics?.[0].min??0,c=this.rasterInfo.statistics?.[0].max??50,p=a?.find((e=>"sizeInfo"===e.type))??{type:"sizeInfo",field:"Magnitude",maxDataValue:c,maxSize:.8*n,minDataValue:u,minSize:.2*n},d=p.minDataValue??u,h=p.maxDataValue??c,m=o(p.maxSize)&&o(p.minSize)?[p.minSize/n,p.maxSize/n]:[.2,.8];if("wind_speed"===t){const e=(m[0]+m[1])/2;m[0]=m[1]=e}const f=o(d)&&o(h)?[d,h]:null;if("classified_arrow"===t)if(o(d)&&o(h)&&o(p)){l=[];const e=(p.maxDataValue-p.minDataValue)/5;for(let t=0;t<6;t++)l.push(p.minDataValue+e*t)}else l=[0,1e-6,3.5,7,10.5,14];const b="flow_to"===i===("ocean_current_kn"===t||"ocean_current_m"===t)?0:Math.PI,y=a?.find((e=>"rotationInfo"===e.type));return{breakValues:l,dataRange:f,inputUnit:r,outputUnit:s,symbolTileSize:n,symbolPercentRange:m,style:t||"single_arrow",rotation:b,rotationType:this.rasterInfo.storageInfo?.tileInfo&&"vector-uv"===this.rasterInfo.dataType?"geographic":y?.rotationType||e.rotationType,type:"vectorField"}}};function O(e){return f(e)&&0!==e.validPixelCount}e([i({json:{write:!0}})],v.prototype,"rendererJSON",void 0),e([i({type:u,json:{write:!0}})],v.prototype,"rasterInfo",void 0),e([i({json:{write:!0}})],v.prototype,"lookup",void 0),e([i()],v.prototype,"canRenderInWebGL",void 0),v=e([l("esri.renderers.support.RasterSymbolizer")],v);const T=v;export{T as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.25/esri/copyright.txt for details.
4
4
  */
5
- import e from"../../../request.js";import{isSome as t}from"../../../core/maybe.js";import{join as r,urlToObject as n}from"../../../core/urlUtils.js";import{getJsonType as i}from"../../../geometry/support/jsonUtils.js";import{normalizeCentralMeridian as o}from"../../../geometry/support/normalizeUtils.js";import{mapParameters as a}from"../../operations/urlUtils.js";import{parsePBFFeatureQuery as s}from"./pbfQueryUtils.js";import{applyFeatureSetZUnitScaling as u}from"./queryZScale.js";const l="Layer does not support extent calculation.";function m(e,t){if(t&&"extent"===e.type)return`${e.xmin},${e.ymin},${e.xmax},${e.ymax}`;if(t&&"point"===e.type)return`${e.x},${e.y}`;const r=e.toJSON();return delete r.spatialReference,JSON.stringify(r)}function y(e,r){const n=e.geometry,o=e.toJSON();delete o.compactGeometryEnabled,delete o.defaultSpatialReferenceEnabled;const a=o;let s,u,l;if(t(n)&&(u=n.spatialReference,l=n.spatialReference.wkid||JSON.stringify(n.spatialReference),a.geometryType=i(n),a.geometry=m(n,e.compactGeometryEnabled),a.inSR=l),o.groupByFieldsForStatistics&&(a.groupByFieldsForStatistics=o.groupByFieldsForStatistics.join(",")),o.objectIds&&(a.objectIds=o.objectIds.join(",")),o.orderByFields&&(a.orderByFields=o.orderByFields.join(",")),!o.outFields||!o.returnDistinctValues&&(r?.returnCountOnly||r?.returnExtentOnly||r?.returnIdsOnly)?delete a.outFields:o.outFields.includes("*")?a.outFields="*":a.outFields=o.outFields.join(","),o.outSR?(a.outSR=o.outSR.wkid||JSON.stringify(o.outSR),s=e.outSpatialReference):n&&(o.returnGeometry||o.returnCentroid)&&(a.outSR=a.inSR,s=u),o.returnGeometry&&delete o.returnGeometry,o.outStatistics&&(a.outStatistics=JSON.stringify(o.outStatistics)),o.pixelSize&&(a.pixelSize=JSON.stringify(o.pixelSize)),o.quantizationParameters&&(e.defaultSpatialReferenceEnabled&&t(u)&&t(e.quantizationParameters)&&t(e.quantizationParameters.extent)&&u.equals(e.quantizationParameters.extent.spatialReference)&&delete o.quantizationParameters.extent.spatialReference,a.quantizationParameters=JSON.stringify(o.quantizationParameters)),o.parameterValues&&(a.parameterValues=JSON.stringify(o.parameterValues)),o.rangeValues&&(a.rangeValues=JSON.stringify(o.rangeValues)),o.dynamicDataSource&&(a.layer=JSON.stringify({source:o.dynamicDataSource}),delete o.dynamicDataSource),o.timeExtent){const e=o.timeExtent,{start:t,end:r}=e;null==t&&null==r||(a.time=t===r?t:`${t??"null"},${r??"null"}`),delete o.timeExtent}return e.defaultSpatialReferenceEnabled&&t(u)&&t(s)&&u.equals(s)&&(a.defaultSR=a.inSR,delete a.inSR,delete a.outSR),a}async function c(e,r,n,i){const o=t(r.timeExtent)&&r.timeExtent.isEmpty?{data:{features:[]}}:await E(e,r,"json",i);return u(r,n,o.data),o}async function d(e,r,n,i){if(t(r.timeExtent)&&r.timeExtent.isEmpty)return{data:n.createFeatureResult()};const o=await f(e,r,i),a=o;return a.data=s(o.data,n),a}function f(e,t,r){return E(e,t,"pbf",r)}function p(e,r,n){return t(r.timeExtent)&&r.timeExtent.isEmpty?Promise.resolve({data:{objectIds:[]}}):E(e,r,"json",n,{returnIdsOnly:!0})}function S(e,r,n){return t(r.timeExtent)&&r.timeExtent.isEmpty?Promise.resolve({data:{count:0}}):E(e,r,"json",n,{returnIdsOnly:!0,returnCountOnly:!0})}function x(e,r,n){return t(r.timeExtent)&&r.timeExtent.isEmpty?Promise.resolve({data:{count:0,extent:null}}):E(e,r,"json",n,{returnExtentOnly:!0,returnCountOnly:!0}).then((e=>{const t=e.data;if(t.hasOwnProperty("extent"))return e;if(t.features)throw new Error(l);if(t.hasOwnProperty("count"))throw new Error(l);return e}))}function E(i,s,u,l={},m={}){const c="string"==typeof i?n(i):i,d=s.geometry?[s.geometry]:[];return l.responseType="pbf"===u?"array-buffer":"json",o(d,null,l).then((n=>{const i=n&&n[0];t(i)&&((s=s.clone()).geometry=i);const o=a({...c.query,f:u,...m,...y(s,m)});return e(r(c.path,"query"),{...l,query:{...o,...l.query}})}))}export{m as encodeGeometry,c as executeQuery,S as executeQueryForCount,x as executeQueryForExtent,p as executeQueryForIds,d as executeQueryPBF,f as executeQueryPBFBuffer,y as queryToQueryStringParameters,E as runQuery};
5
+ import e from"../../../request.js";import{isSome as t}from"../../../core/maybe.js";import{urlToObject as r,join as n}from"../../../core/urlUtils.js";import{getJsonType as i}from"../../../geometry/support/jsonUtils.js";import{normalizeCentralMeridian as o}from"../../../geometry/support/normalizeUtils.js";import{mapParameters as a}from"../../operations/urlUtils.js";import{parsePBFFeatureQuery as s}from"./pbfQueryUtils.js";import{applyFeatureSetZUnitScaling as u}from"./queryZScale.js";const l="Layer does not support extent calculation.";function m(e,t){if(t&&"extent"===e.type)return`${e.xmin},${e.ymin},${e.xmax},${e.ymax}`;if(t&&"point"===e.type)return`${e.x},${e.y}`;const r=e.toJSON();return delete r.spatialReference,JSON.stringify(r)}function y(e,r){const n=e.geometry,o=e.toJSON();delete o.compactGeometryEnabled,delete o.defaultSpatialReferenceEnabled;const a=o;let s,u,l;if(t(n)&&(u=n.spatialReference,l=n.spatialReference.wkid||JSON.stringify(n.spatialReference),a.geometryType=i(n),a.geometry=m(n,e.compactGeometryEnabled),a.inSR=l),o.groupByFieldsForStatistics&&(a.groupByFieldsForStatistics=o.groupByFieldsForStatistics.join(",")),o.objectIds&&(a.objectIds=o.objectIds.join(",")),o.orderByFields&&(a.orderByFields=o.orderByFields.join(",")),!o.outFields||!o.returnDistinctValues&&(r?.returnCountOnly||r?.returnExtentOnly||r?.returnIdsOnly)?delete a.outFields:o.outFields.includes("*")?a.outFields="*":a.outFields=o.outFields.join(","),o.outSR?(a.outSR=o.outSR.wkid||JSON.stringify(o.outSR),s=e.outSpatialReference):n&&(o.returnGeometry||o.returnCentroid)&&(a.outSR=a.inSR,s=u),o.returnGeometry&&delete o.returnGeometry,o.outStatistics&&(a.outStatistics=JSON.stringify(o.outStatistics)),o.pixelSize&&(a.pixelSize=JSON.stringify(o.pixelSize)),o.quantizationParameters&&(e.defaultSpatialReferenceEnabled&&t(u)&&t(e.quantizationParameters)&&t(e.quantizationParameters.extent)&&u.equals(e.quantizationParameters.extent.spatialReference)&&delete o.quantizationParameters.extent.spatialReference,a.quantizationParameters=JSON.stringify(o.quantizationParameters)),o.parameterValues&&(a.parameterValues=JSON.stringify(o.parameterValues)),o.rangeValues&&(a.rangeValues=JSON.stringify(o.rangeValues)),o.dynamicDataSource&&(a.layer=JSON.stringify({source:o.dynamicDataSource}),delete o.dynamicDataSource),o.timeExtent){const e=o.timeExtent,{start:t,end:r}=e;null==t&&null==r||(a.time=t===r?t:`${t??"null"},${r??"null"}`),delete o.timeExtent}return e.defaultSpatialReferenceEnabled&&t(u)&&t(s)&&u.equals(s)&&(a.defaultSR=a.inSR,delete a.inSR,delete a.outSR),a}async function c(e,r,n,i){const o=t(r.timeExtent)&&r.timeExtent.isEmpty?{data:{features:[]}}:await E(e,r,"json",i);return u(r,n,o.data),o}async function d(e,r,n,i){if(t(r.timeExtent)&&r.timeExtent.isEmpty)return{data:n.createFeatureResult()};const o=await f(e,r,i),a=o;return a.data=s(o.data,n),a}function f(e,t,r){return E(e,t,"pbf",r)}function p(e,r,n){return t(r.timeExtent)&&r.timeExtent.isEmpty?Promise.resolve({data:{objectIds:[]}}):E(e,r,"json",n,{returnIdsOnly:!0})}function S(e,r,n){return t(r.timeExtent)&&r.timeExtent.isEmpty?Promise.resolve({data:{count:0}}):E(e,r,"json",n,{returnIdsOnly:!0,returnCountOnly:!0})}function x(e,r,n){return t(r.timeExtent)&&r.timeExtent.isEmpty?Promise.resolve({data:{count:0,extent:null}}):E(e,r,"json",n,{returnExtentOnly:!0,returnCountOnly:!0}).then((e=>{const t=e.data;if(t.hasOwnProperty("extent"))return e;if(t.features)throw new Error(l);if(t.hasOwnProperty("count"))throw new Error(l);return e}))}function E(i,s,u,l={},m={}){const c="string"==typeof i?r(i):i,d=s.geometry?[s.geometry]:[];return l.responseType="pbf"===u?"array-buffer":"json",o(d,null,l).then((r=>{const i=r&&r[0];t(i)&&((s=s.clone()).geometry=i);const o=a({...c.query,f:u,...m,...y(s,m)});return e(n(c.path,"query"),{...l,query:{...o,...l.query}})}))}export{m as encodeGeometry,c as executeQuery,S as executeQueryForCount,x as executeQueryForExtent,p as executeQueryForIds,d as executeQueryPBF,f as executeQueryPBFBuffer,y as queryToQueryStringParameters,E as runQuery};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.25/esri/copyright.txt for details.
4
4
  */
5
- import t from"../../../request.js";import{isSome as e}from"../../../core/maybe.js";import{join as r,urlToObject as o}from"../../../core/urlUtils.js";import{getJsonType as n}from"../../../geometry/support/jsonUtils.js";import{normalizeCentralMeridian as i}from"../../../geometry/support/normalizeUtils.js";import{mapParameters as s}from"../../operations/urlUtils.js";import{applyFeatureSetZUnitScaling as u}from"./queryZScale.js";const l="Layer does not support extent calculation.";function y(t,r){const o=t.geometry,i=t.toJSON(),s=i;if(e(o)&&(s.geometry=JSON.stringify(o),s.geometryType=n(o),s.inSR=o.spatialReference.wkid||JSON.stringify(o.spatialReference)),i.topFilter?.groupByFields&&(s.topFilter.groupByFields=i.topFilter.groupByFields.join(",")),i.topFilter?.orderByFields&&(s.topFilter.orderByFields=i.topFilter.orderByFields.join(",")),i.topFilter&&(s.topFilter=JSON.stringify(s.topFilter)),i.objectIds&&(s.objectIds=i.objectIds.join(",")),i.orderByFields&&(s.orderByFields=i.orderByFields.join(",")),i.outFields&&!(r?.returnCountOnly||r?.returnExtentOnly||r?.returnIdsOnly)?i.outFields.includes("*")?s.outFields="*":s.outFields=i.outFields.join(","):delete s.outFields,i.outSR?s.outSR=i.outSR.wkid||JSON.stringify(i.outSR):o&&i.returnGeometry&&(s.outSR=s.inSR),i.returnGeometry&&delete i.returnGeometry,i.timeExtent){const t=i.timeExtent,{start:e,end:r}=t;null==e&&null==r||(s.time=e===r?e:`${e??"null"},${r??"null"}`),delete i.timeExtent}return s}async function d(t,e,r,o){const n=await c(t,e,"json",o);return u(e,r,n.data),n}async function m(t,r,o){return e(r.timeExtent)&&r.timeExtent.isEmpty?{data:{objectIds:[]}}:c(t,r,"json",o,{returnIdsOnly:!0})}async function p(t,r,o){return e(r.timeExtent)&&r.timeExtent.isEmpty?{data:{count:0,extent:null}}:c(t,r,"json",o,{returnExtentOnly:!0,returnCountOnly:!0}).then((t=>{const e=t.data;if(e.hasOwnProperty("extent"))return t;if(e.features)throw new Error(l);if(e.hasOwnProperty("count"))throw new Error(l);return t}))}function a(t,r,o){return e(r.timeExtent)&&r.timeExtent.isEmpty?Promise.resolve({data:{count:0}}):c(t,r,"json",o,{returnIdsOnly:!0,returnCountOnly:!0})}function c(n,u,l,d={},m={}){const p="string"==typeof n?o(n):n,a=u.geometry?[u.geometry]:[];return d.responseType="pbf"===l?"array-buffer":"json",i(a,null,d).then((o=>{const n=o&&o[0];e(n)&&((u=u.clone()).geometry=n);const i=s({...p.query,f:l,...m,...y(u,m)});return t(r(p.path,"queryTopFeatures"),{...d,query:{...i,...d.query}})}))}export{a as executeQueryForTopCount,p as executeQueryForTopExtents,m as executeQueryForTopIds,d as executeTopFeaturesQuery,y as queryToQueryStringParameters};
5
+ import t from"../../../request.js";import{isSome as e}from"../../../core/maybe.js";import{urlToObject as r,join as o}from"../../../core/urlUtils.js";import{getJsonType as n}from"../../../geometry/support/jsonUtils.js";import{normalizeCentralMeridian as i}from"../../../geometry/support/normalizeUtils.js";import{mapParameters as s}from"../../operations/urlUtils.js";import{applyFeatureSetZUnitScaling as u}from"./queryZScale.js";const l="Layer does not support extent calculation.";function y(t,r){const o=t.geometry,i=t.toJSON(),s=i;if(e(o)&&(s.geometry=JSON.stringify(o),s.geometryType=n(o),s.inSR=o.spatialReference.wkid||JSON.stringify(o.spatialReference)),i.topFilter?.groupByFields&&(s.topFilter.groupByFields=i.topFilter.groupByFields.join(",")),i.topFilter?.orderByFields&&(s.topFilter.orderByFields=i.topFilter.orderByFields.join(",")),i.topFilter&&(s.topFilter=JSON.stringify(s.topFilter)),i.objectIds&&(s.objectIds=i.objectIds.join(",")),i.orderByFields&&(s.orderByFields=i.orderByFields.join(",")),i.outFields&&!(r?.returnCountOnly||r?.returnExtentOnly||r?.returnIdsOnly)?i.outFields.includes("*")?s.outFields="*":s.outFields=i.outFields.join(","):delete s.outFields,i.outSR?s.outSR=i.outSR.wkid||JSON.stringify(i.outSR):o&&i.returnGeometry&&(s.outSR=s.inSR),i.returnGeometry&&delete i.returnGeometry,i.timeExtent){const t=i.timeExtent,{start:e,end:r}=t;null==e&&null==r||(s.time=e===r?e:`${e??"null"},${r??"null"}`),delete i.timeExtent}return s}async function d(t,e,r,o){const n=await c(t,e,"json",o);return u(e,r,n.data),n}async function m(t,r,o){return e(r.timeExtent)&&r.timeExtent.isEmpty?{data:{objectIds:[]}}:c(t,r,"json",o,{returnIdsOnly:!0})}async function p(t,r,o){return e(r.timeExtent)&&r.timeExtent.isEmpty?{data:{count:0,extent:null}}:c(t,r,"json",o,{returnExtentOnly:!0,returnCountOnly:!0}).then((t=>{const e=t.data;if(e.hasOwnProperty("extent"))return t;if(e.features)throw new Error(l);if(e.hasOwnProperty("count"))throw new Error(l);return t}))}function a(t,r,o){return e(r.timeExtent)&&r.timeExtent.isEmpty?Promise.resolve({data:{count:0}}):c(t,r,"json",o,{returnIdsOnly:!0,returnCountOnly:!0})}function c(n,u,l,d={},m={}){const p="string"==typeof n?r(n):n,a=u.geometry?[u.geometry]:[];return d.responseType="pbf"===l?"array-buffer":"json",i(a,null,d).then((r=>{const n=r&&r[0];e(n)&&((u=u.clone()).geometry=n);const i=s({...p.query,f:l,...m,...y(u,m)});return t(o(p.path,"queryTopFeatures"),{...d,query:{...i,...d.query}})}))}export{a as executeQueryForTopCount,p as executeQueryForTopExtents,m as executeQueryForTopIds,d as executeTopFeaturesQuery,y as queryToQueryStringParameters};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.25/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../chunks/tslib.es6.js";import"../../geometry.js";import{isSome as t,unwrap as r}from"../../core/maybe.js";import{property as o}from"../../core/accessorSupport/decorators/property.js";import"../../core/arrayUtils.js";import"../../core/has.js";import"../../core/accessorSupport/ensureType.js";import{reader as s}from"../../core/accessorSupport/decorators/reader.js";import{subclass as a}from"../../core/accessorSupport/decorators/subclass.js";import p from"./DirectionsFeature.js";import n from"./FeatureSet.js";import i from"../../geometry/Extent.js";import m from"../../geometry/SpatialReference.js";import l from"../../geometry/Polyline.js";function u(e,t){if(0===e.length)return new l({spatialReference:t});const r=[];for(const p of e)for(const e of p.paths)r.push(...e);const o=[];r.forEach(((e,t)=>{0!==t&&e[0]===r[t-1][0]&&e[1]===r[t-1][1]||o.push(e)}));const{hasM:s,hasZ:a}=e[0];return new l({hasM:s,hasZ:a,paths:[o],spatialReference:t})}let c=class extends n{constructor(e){super(e),this.extent=null,this.features=null,this.geometryType="polyline",this.routeId=null,this.routeName=null,this.totalDriveTime=null,this.totalLength=null,this.totalTime=null}readFeatures(e,r){if(!e)return[];const o=r.summary.envelope.spatialReference??r.spatialReference,s=o&&m.fromJSON(o);return e.map((e=>{const r=p.fromJSON(e);if(t(r.geometry)&&(r.geometry.spatialReference=s),t(r.events))for(const o of r.events)t(o.geometry)&&(o.geometry.spatialReference=s);return r}))}get mergedGeometry(){if(!this.features)return null;return u(this.features.map((({geometry:e})=>r(e))),this.extent.spatialReference)}get strings(){return this.features.map((({strings:e})=>e)).flat().filter(t)}};e([o({type:i,json:{read:{source:"summary.envelope"}}})],c.prototype,"extent",void 0),e([o()],c.prototype,"features",void 0),e([s("features")],c.prototype,"readFeatures",null),e([o()],c.prototype,"geometryType",void 0),e([o({readOnly:!0})],c.prototype,"mergedGeometry",null),e([o()],c.prototype,"routeId",void 0),e([o()],c.prototype,"routeName",void 0),e([o({value:null,readOnly:!0})],c.prototype,"strings",null),e([o({json:{read:{source:"summary.totalDriveTime"}}})],c.prototype,"totalDriveTime",void 0),e([o({json:{read:{source:"summary.totalLength"}}})],c.prototype,"totalLength",void 0),e([o({json:{read:{source:"summary.totalTime"}}})],c.prototype,"totalTime",void 0),c=e([a("esri.rest.support.DirectionsFeatureSet")],c);const f=c;export{f as default};
5
+ import{_ as e}from"../../chunks/tslib.es6.js";import"../../geometry.js";import{isSome as t,unwrap as r}from"../../core/maybe.js";import{property as o}from"../../core/accessorSupport/decorators/property.js";import"../../core/arrayUtils.js";import"../../core/has.js";import"../../core/accessorSupport/ensureType.js";import{reader as s}from"../../core/accessorSupport/decorators/reader.js";import{subclass as a}from"../../core/accessorSupport/decorators/subclass.js";import p from"./DirectionsFeature.js";import n from"./FeatureSet.js";import i from"../../geometry/SpatialReference.js";import m from"../../geometry/Extent.js";import l from"../../geometry/Polyline.js";function u(e,t){if(0===e.length)return new l({spatialReference:t});const r=[];for(const p of e)for(const e of p.paths)r.push(...e);const o=[];r.forEach(((e,t)=>{0!==t&&e[0]===r[t-1][0]&&e[1]===r[t-1][1]||o.push(e)}));const{hasM:s,hasZ:a}=e[0];return new l({hasM:s,hasZ:a,paths:[o],spatialReference:t})}let c=class extends n{constructor(e){super(e),this.extent=null,this.features=null,this.geometryType="polyline",this.routeId=null,this.routeName=null,this.totalDriveTime=null,this.totalLength=null,this.totalTime=null}readFeatures(e,r){if(!e)return[];const o=r.summary.envelope.spatialReference??r.spatialReference,s=o&&i.fromJSON(o);return e.map((e=>{const r=p.fromJSON(e);if(t(r.geometry)&&(r.geometry.spatialReference=s),t(r.events))for(const o of r.events)t(o.geometry)&&(o.geometry.spatialReference=s);return r}))}get mergedGeometry(){if(!this.features)return null;return u(this.features.map((({geometry:e})=>r(e))),this.extent.spatialReference)}get strings(){return this.features.map((({strings:e})=>e)).flat().filter(t)}};e([o({type:m,json:{read:{source:"summary.envelope"}}})],c.prototype,"extent",void 0),e([o()],c.prototype,"features",void 0),e([s("features")],c.prototype,"readFeatures",null),e([o()],c.prototype,"geometryType",void 0),e([o({readOnly:!0})],c.prototype,"mergedGeometry",null),e([o()],c.prototype,"routeId",void 0),e([o()],c.prototype,"routeName",void 0),e([o({value:null,readOnly:!0})],c.prototype,"strings",null),e([o({json:{read:{source:"summary.totalDriveTime"}}})],c.prototype,"totalDriveTime",void 0),e([o({json:{read:{source:"summary.totalLength"}}})],c.prototype,"totalLength",void 0),e([o({json:{read:{source:"summary.totalTime"}}})],c.prototype,"totalTime",void 0),c=e([a("esri.rest.support.DirectionsFeatureSet")],c);const f=c;export{f as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.25/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../chunks/tslib.es6.js";import{geometryTypes as r}from"../../geometry.js";import t from"../../TimeExtent.js";import{JSONSupport as o}from"../../core/JSONSupport.js";import{clone as s}from"../../core/lang.js";import{property as i}from"../../core/accessorSupport/decorators/property.js";import"../../core/accessorSupport/ensureType.js";import{subclass as p}from"../../core/accessorSupport/decorators/subclass.js";import{writer as m}from"../../core/accessorSupport/decorators/writer.js";import{fromJSON as n,getJsonType as l}from"../../geometry/support/jsonUtils.js";import u from"../../layers/support/MosaicRule.js";import a from"../../layers/support/RasterFunction.js";import c from"../../geometry/Point.js";var y;let j=y=class extends o{constructor(){super(...arguments),this.geometry=null,this.mosaicRule=null,this.renderingRule=null,this.pixelSize=null,this.raster=void 0,this.timeExtent=null}writeGeometry(e,r,t){null!=e&&(r.geometryType=l(e),r[t]=e.toJSON())}clone(){return new y(s({geometry:this.geometry,mosaicRule:this.mosaicRule,renderingRule:this.renderingRule,pixelSize:this.pixelSize,raster:this.raster,timeExtent:this.timeExtent}))}};e([i({types:r,json:{read:n}})],j.prototype,"geometry",void 0),e([m("geometry")],j.prototype,"writeGeometry",null),e([i({type:u,json:{write:!0}})],j.prototype,"mosaicRule",void 0),e([i({type:a,json:{write:!0}})],j.prototype,"renderingRule",void 0),e([i({type:c,json:{write:!0}})],j.prototype,"pixelSize",void 0),e([i({json:{write:!0}})],j.prototype,"raster",void 0),e([i({type:t,json:{read:{source:"time"},write:{target:"time"}}})],j.prototype,"timeExtent",void 0),j=y=e([p("esri.rest.support.ImageHistogramParameters")],j);const d=j;export{d as default};
5
+ import{_ as e}from"../../chunks/tslib.es6.js";import{geometryTypes as r}from"../../geometry.js";import t from"../../TimeExtent.js";import{JSONSupport as o}from"../../core/JSONSupport.js";import{clone as s}from"../../core/lang.js";import{property as i}from"../../core/accessorSupport/decorators/property.js";import"../../core/accessorSupport/ensureType.js";import{subclass as p}from"../../core/accessorSupport/decorators/subclass.js";import{writer as m}from"../../core/accessorSupport/decorators/writer.js";import{getJsonType as n,fromJSON as l}from"../../geometry/support/jsonUtils.js";import u from"../../layers/support/MosaicRule.js";import a from"../../layers/support/RasterFunction.js";import c from"../../geometry/Point.js";var y;let j=y=class extends o{constructor(){super(...arguments),this.geometry=null,this.mosaicRule=null,this.renderingRule=null,this.pixelSize=null,this.raster=void 0,this.timeExtent=null}writeGeometry(e,r,t){null!=e&&(r.geometryType=n(e),r[t]=e.toJSON())}clone(){return new y(s({geometry:this.geometry,mosaicRule:this.mosaicRule,renderingRule:this.renderingRule,pixelSize:this.pixelSize,raster:this.raster,timeExtent:this.timeExtent}))}};e([i({types:r,json:{read:l}})],j.prototype,"geometry",void 0),e([m("geometry")],j.prototype,"writeGeometry",null),e([i({type:u,json:{write:!0}})],j.prototype,"mosaicRule",void 0),e([i({type:a,json:{write:!0}})],j.prototype,"renderingRule",void 0),e([i({type:c,json:{write:!0}})],j.prototype,"pixelSize",void 0),e([i({json:{write:!0}})],j.prototype,"raster",void 0),e([i({type:t,json:{read:{source:"time"},write:{target:"time"}}})],j.prototype,"timeExtent",void 0),j=y=e([p("esri.rest.support.ImageHistogramParameters")],j);const d=j;export{d as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.25/esri/copyright.txt for details.
4
4
  */
5
- import{_ as t}from"../../chunks/tslib.es6.js";import{geometryTypes as e}from"../../geometry.js";import o from"../../TimeExtent.js";import{JSONSupport as r}from"../../core/JSONSupport.js";import{clone as s}from"../../core/lang.js";import{property as i}from"../../core/accessorSupport/decorators/property.js";import"../../core/accessorSupport/ensureType.js";import{subclass as p}from"../../core/accessorSupport/decorators/subclass.js";import{writer as l}from"../../core/accessorSupport/decorators/writer.js";import{fromJSON as n,getJsonType as a}from"../../geometry/support/jsonUtils.js";import m from"../../layers/support/MosaicRule.js";import{interpolationKebab as u}from"../../layers/support/rasterEnums.js";import y from"../../geometry/Point.js";import c from"../../geometry/Multipoint.js";var d;let j=d=class extends r{constructor(){super(...arguments),this.geometry=null,this.interpolation="nearest",this.mosaicRule=null,this.outFields=null,this.pixelSize=null,this.returnFirstValueOnly=!0,this.sampleDistance=null,this.sampleCount=null,this.sliceId=null,this.timeExtent=null}writeGeometry(t,e,o){null!=t&&(e.geometryType=a(t),e[o]=t.toJSON())}set locations(t){if(t?.length){const e=new c({spatialReference:t[0].spatialReference});e.points=t.map((t=>[t.x,t.y])),this._set("locations",t),this.geometry=e}}clone(){return new d(s({geometry:this.geometry,locations:this.locations,interpolation:this.interpolation,mosaicRule:this.mosaicRule,outFields:this.outFields,raster:this.raster,returnFirstValueOnly:this.returnFirstValueOnly,sampleDistance:this.sampleDistance,sampleCount:this.sampleCount,sliceId:this.sliceId,pixelSize:this.pixelSize,timeExtent:this.timeExtent}))}};t([i({types:e,json:{read:n}})],j.prototype,"geometry",void 0),t([l("geometry")],j.prototype,"writeGeometry",null),t([i()],j.prototype,"locations",null),t([i({type:String,json:{type:u.jsonValues,read:u.read,write:u.write}})],j.prototype,"interpolation",void 0),t([i({type:m,json:{write:!0}})],j.prototype,"mosaicRule",void 0),t([i({type:[String],json:{write:!0}})],j.prototype,"outFields",void 0),t([i({type:y,json:{write:!0}})],j.prototype,"pixelSize",void 0),t([i({type:String,json:{write:!0}})],j.prototype,"raster",void 0),t([i({type:Boolean,json:{write:!0}})],j.prototype,"returnFirstValueOnly",void 0),t([i({type:Number,json:{write:!0}})],j.prototype,"sampleDistance",void 0),t([i({type:Number,json:{write:!0}})],j.prototype,"sampleCount",void 0),t([i({type:Number,json:{write:!0}})],j.prototype,"sliceId",void 0),t([i({type:o,json:{read:{source:"time"},write:{target:"time"}}})],j.prototype,"timeExtent",void 0),j=d=t([p("esri.rest.support.ImageSampleParameters")],j);const h=j;export{h as default};
5
+ import{_ as t}from"../../chunks/tslib.es6.js";import{geometryTypes as e}from"../../geometry.js";import o from"../../TimeExtent.js";import{JSONSupport as r}from"../../core/JSONSupport.js";import{clone as s}from"../../core/lang.js";import{property as i}from"../../core/accessorSupport/decorators/property.js";import"../../core/accessorSupport/ensureType.js";import{subclass as p}from"../../core/accessorSupport/decorators/subclass.js";import{writer as l}from"../../core/accessorSupport/decorators/writer.js";import{getJsonType as n,fromJSON as a}from"../../geometry/support/jsonUtils.js";import m from"../../layers/support/MosaicRule.js";import{interpolationKebab as u}from"../../layers/support/rasterEnums.js";import y from"../../geometry/Multipoint.js";import c from"../../geometry/Point.js";var d;let j=d=class extends r{constructor(){super(...arguments),this.geometry=null,this.interpolation="nearest",this.mosaicRule=null,this.outFields=null,this.pixelSize=null,this.returnFirstValueOnly=!0,this.sampleDistance=null,this.sampleCount=null,this.sliceId=null,this.timeExtent=null}writeGeometry(t,e,o){null!=t&&(e.geometryType=n(t),e[o]=t.toJSON())}set locations(t){if(t?.length){const e=new y({spatialReference:t[0].spatialReference});e.points=t.map((t=>[t.x,t.y])),this._set("locations",t),this.geometry=e}}clone(){return new d(s({geometry:this.geometry,locations:this.locations,interpolation:this.interpolation,mosaicRule:this.mosaicRule,outFields:this.outFields,raster:this.raster,returnFirstValueOnly:this.returnFirstValueOnly,sampleDistance:this.sampleDistance,sampleCount:this.sampleCount,sliceId:this.sliceId,pixelSize:this.pixelSize,timeExtent:this.timeExtent}))}};t([i({types:e,json:{read:a}})],j.prototype,"geometry",void 0),t([l("geometry")],j.prototype,"writeGeometry",null),t([i()],j.prototype,"locations",null),t([i({type:String,json:{type:u.jsonValues,read:u.read,write:u.write}})],j.prototype,"interpolation",void 0),t([i({type:m,json:{write:!0}})],j.prototype,"mosaicRule",void 0),t([i({type:[String],json:{write:!0}})],j.prototype,"outFields",void 0),t([i({type:c,json:{write:!0}})],j.prototype,"pixelSize",void 0),t([i({type:String,json:{write:!0}})],j.prototype,"raster",void 0),t([i({type:Boolean,json:{write:!0}})],j.prototype,"returnFirstValueOnly",void 0),t([i({type:Number,json:{write:!0}})],j.prototype,"sampleDistance",void 0),t([i({type:Number,json:{write:!0}})],j.prototype,"sampleCount",void 0),t([i({type:Number,json:{write:!0}})],j.prototype,"sliceId",void 0),t([i({type:o,json:{read:{source:"time"},write:{target:"time"}}})],j.prototype,"timeExtent",void 0),j=d=t([p("esri.rest.support.ImageSampleParameters")],j);const h=j;export{h as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.25/esri/copyright.txt for details.
4
4
  */
5
- import"../../symbols.js";import e from"../../core/Error.js";import{fetchMessageBundle as n}from"../../intl/messages.js";import t from"../../layers/support/LabelClass.js";import r from"../../layers/support/LabelExpressionInfo.js";import s from"../heuristics/clusterMinSize.js";import{getStatisticInfos as o,getClusterField as a,clusterCountField as i,getPredominantTypeExpression as l,getClusterFieldHash as u}from"../support/clusterUtils.js";import{isClusterCompatibleRenderer as c}from"../../views/2d/layers/support/clusterUtils.js";import m from"../../symbols/TextSymbol.js";async function f(n){const{layer:t,renderer:r,view:s}=n;await Promise.all([t.load(),s.when()]);const o=r||t.renderer;if(!c(o))throw new e("clusters-label-schemes:invalid-parameters","'renderer' is not valid");return{layer:t,renderer:o,view:s}}function p(e,n,t){const r="unique-value"===e.type?e.uniqueValueInfos:[];return l(r,n,t)}function v(e){return`\n $feature["${e}"];\n var value = $feature["${e}"];\n var num = Count(Text(Round(value)));\n var label = When(\n num < 4, Text(value, "#.#"),\n num == 4, Text(value / Pow(10, 3), "#.0k"),\n num <= 6, Text(value / Pow(10, 3), "#k"),\n num == 7, Text(value / Pow(10, 6), "#.0m"),\n num > 7, Text(value / Pow(10, 6), "#m"),\n Text(value, "#,###")\n );\n return label;\n `}function w(e){const n=new m({haloColor:"#373837",haloSize:"1px",color:"#f0f0f0",font:{family:"Noto Sans",size:"12px",weight:"bold"}});return new t({symbol:n,deconflictionStrategy:"none",labelPlacement:"center-center",labelExpressionInfo:new r({expression:e})})}async function y(e){const{renderer:n,view:t,statInfo:r}=e,o=r?.statisticType,l=r?a(r.attributeInfo,o):i,c=w("type"===o?p(n,l,e.noneValueLabel):v(l));return{name:r?`clusters-${o}-${u(l,o)}`:"clusters-count",labelingInfo:[c],clusterMinSize:await s(c.symbol,t),fieldName:l}}function b(e){const n=new Map;for(const t of e)"size"===t.attributeInfo.vvType?n.set(t.statisticHash,t):n.has(t.statisticHash)||n.set(t.statisticHash,t);return[...n.values()]}async function d(e){const[{renderer:t,layer:r,view:s},a]=await Promise.all([f(e),n("esri/smartMapping/t9n/smartMapping")]);if(!t)return null;let i=null;const l=[],u=b(o(r,t,!1));for(const n of u){const e=await y({renderer:t,view:s,statInfo:n,noneValueLabel:a.clusters.predominantNoneValue});"size"===n.attributeInfo.vvType?i=e:l.push(e)}const c=await y({renderer:t,view:s});return i?l.unshift(c):i=c,{primaryScheme:i,secondarySchemes:l}}export{d as getLabelSchemes};
5
+ import"../../symbols.js";import e from"../../core/Error.js";import{fetchMessageBundle as n}from"../../intl/messages.js";import t from"../../layers/support/LabelClass.js";import r from"../../layers/support/LabelExpressionInfo.js";import s from"../heuristics/clusterMinSize.js";import{getStatisticInfos as o,getClusterField as a,clusterCountField as i,getClusterFieldHash as l,getPredominantTypeExpression as u}from"../support/clusterUtils.js";import{isClusterCompatibleRenderer as c}from"../../views/2d/layers/support/clusterUtils.js";import m from"../../symbols/TextSymbol.js";async function f(n){const{layer:t,renderer:r,view:s}=n;await Promise.all([t.load(),s.when()]);const o=r||t.renderer;if(!c(o))throw new e("clusters-label-schemes:invalid-parameters","'renderer' is not valid");return{layer:t,renderer:o,view:s}}function p(e,n,t){const r="unique-value"===e.type?e.uniqueValueInfos:[];return u(r,n,t)}function v(e){return`\n $feature["${e}"];\n var value = $feature["${e}"];\n var num = Count(Text(Round(value)));\n var label = When(\n num < 4, Text(value, "#.#"),\n num == 4, Text(value / Pow(10, 3), "#.0k"),\n num <= 6, Text(value / Pow(10, 3), "#k"),\n num == 7, Text(value / Pow(10, 6), "#.0m"),\n num > 7, Text(value / Pow(10, 6), "#m"),\n Text(value, "#,###")\n );\n return label;\n `}function w(e){const n=new m({haloColor:"#373837",haloSize:"1px",color:"#f0f0f0",font:{family:"Noto Sans",size:"12px",weight:"bold"}});return new t({symbol:n,deconflictionStrategy:"none",labelPlacement:"center-center",labelExpressionInfo:new r({expression:e})})}async function y(e){const{renderer:n,view:t,statInfo:r}=e,o=r?.statisticType,u=r?a(r.attributeInfo,o):i,c=w("type"===o?p(n,u,e.noneValueLabel):v(u));return{name:r?`clusters-${o}-${l(u,o)}`:"clusters-count",labelingInfo:[c],clusterMinSize:await s(c.symbol,t),fieldName:u}}function b(e){const n=new Map;for(const t of e)"size"===t.attributeInfo.vvType?n.set(t.statisticHash,t):n.has(t.statisticHash)||n.set(t.statisticHash,t);return[...n.values()]}async function d(e){const[{renderer:t,layer:r,view:s},a]=await Promise.all([f(e),n("esri/smartMapping/t9n/smartMapping")]);if(!t)return null;let i=null;const l=[],u=b(o(r,t,!1));for(const n of u){const e=await y({renderer:t,view:s,statInfo:n,noneValueLabel:a.clusters.predominantNoneValue});"size"===n.attributeInfo.vvType?i=e:l.push(e)}const c=await y({renderer:t,view:s});return i?l.unshift(c):i=c,{primaryScheme:i,secondarySchemes:l}}export{d as getLabelSchemes};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.25/esri/copyright.txt for details.
4
4
  */
5
- import e from"../../core/Error.js";import{clone as a}from"../../core/lang.js";import{isSome as n}from"../../core/maybe.js";import{fetchMessageBundle as i}from"../../intl/messages.js";import l from"../../renderers/support/AuthoringInfo.js";import{AuthoringInfoClassBreakInfo as r}from"../../renderers/support/AuthoringInfoClassBreakInfo.js";import{AuthoringInfoFieldInfo as s}from"../../renderers/support/AuthoringInfoFieldInfo.js";import{createRenderer as o}from"./type.js";import{createColors as t,getClassBreaks as d,verifyBasicFieldValidity as m,getBasemapInfo as u}from"./support/utils.js";import{createLayerAdapter as f,featureCapableLayerTypes as p,getLayerTypeLabels as c}from"../support/adapters/support/layerUtils.js";import{getColors as h,flatten2DArray as y,cloneScheme as b,getSchemes as w}from"../symbology/relationship.js";import{applyColorToSymbol as v}from"../../symbols/support/utils.js";const g=["equal-interval","natural-breaks","quantile"],I=["HH","HL","LH","LL"],M={2:[["HL","HH"],["LL","LH"]],3:[["HL","HM","HH"],["ML","MM","MH"],["LL","LM","LH"]],4:[["HL","HM1","HM2","HH"],["M2L","M2M1","M2M2","M2H"],["M1L","M1M1","M1M2","M1H"],["LL","LM1","LM2","LH"]]},z={2:["L","H"],3:["L","M","H"],4:["L","M1","M2","H"]},F=e=>({minValue:e.minValue,maxValue:e.maxValue});async function T(a){if(!(a&&a.layer&&a.view&&a.field1&&a.field2))throw new e("relationship-renderer:missing-parameters","'layer', 'view', 'field1' and 'field2' parameters are required");const i={...a};if(i.symbolType=i.symbolType||"2d",i.defaultSymbolEnabled=null==i.defaultSymbolEnabled||i.defaultSymbolEnabled,i.classificationMethod=i.classificationMethod||"quantile",i.numClasses=i.numClasses||3,i.focus=i.focus||null,!g.includes(i.classificationMethod))throw new e("relationship-renderer:invalid-parameters",`classification method ${i.classificationMethod} is not supported`);if(i.numClasses<2||i.numClasses>4)throw new e("relationship-renderer:invalid-parameters","'numClasses' must be 2, 3 or 4");if(a.focus&&!I.includes(a.focus))throw new e("relationship-renderer:invalid-parameters","'focus' must be 'HH', 'HL', 'LH', 'LL' or null");const l=f(i.layer,p);if(i.layer=l,!l)throw new e("relationship-renderer:invalid-parameters","'layer' must be one of these types: "+c(p).join(", "));const r=n(i.signal)?{signal:i.signal}:null;await l.load(r);const s=l.geometryType,o=i.symbolType.includes("3d");if(i.outlineOptimizationEnabled="polygon"===s&&i.outlineOptimizationEnabled,i.sizeOptimizationEnabled=("point"===s||"multipoint"===s||"polyline"===s)&&i.sizeOptimizationEnabled,"mesh"===s)i.symbolType="3d-volumetric",i.colorMixMode=i.colorMixMode||"replace",i.edgesType=i.edgesType||"none";else{if("3d-volumetric-uniform"===i.symbolType&&"point"!==s)throw new e("relationship-renderer:not-supported","3d-volumetric-uniform symbols are supported for point layers only");if(o&&"polygon"===s)throw new e("relationship-renderer:not-supported","3d symbols are not supported for polygon layers");if(i.symbolType.includes("3d-volumetric")&&(!i.view||"3d"!==i.view.type))throw new e("relationship-renderer:invalid-parameters","'view' parameter should be an instance of SceneView when 'symbolType' parameter is '3d-volumetric' or '3d-volumetric-uniform'")}const{field1:t,field2:d}=i,u=[t.field,d.field];t.normalizationField&&u.push(t.normalizationField),d.normalizationField&&u.push(d.normalizationField);const h=m(l,u,"relationship-renderer:invalid-parameters");if(h)throw h;return i}async function V(a){if(!(a&&a.renderer&&a.numClasses))throw new e("update-relationship-renderer:missing-parameters","'renderer' and 'numClasses' parameters are required");const{field1:n,field2:i,renderer:l,numClasses:r,colors:s}=a,o=r**2;if((n||i)&&!(n&&i&&n.field&&i.field))throw new e("update-relationship-renderer:missing-parameters","'field1' and 'field2' parameters are required");if(n&&!n.classBreakInfos||i&&!i.classBreakInfos)throw new e("update-relationship-renderer:missing-parameters","'field1.classBreakInfos' and 'field2.classBreakInfos' are required");if(!l.authoringInfo)throw new e("update-relationship-renderer:missing-parameters","'renderer.authoringInfo' is required");if(l.uniqueValueInfos.length!==o)throw new e("update-relationship-renderer:invalid-parameters",`Renderer must have ${o} unique value infos to support ${r} classes`);if(s&&s.length!==o)throw new e("update-relationship-renderer:invalid-parameters",`The scheme must have ${o} colors`);return a}async function H(e){let a=e.relationshipScheme,i=null,l=null;const r=await u(e.basemap,e.view);if(i=n(r.basemapId)?r.basemapId:null,l=n(r.basemapTheme)?r.basemapTheme:null,a)return{scheme:b(a),basemapId:i,basemapTheme:l};const s=w({basemap:i,basemapTheme:l,geometryType:e.geometryType,theme:e.theme,worldScale:e.worldScale,view:e.view});return s&&(a=s.primaryScheme,i=s.basemapId,l=s.basemapTheme),{scheme:a,basemapId:i,basemapTheme:l}}function L(e,n){const i=a(M[e]);return y(i,n)}function k(e,a){return L(e,a).map((e=>({value:e,count:0})))}function C(e,a,n,i){const{field:l,normalizationField:r}=e,{field:s,normalizationField:o}=a,t=n.map((e=>[e.minValue,e.maxValue])),d=i.map((e=>[e.minValue,e.maxValue])),m=t.length,u=z[m];return`\n var field1 = $feature['${l}'];\n var field2 = $feature['${s}'];\n var hasNormField1 = ${r?"true":"false"};\n var hasNormField2 = ${o?"true":"false"};\n var normField1 = ${r?`$feature['${r}']`:"null"};\n var normField2 = ${o?`$feature['${o}']`:"null"};\n\n if (\n IsEmpty(field1) ||\n IsEmpty(field2) ||\n (hasNormField1 && (IsEmpty(normField1) || normField1 == 0)) ||\n (hasNormField2 && (IsEmpty(normField2) || normField2 == 0))\n ) {\n return null;\n }\n\n var value1 = IIf(hasNormField1, (field1 / normField1), field1);\n var value2 = IIf(hasNormField2, (field2 / normField2), field2);\n\n var breaks1 = ${JSON.stringify(t)};\n var breaks2 = ${JSON.stringify(d)};\n var classCodes = ${JSON.stringify(u)};\n\n function getClassCode(value, breaks) {\n var code = null;\n\n for (var i in breaks) {\n var info = breaks[i];\n if (value >= info[0] && value <= info[1]) {\n code = classCodes[i];\n break;\n }\n }\n\n return code;\n }\n\n var code1 = getClassCode(value1, breaks1);\n var code2 = getClassCode(value2, breaks2);\n\n var classValue = IIf(IsEmpty(code1) || IsEmpty(code2), null, code1 + code2);\n return classValue;\n `}async function E(a,n,r){const s=await i("esri/smartMapping/t9n/smartMapping"),{basemap:t,classificationMethod:d,field1:m,field2:u,focus:f,numClasses:p,signal:c}=a,y=a.layer,b=n.classBreakInfos,w=r.classBreakInfos;if(p!==b.length||b.length!==w.length)throw new e("relationship-renderer:error","incompatible class breaks");const v=k(p,f),g=C(a.field1,a.field2,b,w),I=(await H({basemap:t,geometryType:y.geometryType,theme:"default",relationshipScheme:a.relationshipScheme,worldScale:a.symbolType.includes("3d-volumetric"),view:a.view})).scheme,M=await o({layer:y,basemap:t,valueExpression:g,valueExpressionTitle:s.relationship.legendTitle,numTypes:-1,sortEnabled:!1,defaultSymbolEnabled:a.defaultSymbolEnabled,typeScheme:{colors:h(I,p,f),...I},statistics:{uniqueValueInfos:v},legendOptions:a.legendOptions,outlineOptimizationEnabled:a.outlineOptimizationEnabled,sizeOptimizationEnabled:a.sizeOptimizationEnabled,symbolType:a.symbolType,colorMixMode:a.colorMixMode,edgesType:a.edgesType,view:a.view,signal:c}),z=M.renderer,T=z.uniqueValueInfos,V=s.relationship;for(const e of T)e.label=V[e.value];const L=new l({type:"relationship",classificationMethod:d,numClasses:p,focus:f,field1:{field:m.field,normalizationField:m.normalizationField,label:m.label,classBreakInfos:b.map(F)},field2:{field:u.field,normalizationField:u.normalizationField,label:u.label,classBreakInfos:w.map(F)}});return z.authoringInfo=L,{renderer:z,classBreaks:{field1:n,field2:r},uniqueValueInfos:M.uniqueValueInfos,relationshipScheme:I,basemapId:M.basemapId,basemapTheme:M.basemapTheme}}function x(e,a,n){const i=L(a,n);e.sort(((e,a)=>{const n=i.indexOf(e.value),l=i.indexOf(a.value);let r=0;return n<l?r=-1:n>l&&(r=1),r}))}function $(e,a){const{authoringInfo:n}=e;n.numClasses=a.numClasses,n.focus=a.focus||null,n.focus||delete n.focus;const{field1:i,field2:l}=a;n.field1=new s({field:i.field,normalizationField:i.normalizationField,label:i.label,classBreakInfos:i.classBreakInfos.map((e=>new r(F(e))))}),n.field2=new s({field:l.field,normalizationField:l.normalizationField,label:l.label,classBreakInfos:l.classBreakInfos.map((e=>new r(F(e))))}),e.authoringInfo=n}async function S(e){const a=await V(e),{field1:n,field2:i,renderer:l,numClasses:r,focus:s,colors:o}=a,d=l.clone();if(d.valueExpression=C(n,i,n.classBreakInfos,i.classBreakInfos),x(d.uniqueValueInfos,r,s),o){const e=t(o,o.length);d.uniqueValueInfos.forEach(((a,n)=>v(a.symbol,e[n])))}return $(d,a),d}async function q(a){const n=await T(a),{layer:i,classificationMethod:l,field1:r,field2:s,numClasses:o,view:t,signal:m}=n,u={layer:i,classificationMethod:l,field:r.field,normalizationField:r.normalizationField,normalizationType:r.normalizationField?"field":null,minValue:r.minValue,maxValue:r.maxValue,analyzeData:!(null!=r.minValue&&null!=r.maxValue),numClasses:o,view:t,signal:m},f={layer:i,classificationMethod:l,field:s.field,normalizationField:s.normalizationField,normalizationType:s.normalizationField?"field":null,minValue:s.minValue,maxValue:s.maxValue,analyzeData:!(null!=s.minValue&&null!=s.maxValue),numClasses:o,view:t,signal:m},[p,c]=await Promise.all([d(u),d(f)]);if(!p||!c)throw new e("relationship-renderer:error","error when calculating class breaks");return E(n,p.result,c.result)}export{q as createRenderer,S as updateRenderer};
5
+ import e from"../../core/Error.js";import{clone as a}from"../../core/lang.js";import{isSome as n}from"../../core/maybe.js";import{fetchMessageBundle as i}from"../../intl/messages.js";import l from"../../renderers/support/AuthoringInfo.js";import{AuthoringInfoClassBreakInfo as r}from"../../renderers/support/AuthoringInfoClassBreakInfo.js";import{AuthoringInfoFieldInfo as s}from"../../renderers/support/AuthoringInfoFieldInfo.js";import{createRenderer as o}from"./type.js";import{createColors as t,getClassBreaks as d,verifyBasicFieldValidity as m,getBasemapInfo as u}from"./support/utils.js";import{createLayerAdapter as f,featureCapableLayerTypes as p,getLayerTypeLabels as c}from"../support/adapters/support/layerUtils.js";import{getColors as h,cloneScheme as y,getSchemes as b,flatten2DArray as w}from"../symbology/relationship.js";import{applyColorToSymbol as v}from"../../symbols/support/utils.js";const g=["equal-interval","natural-breaks","quantile"],I=["HH","HL","LH","LL"],M={2:[["HL","HH"],["LL","LH"]],3:[["HL","HM","HH"],["ML","MM","MH"],["LL","LM","LH"]],4:[["HL","HM1","HM2","HH"],["M2L","M2M1","M2M2","M2H"],["M1L","M1M1","M1M2","M1H"],["LL","LM1","LM2","LH"]]},z={2:["L","H"],3:["L","M","H"],4:["L","M1","M2","H"]},F=e=>({minValue:e.minValue,maxValue:e.maxValue});async function T(a){if(!(a&&a.layer&&a.view&&a.field1&&a.field2))throw new e("relationship-renderer:missing-parameters","'layer', 'view', 'field1' and 'field2' parameters are required");const i={...a};if(i.symbolType=i.symbolType||"2d",i.defaultSymbolEnabled=null==i.defaultSymbolEnabled||i.defaultSymbolEnabled,i.classificationMethod=i.classificationMethod||"quantile",i.numClasses=i.numClasses||3,i.focus=i.focus||null,!g.includes(i.classificationMethod))throw new e("relationship-renderer:invalid-parameters",`classification method ${i.classificationMethod} is not supported`);if(i.numClasses<2||i.numClasses>4)throw new e("relationship-renderer:invalid-parameters","'numClasses' must be 2, 3 or 4");if(a.focus&&!I.includes(a.focus))throw new e("relationship-renderer:invalid-parameters","'focus' must be 'HH', 'HL', 'LH', 'LL' or null");const l=f(i.layer,p);if(i.layer=l,!l)throw new e("relationship-renderer:invalid-parameters","'layer' must be one of these types: "+c(p).join(", "));const r=n(i.signal)?{signal:i.signal}:null;await l.load(r);const s=l.geometryType,o=i.symbolType.includes("3d");if(i.outlineOptimizationEnabled="polygon"===s&&i.outlineOptimizationEnabled,i.sizeOptimizationEnabled=("point"===s||"multipoint"===s||"polyline"===s)&&i.sizeOptimizationEnabled,"mesh"===s)i.symbolType="3d-volumetric",i.colorMixMode=i.colorMixMode||"replace",i.edgesType=i.edgesType||"none";else{if("3d-volumetric-uniform"===i.symbolType&&"point"!==s)throw new e("relationship-renderer:not-supported","3d-volumetric-uniform symbols are supported for point layers only");if(o&&"polygon"===s)throw new e("relationship-renderer:not-supported","3d symbols are not supported for polygon layers");if(i.symbolType.includes("3d-volumetric")&&(!i.view||"3d"!==i.view.type))throw new e("relationship-renderer:invalid-parameters","'view' parameter should be an instance of SceneView when 'symbolType' parameter is '3d-volumetric' or '3d-volumetric-uniform'")}const{field1:t,field2:d}=i,u=[t.field,d.field];t.normalizationField&&u.push(t.normalizationField),d.normalizationField&&u.push(d.normalizationField);const h=m(l,u,"relationship-renderer:invalid-parameters");if(h)throw h;return i}async function V(a){if(!(a&&a.renderer&&a.numClasses))throw new e("update-relationship-renderer:missing-parameters","'renderer' and 'numClasses' parameters are required");const{field1:n,field2:i,renderer:l,numClasses:r,colors:s}=a,o=r**2;if((n||i)&&!(n&&i&&n.field&&i.field))throw new e("update-relationship-renderer:missing-parameters","'field1' and 'field2' parameters are required");if(n&&!n.classBreakInfos||i&&!i.classBreakInfos)throw new e("update-relationship-renderer:missing-parameters","'field1.classBreakInfos' and 'field2.classBreakInfos' are required");if(!l.authoringInfo)throw new e("update-relationship-renderer:missing-parameters","'renderer.authoringInfo' is required");if(l.uniqueValueInfos.length!==o)throw new e("update-relationship-renderer:invalid-parameters",`Renderer must have ${o} unique value infos to support ${r} classes`);if(s&&s.length!==o)throw new e("update-relationship-renderer:invalid-parameters",`The scheme must have ${o} colors`);return a}async function H(e){let a=e.relationshipScheme,i=null,l=null;const r=await u(e.basemap,e.view);if(i=n(r.basemapId)?r.basemapId:null,l=n(r.basemapTheme)?r.basemapTheme:null,a)return{scheme:y(a),basemapId:i,basemapTheme:l};const s=b({basemap:i,basemapTheme:l,geometryType:e.geometryType,theme:e.theme,worldScale:e.worldScale,view:e.view});return s&&(a=s.primaryScheme,i=s.basemapId,l=s.basemapTheme),{scheme:a,basemapId:i,basemapTheme:l}}function L(e,n){const i=a(M[e]);return w(i,n)}function k(e,a){return L(e,a).map((e=>({value:e,count:0})))}function C(e,a,n,i){const{field:l,normalizationField:r}=e,{field:s,normalizationField:o}=a,t=n.map((e=>[e.minValue,e.maxValue])),d=i.map((e=>[e.minValue,e.maxValue])),m=t.length,u=z[m];return`\n var field1 = $feature['${l}'];\n var field2 = $feature['${s}'];\n var hasNormField1 = ${r?"true":"false"};\n var hasNormField2 = ${o?"true":"false"};\n var normField1 = ${r?`$feature['${r}']`:"null"};\n var normField2 = ${o?`$feature['${o}']`:"null"};\n\n if (\n IsEmpty(field1) ||\n IsEmpty(field2) ||\n (hasNormField1 && (IsEmpty(normField1) || normField1 == 0)) ||\n (hasNormField2 && (IsEmpty(normField2) || normField2 == 0))\n ) {\n return null;\n }\n\n var value1 = IIf(hasNormField1, (field1 / normField1), field1);\n var value2 = IIf(hasNormField2, (field2 / normField2), field2);\n\n var breaks1 = ${JSON.stringify(t)};\n var breaks2 = ${JSON.stringify(d)};\n var classCodes = ${JSON.stringify(u)};\n\n function getClassCode(value, breaks) {\n var code = null;\n\n for (var i in breaks) {\n var info = breaks[i];\n if (value >= info[0] && value <= info[1]) {\n code = classCodes[i];\n break;\n }\n }\n\n return code;\n }\n\n var code1 = getClassCode(value1, breaks1);\n var code2 = getClassCode(value2, breaks2);\n\n var classValue = IIf(IsEmpty(code1) || IsEmpty(code2), null, code1 + code2);\n return classValue;\n `}async function E(a,n,r){const s=await i("esri/smartMapping/t9n/smartMapping"),{basemap:t,classificationMethod:d,field1:m,field2:u,focus:f,numClasses:p,signal:c}=a,y=a.layer,b=n.classBreakInfos,w=r.classBreakInfos;if(p!==b.length||b.length!==w.length)throw new e("relationship-renderer:error","incompatible class breaks");const v=k(p,f),g=C(a.field1,a.field2,b,w),I=(await H({basemap:t,geometryType:y.geometryType,theme:"default",relationshipScheme:a.relationshipScheme,worldScale:a.symbolType.includes("3d-volumetric"),view:a.view})).scheme,M=await o({layer:y,basemap:t,valueExpression:g,valueExpressionTitle:s.relationship.legendTitle,numTypes:-1,sortEnabled:!1,defaultSymbolEnabled:a.defaultSymbolEnabled,typeScheme:{colors:h(I,p,f),...I},statistics:{uniqueValueInfos:v},legendOptions:a.legendOptions,outlineOptimizationEnabled:a.outlineOptimizationEnabled,sizeOptimizationEnabled:a.sizeOptimizationEnabled,symbolType:a.symbolType,colorMixMode:a.colorMixMode,edgesType:a.edgesType,view:a.view,signal:c}),z=M.renderer,T=z.uniqueValueInfos,V=s.relationship;for(const e of T)e.label=V[e.value];const L=new l({type:"relationship",classificationMethod:d,numClasses:p,focus:f,field1:{field:m.field,normalizationField:m.normalizationField,label:m.label,classBreakInfos:b.map(F)},field2:{field:u.field,normalizationField:u.normalizationField,label:u.label,classBreakInfos:w.map(F)}});return z.authoringInfo=L,{renderer:z,classBreaks:{field1:n,field2:r},uniqueValueInfos:M.uniqueValueInfos,relationshipScheme:I,basemapId:M.basemapId,basemapTheme:M.basemapTheme}}function x(e,a,n){const i=L(a,n);e.sort(((e,a)=>{const n=i.indexOf(e.value),l=i.indexOf(a.value);let r=0;return n<l?r=-1:n>l&&(r=1),r}))}function $(e,a){const{authoringInfo:n}=e;n.numClasses=a.numClasses,n.focus=a.focus||null,n.focus||delete n.focus;const{field1:i,field2:l}=a;n.field1=new s({field:i.field,normalizationField:i.normalizationField,label:i.label,classBreakInfos:i.classBreakInfos.map((e=>new r(F(e))))}),n.field2=new s({field:l.field,normalizationField:l.normalizationField,label:l.label,classBreakInfos:l.classBreakInfos.map((e=>new r(F(e))))}),e.authoringInfo=n}async function S(e){const a=await V(e),{field1:n,field2:i,renderer:l,numClasses:r,focus:s,colors:o}=a,d=l.clone();if(d.valueExpression=C(n,i,n.classBreakInfos,i.classBreakInfos),x(d.uniqueValueInfos,r,s),o){const e=t(o,o.length);d.uniqueValueInfos.forEach(((a,n)=>v(a.symbol,e[n])))}return $(d,a),d}async function q(a){const n=await T(a),{layer:i,classificationMethod:l,field1:r,field2:s,numClasses:o,view:t,signal:m}=n,u={layer:i,classificationMethod:l,field:r.field,normalizationField:r.normalizationField,normalizationType:r.normalizationField?"field":null,minValue:r.minValue,maxValue:r.maxValue,analyzeData:!(null!=r.minValue&&null!=r.maxValue),numClasses:o,view:t,signal:m},f={layer:i,classificationMethod:l,field:s.field,normalizationField:s.normalizationField,normalizationType:s.normalizationField?"field":null,minValue:s.minValue,maxValue:s.maxValue,analyzeData:!(null!=s.minValue&&null!=s.maxValue),numClasses:o,view:t,signal:m},[p,c]=await Promise.all([d(u),d(f)]);if(!p||!c)throw new e("relationship-renderer:error","error when calculating class breaks");return E(n,p.result,c.result)}export{q as createRenderer,S as updateRenderer};