@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{_ as e}from"../chunks/tslib.es6.js";import t from"../PopupTemplate.js";import"../renderers/ClassBreaksRenderer.js";import"../renderers/DictionaryRenderer.js";import"../renderers/DotDensityRenderer.js";import"../renderers/HeatmapRenderer.js";import"../renderers/PieChartRenderer.js";import"../renderers/Renderer.js";import r from"../renderers/SimpleRenderer.js";import i from"../renderers/UniqueValueRenderer.js";import{read as o}from"../renderers/support/jsonUtils.js";import{rendererTypes as s,webSceneRendererTypes as a}from"../renderers/support/types.js";import n from"../request.js";import{symbolTypes as p,symbolTypesRenderer as l}from"../symbols.js";import{ClonableMixin as u}from"../core/Clonable.js";import d from"../core/Collection.js";import c from"../core/Error.js";import y from"../core/Handles.js";import has from"../core/has.js";import{JSONMap as h}from"../core/jsonMap.js";import{clone as m}from"../core/lang.js";import f from"../core/Logger.js";import{destroyMaybe as b,isSome as g}from"../core/maybe.js";import{MultiOriginJSONMixin as w}from"../core/MultiOriginJSONSupport.js";import{setDeepValue as v}from"../core/object.js";import{throwIfAbortError as S,whenOrAbort as F}from"../core/promiseUtils.js";import{sqlAnd as I,parseWhereClause as j}from"../core/sql.js";import{urlToObject as T,join as E}from"../core/urlUtils.js";import{property as x}from"../core/accessorSupport/decorators/property.js";import{cast as D}from"../core/accessorSupport/decorators/cast.js";import{reader as C}from"../core/accessorSupport/decorators/reader.js";import{subclass as A}from"../core/accessorSupport/decorators/subclass.js";import{writer as M}from"../core/accessorSupport/decorators/writer.js";import{createTypeReader as L}from"../core/accessorSupport/extensions/serializableProperty/reader.js";import R from"../form/FormTemplate.js";import _ from"../geometry/Extent.js";import O from"../geometry/HeightModelInfo.js";import P from"../geometry/SpatialReference.js";import q from"./Layer.js";import{MemorySource as Q}from"./graphics/sources/MemorySource.js";import{APIKeyMixin as U}from"./mixins/APIKeyMixin.js";import{ArcGISService as G}from"./mixins/ArcGISService.js";import{BlendLayer as V}from"./mixins/BlendLayer.js";import{CustomParametersMixin as z}from"./mixins/CustomParametersMixin.js";import{FeatureEffectLayer as B}from"./mixins/FeatureEffectLayer.js";import{OperationalLayer as k}from"./mixins/OperationalLayer.js";import{OrderedLayer as N}from"./mixins/OrderedLayer.js";import{PortalLayer as W}from"./mixins/PortalLayer.js";import{RefreshableLayer as H}from"./mixins/RefreshableLayer.js";import{ScaleRangeLayer as J}from"./mixins/ScaleRangeLayer.js";import{TemporalLayer as Z}from"./mixins/TemporalLayer.js";import{titleFromUrlAndName as $,parse as K,cleanTitle as X,sanitizeUrlWithLayerId as Y,writeUrlWithLayerId as ee,isHostedAgolService as te}from"./support/arcgisLayerUrl.js";import{id as re,labelsVisible as ie,legendEnabled as oe,minScale as se,maxScale as ae,popupEnabled as ne,url as pe,elevationInfo as le,opacityDrawingInfo as ue,listMode as de,screenSizePerspectiveEnabled as ce}from"./support/commonProperties.js";import{FeatureIndex as ye}from"./support/FeatureIndex.js";import{featureReductionProperty as he}from"./support/featureReductionUtils.js";import me from"./support/FeatureTemplate.js";import fe from"./support/FeatureType.js";import{defineFieldProperties as be}from"./support/fieldProperties.js";import{fixRendererFields as ge,fixTimeInfoFields as we}from"./support/fieldUtils.js";import ve from"./support/GeometryFieldsInfo.js";import Se from"./support/LabelClass.js";import{reader as Fe}from"./support/labelingInfo.js";import Ie from"./support/LayerFloorInfo.js";import je from"./support/Relationship.js";import Te from"./support/TimeInfo.js";import{serviceSupportsSpatialReference as Ee}from"./support/versionUtils.js";import{DataLayerSource as xe}from"./support/source/DataLayerSource.js";import{loadStyleRenderer as De}from"../renderers/support/styleUtils.js";import Ce from"../rest/support/AttachmentQuery.js";import Ae from"../rest/support/FeatureSet.js";import Me from"../rest/support/Query.js";import Le from"../rest/support/RelationshipQuery.js";import Re from"../rest/support/TopFeaturesQuery.js";import{createPopupTemplate as _e}from"../support/popupUtils.js";import{opacityToTransparency as Oe}from"../webdoc/support/opacityUtils.js";const Pe=new h({esriGeometryPoint:"point",esriGeometryMultipoint:"multipoint",esriGeometryPolyline:"polyline",esriGeometryPolygon:"polygon",esriGeometryMultiPatch:"multipatch"}),qe={name:"supportsName",size:"supportsSize",contentType:"supportsContentType",keywords:"supportsKeywords",exifInfo:"supportsExifInfo"},Qe="FeatureLayer",Ue="esri.layers.FeatureLayer",Ge=f.getLogger(Ue);function Ve(e,t){return new c("layer:unsupported",`Layer (${e.title}, ${e.id}) of type '${e.declaredClass}' ${t}`,{layer:e})}function ze(e){return e&&e instanceof d}function Be(e,t,r){return!!(e&&e.hasOwnProperty(t)?e[t]:r)}function ke(e,t,r){return e&&e.hasOwnProperty(t)?e[t]:r}function Ne(e){const t=e?.supportedSpatialAggregationStatistics?.map((e=>e.toLowerCase()));return{envelope:!!t?.includes("envelopeaggregate"),centroid:!!t?.includes("centroidaggregate"),convexHull:!!t?.includes("convexhullaggregate")}}function We(e,t){const r=e?.supportedOperationsWithCacheHint?.map((e=>e.toLowerCase()));return!!r?.includes(t.toLowerCase())}const He=be();function Je(e,t,r){const i=!!r?.writeLayerSchema;return{enabled:i,ignoreOrigin:i}}let Ze=class extends(B(V(N(Z(J(H(G(k(W(w(z(U(u(q)))))))))))))){constructor(...e){super(...e),this._handles=new y,this.capabilities=null,this.charts=null,this.copyright=null,this.datesInUnknownTimezone=!1,this.displayField=null,this.definitionExpression=null,this.dynamicDataSource=null,this.editFieldsInfo=null,this.editingInfo=null,this.elevationInfo=null,this.featureReduction=null,this.fields=null,this.fieldsIndex=null,this.floorInfo=null,this.formTemplate=null,this.fullExtent=null,this.gdbVersion=null,this.geometryFieldsInfo=null,this.geometryType=null,this.hasM=void 0,this.hasZ=void 0,this.heightModelInfo=null,this.historicMoment=null,this.infoFor3D=null,this.isTable=!1,this.labelsVisible=!0,this.labelingInfo=null,this.layerId=void 0,this.legendEnabled=!0,this.minScale=0,this.maxScale=0,this.globalIdField=null,this.objectIdField=null,this.outFields=null,this.path=null,this.popupEnabled=!0,this.popupTemplate=null,this.relationships=null,this.sourceJSON=null,this.returnM=void 0,this.returnZ=void 0,this.screenSizePerspectiveEnabled=!0,this.serviceDefinitionExpression=null,this.spatialReference=P.WGS84,this.subtypeCode=null,this.subtypeField=null,this.templates=null,this.timeInfo=null,this.title=null,this.sublayerTitleMode="item-title",this.trackIdField=null,this.type="feature",this.typeIdField=null,this.types=null,this.indexes=new(d.ofType(ye)),this.userIsAdmin=!1,this.version=void 0,this.visible=!0}destroy(){this.source?.destroy(),this._handles=b(this._handles)}normalizeCtorArgs(e,t){return"string"==typeof e?{url:e,...t}:e}load(e){const t=g(e)?e.signal:null;if(this.portalItem&&this.portalItem.loaded&&this.source)return void this.addResolvingPromise(this.createGraphicsSource(t).then((e=>this._initLayerProperties(e))));const r=this.loadFromPortal({supportedTypes:["Feature Service","Feature Collection"]},e).catch(S).then((async()=>{if(this.url&&null==this.layerId&&/FeatureServer|MapServer\/*$/i.test(this.url)){const e=await this._fetchFirstLayerId(t);null!=e&&(this.layerId=e)}if(!this.url&&!this._hasMemorySource())throw new c("feature-layer:missing-url-or-source","Feature layer must be created with either a url or a source");return this._initLayerProperties(await this.createGraphicsSource(t))})).then((()=>this.finishLoadEditablePortalLayer(e)));return this.addResolvingPromise(r),Promise.resolve(this)}readCapabilities(e,t){return t=t.layerDefinition||t,{analytics:this._readAnalyticsCapabilities(t),attachment:this._readAttachmentCapabilities(t),data:this._readDataCapabilities(t),metadata:this._readMetadataCapabilities(t),operations:this._readOperationsCapabilities(t.capabilities||e,t),query:this._readQueryCapabilities(t),queryRelated:this._readQueryRelatedCapabilities(t),queryTopFeatures:this._readQueryTopFeaturesCapabilities(t),editing:this._readEditingCapabilities(t)}}get createQueryVersion(){return this.commitProperty("definitionExpression"),this.commitProperty("dynamicDataSource"),this.commitProperty("timeExtent"),this.commitProperty("timeOffset"),this.commitProperty("geometryType"),this.commitProperty("gdbVersion"),this.commitProperty("historicMoment"),this.commitProperty("returnZ"),this.commitProperty("capabilities"),this.commitProperty("returnM"),(this._get("createQueryVersion")||0)+1}get editingEnabled(){return!(this.loaded&&!this.capabilities.operations.supportsEditing)&&(this._isOverridden("editingEnabled")?this._get("editingEnabled"):this._hasMemorySource()||this.userHasEditingPrivileges)}set editingEnabled(e){null!=e?this._override("editingEnabled",e):this._clearOverride("editingEnabled")}readEditingEnabled(e,t){return this._readEditingEnabled(t,!1)}readEditingEnabledFromWebMap(e,t,r){return this._readEditingEnabled(t,!0,r)}writeEditingEnabled(e,t){this._writeEditingEnabled(e,t,!1)}writeEditingEnabledToWebMap(e,t,r,i){this._writeEditingEnabled(e,t,!0,i)}readEditingInfo(e,t){const{editingInfo:r}=t;return r?{lastEditDate:null!=r.lastEditDate?new Date(r.lastEditDate):null}:null}readIsTable(e,t){return"Table"===(t=t&&t.layerDefinition||t).type||!t.geometryType}writeIsTable(e,t,r,i){i?.writeLayerSchema&&v(r,e?"Table":"Feature Layer",t)}readMinScale(e,t){return t.effectiveMinScale||e||0}readMaxScale(e,t){return t.effectiveMaxScale||e||0}readGlobalIdFieldFromService(e,t){if((t=t.layerDefinition||t).globalIdField)return t.globalIdField;if(t.fields)for(const r of t.fields)if("esriFieldTypeGlobalID"===r.type)return r.name}readObjectIdFieldFromService(e,t){if((t=t.layerDefinition||t).objectIdField)return t.objectIdField;if(t.fields)for(const r of t.fields)if("esriFieldTypeOID"===r.type)return r.name}get parsedUrl(){const e=this.url?T(this.url):null;return null!=e&&(null!=this.dynamicDataSource?e.path=E(e.path,"dynamicLayer"):null!=this.layerId&&(e.path=E(e.path,this.layerId.toString()))),e}get defaultPopupTemplate(){return this.createPopupTemplate()}set renderer(e){ge(e,this.fieldsIndex),this._set("renderer",e)}readRenderer(e,t,s){const a=(t=t.layerDefinition||t).drawingInfo&&t.drawingInfo.renderer||void 0;if(a){const e=o(a,t,s)||void 0;return e||Ge.error("Failed to create renderer",{rendererDefinition:t.drawingInfo.renderer,layer:this,context:s}),e}if(t.defaultSymbol)return t.types&&t.types.length?new i({defaultSymbol:$e(t.defaultSymbol,t,s),field:t.typeIdField,uniqueValueInfos:t.types.map((e=>({id:e.id,symbol:$e(e.symbol,e,s)})))}):new r({symbol:$e(t.defaultSymbol,t,s)})}set source(e){const t=this._get("source");t!==e&&(ze(t)&&this._resetMemorySource(t),ze(e)&&this._initMemorySource(e),this._set("source",e))}castSource(e){return e?Array.isArray(e)||e instanceof d?new Q({layer:this,items:e}):e:null}readSource(e,t){const r=Ae.fromJSON(t.featureSet);return new Q({layer:this,items:r&&r.features||[]})}readServiceDefinitionExpression(e,t){return t.definitionQuery||t.definitionExpression}readTemplates(e,t){const r=t.editFieldsInfo,i=r&&r.creatorField,o=r&&r.editorField;return e=e&&e.map((e=>me.fromJSON(e))),this._fixTemplates(e,i),this._fixTemplates(e,o),e}readTitle(e,t){const r=t.layerDefinition&&t.layerDefinition.name||t.name,i=t.title||t.layerDefinition&&t.layerDefinition.title;if(r){const e=this.portalItem&&this.portalItem.title;if("item-title"===this.sublayerTitleMode)return this.url?$(this.url,r):r;let t=r;if(!t&&this.url){const e=K(this.url);g(e)&&(t=e.title)}if(!t)return;return"item-title-and-service-name"===this.sublayerTitleMode&&e&&e!==t&&(t=e+" - "+t),X(t)}if("item-title"===this.sublayerTitleMode&&i)return i}readTitleFromWebMap(e,t){return t.title||t.layerDefinition&&t.layerDefinition.name}readTypeIdField(e,t){let r=(t=t.layerDefinition||t).typeIdField;if(r&&t.fields){r=r.toLowerCase();const e=t.fields.find((e=>e.name.toLowerCase()===r));e&&(r=e.name)}return r}readTypes(e,t){e=(t=t.layerDefinition||t).types;const r=t.editFieldsInfo,i=r&&r.creatorField,o=r&&r.editorField;return e&&e.map((e=>(e=fe.fromJSON(e),this._fixTemplates(e.templates,i),this._fixTemplates(e.templates,o),e)))}set url(e){const t=Y({layer:this,url:e,nonStandardUrlAllowed:!0,logger:Ge});this._set("url",t.url),null!=t.layerId&&this._set("layerId",t.layerId)}writeUrl(e,t,r,i){ee(this,e,null,t,i)}readVersion(e,t){return t.currentVersion?t.currentVersion:t.hasOwnProperty("capabilities")||t.hasOwnProperty("drawingInfo")||t.hasOwnProperty("hasAttachments")||t.hasOwnProperty("htmlPopupType")||t.hasOwnProperty("relationships")||t.hasOwnProperty("timeInfo")||t.hasOwnProperty("typeIdField")||t.hasOwnProperty("types")?10:9.3}readVisible(e,t){return t.layerDefinition&&null!=t.layerDefinition.defaultVisibility?!!t.layerDefinition.defaultVisibility:null!=t.visibility?!!t.visibility:void 0}addAttachment(e,t){return this.load().then((()=>this._checkAttachmentSupport(e))).then((()=>{if(!("addAttachment"in this.source))throw new c(Qe,"Layer source does not support addAttachment capability");return this.source.addAttachment(e,t)}))}updateAttachment(e,t,r){return this.load().then((()=>this._checkAttachmentSupport(e))).then((()=>{if(!("updateAttachment"in this.source))throw new c(Qe,"Layer source does not support updateAttachment capability");return this.source.updateAttachment(e,t,r)}))}async applyEdits(e,t){const r=await import("./graphics/editingSupport.js");return await this.load(),r.applyEdits(this,this.source,e,t)}on(e,t){return super.on(e,t)}createPopupTemplate(e){return _e(this,e)}async createGraphicsSource(e){if(this._hasMemorySource())return this.source.load({signal:e});const{default:t}=await F(import("./graphics/sources/FeatureLayerSource.js"),e);return new t({layer:this}).load({signal:e})}createQuery(){const e=new Me,t=this.get("capabilities.data"),r=this.get("capabilities.query");e.dynamicDataSource=this.dynamicDataSource,e.historicMoment=this.historicMoment,e.gdbVersion=this.gdbVersion,e.returnGeometry=!0,r&&(e.compactGeometryEnabled=r.supportsCompactGeometry,e.defaultSpatialReferenceEnabled=r.supportsDefaultSpatialReference),t&&(t.supportsZ&&null!=this.returnZ&&(e.returnZ=this.returnZ),t.supportsM&&null!=this.returnM&&(e.returnM=this.returnM)),e.outFields=["*"];const i=g(this.subtypeCode)?`${this.subtypeField} = ${this.subtypeCode}`:null,o=I(this.definitionExpression,i);e.where=o||"1=1";const{timeOffset:s,timeExtent:a}=this;return e.timeExtent=null!=s&&null!=a?a.offset(-s.value,s.unit):a||null,e.multipatchOption="multipatch"===this.geometryType?"xyFootprint":null,e}deleteAttachments(e,t){return this.load().then((()=>this._checkAttachmentSupport(e))).then((()=>{if(!("deleteAttachments"in this.source))throw new c(Qe,"Layer source does not support deleteAttachments capability");return this.source.deleteAttachments(e,t)}))}fetchRecomputedExtents(e){return this.load({signal:e?.signal}).then((()=>{if(this.source.fetchRecomputedExtents)return this.source.fetchRecomputedExtents(e);throw new c(Qe,"Layer source does not support fetchUpdates capability")}))}getFeatureType(e){const{typeIdField:t,types:r}=this;if(!t||!e)return null;const i=e.attributes?e.attributes[t]:void 0;if(null==i)return null;let o=null;return r.some((e=>{const{id:t}=e;return null!=t&&(t.toString()===i.toString()&&(o=e),!!o)})),o}getFieldDomain(e,t){const r=t&&t.feature,i=this.getFeatureType(r);if(i){const t=i.domains&&i.domains[e];if(t&&"inherited"!==t.type)return t}return this._getLayerDomain(e)}getField(e){return this.fieldsIndex.get(e)}queryAttachments(e,t){return e=Ce.from(e),this.load().then((()=>{if(!this.get("capabilities.data.supportsAttachment"))throw new c(Qe,"this layer doesn't support attachments");const{attachmentTypes:t,objectIds:r,globalIds:i,num:o,size:s,start:a,where:n}=e;if(!this.get("capabilities.operations.supportsQueryAttachments")){const p=r&&r.length>1,l=t&&t.length,u=i&&i.length,d=s&&s.length;if(p||l||u||d||o||a||n)throw new c(Qe,"when 'supportsQueryAttachments' is false, only objectIds of length 1 are supported",e)}if(!(r&&r.length||n))throw new c(Qe,"'objectIds' or 'where' are required to perform attachment query",e);if(!("queryAttachments"in this.source))throw new c(Qe,"Layer source does not support queryAttachments capability",e);return this.source.queryAttachments(e)}))}queryFeatures(e,t){return this.load().then((()=>this.source.queryFeatures(Me.from(e)||this.createQuery(),t))).then((e=>{if(e?.features)for(const t of e.features)t.layer=t.sourceLayer=this;return e}))}queryObjectIds(e,t){return this.load().then((()=>{if(this.source.queryObjectIds)return this.source.queryObjectIds(Me.from(e)||this.createQuery(),t);throw new c(Qe,"Layer source does not support queryObjectIds capability")}))}queryFeatureCount(e,t){return this.load().then((()=>{if(this.source.queryFeatureCount)return this.source.queryFeatureCount(Me.from(e)||this.createQuery(),t);throw new c(Qe,"Layer source does not support queryFeatureCount capability")}))}queryExtent(e,t){return this.load().then((()=>{if(this.source.queryExtent)return this.source.queryExtent(Me.from(e)||this.createQuery(),t);throw new c(Qe,"Layer source does not support queryExtent capability")}))}queryRelatedFeatures(e,t){return this.load().then((()=>{if("queryRelatedFeatures"in this.source)return this.source.queryRelatedFeatures(Le.from(e),t);throw new c(Qe,"Layer source does not support queryRelatedFeatures capability")}))}queryRelatedFeaturesCount(e,t){return this.load().then((()=>{if("queryRelatedFeaturesCount"in this.source)return this.source.queryRelatedFeaturesCount(Le.from(e),t);throw new c(Qe,"Layer source does not support queryRelatedFeaturesCount capability")}))}queryTopFeatures(e,t){return this.load().then((()=>{if("queryTopFeatures"in this.source&&this.get("capabilities.query.supportsTopFeaturesQuery"))return this.source.queryTopFeatures(Re.from(e),t).then((e=>{if(e?.features)for(const t of e.features)t.layer=t.sourceLayer=this;return e}));throw new c(Qe,"Layer source does not support queryTopFeatures capability")}))}queryTopObjectIds(e,t){return this.load().then((()=>{if("queryTopObjectIds"in this.source&&this.get("capabilities.query.supportsTopFeaturesQuery"))return this.source.queryTopObjectIds(Re.from(e),t);throw new c(Qe,"Layer source does not support queryTopObjectIds capability")}))}queryTopFeaturesExtent(e,t){return this.load().then((()=>{if("queryTopExtents"in this.source&&this.get("capabilities.query.supportsTopFeaturesQuery"))return this.source.queryTopExtents(Re.from(e),t);throw new c(Qe,"Layer source does not support queryTopExtents capability")}))}queryTopFeatureCount(e,t){return this.load().then((()=>{if("queryTopCount"in this.source&&this.get("capabilities.query.supportsTopFeaturesQuery"))return this.source.queryTopCount(Re.from(e),t);throw new c(Qe,"Layer source does not support queryFeatureCount capability")}))}read(e,t){const r=e.featureCollection;if(r){const e=r.layers;e&&1===e.length&&(super.read(e[0],t),null!=r.showLegend&&super.read({showLegend:r.showLegend},t))}super.read(e,t),t&&"service"===t.origin&&this.revert(["objectIdField","fields","timeInfo","spatialReference"],"service")}write(e,t){t={...t,writeLayerSchema:t?.writeLayerSchema??this._hasMemorySource()};const{origin:r,layerContainerType:i,messages:o}=t;if(this.dynamicDataSource)return o?.push(Ve(this,"using a dynamic data source cannot be written to web scenes, web maps and feature service items")),null;if(this.isTable){if("web-scene"===r||"web-map"===r&&"tables"!==i)return o?.push(Ve(this,"using a table source cannot be written to web scenes and web maps")),null;if(this._hasMemorySource())return o?.push(Ve(this,"using an in-memory table source cannot be written to web scenes and web maps")),null}else if(this.loaded&&"web-map"===r&&"tables"===i)return o?.push(Ve(this,"using a non-table source cannot be written to tables in web maps")),null;return super.write(e,t)}clone(){if(this._hasMemorySource())throw new c(Qe,`FeatureLayer (title: ${this.title}, id: ${this.id}) created using in-memory source cannot be cloned`);return super.clone()}serviceSupportsSpatialReference(e){return!!this.loaded&&("memory"===this.source.type||Ee(this,e))}async save(e){return(await import("./save/featureLayerUtils.js")).save(this,e)}async saveAs(e,t){return(await import("./save/featureLayerUtils.js")).saveAs(this,e,t)}_readEditingEnabled(e,t,r){let i=e.layerDefinition?.capabilities;return i?this._hasEditingCapability(i):(i=e.capabilities,t&&"web-map"===r?.origin&&!this._hasMemorySource()&&i?this._hasEditingCapability(i):void 0)}_hasEditingCapability(e){return e.toLowerCase().split(",").map((e=>e.trim())).includes("editing")}_writeEditingEnabled(e,t,r,i){if(!e){const e=this.capabilities?.operations?.supportsSync?"Query,Sync":"Query";v("layerDefinition.capabilities",e,t),r&&!i?.writeLayerSchema&&(t.capabilities=e)}}_checkAttachmentSupport(e){const{attributes:t}=e,{objectIdField:r}=this;return this.get("capabilities.data.supportsAttachment")?e?t?t[r]?void 0:Promise.reject(new c(Qe,`feature is missing the identifying attribute ${r}`)):Promise.reject(new c(Qe,"'attributes' are required on a feature to query attachments")):Promise.reject(new c(Qe,"A feature is required to add/delete/update attachments")):Promise.reject(new c(Qe,"this layer doesn't support attachments"))}_getLayerDomain(e){const t=this.fieldsIndex.get(e);return t?t.domain:null}_fetchFirstLayerId(e){return n(this.url,{query:{f:"json",...this.customParameters,token:this.apiKey},responseType:"json",signal:e}).then((e=>{const t=e.data;if(t)return Array.isArray(t.layers)&&t.layers.length>0?t.layers[0].id:Array.isArray(t.tables)&&t.tables.length>0?t.tables[0].id:void 0}))}async _initLayerProperties(e){return this._set("source",e),e.sourceJSON&&(this.sourceJSON=e.sourceJSON,this.read(e.sourceJSON,{origin:"service",url:this.parsedUrl})),this._verifySource(),this._verifyFields(),ge(this.renderer,this.fieldsIndex),we(this.timeInfo,this.fieldsIndex),De(this,{origin:"service"})}async hasDataChanged(){if(this.source?.refresh)try{const{dataChanged:e,updates:t}=await(this.source?.refresh());if(g(t)&&(this.sourceJSON={...this.sourceJSON,...t},this.read(t,{origin:"service",url:this.parsedUrl})),e)return!0}catch{}if(this.definitionExpression)try{return(await j(this.definitionExpression,this.fieldsIndex)).hasDateFunctions}catch{}return!1}_verifyFields(){const e=this.parsedUrl&&this.parsedUrl.path||"undefined";this.objectIdField||console.log("FeatureLayer: 'objectIdField' property is not defined (url: "+e+")"),this.isTable||this._hasMemorySource()||-1!==e.search(/\/FeatureServer\//i)||this.fields?.some((e=>"geometry"===e.type))||console.log("FeatureLayer: unable to find field of type 'geometry' in the layer 'fields' list. If you are using a map service layer, features will not have geometry (url: "+e+")")}_fixTemplates(e,t){e&&e.forEach((e=>{const r=e.prototype&&e.prototype.attributes;r&&t&&delete r[t]}))}_verifySource(){if(this._hasMemorySource()){if(this.url)throw new c("feature-layer:mixed-source-and-url","FeatureLayer cannot be created with both an in-memory source and a url")}else if(!this.url)throw new c("feature-layer:source-or-url-required","FeatureLayer requires either a url, a valid portal item or a source")}_initMemorySource(e){e.forEach((e=>{e.layer=this,e.sourceLayer=this})),this._handles.add([e.on("after-add",(e=>{e.item.layer=this,e.item.sourceLayer=this})),e.on("after-remove",(e=>{e.item.layer=null,e.item.sourceLayer=null}))],"fl-source")}_resetMemorySource(e){e.forEach((e=>{e.layer=null,e.sourceLayer=null})),this._handles.remove("fl-source")}_hasMemorySource(){return!(this.url||!this.source)}_readAnalyticsCapabilities(e){return{supportsCacheHint:We(e.advancedQueryCapabilities,"queryAnalytics")}}_readAttachmentCapabilities(e){const t=e.attachmentProperties,r={supportsName:!1,supportsSize:!1,supportsContentType:!1,supportsKeywords:!1,supportsExifInfo:!1,supportsCacheHint:We(e.advancedQueryCapabilities,"queryAttachments"),supportsResize:Be(e,"supportsAttachmentsResizing",!1)};return t&&Array.isArray(t)&&t.forEach((e=>{const t=qe[e.name];t&&(r[t]=!!e.isEnabled)})),r}_readDataCapabilities(e){return{isVersioned:Be(e,"isDataVersioned",!1),supportsAttachment:Be(e,"hasAttachments",!1),supportsM:Be(e,"hasM",!1),supportsZ:Be(e,"hasZ",!1)}}_readMetadataCapabilities(e){return{supportsAdvancedFieldProperties:Be(e,"supportsFieldDescriptionProperty",!1)}}_readOperationsCapabilities(e,t){const r=e?e.toLowerCase().split(",").map((e=>e.trim())):[],i=this.url?K(this.url):null,o=r.includes(g(i)&&"MapServer"===i.serverType?"data":"query"),s=r.includes("editing")&&!t.datesInUnknownTimezone;let a=s&&r.includes("create"),n=s&&r.includes("delete"),p=s&&r.includes("update");const l=r.includes("changetracking"),u=t.advancedQueryCapabilities;return s&&!(a||n||p)&&(a=n=p=!0),{supportsCalculate:Be(t,"supportsCalculate",!1),supportsTruncate:Be(t,"supportsTruncate",!1),supportsValidateSql:Be(t,"supportsValidateSql",!1),supportsAdd:a,supportsDelete:n,supportsEditing:s,supportsChangeTracking:l,supportsQuery:o,supportsQueryAnalytics:Be(u,"supportsQueryAnalytic",!1),supportsQueryAttachments:Be(u,"supportsQueryAttachments",!1),supportsQueryTopFeatures:Be(u,"supportsTopFeaturesQuery",!1),supportsResizeAttachments:Be(t,"supportsAttachmentsResizing",!1),supportsSync:r.includes("sync"),supportsUpdate:p,supportsExceedsLimitStatistics:Be(t,"supportsExceedsLimitStatistics",!1)}}_readQueryCapabilities(e){const t=e.advancedQueryCapabilities,r=e.ownershipBasedAccessControlForFeatures,i=e.archivingInfo,o=this.url?.includes("MapServer"),s=!has("mapserver-pbf-enabled")&&o&&this.version<10.81,a=te(this.url),n=(e.supportedQueryFormats||"").split(",").reduce(((e,t)=>{const r=t.toLowerCase().trim();return r&&e.add(r),e}),new Set);return{supportsStatistics:Be(t,"supportsStatistics",e.supportsStatistics),supportsPercentileStatistics:Be(t,"supportsPercentileStatistics",!1),supportsSpatialAggregationStatistics:Be(t,"supportsSpatialAggregationStatistics",!1),supportedSpatialAggregationStatistics:Ne(t),supportsCentroid:Be(t,"supportsReturningGeometryCentroid",!1),supportsDistance:Be(t,"supportsQueryWithDistance",!1),supportsDistinct:Be(t,"supportsDistinct",e.supportsAdvancedQueries),supportsExtent:Be(t,"supportsReturningQueryExtent",!1),supportsGeometryProperties:Be(t,"supportsReturningGeometryProperties",!1),supportsHavingClause:Be(t,"supportsHavingClause",!1),supportsOrderBy:Be(t,"supportsOrderBy",e.supportsAdvancedQueries),supportsPagination:Be(t,"supportsPagination",!1),supportsQuantization:Be(e,"supportsCoordinatesQuantization",!1),supportsQuantizationEditMode:Be(e,"supportsQuantizationEditMode",!1),supportsQueryGeometry:Be(e,"supportsReturningQueryGeometry",!1),supportsResultType:Be(t,"supportsQueryWithResultType",!1),supportsMaxRecordCountFactor:Be(t,"supportsMaxRecordCountFactor",!1),supportsSqlExpression:Be(t,"supportsSqlExpression",!1),supportsStandardizedQueriesOnly:Be(e,"useStandardizedQueries",!1),supportsTopFeaturesQuery:Be(t,"supportsTopFeaturesQuery",!1),supportsQueryByOthers:Be(r,"allowOthersToQuery",!0),supportsHistoricMoment:Be(i,"supportsQueryWithHistoricMoment",!1),supportsFormatPBF:!s&&n.has("pbf"),supportsDisjointSpatialRelationship:Be(t,"supportsDisjointSpatialRel",!1),supportsCacheHint:Be(t,"supportsQueryWithCacheHint",!1)||We(t,"query"),supportsDefaultSpatialReference:Be(t,"supportsDefaultSR",!1),supportsCompactGeometry:a,maxRecordCountFactor:ke(e,"maxRecordCountFactor",void 0),maxRecordCount:ke(e,"maxRecordCount",void 0),standardMaxRecordCount:ke(e,"standardMaxRecordCount",void 0),tileMaxRecordCount:ke(e,"tileMaxRecordCount",void 0)}}_readQueryRelatedCapabilities(e){const t=e.advancedQueryCapabilities,r=Be(t,"supportsAdvancedQueryRelated",!1);return{supportsPagination:Be(t,"supportsQueryRelatedPagination",!1),supportsCount:r,supportsOrderBy:r,supportsCacheHint:We(t,"queryRelated")}}_readQueryTopFeaturesCapabilities(e){return{supportsCacheHint:We(e.advancedQueryCapabilities,"queryTopFilter")}}_readEditingCapabilities(e){const t=e.ownershipBasedAccessControlForFeatures;return{supportsGeometryUpdate:Be(e,"allowGeometryUpdates",!0),supportsGlobalId:Be(e,"supportsApplyEditsWithGlobalIds",!1),supportsReturnServiceEditsInSourceSpatialReference:Be(e,"supportsReturnServiceEditsInSourceSR",!1),supportsRollbackOnFailure:Be(e,"supportsRollbackOnFailureParameter",!1),supportsUpdateWithoutM:Be(e,"allowUpdateWithoutMValues",!1),supportsUploadWithItemId:Be(e,"supportsAttachmentsByUploadId",!1),supportsDeleteByAnonymous:Be(t,"allowAnonymousToDelete",!0),supportsDeleteByOthers:Be(t,"allowOthersToDelete",!0),supportsUpdateByAnonymous:Be(t,"allowAnonymousToUpdate",!0),supportsUpdateByOthers:Be(t,"allowOthersToUpdate",!0)}}};e([x({readOnly:!0,json:{read:!1}})],Ze.prototype,"capabilities",void 0),e([C("service","capabilities",["advancedQueryCapabilities","allowGeometryUpdates","allowUpdateWithoutMValues","archivingInfo","capabilities","datesInUnknownTimezone","hasAttachments","hasM","hasZ","maxRecordCount","maxRecordCountFactor","ownershipBasedAccessControlForFeatures","standardMaxRecordCount","supportedQueryFormats","supportsAdvancedQueries","supportsApplyEditsWithGlobalIds","supportsAttachmentsByUploadId","supportsAttachmentsResizing","supportsCalculate","supportsCoordinatesQuantization","supportsExceedsLimitStatistics","supportsFieldDescriptionProperty","supportsQuantizationEditMode","supportsRollbackOnFailureParameter","supportsStatistics","supportsTruncate","supportsValidateSql","tileMaxRecordCount","useStandardizedQueries"])],Ze.prototype,"readCapabilities",null),e([x({json:{origins:{"portal-item":{write:!0},"web-map":{write:!0}}}})],Ze.prototype,"charts",void 0),e([x({readOnly:!0})],Ze.prototype,"createQueryVersion",null),e([x({type:String,json:{read:{source:"layerDefinition.copyrightText"},origins:{service:{read:{source:"copyrightText"}}}}})],Ze.prototype,"copyright",void 0),e([x({type:Boolean})],Ze.prototype,"datesInUnknownTimezone",void 0),e([x({type:String,json:{read:{source:"layerDefinition.displayField"},origins:{service:{read:{source:"displayField"}}}}})],Ze.prototype,"displayField",void 0),e([x({type:String,json:{origins:{service:{read:!1,write:!1}},name:"layerDefinition.definitionExpression",write:{enabled:!0,allowNull:!0}}})],Ze.prototype,"definitionExpression",void 0),e([x({types:p,readOnly:!0})],Ze.prototype,"defaultSymbol",void 0),e([x({type:xe})],Ze.prototype,"dynamicDataSource",void 0),e([x({readOnly:!0})],Ze.prototype,"editFieldsInfo",void 0),e([x({type:Boolean})],Ze.prototype,"editingEnabled",null),e([C(["portal-item","web-scene"],"editingEnabled",["layerDefinition.capabilities"])],Ze.prototype,"readEditingEnabled",null),e([C("web-map","editingEnabled",["capabilities","layerDefinition.capabilities"])],Ze.prototype,"readEditingEnabledFromWebMap",null),e([M(["portal-item","web-scene"],"editingEnabled",{"layerDefinition.capabilities":{type:String}})],Ze.prototype,"writeEditingEnabled",null),e([M("web-map","editingEnabled",{capabilities:{type:String},"layerDefinition.capabilities":{type:String}})],Ze.prototype,"writeEditingEnabledToWebMap",null),e([x({readOnly:!0})],Ze.prototype,"editingInfo",void 0),e([C("editingInfo")],Ze.prototype,"readEditingInfo",null),e([x((()=>{const e=m(le),t=e.json.origins;return t["web-map"]={read:!1,write:!1},t["portal-item"]={read:!1,write:!1},e})())],Ze.prototype,"elevationInfo",void 0),e([x(he)],Ze.prototype,"featureReduction",void 0),e([x({...He.fields,json:{read:{source:"layerDefinition.fields"},origins:{service:{name:"fields"},"web-map":{write:{target:"layerDefinition.fields",overridePolicy:Je}}}}})],Ze.prototype,"fields",void 0),e([x(He.fieldsIndex)],Ze.prototype,"fieldsIndex",void 0),e([x({type:Ie,json:{read:{source:"layerDefinition.floorInfo"},write:{target:"layerDefinition.floorInfo"}}})],Ze.prototype,"floorInfo",void 0),e([x({type:R,json:{name:"formInfo",write:!0,origins:{"web-scene":{read:!1,write:!1}}}})],Ze.prototype,"formTemplate",void 0),e([x({type:_,json:{origins:{service:{read:{source:"extent"}}},read:{source:"layerDefinition.extent"}}})],Ze.prototype,"fullExtent",void 0),e([x()],Ze.prototype,"gdbVersion",void 0),e([x({readOnly:!0,type:ve,json:{read:{source:"geometryProperties"}}})],Ze.prototype,"geometryFieldsInfo",void 0),e([x({type:["point","polygon","polyline","multipoint","multipatch","mesh"],json:{origins:{service:{read:Pe.read},"web-map":{write:{target:"layerDefinition.geometryType",overridePolicy:Je,writer(e,t,r){const i=e?Pe.toJSON(e):null;i&&v(r,i,t)}}}},read:{source:"layerDefinition.geometryType",reader:Pe.read}}})],Ze.prototype,"geometryType",void 0),e([x({type:Boolean,json:{origins:{service:{read:!0}},read:{source:"layerDefinition.hasM"}}})],Ze.prototype,"hasM",void 0),e([x({type:Boolean,json:{origins:{service:{read:!0}},read:{source:"layerDefinition.hasZ"}}})],Ze.prototype,"hasZ",void 0),e([x({readOnly:!0,type:O})],Ze.prototype,"heightModelInfo",void 0),e([x({type:Date})],Ze.prototype,"historicMoment",void 0),e([x(re)],Ze.prototype,"id",void 0),e([x({readOnly:!0,json:{origins:{service:{read:!0}},read:!1}})],Ze.prototype,"infoFor3D",void 0),e([x({readOnly:!0,json:{origins:{"web-map":{write:{target:"layerDefinition.type"}}}}})],Ze.prototype,"isTable",void 0),e([C("service","isTable",["type","geometryType"]),C("isTable",["layerDefinition.type","layerDefinition.geometryType"])],Ze.prototype,"readIsTable",null),e([M("web-map","isTable")],Ze.prototype,"writeIsTable",null),e([x(ie)],Ze.prototype,"labelsVisible",void 0),e([x({type:[Se],json:{origins:{service:{read:{source:"drawingInfo.labelingInfo",reader:Fe},write:{target:"drawingInfo.labelingInfo",enabled:!1}}},read:{source:"layerDefinition.drawingInfo.labelingInfo",reader:Fe},write:{target:"layerDefinition.drawingInfo.labelingInfo"}}})],Ze.prototype,"labelingInfo",void 0),e([x((()=>{const e=m(ue);return e.json.origins["portal-item"]={write:{target:"layerDefinition.drawingInfo.transparency",writer(e,t,r){v(r,Oe(e),t)}}},e})())],Ze.prototype,"opacity",void 0),e([x({type:Number,json:{origins:{service:{read:{source:"id"}},"portal-item":{read:!1,write:{target:"id"}}},read:!1}})],Ze.prototype,"layerId",void 0),e([x(oe)],Ze.prototype,"legendEnabled",void 0),e([x({type:["show","hide"],json:(()=>{const e=m(de.json);return e.origins["portal-item"]={read:!1,write:!1},e})()})],Ze.prototype,"listMode",void 0),e([x(se)],Ze.prototype,"minScale",void 0),e([C("service","minScale",["minScale","effectiveMinScale"])],Ze.prototype,"readMinScale",null),e([x(ae)],Ze.prototype,"maxScale",void 0),e([C("service","maxScale",["maxScale","effectiveMaxScale"])],Ze.prototype,"readMaxScale",null),e([x({type:String})],Ze.prototype,"globalIdField",void 0),e([C("globalIdField",["layerDefinition.globalIdField","layerDefinition.fields"]),C("service","globalIdField",["globalIdField","fields"])],Ze.prototype,"readGlobalIdFieldFromService",null),e([x({type:String,json:{origins:{"web-map":{write:{target:"layerDefinition.objectIdField",overridePolicy:Je}}}}})],Ze.prototype,"objectIdField",void 0),e([C("objectIdField",["layerDefinition.objectIdField","layerDefinition.fields"]),C("service","objectIdField",["objectIdField","fields"])],Ze.prototype,"readObjectIdFieldFromService",null),e([x({value:"ArcGISFeatureLayer",type:["ArcGISFeatureLayer"]})],Ze.prototype,"operationalLayerType",void 0),e([x(He.outFields)],Ze.prototype,"outFields",void 0),e([x({readOnly:!0})],Ze.prototype,"parsedUrl",null),e([x({type:String,json:{origins:{"web-scene":{read:!0,write:!0}},read:!1}})],Ze.prototype,"path",void 0),e([x(ne)],Ze.prototype,"popupEnabled",void 0),e([x({type:t,json:{name:"popupInfo",write:!0}})],Ze.prototype,"popupTemplate",void 0),e([x({readOnly:!0})],Ze.prototype,"defaultPopupTemplate",null),e([x({type:[je],readOnly:!0})],Ze.prototype,"relationships",void 0),e([x({types:s,json:{origins:{service:{write:{target:"drawingInfo.renderer",enabled:!1}},"web-scene":{types:a,name:"layerDefinition.drawingInfo.renderer",write:{overridePolicy:(e,t,r)=>({ignoreOrigin:r?.writeLayerSchema})}}},write:{target:"layerDefinition.drawingInfo.renderer",overridePolicy:(e,t,r)=>({ignoreOrigin:r?.writeLayerSchema})}}})],Ze.prototype,"renderer",null),e([C("service","renderer",["drawingInfo.renderer","defaultSymbol"]),C("renderer",["layerDefinition.drawingInfo.renderer","layerDefinition.defaultSymbol"])],Ze.prototype,"readRenderer",null),e([x()],Ze.prototype,"sourceJSON",void 0),e([x({type:Boolean})],Ze.prototype,"returnM",void 0),e([x({type:Boolean})],Ze.prototype,"returnZ",void 0),e([x((()=>{const e=m(ce);return e.json.origins["portal-item"]={read:!1,write:!1},e})())],Ze.prototype,"screenSizePerspectiveEnabled",void 0),e([x({clonable:!1})],Ze.prototype,"source",null),e([D("source")],Ze.prototype,"castSource",null),e([C("portal-item","source",["featureSet"]),C("web-map","source",["featureSet"])],Ze.prototype,"readSource",null),e([x({readOnly:!0})],Ze.prototype,"serviceDefinitionExpression",void 0),e([C("service","serviceDefinitionExpression",["definitionQuery","definitionExpression"])],Ze.prototype,"readServiceDefinitionExpression",null),e([x({type:P,json:{origins:{service:{read:{source:"extent.spatialReference"}}},read:{source:"layerDefinition.extent.spatialReference"}}})],Ze.prototype,"spatialReference",void 0),e([x({type:Number})],Ze.prototype,"subtypeCode",void 0),e([x({type:String,json:{origins:{service:{read:!0}}}})],Ze.prototype,"subtypeField",void 0),e([x({type:[me]})],Ze.prototype,"templates",void 0),e([C("templates",["editFieldsInfo","creatorField","editorField","templates"])],Ze.prototype,"readTemplates",null),e([x({type:Te})],Ze.prototype,"timeInfo",void 0),e([x()],Ze.prototype,"title",void 0),e([C("service","title",["name"]),C("portal-item","title",["layerDefinition.title","layerDefinition.name","title"])],Ze.prototype,"readTitle",null),e([C("web-map","title",["layerDefinition.name","title"])],Ze.prototype,"readTitleFromWebMap",null),e([x({type:String})],Ze.prototype,"sublayerTitleMode",void 0),e([x({type:String,json:{read:{source:"timeInfo.trackIdField"}}})],Ze.prototype,"trackIdField",void 0),e([x({json:{read:!1}})],Ze.prototype,"type",void 0),e([x({type:String})],Ze.prototype,"typeIdField",void 0),e([C("service","typeIdField"),C("typeIdField",["layerDefinition.typeIdField"])],Ze.prototype,"readTypeIdField",null),e([x({type:[fe]})],Ze.prototype,"types",void 0),e([C("service","types",["types"]),C("types",["layerDefinition.types"])],Ze.prototype,"readTypes",null),e([x({readOnly:!0,json:{write:!1}})],Ze.prototype,"serverGens",void 0),e([x({type:d.ofType(ye),readOnly:!0})],Ze.prototype,"indexes",void 0),e([x(pe)],Ze.prototype,"url",null),e([M("url")],Ze.prototype,"writeUrl",null),e([x({readOnly:!0})],Ze.prototype,"userIsAdmin",void 0),e([x({json:{origins:{service:{read:!0}},read:!1}})],Ze.prototype,"version",void 0),e([C("service","version",["currentVersion","capabilities","drawingInfo","hasAttachments","htmlPopupType","relationships","timeInfo","typeIdField","types"])],Ze.prototype,"readVersion",null),e([x({type:Boolean,json:{origins:{"portal-item":{write:{target:"layerDefinition.defaultVisibility"}}}}})],Ze.prototype,"visible",void 0),e([C("portal-item","visible",["visibility","layerDefinition.defaultVisibility"])],Ze.prototype,"readVisible",null),Ze=e([A(Ue)],Ze);const $e=L({types:l}),Ke=Ze;export{Ke as default};
5
+ import{_ as e}from"../chunks/tslib.es6.js";import t from"../PopupTemplate.js";import"../renderers/ClassBreaksRenderer.js";import"../renderers/DictionaryRenderer.js";import"../renderers/DotDensityRenderer.js";import"../renderers/HeatmapRenderer.js";import"../renderers/PieChartRenderer.js";import"../renderers/Renderer.js";import r from"../renderers/SimpleRenderer.js";import i from"../renderers/UniqueValueRenderer.js";import{read as o}from"../renderers/support/jsonUtils.js";import{rendererTypes as s,webSceneRendererTypes as a}from"../renderers/support/types.js";import n from"../request.js";import{symbolTypes as p,symbolTypesRenderer as l}from"../symbols.js";import{ClonableMixin as u}from"../core/Clonable.js";import d from"../core/Collection.js";import c from"../core/Error.js";import y from"../core/Handles.js";import has from"../core/has.js";import{JSONMap as h}from"../core/jsonMap.js";import{clone as m}from"../core/lang.js";import f from"../core/Logger.js";import{destroyMaybe as b,isSome as g}from"../core/maybe.js";import{MultiOriginJSONMixin as w}from"../core/MultiOriginJSONSupport.js";import{setDeepValue as v}from"../core/object.js";import{throwIfAbortError as S,whenOrAbort as F}from"../core/promiseUtils.js";import{sqlAnd as I,parseWhereClause as j}from"../core/sql.js";import{urlToObject as T,join as E}from"../core/urlUtils.js";import{property as x}from"../core/accessorSupport/decorators/property.js";import{cast as D}from"../core/accessorSupport/decorators/cast.js";import{reader as C}from"../core/accessorSupport/decorators/reader.js";import{subclass as A}from"../core/accessorSupport/decorators/subclass.js";import{writer as M}from"../core/accessorSupport/decorators/writer.js";import{createTypeReader as L}from"../core/accessorSupport/extensions/serializableProperty/reader.js";import R from"../form/FormTemplate.js";import _ from"../geometry/Extent.js";import O from"../geometry/HeightModelInfo.js";import P from"../geometry/SpatialReference.js";import q from"./Layer.js";import{MemorySource as Q}from"./graphics/sources/MemorySource.js";import{APIKeyMixin as U}from"./mixins/APIKeyMixin.js";import{ArcGISService as G}from"./mixins/ArcGISService.js";import{BlendLayer as V}from"./mixins/BlendLayer.js";import{CustomParametersMixin as z}from"./mixins/CustomParametersMixin.js";import{FeatureEffectLayer as B}from"./mixins/FeatureEffectLayer.js";import{OperationalLayer as k}from"./mixins/OperationalLayer.js";import{OrderedLayer as N}from"./mixins/OrderedLayer.js";import{PortalLayer as W}from"./mixins/PortalLayer.js";import{RefreshableLayer as H}from"./mixins/RefreshableLayer.js";import{ScaleRangeLayer as J}from"./mixins/ScaleRangeLayer.js";import{TemporalLayer as Z}from"./mixins/TemporalLayer.js";import{titleFromUrlAndName as $,parse as K,cleanTitle as X,sanitizeUrlWithLayerId as Y,writeUrlWithLayerId as ee,isHostedAgolService as te}from"./support/arcgisLayerUrl.js";import{elevationInfo as re,id as ie,labelsVisible as oe,opacityDrawingInfo as se,legendEnabled as ae,listMode as ne,minScale as pe,maxScale as le,popupEnabled as ue,screenSizePerspectiveEnabled as de,url as ce}from"./support/commonProperties.js";import{FeatureIndex as ye}from"./support/FeatureIndex.js";import{featureReductionProperty as he}from"./support/featureReductionUtils.js";import me from"./support/FeatureTemplate.js";import fe from"./support/FeatureType.js";import{defineFieldProperties as be}from"./support/fieldProperties.js";import{fixRendererFields as ge,fixTimeInfoFields as we}from"./support/fieldUtils.js";import ve from"./support/GeometryFieldsInfo.js";import Se from"./support/LabelClass.js";import{reader as Fe}from"./support/labelingInfo.js";import Ie from"./support/LayerFloorInfo.js";import je from"./support/Relationship.js";import Te from"./support/TimeInfo.js";import{serviceSupportsSpatialReference as Ee}from"./support/versionUtils.js";import{DataLayerSource as xe}from"./support/source/DataLayerSource.js";import{loadStyleRenderer as De}from"../renderers/support/styleUtils.js";import Ce from"../rest/support/AttachmentQuery.js";import Ae from"../rest/support/FeatureSet.js";import Me from"../rest/support/Query.js";import Le from"../rest/support/RelationshipQuery.js";import Re from"../rest/support/TopFeaturesQuery.js";import{createPopupTemplate as _e}from"../support/popupUtils.js";import{opacityToTransparency as Oe}from"../webdoc/support/opacityUtils.js";const Pe=new h({esriGeometryPoint:"point",esriGeometryMultipoint:"multipoint",esriGeometryPolyline:"polyline",esriGeometryPolygon:"polygon",esriGeometryMultiPatch:"multipatch"}),qe={name:"supportsName",size:"supportsSize",contentType:"supportsContentType",keywords:"supportsKeywords",exifInfo:"supportsExifInfo"},Qe="FeatureLayer",Ue="esri.layers.FeatureLayer",Ge=f.getLogger(Ue);function Ve(e,t){return new c("layer:unsupported",`Layer (${e.title}, ${e.id}) of type '${e.declaredClass}' ${t}`,{layer:e})}function ze(e){return e&&e instanceof d}function Be(e,t,r){return!!(e&&e.hasOwnProperty(t)?e[t]:r)}function ke(e,t,r){return e&&e.hasOwnProperty(t)?e[t]:r}function Ne(e){const t=e?.supportedSpatialAggregationStatistics?.map((e=>e.toLowerCase()));return{envelope:!!t?.includes("envelopeaggregate"),centroid:!!t?.includes("centroidaggregate"),convexHull:!!t?.includes("convexhullaggregate")}}function We(e,t){const r=e?.supportedOperationsWithCacheHint?.map((e=>e.toLowerCase()));return!!r?.includes(t.toLowerCase())}const He=be();function Je(e,t,r){const i=!!r?.writeLayerSchema;return{enabled:i,ignoreOrigin:i}}let Ze=class extends(B(V(N(Z(J(H(G(k(W(w(z(U(u(q)))))))))))))){constructor(...e){super(...e),this._handles=new y,this.capabilities=null,this.charts=null,this.copyright=null,this.datesInUnknownTimezone=!1,this.displayField=null,this.definitionExpression=null,this.dynamicDataSource=null,this.editFieldsInfo=null,this.editingInfo=null,this.elevationInfo=null,this.featureReduction=null,this.fields=null,this.fieldsIndex=null,this.floorInfo=null,this.formTemplate=null,this.fullExtent=null,this.gdbVersion=null,this.geometryFieldsInfo=null,this.geometryType=null,this.hasM=void 0,this.hasZ=void 0,this.heightModelInfo=null,this.historicMoment=null,this.infoFor3D=null,this.isTable=!1,this.labelsVisible=!0,this.labelingInfo=null,this.layerId=void 0,this.legendEnabled=!0,this.minScale=0,this.maxScale=0,this.globalIdField=null,this.objectIdField=null,this.outFields=null,this.path=null,this.popupEnabled=!0,this.popupTemplate=null,this.relationships=null,this.sourceJSON=null,this.returnM=void 0,this.returnZ=void 0,this.screenSizePerspectiveEnabled=!0,this.serviceDefinitionExpression=null,this.spatialReference=P.WGS84,this.subtypeCode=null,this.subtypeField=null,this.templates=null,this.timeInfo=null,this.title=null,this.sublayerTitleMode="item-title",this.trackIdField=null,this.type="feature",this.typeIdField=null,this.types=null,this.indexes=new(d.ofType(ye)),this.userIsAdmin=!1,this.version=void 0,this.visible=!0}destroy(){this.source?.destroy(),this._handles=b(this._handles)}normalizeCtorArgs(e,t){return"string"==typeof e?{url:e,...t}:e}load(e){const t=g(e)?e.signal:null;if(this.portalItem&&this.portalItem.loaded&&this.source)return void this.addResolvingPromise(this.createGraphicsSource(t).then((e=>this._initLayerProperties(e))));const r=this.loadFromPortal({supportedTypes:["Feature Service","Feature Collection"]},e).catch(S).then((async()=>{if(this.url&&null==this.layerId&&/FeatureServer|MapServer\/*$/i.test(this.url)){const e=await this._fetchFirstLayerId(t);null!=e&&(this.layerId=e)}if(!this.url&&!this._hasMemorySource())throw new c("feature-layer:missing-url-or-source","Feature layer must be created with either a url or a source");return this._initLayerProperties(await this.createGraphicsSource(t))})).then((()=>this.finishLoadEditablePortalLayer(e)));return this.addResolvingPromise(r),Promise.resolve(this)}readCapabilities(e,t){return t=t.layerDefinition||t,{analytics:this._readAnalyticsCapabilities(t),attachment:this._readAttachmentCapabilities(t),data:this._readDataCapabilities(t),metadata:this._readMetadataCapabilities(t),operations:this._readOperationsCapabilities(t.capabilities||e,t),query:this._readQueryCapabilities(t),queryRelated:this._readQueryRelatedCapabilities(t),queryTopFeatures:this._readQueryTopFeaturesCapabilities(t),editing:this._readEditingCapabilities(t)}}get createQueryVersion(){return this.commitProperty("definitionExpression"),this.commitProperty("dynamicDataSource"),this.commitProperty("timeExtent"),this.commitProperty("timeOffset"),this.commitProperty("geometryType"),this.commitProperty("gdbVersion"),this.commitProperty("historicMoment"),this.commitProperty("returnZ"),this.commitProperty("capabilities"),this.commitProperty("returnM"),(this._get("createQueryVersion")||0)+1}get editingEnabled(){return!(this.loaded&&!this.capabilities.operations.supportsEditing)&&(this._isOverridden("editingEnabled")?this._get("editingEnabled"):this._hasMemorySource()||this.userHasEditingPrivileges)}set editingEnabled(e){null!=e?this._override("editingEnabled",e):this._clearOverride("editingEnabled")}readEditingEnabled(e,t){return this._readEditingEnabled(t,!1)}readEditingEnabledFromWebMap(e,t,r){return this._readEditingEnabled(t,!0,r)}writeEditingEnabled(e,t){this._writeEditingEnabled(e,t,!1)}writeEditingEnabledToWebMap(e,t,r,i){this._writeEditingEnabled(e,t,!0,i)}readEditingInfo(e,t){const{editingInfo:r}=t;return r?{lastEditDate:null!=r.lastEditDate?new Date(r.lastEditDate):null}:null}readIsTable(e,t){return"Table"===(t=t&&t.layerDefinition||t).type||!t.geometryType}writeIsTable(e,t,r,i){i?.writeLayerSchema&&v(r,e?"Table":"Feature Layer",t)}readMinScale(e,t){return t.effectiveMinScale||e||0}readMaxScale(e,t){return t.effectiveMaxScale||e||0}readGlobalIdFieldFromService(e,t){if((t=t.layerDefinition||t).globalIdField)return t.globalIdField;if(t.fields)for(const r of t.fields)if("esriFieldTypeGlobalID"===r.type)return r.name}readObjectIdFieldFromService(e,t){if((t=t.layerDefinition||t).objectIdField)return t.objectIdField;if(t.fields)for(const r of t.fields)if("esriFieldTypeOID"===r.type)return r.name}get parsedUrl(){const e=this.url?T(this.url):null;return null!=e&&(null!=this.dynamicDataSource?e.path=E(e.path,"dynamicLayer"):null!=this.layerId&&(e.path=E(e.path,this.layerId.toString()))),e}get defaultPopupTemplate(){return this.createPopupTemplate()}set renderer(e){ge(e,this.fieldsIndex),this._set("renderer",e)}readRenderer(e,t,s){const a=(t=t.layerDefinition||t).drawingInfo&&t.drawingInfo.renderer||void 0;if(a){const e=o(a,t,s)||void 0;return e||Ge.error("Failed to create renderer",{rendererDefinition:t.drawingInfo.renderer,layer:this,context:s}),e}if(t.defaultSymbol)return t.types&&t.types.length?new i({defaultSymbol:$e(t.defaultSymbol,t,s),field:t.typeIdField,uniqueValueInfos:t.types.map((e=>({id:e.id,symbol:$e(e.symbol,e,s)})))}):new r({symbol:$e(t.defaultSymbol,t,s)})}set source(e){const t=this._get("source");t!==e&&(ze(t)&&this._resetMemorySource(t),ze(e)&&this._initMemorySource(e),this._set("source",e))}castSource(e){return e?Array.isArray(e)||e instanceof d?new Q({layer:this,items:e}):e:null}readSource(e,t){const r=Ae.fromJSON(t.featureSet);return new Q({layer:this,items:r&&r.features||[]})}readServiceDefinitionExpression(e,t){return t.definitionQuery||t.definitionExpression}readTemplates(e,t){const r=t.editFieldsInfo,i=r&&r.creatorField,o=r&&r.editorField;return e=e&&e.map((e=>me.fromJSON(e))),this._fixTemplates(e,i),this._fixTemplates(e,o),e}readTitle(e,t){const r=t.layerDefinition&&t.layerDefinition.name||t.name,i=t.title||t.layerDefinition&&t.layerDefinition.title;if(r){const e=this.portalItem&&this.portalItem.title;if("item-title"===this.sublayerTitleMode)return this.url?$(this.url,r):r;let t=r;if(!t&&this.url){const e=K(this.url);g(e)&&(t=e.title)}if(!t)return;return"item-title-and-service-name"===this.sublayerTitleMode&&e&&e!==t&&(t=e+" - "+t),X(t)}if("item-title"===this.sublayerTitleMode&&i)return i}readTitleFromWebMap(e,t){return t.title||t.layerDefinition&&t.layerDefinition.name}readTypeIdField(e,t){let r=(t=t.layerDefinition||t).typeIdField;if(r&&t.fields){r=r.toLowerCase();const e=t.fields.find((e=>e.name.toLowerCase()===r));e&&(r=e.name)}return r}readTypes(e,t){e=(t=t.layerDefinition||t).types;const r=t.editFieldsInfo,i=r&&r.creatorField,o=r&&r.editorField;return e&&e.map((e=>(e=fe.fromJSON(e),this._fixTemplates(e.templates,i),this._fixTemplates(e.templates,o),e)))}set url(e){const t=Y({layer:this,url:e,nonStandardUrlAllowed:!0,logger:Ge});this._set("url",t.url),null!=t.layerId&&this._set("layerId",t.layerId)}writeUrl(e,t,r,i){ee(this,e,null,t,i)}readVersion(e,t){return t.currentVersion?t.currentVersion:t.hasOwnProperty("capabilities")||t.hasOwnProperty("drawingInfo")||t.hasOwnProperty("hasAttachments")||t.hasOwnProperty("htmlPopupType")||t.hasOwnProperty("relationships")||t.hasOwnProperty("timeInfo")||t.hasOwnProperty("typeIdField")||t.hasOwnProperty("types")?10:9.3}readVisible(e,t){return t.layerDefinition&&null!=t.layerDefinition.defaultVisibility?!!t.layerDefinition.defaultVisibility:null!=t.visibility?!!t.visibility:void 0}addAttachment(e,t){return this.load().then((()=>this._checkAttachmentSupport(e))).then((()=>{if(!("addAttachment"in this.source))throw new c(Qe,"Layer source does not support addAttachment capability");return this.source.addAttachment(e,t)}))}updateAttachment(e,t,r){return this.load().then((()=>this._checkAttachmentSupport(e))).then((()=>{if(!("updateAttachment"in this.source))throw new c(Qe,"Layer source does not support updateAttachment capability");return this.source.updateAttachment(e,t,r)}))}async applyEdits(e,t){const r=await import("./graphics/editingSupport.js");return await this.load(),r.applyEdits(this,this.source,e,t)}on(e,t){return super.on(e,t)}createPopupTemplate(e){return _e(this,e)}async createGraphicsSource(e){if(this._hasMemorySource())return this.source.load({signal:e});const{default:t}=await F(import("./graphics/sources/FeatureLayerSource.js"),e);return new t({layer:this}).load({signal:e})}createQuery(){const e=new Me,t=this.get("capabilities.data"),r=this.get("capabilities.query");e.dynamicDataSource=this.dynamicDataSource,e.historicMoment=this.historicMoment,e.gdbVersion=this.gdbVersion,e.returnGeometry=!0,r&&(e.compactGeometryEnabled=r.supportsCompactGeometry,e.defaultSpatialReferenceEnabled=r.supportsDefaultSpatialReference),t&&(t.supportsZ&&null!=this.returnZ&&(e.returnZ=this.returnZ),t.supportsM&&null!=this.returnM&&(e.returnM=this.returnM)),e.outFields=["*"];const i=g(this.subtypeCode)?`${this.subtypeField} = ${this.subtypeCode}`:null,o=I(this.definitionExpression,i);e.where=o||"1=1";const{timeOffset:s,timeExtent:a}=this;return e.timeExtent=null!=s&&null!=a?a.offset(-s.value,s.unit):a||null,e.multipatchOption="multipatch"===this.geometryType?"xyFootprint":null,e}deleteAttachments(e,t){return this.load().then((()=>this._checkAttachmentSupport(e))).then((()=>{if(!("deleteAttachments"in this.source))throw new c(Qe,"Layer source does not support deleteAttachments capability");return this.source.deleteAttachments(e,t)}))}fetchRecomputedExtents(e){return this.load({signal:e?.signal}).then((()=>{if(this.source.fetchRecomputedExtents)return this.source.fetchRecomputedExtents(e);throw new c(Qe,"Layer source does not support fetchUpdates capability")}))}getFeatureType(e){const{typeIdField:t,types:r}=this;if(!t||!e)return null;const i=e.attributes?e.attributes[t]:void 0;if(null==i)return null;let o=null;return r.some((e=>{const{id:t}=e;return null!=t&&(t.toString()===i.toString()&&(o=e),!!o)})),o}getFieldDomain(e,t){const r=t&&t.feature,i=this.getFeatureType(r);if(i){const t=i.domains&&i.domains[e];if(t&&"inherited"!==t.type)return t}return this._getLayerDomain(e)}getField(e){return this.fieldsIndex.get(e)}queryAttachments(e,t){return e=Ce.from(e),this.load().then((()=>{if(!this.get("capabilities.data.supportsAttachment"))throw new c(Qe,"this layer doesn't support attachments");const{attachmentTypes:t,objectIds:r,globalIds:i,num:o,size:s,start:a,where:n}=e;if(!this.get("capabilities.operations.supportsQueryAttachments")){const p=r&&r.length>1,l=t&&t.length,u=i&&i.length,d=s&&s.length;if(p||l||u||d||o||a||n)throw new c(Qe,"when 'supportsQueryAttachments' is false, only objectIds of length 1 are supported",e)}if(!(r&&r.length||n))throw new c(Qe,"'objectIds' or 'where' are required to perform attachment query",e);if(!("queryAttachments"in this.source))throw new c(Qe,"Layer source does not support queryAttachments capability",e);return this.source.queryAttachments(e)}))}queryFeatures(e,t){return this.load().then((()=>this.source.queryFeatures(Me.from(e)||this.createQuery(),t))).then((e=>{if(e?.features)for(const t of e.features)t.layer=t.sourceLayer=this;return e}))}queryObjectIds(e,t){return this.load().then((()=>{if(this.source.queryObjectIds)return this.source.queryObjectIds(Me.from(e)||this.createQuery(),t);throw new c(Qe,"Layer source does not support queryObjectIds capability")}))}queryFeatureCount(e,t){return this.load().then((()=>{if(this.source.queryFeatureCount)return this.source.queryFeatureCount(Me.from(e)||this.createQuery(),t);throw new c(Qe,"Layer source does not support queryFeatureCount capability")}))}queryExtent(e,t){return this.load().then((()=>{if(this.source.queryExtent)return this.source.queryExtent(Me.from(e)||this.createQuery(),t);throw new c(Qe,"Layer source does not support queryExtent capability")}))}queryRelatedFeatures(e,t){return this.load().then((()=>{if("queryRelatedFeatures"in this.source)return this.source.queryRelatedFeatures(Le.from(e),t);throw new c(Qe,"Layer source does not support queryRelatedFeatures capability")}))}queryRelatedFeaturesCount(e,t){return this.load().then((()=>{if("queryRelatedFeaturesCount"in this.source)return this.source.queryRelatedFeaturesCount(Le.from(e),t);throw new c(Qe,"Layer source does not support queryRelatedFeaturesCount capability")}))}queryTopFeatures(e,t){return this.load().then((()=>{if("queryTopFeatures"in this.source&&this.get("capabilities.query.supportsTopFeaturesQuery"))return this.source.queryTopFeatures(Re.from(e),t).then((e=>{if(e?.features)for(const t of e.features)t.layer=t.sourceLayer=this;return e}));throw new c(Qe,"Layer source does not support queryTopFeatures capability")}))}queryTopObjectIds(e,t){return this.load().then((()=>{if("queryTopObjectIds"in this.source&&this.get("capabilities.query.supportsTopFeaturesQuery"))return this.source.queryTopObjectIds(Re.from(e),t);throw new c(Qe,"Layer source does not support queryTopObjectIds capability")}))}queryTopFeaturesExtent(e,t){return this.load().then((()=>{if("queryTopExtents"in this.source&&this.get("capabilities.query.supportsTopFeaturesQuery"))return this.source.queryTopExtents(Re.from(e),t);throw new c(Qe,"Layer source does not support queryTopExtents capability")}))}queryTopFeatureCount(e,t){return this.load().then((()=>{if("queryTopCount"in this.source&&this.get("capabilities.query.supportsTopFeaturesQuery"))return this.source.queryTopCount(Re.from(e),t);throw new c(Qe,"Layer source does not support queryFeatureCount capability")}))}read(e,t){const r=e.featureCollection;if(r){const e=r.layers;e&&1===e.length&&(super.read(e[0],t),null!=r.showLegend&&super.read({showLegend:r.showLegend},t))}super.read(e,t),t&&"service"===t.origin&&this.revert(["objectIdField","fields","timeInfo","spatialReference"],"service")}write(e,t){t={...t,writeLayerSchema:t?.writeLayerSchema??this._hasMemorySource()};const{origin:r,layerContainerType:i,messages:o}=t;if(this.dynamicDataSource)return o?.push(Ve(this,"using a dynamic data source cannot be written to web scenes, web maps and feature service items")),null;if(this.isTable){if("web-scene"===r||"web-map"===r&&"tables"!==i)return o?.push(Ve(this,"using a table source cannot be written to web scenes and web maps")),null;if(this._hasMemorySource())return o?.push(Ve(this,"using an in-memory table source cannot be written to web scenes and web maps")),null}else if(this.loaded&&"web-map"===r&&"tables"===i)return o?.push(Ve(this,"using a non-table source cannot be written to tables in web maps")),null;return super.write(e,t)}clone(){if(this._hasMemorySource())throw new c(Qe,`FeatureLayer (title: ${this.title}, id: ${this.id}) created using in-memory source cannot be cloned`);return super.clone()}serviceSupportsSpatialReference(e){return!!this.loaded&&("memory"===this.source.type||Ee(this,e))}async save(e){return(await import("./save/featureLayerUtils.js")).save(this,e)}async saveAs(e,t){return(await import("./save/featureLayerUtils.js")).saveAs(this,e,t)}_readEditingEnabled(e,t,r){let i=e.layerDefinition?.capabilities;return i?this._hasEditingCapability(i):(i=e.capabilities,t&&"web-map"===r?.origin&&!this._hasMemorySource()&&i?this._hasEditingCapability(i):void 0)}_hasEditingCapability(e){return e.toLowerCase().split(",").map((e=>e.trim())).includes("editing")}_writeEditingEnabled(e,t,r,i){if(!e){const e=this.capabilities?.operations?.supportsSync?"Query,Sync":"Query";v("layerDefinition.capabilities",e,t),r&&!i?.writeLayerSchema&&(t.capabilities=e)}}_checkAttachmentSupport(e){const{attributes:t}=e,{objectIdField:r}=this;return this.get("capabilities.data.supportsAttachment")?e?t?t[r]?void 0:Promise.reject(new c(Qe,`feature is missing the identifying attribute ${r}`)):Promise.reject(new c(Qe,"'attributes' are required on a feature to query attachments")):Promise.reject(new c(Qe,"A feature is required to add/delete/update attachments")):Promise.reject(new c(Qe,"this layer doesn't support attachments"))}_getLayerDomain(e){const t=this.fieldsIndex.get(e);return t?t.domain:null}_fetchFirstLayerId(e){return n(this.url,{query:{f:"json",...this.customParameters,token:this.apiKey},responseType:"json",signal:e}).then((e=>{const t=e.data;if(t)return Array.isArray(t.layers)&&t.layers.length>0?t.layers[0].id:Array.isArray(t.tables)&&t.tables.length>0?t.tables[0].id:void 0}))}async _initLayerProperties(e){return this._set("source",e),e.sourceJSON&&(this.sourceJSON=e.sourceJSON,this.read(e.sourceJSON,{origin:"service",url:this.parsedUrl})),this._verifySource(),this._verifyFields(),ge(this.renderer,this.fieldsIndex),we(this.timeInfo,this.fieldsIndex),De(this,{origin:"service"})}async hasDataChanged(){if(this.source?.refresh)try{const{dataChanged:e,updates:t}=await(this.source?.refresh());if(g(t)&&(this.sourceJSON={...this.sourceJSON,...t},this.read(t,{origin:"service",url:this.parsedUrl})),e)return!0}catch{}if(this.definitionExpression)try{return(await j(this.definitionExpression,this.fieldsIndex)).hasDateFunctions}catch{}return!1}_verifyFields(){const e=this.parsedUrl&&this.parsedUrl.path||"undefined";this.objectIdField||console.log("FeatureLayer: 'objectIdField' property is not defined (url: "+e+")"),this.isTable||this._hasMemorySource()||-1!==e.search(/\/FeatureServer\//i)||this.fields?.some((e=>"geometry"===e.type))||console.log("FeatureLayer: unable to find field of type 'geometry' in the layer 'fields' list. If you are using a map service layer, features will not have geometry (url: "+e+")")}_fixTemplates(e,t){e&&e.forEach((e=>{const r=e.prototype&&e.prototype.attributes;r&&t&&delete r[t]}))}_verifySource(){if(this._hasMemorySource()){if(this.url)throw new c("feature-layer:mixed-source-and-url","FeatureLayer cannot be created with both an in-memory source and a url")}else if(!this.url)throw new c("feature-layer:source-or-url-required","FeatureLayer requires either a url, a valid portal item or a source")}_initMemorySource(e){e.forEach((e=>{e.layer=this,e.sourceLayer=this})),this._handles.add([e.on("after-add",(e=>{e.item.layer=this,e.item.sourceLayer=this})),e.on("after-remove",(e=>{e.item.layer=null,e.item.sourceLayer=null}))],"fl-source")}_resetMemorySource(e){e.forEach((e=>{e.layer=null,e.sourceLayer=null})),this._handles.remove("fl-source")}_hasMemorySource(){return!(this.url||!this.source)}_readAnalyticsCapabilities(e){return{supportsCacheHint:We(e.advancedQueryCapabilities,"queryAnalytics")}}_readAttachmentCapabilities(e){const t=e.attachmentProperties,r={supportsName:!1,supportsSize:!1,supportsContentType:!1,supportsKeywords:!1,supportsExifInfo:!1,supportsCacheHint:We(e.advancedQueryCapabilities,"queryAttachments"),supportsResize:Be(e,"supportsAttachmentsResizing",!1)};return t&&Array.isArray(t)&&t.forEach((e=>{const t=qe[e.name];t&&(r[t]=!!e.isEnabled)})),r}_readDataCapabilities(e){return{isVersioned:Be(e,"isDataVersioned",!1),supportsAttachment:Be(e,"hasAttachments",!1),supportsM:Be(e,"hasM",!1),supportsZ:Be(e,"hasZ",!1)}}_readMetadataCapabilities(e){return{supportsAdvancedFieldProperties:Be(e,"supportsFieldDescriptionProperty",!1)}}_readOperationsCapabilities(e,t){const r=e?e.toLowerCase().split(",").map((e=>e.trim())):[],i=this.url?K(this.url):null,o=r.includes(g(i)&&"MapServer"===i.serverType?"data":"query"),s=r.includes("editing")&&!t.datesInUnknownTimezone;let a=s&&r.includes("create"),n=s&&r.includes("delete"),p=s&&r.includes("update");const l=r.includes("changetracking"),u=t.advancedQueryCapabilities;return s&&!(a||n||p)&&(a=n=p=!0),{supportsCalculate:Be(t,"supportsCalculate",!1),supportsTruncate:Be(t,"supportsTruncate",!1),supportsValidateSql:Be(t,"supportsValidateSql",!1),supportsAdd:a,supportsDelete:n,supportsEditing:s,supportsChangeTracking:l,supportsQuery:o,supportsQueryAnalytics:Be(u,"supportsQueryAnalytic",!1),supportsQueryAttachments:Be(u,"supportsQueryAttachments",!1),supportsQueryTopFeatures:Be(u,"supportsTopFeaturesQuery",!1),supportsResizeAttachments:Be(t,"supportsAttachmentsResizing",!1),supportsSync:r.includes("sync"),supportsUpdate:p,supportsExceedsLimitStatistics:Be(t,"supportsExceedsLimitStatistics",!1)}}_readQueryCapabilities(e){const t=e.advancedQueryCapabilities,r=e.ownershipBasedAccessControlForFeatures,i=e.archivingInfo,o=this.url?.includes("MapServer"),s=!has("mapserver-pbf-enabled")&&o&&this.version<10.81,a=te(this.url),n=(e.supportedQueryFormats||"").split(",").reduce(((e,t)=>{const r=t.toLowerCase().trim();return r&&e.add(r),e}),new Set);return{supportsStatistics:Be(t,"supportsStatistics",e.supportsStatistics),supportsPercentileStatistics:Be(t,"supportsPercentileStatistics",!1),supportsSpatialAggregationStatistics:Be(t,"supportsSpatialAggregationStatistics",!1),supportedSpatialAggregationStatistics:Ne(t),supportsCentroid:Be(t,"supportsReturningGeometryCentroid",!1),supportsDistance:Be(t,"supportsQueryWithDistance",!1),supportsDistinct:Be(t,"supportsDistinct",e.supportsAdvancedQueries),supportsExtent:Be(t,"supportsReturningQueryExtent",!1),supportsGeometryProperties:Be(t,"supportsReturningGeometryProperties",!1),supportsHavingClause:Be(t,"supportsHavingClause",!1),supportsOrderBy:Be(t,"supportsOrderBy",e.supportsAdvancedQueries),supportsPagination:Be(t,"supportsPagination",!1),supportsQuantization:Be(e,"supportsCoordinatesQuantization",!1),supportsQuantizationEditMode:Be(e,"supportsQuantizationEditMode",!1),supportsQueryGeometry:Be(e,"supportsReturningQueryGeometry",!1),supportsResultType:Be(t,"supportsQueryWithResultType",!1),supportsMaxRecordCountFactor:Be(t,"supportsMaxRecordCountFactor",!1),supportsSqlExpression:Be(t,"supportsSqlExpression",!1),supportsStandardizedQueriesOnly:Be(e,"useStandardizedQueries",!1),supportsTopFeaturesQuery:Be(t,"supportsTopFeaturesQuery",!1),supportsQueryByOthers:Be(r,"allowOthersToQuery",!0),supportsHistoricMoment:Be(i,"supportsQueryWithHistoricMoment",!1),supportsFormatPBF:!s&&n.has("pbf"),supportsDisjointSpatialRelationship:Be(t,"supportsDisjointSpatialRel",!1),supportsCacheHint:Be(t,"supportsQueryWithCacheHint",!1)||We(t,"query"),supportsDefaultSpatialReference:Be(t,"supportsDefaultSR",!1),supportsCompactGeometry:a,maxRecordCountFactor:ke(e,"maxRecordCountFactor",void 0),maxRecordCount:ke(e,"maxRecordCount",void 0),standardMaxRecordCount:ke(e,"standardMaxRecordCount",void 0),tileMaxRecordCount:ke(e,"tileMaxRecordCount",void 0)}}_readQueryRelatedCapabilities(e){const t=e.advancedQueryCapabilities,r=Be(t,"supportsAdvancedQueryRelated",!1);return{supportsPagination:Be(t,"supportsQueryRelatedPagination",!1),supportsCount:r,supportsOrderBy:r,supportsCacheHint:We(t,"queryRelated")}}_readQueryTopFeaturesCapabilities(e){return{supportsCacheHint:We(e.advancedQueryCapabilities,"queryTopFilter")}}_readEditingCapabilities(e){const t=e.ownershipBasedAccessControlForFeatures;return{supportsGeometryUpdate:Be(e,"allowGeometryUpdates",!0),supportsGlobalId:Be(e,"supportsApplyEditsWithGlobalIds",!1),supportsReturnServiceEditsInSourceSpatialReference:Be(e,"supportsReturnServiceEditsInSourceSR",!1),supportsRollbackOnFailure:Be(e,"supportsRollbackOnFailureParameter",!1),supportsUpdateWithoutM:Be(e,"allowUpdateWithoutMValues",!1),supportsUploadWithItemId:Be(e,"supportsAttachmentsByUploadId",!1),supportsDeleteByAnonymous:Be(t,"allowAnonymousToDelete",!0),supportsDeleteByOthers:Be(t,"allowOthersToDelete",!0),supportsUpdateByAnonymous:Be(t,"allowAnonymousToUpdate",!0),supportsUpdateByOthers:Be(t,"allowOthersToUpdate",!0)}}};e([x({readOnly:!0,json:{read:!1}})],Ze.prototype,"capabilities",void 0),e([C("service","capabilities",["advancedQueryCapabilities","allowGeometryUpdates","allowUpdateWithoutMValues","archivingInfo","capabilities","datesInUnknownTimezone","hasAttachments","hasM","hasZ","maxRecordCount","maxRecordCountFactor","ownershipBasedAccessControlForFeatures","standardMaxRecordCount","supportedQueryFormats","supportsAdvancedQueries","supportsApplyEditsWithGlobalIds","supportsAttachmentsByUploadId","supportsAttachmentsResizing","supportsCalculate","supportsCoordinatesQuantization","supportsExceedsLimitStatistics","supportsFieldDescriptionProperty","supportsQuantizationEditMode","supportsRollbackOnFailureParameter","supportsStatistics","supportsTruncate","supportsValidateSql","tileMaxRecordCount","useStandardizedQueries"])],Ze.prototype,"readCapabilities",null),e([x({json:{origins:{"portal-item":{write:!0},"web-map":{write:!0}}}})],Ze.prototype,"charts",void 0),e([x({readOnly:!0})],Ze.prototype,"createQueryVersion",null),e([x({type:String,json:{read:{source:"layerDefinition.copyrightText"},origins:{service:{read:{source:"copyrightText"}}}}})],Ze.prototype,"copyright",void 0),e([x({type:Boolean})],Ze.prototype,"datesInUnknownTimezone",void 0),e([x({type:String,json:{read:{source:"layerDefinition.displayField"},origins:{service:{read:{source:"displayField"}}}}})],Ze.prototype,"displayField",void 0),e([x({type:String,json:{origins:{service:{read:!1,write:!1}},name:"layerDefinition.definitionExpression",write:{enabled:!0,allowNull:!0}}})],Ze.prototype,"definitionExpression",void 0),e([x({types:p,readOnly:!0})],Ze.prototype,"defaultSymbol",void 0),e([x({type:xe})],Ze.prototype,"dynamicDataSource",void 0),e([x({readOnly:!0})],Ze.prototype,"editFieldsInfo",void 0),e([x({type:Boolean})],Ze.prototype,"editingEnabled",null),e([C(["portal-item","web-scene"],"editingEnabled",["layerDefinition.capabilities"])],Ze.prototype,"readEditingEnabled",null),e([C("web-map","editingEnabled",["capabilities","layerDefinition.capabilities"])],Ze.prototype,"readEditingEnabledFromWebMap",null),e([M(["portal-item","web-scene"],"editingEnabled",{"layerDefinition.capabilities":{type:String}})],Ze.prototype,"writeEditingEnabled",null),e([M("web-map","editingEnabled",{capabilities:{type:String},"layerDefinition.capabilities":{type:String}})],Ze.prototype,"writeEditingEnabledToWebMap",null),e([x({readOnly:!0})],Ze.prototype,"editingInfo",void 0),e([C("editingInfo")],Ze.prototype,"readEditingInfo",null),e([x((()=>{const e=m(re),t=e.json.origins;return t["web-map"]={read:!1,write:!1},t["portal-item"]={read:!1,write:!1},e})())],Ze.prototype,"elevationInfo",void 0),e([x(he)],Ze.prototype,"featureReduction",void 0),e([x({...He.fields,json:{read:{source:"layerDefinition.fields"},origins:{service:{name:"fields"},"web-map":{write:{target:"layerDefinition.fields",overridePolicy:Je}}}}})],Ze.prototype,"fields",void 0),e([x(He.fieldsIndex)],Ze.prototype,"fieldsIndex",void 0),e([x({type:Ie,json:{read:{source:"layerDefinition.floorInfo"},write:{target:"layerDefinition.floorInfo"}}})],Ze.prototype,"floorInfo",void 0),e([x({type:R,json:{name:"formInfo",write:!0,origins:{"web-scene":{read:!1,write:!1}}}})],Ze.prototype,"formTemplate",void 0),e([x({type:_,json:{origins:{service:{read:{source:"extent"}}},read:{source:"layerDefinition.extent"}}})],Ze.prototype,"fullExtent",void 0),e([x()],Ze.prototype,"gdbVersion",void 0),e([x({readOnly:!0,type:ve,json:{read:{source:"geometryProperties"}}})],Ze.prototype,"geometryFieldsInfo",void 0),e([x({type:["point","polygon","polyline","multipoint","multipatch","mesh"],json:{origins:{service:{read:Pe.read},"web-map":{write:{target:"layerDefinition.geometryType",overridePolicy:Je,writer(e,t,r){const i=e?Pe.toJSON(e):null;i&&v(r,i,t)}}}},read:{source:"layerDefinition.geometryType",reader:Pe.read}}})],Ze.prototype,"geometryType",void 0),e([x({type:Boolean,json:{origins:{service:{read:!0}},read:{source:"layerDefinition.hasM"}}})],Ze.prototype,"hasM",void 0),e([x({type:Boolean,json:{origins:{service:{read:!0}},read:{source:"layerDefinition.hasZ"}}})],Ze.prototype,"hasZ",void 0),e([x({readOnly:!0,type:O})],Ze.prototype,"heightModelInfo",void 0),e([x({type:Date})],Ze.prototype,"historicMoment",void 0),e([x(ie)],Ze.prototype,"id",void 0),e([x({readOnly:!0,json:{origins:{service:{read:!0}},read:!1}})],Ze.prototype,"infoFor3D",void 0),e([x({readOnly:!0,json:{origins:{"web-map":{write:{target:"layerDefinition.type"}}}}})],Ze.prototype,"isTable",void 0),e([C("service","isTable",["type","geometryType"]),C("isTable",["layerDefinition.type","layerDefinition.geometryType"])],Ze.prototype,"readIsTable",null),e([M("web-map","isTable")],Ze.prototype,"writeIsTable",null),e([x(oe)],Ze.prototype,"labelsVisible",void 0),e([x({type:[Se],json:{origins:{service:{read:{source:"drawingInfo.labelingInfo",reader:Fe},write:{target:"drawingInfo.labelingInfo",enabled:!1}}},read:{source:"layerDefinition.drawingInfo.labelingInfo",reader:Fe},write:{target:"layerDefinition.drawingInfo.labelingInfo"}}})],Ze.prototype,"labelingInfo",void 0),e([x((()=>{const e=m(se);return e.json.origins["portal-item"]={write:{target:"layerDefinition.drawingInfo.transparency",writer(e,t,r){v(r,Oe(e),t)}}},e})())],Ze.prototype,"opacity",void 0),e([x({type:Number,json:{origins:{service:{read:{source:"id"}},"portal-item":{read:!1,write:{target:"id"}}},read:!1}})],Ze.prototype,"layerId",void 0),e([x(ae)],Ze.prototype,"legendEnabled",void 0),e([x({type:["show","hide"],json:(()=>{const e=m(ne.json);return e.origins["portal-item"]={read:!1,write:!1},e})()})],Ze.prototype,"listMode",void 0),e([x(pe)],Ze.prototype,"minScale",void 0),e([C("service","minScale",["minScale","effectiveMinScale"])],Ze.prototype,"readMinScale",null),e([x(le)],Ze.prototype,"maxScale",void 0),e([C("service","maxScale",["maxScale","effectiveMaxScale"])],Ze.prototype,"readMaxScale",null),e([x({type:String})],Ze.prototype,"globalIdField",void 0),e([C("globalIdField",["layerDefinition.globalIdField","layerDefinition.fields"]),C("service","globalIdField",["globalIdField","fields"])],Ze.prototype,"readGlobalIdFieldFromService",null),e([x({type:String,json:{origins:{"web-map":{write:{target:"layerDefinition.objectIdField",overridePolicy:Je}}}}})],Ze.prototype,"objectIdField",void 0),e([C("objectIdField",["layerDefinition.objectIdField","layerDefinition.fields"]),C("service","objectIdField",["objectIdField","fields"])],Ze.prototype,"readObjectIdFieldFromService",null),e([x({value:"ArcGISFeatureLayer",type:["ArcGISFeatureLayer"]})],Ze.prototype,"operationalLayerType",void 0),e([x(He.outFields)],Ze.prototype,"outFields",void 0),e([x({readOnly:!0})],Ze.prototype,"parsedUrl",null),e([x({type:String,json:{origins:{"web-scene":{read:!0,write:!0}},read:!1}})],Ze.prototype,"path",void 0),e([x(ue)],Ze.prototype,"popupEnabled",void 0),e([x({type:t,json:{name:"popupInfo",write:!0}})],Ze.prototype,"popupTemplate",void 0),e([x({readOnly:!0})],Ze.prototype,"defaultPopupTemplate",null),e([x({type:[je],readOnly:!0})],Ze.prototype,"relationships",void 0),e([x({types:s,json:{origins:{service:{write:{target:"drawingInfo.renderer",enabled:!1}},"web-scene":{types:a,name:"layerDefinition.drawingInfo.renderer",write:{overridePolicy:(e,t,r)=>({ignoreOrigin:r?.writeLayerSchema})}}},write:{target:"layerDefinition.drawingInfo.renderer",overridePolicy:(e,t,r)=>({ignoreOrigin:r?.writeLayerSchema})}}})],Ze.prototype,"renderer",null),e([C("service","renderer",["drawingInfo.renderer","defaultSymbol"]),C("renderer",["layerDefinition.drawingInfo.renderer","layerDefinition.defaultSymbol"])],Ze.prototype,"readRenderer",null),e([x()],Ze.prototype,"sourceJSON",void 0),e([x({type:Boolean})],Ze.prototype,"returnM",void 0),e([x({type:Boolean})],Ze.prototype,"returnZ",void 0),e([x((()=>{const e=m(de);return e.json.origins["portal-item"]={read:!1,write:!1},e})())],Ze.prototype,"screenSizePerspectiveEnabled",void 0),e([x({clonable:!1})],Ze.prototype,"source",null),e([D("source")],Ze.prototype,"castSource",null),e([C("portal-item","source",["featureSet"]),C("web-map","source",["featureSet"])],Ze.prototype,"readSource",null),e([x({readOnly:!0})],Ze.prototype,"serviceDefinitionExpression",void 0),e([C("service","serviceDefinitionExpression",["definitionQuery","definitionExpression"])],Ze.prototype,"readServiceDefinitionExpression",null),e([x({type:P,json:{origins:{service:{read:{source:"extent.spatialReference"}}},read:{source:"layerDefinition.extent.spatialReference"}}})],Ze.prototype,"spatialReference",void 0),e([x({type:Number})],Ze.prototype,"subtypeCode",void 0),e([x({type:String,json:{origins:{service:{read:!0}}}})],Ze.prototype,"subtypeField",void 0),e([x({type:[me]})],Ze.prototype,"templates",void 0),e([C("templates",["editFieldsInfo","creatorField","editorField","templates"])],Ze.prototype,"readTemplates",null),e([x({type:Te})],Ze.prototype,"timeInfo",void 0),e([x()],Ze.prototype,"title",void 0),e([C("service","title",["name"]),C("portal-item","title",["layerDefinition.title","layerDefinition.name","title"])],Ze.prototype,"readTitle",null),e([C("web-map","title",["layerDefinition.name","title"])],Ze.prototype,"readTitleFromWebMap",null),e([x({type:String})],Ze.prototype,"sublayerTitleMode",void 0),e([x({type:String,json:{read:{source:"timeInfo.trackIdField"}}})],Ze.prototype,"trackIdField",void 0),e([x({json:{read:!1}})],Ze.prototype,"type",void 0),e([x({type:String})],Ze.prototype,"typeIdField",void 0),e([C("service","typeIdField"),C("typeIdField",["layerDefinition.typeIdField"])],Ze.prototype,"readTypeIdField",null),e([x({type:[fe]})],Ze.prototype,"types",void 0),e([C("service","types",["types"]),C("types",["layerDefinition.types"])],Ze.prototype,"readTypes",null),e([x({readOnly:!0,json:{write:!1}})],Ze.prototype,"serverGens",void 0),e([x({type:d.ofType(ye),readOnly:!0})],Ze.prototype,"indexes",void 0),e([x(ce)],Ze.prototype,"url",null),e([M("url")],Ze.prototype,"writeUrl",null),e([x({readOnly:!0})],Ze.prototype,"userIsAdmin",void 0),e([x({json:{origins:{service:{read:!0}},read:!1}})],Ze.prototype,"version",void 0),e([C("service","version",["currentVersion","capabilities","drawingInfo","hasAttachments","htmlPopupType","relationships","timeInfo","typeIdField","types"])],Ze.prototype,"readVersion",null),e([x({type:Boolean,json:{origins:{"portal-item":{write:{target:"layerDefinition.defaultVisibility"}}}}})],Ze.prototype,"visible",void 0),e([C("portal-item","visible",["visibility","layerDefinition.defaultVisibility"])],Ze.prototype,"readVisible",null),Ze=e([A(Ue)],Ze);const $e=L({types:l}),Ke=Ze;export{Ke 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{getNamedColorCopy as t,hex2rgba as e,isNamedColor as r,hsla2rgba as n}from"../../colorUtils.js";import u from"../../core/Error.js";import{BloomEffect as a,DropShadowEffect as o,BlurEffect as c,HueRotateEffect as i,OpacityEffect as l,ColorMatrixEffect as s}from"./effects.js";import{c as f}from"../../chunks/_commonjsHelpers.js";import{canInterpolateEffects as p,normalizeEffects as h}from"./utils.js";var m,g,v={exports:{}};function d(t){if(!t||0===t.length)return null;if("string"==typeof t){const e=y(t);return e&&0!==e.length?e:null}const e=t.map((t=>{if(!Number.isFinite(t.scale)||t.scale<=0)throw new u("effect:invalid-scale","scale must be finite and greater than 0",{stop:t});return{scale:t.scale,effects:y(t.value)}}));e.sort(((t,e)=>e.effects.length-t.effects.length));for(let r=0;r<e.length-1;r++){if(!p(e[r].effects,e[r+1].effects))throw new u("effect:interpolation-impossible","Cannot interpolate by scale between 2 lists of mixed effects",{a:e[r].effects,b:e[r+1].effects});h(e[r].effects,e[r+1].effects)}return e.sort(((t,e)=>e.scale-t.scale)),e}function y(t){let e;if(!t)return[];try{e=v.exports.parse(t)}catch(r){throw new u("effect:invalid-syntax","Invalid effect syntax",{value:t,error:r})}return e.map((t=>A(t)))}function A(t){try{switch(t.name){case"grayscale":case"sepia":case"saturate":case"invert":case"brightness":case"contrast":return w(t);case"opacity":return x(t);case"hue-rotate":return b(t);case"blur":return C(t);case"drop-shadow":return F(t);case"bloom":return E(t)}}catch(e){throw e.details.filter=t,e}throw new u("effect:unknown-effect",`Effect '${t.name}' is not supported`,{effect:t})}function w(t){let e=1;return j(t.parameters,1),1===t.parameters.length&&(e=M(t.parameters[0])),new s(t.name,e)}function x(t){let e=1;return j(t.parameters,1),1===t.parameters.length&&(e=M(t.parameters[0])),new l(e)}function b(t){let e=0;return j(t.parameters,1),1===t.parameters.length&&(e=N(t.parameters[0])),new i(e)}function C(t){let e=0;return j(t.parameters,1),1===t.parameters.length&&(e=T(t.parameters[0]),O(e,t.parameters[0])),new c(e)}function F(t){const e=[];let r=null;for(const n of t.parameters)if("color"===n.type){if(e.length&&Object.freeze(e),r)throw new u("effect:type-error","Accepts only one color",{});r=U(n)}else{const t=T(n);if(Object.isFrozen(e))throw new u("effect:type-error","<length> parameters not consecutive",{lengths:e});e.push(t),3===e.length&&O(t,n)}if(e.length<2||e.length>3)throw new u("effect:type-error",`Expected <length>{2,3}, Actual: <length>{${e.length}}`,{lengths:e});return new o(e[0],e[1],e[2]||0,r||H("black"))}function E(t){let e=1,r=0,n=0;return j(t.parameters,3),t.parameters[0]&&(e=M(t.parameters[0])),t.parameters[1]&&(r=T(t.parameters[1]),O(r,t.parameters[1])),t.parameters[2]&&(n=M(t.parameters[2])),new a(e,r,n)}function j(t,e){if(t.length>e)throw new u("effect:type-error",`Function supports up to ${e} parameters, Actual: ${t.length}`,{parameters:t})}function $(t){if("color"===t.type)return"<color>";if(t.unit){if(R[t.unit])return"<length>";if(S[t.unit])return"<angle>";if("%"===t.unit)return"<percentage>"}return"<double>"}function O(t,e){if(t<0)throw new u("effect:type-error",`Negative values are not allowed, Actual: ${t}`,{term:e})}function k(t){if("quantity"!==t.type||null!==t.unit)throw new u("effect:type-error",`Expected <double>, Actual: ${$(t)}`,{term:t})}function q(t){if("quantity"!==t.type||null!==t.unit&&"%"!==t.unit)throw new u("effect:type-error",`Expected <double> or <percentage>, Actual: ${$(t)}`,{term:t})}g=function(){function t(t,e){function r(){this.constructor=t}r.prototype=e.prototype,t.prototype=new r}function e(t,r,n,u){var a=Error.call(this,t);return Object.setPrototypeOf&&Object.setPrototypeOf(a,e.prototype),a.expected=r,a.found=n,a.location=u,a.name="SyntaxError",a}function r(t,e,r){return r=r||" ",t.length>e?t:(e-=t.length,t+(r+=r.repeat(e)).slice(0,e))}function n(t,r){var n,u={},a=(r=void 0!==r?r:{}).grammarSource,o={start:Lt},c=Lt,i="none",l=")",s=",",f="(",p="%",h="px",m="cm",g="mm",v="in",d="pt",y="pc",A="deg",w="rad",x="grad",b="turn",C="#",F=".",E="e",j=/^[ \t\n\r]/,$=/^[a-z\-]/,O=/^[0-9a-fA-F]/,k=/^[+\-]/,q=/^[0-9]/,S=Bt("none"),z=Ut("none",!1),R=Ut(")",!1),I=Ut(",",!1),M=Bt("whitespace"),P=Ht([" ","\t","\n","\r"],!1,!1),N=Bt("function"),T=Ut("(",!1),U=Bt("identifier"),H=Ht([["a","z"],"-"],!1,!1),_=Bt("percentage"),B=Ut("%",!1),D=Bt("length"),G=Ut("px",!1),J=Ut("cm",!1),K=Ut("mm",!1),L=Ut("in",!1),Q=Ut("pt",!1),V=Ut("pc",!1),W=Bt("angle"),X=Ut("deg",!1),Y=Ut("rad",!1),Z=Ut("grad",!1),tt=Ut("turn",!1),et=Bt("number"),rt=Bt("color"),nt=Ut("#",!1),ut=Ht([["0","9"],["a","f"],["A","F"]],!1,!1),at=Ht(["+","-"],!1,!1),ot=Ht([["0","9"]],!1,!1),ct=Ut(".",!1),it=Ut("e",!1),lt=function(){return[]},st=function(t,e){return{type:"function",name:t,parameters:e||[]}},ft=function(t,e){return e.length>0?le(t,e,3):[t]},pt=function(t){return{type:"quantity",value:t.value,unit:t.unit}},ht=function(t){return{type:"color",colorType:t.type,value:t.value}},mt=function(t){return t},gt=function(){return Tt()},vt=function(t){return{value:t,unit:"%"}},dt=function(t){return{value:t,unit:"px"}},yt=function(t){return{value:t,unit:"cm"}},At=function(t){return{value:t,unit:"mm"}},wt=function(t){return{value:t,unit:"in"}},xt=function(t){return{value:t,unit:"pt"}},bt=function(t){return{value:t,unit:"pc"}},Ct=function(t){return{value:t,unit:"deg"}},Ft=function(t){return{value:t,unit:"rad"}},Et=function(t){return{value:t,unit:"grad"}},jt=function(t){return{value:t,unit:"turn"}},$t=function(t){return{value:t,unit:null}},Ot=function(){return{type:"hex",value:Tt()}},kt=function(t){return{type:"function",value:t}},qt=function(){return{type:"named",value:Tt()}},St=function(){return parseFloat(Tt())},zt=0,Rt=0,It=[{line:1,column:1}],Mt=0,Pt=[],Nt=0;if("startRule"in r){if(!(r.startRule in o))throw new Error("Can't start parsing from rule \""+r.startRule+'".');c=o[r.startRule]}function Tt(){return t.substring(Rt,zt)}function Ut(t,e){return{type:"literal",text:t,ignoreCase:e}}function Ht(t,e,r){return{type:"class",parts:t,inverted:e,ignoreCase:r}}function _t(){return{type:"end"}}function Bt(t){return{type:"other",description:t}}function Dt(e){var r,n=It[e];if(n)return n;for(r=e-1;!It[r];)r--;for(n={line:(n=It[r]).line,column:n.column};r<e;)10===t.charCodeAt(r)?(n.line++,n.column=1):n.column++,r++;return It[e]=n,n}function Gt(t,e){var r=Dt(t),n=Dt(e);return{source:a,start:{offset:t,line:r.line,column:r.column},end:{offset:e,line:n.line,column:n.column}}}function Jt(t){zt<Mt||(zt>Mt&&(Mt=zt,Pt=[]),Pt.push(t))}function Kt(t,r,n){return new e(e.buildMessage(t,r),t,r,n)}function Lt(){var t;return(t=Qt())===u&&(t=Vt()),t}function Qt(){var e,r;return Nt++,e=zt,Zt(),t.substr(zt,4)===i?(r=i,zt+=4):(r=u,0===Nt&&Jt(z)),r!==u?(Zt(),Rt=e,e=lt()):(zt=e,e=u),Nt--,e===u&&0===Nt&&Jt(S),e}function Vt(){var t,e;if(t=[],(e=Wt())!==u)for(;e!==u;)t.push(e),e=Wt();else t=u;return t}function Wt(){var e,r,n,a;return e=zt,Zt(),(r=te())!==u?(Zt(),(n=Xt())===u&&(n=null),Zt(),41===t.charCodeAt(zt)?(a=l,zt++):(a=u,0===Nt&&Jt(R)),a!==u?(Zt(),Rt=e,e=st(r,n)):(zt=e,e=u)):(zt=e,e=u),e}function Xt(){var e,r,n,a,o,c,i,l;if(e=zt,(r=Yt())!==u){for(n=[],a=zt,o=Zt(),44===t.charCodeAt(zt)?(c=s,zt++):(c=u,0===Nt&&Jt(I)),c===u&&(c=null),i=Zt(),(l=Yt())!==u?a=o=[o,c,i,l]:(zt=a,a=u);a!==u;)n.push(a),a=zt,o=Zt(),44===t.charCodeAt(zt)?(c=s,zt++):(c=u,0===Nt&&Jt(I)),c===u&&(c=null),i=Zt(),(l=Yt())!==u?a=o=[o,c,i,l]:(zt=a,a=u);Rt=e,e=ft(r,n)}else zt=e,e=u;return e}function Yt(){var t,e;return t=zt,(e=re())===u&&(e=ne())===u&&(e=ue())===u&&(e=ae()),e!==u&&(Rt=t,e=pt(e)),(t=e)===u&&(t=zt,(e=oe())!==u&&(Rt=t,e=ht(e)),t=e),t}function Zt(){var e,r;for(Nt++,e=[],j.test(t.charAt(zt))?(r=t.charAt(zt),zt++):(r=u,0===Nt&&Jt(P));r!==u;)e.push(r),j.test(t.charAt(zt))?(r=t.charAt(zt),zt++):(r=u,0===Nt&&Jt(P));return Nt--,r=u,0===Nt&&Jt(M),e}function te(){var e,r,n;return Nt++,e=zt,(r=ee())!==u?(40===t.charCodeAt(zt)?(n=f,zt++):(n=u,0===Nt&&Jt(T)),n!==u?(Rt=e,e=mt(r)):(zt=e,e=u)):(zt=e,e=u),Nt--,e===u&&(r=u,0===Nt&&Jt(N)),e}function ee(){var e,r,n;if(Nt++,e=zt,r=[],$.test(t.charAt(zt))?(n=t.charAt(zt),zt++):(n=u,0===Nt&&Jt(H)),n!==u)for(;n!==u;)r.push(n),$.test(t.charAt(zt))?(n=t.charAt(zt),zt++):(n=u,0===Nt&&Jt(H));else r=u;return r!==u&&(Rt=e,r=gt()),Nt--,(e=r)===u&&(r=u,0===Nt&&Jt(U)),e}function re(){var e,r,n;return Nt++,e=zt,Zt(),(r=ce())!==u?(37===t.charCodeAt(zt)?(n=p,zt++):(n=u,0===Nt&&Jt(B)),n!==u?(Rt=e,e=vt(r)):(zt=e,e=u)):(zt=e,e=u),Nt--,e===u&&0===Nt&&Jt(_),e}function ne(){var e,r,n;return Nt++,e=zt,Zt(),(r=ce())!==u?(t.substr(zt,2)===h?(n=h,zt+=2):(n=u,0===Nt&&Jt(G)),n!==u?(Rt=e,e=dt(r)):(zt=e,e=u)):(zt=e,e=u),e===u&&(e=zt,Zt(),(r=ce())!==u?(t.substr(zt,2)===m?(n=m,zt+=2):(n=u,0===Nt&&Jt(J)),n!==u?(Rt=e,e=yt(r)):(zt=e,e=u)):(zt=e,e=u),e===u&&(e=zt,Zt(),(r=ce())!==u?(t.substr(zt,2)===g?(n=g,zt+=2):(n=u,0===Nt&&Jt(K)),n!==u?(Rt=e,e=At(r)):(zt=e,e=u)):(zt=e,e=u),e===u&&(e=zt,Zt(),(r=ce())!==u?(t.substr(zt,2)===v?(n=v,zt+=2):(n=u,0===Nt&&Jt(L)),n!==u?(Rt=e,e=wt(r)):(zt=e,e=u)):(zt=e,e=u),e===u&&(e=zt,Zt(),(r=ce())!==u?(t.substr(zt,2)===d?(n=d,zt+=2):(n=u,0===Nt&&Jt(Q)),n!==u?(Rt=e,e=xt(r)):(zt=e,e=u)):(zt=e,e=u),e===u&&(e=zt,Zt(),(r=ce())!==u?(t.substr(zt,2)===y?(n=y,zt+=2):(n=u,0===Nt&&Jt(V)),n!==u?(Rt=e,e=bt(r)):(zt=e,e=u)):(zt=e,e=u)))))),Nt--,e===u&&0===Nt&&Jt(D),e}function ue(){var e,r,n;return Nt++,e=zt,(r=ce())!==u?(t.substr(zt,3)===A?(n=A,zt+=3):(n=u,0===Nt&&Jt(X)),n!==u?(Rt=e,e=Ct(r)):(zt=e,e=u)):(zt=e,e=u),e===u&&(e=zt,(r=ce())!==u?(t.substr(zt,3)===w?(n=w,zt+=3):(n=u,0===Nt&&Jt(Y)),n!==u?(Rt=e,e=Ft(r)):(zt=e,e=u)):(zt=e,e=u),e===u&&(e=zt,(r=ce())!==u?(t.substr(zt,4)===x?(n=x,zt+=4):(n=u,0===Nt&&Jt(Z)),n!==u?(Rt=e,e=Et(r)):(zt=e,e=u)):(zt=e,e=u),e===u&&(e=zt,(r=ce())!==u?(t.substr(zt,4)===b?(n=b,zt+=4):(n=u,0===Nt&&Jt(tt)),n!==u?(Rt=e,e=jt(r)):(zt=e,e=u)):(zt=e,e=u)))),Nt--,e===u&&(r=u,0===Nt&&Jt(W)),e}function ae(){var t,e;return Nt++,t=zt,Zt(),(e=ce())!==u?(Rt=t,t=$t(e)):(zt=t,t=u),Nt--,t===u&&0===Nt&&Jt(et),t}function oe(){var e,r,n,a;if(Nt++,e=zt,35===t.charCodeAt(zt)?(r=C,zt++):(r=u,0===Nt&&Jt(nt)),r!==u){if(n=[],O.test(t.charAt(zt))?(a=t.charAt(zt),zt++):(a=u,0===Nt&&Jt(ut)),a!==u)for(;a!==u;)n.push(a),O.test(t.charAt(zt))?(a=t.charAt(zt),zt++):(a=u,0===Nt&&Jt(ut));else n=u;n!==u?(Rt=e,e=Ot()):(zt=e,e=u)}else zt=e,e=u;return e===u&&(e=zt,(r=Wt())!==u&&(Rt=e,r=kt(r)),(e=r)===u&&(e=zt,(r=ee())!==u&&(Rt=e,r=qt()),e=r)),Nt--,e===u&&(r=u,0===Nt&&Jt(rt)),e}function ce(){var e,r,n,a,o,c,i;for(e=zt,k.test(t.charAt(zt))?(t.charAt(zt),zt++):0===Nt&&Jt(at),r=zt,n=[],q.test(t.charAt(zt))?(a=t.charAt(zt),zt++):(a=u,0===Nt&&Jt(ot));a!==u;)n.push(a),q.test(t.charAt(zt))?(a=t.charAt(zt),zt++):(a=u,0===Nt&&Jt(ot));if(46===t.charCodeAt(zt)?(a=F,zt++):(a=u,0===Nt&&Jt(ct)),a!==u){if(o=[],q.test(t.charAt(zt))?(c=t.charAt(zt),zt++):(c=u,0===Nt&&Jt(ot)),c!==u)for(;c!==u;)o.push(c),q.test(t.charAt(zt))?(c=t.charAt(zt),zt++):(c=u,0===Nt&&Jt(ot));else o=u;o!==u?r=n=[n,a,o]:(zt=r,r=u)}else zt=r,r=u;if(r===u)if(r=[],q.test(t.charAt(zt))?(n=t.charAt(zt),zt++):(n=u,0===Nt&&Jt(ot)),n!==u)for(;n!==u;)r.push(n),q.test(t.charAt(zt))?(n=t.charAt(zt),zt++):(n=u,0===Nt&&Jt(ot));else r=u;if(r!==u){if(n=zt,101===t.charCodeAt(zt)?(a=E,zt++):(a=u,0===Nt&&Jt(it)),a!==u){if(k.test(t.charAt(zt))?(o=t.charAt(zt),zt++):(o=u,0===Nt&&Jt(at)),o===u&&(o=null),c=[],q.test(t.charAt(zt))?(i=t.charAt(zt),zt++):(i=u,0===Nt&&Jt(ot)),i!==u)for(;i!==u;)c.push(i),q.test(t.charAt(zt))?(i=t.charAt(zt),zt++):(i=u,0===Nt&&Jt(ot));else c=u;c!==u?n=a=[a,o,c]:(zt=n,n=u)}else zt=n,n=u;n===u&&(n=null),Rt=e,e=St()}else zt=e,e=u;return e}function ie(t,e){return t.map((function(t){return t[e]}))}function le(t,e,r){return[t].concat(ie(e,r))}if((n=c())!==u&&zt===t.length)return n;throw n!==u&&zt<t.length&&Jt(_t()),Kt(Pt,Mt<t.length?t.charAt(Mt):null,Mt<t.length?Gt(Mt,Mt+1):Gt(Mt,Mt))}return t(e,Error),e.prototype.format=function(t){var e="Error: "+this.message;if(this.location){var n,u=null;for(n=0;n<t.length;n++)if(t[n].source===this.location.source){u=t[n].text.split(/\r\n|\n|\r/g);break}var a=this.location.start,o=this.location.source+":"+a.line+":"+a.column;if(u){var c=this.location.end,i=r("",a.line.toString().length," "),l=u[a.line-1],s=(a.line===c.line?c.column:l.length+1)-a.column||1;e+="\n --\x3e "+o+"\n"+i+" |\n"+a.line+" | "+l+"\n"+i+" | "+r("",a.column-1," ")+r("",s,"^")}else e+="\n at "+o}return e},e.buildMessage=function(t,e){var r={literal:function(t){return'"'+u(t.text)+'"'},class:function(t){var e=t.parts.map((function(t){return Array.isArray(t)?a(t[0])+"-"+a(t[1]):a(t)}));return"["+(t.inverted?"^":"")+e.join("")+"]"},any:function(){return"any character"},end:function(){return"end of input"},other:function(t){return t.description}};function n(t){return t.charCodeAt(0).toString(16).toUpperCase()}function u(t){return t.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,(function(t){return"\\x0"+n(t)})).replace(/[\x10-\x1F\x7F-\x9F]/g,(function(t){return"\\x"+n(t)}))}function a(t){return t.replace(/\\/g,"\\\\").replace(/\]/g,"\\]").replace(/\^/g,"\\^").replace(/-/g,"\\-").replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,(function(t){return"\\x0"+n(t)})).replace(/[\x10-\x1F\x7F-\x9F]/g,(function(t){return"\\x"+n(t)}))}function o(t){return r[t.type](t)}function c(t){var e,r,n=t.map(o);if(n.sort(),n.length>0){for(e=1,r=1;e<n.length;e++)n[e-1]!==n[e]&&(n[r]=n[e],r++);n.length=r}switch(n.length){case 1:return n[0];case 2:return n[0]+" or "+n[1];default:return n.slice(0,-1).join(", ")+", or "+n[n.length-1]}}function i(t){return t?'"'+u(t)+'"':"end of input"}return"Expected "+c(t)+" but "+i(e)+" found."},{SyntaxError:e,parse:n}},(m=v).exports&&(m.exports=g());const S={deg:1,grad:.9,rad:180/Math.PI,turn:360};function z(t){if("quantity"!==t.type||!(0===t.value&&null===t.unit||t.unit&&null!=S[t.unit]))throw new u("effect:type-error",`Expected <angle>, Actual: ${$(t)}`,{term:t})}const R={px:1,cm:96/2.54,mm:96/2.54/10,in:96,pc:16,pt:96/72};function I(t){if("quantity"!==t.type||!(0===t.value&&null===t.unit||t.unit&&null!=R[t.unit]))throw new u("effect:type-error",`Expected <length>, Actual: ${$(t)}`,{term:t})}function M(t){q(t);const e=t.value;return O(e,t),"%"===t.unit?.01*e:e}function P(t){return k(t),O(t.value,t),t.value}function N(t){return z(t),t.value*S[t.unit]||0}function T(t){return I(t),t.value*R[t.unit]||0}function U(t){switch(t.colorType){case"hex":return e(t.value);case"named":return H(t.value);case"function":return D(t.value)}}function H(e){if(!r(e))throw new u("effect:unknown-color",`color '${e}' isn't valid`,{namedColor:e});return t(e)}const _=/^rgba?/i,B=/^hsla?/i;function D(t){if(j(t.parameters,4),_.test(t.name))return[M(t.parameters[0]),M(t.parameters[1]),M(t.parameters[2]),t.parameters[3]?M(t.parameters[3]):1];if(B.test(t.name))return n(P(t.parameters[0]),M(t.parameters[1]),M(t.parameters[2]),t.parameters[3]?M(t.parameters[3]):1);throw new u("effect:syntax-error",`Invalid color function '${t.name}'`,{colorFunction:t})}export{d as parse};
5
+ import{hex2rgba as t,isNamedColor as e,getNamedColorCopy as r,hsla2rgba as n}from"../../colorUtils.js";import u from"../../core/Error.js";import{ColorMatrixEffect as a,OpacityEffect as o,HueRotateEffect as c,BlurEffect as i,DropShadowEffect as l,BloomEffect as s}from"./effects.js";import{c as f}from"../../chunks/_commonjsHelpers.js";import{canInterpolateEffects as p,normalizeEffects as h}from"./utils.js";var m,g,v={exports:{}};function d(t){if(!t||0===t.length)return null;if("string"==typeof t){const e=y(t);return e&&0!==e.length?e:null}const e=t.map((t=>{if(!Number.isFinite(t.scale)||t.scale<=0)throw new u("effect:invalid-scale","scale must be finite and greater than 0",{stop:t});return{scale:t.scale,effects:y(t.value)}}));e.sort(((t,e)=>e.effects.length-t.effects.length));for(let r=0;r<e.length-1;r++){if(!p(e[r].effects,e[r+1].effects))throw new u("effect:interpolation-impossible","Cannot interpolate by scale between 2 lists of mixed effects",{a:e[r].effects,b:e[r+1].effects});h(e[r].effects,e[r+1].effects)}return e.sort(((t,e)=>e.scale-t.scale)),e}function y(t){let e;if(!t)return[];try{e=v.exports.parse(t)}catch(r){throw new u("effect:invalid-syntax","Invalid effect syntax",{value:t,error:r})}return e.map((t=>A(t)))}function A(t){try{switch(t.name){case"grayscale":case"sepia":case"saturate":case"invert":case"brightness":case"contrast":return w(t);case"opacity":return x(t);case"hue-rotate":return b(t);case"blur":return C(t);case"drop-shadow":return F(t);case"bloom":return E(t)}}catch(e){throw e.details.filter=t,e}throw new u("effect:unknown-effect",`Effect '${t.name}' is not supported`,{effect:t})}function w(t){let e=1;return j(t.parameters,1),1===t.parameters.length&&(e=M(t.parameters[0])),new a(t.name,e)}function x(t){let e=1;return j(t.parameters,1),1===t.parameters.length&&(e=M(t.parameters[0])),new o(e)}function b(t){let e=0;return j(t.parameters,1),1===t.parameters.length&&(e=N(t.parameters[0])),new c(e)}function C(t){let e=0;return j(t.parameters,1),1===t.parameters.length&&(e=T(t.parameters[0]),O(e,t.parameters[0])),new i(e)}function F(t){const e=[];let r=null;for(const n of t.parameters)if("color"===n.type){if(e.length&&Object.freeze(e),r)throw new u("effect:type-error","Accepts only one color",{});r=U(n)}else{const t=T(n);if(Object.isFrozen(e))throw new u("effect:type-error","<length> parameters not consecutive",{lengths:e});e.push(t),3===e.length&&O(t,n)}if(e.length<2||e.length>3)throw new u("effect:type-error",`Expected <length>{2,3}, Actual: <length>{${e.length}}`,{lengths:e});return new l(e[0],e[1],e[2]||0,r||H("black"))}function E(t){let e=1,r=0,n=0;return j(t.parameters,3),t.parameters[0]&&(e=M(t.parameters[0])),t.parameters[1]&&(r=T(t.parameters[1]),O(r,t.parameters[1])),t.parameters[2]&&(n=M(t.parameters[2])),new s(e,r,n)}function j(t,e){if(t.length>e)throw new u("effect:type-error",`Function supports up to ${e} parameters, Actual: ${t.length}`,{parameters:t})}function $(t){if("color"===t.type)return"<color>";if(t.unit){if(R[t.unit])return"<length>";if(S[t.unit])return"<angle>";if("%"===t.unit)return"<percentage>"}return"<double>"}function O(t,e){if(t<0)throw new u("effect:type-error",`Negative values are not allowed, Actual: ${t}`,{term:e})}function k(t){if("quantity"!==t.type||null!==t.unit)throw new u("effect:type-error",`Expected <double>, Actual: ${$(t)}`,{term:t})}function q(t){if("quantity"!==t.type||null!==t.unit&&"%"!==t.unit)throw new u("effect:type-error",`Expected <double> or <percentage>, Actual: ${$(t)}`,{term:t})}g=function(){function t(t,e){function r(){this.constructor=t}r.prototype=e.prototype,t.prototype=new r}function e(t,r,n,u){var a=Error.call(this,t);return Object.setPrototypeOf&&Object.setPrototypeOf(a,e.prototype),a.expected=r,a.found=n,a.location=u,a.name="SyntaxError",a}function r(t,e,r){return r=r||" ",t.length>e?t:(e-=t.length,t+(r+=r.repeat(e)).slice(0,e))}function n(t,r){var n,u={},a=(r=void 0!==r?r:{}).grammarSource,o={start:Lt},c=Lt,i="none",l=")",s=",",f="(",p="%",h="px",m="cm",g="mm",v="in",d="pt",y="pc",A="deg",w="rad",x="grad",b="turn",C="#",F=".",E="e",j=/^[ \t\n\r]/,$=/^[a-z\-]/,O=/^[0-9a-fA-F]/,k=/^[+\-]/,q=/^[0-9]/,S=Bt("none"),z=Ut("none",!1),R=Ut(")",!1),I=Ut(",",!1),M=Bt("whitespace"),P=Ht([" ","\t","\n","\r"],!1,!1),N=Bt("function"),T=Ut("(",!1),U=Bt("identifier"),H=Ht([["a","z"],"-"],!1,!1),_=Bt("percentage"),B=Ut("%",!1),D=Bt("length"),G=Ut("px",!1),J=Ut("cm",!1),K=Ut("mm",!1),L=Ut("in",!1),Q=Ut("pt",!1),V=Ut("pc",!1),W=Bt("angle"),X=Ut("deg",!1),Y=Ut("rad",!1),Z=Ut("grad",!1),tt=Ut("turn",!1),et=Bt("number"),rt=Bt("color"),nt=Ut("#",!1),ut=Ht([["0","9"],["a","f"],["A","F"]],!1,!1),at=Ht(["+","-"],!1,!1),ot=Ht([["0","9"]],!1,!1),ct=Ut(".",!1),it=Ut("e",!1),lt=function(){return[]},st=function(t,e){return{type:"function",name:t,parameters:e||[]}},ft=function(t,e){return e.length>0?le(t,e,3):[t]},pt=function(t){return{type:"quantity",value:t.value,unit:t.unit}},ht=function(t){return{type:"color",colorType:t.type,value:t.value}},mt=function(t){return t},gt=function(){return Tt()},vt=function(t){return{value:t,unit:"%"}},dt=function(t){return{value:t,unit:"px"}},yt=function(t){return{value:t,unit:"cm"}},At=function(t){return{value:t,unit:"mm"}},wt=function(t){return{value:t,unit:"in"}},xt=function(t){return{value:t,unit:"pt"}},bt=function(t){return{value:t,unit:"pc"}},Ct=function(t){return{value:t,unit:"deg"}},Ft=function(t){return{value:t,unit:"rad"}},Et=function(t){return{value:t,unit:"grad"}},jt=function(t){return{value:t,unit:"turn"}},$t=function(t){return{value:t,unit:null}},Ot=function(){return{type:"hex",value:Tt()}},kt=function(t){return{type:"function",value:t}},qt=function(){return{type:"named",value:Tt()}},St=function(){return parseFloat(Tt())},zt=0,Rt=0,It=[{line:1,column:1}],Mt=0,Pt=[],Nt=0;if("startRule"in r){if(!(r.startRule in o))throw new Error("Can't start parsing from rule \""+r.startRule+'".');c=o[r.startRule]}function Tt(){return t.substring(Rt,zt)}function Ut(t,e){return{type:"literal",text:t,ignoreCase:e}}function Ht(t,e,r){return{type:"class",parts:t,inverted:e,ignoreCase:r}}function _t(){return{type:"end"}}function Bt(t){return{type:"other",description:t}}function Dt(e){var r,n=It[e];if(n)return n;for(r=e-1;!It[r];)r--;for(n={line:(n=It[r]).line,column:n.column};r<e;)10===t.charCodeAt(r)?(n.line++,n.column=1):n.column++,r++;return It[e]=n,n}function Gt(t,e){var r=Dt(t),n=Dt(e);return{source:a,start:{offset:t,line:r.line,column:r.column},end:{offset:e,line:n.line,column:n.column}}}function Jt(t){zt<Mt||(zt>Mt&&(Mt=zt,Pt=[]),Pt.push(t))}function Kt(t,r,n){return new e(e.buildMessage(t,r),t,r,n)}function Lt(){var t;return(t=Qt())===u&&(t=Vt()),t}function Qt(){var e,r;return Nt++,e=zt,Zt(),t.substr(zt,4)===i?(r=i,zt+=4):(r=u,0===Nt&&Jt(z)),r!==u?(Zt(),Rt=e,e=lt()):(zt=e,e=u),Nt--,e===u&&0===Nt&&Jt(S),e}function Vt(){var t,e;if(t=[],(e=Wt())!==u)for(;e!==u;)t.push(e),e=Wt();else t=u;return t}function Wt(){var e,r,n,a;return e=zt,Zt(),(r=te())!==u?(Zt(),(n=Xt())===u&&(n=null),Zt(),41===t.charCodeAt(zt)?(a=l,zt++):(a=u,0===Nt&&Jt(R)),a!==u?(Zt(),Rt=e,e=st(r,n)):(zt=e,e=u)):(zt=e,e=u),e}function Xt(){var e,r,n,a,o,c,i,l;if(e=zt,(r=Yt())!==u){for(n=[],a=zt,o=Zt(),44===t.charCodeAt(zt)?(c=s,zt++):(c=u,0===Nt&&Jt(I)),c===u&&(c=null),i=Zt(),(l=Yt())!==u?a=o=[o,c,i,l]:(zt=a,a=u);a!==u;)n.push(a),a=zt,o=Zt(),44===t.charCodeAt(zt)?(c=s,zt++):(c=u,0===Nt&&Jt(I)),c===u&&(c=null),i=Zt(),(l=Yt())!==u?a=o=[o,c,i,l]:(zt=a,a=u);Rt=e,e=ft(r,n)}else zt=e,e=u;return e}function Yt(){var t,e;return t=zt,(e=re())===u&&(e=ne())===u&&(e=ue())===u&&(e=ae()),e!==u&&(Rt=t,e=pt(e)),(t=e)===u&&(t=zt,(e=oe())!==u&&(Rt=t,e=ht(e)),t=e),t}function Zt(){var e,r;for(Nt++,e=[],j.test(t.charAt(zt))?(r=t.charAt(zt),zt++):(r=u,0===Nt&&Jt(P));r!==u;)e.push(r),j.test(t.charAt(zt))?(r=t.charAt(zt),zt++):(r=u,0===Nt&&Jt(P));return Nt--,r=u,0===Nt&&Jt(M),e}function te(){var e,r,n;return Nt++,e=zt,(r=ee())!==u?(40===t.charCodeAt(zt)?(n=f,zt++):(n=u,0===Nt&&Jt(T)),n!==u?(Rt=e,e=mt(r)):(zt=e,e=u)):(zt=e,e=u),Nt--,e===u&&(r=u,0===Nt&&Jt(N)),e}function ee(){var e,r,n;if(Nt++,e=zt,r=[],$.test(t.charAt(zt))?(n=t.charAt(zt),zt++):(n=u,0===Nt&&Jt(H)),n!==u)for(;n!==u;)r.push(n),$.test(t.charAt(zt))?(n=t.charAt(zt),zt++):(n=u,0===Nt&&Jt(H));else r=u;return r!==u&&(Rt=e,r=gt()),Nt--,(e=r)===u&&(r=u,0===Nt&&Jt(U)),e}function re(){var e,r,n;return Nt++,e=zt,Zt(),(r=ce())!==u?(37===t.charCodeAt(zt)?(n=p,zt++):(n=u,0===Nt&&Jt(B)),n!==u?(Rt=e,e=vt(r)):(zt=e,e=u)):(zt=e,e=u),Nt--,e===u&&0===Nt&&Jt(_),e}function ne(){var e,r,n;return Nt++,e=zt,Zt(),(r=ce())!==u?(t.substr(zt,2)===h?(n=h,zt+=2):(n=u,0===Nt&&Jt(G)),n!==u?(Rt=e,e=dt(r)):(zt=e,e=u)):(zt=e,e=u),e===u&&(e=zt,Zt(),(r=ce())!==u?(t.substr(zt,2)===m?(n=m,zt+=2):(n=u,0===Nt&&Jt(J)),n!==u?(Rt=e,e=yt(r)):(zt=e,e=u)):(zt=e,e=u),e===u&&(e=zt,Zt(),(r=ce())!==u?(t.substr(zt,2)===g?(n=g,zt+=2):(n=u,0===Nt&&Jt(K)),n!==u?(Rt=e,e=At(r)):(zt=e,e=u)):(zt=e,e=u),e===u&&(e=zt,Zt(),(r=ce())!==u?(t.substr(zt,2)===v?(n=v,zt+=2):(n=u,0===Nt&&Jt(L)),n!==u?(Rt=e,e=wt(r)):(zt=e,e=u)):(zt=e,e=u),e===u&&(e=zt,Zt(),(r=ce())!==u?(t.substr(zt,2)===d?(n=d,zt+=2):(n=u,0===Nt&&Jt(Q)),n!==u?(Rt=e,e=xt(r)):(zt=e,e=u)):(zt=e,e=u),e===u&&(e=zt,Zt(),(r=ce())!==u?(t.substr(zt,2)===y?(n=y,zt+=2):(n=u,0===Nt&&Jt(V)),n!==u?(Rt=e,e=bt(r)):(zt=e,e=u)):(zt=e,e=u)))))),Nt--,e===u&&0===Nt&&Jt(D),e}function ue(){var e,r,n;return Nt++,e=zt,(r=ce())!==u?(t.substr(zt,3)===A?(n=A,zt+=3):(n=u,0===Nt&&Jt(X)),n!==u?(Rt=e,e=Ct(r)):(zt=e,e=u)):(zt=e,e=u),e===u&&(e=zt,(r=ce())!==u?(t.substr(zt,3)===w?(n=w,zt+=3):(n=u,0===Nt&&Jt(Y)),n!==u?(Rt=e,e=Ft(r)):(zt=e,e=u)):(zt=e,e=u),e===u&&(e=zt,(r=ce())!==u?(t.substr(zt,4)===x?(n=x,zt+=4):(n=u,0===Nt&&Jt(Z)),n!==u?(Rt=e,e=Et(r)):(zt=e,e=u)):(zt=e,e=u),e===u&&(e=zt,(r=ce())!==u?(t.substr(zt,4)===b?(n=b,zt+=4):(n=u,0===Nt&&Jt(tt)),n!==u?(Rt=e,e=jt(r)):(zt=e,e=u)):(zt=e,e=u)))),Nt--,e===u&&(r=u,0===Nt&&Jt(W)),e}function ae(){var t,e;return Nt++,t=zt,Zt(),(e=ce())!==u?(Rt=t,t=$t(e)):(zt=t,t=u),Nt--,t===u&&0===Nt&&Jt(et),t}function oe(){var e,r,n,a;if(Nt++,e=zt,35===t.charCodeAt(zt)?(r=C,zt++):(r=u,0===Nt&&Jt(nt)),r!==u){if(n=[],O.test(t.charAt(zt))?(a=t.charAt(zt),zt++):(a=u,0===Nt&&Jt(ut)),a!==u)for(;a!==u;)n.push(a),O.test(t.charAt(zt))?(a=t.charAt(zt),zt++):(a=u,0===Nt&&Jt(ut));else n=u;n!==u?(Rt=e,e=Ot()):(zt=e,e=u)}else zt=e,e=u;return e===u&&(e=zt,(r=Wt())!==u&&(Rt=e,r=kt(r)),(e=r)===u&&(e=zt,(r=ee())!==u&&(Rt=e,r=qt()),e=r)),Nt--,e===u&&(r=u,0===Nt&&Jt(rt)),e}function ce(){var e,r,n,a,o,c,i;for(e=zt,k.test(t.charAt(zt))?(t.charAt(zt),zt++):0===Nt&&Jt(at),r=zt,n=[],q.test(t.charAt(zt))?(a=t.charAt(zt),zt++):(a=u,0===Nt&&Jt(ot));a!==u;)n.push(a),q.test(t.charAt(zt))?(a=t.charAt(zt),zt++):(a=u,0===Nt&&Jt(ot));if(46===t.charCodeAt(zt)?(a=F,zt++):(a=u,0===Nt&&Jt(ct)),a!==u){if(o=[],q.test(t.charAt(zt))?(c=t.charAt(zt),zt++):(c=u,0===Nt&&Jt(ot)),c!==u)for(;c!==u;)o.push(c),q.test(t.charAt(zt))?(c=t.charAt(zt),zt++):(c=u,0===Nt&&Jt(ot));else o=u;o!==u?r=n=[n,a,o]:(zt=r,r=u)}else zt=r,r=u;if(r===u)if(r=[],q.test(t.charAt(zt))?(n=t.charAt(zt),zt++):(n=u,0===Nt&&Jt(ot)),n!==u)for(;n!==u;)r.push(n),q.test(t.charAt(zt))?(n=t.charAt(zt),zt++):(n=u,0===Nt&&Jt(ot));else r=u;if(r!==u){if(n=zt,101===t.charCodeAt(zt)?(a=E,zt++):(a=u,0===Nt&&Jt(it)),a!==u){if(k.test(t.charAt(zt))?(o=t.charAt(zt),zt++):(o=u,0===Nt&&Jt(at)),o===u&&(o=null),c=[],q.test(t.charAt(zt))?(i=t.charAt(zt),zt++):(i=u,0===Nt&&Jt(ot)),i!==u)for(;i!==u;)c.push(i),q.test(t.charAt(zt))?(i=t.charAt(zt),zt++):(i=u,0===Nt&&Jt(ot));else c=u;c!==u?n=a=[a,o,c]:(zt=n,n=u)}else zt=n,n=u;n===u&&(n=null),Rt=e,e=St()}else zt=e,e=u;return e}function ie(t,e){return t.map((function(t){return t[e]}))}function le(t,e,r){return[t].concat(ie(e,r))}if((n=c())!==u&&zt===t.length)return n;throw n!==u&&zt<t.length&&Jt(_t()),Kt(Pt,Mt<t.length?t.charAt(Mt):null,Mt<t.length?Gt(Mt,Mt+1):Gt(Mt,Mt))}return t(e,Error),e.prototype.format=function(t){var e="Error: "+this.message;if(this.location){var n,u=null;for(n=0;n<t.length;n++)if(t[n].source===this.location.source){u=t[n].text.split(/\r\n|\n|\r/g);break}var a=this.location.start,o=this.location.source+":"+a.line+":"+a.column;if(u){var c=this.location.end,i=r("",a.line.toString().length," "),l=u[a.line-1],s=(a.line===c.line?c.column:l.length+1)-a.column||1;e+="\n --\x3e "+o+"\n"+i+" |\n"+a.line+" | "+l+"\n"+i+" | "+r("",a.column-1," ")+r("",s,"^")}else e+="\n at "+o}return e},e.buildMessage=function(t,e){var r={literal:function(t){return'"'+u(t.text)+'"'},class:function(t){var e=t.parts.map((function(t){return Array.isArray(t)?a(t[0])+"-"+a(t[1]):a(t)}));return"["+(t.inverted?"^":"")+e.join("")+"]"},any:function(){return"any character"},end:function(){return"end of input"},other:function(t){return t.description}};function n(t){return t.charCodeAt(0).toString(16).toUpperCase()}function u(t){return t.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,(function(t){return"\\x0"+n(t)})).replace(/[\x10-\x1F\x7F-\x9F]/g,(function(t){return"\\x"+n(t)}))}function a(t){return t.replace(/\\/g,"\\\\").replace(/\]/g,"\\]").replace(/\^/g,"\\^").replace(/-/g,"\\-").replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,(function(t){return"\\x0"+n(t)})).replace(/[\x10-\x1F\x7F-\x9F]/g,(function(t){return"\\x"+n(t)}))}function o(t){return r[t.type](t)}function c(t){var e,r,n=t.map(o);if(n.sort(),n.length>0){for(e=1,r=1;e<n.length;e++)n[e-1]!==n[e]&&(n[r]=n[e],r++);n.length=r}switch(n.length){case 1:return n[0];case 2:return n[0]+" or "+n[1];default:return n.slice(0,-1).join(", ")+", or "+n[n.length-1]}}function i(t){return t?'"'+u(t)+'"':"end of input"}return"Expected "+c(t)+" but "+i(e)+" found."},{SyntaxError:e,parse:n}},(m=v).exports&&(m.exports=g());const S={deg:1,grad:.9,rad:180/Math.PI,turn:360};function z(t){if("quantity"!==t.type||!(0===t.value&&null===t.unit||t.unit&&null!=S[t.unit]))throw new u("effect:type-error",`Expected <angle>, Actual: ${$(t)}`,{term:t})}const R={px:1,cm:96/2.54,mm:96/2.54/10,in:96,pc:16,pt:96/72};function I(t){if("quantity"!==t.type||!(0===t.value&&null===t.unit||t.unit&&null!=R[t.unit]))throw new u("effect:type-error",`Expected <length>, Actual: ${$(t)}`,{term:t})}function M(t){q(t);const e=t.value;return O(e,t),"%"===t.unit?.01*e:e}function P(t){return k(t),O(t.value,t),t.value}function N(t){return z(t),t.value*S[t.unit]||0}function T(t){return I(t),t.value*R[t.unit]||0}function U(e){switch(e.colorType){case"hex":return t(e.value);case"named":return H(e.value);case"function":return D(e.value)}}function H(t){if(!e(t))throw new u("effect:unknown-color",`color '${t}' isn't valid`,{namedColor:t});return r(t)}const _=/^rgba?/i,B=/^hsla?/i;function D(t){if(j(t.parameters,4),_.test(t.name))return[M(t.parameters[0]),M(t.parameters[1]),M(t.parameters[2]),t.parameters[3]?M(t.parameters[3]):1];if(B.test(t.name))return n(P(t.parameters[0]),M(t.parameters[1]),M(t.parameters[2]),t.parameters[3]?M(t.parameters[3]):1);throw new u("effect:syntax-error",`Invalid color function '${t.name}'`,{colorFunction:t})}export{d as parse};
@@ -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"../../geometry.js";import e from"../../Graphic.js";import"../../core/has.js";import{clone as t}from"../../core/lang.js";import{isNone as r}from"../../core/maybe.js";import{isFloat32Array as n,isFloat64Array as s,toArray as a}from"../../core/typedArrayUtil.js";import{fromJSON as i}from"../../geometry/support/jsonUtils.js";import{makeDehydratedPoint as o}from"./dehydratedFeatures.js";import m from"../../geometry/SpatialReference.js";function l(e){return"declaredClass"in e}function u(e){return"declaredClass"in e}function c(e){return"declaredClass"in e}function f(r,n){if(!r)return null;if(c(r))return r;const s=new e({layer:n,sourceLayer:n});return s.visible=r.visible,s.symbol=t(r.symbol),s.attributes=t(r.attributes),s.geometry=p(r.geometry),s}function p(e){return r(e)?null:l(e)?e:i(h(e))}function h(e){const{wkid:t,wkt:r,latestWkid:n}=e.spatialReference,s={wkid:t,wkt:r,latestWkid:n};switch(e.type){case"point":{const{x:t,y:r,z:n,m:a}=e;return{x:t,y:r,z:n,m:a,spatialReference:s}}case"polygon":{const{rings:t,hasZ:r,hasM:n}=e;return{rings:y(t),hasZ:r,hasM:n,spatialReference:s}}case"polyline":{const{paths:t,hasZ:r,hasM:n}=e;return{paths:y(t),hasZ:r,hasM:n,spatialReference:s}}case"extent":{const{xmin:t,xmax:r,ymin:n,ymax:a,zmin:i,zmax:o,mmin:m,mmax:l,hasZ:u,hasM:c}=e;return{xmin:t,xmax:r,ymin:n,ymax:a,zmin:i,zmax:o,mmin:m,mmax:l,hasZ:u,hasM:c,spatialReference:s}}case"multipoint":{const{points:t,hasZ:r,hasM:n}=e;return{points:M(t)?d(t):t,hasZ:r,hasM:n,spatialReference:s}}default:return}}function y(e){return x(e)?e.map((e=>d(e))):e}function d(e){return e.map((e=>a(e)))}function x(e){for(const t of e)if(0!==t.length)return M(t);return!1}function M(e){return e.length&&(n(e[0])||s(e[0]))}function k(e,t){if(!e)return null;let r;if(u(e)){if(null==t)return e.clone();if(u(t))return t.copy(e)}return null!=t?(r=t,r.x=e.x,r.y=e.y,r.spatialReference=e.spatialReference,e.hasZ?(r.z=e.z,r.hasZ=e.hasZ):(r.z=null,r.hasZ=!1),e.hasM?(r.m=e.m,r.hasM=!0):(r.m=null,r.hasM=!1)):(r=o(e.x,e.y,e.z,e.spatialReference),e.hasM&&(r.m=e.m,r.hasM=!0)),r}function Z(e){const{wkid:t,wkt:r,latestWkid:n}=e,s={wkid:t,wkt:r,latestWkid:n};return m.fromJSON(s)}export{k as clonePoint,p as hydrateGeometry,f as hydrateGraphic,Z as hydratedSpatialReference,l as isHydratedGeometry,c as isHydratedGraphic,u as isHydratedPoint};
5
+ import"../../geometry.js";import e from"../../Graphic.js";import"../../core/has.js";import{clone as t}from"../../core/lang.js";import{isNone as r}from"../../core/maybe.js";import{toArray as n,isFloat32Array as s,isFloat64Array as a}from"../../core/typedArrayUtil.js";import{fromJSON as i}from"../../geometry/support/jsonUtils.js";import{makeDehydratedPoint as o}from"./dehydratedFeatures.js";import m from"../../geometry/SpatialReference.js";function l(e){return"declaredClass"in e}function u(e){return"declaredClass"in e}function c(e){return"declaredClass"in e}function f(r,n){if(!r)return null;if(c(r))return r;const s=new e({layer:n,sourceLayer:n});return s.visible=r.visible,s.symbol=t(r.symbol),s.attributes=t(r.attributes),s.geometry=p(r.geometry),s}function p(e){return r(e)?null:l(e)?e:i(h(e))}function h(e){const{wkid:t,wkt:r,latestWkid:n}=e.spatialReference,s={wkid:t,wkt:r,latestWkid:n};switch(e.type){case"point":{const{x:t,y:r,z:n,m:a}=e;return{x:t,y:r,z:n,m:a,spatialReference:s}}case"polygon":{const{rings:t,hasZ:r,hasM:n}=e;return{rings:y(t),hasZ:r,hasM:n,spatialReference:s}}case"polyline":{const{paths:t,hasZ:r,hasM:n}=e;return{paths:y(t),hasZ:r,hasM:n,spatialReference:s}}case"extent":{const{xmin:t,xmax:r,ymin:n,ymax:a,zmin:i,zmax:o,mmin:m,mmax:l,hasZ:u,hasM:c}=e;return{xmin:t,xmax:r,ymin:n,ymax:a,zmin:i,zmax:o,mmin:m,mmax:l,hasZ:u,hasM:c,spatialReference:s}}case"multipoint":{const{points:t,hasZ:r,hasM:n}=e;return{points:M(t)?d(t):t,hasZ:r,hasM:n,spatialReference:s}}default:return}}function y(e){return x(e)?e.map((e=>d(e))):e}function d(e){return e.map((e=>n(e)))}function x(e){for(const t of e)if(0!==t.length)return M(t);return!1}function M(e){return e.length&&(s(e[0])||a(e[0]))}function k(e,t){if(!e)return null;let r;if(u(e)){if(null==t)return e.clone();if(u(t))return t.copy(e)}return null!=t?(r=t,r.x=e.x,r.y=e.y,r.spatialReference=e.spatialReference,e.hasZ?(r.z=e.z,r.hasZ=e.hasZ):(r.z=null,r.hasZ=!1),e.hasM?(r.m=e.m,r.hasM=!0):(r.m=null,r.hasM=!1)):(r=o(e.x,e.y,e.z,e.spatialReference),e.hasM&&(r.m=e.m,r.hasM=!0)),r}function Z(e){const{wkid:t,wkt:r,latestWkid:n}=e,s={wkid:t,wkt:r,latestWkid:n};return m.fromJSON(s)}export{k as clonePoint,p as hydrateGeometry,f as hydrateGraphic,Z as hydratedSpatialReference,l as isHydratedGeometry,c as isHydratedGraphic,u as isHydratedPoint};
@@ -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{isNone as e}from"../../../../core/maybe.js";import{isValid as t}from"../../../../geometry/support/spatialReferenceUtils.js";import{sanitizeNullFieldValue as n,validateFieldValue as i,validationErrorToString as r,isNumericField as s,isStringField as o}from"../../../support/fieldUtils.js";class l{constructor(){this.code=null,this.description=null}}class u{constructor(e){this.error=new l,this.globalId=null,this.objectId=null,this.success=!1,this.uniqueId=null,this.error.description=e}}function a(e){return new u(e)}class c{constructor(e){this.globalId=null,this.success=!0,this.objectId=this.uniqueId=e}}function f(e){return new c(e)}const d=new Set;function m(e,t,n,s=!1,o){d.clear();for(const l in n){const u=e.get(l);if(!u)continue;const c=n[l],f=p(u,c);if(f!==c&&o&&o.push({name:"invalid-value-type",message:"attribute value was converted to match the field type",details:{field:u,originalValue:c,sanitizedValue:f}}),d.add(u.name),u&&(s||u.editable)){const e=i(u,f);if(e)return a(r(e,u,f));t[u.name]=f}}for(const i of e.requiredFields)if(!d.has(i.name))return a(`missing required field "${i.name}"`);return null}function p(e,t){let i=t;return"string"==typeof t&&s(e)?i=parseFloat(t):null!=t&&o(e)&&"string"!=typeof t&&(i=String(t)),n(i)}let h;function g(n,i){if(!n||!t(i))return n;if("rings"in n||"paths"in n){if(e(h))throw new TypeError("geometry engine not loaded");return h.simplify(i,n)}return n}async function y(){return e(h)&&(h=await import("../../../../geometry/geometryEngineJSON.js")),h}async function w(e,n){!t(e)||"esriGeometryPolygon"!==n&&"esriGeometryPolyline"!==n||await y()}export{a as createFeatureEditErrorResult,f as createFeatureEditSuccessResult,y as loadGeometryEngine,w as loadGeometryEngineForSimplify,m as mixAttributes,g as simplify};
5
+ import{isNone as e}from"../../../../core/maybe.js";import{isValid as t}from"../../../../geometry/support/spatialReferenceUtils.js";import{validateFieldValue as n,validationErrorToString as i,isNumericField as r,isStringField as s,sanitizeNullFieldValue as o}from"../../../support/fieldUtils.js";class l{constructor(){this.code=null,this.description=null}}class u{constructor(e){this.error=new l,this.globalId=null,this.objectId=null,this.success=!1,this.uniqueId=null,this.error.description=e}}function a(e){return new u(e)}class c{constructor(e){this.globalId=null,this.success=!0,this.objectId=this.uniqueId=e}}function f(e){return new c(e)}const d=new Set;function m(e,t,r,s=!1,o){d.clear();for(const l in r){const u=e.get(l);if(!u)continue;const c=r[l],f=p(u,c);if(f!==c&&o&&o.push({name:"invalid-value-type",message:"attribute value was converted to match the field type",details:{field:u,originalValue:c,sanitizedValue:f}}),d.add(u.name),u&&(s||u.editable)){const e=n(u,f);if(e)return a(i(e,u,f));t[u.name]=f}}for(const n of e.requiredFields)if(!d.has(n.name))return a(`missing required field "${n.name}"`);return null}function p(e,t){let n=t;return"string"==typeof t&&r(e)?n=parseFloat(t):null!=t&&s(e)&&"string"!=typeof t&&(n=String(t)),o(n)}let h;function g(n,i){if(!n||!t(i))return n;if("rings"in n||"paths"in n){if(e(h))throw new TypeError("geometry engine not loaded");return h.simplify(i,n)}return n}async function y(){return e(h)&&(h=await import("../../../../geometry/geometryEngineJSON.js")),h}async function w(e,n){!t(e)||"esriGeometryPolygon"!==n&&"esriGeometryPolyline"!==n||await y()}export{a as createFeatureEditErrorResult,f as createFeatureEditSuccessResult,y as loadGeometryEngine,w as loadGeometryEngineForSimplify,m as mixAttributes,g as simplify};
@@ -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 t from"../../Graphic.js";import{read as r,rasterRendererTypes as i,websceneRasterRendererTypes as s}from"../../rasterRenderers.js";import n from"../../request.js";import o from"../../core/Error.js";import{strict as a}from"../../core/jsonMap.js";import{clone as l}from"../../core/lang.js";import u from"../../core/Logger.js";import{isSome as p,isNone as c,unwrap as m}from"../../core/maybe.js";import{when as d}from"../../core/promiseUtils.js";import{watch as h}from"../../core/reactiveUtils.js";import{urlToObject as f}from"../../core/urlUtils.js";import{property as y,ensureRange as g}from"../../core/accessorSupport/decorators/property.js";import{ensureClass as R,Integer as v,ensureNumber as S}from"../../core/accessorSupport/ensureType.js";import{reader as b}from"../../core/accessorSupport/decorators/reader.js";import{subclass as I}from"../../core/accessorSupport/decorators/subclass.js";import{writer as x}from"../../core/accessorSupport/decorators/writer.js";import{opacity as _,url as w}from"../support/commonProperties.js";import F from"../support/DimensionalDefinition.js";import{ExportImageServiceParameters as D}from"../support/ExportImageServiceParameters.js";import j from"../support/Field.js";import P from"../support/FieldsIndex.js";import{isSupportedRendererType as T}from"../support/imageryRendererUtils.js";import N from"../support/MosaicRule.js";import O from"../support/PixelBlock.js";import{interpolationKebab as C,noDataInterpretationKebab as M}from"../support/rasterEnums.js";import J from"../support/RasterFunction.js";import q from"../support/RasterInfo.js";import V from"../support/RasterJobHandler.js";import{getDefaultMultidimensionalDefinition as A}from"../support/rasterDatasets/multidimensionalUtils.js";import{decode as E,getFormat as Q}from"../support/rasterFormats/RasterCodec.js";import{uvComponentToVector as H}from"../support/rasterFunctions/vectorFieldUtils.js";import{getSupportedRendererTypes as U,getDefaultBandCombination as z,createDefaultRenderer as L,normalizeRendererJSON as B}from"../../renderers/support/rasterRendererHelper.js";import k from"../../renderers/support/RasterSymbolizer.js";import{computeAngles as G,computePixelSpaceLocations as W,computeHistograms as K,computeStatisticsHistograms as X,getImageSpatialReferenceQueryParameter as $,getSamples as Y,identify as Z}from"../../rest/imageService.js";import"../../core/has.js";import"../support/source/DataLayerSource.js";import{executeQueryJSON as ee}from"../../rest/query/executeQueryJSON.js";import"../../core/unitUtils.js";import"../../geometry/support/spatialReferenceUtils.js";import"../graphics/featureConversionUtils.js";import te from"../../geometry/Extent.js";import"../../geometry/Geometry.js";import"../../geometry/Multipoint.js";import"../../geometry/Point.js";import re from"../../geometry/Polygon.js";import"../../geometry/Polyline.js";import"../../geometry/support/normalizeUtils.js";import"../../core/pbf.js";import ie from"../../rest/support/FeatureSet.js";import se from"../../rest/support/Query.js";import"../../kernel.js";import"../../rest/query/support/AttachmentInfo.js";import"../../rest/support/AttachmentQuery.js";import{executeForCount as ne}from"../../rest/query/executeForCount.js";import{executeForIds as oe}from"../../rest/query/executeForIds.js";import"../../rest/support/RelationshipQuery.js";import"../../rest/support/TopFeaturesQuery.js";import{fetchServiceRasterInfo as ae,generateRasterInfo as le}from"../../rest/imageService/fetchRasterInfo.js";import{getCatalogItemRasterInfo as ue}from"../../rest/imageService/getCatalogItemRasterInfo.js";import pe from"../../rest/support/ImageAngleParameters.js";import ce from"../../rest/support/ImageHistogramParameters.js";import me from"../../rest/support/ImageIdentifyParameters.js";import de from"../../rest/support/ImagePixelLocationParameters.js";import he from"../../rest/support/ImageSampleParameters.js";import{createFlowMesh as fe}from"../../views/2d/engine/flow/dataUtils.js";import ye from"../../geometry/SpatialReference.js";const ge=a()({U1:"u1",U2:"u2",U4:"u4",U8:"u8",S8:"s8",U16:"u16",S16:"s16",U32:"u32",S32:"s32",F32:"f32",F64:"f64",C64:"c64",C128:"c128",UNKNOWN:"unknown"}),Re=new Set(["png","png8","png24","png32","jpg","bmp","gif","jpgpng","lerc","tiff"]),ve=g(S,{min:0,max:255});function Se(e){if(!e)return null;const t=JSON.stringify(e).match(/"rasterFunction":"(.*?")/gi)?.map((e=>e.replace('"rasterFunction":"',"").replace('"',"")));return t?t.join("/"):null}const be=a=>{let g=class extends a{constructor(){super(...arguments),this._functionRasterInfos={},this._rasterJobHandler={instance:null,refCount:0,connectionPromise:null},this._defaultServiceMosaicRule=null,this._serviceSourceType=null,this._serviceSupportsMosaicRule=null,this._rasterAttributeTableFieldPrefix="Raster.",this.adjustAspectRatio=null,this.bandIds=void 0,this.capabilities=null,this.compressionQuality=void 0,this.compressionTolerance=.01,this.copyright=null,this.definitionExpression=null,this.exportImageServiceParameters=null,this.rasterInfo=null,this.fields=null,this.fullExtent=null,this.hasMultidimensions=!1,this.imageMaxHeight=4100,this.imageMaxWidth=4100,this.interpolation=void 0,this.minScale=0,this.maxScale=0,this.noData=null,this.noDataInterpretation=void 0,this.objectIdField=null,this.geometryType="polygon",this.typeIdField=null,this.types=[],this.pixelFilter=null,this.raster=void 0,this.viewId=void 0,this.symbolizer=null,this.rasterFunctionInfos=null,this.serviceDataType=null,this.spatialReference=null,this.pixelType=null,this.serviceRasterInfo=null,this.sourceJSON=null,this.url=null,this.version=void 0}initialize(){this._set("exportImageServiceParameters",new D({layer:this}))}readDefaultServiceMosaicRule(e,t){return this._serviceSupportsMosaicRule?N.fromJSON(t):null}readServiceSourceType(e,t){return this._isMosaicDataset(t)?"mosaic-dataset":"raster-dataset"}readServiceSupportsMosaicRule(e,t){return this._isMosaicRuleSupported(t)}get _rasterFunctionNamesIndex(){const e=new Map;return!this.rasterFunctionInfos||p(this.rasterFunctionInfos)&&this.rasterFunctionInfos.length<1||p(this.rasterFunctionInfos)&&this.rasterFunctionInfos.forEach((t=>{e.set(t.name.toLowerCase().replace(/ /gi,"_"),t.name)})),e}readBandIds(e,t){if(Array.isArray(e)&&e.length>0&&e.every((e=>"number"==typeof e)))return e}readCapabilities(e,t){return this._readCapabilities(t)}writeCompressionQuality(e,t,r){null!=e&&"lerc"!==this.format&&(t[r]=e)}writeCompressionTolerance(e,t,r){"lerc"===this.format&&null!=e&&(t[r]=e)}get fieldsIndex(){return this.fields?new P(this.fields):null}set format(e){e&&Re.has(e.toLowerCase())&&this._set("format",e.toLowerCase())}readFormat(e,t){return"esriImageServiceDataTypeVector-UV"===t.serviceDataType||"esriImageServiceDataTypeVector-MagDir"===t.serviceDataType||null!=this.pixelFilter?"lerc":"jpgpng"}readMinScale(e,t){return null!=t.minLOD&&null!=t.maxLOD?e:0}readMaxScale(e,t){return null!=t.minLOD&&null!=t.maxLOD?e:0}set mosaicRule(e){let t=e;t&&t.mosaicMethod&&(t=N.fromJSON({...t.toJSON(),mosaicMethod:t.mosaicMethod,mosaicOperation:t.mosaicOperation})),this._set("mosaicRule",t)}readMosaicRule(e,t){const r=e||t.mosaicRule;return r?N.fromJSON(r):this._isMosaicRuleSupported(t)?N.fromJSON(t):null}writeMosaicRule(e,t,r){let i=this.mosaicRule;const s=this.definitionExpression;i?s&&s!==i.where&&(i=i.clone(),i.where=s):s&&(i=new N({where:s})),this._isValidCustomizedMosaicRule(i)&&(t[r]=i.toJSON())}get multidimensionalInfo(){return p(this.serviceRasterInfo)?this.serviceRasterInfo.multidimensionalInfo:null}writeNoData(e,t,r){null!=e&&"number"==typeof e&&(t[r]=ve(e))}readObjectIdField(e,t){if(!e){const r=t.fields.filter((e=>"esriFieldTypeOID"===e.type||"oid"===e.type));e=r&&r[0]&&r[0].name}return e}get parsedUrl(){return this.url?f(this.url):null}set renderer(e){this.loaded&&(e=this._configRenderer(e)),this._set("renderer",e)}readRenderer(e,t,i){const s=t?.layerDefinition?.drawingInfo?.renderer,n=r(s,i);return null==n?null:("vector-field"===n.type&&t.symbolTileSize&&!s.symbolTileSize&&(n.symbolTileSize=t.symbolTileSize),T(n)||u.getLogger(this.declaredClass).warn("ArcGISImageService","Imagery layer doesn't support given renderer type."),n)}writeRenderer(e,t,r){t.layerDefinition=t.layerDefinition||{},t.layerDefinition.drawingInfo=t.layerDefinition.drawingInfo||{},t.layerDefinition.drawingInfo.renderer=e.toJSON(),"vector-field"===e.type&&(t.symbolTileSize=e.symbolTileSize)}get rasterFields(){const e=this._rasterAttributeTableFieldPrefix||"Raster.",t=new j({name:"Raster.ItemPixelValue",alias:"Item Pixel Value",domain:null,editable:!1,length:50,type:"string"}),r=new j({name:"Raster.ServicePixelValue",alias:"Service Pixel Value",domain:null,editable:!1,length:50,type:"string"}),i=new j({name:"Raster.ServicePixelValue.Raw",alias:"Raw Service Pixel Value",domain:null,editable:!1,length:50,type:"string"});let s=this.fields?l(this.fields):[];s.push(r),this.capabilities.operations.supportsQuery&&this.fields&&this.fields.length>0&&s.push(t),this.version>=10.4&&p(this.rasterFunctionInfos)&&this.rasterFunctionInfos.some((e=>"none"===e.name.toLowerCase()))&&s.push(i),p(this.rasterFunctionInfos)&&this.rasterFunctionInfos.filter((e=>"none"!==e.name.toLowerCase())).forEach((e=>{s.push(new j({name:"Raster.ServicePixelValue."+e.name,alias:e.name,domain:null,editable:!1,length:50,type:"string"}))})),this._isVectorDataSet()&&(s.push(new j({name:"Raster.Magnitude",alias:"Magnitude",domain:null,editable:!1,type:"double"})),s.push(new j({name:"Raster.Direction",alias:"Direction",domain:null,editable:!1,type:"double"})));const{attributeTable:n}=this.rasterInfo;if(p(n)){const t=n.fields.filter((e=>"esriFieldTypeOID"!==e.type&&"value"!==e.name.toLowerCase())).map((t=>{const r=l(t);return r.name=e+t.name,r}));s=s.concat(t)}return s}set renderingRule(e){let t=e;t&&t.rasterFunction&&(t=J.fromJSON({...t.toJSON(),rasterFunction:t.rasterFunction,rasterFunctionArguments:t.rasterFunctionArguments})),this._set("renderingRule",t)}readRenderingRule(e,t){const r=t.rasterFunctionInfos;return t.renderingRule||r&&r.length&&"None"!==r[0].name?this._isRFTJson(t.renderingRule)?J.fromJSON({rasterFunctionDefinition:t.renderingRule}):J.fromJSON(t.renderingRule||{rasterFunctionInfos:t.rasterFunctionInfos}):null}writeRenderingRule(e,t,r){const i=e.toJSON();i.rasterFunctionDefinition?t[r]=i.rasterFunctionDefinition:t[r]=i}readSpatialReference(e,t){const r=e||t.extent.spatialReference;return r?ye.fromJSON(r):null}readPixelType(e){return ge.fromJSON(e)||e}writePixelType(e,t,r){(c(this.serviceRasterInfo)||this.pixelType!==this.serviceRasterInfo.pixelType)&&(t[r]=ge.toJSON(e))}readVersion(e,t){let r=t.currentVersion;return r||(r=t.hasOwnProperty("fields")||t.hasOwnProperty("timeInfo")?10:9.3),r}applyFilter(e){let t=e;return this.pixelFilter&&(t=this._clonePixelData(e),this.pixelFilter(t)),t}async applyRenderer(e,t){let r=e;if(!this._isPicture()&&this.renderer&&this.symbolizer&&!this.pixelFilter){const i=JSON.stringify(this._cachedRendererJson)!==JSON.stringify(this.renderer.toJSON()),s=this._rasterJobHandler.instance,{bandIds:n}=this;if(s){i&&(this.symbolizer.bind(),await s.updateSymbolizer(this.symbolizer,t),this._cachedRendererJson=this.renderer.toJSON());const o=await s.symbolize({bandIds:n,...e},t);r={extent:e.extent,pixelBlock:o}}else r={extent:e.extent,pixelBlock:this.symbolizer.symbolize({bandIds:n,...e})}}return r}destroy(){this._shutdownJobHandler()}increaseRasterJobHandlerUsage(){this._rasterJobHandler.refCount++}decreaseRasterJobHandlerUsage(){this._rasterJobHandler.refCount--,this._rasterJobHandler.refCount<=0&&this._shutdownJobHandler()}async computeAngles(e,t){if(await this._fetchCapabilities(t?.signal),!this.capabilities.operations.supportsComputeAngles)throw new o("imagery-layer:compute-angles","this operation is not supported on the input image service");return e=R(pe,e).clone(),G(this.url,e,this._getRequestOptions(t))}async computePixelSpaceLocations(e,t){if(await this._fetchCapabilities(t?.signal),!this.capabilities.operations.supportsComputePixelLocation)throw new o("imagery-layer:compute-pixel-space-locations","this operation is not supported on the input image service");return e=R(de,e).clone(),W(this.url,e,this._getRequestOptions(t))}async computeHistograms(e,t){if(await this._fetchCapabilities(t?.signal),!this.capabilities.operations.supportsComputeHistograms)throw new o("imagery-layer:compute-histograms","this operation is not supported on the input image service");e=R(ce,e).clone();const{raster:r,mosaicRule:i,renderingRule:s}=this;return s&&null==e.renderingRule&&(e.renderingRule=s),i&&null==e.mosaicRule&&(e.mosaicRule=i),r&&null==e.raster&&(e.raster=r),K(this.url,e,this._getRequestOptions(t))}async computeStatisticsHistograms(e,t){if(await this._fetchCapabilities(t?.signal),!this.capabilities.operations.supportsComputeStatisticsHistograms)throw new o("imagery-layer:compute-statistics-histograms","this operation is not supported on the input image service");e=R(ce,e).clone();const{raster:r,mosaicRule:i,renderingRule:s}=this;return s&&null==e.renderingRule&&(e.renderingRule=s),i&&null==e.mosaicRule&&(e.mosaicRule=i),r&&null==e.raster&&(e.raster=r),X(this.url,e,this._getRequestOptions(t))}getField(e){const{fieldsIndex:t}=this;return p(t)?t.get(e):void 0}getFieldDomain(e,t){const r=this.getField(e);return r?r.domain:null}fetchImage(e,t,r,i={}){if(null==e||null==t||null==r)return Promise.reject(new o("imagery-layer:fetch-image","Insufficient parameters for requesting an image. A valid extent, width and height values are required."));const s=this.renderer||this.symbolizer?this.generateRasterInfo(this.renderingRule,{signal:i.signal}):null;return d(s).then((s=>{s&&(this.rasterInfo=s);const n={imageServiceParameters:this.getExportImageServiceParameters(e,t,r,i.timeExtent),imageProps:{extent:e,width:t,height:r,format:this.format},requestAsImageElement:i.requestAsImageElement&&!this.pixelFilter||!1,signal:i.signal};return this._requestArrayBuffer(n)}))}fetchKeyProperties(e){return n(this.parsedUrl.path+"/keyProperties",{query:this._getQueryParams({renderingRule:this.version>=10.3?e?.renderingRule:null})}).then((e=>e.data))}fetchRasterAttributeTable(e){return this.version<10.1?Promise.reject(new o("#fetchRasterAttributeTable()","Failed to get rasterAttributeTable")):n(this.parsedUrl.path+"/rasterAttributeTable",{query:this._getQueryParams({renderingRule:this.version>=10.3?e?.renderingRule:null})}).then((e=>ie.fromJSON(e.data)))}getCatalogItemRasterInfo(e,t){const r={...t,query:this._getQueryParams()};return ue(this.parsedUrl.path,e,r)}async getCatalogItemICSInfo(e,t){const{data:r}=await n(this.parsedUrl.path+"/"+e+"/info/ics",{query:this._getQueryParams(),...t}),i=r&&r.ics;if(!i)return;let s=null;try{s=(await n(this.parsedUrl.path+"/"+e+"/info",{query:this._getQueryParams(),...t})).data.extent}catch{}if(!s||!s.spatialReference)return{ics:i,icsToPixelTransform:null,icsExtent:null,northDirection:null};const o=this.version>=10.7?n(this.parsedUrl.path+"/"+e+"/info/icstopixel",{query:this._getQueryParams(),...t}).then((e=>e.data)).catch((()=>({}))):{},a=s.spatialReference,l={geometries:JSON.stringify({geometryType:"esriGeometryEnvelope",geometries:[s]}),inSR:a.wkid||JSON.stringify(a),outSR:"0:"+e},u=n(this.parsedUrl.path+"/project",{query:this._getQueryParams(l),...t}).then((e=>e.data)).catch((()=>({}))),p=5,c=(s.xmin+s.xmax)/2,m=(s.ymax-s.ymin)/(p+1),d=s.ymin+m,h=[];for(let n=0;n<p;n++)h.push({x:c,y:d+m*n});const f={geometries:JSON.stringify({geometryType:"esriGeometryPoint",geometries:h}),inSR:a.wkid||JSON.stringify(a),outSR:"0:"+e},y=n(this.parsedUrl.path+"/project",{query:this._getQueryParams(f),...t}).then((e=>e.data)).catch((()=>({}))),g=await Promise.all([o,u,y]);let R=g[0].ipxf;if(null==R){const e=i.geodataXform?.xf_0;"topup"===e?.name?.toLowerCase()&&6===e?.coefficients?.length&&(R={affine:{name:"ics [sensor: Frame] to pixel (column, row) transformation",coefficients:e.coefficients,cellsizeRatio:0,type:"GeometricXform"}})}const v=te.fromJSON(g[1]&&g[1].geometries&&g[1].geometries[0]);v&&(v.spatialReference=new ye({wkid:0,imageCoordinateSystem:i}));const S=g[2].geometries?g[2].geometries.filter((e=>null!=e&&null!=e.x&&null!=e.y&&"NaN"!==e.x&&"NaN"!==e.y)):[],b=S.length;if(b<3)return{ics:i,icsToPixelTransform:R,icsExtent:v,northDirection:null};let I=0,x=0,_=0,w=0;for(let n=0;n<b;n++)I+=S[n].x,x+=S[n].y,_+=S[n].x*S[n].x,w+=S[n].x*S[n].y;const F=(b*w-I*x)/(b*_-I*I);let D=0;const j=S[p-1].x>S[0].x,P=S[p-1].y>S[0].y;return F===1/0?D=P?90:270:0===F?D=j?0:180:F>0?D=j?180*Math.atan(F)/Math.PI:180*Math.atan(F)/Math.PI+180:F<0&&(D=P?180+180*Math.atan(F)/Math.PI:360+180*Math.atan(F)/Math.PI),{ics:i,icsToPixelTransform:R,icsExtent:v,northDirection:D}}async generateRasterInfo(e,t){if(await this.load(),!e||"none"===e?.functionName?.toLowerCase()||this._isVectorFieldResampleFunction(e))return this.serviceRasterInfo;const r=Se(e);if(this._functionRasterInfos[r])return this._functionRasterInfos[r];const i=this._generateRasterInfo(e,t);this._functionRasterInfos[r]=i;try{return await i}catch{return this._functionRasterInfos[r]=null,null}}getExportImageServiceParameters(e,t,r,i){e=e.clone().shiftCentralMeridian();const s=$(e.spatialReference,this.parsedUrl.path);this.pixelType!==this.serviceRasterInfo.pixelType&&(this.exportImageServiceParameters.pixelType=this.pixelType);const n=this.exportImageServiceParameters.toJSON(),{bandIds:o,noData:a}=n;let{renderingRule:l}=n;const u=this.renderingRule?.rasterFunctionDefinition,p=!this.renderer||"raster-stretch"===this.renderer.type;if(o?.length&&this._hasRenderingRule(this.renderingRule)&&!u&&p){const e={rasterFunction:"ExtractBand",rasterFunctionArguments:{BandIds:o}};if("Stretch"===l.rasterFunction)e.rasterFunctionArguments.Raster=l.rasterFunctionArguments.Raster,l.rasterFunctionArguments.Raster=e;else if("Colormap"===l.rasterFunction){const t=l.rasterFunctionArguments.Raster;"Stretch"===t?.rasterFunction?(e.rasterFunctionArguments.Raster=t.rasterFunctionArguments.Raster,t.rasterFunctionArguments.Raster=e):(e.rasterFunctionArguments.Raster=t,l.rasterFunctionArguments.Raster=e)}else e.rasterFunctionArguments.Raster=l,l=e;n.bandIds=void 0}else n.bandIds=o?.join(",");a instanceof Array&&a.length>0&&(n.noData=a.join(","));const c=this._serviceSupportsMosaicRule?this._combineMosaicRuleWithTimeExtent(this.exportImageServiceParameters.mosaicRule,i):null;n.mosaicRule=c&&JSON.stringify(c),n.renderingRule=this._getRenderingRuleString(J.fromJSON(l));const m={};if(i){const{start:e,end:t}=i.toJSON();e&&t&&e===t?m.time=""+e:null==e&&null==t||(m.time=`${e??"null"},${t??"null"}`)}return{bbox:e.xmin+","+e.ymin+","+e.xmax+","+e.ymax,bboxSR:s,imageSR:s,size:t+","+r,...n,...m}}async getSamples(e,t){if(await this._fetchCapabilities(t?.signal),!this.capabilities.operations.supportsGetSamples)throw new o("imagery-layer:get-samples","getSamples operation is not supported on the input image service");e=R(he,e).clone();const{raster:r}=this;return r&&null==e.raster&&(e.raster=r),Y(this.url,e,this._getRequestOptions(t))}async identify(e,t){if(await this._fetchCapabilities(t?.signal),!this.capabilities.operations.supportsIdentify)throw new o("imagery-layer:query-rasters","query operation is not supported on the input image service");e=R(me,e).clone();const{raster:r,mosaicRule:i,renderingRule:s}=this;if(s&&null==e.renderingRule&&(e.renderingRule=s),i&&null==e.mosaicRule){const t=this._combineMosaicRuleWithTimeExtent(i,e.timeExtent);e.mosaicRule=m(t)}return r&&null==e.raster&&(e.raster=r),Z(this.url,e,this._getRequestOptions(t))}createQuery(){const e=new se;return e.outFields=["*"],e.returnGeometry=!0,e.where=this.definitionExpression||"1=1",e}async queryRasters(e,t){return({query:e,requestOptions:t}=await this._prepareForQuery(e,t)),ee(this.url,e,t)}async queryObjectIds(e,t){return({query:e,requestOptions:t}=await this._prepareForQuery(e,t)),oe(this.url,e,t)}async queryRasterCount(e,t){return({query:e,requestOptions:t}=await this._prepareForQuery(e,t)),ne(this.url,e,t)}async queryVisibleRasters(e,t){if(!e)throw new o("imagery-layer: query-visible-rasters","missing query parameter");await this.load();const{pixelSize:r,returnDomainValues:i,returnTopmostRaster:s,showNoDataRecords:n}=t||{pixelSize:null,returnDomainValues:!1,returnTopmostRaster:!1,showNoDataRecords:!1};let a=!1,l=null,u=null;const m="raster.servicepixelvalue",d=this._rasterFunctionNamesIndex;if(p(e.outFields)&&(a=e.outFields.some((e=>!e.toLowerCase().includes(m))),this.version>=10.4)){const t=e.outFields.filter((e=>e.toLowerCase().includes(m)&&e.length>m.length)).map((e=>{const t=e.slice(m.length+1);return[this._updateRenderingRulesFunctionName(t,d),t]}));l=t.map((e=>new J({functionName:e[0]}))),u=t.map((e=>e[1])),0===l.length?this.renderingRule?(l.push(this.renderingRule),u.push(this.renderingRule.functionName)):l=null:this.renderingRule&&!l.some((e=>e.functionName===this.renderingRule.functionName))&&(l.push(this.renderingRule),u.push(this.renderingRule.functionName))}const h=c(e.outSpatialReference)||e.outSpatialReference.equals(this.spatialReference),f=e.timeExtent||this.timeExtent,y=this._combineMosaicRuleWithTimeExtent(this.exportImageServiceParameters.mosaicRule,f),g=this._getQueryParams({geometry:e.geometry,timeExtent:f,mosaicRule:y,renderingRule:this.version<10.4?this.renderingRule:null,renderingRules:l,pixelSize:r,returnCatalogItems:a,returnGeometry:h,raster:this.raster,maxItemCount:s?1:null});delete g.f;const R=new me(g);try{await this.generateRasterInfo(this.renderingRule);const r=await Z(this.url,R,{signal:t?.signal,query:{...this.customParameters}}),s=e.outFields,o=r.value.toLowerCase().includes("nodata");if(!(a&&!h&&r?.catalogItems?.features.length&&(n||!o)))return this._processVisibleRastersResponse(r,{returnDomainValues:i,templateRRFunctionNames:u,showNoDataRecords:n,templateFields:s});const l=this.objectIdField||"ObjectId",c=r.catalogItems.features,m=c.map((e=>e.attributes?.[l])),d=new se({objectIds:m,returnGeometry:!0,outSpatialReference:e.outSpatialReference,outFields:[l]}),f=await this.queryRasters(d);return f?.features?.length&&f.features.forEach((t=>{c.forEach((r=>{r.attributes[l]===t.attributes[l]&&(r.geometry=new re(t.geometry),p(e.outSpatialReference)&&(r.geometry.spatialReference=e.outSpatialReference))}))})),this._processVisibleRastersResponse(r,{returnDomainValues:i,templateRRFunctionNames:u,showNoDataRecords:n,templateFields:s})}catch{throw new o("imagery-layer:query-visible-rasters","encountered error when querying visible rasters")}}async fetchVariableStatisticsHistograms(e,t){const r=n(this.parsedUrl.path+"/statistics",{query:this._getQueryParams({variable:e}),signal:t}).then((e=>e.data?.statistics)),i=n(this.parsedUrl.path+"/histograms",{query:this._getQueryParams({variable:e}),signal:t}).then((e=>e.data?.histograms)),s=await Promise.all([r,i]);return s[0]&&s[0].forEach((e=>{e.avg=e.mean,e.stddev=e.standardDeviation})),{statistics:s[0]||null,histograms:s[1]||null}}async createFlowMesh(e,t){const r=this._rasterJobHandler.instance;return r?r.createFlowMesh(e,t):fe(e.meshType,e.simulationSettings,e.flowData,p(t.signal)?t.signal:(new AbortController).signal)}async _fetchService(e){await this._fetchServiceInfo(e),this.rasterInfo||(this.rasterInfo=this.serviceRasterInfo);const t=this.sourceJSON,r=p(this.serviceRasterInfo)?Promise.resolve(this.serviceRasterInfo):ae(this.parsedUrl.path,t,{signal:e,query:this._getQueryParams()}).then((e=>(this._set("serviceRasterInfo",e),e))),i=this._hasRenderingRule(this.renderingRule)?this.generateRasterInfo(this.renderingRule,{signal:e}):null,s=this._getRasterFunctionInfos();return Promise.all([r,i,s]).then((e=>{e[1]?this._set("rasterInfo",e[1]):this._set("rasterInfo",e[0]),e[2]&&this._set("rasterFunctionInfos",e[2]),this.renderer&&!this._isSupportedRenderer(this.renderer)&&(this._set("renderer",null),u.getLogger(this.declaredClass).warn("ArcGISImageService","Switching to the default renderer. Renderer applied is not valid for this Imagery Layer")),this._set("renderer",this._configRenderer(this.renderer)),this.addHandles(h((()=>this.renderingRule),(e=>{(this.renderer||this.symbolizer||this.popupEnabled&&this.popupTemplate)&&this.generateRasterInfo(e).then((e=>{e&&(this.rasterInfo=e)}))})));const{serviceRasterInfo:t}=this;p(t.multidimensionalInfo)&&this._updateMultidimensionalDefinition(t)}))}_combineMosaicRuleWithTimeExtent(e,t){const r=this.timeInfo;if(c(e)||c(this.multidimensionalInfo)||c(t)||c(r?.startField))return e;const{startField:i}=r,s=this.multidimensionalInfo.variables.some((e=>e.dimensions.some((e=>e.name===i))))?i:"StdTime";if(e=e.clone(),"mosaic-dataset"===this._serviceSourceType)return e.multidimensionalDefinition=e.multidimensionalDefinition?.filter((e=>e.dimensionName!==s)),this._cleanupMultidimensionalDefinition(e);e.multidimensionalDefinition=e.multidimensionalDefinition||[];const n=e.multidimensionalDefinition.filter((e=>e.dimensionName===s)),o=p(t.start)?t.start.getTime():null,a=p(t.end)?t.end.getTime():null,l=null==o||null==a||o===a,u=l?[o||a]:[[o,a]],m=this.version>=10.8;if(n.length)n.forEach((e=>{e.dimensionName===s&&(m?(e.dimensionName=null,e.isSlice=null,e.values=null):(e.isSlice=l,e.values=u))}));else if(!m){const t=e.multidimensionalDefinition.filter((e=>null!=e.variableName&&null==e.dimensionName));t.length?t.forEach((e=>{e.dimensionName=s,e.isSlice=l,e.values=u})):e.multidimensionalDefinition.push(new F({variableName:"",dimensionName:s,isSlice:l,values:u}))}return this._cleanupMultidimensionalDefinition(e)}_cleanupMultidimensionalDefinition(e){return c(e)?null:(e.multidimensionalDefinition&&(e.multidimensionalDefinition=e.multidimensionalDefinition.filter((e=>!(!e.variableName&&!e.dimensionName))),0===e.multidimensionalDefinition.length&&(e.multidimensionalDefinition=null)),"mosaic-dataset"!==this._serviceSourceType&&null==e.multidimensionalDefinition?null:e)}async _prepareForQuery(e,t){if(await this._fetchCapabilities(t?.signal),!this.capabilities.operations.supportsQuery)throw new o("imagery-layer:query-rasters","query operation is not supported on the input image service");return e=p(e)?R(se,e):this.createQuery(),t=this._getRequestOptions(t),this.raster&&(t.query={...t.query,raster:this.raster}),{query:e,requestOptions:t}}async _initJobHandler(){if(null!=this._rasterJobHandler.connectionPromise)return this._rasterJobHandler.connectionPromise;const e=new V;this._rasterJobHandler.connectionPromise=e.initialize().then((()=>{this._rasterJobHandler.instance=e}),(()=>null)),await this._rasterJobHandler.connectionPromise}_shutdownJobHandler(){this._rasterJobHandler.instance&&this._rasterJobHandler.instance.destroy(),this._rasterJobHandler.instance=null,this._rasterJobHandler.connectionPromise=null,this._rasterJobHandler.refCount=0,this._cachedRendererJson=null}_isSupportedRenderer(e){const{rasterInfo:t,renderingRule:r}=this;return"unique-value"===e.type&&this._hasRenderingRule(r)&&1===t.bandCount&&["u8","s8"].includes(t.pixelType)||U(this.rasterInfo).includes(this.renderer.type)}async _fetchCapabilities(e){return this.capabilities||await this._fetchServiceInfo(e),this.capabilities}async _fetchServiceInfo(e){let t=this.sourceJSON;if(!t){const{data:r,ssl:i}=await n(this.parsedUrl.path,{query:this._getQueryParams(),signal:e});t=r,this.sourceJSON=t,i&&(this.url=this.url.replace(/^http:/i,"https:"))}if(t.capabilities?.toLowerCase().split(",").map((e=>e.trim())).indexOf("tilesonly")>-1)throw new o("imagery-layer:fetch-service-info","use ImageryTileLayer to open tiles-only image services");this.read(t,{origin:"service",url:this.parsedUrl})}_isMosaicDataset(e){return e.serviceSourceType?"esriImageServiceSourceTypeMosaicDataset"===e.serviceSourceType:e.fields?.length>0}_isMosaicRuleSupported(e){if(!e)return!1;const t=this._isMosaicDataset(e),r=e.currentVersion>=10.71&&e.hasMultidimensions&&e.timeInfo&&!(e.objectIdField&&e.fields?.length>1);return t||r}_isVectorFieldResampleFunction(e){if(c(e))return!1;const{functionName:t,functionArguments:r}=e,i="resample"===t?.toLowerCase(),s=r?.ResampleType||r?.resampleType;return i&&(7===s||10===s)}_isPicture(){return!this.format||this.format.includes("jpg")||this.format.includes("png")}_configRenderer(e){if(!this._isPicture()&&!this.pixelFilter||this._isVectorDataSet()){if(!this.bandIds&&this.rasterInfo.bandCount>=3){const e=z(this.rasterInfo);!e||3===this.rasterInfo.bandCount&&0===e[0]&&1===e[1]&&2===e[2]||(this.bandIds=e)}e||(e=L(this.rasterInfo,{bandIds:this.bandIds,variableName:this.renderingRule?null:this.mosaicRule?.multidimensionalDefinition?.[0].variableName}));const t=B(e.toJSON());this.symbolizer?(this.symbolizer.rendererJSON=t,this.symbolizer.rasterInfo=this.rasterInfo):this.symbolizer=new k({rendererJSON:t,rasterInfo:this.rasterInfo}),this.symbolizer.bind().success||(this.symbolizer=null)}return e}_clonePixelData(e){return null==e?e:{extent:e.extent&&e.extent.clone(),pixelBlock:p(e.pixelBlock)&&e.pixelBlock.clone()}}_getQueryParams(e){p(e?.renderingRule)&&"string"!=typeof e.renderingRule&&(e.renderingRule=this._getRenderingRuleString(e.renderingRule));const{raster:t,viewId:r}=this;return{raster:t,viewId:r,f:"json",...e,...this.customParameters}}_getRequestOptions(e){return{...e,query:{...e?.query,...this.customParameters}}}_decodePixelBlock(e,t,r){return this._rasterJobHandler.instance?this._rasterJobHandler.instance.decode({data:e,options:t}):E(e,t,r)}async _getRasterFunctionInfos(e){const t=this.sourceJSON.rasterFunctionInfos;if(this.loaded)return t;if(t&&this.version>=10.3){if(1===t.length&&"none"===t[0].name.toLowerCase())return t;return(await n(this.parsedUrl.path+"/rasterFunctionInfos",{query:this._getQueryParams(),signal:e})).data?.rasterFunctionInfos}return null}async _requestArrayBuffer(e){const{imageProps:t,requestAsImageElement:r,signal:i}=e;if(r&&!this.pixelFilter&&t.format?.indexOf("png")>-1){return{imageElement:(await n(this.parsedUrl.path+"/exportImage",{responseType:"image",query:this._getQueryParams({f:"image",...e.imageServiceParameters}),signal:i})).data,params:t}}const s=this._initJobHandler(),a=n(this.parsedUrl.path+"/exportImage",{responseType:"array-buffer",query:this._getQueryParams({f:"image",...e.imageServiceParameters}),signal:i}),l=(await Promise.all([a,s]))[0].data,u=t.format||"jpgpng";let p=u;if("bsq"!==p&&"bip"!==p&&(p=Q(l)),!p)throw new o("imagery-layer:fetch-image","unsupported format signature "+String.fromCharCode.apply(null,new Uint8Array(l)));const c={signal:i},m="gif"===u||"bmp"===u||u.includes("png")&&("png"===p||"jpg"===p)?E(l,{useCanvas:!0,...t},c):this._decodePixelBlock(l,{width:t.width,height:t.height,planes:null,pixelType:null,noDataValue:null,format:u},c);return{pixelData:{pixelBlock:await m,extent:t.extent},params:t}}_generateRasterInfo(e,t){const r={...t,query:this._getQueryParams()};return le(this.parsedUrl.path,e,r)}_isValidCustomizedMosaicRule(e){return e&&JSON.stringify(e.toJSON())!==JSON.stringify(this._defaultServiceMosaicRule?.toJSON())}_updateMultidimensionalDefinition(e){if(this._isValidCustomizedMosaicRule(this.mosaicRule))return;const t=A(e);if(p(t)&&t.length>0){this.mosaicRule=this.mosaicRule||new N;const e=this.mosaicRule.multidimensionalDefinition;(!e||e&&e.length<=0)&&(this.mosaicRule.multidimensionalDefinition=t)}}_processVisibleRastersResponse(e,r){r=r||{};const i=e.value,{templateRRFunctionNames:s,showNoDataRecords:n,returnDomainValues:o,templateFields:a}=r,l=e.processedValues;let u=e.catalogItems&&e.catalogItems.features,c=e.properties&&e.properties.Values&&e.properties.Values.map((e=>e.replace(/ /gi,", ")))||[];const m=this.objectIdField||"ObjectId",d="string"==typeof i&&i.toLowerCase().includes("nodata"),h=[];if(i&&!u&&!d){const e={};e[m]=0;c=[i],u=[new t(this.fullExtent,null,e)]}if(!u)return[];let f,y,g;this._updateResponseFieldNames(u,a),d&&!n&&(u=[]);for(let t=0;t<u.length;t++){if(f=u[t],null!=i){if(y=c[t],g=this.renderingRule&&l&&l.length>0&&s&&s.length>0&&s.includes(this.renderingRule.functionName)?l[s.indexOf(this.renderingRule.functionName)]:i,"nodata"===y.toLowerCase()&&!n)continue;const e="Raster.ItemPixelValue",r="Raster.ServicePixelValue";f.attributes[e]=y,f.attributes[r]=g,this._updateFeatureWithMagDirValues(f,y);const o=this.fields&&this.fields.length>0;let a=this.renderingRule&&p(this.serviceRasterInfo.attributeTable)?o?y:i:g;this.renderingRule||(a=o?y:i),this._updateFeatureWithRasterAttributeTableValues(f,a)}if(f.sourceLayer=f.layer=this,o&&this._updateFeatureWithDomainValues(f),s&&l&&s.length===l.length)for(let e=0;e<s.length;e++){const t="Raster.ServicePixelValue."+s[e];f.attributes[t]=l[e]}h.push(u[t])}return h}_updateFeatureWithRasterAttributeTableValues(e,t){const r=this.rasterInfo&&this.rasterInfo.attributeTable||this.serviceRasterInfo.attributeTable;if(c(r))return;const{features:i,fields:s}=r,n=s.map((e=>e.name)).filter((e=>"value"===e.toLowerCase())),o=n&&n[0];if(!o)return;const a=i.filter((e=>e.attributes[o]===(null!=t?parseInt(t,10):null)));a&&a[0]&&s.forEach((t=>{const r=this._rasterAttributeTableFieldPrefix+t.name;e.attributes[r]=a[0].attributes[t.name]}))}_updateFeatureWithMagDirValues(e,t){if(!this._isVectorDataSet())return;const r=t.split(/,\s*/).map((e=>parseFloat(e))),i=r.map((e=>[e])),s=r.map((e=>({minValue:e,maxValue:e,noDataValue:null}))),n=new O({height:1,width:1,pixelType:"f32",pixels:i,statistics:s});null!=this.pixelFilter&&this.pixelFilter({pixelBlock:n,extent:new te(0,0,0,0,this.spatialReference)});const o="esriImageServiceDataTypeVector-MagDir"===this.serviceDataType?[n.pixels[0][0],n.pixels[1][0]]:H([n.pixels[0][0],n.pixels[1][0]]);e.attributes["Raster.Magnitude"]=o[0],e.attributes["Raster.Direction"]=o[1]}_updateFeatureWithDomainValues(e){const t=this.fields&&this.fields.filter((e=>e.domain&&"coded-value"===e.domain.type));null!=t&&t.forEach((t=>{const r=e.attributes[t.name];if(null!=r){const i=t.domain.codedValues.find((e=>e.code===r));i&&(e.attributes[t.name]=i.name)}}))}_updateResponseFieldNames(e,t){if(!t||t.length<1)return;const r=this.fieldsIndex;c(r)||e.forEach((e=>{if(e&&e.attributes)for(const i of t)if(r.has(i)){const t=r.get(i).name;t!==i&&(e.attributes[i]=e.attributes[t],delete e.attributes[t])}}))}_getRenderingRuleString(e){if(this._hasRenderingRule(e)){let t=e.toJSON();return t=t.rasterFunctionDefinition??t,(t.thumbnail||t.thumbnailEx)&&(t.thumbnail=t.thumbnailEx=null),JSON.stringify(t)}return null}_hasRenderingRule(e){return e&&e.functionName&&"none"!==e.functionName.toLowerCase()}_updateRenderingRulesFunctionName(e,t){if(!e||e.length<1)return;if("Raw"===e)return e.replace("Raw","None");const r=e.toLowerCase().replace(/ /gi,"_");return t.has(r)?t.get(r):e}_isRFTJson(e){return e&&e.name&&e.arguments&&e.function&&e.hasOwnProperty("functionType")}_isVectorDataSet(){return"esriImageServiceDataTypeVector-UV"===this.serviceDataType||"esriImageServiceDataTypeVector-MagDir"===this.serviceDataType}_readCapabilities(e){const t=e.capabilities?e.capabilities.toLowerCase().split(",").map((e=>e.trim())):["image","catalog"],{currentVersion:r,advancedQueryCapabilities:i,maxRecordCount:s}=e,n=t.includes("image"),o="esriImageServiceDataTypeElevation"===e.serviceDataType,a=!!(e.spatialReference||e.extent&&e.extent.spatialReference),l=t.includes("edit");return{data:{supportsAttachment:!1},operations:{supportsComputeHistograms:n,supportsExportImage:n,supportsIdentify:n,supportsMeasure:t.includes("mensuration")&&a,supportsDownload:t.includes("download"),supportsQuery:t.includes("catalog")&&e.fields&&e.fields.length>0,supportsGetSamples:r>=10.2&&n,supportsProject:r>=10.3&&n,supportsComputeStatisticsHistograms:r>=10.4&&n,supportsQueryBoundary:r>=10.6&&n,supportsCalculateVolume:r>=10.7&&o,supportsComputePixelLocation:r>=10.7&&t.includes("catalog"),supportsComputeAngles:r>=10.91,supportsAdd:l,supportsDelete:l,supportsEditing:l,supportsUpdate:l,supportsCalculate:!1,supportsTruncate:!1,supportsValidateSql:!1,supportsChangeTracking:!1,supportsQueryAttachments:!1,supportsResizeAttachments:!1,supportsSync:!1,supportsExceedsLimitStatistics:!1,supportsQueryAnalytics:!1,supportsQueryTopFeatures:!1},query:{maxRecordCount:s,maxRecordCountFactor:void 0,supportsStatistics:!!i?.supportsStatistics,supportsOrderBy:!!i?.supportsOrderBy,supportsDistinct:!!i?.supportsDistinct,supportsPagination:!!i?.supportsPagination,supportsStandardizedQueriesOnly:!!i?.useStandardizedQueries,supportsPercentileStatistics:!!i?.supportsPercentileStatistics,supportsCentroid:!!i?.supportsReturningGeometryCentroid,supportsDistance:!!i?.supportsQueryWithDistance,supportsExtent:!!i?.supportsReturningQueryExtent,supportsGeometryProperties:!!i?.supportsReturningGeometryProperties,supportsHavingClause:!!i?.supportsHavingClause,supportsQuantization:!1,supportsQuantizationEditMode:!1,supportsQueryGeometry:!1,supportsResultType:!1,supportsMaxRecordCountFactor:!1,supportsSqlExpression:!1,supportsTopFeaturesQuery:!1,supportsQueryByOthers:!1,supportsHistoricMoment:!1,supportsFormatPBF:!1,supportsDisjointSpatialRelationship:!1,supportsCacheHint:!1,supportsSpatialAggregationStatistics:!1,supportedSpatialAggregationStatistics:{envelope:!1,centroid:!1,convexHull:!1},supportsDefaultSpatialReference:!!i?.supportsDefaultSR,supportsCompactGeometry:!1,standardMaxRecordCount:void 0,tileMaxRecordCount:void 0}}}};return e([y()],g.prototype,"_functionRasterInfos",void 0),e([y()],g.prototype,"_rasterJobHandler",void 0),e([y({dependsOn:["_serviceSupportsMosaicRule"]})],g.prototype,"_defaultServiceMosaicRule",void 0),e([b("_defaultServiceMosaicRule",["defaultMosaicMethod"])],g.prototype,"readDefaultServiceMosaicRule",null),e([y()],g.prototype,"_cachedRendererJson",void 0),e([y({readOnly:!0})],g.prototype,"_serviceSourceType",void 0),e([b("_serviceSourceType",["serviceSourceType","fields"])],g.prototype,"readServiceSourceType",null),e([y({readOnly:!0})],g.prototype,"_serviceSupportsMosaicRule",void 0),e([b("_serviceSupportsMosaicRule",["currentVersion","fields"])],g.prototype,"readServiceSupportsMosaicRule",null),e([y()],g.prototype,"_rasterAttributeTableFieldPrefix",void 0),e([y({readOnly:!0})],g.prototype,"_rasterFunctionNamesIndex",null),e([y()],g.prototype,"adjustAspectRatio",void 0),e([y({type:[v],json:{write:!0}})],g.prototype,"bandIds",void 0),e([b("bandIds")],g.prototype,"readBandIds",null),e([y({readOnly:!0,json:{read:!1}})],g.prototype,"capabilities",void 0),e([b("service","capabilities",["capabilities","currentVersion","serviceDataType"])],g.prototype,"readCapabilities",null),e([y({type:Number})],g.prototype,"compressionQuality",void 0),e([x("compressionQuality")],g.prototype,"writeCompressionQuality",null),e([y({type:Number})],g.prototype,"compressionTolerance",void 0),e([x("compressionTolerance")],g.prototype,"writeCompressionTolerance",null),e([y({json:{read:{source:"copyrightText"}}})],g.prototype,"copyright",void 0),e([y({type:String,json:{name:"layerDefinition.definitionExpression",write:{enabled:!0,allowNull:!0}}})],g.prototype,"definitionExpression",void 0),e([y({readOnly:!0,constructOnly:!0})],g.prototype,"exportImageServiceParameters",void 0),e([y()],g.prototype,"rasterInfo",void 0),e([y({readOnly:!0,type:[j]})],g.prototype,"fields",void 0),e([y({readOnly:!0})],g.prototype,"fieldsIndex",null),e([y({type:["png","png8","png24","png32","jpg","bmp","gif","jpgpng","lerc","tiff"],json:{write:!0}})],g.prototype,"format",null),e([b("service","format",["serviceDataType"])],g.prototype,"readFormat",null),e([y({type:te})],g.prototype,"fullExtent",void 0),e([y({readOnly:!0})],g.prototype,"hasMultidimensions",void 0),e([y({json:{read:{source:"maxImageHeight"}}})],g.prototype,"imageMaxHeight",void 0),e([y({json:{read:{source:"maxImageWidth"}}})],g.prototype,"imageMaxWidth",void 0),e([y({type:String,json:{type:C.jsonValues,read:C.read,write:C.write}})],g.prototype,"interpolation",void 0),e([y()],g.prototype,"minScale",void 0),e([b("service","minScale")],g.prototype,"readMinScale",null),e([y()],g.prototype,"maxScale",void 0),e([b("service","maxScale")],g.prototype,"readMaxScale",null),e([y({type:N})],g.prototype,"mosaicRule",null),e([b("mosaicRule",["mosaicRule","defaultMosaicMethod"])],g.prototype,"readMosaicRule",null),e([x("mosaicRule")],g.prototype,"writeMosaicRule",null),e([y()],g.prototype,"multidimensionalInfo",null),e([y({json:{type:v}})],g.prototype,"noData",void 0),e([x("noData")],g.prototype,"writeNoData",null),e([y({type:String,json:{type:M.jsonValues,read:M.read,write:M.write}})],g.prototype,"noDataInterpretation",void 0),e([y({type:String,readOnly:!0,json:{read:{source:["fields"]}}})],g.prototype,"objectIdField",void 0),e([b("objectIdField")],g.prototype,"readObjectIdField",null),e([y({})],g.prototype,"geometryType",void 0),e([y({})],g.prototype,"typeIdField",void 0),e([y({})],g.prototype,"types",void 0),e([y({readOnly:!0})],g.prototype,"parsedUrl",null),e([y({type:Function})],g.prototype,"pixelFilter",void 0),e([y()],g.prototype,"raster",void 0),e([y()],g.prototype,"viewId",void 0),e([y({types:i,json:{name:"layerDefinition.drawingInfo.renderer",origins:{"web-scene":{types:s,name:"layerDefinition.drawingInfo.renderer",write:{overridePolicy:e=>({enabled:e&&"vector-field"!==e.type&&"flow"!==e.type})}}}}})],g.prototype,"renderer",null),e([b("renderer")],g.prototype,"readRenderer",null),e([x("renderer")],g.prototype,"writeRenderer",null),e([y()],g.prototype,"symbolizer",void 0),e([y(_)],g.prototype,"opacity",void 0),e([y({readOnly:!0})],g.prototype,"rasterFields",null),e([y({constructOnly:!0})],g.prototype,"rasterFunctionInfos",void 0),e([y({type:J})],g.prototype,"renderingRule",null),e([b("renderingRule",["renderingRule","rasterFunctionInfos"])],g.prototype,"readRenderingRule",null),e([x("renderingRule")],g.prototype,"writeRenderingRule",null),e([y()],g.prototype,"serviceDataType",void 0),e([y({readOnly:!0,type:ye})],g.prototype,"spatialReference",void 0),e([b("spatialReference",["spatialReference","extent"])],g.prototype,"readSpatialReference",null),e([y({json:{type:ge.jsonValues}})],g.prototype,"pixelType",void 0),e([b("pixelType")],g.prototype,"readPixelType",null),e([x("pixelType")],g.prototype,"writePixelType",null),e([y({constructOnly:!0,type:q})],g.prototype,"serviceRasterInfo",void 0),e([y()],g.prototype,"sourceJSON",void 0),e([y(w)],g.prototype,"url",void 0),e([y({readOnly:!0})],g.prototype,"version",void 0),e([b("version",["currentVersion","fields","timeInfo"])],g.prototype,"readVersion",null),g=e([I("esri.layers.mixins.ArcGISImageService")],g),g};export{be as ArcGISImageService};
5
+ import{_ as e}from"../../chunks/tslib.es6.js";import"../../geometry.js";import t from"../../Graphic.js";import{rasterRendererTypes as r,websceneRasterRendererTypes as i,read as s}from"../../rasterRenderers.js";import n from"../../request.js";import o from"../../core/Error.js";import{strict as a}from"../../core/jsonMap.js";import{clone as l}from"../../core/lang.js";import u from"../../core/Logger.js";import{isSome as p,isNone as c,unwrap as m}from"../../core/maybe.js";import{when as d}from"../../core/promiseUtils.js";import{watch as h}from"../../core/reactiveUtils.js";import{urlToObject as f}from"../../core/urlUtils.js";import{property as y,ensureRange as g}from"../../core/accessorSupport/decorators/property.js";import{Integer as R,ensureClass as v,ensureNumber as S}from"../../core/accessorSupport/ensureType.js";import{reader as b}from"../../core/accessorSupport/decorators/reader.js";import{subclass as I}from"../../core/accessorSupport/decorators/subclass.js";import{writer as x}from"../../core/accessorSupport/decorators/writer.js";import{opacity as _,url as w}from"../support/commonProperties.js";import F from"../support/DimensionalDefinition.js";import{ExportImageServiceParameters as D}from"../support/ExportImageServiceParameters.js";import j from"../support/Field.js";import P from"../support/FieldsIndex.js";import{isSupportedRendererType as T}from"../support/imageryRendererUtils.js";import N from"../support/MosaicRule.js";import O from"../support/PixelBlock.js";import{interpolationKebab as C,noDataInterpretationKebab as M}from"../support/rasterEnums.js";import J from"../support/RasterFunction.js";import q from"../support/RasterInfo.js";import V from"../support/RasterJobHandler.js";import{getDefaultMultidimensionalDefinition as A}from"../support/rasterDatasets/multidimensionalUtils.js";import{decode as E,getFormat as Q}from"../support/rasterFormats/RasterCodec.js";import{uvComponentToVector as H}from"../support/rasterFunctions/vectorFieldUtils.js";import{getSupportedRendererTypes as U,getDefaultBandCombination as z,createDefaultRenderer as L,normalizeRendererJSON as B}from"../../renderers/support/rasterRendererHelper.js";import k from"../../renderers/support/RasterSymbolizer.js";import{computeAngles as G,computePixelSpaceLocations as W,computeHistograms as K,computeStatisticsHistograms as X,getImageSpatialReferenceQueryParameter as $,getSamples as Y,identify as Z}from"../../rest/imageService.js";import"../../core/has.js";import"../support/source/DataLayerSource.js";import{executeQueryJSON as ee}from"../../rest/query/executeQueryJSON.js";import"../../core/unitUtils.js";import"../../geometry/support/spatialReferenceUtils.js";import"../graphics/featureConversionUtils.js";import te from"../../geometry/Extent.js";import"../../geometry/Geometry.js";import"../../geometry/Multipoint.js";import"../../geometry/Point.js";import re from"../../geometry/Polygon.js";import"../../geometry/Polyline.js";import"../../geometry/support/normalizeUtils.js";import"../../core/pbf.js";import ie from"../../rest/support/FeatureSet.js";import se from"../../rest/support/Query.js";import"../../kernel.js";import"../../rest/query/support/AttachmentInfo.js";import"../../rest/support/AttachmentQuery.js";import{executeForCount as ne}from"../../rest/query/executeForCount.js";import{executeForIds as oe}from"../../rest/query/executeForIds.js";import"../../rest/support/RelationshipQuery.js";import"../../rest/support/TopFeaturesQuery.js";import{fetchServiceRasterInfo as ae,generateRasterInfo as le}from"../../rest/imageService/fetchRasterInfo.js";import{getCatalogItemRasterInfo as ue}from"../../rest/imageService/getCatalogItemRasterInfo.js";import pe from"../../rest/support/ImageAngleParameters.js";import ce from"../../rest/support/ImageHistogramParameters.js";import me from"../../rest/support/ImageIdentifyParameters.js";import de from"../../rest/support/ImagePixelLocationParameters.js";import he from"../../rest/support/ImageSampleParameters.js";import{createFlowMesh as fe}from"../../views/2d/engine/flow/dataUtils.js";import ye from"../../geometry/SpatialReference.js";const ge=a()({U1:"u1",U2:"u2",U4:"u4",U8:"u8",S8:"s8",U16:"u16",S16:"s16",U32:"u32",S32:"s32",F32:"f32",F64:"f64",C64:"c64",C128:"c128",UNKNOWN:"unknown"}),Re=new Set(["png","png8","png24","png32","jpg","bmp","gif","jpgpng","lerc","tiff"]),ve=g(S,{min:0,max:255});function Se(e){if(!e)return null;const t=JSON.stringify(e).match(/"rasterFunction":"(.*?")/gi)?.map((e=>e.replace('"rasterFunction":"',"").replace('"',"")));return t?t.join("/"):null}const be=a=>{let g=class extends a{constructor(){super(...arguments),this._functionRasterInfos={},this._rasterJobHandler={instance:null,refCount:0,connectionPromise:null},this._defaultServiceMosaicRule=null,this._serviceSourceType=null,this._serviceSupportsMosaicRule=null,this._rasterAttributeTableFieldPrefix="Raster.",this.adjustAspectRatio=null,this.bandIds=void 0,this.capabilities=null,this.compressionQuality=void 0,this.compressionTolerance=.01,this.copyright=null,this.definitionExpression=null,this.exportImageServiceParameters=null,this.rasterInfo=null,this.fields=null,this.fullExtent=null,this.hasMultidimensions=!1,this.imageMaxHeight=4100,this.imageMaxWidth=4100,this.interpolation=void 0,this.minScale=0,this.maxScale=0,this.noData=null,this.noDataInterpretation=void 0,this.objectIdField=null,this.geometryType="polygon",this.typeIdField=null,this.types=[],this.pixelFilter=null,this.raster=void 0,this.viewId=void 0,this.symbolizer=null,this.rasterFunctionInfos=null,this.serviceDataType=null,this.spatialReference=null,this.pixelType=null,this.serviceRasterInfo=null,this.sourceJSON=null,this.url=null,this.version=void 0}initialize(){this._set("exportImageServiceParameters",new D({layer:this}))}readDefaultServiceMosaicRule(e,t){return this._serviceSupportsMosaicRule?N.fromJSON(t):null}readServiceSourceType(e,t){return this._isMosaicDataset(t)?"mosaic-dataset":"raster-dataset"}readServiceSupportsMosaicRule(e,t){return this._isMosaicRuleSupported(t)}get _rasterFunctionNamesIndex(){const e=new Map;return!this.rasterFunctionInfos||p(this.rasterFunctionInfos)&&this.rasterFunctionInfos.length<1||p(this.rasterFunctionInfos)&&this.rasterFunctionInfos.forEach((t=>{e.set(t.name.toLowerCase().replace(/ /gi,"_"),t.name)})),e}readBandIds(e,t){if(Array.isArray(e)&&e.length>0&&e.every((e=>"number"==typeof e)))return e}readCapabilities(e,t){return this._readCapabilities(t)}writeCompressionQuality(e,t,r){null!=e&&"lerc"!==this.format&&(t[r]=e)}writeCompressionTolerance(e,t,r){"lerc"===this.format&&null!=e&&(t[r]=e)}get fieldsIndex(){return this.fields?new P(this.fields):null}set format(e){e&&Re.has(e.toLowerCase())&&this._set("format",e.toLowerCase())}readFormat(e,t){return"esriImageServiceDataTypeVector-UV"===t.serviceDataType||"esriImageServiceDataTypeVector-MagDir"===t.serviceDataType||null!=this.pixelFilter?"lerc":"jpgpng"}readMinScale(e,t){return null!=t.minLOD&&null!=t.maxLOD?e:0}readMaxScale(e,t){return null!=t.minLOD&&null!=t.maxLOD?e:0}set mosaicRule(e){let t=e;t&&t.mosaicMethod&&(t=N.fromJSON({...t.toJSON(),mosaicMethod:t.mosaicMethod,mosaicOperation:t.mosaicOperation})),this._set("mosaicRule",t)}readMosaicRule(e,t){const r=e||t.mosaicRule;return r?N.fromJSON(r):this._isMosaicRuleSupported(t)?N.fromJSON(t):null}writeMosaicRule(e,t,r){let i=this.mosaicRule;const s=this.definitionExpression;i?s&&s!==i.where&&(i=i.clone(),i.where=s):s&&(i=new N({where:s})),this._isValidCustomizedMosaicRule(i)&&(t[r]=i.toJSON())}get multidimensionalInfo(){return p(this.serviceRasterInfo)?this.serviceRasterInfo.multidimensionalInfo:null}writeNoData(e,t,r){null!=e&&"number"==typeof e&&(t[r]=ve(e))}readObjectIdField(e,t){if(!e){const r=t.fields.filter((e=>"esriFieldTypeOID"===e.type||"oid"===e.type));e=r&&r[0]&&r[0].name}return e}get parsedUrl(){return this.url?f(this.url):null}set renderer(e){this.loaded&&(e=this._configRenderer(e)),this._set("renderer",e)}readRenderer(e,t,r){const i=t?.layerDefinition?.drawingInfo?.renderer,n=s(i,r);return null==n?null:("vector-field"===n.type&&t.symbolTileSize&&!i.symbolTileSize&&(n.symbolTileSize=t.symbolTileSize),T(n)||u.getLogger(this.declaredClass).warn("ArcGISImageService","Imagery layer doesn't support given renderer type."),n)}writeRenderer(e,t,r){t.layerDefinition=t.layerDefinition||{},t.layerDefinition.drawingInfo=t.layerDefinition.drawingInfo||{},t.layerDefinition.drawingInfo.renderer=e.toJSON(),"vector-field"===e.type&&(t.symbolTileSize=e.symbolTileSize)}get rasterFields(){const e=this._rasterAttributeTableFieldPrefix||"Raster.",t=new j({name:"Raster.ItemPixelValue",alias:"Item Pixel Value",domain:null,editable:!1,length:50,type:"string"}),r=new j({name:"Raster.ServicePixelValue",alias:"Service Pixel Value",domain:null,editable:!1,length:50,type:"string"}),i=new j({name:"Raster.ServicePixelValue.Raw",alias:"Raw Service Pixel Value",domain:null,editable:!1,length:50,type:"string"});let s=this.fields?l(this.fields):[];s.push(r),this.capabilities.operations.supportsQuery&&this.fields&&this.fields.length>0&&s.push(t),this.version>=10.4&&p(this.rasterFunctionInfos)&&this.rasterFunctionInfos.some((e=>"none"===e.name.toLowerCase()))&&s.push(i),p(this.rasterFunctionInfos)&&this.rasterFunctionInfos.filter((e=>"none"!==e.name.toLowerCase())).forEach((e=>{s.push(new j({name:"Raster.ServicePixelValue."+e.name,alias:e.name,domain:null,editable:!1,length:50,type:"string"}))})),this._isVectorDataSet()&&(s.push(new j({name:"Raster.Magnitude",alias:"Magnitude",domain:null,editable:!1,type:"double"})),s.push(new j({name:"Raster.Direction",alias:"Direction",domain:null,editable:!1,type:"double"})));const{attributeTable:n}=this.rasterInfo;if(p(n)){const t=n.fields.filter((e=>"esriFieldTypeOID"!==e.type&&"value"!==e.name.toLowerCase())).map((t=>{const r=l(t);return r.name=e+t.name,r}));s=s.concat(t)}return s}set renderingRule(e){let t=e;t&&t.rasterFunction&&(t=J.fromJSON({...t.toJSON(),rasterFunction:t.rasterFunction,rasterFunctionArguments:t.rasterFunctionArguments})),this._set("renderingRule",t)}readRenderingRule(e,t){const r=t.rasterFunctionInfos;return t.renderingRule||r&&r.length&&"None"!==r[0].name?this._isRFTJson(t.renderingRule)?J.fromJSON({rasterFunctionDefinition:t.renderingRule}):J.fromJSON(t.renderingRule||{rasterFunctionInfos:t.rasterFunctionInfos}):null}writeRenderingRule(e,t,r){const i=e.toJSON();i.rasterFunctionDefinition?t[r]=i.rasterFunctionDefinition:t[r]=i}readSpatialReference(e,t){const r=e||t.extent.spatialReference;return r?ye.fromJSON(r):null}readPixelType(e){return ge.fromJSON(e)||e}writePixelType(e,t,r){(c(this.serviceRasterInfo)||this.pixelType!==this.serviceRasterInfo.pixelType)&&(t[r]=ge.toJSON(e))}readVersion(e,t){let r=t.currentVersion;return r||(r=t.hasOwnProperty("fields")||t.hasOwnProperty("timeInfo")?10:9.3),r}applyFilter(e){let t=e;return this.pixelFilter&&(t=this._clonePixelData(e),this.pixelFilter(t)),t}async applyRenderer(e,t){let r=e;if(!this._isPicture()&&this.renderer&&this.symbolizer&&!this.pixelFilter){const i=JSON.stringify(this._cachedRendererJson)!==JSON.stringify(this.renderer.toJSON()),s=this._rasterJobHandler.instance,{bandIds:n}=this;if(s){i&&(this.symbolizer.bind(),await s.updateSymbolizer(this.symbolizer,t),this._cachedRendererJson=this.renderer.toJSON());const o=await s.symbolize({bandIds:n,...e},t);r={extent:e.extent,pixelBlock:o}}else r={extent:e.extent,pixelBlock:this.symbolizer.symbolize({bandIds:n,...e})}}return r}destroy(){this._shutdownJobHandler()}increaseRasterJobHandlerUsage(){this._rasterJobHandler.refCount++}decreaseRasterJobHandlerUsage(){this._rasterJobHandler.refCount--,this._rasterJobHandler.refCount<=0&&this._shutdownJobHandler()}async computeAngles(e,t){if(await this._fetchCapabilities(t?.signal),!this.capabilities.operations.supportsComputeAngles)throw new o("imagery-layer:compute-angles","this operation is not supported on the input image service");return e=v(pe,e).clone(),G(this.url,e,this._getRequestOptions(t))}async computePixelSpaceLocations(e,t){if(await this._fetchCapabilities(t?.signal),!this.capabilities.operations.supportsComputePixelLocation)throw new o("imagery-layer:compute-pixel-space-locations","this operation is not supported on the input image service");return e=v(de,e).clone(),W(this.url,e,this._getRequestOptions(t))}async computeHistograms(e,t){if(await this._fetchCapabilities(t?.signal),!this.capabilities.operations.supportsComputeHistograms)throw new o("imagery-layer:compute-histograms","this operation is not supported on the input image service");e=v(ce,e).clone();const{raster:r,mosaicRule:i,renderingRule:s}=this;return s&&null==e.renderingRule&&(e.renderingRule=s),i&&null==e.mosaicRule&&(e.mosaicRule=i),r&&null==e.raster&&(e.raster=r),K(this.url,e,this._getRequestOptions(t))}async computeStatisticsHistograms(e,t){if(await this._fetchCapabilities(t?.signal),!this.capabilities.operations.supportsComputeStatisticsHistograms)throw new o("imagery-layer:compute-statistics-histograms","this operation is not supported on the input image service");e=v(ce,e).clone();const{raster:r,mosaicRule:i,renderingRule:s}=this;return s&&null==e.renderingRule&&(e.renderingRule=s),i&&null==e.mosaicRule&&(e.mosaicRule=i),r&&null==e.raster&&(e.raster=r),X(this.url,e,this._getRequestOptions(t))}getField(e){const{fieldsIndex:t}=this;return p(t)?t.get(e):void 0}getFieldDomain(e,t){const r=this.getField(e);return r?r.domain:null}fetchImage(e,t,r,i={}){if(null==e||null==t||null==r)return Promise.reject(new o("imagery-layer:fetch-image","Insufficient parameters for requesting an image. A valid extent, width and height values are required."));const s=this.renderer||this.symbolizer?this.generateRasterInfo(this.renderingRule,{signal:i.signal}):null;return d(s).then((s=>{s&&(this.rasterInfo=s);const n={imageServiceParameters:this.getExportImageServiceParameters(e,t,r,i.timeExtent),imageProps:{extent:e,width:t,height:r,format:this.format},requestAsImageElement:i.requestAsImageElement&&!this.pixelFilter||!1,signal:i.signal};return this._requestArrayBuffer(n)}))}fetchKeyProperties(e){return n(this.parsedUrl.path+"/keyProperties",{query:this._getQueryParams({renderingRule:this.version>=10.3?e?.renderingRule:null})}).then((e=>e.data))}fetchRasterAttributeTable(e){return this.version<10.1?Promise.reject(new o("#fetchRasterAttributeTable()","Failed to get rasterAttributeTable")):n(this.parsedUrl.path+"/rasterAttributeTable",{query:this._getQueryParams({renderingRule:this.version>=10.3?e?.renderingRule:null})}).then((e=>ie.fromJSON(e.data)))}getCatalogItemRasterInfo(e,t){const r={...t,query:this._getQueryParams()};return ue(this.parsedUrl.path,e,r)}async getCatalogItemICSInfo(e,t){const{data:r}=await n(this.parsedUrl.path+"/"+e+"/info/ics",{query:this._getQueryParams(),...t}),i=r&&r.ics;if(!i)return;let s=null;try{s=(await n(this.parsedUrl.path+"/"+e+"/info",{query:this._getQueryParams(),...t})).data.extent}catch{}if(!s||!s.spatialReference)return{ics:i,icsToPixelTransform:null,icsExtent:null,northDirection:null};const o=this.version>=10.7?n(this.parsedUrl.path+"/"+e+"/info/icstopixel",{query:this._getQueryParams(),...t}).then((e=>e.data)).catch((()=>({}))):{},a=s.spatialReference,l={geometries:JSON.stringify({geometryType:"esriGeometryEnvelope",geometries:[s]}),inSR:a.wkid||JSON.stringify(a),outSR:"0:"+e},u=n(this.parsedUrl.path+"/project",{query:this._getQueryParams(l),...t}).then((e=>e.data)).catch((()=>({}))),p=5,c=(s.xmin+s.xmax)/2,m=(s.ymax-s.ymin)/(p+1),d=s.ymin+m,h=[];for(let n=0;n<p;n++)h.push({x:c,y:d+m*n});const f={geometries:JSON.stringify({geometryType:"esriGeometryPoint",geometries:h}),inSR:a.wkid||JSON.stringify(a),outSR:"0:"+e},y=n(this.parsedUrl.path+"/project",{query:this._getQueryParams(f),...t}).then((e=>e.data)).catch((()=>({}))),g=await Promise.all([o,u,y]);let R=g[0].ipxf;if(null==R){const e=i.geodataXform?.xf_0;"topup"===e?.name?.toLowerCase()&&6===e?.coefficients?.length&&(R={affine:{name:"ics [sensor: Frame] to pixel (column, row) transformation",coefficients:e.coefficients,cellsizeRatio:0,type:"GeometricXform"}})}const v=te.fromJSON(g[1]&&g[1].geometries&&g[1].geometries[0]);v&&(v.spatialReference=new ye({wkid:0,imageCoordinateSystem:i}));const S=g[2].geometries?g[2].geometries.filter((e=>null!=e&&null!=e.x&&null!=e.y&&"NaN"!==e.x&&"NaN"!==e.y)):[],b=S.length;if(b<3)return{ics:i,icsToPixelTransform:R,icsExtent:v,northDirection:null};let I=0,x=0,_=0,w=0;for(let n=0;n<b;n++)I+=S[n].x,x+=S[n].y,_+=S[n].x*S[n].x,w+=S[n].x*S[n].y;const F=(b*w-I*x)/(b*_-I*I);let D=0;const j=S[p-1].x>S[0].x,P=S[p-1].y>S[0].y;return F===1/0?D=P?90:270:0===F?D=j?0:180:F>0?D=j?180*Math.atan(F)/Math.PI:180*Math.atan(F)/Math.PI+180:F<0&&(D=P?180+180*Math.atan(F)/Math.PI:360+180*Math.atan(F)/Math.PI),{ics:i,icsToPixelTransform:R,icsExtent:v,northDirection:D}}async generateRasterInfo(e,t){if(await this.load(),!e||"none"===e?.functionName?.toLowerCase()||this._isVectorFieldResampleFunction(e))return this.serviceRasterInfo;const r=Se(e);if(this._functionRasterInfos[r])return this._functionRasterInfos[r];const i=this._generateRasterInfo(e,t);this._functionRasterInfos[r]=i;try{return await i}catch{return this._functionRasterInfos[r]=null,null}}getExportImageServiceParameters(e,t,r,i){e=e.clone().shiftCentralMeridian();const s=$(e.spatialReference,this.parsedUrl.path);this.pixelType!==this.serviceRasterInfo.pixelType&&(this.exportImageServiceParameters.pixelType=this.pixelType);const n=this.exportImageServiceParameters.toJSON(),{bandIds:o,noData:a}=n;let{renderingRule:l}=n;const u=this.renderingRule?.rasterFunctionDefinition,p=!this.renderer||"raster-stretch"===this.renderer.type;if(o?.length&&this._hasRenderingRule(this.renderingRule)&&!u&&p){const e={rasterFunction:"ExtractBand",rasterFunctionArguments:{BandIds:o}};if("Stretch"===l.rasterFunction)e.rasterFunctionArguments.Raster=l.rasterFunctionArguments.Raster,l.rasterFunctionArguments.Raster=e;else if("Colormap"===l.rasterFunction){const t=l.rasterFunctionArguments.Raster;"Stretch"===t?.rasterFunction?(e.rasterFunctionArguments.Raster=t.rasterFunctionArguments.Raster,t.rasterFunctionArguments.Raster=e):(e.rasterFunctionArguments.Raster=t,l.rasterFunctionArguments.Raster=e)}else e.rasterFunctionArguments.Raster=l,l=e;n.bandIds=void 0}else n.bandIds=o?.join(",");a instanceof Array&&a.length>0&&(n.noData=a.join(","));const c=this._serviceSupportsMosaicRule?this._combineMosaicRuleWithTimeExtent(this.exportImageServiceParameters.mosaicRule,i):null;n.mosaicRule=c&&JSON.stringify(c),n.renderingRule=this._getRenderingRuleString(J.fromJSON(l));const m={};if(i){const{start:e,end:t}=i.toJSON();e&&t&&e===t?m.time=""+e:null==e&&null==t||(m.time=`${e??"null"},${t??"null"}`)}return{bbox:e.xmin+","+e.ymin+","+e.xmax+","+e.ymax,bboxSR:s,imageSR:s,size:t+","+r,...n,...m}}async getSamples(e,t){if(await this._fetchCapabilities(t?.signal),!this.capabilities.operations.supportsGetSamples)throw new o("imagery-layer:get-samples","getSamples operation is not supported on the input image service");e=v(he,e).clone();const{raster:r}=this;return r&&null==e.raster&&(e.raster=r),Y(this.url,e,this._getRequestOptions(t))}async identify(e,t){if(await this._fetchCapabilities(t?.signal),!this.capabilities.operations.supportsIdentify)throw new o("imagery-layer:query-rasters","query operation is not supported on the input image service");e=v(me,e).clone();const{raster:r,mosaicRule:i,renderingRule:s}=this;if(s&&null==e.renderingRule&&(e.renderingRule=s),i&&null==e.mosaicRule){const t=this._combineMosaicRuleWithTimeExtent(i,e.timeExtent);e.mosaicRule=m(t)}return r&&null==e.raster&&(e.raster=r),Z(this.url,e,this._getRequestOptions(t))}createQuery(){const e=new se;return e.outFields=["*"],e.returnGeometry=!0,e.where=this.definitionExpression||"1=1",e}async queryRasters(e,t){return({query:e,requestOptions:t}=await this._prepareForQuery(e,t)),ee(this.url,e,t)}async queryObjectIds(e,t){return({query:e,requestOptions:t}=await this._prepareForQuery(e,t)),oe(this.url,e,t)}async queryRasterCount(e,t){return({query:e,requestOptions:t}=await this._prepareForQuery(e,t)),ne(this.url,e,t)}async queryVisibleRasters(e,t){if(!e)throw new o("imagery-layer: query-visible-rasters","missing query parameter");await this.load();const{pixelSize:r,returnDomainValues:i,returnTopmostRaster:s,showNoDataRecords:n}=t||{pixelSize:null,returnDomainValues:!1,returnTopmostRaster:!1,showNoDataRecords:!1};let a=!1,l=null,u=null;const m="raster.servicepixelvalue",d=this._rasterFunctionNamesIndex;if(p(e.outFields)&&(a=e.outFields.some((e=>!e.toLowerCase().includes(m))),this.version>=10.4)){const t=e.outFields.filter((e=>e.toLowerCase().includes(m)&&e.length>m.length)).map((e=>{const t=e.slice(m.length+1);return[this._updateRenderingRulesFunctionName(t,d),t]}));l=t.map((e=>new J({functionName:e[0]}))),u=t.map((e=>e[1])),0===l.length?this.renderingRule?(l.push(this.renderingRule),u.push(this.renderingRule.functionName)):l=null:this.renderingRule&&!l.some((e=>e.functionName===this.renderingRule.functionName))&&(l.push(this.renderingRule),u.push(this.renderingRule.functionName))}const h=c(e.outSpatialReference)||e.outSpatialReference.equals(this.spatialReference),f=e.timeExtent||this.timeExtent,y=this._combineMosaicRuleWithTimeExtent(this.exportImageServiceParameters.mosaicRule,f),g=this._getQueryParams({geometry:e.geometry,timeExtent:f,mosaicRule:y,renderingRule:this.version<10.4?this.renderingRule:null,renderingRules:l,pixelSize:r,returnCatalogItems:a,returnGeometry:h,raster:this.raster,maxItemCount:s?1:null});delete g.f;const R=new me(g);try{await this.generateRasterInfo(this.renderingRule);const r=await Z(this.url,R,{signal:t?.signal,query:{...this.customParameters}}),s=e.outFields,o=r.value.toLowerCase().includes("nodata");if(!(a&&!h&&r?.catalogItems?.features.length&&(n||!o)))return this._processVisibleRastersResponse(r,{returnDomainValues:i,templateRRFunctionNames:u,showNoDataRecords:n,templateFields:s});const l=this.objectIdField||"ObjectId",c=r.catalogItems.features,m=c.map((e=>e.attributes?.[l])),d=new se({objectIds:m,returnGeometry:!0,outSpatialReference:e.outSpatialReference,outFields:[l]}),f=await this.queryRasters(d);return f?.features?.length&&f.features.forEach((t=>{c.forEach((r=>{r.attributes[l]===t.attributes[l]&&(r.geometry=new re(t.geometry),p(e.outSpatialReference)&&(r.geometry.spatialReference=e.outSpatialReference))}))})),this._processVisibleRastersResponse(r,{returnDomainValues:i,templateRRFunctionNames:u,showNoDataRecords:n,templateFields:s})}catch{throw new o("imagery-layer:query-visible-rasters","encountered error when querying visible rasters")}}async fetchVariableStatisticsHistograms(e,t){const r=n(this.parsedUrl.path+"/statistics",{query:this._getQueryParams({variable:e}),signal:t}).then((e=>e.data?.statistics)),i=n(this.parsedUrl.path+"/histograms",{query:this._getQueryParams({variable:e}),signal:t}).then((e=>e.data?.histograms)),s=await Promise.all([r,i]);return s[0]&&s[0].forEach((e=>{e.avg=e.mean,e.stddev=e.standardDeviation})),{statistics:s[0]||null,histograms:s[1]||null}}async createFlowMesh(e,t){const r=this._rasterJobHandler.instance;return r?r.createFlowMesh(e,t):fe(e.meshType,e.simulationSettings,e.flowData,p(t.signal)?t.signal:(new AbortController).signal)}async _fetchService(e){await this._fetchServiceInfo(e),this.rasterInfo||(this.rasterInfo=this.serviceRasterInfo);const t=this.sourceJSON,r=p(this.serviceRasterInfo)?Promise.resolve(this.serviceRasterInfo):ae(this.parsedUrl.path,t,{signal:e,query:this._getQueryParams()}).then((e=>(this._set("serviceRasterInfo",e),e))),i=this._hasRenderingRule(this.renderingRule)?this.generateRasterInfo(this.renderingRule,{signal:e}):null,s=this._getRasterFunctionInfos();return Promise.all([r,i,s]).then((e=>{e[1]?this._set("rasterInfo",e[1]):this._set("rasterInfo",e[0]),e[2]&&this._set("rasterFunctionInfos",e[2]),this.renderer&&!this._isSupportedRenderer(this.renderer)&&(this._set("renderer",null),u.getLogger(this.declaredClass).warn("ArcGISImageService","Switching to the default renderer. Renderer applied is not valid for this Imagery Layer")),this._set("renderer",this._configRenderer(this.renderer)),this.addHandles(h((()=>this.renderingRule),(e=>{(this.renderer||this.symbolizer||this.popupEnabled&&this.popupTemplate)&&this.generateRasterInfo(e).then((e=>{e&&(this.rasterInfo=e)}))})));const{serviceRasterInfo:t}=this;p(t.multidimensionalInfo)&&this._updateMultidimensionalDefinition(t)}))}_combineMosaicRuleWithTimeExtent(e,t){const r=this.timeInfo;if(c(e)||c(this.multidimensionalInfo)||c(t)||c(r?.startField))return e;const{startField:i}=r,s=this.multidimensionalInfo.variables.some((e=>e.dimensions.some((e=>e.name===i))))?i:"StdTime";if(e=e.clone(),"mosaic-dataset"===this._serviceSourceType)return e.multidimensionalDefinition=e.multidimensionalDefinition?.filter((e=>e.dimensionName!==s)),this._cleanupMultidimensionalDefinition(e);e.multidimensionalDefinition=e.multidimensionalDefinition||[];const n=e.multidimensionalDefinition.filter((e=>e.dimensionName===s)),o=p(t.start)?t.start.getTime():null,a=p(t.end)?t.end.getTime():null,l=null==o||null==a||o===a,u=l?[o||a]:[[o,a]],m=this.version>=10.8;if(n.length)n.forEach((e=>{e.dimensionName===s&&(m?(e.dimensionName=null,e.isSlice=null,e.values=null):(e.isSlice=l,e.values=u))}));else if(!m){const t=e.multidimensionalDefinition.filter((e=>null!=e.variableName&&null==e.dimensionName));t.length?t.forEach((e=>{e.dimensionName=s,e.isSlice=l,e.values=u})):e.multidimensionalDefinition.push(new F({variableName:"",dimensionName:s,isSlice:l,values:u}))}return this._cleanupMultidimensionalDefinition(e)}_cleanupMultidimensionalDefinition(e){return c(e)?null:(e.multidimensionalDefinition&&(e.multidimensionalDefinition=e.multidimensionalDefinition.filter((e=>!(!e.variableName&&!e.dimensionName))),0===e.multidimensionalDefinition.length&&(e.multidimensionalDefinition=null)),"mosaic-dataset"!==this._serviceSourceType&&null==e.multidimensionalDefinition?null:e)}async _prepareForQuery(e,t){if(await this._fetchCapabilities(t?.signal),!this.capabilities.operations.supportsQuery)throw new o("imagery-layer:query-rasters","query operation is not supported on the input image service");return e=p(e)?v(se,e):this.createQuery(),t=this._getRequestOptions(t),this.raster&&(t.query={...t.query,raster:this.raster}),{query:e,requestOptions:t}}async _initJobHandler(){if(null!=this._rasterJobHandler.connectionPromise)return this._rasterJobHandler.connectionPromise;const e=new V;this._rasterJobHandler.connectionPromise=e.initialize().then((()=>{this._rasterJobHandler.instance=e}),(()=>null)),await this._rasterJobHandler.connectionPromise}_shutdownJobHandler(){this._rasterJobHandler.instance&&this._rasterJobHandler.instance.destroy(),this._rasterJobHandler.instance=null,this._rasterJobHandler.connectionPromise=null,this._rasterJobHandler.refCount=0,this._cachedRendererJson=null}_isSupportedRenderer(e){const{rasterInfo:t,renderingRule:r}=this;return"unique-value"===e.type&&this._hasRenderingRule(r)&&1===t.bandCount&&["u8","s8"].includes(t.pixelType)||U(this.rasterInfo).includes(this.renderer.type)}async _fetchCapabilities(e){return this.capabilities||await this._fetchServiceInfo(e),this.capabilities}async _fetchServiceInfo(e){let t=this.sourceJSON;if(!t){const{data:r,ssl:i}=await n(this.parsedUrl.path,{query:this._getQueryParams(),signal:e});t=r,this.sourceJSON=t,i&&(this.url=this.url.replace(/^http:/i,"https:"))}if(t.capabilities?.toLowerCase().split(",").map((e=>e.trim())).indexOf("tilesonly")>-1)throw new o("imagery-layer:fetch-service-info","use ImageryTileLayer to open tiles-only image services");this.read(t,{origin:"service",url:this.parsedUrl})}_isMosaicDataset(e){return e.serviceSourceType?"esriImageServiceSourceTypeMosaicDataset"===e.serviceSourceType:e.fields?.length>0}_isMosaicRuleSupported(e){if(!e)return!1;const t=this._isMosaicDataset(e),r=e.currentVersion>=10.71&&e.hasMultidimensions&&e.timeInfo&&!(e.objectIdField&&e.fields?.length>1);return t||r}_isVectorFieldResampleFunction(e){if(c(e))return!1;const{functionName:t,functionArguments:r}=e,i="resample"===t?.toLowerCase(),s=r?.ResampleType||r?.resampleType;return i&&(7===s||10===s)}_isPicture(){return!this.format||this.format.includes("jpg")||this.format.includes("png")}_configRenderer(e){if(!this._isPicture()&&!this.pixelFilter||this._isVectorDataSet()){if(!this.bandIds&&this.rasterInfo.bandCount>=3){const e=z(this.rasterInfo);!e||3===this.rasterInfo.bandCount&&0===e[0]&&1===e[1]&&2===e[2]||(this.bandIds=e)}e||(e=L(this.rasterInfo,{bandIds:this.bandIds,variableName:this.renderingRule?null:this.mosaicRule?.multidimensionalDefinition?.[0].variableName}));const t=B(e.toJSON());this.symbolizer?(this.symbolizer.rendererJSON=t,this.symbolizer.rasterInfo=this.rasterInfo):this.symbolizer=new k({rendererJSON:t,rasterInfo:this.rasterInfo}),this.symbolizer.bind().success||(this.symbolizer=null)}return e}_clonePixelData(e){return null==e?e:{extent:e.extent&&e.extent.clone(),pixelBlock:p(e.pixelBlock)&&e.pixelBlock.clone()}}_getQueryParams(e){p(e?.renderingRule)&&"string"!=typeof e.renderingRule&&(e.renderingRule=this._getRenderingRuleString(e.renderingRule));const{raster:t,viewId:r}=this;return{raster:t,viewId:r,f:"json",...e,...this.customParameters}}_getRequestOptions(e){return{...e,query:{...e?.query,...this.customParameters}}}_decodePixelBlock(e,t,r){return this._rasterJobHandler.instance?this._rasterJobHandler.instance.decode({data:e,options:t}):E(e,t,r)}async _getRasterFunctionInfos(e){const t=this.sourceJSON.rasterFunctionInfos;if(this.loaded)return t;if(t&&this.version>=10.3){if(1===t.length&&"none"===t[0].name.toLowerCase())return t;return(await n(this.parsedUrl.path+"/rasterFunctionInfos",{query:this._getQueryParams(),signal:e})).data?.rasterFunctionInfos}return null}async _requestArrayBuffer(e){const{imageProps:t,requestAsImageElement:r,signal:i}=e;if(r&&!this.pixelFilter&&t.format?.indexOf("png")>-1){return{imageElement:(await n(this.parsedUrl.path+"/exportImage",{responseType:"image",query:this._getQueryParams({f:"image",...e.imageServiceParameters}),signal:i})).data,params:t}}const s=this._initJobHandler(),a=n(this.parsedUrl.path+"/exportImage",{responseType:"array-buffer",query:this._getQueryParams({f:"image",...e.imageServiceParameters}),signal:i}),l=(await Promise.all([a,s]))[0].data,u=t.format||"jpgpng";let p=u;if("bsq"!==p&&"bip"!==p&&(p=Q(l)),!p)throw new o("imagery-layer:fetch-image","unsupported format signature "+String.fromCharCode.apply(null,new Uint8Array(l)));const c={signal:i},m="gif"===u||"bmp"===u||u.includes("png")&&("png"===p||"jpg"===p)?E(l,{useCanvas:!0,...t},c):this._decodePixelBlock(l,{width:t.width,height:t.height,planes:null,pixelType:null,noDataValue:null,format:u},c);return{pixelData:{pixelBlock:await m,extent:t.extent},params:t}}_generateRasterInfo(e,t){const r={...t,query:this._getQueryParams()};return le(this.parsedUrl.path,e,r)}_isValidCustomizedMosaicRule(e){return e&&JSON.stringify(e.toJSON())!==JSON.stringify(this._defaultServiceMosaicRule?.toJSON())}_updateMultidimensionalDefinition(e){if(this._isValidCustomizedMosaicRule(this.mosaicRule))return;const t=A(e);if(p(t)&&t.length>0){this.mosaicRule=this.mosaicRule||new N;const e=this.mosaicRule.multidimensionalDefinition;(!e||e&&e.length<=0)&&(this.mosaicRule.multidimensionalDefinition=t)}}_processVisibleRastersResponse(e,r){r=r||{};const i=e.value,{templateRRFunctionNames:s,showNoDataRecords:n,returnDomainValues:o,templateFields:a}=r,l=e.processedValues;let u=e.catalogItems&&e.catalogItems.features,c=e.properties&&e.properties.Values&&e.properties.Values.map((e=>e.replace(/ /gi,", ")))||[];const m=this.objectIdField||"ObjectId",d="string"==typeof i&&i.toLowerCase().includes("nodata"),h=[];if(i&&!u&&!d){const e={};e[m]=0;c=[i],u=[new t(this.fullExtent,null,e)]}if(!u)return[];let f,y,g;this._updateResponseFieldNames(u,a),d&&!n&&(u=[]);for(let t=0;t<u.length;t++){if(f=u[t],null!=i){if(y=c[t],g=this.renderingRule&&l&&l.length>0&&s&&s.length>0&&s.includes(this.renderingRule.functionName)?l[s.indexOf(this.renderingRule.functionName)]:i,"nodata"===y.toLowerCase()&&!n)continue;const e="Raster.ItemPixelValue",r="Raster.ServicePixelValue";f.attributes[e]=y,f.attributes[r]=g,this._updateFeatureWithMagDirValues(f,y);const o=this.fields&&this.fields.length>0;let a=this.renderingRule&&p(this.serviceRasterInfo.attributeTable)?o?y:i:g;this.renderingRule||(a=o?y:i),this._updateFeatureWithRasterAttributeTableValues(f,a)}if(f.sourceLayer=f.layer=this,o&&this._updateFeatureWithDomainValues(f),s&&l&&s.length===l.length)for(let e=0;e<s.length;e++){const t="Raster.ServicePixelValue."+s[e];f.attributes[t]=l[e]}h.push(u[t])}return h}_updateFeatureWithRasterAttributeTableValues(e,t){const r=this.rasterInfo&&this.rasterInfo.attributeTable||this.serviceRasterInfo.attributeTable;if(c(r))return;const{features:i,fields:s}=r,n=s.map((e=>e.name)).filter((e=>"value"===e.toLowerCase())),o=n&&n[0];if(!o)return;const a=i.filter((e=>e.attributes[o]===(null!=t?parseInt(t,10):null)));a&&a[0]&&s.forEach((t=>{const r=this._rasterAttributeTableFieldPrefix+t.name;e.attributes[r]=a[0].attributes[t.name]}))}_updateFeatureWithMagDirValues(e,t){if(!this._isVectorDataSet())return;const r=t.split(/,\s*/).map((e=>parseFloat(e))),i=r.map((e=>[e])),s=r.map((e=>({minValue:e,maxValue:e,noDataValue:null}))),n=new O({height:1,width:1,pixelType:"f32",pixels:i,statistics:s});null!=this.pixelFilter&&this.pixelFilter({pixelBlock:n,extent:new te(0,0,0,0,this.spatialReference)});const o="esriImageServiceDataTypeVector-MagDir"===this.serviceDataType?[n.pixels[0][0],n.pixels[1][0]]:H([n.pixels[0][0],n.pixels[1][0]]);e.attributes["Raster.Magnitude"]=o[0],e.attributes["Raster.Direction"]=o[1]}_updateFeatureWithDomainValues(e){const t=this.fields&&this.fields.filter((e=>e.domain&&"coded-value"===e.domain.type));null!=t&&t.forEach((t=>{const r=e.attributes[t.name];if(null!=r){const i=t.domain.codedValues.find((e=>e.code===r));i&&(e.attributes[t.name]=i.name)}}))}_updateResponseFieldNames(e,t){if(!t||t.length<1)return;const r=this.fieldsIndex;c(r)||e.forEach((e=>{if(e&&e.attributes)for(const i of t)if(r.has(i)){const t=r.get(i).name;t!==i&&(e.attributes[i]=e.attributes[t],delete e.attributes[t])}}))}_getRenderingRuleString(e){if(this._hasRenderingRule(e)){let t=e.toJSON();return t=t.rasterFunctionDefinition??t,(t.thumbnail||t.thumbnailEx)&&(t.thumbnail=t.thumbnailEx=null),JSON.stringify(t)}return null}_hasRenderingRule(e){return e&&e.functionName&&"none"!==e.functionName.toLowerCase()}_updateRenderingRulesFunctionName(e,t){if(!e||e.length<1)return;if("Raw"===e)return e.replace("Raw","None");const r=e.toLowerCase().replace(/ /gi,"_");return t.has(r)?t.get(r):e}_isRFTJson(e){return e&&e.name&&e.arguments&&e.function&&e.hasOwnProperty("functionType")}_isVectorDataSet(){return"esriImageServiceDataTypeVector-UV"===this.serviceDataType||"esriImageServiceDataTypeVector-MagDir"===this.serviceDataType}_readCapabilities(e){const t=e.capabilities?e.capabilities.toLowerCase().split(",").map((e=>e.trim())):["image","catalog"],{currentVersion:r,advancedQueryCapabilities:i,maxRecordCount:s}=e,n=t.includes("image"),o="esriImageServiceDataTypeElevation"===e.serviceDataType,a=!!(e.spatialReference||e.extent&&e.extent.spatialReference),l=t.includes("edit");return{data:{supportsAttachment:!1},operations:{supportsComputeHistograms:n,supportsExportImage:n,supportsIdentify:n,supportsMeasure:t.includes("mensuration")&&a,supportsDownload:t.includes("download"),supportsQuery:t.includes("catalog")&&e.fields&&e.fields.length>0,supportsGetSamples:r>=10.2&&n,supportsProject:r>=10.3&&n,supportsComputeStatisticsHistograms:r>=10.4&&n,supportsQueryBoundary:r>=10.6&&n,supportsCalculateVolume:r>=10.7&&o,supportsComputePixelLocation:r>=10.7&&t.includes("catalog"),supportsComputeAngles:r>=10.91,supportsAdd:l,supportsDelete:l,supportsEditing:l,supportsUpdate:l,supportsCalculate:!1,supportsTruncate:!1,supportsValidateSql:!1,supportsChangeTracking:!1,supportsQueryAttachments:!1,supportsResizeAttachments:!1,supportsSync:!1,supportsExceedsLimitStatistics:!1,supportsQueryAnalytics:!1,supportsQueryTopFeatures:!1},query:{maxRecordCount:s,maxRecordCountFactor:void 0,supportsStatistics:!!i?.supportsStatistics,supportsOrderBy:!!i?.supportsOrderBy,supportsDistinct:!!i?.supportsDistinct,supportsPagination:!!i?.supportsPagination,supportsStandardizedQueriesOnly:!!i?.useStandardizedQueries,supportsPercentileStatistics:!!i?.supportsPercentileStatistics,supportsCentroid:!!i?.supportsReturningGeometryCentroid,supportsDistance:!!i?.supportsQueryWithDistance,supportsExtent:!!i?.supportsReturningQueryExtent,supportsGeometryProperties:!!i?.supportsReturningGeometryProperties,supportsHavingClause:!!i?.supportsHavingClause,supportsQuantization:!1,supportsQuantizationEditMode:!1,supportsQueryGeometry:!1,supportsResultType:!1,supportsMaxRecordCountFactor:!1,supportsSqlExpression:!1,supportsTopFeaturesQuery:!1,supportsQueryByOthers:!1,supportsHistoricMoment:!1,supportsFormatPBF:!1,supportsDisjointSpatialRelationship:!1,supportsCacheHint:!1,supportsSpatialAggregationStatistics:!1,supportedSpatialAggregationStatistics:{envelope:!1,centroid:!1,convexHull:!1},supportsDefaultSpatialReference:!!i?.supportsDefaultSR,supportsCompactGeometry:!1,standardMaxRecordCount:void 0,tileMaxRecordCount:void 0}}}};return e([y()],g.prototype,"_functionRasterInfos",void 0),e([y()],g.prototype,"_rasterJobHandler",void 0),e([y({dependsOn:["_serviceSupportsMosaicRule"]})],g.prototype,"_defaultServiceMosaicRule",void 0),e([b("_defaultServiceMosaicRule",["defaultMosaicMethod"])],g.prototype,"readDefaultServiceMosaicRule",null),e([y()],g.prototype,"_cachedRendererJson",void 0),e([y({readOnly:!0})],g.prototype,"_serviceSourceType",void 0),e([b("_serviceSourceType",["serviceSourceType","fields"])],g.prototype,"readServiceSourceType",null),e([y({readOnly:!0})],g.prototype,"_serviceSupportsMosaicRule",void 0),e([b("_serviceSupportsMosaicRule",["currentVersion","fields"])],g.prototype,"readServiceSupportsMosaicRule",null),e([y()],g.prototype,"_rasterAttributeTableFieldPrefix",void 0),e([y({readOnly:!0})],g.prototype,"_rasterFunctionNamesIndex",null),e([y()],g.prototype,"adjustAspectRatio",void 0),e([y({type:[R],json:{write:!0}})],g.prototype,"bandIds",void 0),e([b("bandIds")],g.prototype,"readBandIds",null),e([y({readOnly:!0,json:{read:!1}})],g.prototype,"capabilities",void 0),e([b("service","capabilities",["capabilities","currentVersion","serviceDataType"])],g.prototype,"readCapabilities",null),e([y({type:Number})],g.prototype,"compressionQuality",void 0),e([x("compressionQuality")],g.prototype,"writeCompressionQuality",null),e([y({type:Number})],g.prototype,"compressionTolerance",void 0),e([x("compressionTolerance")],g.prototype,"writeCompressionTolerance",null),e([y({json:{read:{source:"copyrightText"}}})],g.prototype,"copyright",void 0),e([y({type:String,json:{name:"layerDefinition.definitionExpression",write:{enabled:!0,allowNull:!0}}})],g.prototype,"definitionExpression",void 0),e([y({readOnly:!0,constructOnly:!0})],g.prototype,"exportImageServiceParameters",void 0),e([y()],g.prototype,"rasterInfo",void 0),e([y({readOnly:!0,type:[j]})],g.prototype,"fields",void 0),e([y({readOnly:!0})],g.prototype,"fieldsIndex",null),e([y({type:["png","png8","png24","png32","jpg","bmp","gif","jpgpng","lerc","tiff"],json:{write:!0}})],g.prototype,"format",null),e([b("service","format",["serviceDataType"])],g.prototype,"readFormat",null),e([y({type:te})],g.prototype,"fullExtent",void 0),e([y({readOnly:!0})],g.prototype,"hasMultidimensions",void 0),e([y({json:{read:{source:"maxImageHeight"}}})],g.prototype,"imageMaxHeight",void 0),e([y({json:{read:{source:"maxImageWidth"}}})],g.prototype,"imageMaxWidth",void 0),e([y({type:String,json:{type:C.jsonValues,read:C.read,write:C.write}})],g.prototype,"interpolation",void 0),e([y()],g.prototype,"minScale",void 0),e([b("service","minScale")],g.prototype,"readMinScale",null),e([y()],g.prototype,"maxScale",void 0),e([b("service","maxScale")],g.prototype,"readMaxScale",null),e([y({type:N})],g.prototype,"mosaicRule",null),e([b("mosaicRule",["mosaicRule","defaultMosaicMethod"])],g.prototype,"readMosaicRule",null),e([x("mosaicRule")],g.prototype,"writeMosaicRule",null),e([y()],g.prototype,"multidimensionalInfo",null),e([y({json:{type:R}})],g.prototype,"noData",void 0),e([x("noData")],g.prototype,"writeNoData",null),e([y({type:String,json:{type:M.jsonValues,read:M.read,write:M.write}})],g.prototype,"noDataInterpretation",void 0),e([y({type:String,readOnly:!0,json:{read:{source:["fields"]}}})],g.prototype,"objectIdField",void 0),e([b("objectIdField")],g.prototype,"readObjectIdField",null),e([y({})],g.prototype,"geometryType",void 0),e([y({})],g.prototype,"typeIdField",void 0),e([y({})],g.prototype,"types",void 0),e([y({readOnly:!0})],g.prototype,"parsedUrl",null),e([y({type:Function})],g.prototype,"pixelFilter",void 0),e([y()],g.prototype,"raster",void 0),e([y()],g.prototype,"viewId",void 0),e([y({types:r,json:{name:"layerDefinition.drawingInfo.renderer",origins:{"web-scene":{types:i,name:"layerDefinition.drawingInfo.renderer",write:{overridePolicy:e=>({enabled:e&&"vector-field"!==e.type&&"flow"!==e.type})}}}}})],g.prototype,"renderer",null),e([b("renderer")],g.prototype,"readRenderer",null),e([x("renderer")],g.prototype,"writeRenderer",null),e([y()],g.prototype,"symbolizer",void 0),e([y(_)],g.prototype,"opacity",void 0),e([y({readOnly:!0})],g.prototype,"rasterFields",null),e([y({constructOnly:!0})],g.prototype,"rasterFunctionInfos",void 0),e([y({type:J})],g.prototype,"renderingRule",null),e([b("renderingRule",["renderingRule","rasterFunctionInfos"])],g.prototype,"readRenderingRule",null),e([x("renderingRule")],g.prototype,"writeRenderingRule",null),e([y()],g.prototype,"serviceDataType",void 0),e([y({readOnly:!0,type:ye})],g.prototype,"spatialReference",void 0),e([b("spatialReference",["spatialReference","extent"])],g.prototype,"readSpatialReference",null),e([y({json:{type:ge.jsonValues}})],g.prototype,"pixelType",void 0),e([b("pixelType")],g.prototype,"readPixelType",null),e([x("pixelType")],g.prototype,"writePixelType",null),e([y({constructOnly:!0,type:q})],g.prototype,"serviceRasterInfo",void 0),e([y()],g.prototype,"sourceJSON",void 0),e([y(w)],g.prototype,"url",void 0),e([y({readOnly:!0})],g.prototype,"version",void 0),e([b("version",["currentVersion","fields","timeInfo"])],g.prototype,"readVersion",null),g=e([I("esri.layers.mixins.ArcGISImageService")],g),g};export{be as ArcGISImageService};