@arcgis/core 4.28.0-next.20230818 → 4.28.0-next.20230821

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 (200) hide show
  1. package/arcade/functions/centroid.js +1 -1
  2. package/assets/esri/core/workers/RemoteClient.js +1 -1
  3. package/assets/esri/core/workers/chunks/003744a45b07865f1be9.js +1 -0
  4. package/assets/esri/core/workers/chunks/034accc7cab6c88a3b31.js +1 -0
  5. package/assets/esri/core/workers/chunks/05ab09713d599687afa3.js +1 -0
  6. package/assets/esri/core/workers/chunks/{3724f23b6f5ac8ec2568.js → 12b8fe0374fa9ab4ca09.js} +1 -1
  7. package/assets/esri/core/workers/chunks/16d1a72014074e87ecb9.js +1 -0
  8. package/assets/esri/core/workers/chunks/{e4b6565c16430b28ad93.js → 19857e5420cdf23c5f2e.js} +1 -1
  9. package/assets/esri/core/workers/chunks/{1a804dea42c0fb5e5c07.js → 1bab408eaffd2c18976d.js} +1 -1
  10. package/assets/esri/core/workers/chunks/201365f53509e3f78e17.js +1 -0
  11. package/assets/esri/core/workers/chunks/{2031451b82ff70fb201a.js → 2f48f4a9a0a056ac5e1c.js} +1 -1
  12. package/assets/esri/core/workers/chunks/318b51fdee09c1fd750f.js +1 -0
  13. package/assets/esri/core/workers/chunks/{5b799dc155adeb728c74.js → 3361e3e8385f8de8820c.js} +1 -1
  14. package/assets/esri/core/workers/chunks/3ce1870c28ab6ac3648e.js +1 -0
  15. package/assets/esri/core/workers/chunks/41929e4531787389804b.js +1 -0
  16. package/assets/esri/core/workers/chunks/{55ac725127c5ea9fb942.js → 4e39252f40bc57be9d12.js} +1 -1
  17. package/assets/esri/core/workers/chunks/4e496b03ce24b1206f86.js +1 -0
  18. package/assets/esri/core/workers/chunks/{ee5f17c1790dc07f9d9e.js → 50455c84131b634ca6b4.js} +1 -1
  19. package/assets/esri/core/workers/chunks/54513578f735d274a20e.js +1 -0
  20. package/assets/esri/core/workers/chunks/{d46f8ef92e79d12384c9.js → 587437526ea77f764986.js} +1 -1
  21. package/assets/esri/core/workers/chunks/{ab720e2f0a35138564b2.js → 5ffabd1a90c5b08109aa.js} +1 -1
  22. package/assets/esri/core/workers/chunks/6108d72faf48a592c8ba.js +1 -0
  23. package/assets/esri/core/workers/chunks/6479439afae01f9bb5e6.js +1 -0
  24. package/assets/esri/core/workers/chunks/69306dfc89e877539223.js +1 -0
  25. package/assets/esri/core/workers/chunks/6db4a6f9d25691830829.js +1 -0
  26. package/assets/esri/core/workers/chunks/{61393fd3376ea599a447.js → 76e27cece1559ae815df.js} +1 -1
  27. package/assets/esri/core/workers/chunks/81526909c0fa11639038.js +1 -0
  28. package/assets/esri/core/workers/chunks/873111ddf4813cdd4903.js +1 -0
  29. package/assets/esri/core/workers/chunks/8d4f1170394a8be15da9.js +1 -0
  30. package/assets/esri/core/workers/chunks/8d8bdfda09c24e363f78.js +1 -0
  31. package/assets/esri/core/workers/chunks/9b54b5bdb6367c36f6e9.js +1 -0
  32. package/assets/esri/core/workers/chunks/b2752e038c5fa3c21e49.js +1 -0
  33. package/assets/esri/core/workers/chunks/{dd3b7cfc6f78552249a4.js → b78dc6cbe14e5817b4d9.js} +1 -1
  34. package/assets/esri/core/workers/chunks/{e31d0c7363cbceeb5ac9.js → c35b850fbfcb28133235.js} +1 -1
  35. package/assets/esri/core/workers/chunks/c83e1be4ee64320cf2fe.js +1 -0
  36. package/assets/esri/core/workers/chunks/c88869d2a647c22dc3e6.js +1 -0
  37. package/assets/esri/core/workers/chunks/cb0a5bc6deaa98026bb5.js +1 -0
  38. package/assets/esri/core/workers/chunks/{767467738aeabec14abd.js → d0c4367a197b193e95d4.js} +1 -1
  39. package/assets/esri/core/workers/chunks/{f113141e254505116b82.js → d1cc2c050423595e54e0.js} +1 -1
  40. package/assets/esri/core/workers/chunks/{7f34945036495ad7c3f8.js → d2a8bf2d090b94cb294b.js} +1 -1
  41. package/assets/esri/core/workers/chunks/{08af7f7f1950a59a8e47.js → d6c96a20e9640b433719.js} +4 -4
  42. package/assets/esri/core/workers/chunks/da5453e67d00ff546640.js +1 -0
  43. package/assets/esri/core/workers/chunks/daa79c14150c12d8bc3d.js +1 -0
  44. package/assets/esri/core/workers/chunks/ef03b78659c72de93076.js +1 -0
  45. package/assets/esri/core/workers/chunks/{c3cace5b25b5170228ba.js → f2fe89b6ac6bf6817e71.js} +1 -1
  46. package/assets/esri/core/workers/chunks/f3554627664a419e00fa.js +1 -0
  47. package/assets/esri/themes/base/_core.scss +2 -0
  48. package/assets/esri/themes/base/widgets/_DirectionalPad.scss +76 -0
  49. package/assets/esri/themes/base/widgets/_Editor.scss +65 -4
  50. package/assets/esri/themes/base/widgets/_UtilityNetworkAssociations.scss +97 -39
  51. package/assets/esri/themes/dark/main.css +1 -1
  52. package/assets/esri/themes/light/main.css +1 -1
  53. package/assets/esri/themes/light/view.css +1 -1
  54. package/assets/esri/widgets/DirectionalPad/t9n/DirectionalPad.json +1 -0
  55. package/assets/esri/widgets/DirectionalPad/t9n/DirectionalPad_en.json +1 -0
  56. package/assets/esri/widgets/Editor/t9n/Editor.json +1 -1
  57. package/assets/esri/widgets/Editor/t9n/Editor_en.json +1 -1
  58. package/assets/esri/widgets/UtilityNetworkAssociations/assets/img/line-caps/butt.png +0 -0
  59. package/assets/esri/widgets/UtilityNetworkAssociations/assets/img/line-caps/round.png +0 -0
  60. package/assets/esri/widgets/UtilityNetworkAssociations/assets/img/line-caps/square.png +0 -0
  61. package/assets/esri/widgets/UtilityNetworkAssociations/assets/img/line-patterns/dash-dot.png +0 -0
  62. package/assets/esri/widgets/UtilityNetworkAssociations/assets/img/line-patterns/dash.png +0 -0
  63. package/assets/esri/widgets/UtilityNetworkAssociations/assets/img/line-patterns/dot.png +0 -0
  64. package/assets/esri/widgets/UtilityNetworkAssociations/assets/img/line-patterns/long-dash-dot-dot.png +0 -0
  65. package/assets/esri/widgets/UtilityNetworkAssociations/assets/img/line-patterns/long-dash-dot.png +0 -0
  66. package/assets/esri/widgets/UtilityNetworkAssociations/assets/img/line-patterns/long-dash.png +0 -0
  67. package/assets/esri/widgets/UtilityNetworkAssociations/assets/img/line-patterns/short-dash-dot-dot.png +0 -0
  68. package/assets/esri/widgets/UtilityNetworkAssociations/assets/img/line-patterns/short-dash-dot.png +0 -0
  69. package/assets/esri/widgets/UtilityNetworkAssociations/assets/img/line-patterns/short-dash.png +0 -0
  70. package/assets/esri/widgets/UtilityNetworkAssociations/assets/img/line-patterns/short-dot.png +0 -0
  71. package/assets/esri/widgets/UtilityNetworkAssociations/assets/img/line-patterns/solid.png +0 -0
  72. package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations.json +1 -1
  73. package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_en.json +1 -1
  74. package/chunks/HighlightBlur.glsl.js +3 -3
  75. package/chunks/HighlightDownsample.glsl.js +24 -6
  76. package/chunks/SSAO.glsl.js +2 -2
  77. package/core/timeUtils.js +1 -1
  78. package/interfaces.d.ts +182 -2
  79. package/intl/date.js +1 -1
  80. package/layers/FeatureLayer.js +1 -1
  81. package/layers/ImageryLayer.js +1 -1
  82. package/layers/ImageryTileLayer.js +1 -1
  83. package/layers/StreamLayer.js +1 -1
  84. package/layers/SubtypeGroupLayer.js +1 -1
  85. package/layers/VoxelWasmPerSceneView.js +1 -1
  86. package/layers/graphics/sources/support/uploads.js +1 -1
  87. package/layers/mixins/ArcGISImageService.js +1 -1
  88. package/layers/mixins/ImageryTileMixin.js +1 -1
  89. package/layers/save/featureLayerUtils.js +1 -1
  90. package/layers/save/imageryUtils.js +1 -1
  91. package/layers/save/streamLayerUtils.js +1 -1
  92. package/libs/maquette-advanced-projector/utils.js +1 -1
  93. package/package.json +1 -1
  94. package/popup/support/FieldInfoFormat.js +1 -1
  95. package/portal/PortalItem.js +1 -1
  96. package/support/revision.js +1 -1
  97. package/views/2d/navigation/MapViewNavigation.js +1 -1
  98. package/views/3d/environment/EnvironmentRenderer.js +1 -1
  99. package/views/3d/externalRenderers/ExternalRendererStore.js +1 -1
  100. package/views/3d/layers/i3s/PointRenderer.js +1 -1
  101. package/views/3d/support/LaserLineRenderer.js +1 -1
  102. package/views/3d/terrain/OverlayRenderer.js +1 -1
  103. package/views/3d/terrain/TerrainRenderer.js +1 -1
  104. package/views/3d/terrain/TerrainSurface.js +1 -1
  105. package/views/3d/webgl-engine/core/renderPasses/RenderPassManager.js +1 -1
  106. package/views/3d/webgl-engine/effects/RenderPlugin.js +1 -1
  107. package/views/3d/webgl-engine/effects/RenderPluginManager.js +1 -1
  108. package/views/3d/webgl-engine/effects/highlight/Highlight.js +1 -1
  109. package/views/3d/webgl-engine/effects/highlight/ShadowHighlight.js +1 -1
  110. package/views/3d/webgl-engine/effects/smaa/SMAA.js +1 -1
  111. package/views/3d/webgl-engine/effects/ssao/SSAO.js +1 -1
  112. package/views/3d/webgl-engine/lib/GLMaterialRepository.js +1 -1
  113. package/views/3d/webgl-engine/lib/GLMaterials.js +1 -1
  114. package/views/3d/webgl-engine/lib/Renderer.js +1 -1
  115. package/views/3d/webgl-engine/lib/lodRendering/LodRenderer.js +1 -1
  116. package/views/3d/webgl-engine/materials/CheckerBoardMaterial.js +1 -1
  117. package/views/3d/webgl-engine/materials/ColorMaterial.js +1 -1
  118. package/views/3d/webgl-engine/materials/DefaultMaterial.js +1 -1
  119. package/views/3d/webgl-engine/materials/HUDMaterial.js +1 -1
  120. package/views/3d/webgl-engine/materials/HeatmapDensityMaterial.js +1 -1
  121. package/views/3d/webgl-engine/materials/ImageMaterial.js +1 -1
  122. package/views/3d/webgl-engine/materials/LineCalloutMaterial.js +1 -1
  123. package/views/3d/webgl-engine/materials/LineMarkerMaterial.js +1 -1
  124. package/views/3d/webgl-engine/materials/MeasurementArrowMaterial.js +1 -1
  125. package/views/3d/webgl-engine/materials/NativeLineMaterial.js +1 -1
  126. package/views/3d/webgl-engine/materials/PathMaterial.js +1 -1
  127. package/views/3d/webgl-engine/materials/PatternMaterial.js +1 -1
  128. package/views/3d/webgl-engine/materials/RibbonLineMaterial.js +1 -1
  129. package/views/3d/webgl-engine/materials/ShadedColorMaterial.js +1 -1
  130. package/views/3d/webgl-engine/materials/SlicePlaneMaterial.js +1 -1
  131. package/views/3d/webgl-engine/materials/WaterMaterial.js +1 -1
  132. package/views/3d/webgl-engine/materials/renderers/MergedRenderer.js +1 -1
  133. package/views/3d/webgl-engine/shaders/HighlightDownsample.glsl.js +1 -1
  134. package/views/draw/DrawGraphicTool.js +1 -1
  135. package/views/draw/DrawOperation.js +1 -1
  136. package/views/interactive/sketch/constraints.js +1 -1
  137. package/views/interactive/sketch/normalizedPoint.js +1 -1
  138. package/views/interactive/snapping/SnappingManager.js +1 -1
  139. package/views/interactive/snapping/candidates/IntersectionSnappingCandidate.js +1 -1
  140. package/views/interactive/tooltip/TooltipEditableField.js +1 -1
  141. package/views/interactive/tooltip/TooltipEditableFieldAngle.js +1 -1
  142. package/views/interactive/tooltip/constraintUtils.js +5 -0
  143. package/views/support/angularMeasurementUtils.js +1 -1
  144. package/widgets/Compass/CompassViewModel.js +1 -1
  145. package/widgets/Compass/utils.js +5 -0
  146. package/widgets/DirectionalPad/DirectionalPadViewModel.d.ts +4 -0
  147. package/widgets/DirectionalPad/DirectionalPadViewModel.js +5 -0
  148. package/widgets/DirectionalPad/VisibleElements.js +5 -0
  149. package/widgets/DirectionalPad/constants.js +5 -0
  150. package/widgets/DirectionalPad/css.js +5 -0
  151. package/widgets/DirectionalPad/utils.js +5 -0
  152. package/widgets/DirectionalPad.d.ts +4 -0
  153. package/widgets/DirectionalPad.js +5 -0
  154. package/widgets/Editor/EditorViewModel.js +1 -1
  155. package/widgets/Editor/Upload.js +1 -1
  156. package/widgets/Editor/components/CreateFeaturesPanelContent.js +1 -1
  157. package/widgets/Editor/components/UploadDetails.js +1 -1
  158. package/widgets/Editor/modelUploadUtils.js +1 -1
  159. package/widgets/Editor.js +1 -1
  160. package/widgets/ElevationProfile/support/chartUtils.js +1 -1
  161. package/widgets/ElevationProfile.js +1 -1
  162. package/widgets/Feature/FeatureViewModel.js +1 -1
  163. package/widgets/Feature/support/featureUtils.js +1 -1
  164. package/widgets/FeatureForm/FeatureFormViewModel.js +1 -1
  165. package/widgets/FeatureForm/FieldInput.js +1 -1
  166. package/widgets/FeatureForm/FormExpressionsManager.js +1 -1
  167. package/widgets/FeatureForm/InputBase.js +1 -1
  168. package/widgets/FeatureForm.js +1 -1
  169. package/widgets/UtilityNetworkAssociations/UtilityNetworkAssociationsLineSymbolPicker.js +5 -0
  170. package/widgets/UtilityNetworkAssociations/UtilityNetworkAssociationsViewModel.js +1 -1
  171. package/widgets/UtilityNetworkAssociations/VisibleElements.js +5 -0
  172. package/widgets/UtilityNetworkAssociations/VisibleElementsSettingsPane.js +5 -0
  173. package/widgets/UtilityNetworkAssociations.js +1 -1
  174. package/assets/esri/core/workers/chunks/11abbbf97093b55e2417.js +0 -1
  175. package/assets/esri/core/workers/chunks/1b2a081f2c3b97ba7e00.js +0 -1
  176. package/assets/esri/core/workers/chunks/235f333177ed7ea21e01.js +0 -1
  177. package/assets/esri/core/workers/chunks/3725dd14c2da0f47198f.js +0 -1
  178. package/assets/esri/core/workers/chunks/39467e1da18924cfb9b6.js +0 -1
  179. package/assets/esri/core/workers/chunks/42595c4870c673ed451c.js +0 -1
  180. package/assets/esri/core/workers/chunks/481cdd2a4bc40c6fef66.js +0 -1
  181. package/assets/esri/core/workers/chunks/54893132e70c515ea7e3.js +0 -1
  182. package/assets/esri/core/workers/chunks/6509a4198972b323d9b6.js +0 -1
  183. package/assets/esri/core/workers/chunks/68598d2806d4aa3d8acc.js +0 -1
  184. package/assets/esri/core/workers/chunks/718d2e8ea61f3b7b70c5.js +0 -1
  185. package/assets/esri/core/workers/chunks/7bce4b5eec630ef57f1e.js +0 -1
  186. package/assets/esri/core/workers/chunks/81df7304f97d1fc3ba16.js +0 -1
  187. package/assets/esri/core/workers/chunks/8706dc9f852df9b2095d.js +0 -1
  188. package/assets/esri/core/workers/chunks/8ef26aac0fe7feb8c324.js +0 -1
  189. package/assets/esri/core/workers/chunks/91e61da22f258d9e86c5.js +0 -1
  190. package/assets/esri/core/workers/chunks/9f039bf79b34d8fd75ae.js +0 -1
  191. package/assets/esri/core/workers/chunks/a1f3352301472e4b8956.js +0 -1
  192. package/assets/esri/core/workers/chunks/a20fd9e7db37b3c3b041.js +0 -1
  193. package/assets/esri/core/workers/chunks/aa83dce42d64034a0a13.js +0 -1
  194. package/assets/esri/core/workers/chunks/c8c8471b59700914ee9d.js +0 -1
  195. package/assets/esri/core/workers/chunks/cdcf0a5e05283d37b3ac.js +0 -1
  196. package/assets/esri/core/workers/chunks/d4f9106bf2ea5d66d96a.js +0 -1
  197. package/assets/esri/core/workers/chunks/e6bfbc4347fa13db4df2.js +0 -1
  198. package/assets/esri/core/workers/chunks/f1d5487f2d828fb142ba.js +0 -1
  199. package/assets/esri/core/workers/chunks/f97f165d05439e668e05.js +0 -1
  200. package/assets/esri/core/workers/chunks/fe973d8155c22d73a4f9.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.28/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{rasterRendererTypes as r,websceneRasterRendererTypes as i,read as s}from"../../rasterRenderers.js";import n from"../../request.js";import{deprecatedProperty as o}from"../../core/deprecate.js";import a from"../../core/Error.js";import{clone as l}from"../../core/lang.js";import u from"../../core/Logger.js";import{watch as p}from"../../core/reactiveUtils.js";import{urlToObject as c}from"../../core/urlUtils.js";import{property as m,ensureRange as d}from"../../core/accessorSupport/decorators/property.js";import{Integer as h,ensureClass as f,ensureNumber as y}from"../../core/accessorSupport/ensureType.js";import{reader as g}from"../../core/accessorSupport/decorators/reader.js";import{subclass as R}from"../../core/accessorSupport/decorators/subclass.js";import{writer as b}from"../../core/accessorSupport/decorators/writer.js";import{opacity as v,url as S}from"../support/commonProperties.js";import x from"../support/DimensionalDefinition.js";import{ExportImageServiceParameters as I}from"../support/ExportImageServiceParameters.js";import w from"../support/Field.js";import _ from"../support/FieldsIndex.js";import{createBitmap as F}from"../support/imageBitmapUtils.js";import{isSupportedRendererType as D}from"../support/imageryRendererUtils.js";import j from"../support/MosaicRule.js";import P from"../support/MultidimensionalSubset.js";import T from"../support/PixelBlock.js";import{interpolationKebab as O,noDataInterpretationKebab as C,pixelTypeKebabDict as N}from"../support/rasterEnums.js";import M from"../support/RasterFunction.js";import A from"../support/RasterInfo.js";import J from"../support/RasterJobHandler.js";import{intersectMultimensionalSubset as q,getSubsetVariablesFromMdInfo as E,getDefaultMultidimensionalDefinition as V}from"../support/rasterDatasets/multidimensionalUtils.js";import{decode as H,getFormat as Q}from"../support/rasterFormats/RasterCodec.js";import{uvComponentToVector as L}from"../support/rasterFunctions/vectorFieldUtils.js";import{getSupportedRendererTypes as U,getDefaultBandCombination as z,createDefaultRenderer as B,normalizeRendererJSON as k}from"../../renderers/support/rasterRendererHelper.js";import G from"../../renderers/support/RasterSymbolizer.js";import{computeAngles as W,computePixelSpaceLocations as $,computeHistograms as X,computeStatisticsHistograms as K,measureHeight as Y,measureAreaAndPerimeter as Z,measureDistanceAndAngle as ee,measurePointOrCentroid as te,getImageSpatialReferenceQueryParameter as re,getSamples as ie,identify as se}from"../../rest/imageService.js";import"../../core/has.js";import"../support/source/DataLayerSource.js";import{executeQueryJSON as ne}from"../../rest/query/executeQueryJSON.js";import"../../config.js";import"../../kernel.js";import"../../core/unitUtils.js";import"../../geometry/ellipsoidUtils.js";import"../../geometry/support/spatialReferenceUtils.js";import"../graphics/featureConversionUtils.js";import oe from"../../geometry/Extent.js";import"../../geometry/Geometry.js";import"../../geometry/Multipoint.js";import"../../geometry/Point.js";import ae from"../../geometry/Polygon.js";import"../../geometry/Polyline.js";import"../../geometry/support/normalizeUtils.js";import"../../core/pbf.js";import le from"../../rest/support/FeatureSet.js";import ue from"../../rest/support/Query.js";import"../../rest/query/support/AttachmentInfo.js";import"../../rest/support/AttachmentQuery.js";import{executeForCount as pe}from"../../rest/query/executeForCount.js";import{executeForIds as ce}from"../../rest/query/executeForIds.js";import"../../rest/support/RelationshipQuery.js";import"../../rest/support/TopFeaturesQuery.js";import{generateRasterInfo as me,fetchServiceRasterInfo as de}from"../../rest/imageService/fetchRasterInfo.js";import{getCatalogItemRasterInfo as he}from"../../rest/imageService/getCatalogItemRasterInfo.js";import fe from"../../rest/support/ImageAngleParameters.js";import ye from"../../rest/support/ImageAreaParameters.js";import ge from"../../rest/support/ImageDistanceParameters.js";import Re from"../../rest/support/ImageHeightParameters.js";import be from"../../rest/support/ImageHistogramParameters.js";import ve from"../../rest/support/ImageIdentifyParameters.js";import Se from"../../rest/support/ImagePixelLocationParameters.js";import xe from"../../rest/support/ImagePointParameters.js";import Ie from"../../rest/support/ImageSampleParameters.js";import{createFlowMesh as we}from"../../views/2d/engine/flow/dataUtils.js";import _e from"../../geometry/SpatialReference.js";const Fe=new Set(["png","png8","png24","png32","jpg","bmp","gif","jpgpng","lerc","tiff"]),De=d(y,{min:0,max:255});function je(e){if(!e)return null;const t=JSON.stringify(e).match(/"rasterFunction":"(.*?")/gi),r=t?.map((e=>e.replace('"rasterFunction":"',"").replace('"',"")));return r?r.join("/"):null}const Pe=d=>{let y=class extends d{constructor(){super(...arguments),this._functionRasterInfos={},this._rasterJobHandler={instance:null,refCount:0,connectionPromise:null},this._cachedRendererJson=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.defaultMosaicRule=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.multidimensionalInfo=null,this.multidimensionalSubset=null,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.sourceType=null,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 I({layer:this}))}readServiceSupportsMosaicRule(e,t){return this._isMosaicRuleSupported(t)}get _rasterFunctionNamesIndex(){const e=new Map;return!this.rasterFunctionInfos||null!=this.rasterFunctionInfos&&this.rasterFunctionInfos.length<1||null!=this.rasterFunctionInfos&&this.rasterFunctionInfos.forEach((t=>{e.set(t.name.toLowerCase().replaceAll(/ /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)}readDefaultMosaicRule(e,t){return this._serviceSupportsMosaicRule?j.fromJSON(t):null}get fieldsIndex(){return this.fields?new _(this.fields):null}set format(e){e&&Fe.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=j.fromJSON({...t.toJSON(),mosaicMethod:t.mosaicMethod,mosaicOperation:t.mosaicOperation})),this._set("mosaicRule",t)}readMosaicRule(e,t){const r=e||t.mosaicRule;return r?j.fromJSON(r):this._isMosaicRuleSupported(t)?j.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 j({where:s})),this._isValidCustomizedMosaicRule(i)&&(t[r]=i.toJSON())}writeNoData(e,t,r){null!=e&&"number"==typeof e&&(t[r]=De(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 c(this.url)}readSourceType(e,t){return this._isMosaicDataset(t)?"mosaic-dataset":"raster-dataset"}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),D(n)||u.getLogger(this).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 w({name:"Raster.ItemPixelValue",alias:"Item Pixel Value",domain:null,editable:!1,length:50,type:"string"}),r=new w({name:"Raster.ServicePixelValue",alias:"Service Pixel Value",domain:null,editable:!1,length:50,type:"string"}),i=new w({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&&null!=this.rasterFunctionInfos&&this.rasterFunctionInfos.some((e=>"none"===e.name.toLowerCase()))&&s.push(i),null!=this.rasterFunctionInfos&&this.rasterFunctionInfos.filter((e=>"none"!==e.name.toLowerCase())).forEach((e=>{s.push(new w({name:"Raster.ServicePixelValue."+e.name,alias:e.name,domain:null,editable:!1,length:50,type:"string"}))})),this._isVectorDataSet()&&(s.push(new w({name:"Raster.Magnitude",alias:"Magnitude",domain:null,editable:!1,type:"double"})),s.push(new w({name:"Raster.Direction",alias:"Direction",domain:null,editable:!1,type:"double"})));const{attributeTable:n}=this.rasterInfo??{};if(null!=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}get renderingRule(){return o(u.getLogger(this),"renderingRule",{replacement:"rasterFunction",version:"4.27",warnOnce:!0}),this._get("rasterFunction")}set renderingRule(e){o(u.getLogger(this),"renderingRule",{replacement:"rasterFunction",version:"4.27",warnOnce:!0}),this._set("rasterFunction",e)}set rasterFunction(e){let t=e;t&&t.rasterFunction&&(t=M.fromJSON({...t.toJSON(),rasterFunction:t.rasterFunction,rasterFunctionArguments:t.rasterFunctionArguments})),this._set("rasterFunction",t)}readRasterFunction(e,t){const r=t.rasterFunctionInfos;return t.renderingRule||r&&r.length&&"None"!==r[0].name?this._isRFTJson(t.renderingRule)?M.fromJSON({rasterFunctionDefinition:t.renderingRule}):M.fromJSON(t.renderingRule||{rasterFunctionInfos:t.rasterFunctionInfos}):null}readSpatialReference(e,t){const r=e||t.extent.spatialReference;return r?_e.fromJSON(r):null}readPixelType(e){return N.fromJSON(e)||e}writePixelType(e,t,r){null!=this.serviceRasterInfo&&this.pixelType===this.serviceRasterInfo.pixelType||(t[r]=N.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;const{renderer:i,symbolizer:s,pixelFilter:n,bandIds:o}=this;if(!this._isPicture()&&i&&s&&!n){const n=JSON.stringify(this._cachedRendererJson)!==JSON.stringify(i.toJSON()),a=this._rasterJobHandler.instance;if(a){n&&(s.bind(),await a.updateSymbolizer(s,t),this._cachedRendererJson=i.toJSON());const l=await a.symbolize({bandIds:o,...e},t);r={extent:e.extent,pixelBlock:l}}else r={extent:e.extent,pixelBlock:s.symbolize({bandIds:o,...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)).operations.supportsComputeAngles)throw new a("imagery-layer:compute-angles","this operation is not supported on the input image service");return e=f(fe,e).clone(),W(this.url,e,this._getRequestOptions(t))}async computePixelSpaceLocations(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsComputePixelLocation)throw new a("imagery-layer:compute-pixel-space-locations","this operation is not supported on the input image service");return e=f(Se,e).clone(),$(this.url,e,this._getRequestOptions(t))}async computeHistograms(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsComputeHistograms)throw new a("imagery-layer:compute-histograms","this operation is not supported on the input image service");return e=f(be,e).clone(),this._applyMosaicAndRenderingRules(e),X(this.url,e,this._getRequestOptions(t))}async computeStatisticsHistograms(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsComputeStatisticsHistograms)throw new a("imagery-layer:compute-statistics-histograms","this operation is not supported on the input image service");return e=f(be,e).clone(),this._applyMosaicAndRenderingRules(e),K(this.url,e,this._getRequestOptions(t))}async measureHeight(e,t){const r=await this._fetchCapabilities(t?.signal);if(!("base-and-top"===e.operationType?r.mensuration.supportsHeightFromBaseAndTop:"base-and-top-shadow"===e.operationType?r.mensuration.supportsHeightFromBaseAndTopShadow:r.mensuration.supportsHeightFromTopAndTopShadow))throw new a("imagery-layer:measure-height","this operation is not supported on the input image service");return e=f(Re,e).clone(),this._applyMosaicAndRenderingRules(e),Y(this.url,e,this._getRequestOptions(t))}async measureAreaAndPerimeter(e,t){const r=await this._fetchCapabilities(t?.signal);if(!(r.mensuration.supportsAreaAndPerimeter&&(!e.is3D||r.mensuration.supports3D)))throw new a("imagery-layer:measure-area-and-perimeter","this operation is not supported on the input image service");return e=f(ye,e).clone(),this._applyMosaicAndRenderingRules(e),Z(this.url,e,this._getRequestOptions(t))}async measureDistanceAndAngle(e,t){const r=await this._fetchCapabilities(t?.signal);if(!(r.mensuration.supportsDistanceAndAngle&&(!e.is3D||r.mensuration.supports3D)))throw new a("imagery-layer:measure-distance-and-angle","this operation is not supported on the input image service");return e=f(ge,e).clone(),this._applyMosaicAndRenderingRules(e),ee(this.url,e,this._getRequestOptions(t))}async measurePointOrCentroid(e,t){const r=await this._fetchCapabilities(t?.signal);if(!(r.mensuration.supportsPointOrCentroid&&(!e.is3D||r.mensuration.supports3D)))throw new a("imagery-layer:measure-point-or-centroid","this operation is not supported on the input image service");return e=f(xe,e).clone(),this._applyMosaicAndRenderingRules(e),te(this.url,e,this._getRequestOptions(t))}getField(e){const{fieldsIndex:t}=this;return null!=t?t.get(e):void 0}getFieldDomain(e,t){const r=this.getField(e);return r?r.domain:null}async fetchImage(e,t,r,i={}){if(null==e||null==t||null==r)throw new a("imagery-layer:fetch-image","Insufficient parameters for requesting an image. A valid extent, width and height values are required.");if(this.renderer||this.symbolizer){const e=await this._generateRasterInfo(this.rasterFunction,{signal:i.signal});e&&(this.rasterInfo=e)}const s=this.getExportImageServiceParameters(e,t,r,i.timeExtent);if(null==s){if(i.requestAsImageElement&&this._canRequestImageElement(this.format)){const e=document.createElement("canvas");if(e.width=t,e.height=r,i.returnImageBitmap){return{imageBitmap:await F(e,`${Pe(this.parsedUrl)}/exportImage`,i.signal)}}return{imageOrCanvasElement:e}}const{bandIds:s,rasterInfo:n}=this,o=(s?.length||n.bandCount)??0,a=t*r,l=n.pixelType,u=[];for(let e=0;e<o;e++)u.push(T.createEmptyBand(l,a));return{pixelData:{pixelBlock:new T({width:t,height:r,pixels:u,mask:new Uint8Array(a),pixelType:l}),extent:e}}}const n=!!i.requestAsImageElement&&!this.pixelFilter,o=n&&!!i.returnImageBitmap,l={imageServiceParameters:s,imageProps:{extent:e,width:t,height:r,format:this.format},requestAsImageElement:n,returnImageBitmap:o,signal:i.signal};return this._requestArrayBuffer(l)}fetchKeyProperties(e){return n(Pe(this.parsedUrl)+"/keyProperties",{query:this._getQueryParams({renderingRule:this.version>=10.3?e?.rasterFunction:null})}).then((e=>e.data))}fetchRasterAttributeTable(e){return this.version<10.1?Promise.reject(new a("#fetchRasterAttributeTable()","Failed to get rasterAttributeTable")):n(Pe(this.parsedUrl)+"/rasterAttributeTable",{query:this._getQueryParams({renderingRule:this.version>=10.3?e?.rasterFunction:null})}).then((e=>le.fromJSON(e.data)))}getCatalogItemRasterInfo(e,t){const r={...t,query:this._getQueryParams()};return he(Pe(this.parsedUrl),e,r)}async getCatalogItemICSInfo(e,t){const{data:r}=await n(Pe(this.parsedUrl)+"/"+e+"/info/ics",{query:this._getQueryParams(),...t}),i=r&&r.ics;if(!i)return;let s=null;try{s=(await n(Pe(this.parsedUrl)+"/"+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(Pe(this.parsedUrl)+"/"+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(Pe(this.parsedUrl)+"/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(Pe(this.parsedUrl)+"/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 b=oe.fromJSON(g[1]&&g[1].geometries&&g[1].geometries[0]);b&&(b.spatialReference=new _e({wkid:0,imageCoordinateSystem:i}));const v=g[2].geometries?g[2].geometries.filter((e=>null!=e&&null!=e.x&&null!=e.y&&"NaN"!==e.x&&"NaN"!==e.y)):[],S=v.length;if(S<3)return{ics:i,icsToPixelTransform:R,icsExtent:b,northDirection:null};let x=0,I=0,w=0,_=0;for(let n=0;n<S;n++)x+=v[n].x,I+=v[n].y,w+=v[n].x*v[n].x,_+=v[n].x*v[n].y;const F=(S*_-x*I)/(S*w-x*x);let D=0;const j=v[p-1].x>v[0].x,P=v[p-1].y>v[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:b,northDirection:D}}async generateRasterInfo(e,t){if(e=f(M,e),this.serviceRasterInfo&&(!e||"none"===e.functionName?.toLowerCase()||this._isVectorFieldResampleFunction(e)))return this.serviceRasterInfo;const r=je(e);if(!r)throw new a("imagery-layer:generate-raster-info","the rendering rule is not supported");if(this._functionRasterInfos[r])return this._functionRasterInfos[r];const i={...t,query:this._getQueryParams()},s=me(Pe(this.parsedUrl),e,i);this._functionRasterInfos[r]=s;try{return await s}catch(n){throw this._functionRasterInfos[r]=null,n}}getExportImageServiceParameters(e,t,r,i){e=e.clone().shiftCentralMeridian();const s=re(e.spatialReference,Pe(this.parsedUrl));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.rasterFunction?.rasterFunctionDefinition,p=!this.renderer||"raster-stretch"===this.renderer.type;if(o?.length&&this._hasRasterFunction(this.rasterFunction)&&!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._processMultidimensionalIntersection(null,i,this.exportImageServiceParameters.mosaicRule);if(c.isOutSide)return null;n.mosaicRule=null!=c.mosaicRule?JSON.stringify(c.mosaicRule):null,i=c.timeExtent,n.renderingRule=this._getRenderingRuleString(M.fromJSON(l));const m={};if(null!=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){const r=await this._fetchCapabilities(t?.signal);if(!r?.operations.supportsGetSamples)throw new a("imagery-layer:get-samples","getSamples operation is not supported on the input image service");e=f(Ie,e).clone();const{raster:i}=this;return i&&null==e.raster&&(e.raster=i),ie(this.url,e,this._getRequestOptions(t))}async identify(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsIdentify)throw new a("imagery-layer:identify","identify operation is not supported on the input image service");e=f(ve,e).clone();const r=this._processMultidimensionalIntersection(e.geometry,e.timeExtent,e.mosaicRule||this.mosaicRule);if(r.isOutSide)throw new a("imagery-layer:identify","the request cannot be fulfilled when falling outside of the multidimensional subset");e.timeExtent=r.timeExtent,e.mosaicRule=r.mosaicRule;const{raster:i,rasterFunction:s}=this;return s&&null==e.rasterFunction&&(e.rasterFunction=s),i&&null==e.raster&&(e.raster=i),se(this.url,e,this._getRequestOptions(t))}createQuery(){const e=new ue;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)),ne(this.url,e,t)}async queryObjectIds(e,t){return({query:e,requestOptions:t}=await this._prepareForQuery(e,t)),ce(this.url,e,t)}async queryRasterCount(e,t){return({query:e,requestOptions:t}=await this._prepareForQuery(e,t)),pe(this.url,e,t)}async queryVisibleRasters(e,t){if(!e)throw new a("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 o=!1,l=null,u=null;const p="raster.servicepixelvalue",c=this._rasterFunctionNamesIndex;if(null!=e.outFields&&(o=e.outFields.some((e=>!e.toLowerCase().includes(p))),this.version>=10.4)){const t=e.outFields.filter((e=>e.toLowerCase().includes(p)&&e.length>p.length)).map((e=>{const t=e.slice(p.length+1);return[this._updateRenderingRulesFunctionName(t,c),t]}));l=t.map((e=>new M({functionName:e[0]}))),u=t.map((e=>e[1]));const{rasterFunction:r}=this;0===l.length?r?.functionName?(l.push(r),u.push(r.functionName)):l=null:r?.functionName&&!l.some((e=>e.functionName===r.functionName))&&(l.push(r),u.push(r.functionName))}const m=null==e.outSpatialReference||e.outSpatialReference.equals(this.spatialReference),{multidimensionalSubset:d}=this;let h=e.timeExtent||this.timeExtent;if(d){const{isOutside:t,intersection:r}=q(d,{geometry:e.geometry,timeExtent:e.timeExtent,multidimensionalDefinition:this.exportImageServiceParameters.mosaicRule?.multidimensionalDefinition});if(t)throw new a("imagery-layer:query-visible-rasters","the request cannot be fulfilled when falling outside of the multidimensional subset");r&&null!=r.timeExtent&&(h=r.timeExtent)}const f=this._combineMosaicRuleWithTimeExtent(this.exportImageServiceParameters.mosaicRule,h),y=this._getQueryParams({geometry:e.geometry,timeExtent:h,mosaicRule:f,rasterFunction:this.version<10.4?this.rasterFunction:null,rasterFunctions:l,pixelSize:r,returnCatalogItems:o,returnGeometry:m,raster:this.raster,maxItemCount:s?1:null});delete y.f;const g=new ve(y);try{await this._generateRasterInfo(this.rasterFunction);const r=await se(this.url,g,{signal:t?.signal,query:{...this.customParameters}}),s=e.outFields,a=null!=r.value&&r.value.toLowerCase().includes("nodata");if(!(o&&!m&&r?.catalogItems?.features.length&&(n||!a)))return this._processVisibleRastersResponse(r,{returnDomainValues:i,templateRRFunctionNames:u,showNoDataRecords:n,templateFields:s});const l=this.objectIdField||"ObjectId",p=r.catalogItems?.features??[],c=p.map((e=>e.attributes?.[l])),d=new ue({objectIds:c,returnGeometry:!0,outSpatialReference:e.outSpatialReference,outFields:[l]}),h=await this.queryRasters(d);return h?.features?.length&&h.features.forEach((t=>{p.forEach((r=>{r.attributes[l]===t.attributes[l]&&(r.geometry=new ae(t.geometry),null!=e.outSpatialReference&&(r.geometry.spatialReference=e.outSpatialReference))}))})),this._processVisibleRastersResponse(r,{returnDomainValues:i,templateRRFunctionNames:u,showNoDataRecords:n,templateFields:s})}catch{throw new a("imagery-layer:query-visible-rasters","encountered error when querying visible rasters")}}async fetchVariableStatisticsHistograms(e,t){const r=n(Pe(this.parsedUrl)+"/statistics",{query:this._getQueryParams({variable:e}),signal:t}).then((e=>e.data?.statistics)),i=n(Pe(this.parsedUrl)+"/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):we(e.meshType,e.simulationSettings,e.flowData,null!=t.signal?t.signal:(new AbortController).signal)}getMultidimensionalSubsetVariables(e){const t=e??this.serviceRasterInfo.multidimensionalInfo;return E(this.multidimensionalSubset,t)}async _fetchService(e){await this._fetchServiceInfo(e),this.rasterInfo||(this.rasterInfo=this.serviceRasterInfo);const t=this.sourceJSON,r=null!=this.serviceRasterInfo?Promise.resolve(this.serviceRasterInfo):de(Pe(this.parsedUrl),t,{signal:e,query:this._getQueryParams()}).then((e=>(this._set("serviceRasterInfo",e),this._set("multidimensionalInfo",e.multidimensionalInfo),e))),i=this._hasRasterFunction(this.rasterFunction)?this._generateRasterInfo(this.rasterFunction,{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).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([p((()=>this.rasterFunction),(e=>{(this.renderer||this.symbolizer||this.popupEnabled&&this.popupTemplate)&&this._generateRasterInfo(e).then((e=>{e&&(this.rasterInfo=e)}))}))]);const{serviceRasterInfo:t}=this;null!=t.multidimensionalInfo&&this._updateMultidimensionalDefinition(t)}))}_combineMosaicRuleWithTimeExtent(e,t){const r=this.timeInfo,{multidimensionalInfo:i}=this.serviceRasterInfo;if(null==e||null==i||null==t||null==r?.startField)return e;const{startField:s}=r,n=i.variables.some((e=>e.dimensions.some((e=>e.name===s))))?s:"StdTime";if(e=e.clone(),"mosaic-dataset"===this.sourceType)return e.multidimensionalDefinition=e.multidimensionalDefinition?.filter((e=>e.dimensionName!==n)),this._cleanupMultidimensionalDefinition(e);e.multidimensionalDefinition=e.multidimensionalDefinition||[];const o=e.multidimensionalDefinition.filter((e=>e.dimensionName===n)),a=null!=t.start?t.start.getTime():null,l=null!=t.end?t.end.getTime():null,u=null==a||null==l||a===l,p=u?[a||l]:[[a,l]],c=this.version>=10.8;if(o.length)o.forEach((e=>{e.dimensionName===n&&(c?(e.dimensionName=null,e.isSlice=!1,e.values=[]):(e.isSlice=u,e.values=p))}));else if(!c){const t=e.multidimensionalDefinition.filter((e=>null!=e.variableName&&null==e.dimensionName));t.length?t.forEach((e=>{e.dimensionName=n,e.isSlice=u,e.values=p})):e.multidimensionalDefinition.push(new x({variableName:"",dimensionName:n,isSlice:u,values:p}))}return this._cleanupMultidimensionalDefinition(e)}_cleanupMultidimensionalDefinition(e){return null==e?null:(e.multidimensionalDefinition&&(e.multidimensionalDefinition=e.multidimensionalDefinition.filter((e=>!(!e.variableName&&!e.dimensionName))),0===e.multidimensionalDefinition.length&&(e.multidimensionalDefinition=null)),"mosaic-dataset"!==this.sourceType&&null==e.multidimensionalDefinition?null:e)}async _prepareForQuery(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsQuery)throw new a("imagery-layer:query-rasters","query operation is not supported on the input image service");return e=null!=e?f(ue,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 J;this._rasterJobHandler.connectionPromise=e.initialize().then((()=>{this._rasterJobHandler.instance=e}),(()=>{})),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,rasterFunction:r}=this;return"unique-value"===e.type&&this._hasRasterFunction(r)&&1===t?.bandCount&&["u8","s8"].includes(t.pixelType)||null!=t&&null!=e&&U(t).includes(e.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(Pe(this.parsedUrl),{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 a("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.fields?.length>1);return t||r}_isVectorFieldResampleFunction(e){if(null==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){const t=this._isPicture(),{rasterInfo:r}=this;if(!t&&!this.pixelFilter||this._isVectorDataSet()){if(!this.bandIds&&r.bandCount>=3){const e=z(r);!e||3===r.bandCount&&0===e[0]&&1===e[1]&&2===e[2]||(this.bandIds=e)}e||(e=B(r,{bandIds:this.bandIds,variableName:this.rasterFunction?null:this.mosaicRule?.multidimensionalDefinition?.[0].variableName}));const t=k(e.toJSON());this.symbolizer?(this.symbolizer.rendererJSON=t,this.symbolizer.rasterInfo=r):this.symbolizer=new G({rendererJSON:t,rasterInfo:r}),this.symbolizer.bind().success||(this.symbolizer=null)}return e}_clonePixelData(e){return null==e?e:{extent:e.extent&&e.extent.clone(),pixelBlock:null!=e.pixelBlock?e.pixelBlock.clone():null}}_getQueryParams(e){e&&null!=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}):H(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;const r=await n(Pe(this.parsedUrl)+"/rasterFunctionInfos",{query:this._getQueryParams(),signal:e});return r.data?.rasterFunctionInfos}return null}_canRequestImageElement(e){return!this.pixelFilter&&(!e||e.includes("png"))}async _requestArrayBuffer(e){const{imageProps:t,requestAsImageElement:r,returnImageBitmap:i,signal:s}=e;if(r&&this._canRequestImageElement(t.format)){const r=`${Pe(this.parsedUrl)}/exportImage`,{data:o}=await n(r,{responseType:i?"blob":"image",query:this._getQueryParams({f:"image",...this.refreshParameters,...e.imageServiceParameters}),signal:s});if(o instanceof Blob){return{imageBitmap:await F(o,r,s),params:t}}return{imageOrCanvasElement:o,params:t}}const o=this._initJobHandler(),l=n(Pe(this.parsedUrl)+"/exportImage",{responseType:"array-buffer",query:this._getQueryParams({f:"image",...e.imageServiceParameters}),signal:s}),u=(await Promise.all([l,o]))[0].data,p=t.format||"jpgpng";let c=p;if("bsq"!==c&&"bip"!==c&&(c=Q(u)),!c)throw new a("imagery-layer:fetch-image","unsupported format signature "+String.fromCharCode.apply(null,new Uint8Array(u)));const m={signal:s},d="gif"===p||"bmp"===p||p.includes("png")&&("png"===c||"jpg"===c)?H(u,{useCanvas:!0,...t},m):this._decodePixelBlock(u,{width:t.width,height:t.height,planes:null,pixelType:null,noDataValue:null,format:p},m);return{pixelData:{pixelBlock:await d,extent:t.extent},params:t}}_generateRasterInfo(e,t){return this.generateRasterInfo(e,t).catch((()=>null))}_isValidCustomizedMosaicRule(e){return e&&JSON.stringify(e.toJSON())!==JSON.stringify(this.defaultMosaicRule?.toJSON())}_updateMultidimensionalDefinition(e){if(this._isValidCustomizedMosaicRule(this.mosaicRule))return;let t=V(e,{multidimensionalSubset:this.multidimensionalSubset});if(null!=t&&t.length>0){this.mosaicRule=this.mosaicRule||new j;const e=this.mosaicRule.multidimensionalDefinition;!this.sourceJSON.defaultVariableName&&this.rasterFunction&&"none"!==this.rasterFunction.functionName?.toLowerCase()&&t.forEach((e=>e.variableName="")),t=t.filter((({variableName:e,dimensionName:t})=>e&&"*"!==e||t)),!e?.length&&t.length&&(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,p=e.properties&&e.properties.Values&&e.properties.Values.map((e=>e.replaceAll(/ /gi,", ")))||[];const c=this.objectIdField||"ObjectId",m="string"==typeof i&&i.toLowerCase().includes("nodata"),d=[];if(i&&!u&&!m){const e={};e[c]=0;p=[i],u=[new t(this.fullExtent,null,e)]}if(!u)return[];let h,f,y;this._updateResponseFieldNames(u,a),m&&!n&&(u=[]);for(let t=0;t<u.length;t++){if(h=u[t],null!=i){if(f=p[t],y=this.rasterFunction&&l&&l.length>0&&s&&s.length>0&&s.includes(this.rasterFunction.functionName)?l[s.indexOf(this.rasterFunction.functionName)]:i,"nodata"===f.toLowerCase()&&!n)continue;const e="Raster.ItemPixelValue",r="Raster.ServicePixelValue";h.attributes[e]=f,h.attributes[r]=y,this._updateFeatureWithMagDirValues(h,f);const o=this.fields&&this.fields.length>0;let a=this.rasterFunction&&null!=this.serviceRasterInfo.attributeTable?o?f:i:y;this.rasterFunction||(a=o?f:i),this._updateFeatureWithRasterAttributeTableValues(h,a)}if(h.sourceLayer=h.layer=this,o&&this._updateFeatureWithDomainValues(h),s&&l&&s.length===l.length)for(let e=0;e<s.length;e++){const t="Raster.ServicePixelValue."+s[e];h.attributes[t]=l[e]}d.push(u[t])}return d}_processMultidimensionalIntersection(e,t,r){const{multidimensionalSubset:i}=this;if(!i)return{isOutSide:!1,timeExtent:t,mosaicRule:r=this._combineMosaicRuleWithTimeExtent(r,t)};if(i){const{isOutside:r,intersection:s}=q(i,{geometry:e,timeExtent:t});if(r)return{isOutSide:!0,timeExtent:null,mosaicRule:null};s&&null!=s.timeExtent&&(t=s.timeExtent)}if(null!=(r=this._combineMosaicRuleWithTimeExtent(r,t))&&r.multidimensionalDefinition){const{isOutside:e}=q(i,{multidimensionalDefinition:r.multidimensionalDefinition});if(e)return{isOutSide:!0,timeExtent:null,mosaicRule:null}}return{isOutSide:!1,timeExtent:t,mosaicRule:r}}_updateFeatureWithRasterAttributeTableValues(e,t){const r=this.rasterInfo.attributeTable||this.serviceRasterInfo.attributeTable;if(null==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 T({height:1,width:1,pixelType:"f32",pixels:i,statistics:s});null!=this.pixelFilter&&this.pixelFilter({pixelBlock:n,extent:new oe(0,0,0,0,this.spatialReference)});const o="esriImageServiceDataTypeVector-MagDir"===this.serviceDataType?[n.pixels[0][0],n.pixels[1][0]]:L([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;null!=r&&e.forEach((e=>{if(e&&e.attributes)for(const i of t){const t=r.get(i)?.name;t&&t!==i&&(e.attributes[i]=e.attributes[t],delete e.attributes[t])}}))}_getRenderingRuleString(e){if(e){let t=e.toJSON();return t=t.rasterFunctionDefinition??t,(t.thumbnail||t.thumbnailEx)&&(t.thumbnail=t.thumbnailEx=null),JSON.stringify(t)}return null}_hasRasterFunction(e){return null!=e&&null!=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().replaceAll(/ /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}_applyMosaicAndRenderingRules(e){const{raster:t,mosaicRule:r,rasterFunction:i}=this;i&&e instanceof be&&null==e.rasterFunction&&(e.rasterFunction=i),r&&null==e.mosaicRule&&(e.mosaicRule=r),t&&null==e.raster&&(e.raster=t)}_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"),u=t.includes("mensuration")&&a,p=null==e.mensurationCapabilities?[]:e.mensurationCapabilities.toLowerCase().split(",").map((e=>e.trim())),c=u&&p.includes("basic");return{data:{supportsAttachment:!1},operations:{supportsComputeHistograms:n,supportsExportImage:n,supportsIdentify:n,supportsMeasure:u,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,supportsAsyncConvert3D:!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,supportsQueryByAnonymous:!1,supportsQueryByOthers:!1,supportsHistoricMoment:!1,supportsFormatPBF:!1,supportsDisjointSpatialRelationship:!1,supportsCacheHint:!1,supportsSpatialAggregationStatistics:!1,supportedSpatialAggregationStatistics:{envelope:!1,centroid:!1,convexHull:!1},supportsDefaultSpatialReference:!!i?.supportsDefaultSR,supportsFullTextSearch:!1,supportsCompactGeometry:!1,standardMaxRecordCount:void 0,tileMaxRecordCount:void 0},mensuration:{supportsDistanceAndAngle:c,supportsAreaAndPerimeter:c,supportsPointOrCentroid:c,supportsHeightFromBaseAndTop:u&&p.includes("base-top height"),supportsHeightFromBaseAndTopShadow:u&&p.includes("base-top shadow height"),supportsHeightFromTopAndTopShadow:u&&p.includes("top-top shadow height"),supports3D:u&&p.includes("3d")}}}};function Pe(e){return e?.path??""}return e([m()],y.prototype,"_functionRasterInfos",void 0),e([m()],y.prototype,"_rasterJobHandler",void 0),e([m()],y.prototype,"_cachedRendererJson",void 0),e([m({readOnly:!0})],y.prototype,"_serviceSupportsMosaicRule",void 0),e([g("_serviceSupportsMosaicRule",["currentVersion","fields"])],y.prototype,"readServiceSupportsMosaicRule",null),e([m()],y.prototype,"_rasterAttributeTableFieldPrefix",void 0),e([m({readOnly:!0})],y.prototype,"_rasterFunctionNamesIndex",null),e([m()],y.prototype,"adjustAspectRatio",void 0),e([m({type:[h],json:{write:!0}})],y.prototype,"bandIds",void 0),e([g("bandIds")],y.prototype,"readBandIds",null),e([m({readOnly:!0,json:{read:!1}})],y.prototype,"capabilities",void 0),e([g("service","capabilities",["capabilities","currentVersion","serviceDataType"])],y.prototype,"readCapabilities",null),e([m({type:Number})],y.prototype,"compressionQuality",void 0),e([b("compressionQuality")],y.prototype,"writeCompressionQuality",null),e([m({type:Number})],y.prototype,"compressionTolerance",void 0),e([b("compressionTolerance")],y.prototype,"writeCompressionTolerance",null),e([m({json:{read:{source:"copyrightText"}}})],y.prototype,"copyright",void 0),e([m({readOnly:!0,dependsOn:["_serviceSupportsMosaicRule"]})],y.prototype,"defaultMosaicRule",void 0),e([g("defaultMosaicRule",["defaultMosaicMethod"])],y.prototype,"readDefaultMosaicRule",null),e([m({type:String,json:{name:"layerDefinition.definitionExpression",write:{enabled:!0,allowNull:!0}}})],y.prototype,"definitionExpression",void 0),e([m({readOnly:!0,constructOnly:!0})],y.prototype,"exportImageServiceParameters",void 0),e([m()],y.prototype,"rasterInfo",void 0),e([m({readOnly:!0,type:[w]})],y.prototype,"fields",void 0),e([m({readOnly:!0})],y.prototype,"fieldsIndex",null),e([m({type:["png","png8","png24","png32","jpg","bmp","gif","jpgpng","lerc","tiff"],json:{write:!0}})],y.prototype,"format",null),e([g("service","format",["serviceDataType"])],y.prototype,"readFormat",null),e([m({type:oe})],y.prototype,"fullExtent",void 0),e([m({readOnly:!0})],y.prototype,"hasMultidimensions",void 0),e([m({json:{read:{source:"maxImageHeight"}}})],y.prototype,"imageMaxHeight",void 0),e([m({json:{read:{source:"maxImageWidth"}}})],y.prototype,"imageMaxWidth",void 0),e([m({type:String,json:{type:O.jsonValues,read:O.read,write:O.write}})],y.prototype,"interpolation",void 0),e([m()],y.prototype,"minScale",void 0),e([g("service","minScale")],y.prototype,"readMinScale",null),e([m()],y.prototype,"maxScale",void 0),e([g("service","maxScale")],y.prototype,"readMaxScale",null),e([m({type:j})],y.prototype,"mosaicRule",null),e([g("mosaicRule",["mosaicRule","defaultMosaicMethod"])],y.prototype,"readMosaicRule",null),e([b("mosaicRule")],y.prototype,"writeMosaicRule",null),e([m()],y.prototype,"multidimensionalInfo",void 0),e([m({type:P,json:{write:!0}})],y.prototype,"multidimensionalSubset",void 0),e([m({json:{type:h}})],y.prototype,"noData",void 0),e([b("noData")],y.prototype,"writeNoData",null),e([m({type:String,json:{type:C.jsonValues,read:C.read,write:C.write}})],y.prototype,"noDataInterpretation",void 0),e([m({type:String,readOnly:!0,json:{read:{source:["fields"]}}})],y.prototype,"objectIdField",void 0),e([g("objectIdField")],y.prototype,"readObjectIdField",null),e([m({})],y.prototype,"geometryType",void 0),e([m({})],y.prototype,"typeIdField",void 0),e([m({})],y.prototype,"types",void 0),e([m({readOnly:!0})],y.prototype,"parsedUrl",null),e([m({type:Function})],y.prototype,"pixelFilter",void 0),e([m()],y.prototype,"raster",void 0),e([m({readOnly:!0})],y.prototype,"sourceType",void 0),e([g("sourceType",["serviceSourceType","fields"])],y.prototype,"readSourceType",null),e([m()],y.prototype,"viewId",void 0),e([m({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})}}}}})],y.prototype,"renderer",null),e([g("renderer")],y.prototype,"readRenderer",null),e([b("renderer")],y.prototype,"writeRenderer",null),e([m()],y.prototype,"symbolizer",void 0),e([m(v)],y.prototype,"opacity",void 0),e([m({readOnly:!0})],y.prototype,"rasterFields",null),e([m({constructOnly:!0})],y.prototype,"rasterFunctionInfos",void 0),e([m({type:M})],y.prototype,"renderingRule",null),e([m({type:M,json:{name:"renderingRule"}})],y.prototype,"rasterFunction",null),e([g("rasterFunction",["renderingRule","rasterFunctionInfos"])],y.prototype,"readRasterFunction",null),e([m()],y.prototype,"serviceDataType",void 0),e([m({readOnly:!0,type:_e})],y.prototype,"spatialReference",void 0),e([g("spatialReference",["spatialReference","extent"])],y.prototype,"readSpatialReference",null),e([m({json:{type:N.jsonValues}})],y.prototype,"pixelType",void 0),e([g("pixelType")],y.prototype,"readPixelType",null),e([b("pixelType")],y.prototype,"writePixelType",null),e([m({constructOnly:!0,type:A})],y.prototype,"serviceRasterInfo",void 0),e([m()],y.prototype,"sourceJSON",void 0),e([m(S)],y.prototype,"url",void 0),e([m({readOnly:!0})],y.prototype,"version",void 0),e([g("version",["currentVersion","fields","timeInfo"])],y.prototype,"readVersion",null),y=e([R("esri.layers.mixins.ArcGISImageService")],y),y};export{Pe 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{deprecatedProperty as o}from"../../core/deprecate.js";import a from"../../core/Error.js";import{clone as l}from"../../core/lang.js";import u from"../../core/Logger.js";import{watch as p}from"../../core/reactiveUtils.js";import{urlToObject as c}from"../../core/urlUtils.js";import{property as m,ensureRange as d}from"../../core/accessorSupport/decorators/property.js";import{Integer as h,ensureClass as f,ensureNumber as y}from"../../core/accessorSupport/ensureType.js";import{reader as g}from"../../core/accessorSupport/decorators/reader.js";import{subclass as R}from"../../core/accessorSupport/decorators/subclass.js";import{writer as b}from"../../core/accessorSupport/decorators/writer.js";import{opacity as v,url as S}from"../support/commonProperties.js";import x from"../support/DimensionalDefinition.js";import{ExportImageServiceParameters as I}from"../support/ExportImageServiceParameters.js";import w from"../support/Field.js";import _ from"../support/FieldsIndex.js";import{createBitmap as F}from"../support/imageBitmapUtils.js";import{isSupportedRendererType as D}from"../support/imageryRendererUtils.js";import j from"../support/MosaicRule.js";import P from"../support/MultidimensionalSubset.js";import O from"../support/PixelBlock.js";import{interpolationKebab as T,noDataInterpretationKebab as C,pixelTypeKebabDict as N}from"../support/rasterEnums.js";import M from"../support/RasterFunction.js";import A from"../support/RasterInfo.js";import J from"../support/RasterJobHandler.js";import{intersectMultimensionalSubset as q,getSubsetVariablesFromMdInfo as E,getDefaultMultidimensionalDefinition as V}from"../support/rasterDatasets/multidimensionalUtils.js";import{decode as H,getFormat as Q}from"../support/rasterFormats/RasterCodec.js";import{uvComponentToVector as L}from"../support/rasterFunctions/vectorFieldUtils.js";import{getSupportedRendererTypes as U,getDefaultBandCombination as z,createDefaultRenderer as B,normalizeRendererJSON as k}from"../../renderers/support/rasterRendererHelper.js";import G from"../../renderers/support/RasterSymbolizer.js";import{computeAngles as W,computePixelSpaceLocations as $,computeHistograms as X,computeStatisticsHistograms as K,measureHeight as Y,measureAreaAndPerimeter as Z,measureDistanceAndAngle as ee,measurePointOrCentroid as te,getImageSpatialReferenceQueryParameter as re,getSamples as ie,identify as se}from"../../rest/imageService.js";import"../../core/has.js";import"../support/source/DataLayerSource.js";import{executeQueryJSON as ne}from"../../rest/query/executeQueryJSON.js";import"../../config.js";import"../../kernel.js";import"../../core/unitUtils.js";import"../../geometry/ellipsoidUtils.js";import"../../geometry/support/spatialReferenceUtils.js";import"../graphics/featureConversionUtils.js";import oe from"../../geometry/Extent.js";import"../../geometry/Geometry.js";import"../../geometry/Multipoint.js";import"../../geometry/Point.js";import ae from"../../geometry/Polygon.js";import"../../geometry/Polyline.js";import"../../geometry/support/normalizeUtils.js";import"../../core/pbf.js";import le from"../../rest/support/FeatureSet.js";import ue from"../../rest/support/Query.js";import"../../rest/query/support/AttachmentInfo.js";import"../../rest/support/AttachmentQuery.js";import{executeForCount as pe}from"../../rest/query/executeForCount.js";import{executeForIds as ce}from"../../rest/query/executeForIds.js";import"../../rest/support/RelationshipQuery.js";import"../../rest/support/TopFeaturesQuery.js";import{generateRasterInfo as me,fetchServiceRasterInfo as de}from"../../rest/imageService/fetchRasterInfo.js";import{getCatalogItemRasterInfo as he}from"../../rest/imageService/getCatalogItemRasterInfo.js";import fe from"../../rest/support/ImageAngleParameters.js";import ye from"../../rest/support/ImageAreaParameters.js";import ge from"../../rest/support/ImageDistanceParameters.js";import Re from"../../rest/support/ImageHeightParameters.js";import be from"../../rest/support/ImageHistogramParameters.js";import ve from"../../rest/support/ImageIdentifyParameters.js";import Se from"../../rest/support/ImagePixelLocationParameters.js";import xe from"../../rest/support/ImagePointParameters.js";import Ie from"../../rest/support/ImageSampleParameters.js";import{createFlowMesh as we}from"../../views/2d/engine/flow/dataUtils.js";import _e from"../../geometry/SpatialReference.js";const Fe=new Set(["png","png8","png24","png32","jpg","bmp","gif","jpgpng","lerc","tiff"]),De=d(y,{min:0,max:255});function je(e){if(!e)return null;const t=JSON.stringify(e).match(/"rasterFunction":"(.*?")/gi),r=t?.map((e=>e.replace('"rasterFunction":"',"").replace('"',"")));return r?r.join("/"):null}const Pe=d=>{let y=class extends d{constructor(){super(...arguments),this._functionRasterInfos={},this._rasterJobHandler={instance:null,refCount:0,connectionPromise:null},this._cachedRendererJson=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.defaultMosaicRule=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.multidimensionalInfo=null,this.multidimensionalSubset=null,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.sourceType=null,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 I({layer:this}))}readServiceSupportsMosaicRule(e,t){return this._isMosaicRuleSupported(t)}get _rasterFunctionNamesIndex(){const e=new Map;return!this.rasterFunctionInfos||null!=this.rasterFunctionInfos&&this.rasterFunctionInfos.length<1||null!=this.rasterFunctionInfos&&this.rasterFunctionInfos.forEach((t=>{e.set(t.name.toLowerCase().replaceAll(/ /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)}readDefaultMosaicRule(e,t){return this._serviceSupportsMosaicRule?j.fromJSON(t):null}get fieldsIndex(){return this.fields?new _(this.fields):null}set format(e){e&&Fe.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=j.fromJSON({...t.toJSON(),mosaicMethod:t.mosaicMethod,mosaicOperation:t.mosaicOperation})),this._set("mosaicRule",t)}readMosaicRule(e,t){const r=e||t.mosaicRule;return r?j.fromJSON(r):this._isMosaicRuleSupported(t)?j.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 j({where:s})),this._isValidCustomizedMosaicRule(i)&&(t[r]=i.toJSON())}writeNoData(e,t,r){null!=e&&"number"==typeof e&&(t[r]=De(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 c(this.url)}readSourceType(e,t){return this._isMosaicDataset(t)?"mosaic-dataset":"raster-dataset"}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),D(n)||u.getLogger(this).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,t=new w({name:"Raster.ItemPixelValue",alias:"Item Pixel Value",domain:null,editable:!1,length:50,type:"string"}),r=new w({name:"Raster.ServicePixelValue",alias:"Service Pixel Value",domain:null,editable:!1,length:50,type:"string"}),i=new w({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&&null!=this.rasterFunctionInfos&&this.rasterFunctionInfos.some((e=>"none"===e.name.toLowerCase()))&&s.push(i),null!=this.rasterFunctionInfos&&this.rasterFunctionInfos.filter((e=>"none"!==e.name.toLowerCase())).forEach((e=>{s.push(new w({name:"Raster.ServicePixelValue."+e.name,alias:e.name,domain:null,editable:!1,length:50,type:"string"}))})),this._isVectorDataSet()&&(s.push(new w({name:"Raster.Magnitude",alias:"Magnitude",domain:null,editable:!1,type:"double"})),s.push(new w({name:"Raster.Direction",alias:"Direction",domain:null,editable:!1,type:"double"})));const{attributeTable:n}=this.rasterInfo??{};if(null!=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}get renderingRule(){return o(u.getLogger(this),"renderingRule",{replacement:"rasterFunction",version:"4.27",warnOnce:!0}),this._get("rasterFunction")}set renderingRule(e){o(u.getLogger(this),"renderingRule",{replacement:"rasterFunction",version:"4.27",warnOnce:!0}),this._set("rasterFunction",e)}set rasterFunction(e){let t=e;t&&t.rasterFunction&&(t=M.fromJSON({...t.toJSON(),rasterFunction:t.rasterFunction,rasterFunctionArguments:t.rasterFunctionArguments})),this._set("rasterFunction",t)}readRasterFunction(e,t){const r=t.rasterFunctionInfos;return t.renderingRule||r&&r.length&&"None"!==r[0].name?this._isRFTJson(t.renderingRule)?M.fromJSON({rasterFunctionDefinition:t.renderingRule}):M.fromJSON(t.renderingRule||{rasterFunctionInfos:t.rasterFunctionInfos}):null}readSpatialReference(e,t){const r=e||t.extent.spatialReference;return r?_e.fromJSON(r):null}readPixelType(e){return N.fromJSON(e)||e}writePixelType(e,t,r){null!=this.serviceRasterInfo&&this.pixelType===this.serviceRasterInfo.pixelType||(t[r]=N.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;const{renderer:i,symbolizer:s,pixelFilter:n,bandIds:o}=this;if(!this._isPicture()&&i&&s&&!n){const n=JSON.stringify(this._cachedRendererJson)!==JSON.stringify(i.toJSON()),a=this._rasterJobHandler.instance;if(a){n&&(s.bind(),await a.updateSymbolizer(s,t),this._cachedRendererJson=i.toJSON());const l=await a.symbolize({bandIds:o,...e},t);r={extent:e.extent,pixelBlock:l}}else r={extent:e.extent,pixelBlock:s.symbolize({bandIds:o,...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)).operations.supportsComputeAngles)throw new a("imagery-layer:compute-angles","this operation is not supported on the input image service");return e=f(fe,e).clone(),W(this.url,e,this._getRequestOptions(t))}async computePixelSpaceLocations(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsComputePixelLocation)throw new a("imagery-layer:compute-pixel-space-locations","this operation is not supported on the input image service");return e=f(Se,e).clone(),$(this.url,e,this._getRequestOptions(t))}async computeHistograms(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsComputeHistograms)throw new a("imagery-layer:compute-histograms","this operation is not supported on the input image service");return e=f(be,e).clone(),this._applyMosaicAndRenderingRules(e),X(this.url,e,this._getRequestOptions(t))}async computeStatisticsHistograms(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsComputeStatisticsHistograms)throw new a("imagery-layer:compute-statistics-histograms","this operation is not supported on the input image service");return e=f(be,e).clone(),this._applyMosaicAndRenderingRules(e),K(this.url,e,this._getRequestOptions(t))}async measureHeight(e,t){const r=await this._fetchCapabilities(t?.signal);if(!("base-and-top"===e.operationType?r.mensuration.supportsHeightFromBaseAndTop:"base-and-top-shadow"===e.operationType?r.mensuration.supportsHeightFromBaseAndTopShadow:r.mensuration.supportsHeightFromTopAndTopShadow))throw new a("imagery-layer:measure-height","this operation is not supported on the input image service");return e=f(Re,e).clone(),this._applyMosaicAndRenderingRules(e),Y(this.url,e,this._getRequestOptions(t))}async measureAreaAndPerimeter(e,t){const r=await this._fetchCapabilities(t?.signal);if(!(r.mensuration.supportsAreaAndPerimeter&&(!e.is3D||r.mensuration.supports3D)))throw new a("imagery-layer:measure-area-and-perimeter","this operation is not supported on the input image service");return e=f(ye,e).clone(),this._applyMosaicAndRenderingRules(e),Z(this.url,e,this._getRequestOptions(t))}async measureDistanceAndAngle(e,t){const r=await this._fetchCapabilities(t?.signal);if(!(r.mensuration.supportsDistanceAndAngle&&(!e.is3D||r.mensuration.supports3D)))throw new a("imagery-layer:measure-distance-and-angle","this operation is not supported on the input image service");return e=f(ge,e).clone(),this._applyMosaicAndRenderingRules(e),ee(this.url,e,this._getRequestOptions(t))}async measurePointOrCentroid(e,t){const r=await this._fetchCapabilities(t?.signal);if(!(r.mensuration.supportsPointOrCentroid&&(!e.is3D||r.mensuration.supports3D)))throw new a("imagery-layer:measure-point-or-centroid","this operation is not supported on the input image service");return e=f(xe,e).clone(),this._applyMosaicAndRenderingRules(e),te(this.url,e,this._getRequestOptions(t))}getField(e){const{fieldsIndex:t}=this;return null!=t?t.get(e):void 0}getFieldDomain(e,t){const r=this.getField(e);return r?r.domain:null}async fetchImage(e,t,r,i={}){if(null==e||null==t||null==r)throw new a("imagery-layer:fetch-image","Insufficient parameters for requesting an image. A valid extent, width and height values are required.");if(this.renderer||this.symbolizer){const e=await this._generateRasterInfo(this.rasterFunction,{signal:i.signal});e&&(this.rasterInfo=e)}const s=this.getExportImageServiceParameters(e,t,r,i.timeExtent);if(null==s){if(i.requestAsImageElement&&this._canRequestImageElement(this.format)){const e=document.createElement("canvas");if(e.width=t,e.height=r,i.returnImageBitmap){return{imageBitmap:await F(e,`${Pe(this.parsedUrl)}/exportImage`,i.signal)}}return{imageOrCanvasElement:e}}const{bandIds:s,rasterInfo:n}=this,o=(s?.length||n.bandCount)??0,a=t*r,l=n.pixelType,u=[];for(let e=0;e<o;e++)u.push(O.createEmptyBand(l,a));return{pixelData:{pixelBlock:new O({width:t,height:r,pixels:u,mask:new Uint8Array(a),pixelType:l}),extent:e}}}const n=!!i.requestAsImageElement&&!this.pixelFilter,o=n&&!!i.returnImageBitmap,l={imageServiceParameters:s,imageProps:{extent:e,width:t,height:r,format:this.format},requestAsImageElement:n,returnImageBitmap:o,signal:i.signal};return this._requestArrayBuffer(l)}fetchKeyProperties(e){return n(Pe(this.parsedUrl)+"/keyProperties",{query:this._getQueryParams({renderingRule:this.version>=10.3?e?.rasterFunction:null})}).then((e=>e.data))}fetchRasterAttributeTable(e){return this.version<10.1?Promise.reject(new a("#fetchRasterAttributeTable()","Failed to get rasterAttributeTable")):n(Pe(this.parsedUrl)+"/rasterAttributeTable",{query:this._getQueryParams({renderingRule:this.version>=10.3?e?.rasterFunction:null})}).then((e=>le.fromJSON(e.data)))}getCatalogItemRasterInfo(e,t){const r={...t,query:this._getQueryParams()};return he(Pe(this.parsedUrl),e,r)}async getCatalogItemICSInfo(e,t){const{data:r}=await n(Pe(this.parsedUrl)+"/"+e+"/info/ics",{query:this._getQueryParams(),...t}),i=r&&r.ics;if(!i)return;let s=null;try{s=(await n(Pe(this.parsedUrl)+"/"+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(Pe(this.parsedUrl)+"/"+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(Pe(this.parsedUrl)+"/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(Pe(this.parsedUrl)+"/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 b=oe.fromJSON(g[1]&&g[1].geometries&&g[1].geometries[0]);b&&(b.spatialReference=new _e({wkid:0,imageCoordinateSystem:i}));const v=g[2].geometries?g[2].geometries.filter((e=>null!=e&&null!=e.x&&null!=e.y&&"NaN"!==e.x&&"NaN"!==e.y)):[],S=v.length;if(S<3)return{ics:i,icsToPixelTransform:R,icsExtent:b,northDirection:null};let x=0,I=0,w=0,_=0;for(let n=0;n<S;n++)x+=v[n].x,I+=v[n].y,w+=v[n].x*v[n].x,_+=v[n].x*v[n].y;const F=(S*_-x*I)/(S*w-x*x);let D=0;const j=v[p-1].x>v[0].x,P=v[p-1].y>v[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:b,northDirection:D}}async generateRasterInfo(e,t){if(e=f(M,e),this.serviceRasterInfo&&(!e||"none"===e.functionName?.toLowerCase()||this._isVectorFieldResampleFunction(e)))return this.serviceRasterInfo;const r=je(e);if(!r)throw new a("imagery-layer:generate-raster-info","the rendering rule is not supported");if(this._functionRasterInfos[r])return this._functionRasterInfos[r];const i={...t,query:this._getQueryParams()},s=me(Pe(this.parsedUrl),e,i);this._functionRasterInfos[r]=s;try{return await s}catch(n){throw this._functionRasterInfos[r]=null,n}}getExportImageServiceParameters(e,t,r,i){e=e.clone().shiftCentralMeridian();const s=re(e.spatialReference,Pe(this.parsedUrl));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.rasterFunction?.rasterFunctionDefinition,p=!this.renderer||"raster-stretch"===this.renderer.type;if(o?.length&&this._hasRasterFunction(this.rasterFunction)&&!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._processMultidimensionalIntersection(null,i,this.exportImageServiceParameters.mosaicRule);if(c.isOutSide)return null;n.mosaicRule=null!=c.mosaicRule?JSON.stringify(c.mosaicRule):null,i=c.timeExtent,n.renderingRule=this._getRenderingRuleString(M.fromJSON(l));const m={};if(null!=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){const r=await this._fetchCapabilities(t?.signal);if(!r?.operations.supportsGetSamples)throw new a("imagery-layer:get-samples","getSamples operation is not supported on the input image service");e=f(Ie,e).clone();const{raster:i}=this;return i&&null==e.raster&&(e.raster=i),ie(this.url,e,this._getRequestOptions(t))}async identify(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsIdentify)throw new a("imagery-layer:identify","identify operation is not supported on the input image service");e=f(ve,e).clone();const r=this._processMultidimensionalIntersection(e.geometry,e.timeExtent,e.mosaicRule||this.mosaicRule);if(r.isOutSide)throw new a("imagery-layer:identify","the request cannot be fulfilled when falling outside of the multidimensional subset");e.timeExtent=r.timeExtent,e.mosaicRule=r.mosaicRule;const{raster:i,rasterFunction:s}=this;return s&&null==e.rasterFunction&&(e.rasterFunction=s),i&&null==e.raster&&(e.raster=i),se(this.url,e,this._getRequestOptions(t))}createQuery(){const e=new ue;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)),ne(this.url,e,t)}async queryObjectIds(e,t){return({query:e,requestOptions:t}=await this._prepareForQuery(e,t)),ce(this.url,e,t)}async queryRasterCount(e,t){return({query:e,requestOptions:t}=await this._prepareForQuery(e,t)),pe(this.url,e,t)}async queryVisibleRasters(e,t){if(!e)throw new a("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 o=!1,l=null,u=null;const p="raster.servicepixelvalue",c=this._rasterFunctionNamesIndex;if(null!=e.outFields&&(o=e.outFields.some((e=>!e.toLowerCase().includes(p))),this.version>=10.4)){const t=e.outFields.filter((e=>e.toLowerCase().includes(p)&&e.length>p.length)).map((e=>{const t=e.slice(p.length+1);return[this._updateRenderingRulesFunctionName(t,c),t]}));l=t.map((e=>new M({functionName:e[0]}))),u=t.map((e=>e[1]));const{rasterFunction:r}=this;0===l.length?r?.functionName?(l.push(r),u.push(r.functionName)):l=null:r?.functionName&&!l.some((e=>e.functionName===r.functionName))&&(l.push(r),u.push(r.functionName))}const m=null==e.outSpatialReference||e.outSpatialReference.equals(this.spatialReference),{multidimensionalSubset:d}=this;let h=e.timeExtent||this.timeExtent;if(d){const{isOutside:t,intersection:r}=q(d,{geometry:e.geometry,timeExtent:e.timeExtent,multidimensionalDefinition:this.exportImageServiceParameters.mosaicRule?.multidimensionalDefinition});if(t)throw new a("imagery-layer:query-visible-rasters","the request cannot be fulfilled when falling outside of the multidimensional subset");r&&null!=r.timeExtent&&(h=r.timeExtent)}const f=this._combineMosaicRuleWithTimeExtent(this.exportImageServiceParameters.mosaicRule,h),y=this._getQueryParams({geometry:e.geometry,timeExtent:h,mosaicRule:f,rasterFunction:this.version<10.4?this.rasterFunction:null,rasterFunctions:l,pixelSize:r,returnCatalogItems:o,returnGeometry:m,raster:this.raster,maxItemCount:s?1:null});delete y.f;const g=new ve(y);try{await this._generateRasterInfo(this.rasterFunction);const r=await se(this.url,g,{signal:t?.signal,query:{...this.customParameters}}),s=e.outFields,a=null!=r.value&&r.value.toLowerCase().includes("nodata");if(!(o&&!m&&r?.catalogItems?.features.length&&(n||!a)))return this._processVisibleRastersResponse(r,{returnDomainValues:i,templateRRFunctionNames:u,showNoDataRecords:n,templateFields:s});const l=this.objectIdField||"ObjectId",p=r.catalogItems?.features??[],c=p.map((e=>e.attributes?.[l])),d=new ue({objectIds:c,returnGeometry:!0,outSpatialReference:e.outSpatialReference,outFields:[l]}),h=await this.queryRasters(d);return h?.features?.length&&h.features.forEach((t=>{p.forEach((r=>{r.attributes[l]===t.attributes[l]&&(r.geometry=new ae(t.geometry),null!=e.outSpatialReference&&(r.geometry.spatialReference=e.outSpatialReference))}))})),this._processVisibleRastersResponse(r,{returnDomainValues:i,templateRRFunctionNames:u,showNoDataRecords:n,templateFields:s})}catch{throw new a("imagery-layer:query-visible-rasters","encountered error when querying visible rasters")}}async fetchVariableStatisticsHistograms(e,t){const r=n(Pe(this.parsedUrl)+"/statistics",{query:this._getQueryParams({variable:e}),signal:t}).then((e=>e.data?.statistics)),i=n(Pe(this.parsedUrl)+"/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):we(e.meshType,e.simulationSettings,e.flowData,null!=t.signal?t.signal:(new AbortController).signal)}getMultidimensionalSubsetVariables(e){const t=e??this.serviceRasterInfo.multidimensionalInfo;return E(this.multidimensionalSubset,t)}async _fetchService(e){await this._fetchServiceInfo(e),this.rasterInfo||(this.rasterInfo=this.serviceRasterInfo);const t=this.sourceJSON,r=null!=this.serviceRasterInfo?Promise.resolve(this.serviceRasterInfo):de(Pe(this.parsedUrl),t,{signal:e,query:this._getQueryParams()}).then((e=>(this._set("serviceRasterInfo",e),this._set("multidimensionalInfo",e.multidimensionalInfo),e))),i=this._hasRasterFunction(this.rasterFunction)?this._generateRasterInfo(this.rasterFunction,{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).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([p((()=>this.rasterFunction),(e=>{(this.renderer||this.symbolizer||this.popupEnabled&&this.popupTemplate)&&this._generateRasterInfo(e).then((e=>{e&&(this.rasterInfo=e)}))}))]);const{serviceRasterInfo:t}=this;null!=t.multidimensionalInfo&&this._updateMultidimensionalDefinition(t)}))}_combineMosaicRuleWithTimeExtent(e,t){const r=this.timeInfo,{multidimensionalInfo:i}=this.serviceRasterInfo;if(null==e||null==i||null==t||null==r?.startField)return e;const{startField:s}=r,n=i.variables.some((e=>e.dimensions.some((e=>e.name===s))))?s:"StdTime";if(e=e.clone(),"mosaic-dataset"===this.sourceType)return e.multidimensionalDefinition=e.multidimensionalDefinition?.filter((e=>e.dimensionName!==n)),this._cleanupMultidimensionalDefinition(e);e.multidimensionalDefinition=e.multidimensionalDefinition||[];const o=e.multidimensionalDefinition.filter((e=>e.dimensionName===n)),a=null!=t.start?t.start.getTime():null,l=null!=t.end?t.end.getTime():null,u=null==a||null==l||a===l,p=u?[a||l]:[[a,l]],c=this.version>=10.8;if(o.length)o.forEach((e=>{e.dimensionName===n&&(c?(e.dimensionName=null,e.isSlice=!1,e.values=[]):(e.isSlice=u,e.values=p))}));else if(!c){const t=e.multidimensionalDefinition.filter((e=>null!=e.variableName&&null==e.dimensionName));t.length?t.forEach((e=>{e.dimensionName=n,e.isSlice=u,e.values=p})):e.multidimensionalDefinition.push(new x({variableName:"",dimensionName:n,isSlice:u,values:p}))}return this._cleanupMultidimensionalDefinition(e)}_cleanupMultidimensionalDefinition(e){return null==e?null:(e.multidimensionalDefinition&&(e.multidimensionalDefinition=e.multidimensionalDefinition.filter((e=>!(!e.variableName&&!e.dimensionName))),0===e.multidimensionalDefinition.length&&(e.multidimensionalDefinition=null)),"mosaic-dataset"!==this.sourceType&&null==e.multidimensionalDefinition?null:e)}async _prepareForQuery(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsQuery)throw new a("imagery-layer:query-rasters","query operation is not supported on the input image service");return e=null!=e?f(ue,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 J;this._rasterJobHandler.connectionPromise=e.initialize().then((()=>{this._rasterJobHandler.instance=e}),(()=>{})),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,rasterFunction:r}=this;return"unique-value"===e.type&&this._hasRasterFunction(r)&&1===t?.bandCount&&["u8","s8"].includes(t.pixelType)||null!=t&&null!=e&&U(t).includes(e.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(Pe(this.parsedUrl),{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 a("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.fields?.length>1);return t||r}_isVectorFieldResampleFunction(e){if(null==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){const t=this._isPicture(),{rasterInfo:r}=this;if(!t&&!this.pixelFilter||this._isVectorDataSet()){if(!this.bandIds&&r.bandCount>=3){const e=z(r);!e||3===r.bandCount&&0===e[0]&&1===e[1]&&2===e[2]||(this.bandIds=e)}e||(e=B(r,{bandIds:this.bandIds,variableName:this.rasterFunction?null:this.mosaicRule?.multidimensionalDefinition?.[0].variableName}));const t=k(e.toJSON());this.symbolizer?(this.symbolizer.rendererJSON=t,this.symbolizer.rasterInfo=r):this.symbolizer=new G({rendererJSON:t,rasterInfo:r}),this.symbolizer.bind().success||(this.symbolizer=null)}return e}_clonePixelData(e){return null==e?e:{extent:e.extent&&e.extent.clone(),pixelBlock:null!=e.pixelBlock?e.pixelBlock.clone():null}}_getQueryParams(e){e&&null!=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}):H(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;const r=await n(Pe(this.parsedUrl)+"/rasterFunctionInfos",{query:this._getQueryParams(),signal:e});return r.data?.rasterFunctionInfos}return null}_canRequestImageElement(e){return!this.pixelFilter&&(!e||e.includes("png"))}async _requestArrayBuffer(e){const{imageProps:t,requestAsImageElement:r,returnImageBitmap:i,signal:s}=e;if(r&&this._canRequestImageElement(t.format)){const r=`${Pe(this.parsedUrl)}/exportImage`,{data:o}=await n(r,{responseType:i?"blob":"image",query:this._getQueryParams({f:"image",...this.refreshParameters,...e.imageServiceParameters}),signal:s});if(o instanceof Blob){return{imageBitmap:await F(o,r,s),params:t}}return{imageOrCanvasElement:o,params:t}}const o=this._initJobHandler(),l=n(Pe(this.parsedUrl)+"/exportImage",{responseType:"array-buffer",query:this._getQueryParams({f:"image",...e.imageServiceParameters}),signal:s}),u=(await Promise.all([l,o]))[0].data,p=t.format||"jpgpng";let c=p;if("bsq"!==c&&"bip"!==c&&(c=Q(u)),!c)throw new a("imagery-layer:fetch-image","unsupported format signature "+String.fromCharCode.apply(null,new Uint8Array(u)));const m={signal:s},d="gif"===p||"bmp"===p||p.includes("png")&&("png"===c||"jpg"===c)?H(u,{useCanvas:!0,...t},m):this._decodePixelBlock(u,{width:t.width,height:t.height,planes:null,pixelType:null,noDataValue:null,format:p},m);return{pixelData:{pixelBlock:await d,extent:t.extent},params:t}}_generateRasterInfo(e,t){return this.generateRasterInfo(e,t).catch((()=>null))}_isValidCustomizedMosaicRule(e){return e&&JSON.stringify(e.toJSON())!==JSON.stringify(this.defaultMosaicRule?.toJSON())}_updateMultidimensionalDefinition(e){if(this._isValidCustomizedMosaicRule(this.mosaicRule))return;let t=V(e,{multidimensionalSubset:this.multidimensionalSubset});if(null!=t&&t.length>0){this.mosaicRule=this.mosaicRule||new j;const e=this.mosaicRule.multidimensionalDefinition;!this.sourceJSON.defaultVariableName&&this.rasterFunction&&"none"!==this.rasterFunction.functionName?.toLowerCase()&&t.forEach((e=>e.variableName="")),t=t.filter((({variableName:e,dimensionName:t})=>e&&"*"!==e||t)),!e?.length&&t.length&&(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,p=e.properties&&e.properties.Values&&e.properties.Values.map((e=>e.replaceAll(/ /gi,", ")))||[];const c=this.objectIdField||"ObjectId",m="string"==typeof i&&i.toLowerCase().includes("nodata"),d=[];if(i&&!u&&!m){const e={};e[c]=0;p=[i],u=[new t(this.fullExtent,null,e)]}if(!u)return[];let h,f,y;this._updateResponseFieldNames(u,a),m&&!n&&(u=[]);for(let t=0;t<u.length;t++){if(h=u[t],null!=i){if(f=p[t],y=this.rasterFunction&&l&&l.length>0&&s&&s.length>0&&s.includes(this.rasterFunction.functionName)?l[s.indexOf(this.rasterFunction.functionName)]:i,"nodata"===f.toLowerCase()&&!n)continue;const e="Raster.ItemPixelValue",r="Raster.ServicePixelValue";h.attributes[e]=f,h.attributes[r]=y,this._updateFeatureWithMagDirValues(h,f);const o=this.fields&&this.fields.length>0;let a=this.rasterFunction&&null!=this.serviceRasterInfo.attributeTable?o?f:i:y;this.rasterFunction||(a=o?f:i),this._updateFeatureWithRasterAttributeTableValues(h,a)}if(h.sourceLayer=h.layer=this,o&&this._updateFeatureWithDomainValues(h),s&&l&&s.length===l.length)for(let e=0;e<s.length;e++){const t="Raster.ServicePixelValue."+s[e];h.attributes[t]=l[e]}d.push(u[t])}return d}_processMultidimensionalIntersection(e,t,r){const{multidimensionalSubset:i}=this;if(!i)return{isOutSide:!1,timeExtent:t,mosaicRule:r=this._combineMosaicRuleWithTimeExtent(r,t)};if(i){const{isOutside:r,intersection:s}=q(i,{geometry:e,timeExtent:t});if(r)return{isOutSide:!0,timeExtent:null,mosaicRule:null};s&&null!=s.timeExtent&&(t=s.timeExtent)}if(null!=(r=this._combineMosaicRuleWithTimeExtent(r,t))&&r.multidimensionalDefinition){const{isOutside:e}=q(i,{multidimensionalDefinition:r.multidimensionalDefinition});if(e)return{isOutSide:!0,timeExtent:null,mosaicRule:null}}return{isOutSide:!1,timeExtent:t,mosaicRule:r}}_updateFeatureWithRasterAttributeTableValues(e,t){const r=this.rasterInfo.attributeTable||this.serviceRasterInfo.attributeTable;if(null==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 oe(0,0,0,0,this.spatialReference)});const o="esriImageServiceDataTypeVector-MagDir"===this.serviceDataType?[n.pixels[0][0],n.pixels[1][0]]:L([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;null!=r&&e.forEach((e=>{if(e&&e.attributes)for(const i of t){const t=r.get(i)?.name;t&&t!==i&&(e.attributes[i]=e.attributes[t],delete e.attributes[t])}}))}_getRenderingRuleString(e){if(e){let t=e.toJSON();return t=t.rasterFunctionDefinition??t,(t.thumbnail||t.thumbnailEx)&&(t.thumbnail=t.thumbnailEx=null),JSON.stringify(t)}return null}_hasRasterFunction(e){return null!=e&&null!=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().replaceAll(/ /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}_applyMosaicAndRenderingRules(e){const{raster:t,mosaicRule:r,rasterFunction:i}=this;i&&e instanceof be&&null==e.rasterFunction&&(e.rasterFunction=i),r&&null==e.mosaicRule&&(e.mosaicRule=r),t&&null==e.raster&&(e.raster=t)}_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"),u=t.includes("mensuration")&&a,p=null==e.mensurationCapabilities?[]:e.mensurationCapabilities.toLowerCase().split(",").map((e=>e.trim())),c=u&&p.includes("basic");return{data:{supportsAttachment:!1},operations:{supportsComputeHistograms:n,supportsExportImage:n,supportsIdentify:n,supportsMeasure:u,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,supportsAsyncConvert3D:!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,supportsQueryByAnonymous:!1,supportsQueryByOthers:!1,supportsHistoricMoment:!1,supportsFormatPBF:!1,supportsDisjointSpatialRelationship:!1,supportsCacheHint:!1,supportsSpatialAggregationStatistics:!1,supportedSpatialAggregationStatistics:{envelope:!1,centroid:!1,convexHull:!1},supportsDefaultSpatialReference:!!i?.supportsDefaultSR,supportsFullTextSearch:!1,supportsCompactGeometry:!1,standardMaxRecordCount:void 0,tileMaxRecordCount:void 0},mensuration:{supportsDistanceAndAngle:c,supportsAreaAndPerimeter:c,supportsPointOrCentroid:c,supportsHeightFromBaseAndTop:u&&p.includes("base-top height"),supportsHeightFromBaseAndTopShadow:u&&p.includes("base-top shadow height"),supportsHeightFromTopAndTopShadow:u&&p.includes("top-top shadow height"),supports3D:u&&p.includes("3d")}}}};function Pe(e){return e?.path??""}return e([m({clonable:!1})],y.prototype,"_functionRasterInfos",void 0),e([m({clonable:!1})],y.prototype,"_rasterJobHandler",void 0),e([m({clonable:!1})],y.prototype,"_cachedRendererJson",void 0),e([m({readOnly:!0})],y.prototype,"_serviceSupportsMosaicRule",void 0),e([g("_serviceSupportsMosaicRule",["currentVersion","fields"])],y.prototype,"readServiceSupportsMosaicRule",null),e([m({readOnly:!0})],y.prototype,"_rasterAttributeTableFieldPrefix",void 0),e([m({readOnly:!0})],y.prototype,"_rasterFunctionNamesIndex",null),e([m()],y.prototype,"adjustAspectRatio",void 0),e([m({type:[h],json:{write:!0}})],y.prototype,"bandIds",void 0),e([g("bandIds")],y.prototype,"readBandIds",null),e([m({readOnly:!0,json:{read:!1}})],y.prototype,"capabilities",void 0),e([g("service","capabilities",["capabilities","currentVersion","serviceDataType"])],y.prototype,"readCapabilities",null),e([m({type:Number})],y.prototype,"compressionQuality",void 0),e([b("compressionQuality")],y.prototype,"writeCompressionQuality",null),e([m({type:Number})],y.prototype,"compressionTolerance",void 0),e([b("compressionTolerance")],y.prototype,"writeCompressionTolerance",null),e([m({json:{read:{source:"copyrightText"}}})],y.prototype,"copyright",void 0),e([m({readOnly:!0,dependsOn:["_serviceSupportsMosaicRule"]})],y.prototype,"defaultMosaicRule",void 0),e([g("defaultMosaicRule",["defaultMosaicMethod"])],y.prototype,"readDefaultMosaicRule",null),e([m({type:String,json:{name:"layerDefinition.definitionExpression",write:{enabled:!0,allowNull:!0}}})],y.prototype,"definitionExpression",void 0),e([m({readOnly:!0,constructOnly:!0})],y.prototype,"exportImageServiceParameters",void 0),e([m()],y.prototype,"rasterInfo",void 0),e([m({readOnly:!0,type:[w]})],y.prototype,"fields",void 0),e([m({readOnly:!0})],y.prototype,"fieldsIndex",null),e([m({type:["png","png8","png24","png32","jpg","bmp","gif","jpgpng","lerc","tiff"],json:{write:!0}})],y.prototype,"format",null),e([g("service","format",["serviceDataType"])],y.prototype,"readFormat",null),e([m({type:oe})],y.prototype,"fullExtent",void 0),e([m({readOnly:!0})],y.prototype,"hasMultidimensions",void 0),e([m({json:{read:{source:"maxImageHeight"}}})],y.prototype,"imageMaxHeight",void 0),e([m({json:{read:{source:"maxImageWidth"}}})],y.prototype,"imageMaxWidth",void 0),e([m({type:String,json:{type:T.jsonValues,read:T.read,write:T.write}})],y.prototype,"interpolation",void 0),e([m()],y.prototype,"minScale",void 0),e([g("service","minScale")],y.prototype,"readMinScale",null),e([m()],y.prototype,"maxScale",void 0),e([g("service","maxScale")],y.prototype,"readMaxScale",null),e([m({type:j})],y.prototype,"mosaicRule",null),e([g("mosaicRule",["mosaicRule","defaultMosaicMethod"])],y.prototype,"readMosaicRule",null),e([b("mosaicRule")],y.prototype,"writeMosaicRule",null),e([m()],y.prototype,"multidimensionalInfo",void 0),e([m({type:P,json:{write:!0}})],y.prototype,"multidimensionalSubset",void 0),e([m({json:{type:h}})],y.prototype,"noData",void 0),e([b("noData")],y.prototype,"writeNoData",null),e([m({type:String,json:{type:C.jsonValues,read:C.read,write:C.write}})],y.prototype,"noDataInterpretation",void 0),e([m({type:String,readOnly:!0,json:{read:{source:["fields"]}}})],y.prototype,"objectIdField",void 0),e([g("objectIdField")],y.prototype,"readObjectIdField",null),e([m({readOnly:!0})],y.prototype,"geometryType",void 0),e([m({})],y.prototype,"typeIdField",void 0),e([m({})],y.prototype,"types",void 0),e([m({readOnly:!0})],y.prototype,"parsedUrl",null),e([m({type:Function})],y.prototype,"pixelFilter",void 0),e([m()],y.prototype,"raster",void 0),e([m({readOnly:!0})],y.prototype,"sourceType",void 0),e([g("sourceType",["serviceSourceType","fields"])],y.prototype,"readSourceType",null),e([m()],y.prototype,"viewId",void 0),e([m({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})}}}}})],y.prototype,"renderer",null),e([g("renderer")],y.prototype,"readRenderer",null),e([b("renderer")],y.prototype,"writeRenderer",null),e([m({clonable:!1})],y.prototype,"symbolizer",void 0),e([m(v)],y.prototype,"opacity",void 0),e([m({readOnly:!0})],y.prototype,"rasterFields",null),e([m({constructOnly:!0})],y.prototype,"rasterFunctionInfos",void 0),e([m({type:M})],y.prototype,"renderingRule",null),e([m({type:M,json:{name:"renderingRule"}})],y.prototype,"rasterFunction",null),e([g("rasterFunction",["renderingRule","rasterFunctionInfos"])],y.prototype,"readRasterFunction",null),e([m({readOnly:!0})],y.prototype,"serviceDataType",void 0),e([m({readOnly:!0,type:_e})],y.prototype,"spatialReference",void 0),e([g("spatialReference",["spatialReference","extent"])],y.prototype,"readSpatialReference",null),e([m({json:{type:N.jsonValues}})],y.prototype,"pixelType",void 0),e([g("pixelType")],y.prototype,"readPixelType",null),e([b("pixelType")],y.prototype,"writePixelType",null),e([m({constructOnly:!0,type:A})],y.prototype,"serviceRasterInfo",void 0),e([m()],y.prototype,"sourceJSON",void 0),e([m(S)],y.prototype,"url",void 0),e([m({readOnly:!0})],y.prototype,"version",void 0),e([g("version",["currentVersion","fields","timeInfo"])],y.prototype,"readVersion",null),y=e([R("esri.layers.mixins.ArcGISImageService")],y),y};export{Pe as ArcGISImageService};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.28/esri/copyright.txt for details.
4
4
  */
5
- import{_ as t}from"../../chunks/tslib.es6.js";import"../../geometry.js";import{rasterRendererTypes as e,websceneRasterRendererTypes as r,read as i}from"../../rasterRenderers.js";import n from"../../request.js";import s from"../../core/Error.js";import o from"../../core/Logger.js";import{property as a}from"../../core/accessorSupport/decorators/property.js";import{ensureClass as l}from"../../core/accessorSupport/ensureType.js";import"../../core/arrayUtils.js";import"../../core/has.js";import{reader as u}from"../../core/accessorSupport/decorators/reader.js";import{subclass as c}from"../../core/accessorSupport/decorators/subclass.js";import{getInfo as d}from"../../geometry/support/spatialReferenceUtils.js";import{sanitizeUrl as m}from"../support/arcgisLayerUrl.js";import{url as h}from"../support/commonProperties.js";import p from"../support/DimensionalDefinition.js";import f from"../support/MultidimensionalSubset.js";import y from"../support/RasterFunction.js";import b from"../support/RasterJobHandler.js";import g from"../support/TileInfo.js";import F from"../support/rasterDatasets/FunctionRaster.js";import{getDefaultMultidimensionalDefinition as J,hasExcludedVariableOrDimension as R,getDefaultVariablInfo as _,isMultiSliceOrRangeDefinition as I,getSubsetVariablesFromMdInfo as S}from"../support/rasterDatasets/multidimensionalUtils.js";import{snapToRaster as x,clip as w}from"../support/rasterFunctions/clipUtils.js";import{create as v}from"../support/rasterFunctions/rasterFunctionHelper.js";import{load as j,projectExtent as D,projectPolygon as H}from"../support/rasterFunctions/rasterProjectionHelper.js";import{computeStatisticsHistograms as T}from"../support/rasterFunctions/stretchUtils.js";import{convertVectorFieldData as N}from"../support/rasterFunctions/vectorFieldUtils.js";import{normalizeRendererJSON as O,getVariableRasterInfo as z,getDefaultInterpolation as P,getDefaultBandCombination as C,createDefaultRenderer as E}from"../../renderers/support/rasterRendererHelper.js";import A from"../../renderers/support/RasterSymbolizer.js";import M from"../../rest/support/ImageHistogramParameters.js";import{createFlowMesh as U}from"../../views/2d/engine/flow/dataUtils.js";import k from"../../geometry/SpatialReference.js";import q from"../../geometry/Point.js";const B=o.getLogger("esri.layers.mixins.ImageryTileMixin"),V=o=>{let V=class extends o{constructor(...t){super(...t),this._isConstructedFromFunctionRaster=!1,this._rasterJobHandler={instance:null,refCount:0,connectionPromise:null},this.bandIds=null,this.copyright=null,this.interpolation="nearest",this.multidimensionalSubset=null,this.raster=null,this.rasterInfo=null,this.sourceJSON=null,this.spatialReference=null,this.symbolizer=null,this._isConstructedFromFunctionRaster="Function"===t[0]?.raster?.datasetFormat}get fullExtent(){return this.rasterInfo?.extent}set multidimensionalDefinition(t){this._set("multidimensionalDefinition",t),this.updateRenderer()}set rasterFunction(t){"none"===t?.functionName?.toLowerCase()&&(t=void 0),this._set("rasterFunction",t),this.updateRasterFunction()}set url(t){this._set("url",m(t,B))}set renderer(t){null==t&&null==this.rasterFunction?this._configDefaultRenderer("override"):(this._set("renderer",t),this.updateRenderer())}readRenderer(t,e,r){const n=e?.layerDefinition?.drawingInfo?.renderer;return i(n,r)||void 0}async convertVectorFieldData(t,e){if(null==t||!this.rasterInfo)return null;const r=this._rasterJobHandler.instance,i=this.rasterInfo.dataType;return r?r.convertVectorFieldData({pixelBlock:t,dataType:i},e):N(t,i)}async computeStatisticsHistograms(t,e){t=l(M,t).clone();const{rasterInfo:r}=this,{geometry:i}=t;if(null==i)throw new s("imagery-tile-mixin:compute-statistics-histograms","geometry must be specified");let n=i;const{spatialReference:o}=r;i.spatialReference.equals(o)||(await j(),n="extent"===i.type?D(i,o):H(i,o));const a=t.pixelSize??new q({x:r.pixelSize.x,y:r.pixelSize.y,spatialReference:o}),{extent:u,width:c,height:d}=x(r,n,a),m=await this.fetchPixels(u,c,d,{...e,interpolation:"nearest"});if(null==m.pixelBlock)throw new s("imagery-tile-mixin:compute-statistics-histograms","failed to fetch pixels");const h=await w(m.pixelBlock,u,n),p=this._rasterJobHandler.instance;return p?p.computeStatisticsHistograms({pixelBlock:h},e):T(h)}async createFlowMesh(t,e){const r=this._rasterJobHandler.instance;return r?r.createFlowMesh(t,e):U(t.meshType,t.simulationSettings,t.flowData,null!=e.signal?e.signal:(new AbortController).signal)}normalizeRasterFetchOptions(t){const{multidimensionalInfo:e}=this.rasterInfo??{};if(null==e)return t;let r=t.multidimensionalDefinition||this.multidimensionalDefinition;null!=r&&r.length||(r=J(this.raster.rasterInfo,{multidimensionalSubset:this.multidimensionalSubset}));const i=t.timeExtent||this.timeExtent;if(null!=r&&null!=i&&(null!=i.start||null!=i.end)){r=r.map((t=>t.clone()));const n=e.variables.find((({name:t})=>t===r[0].variableName))?.dimensions?.find((({name:t})=>"StdTime"===t)),s=r.find((({dimensionName:t})=>"StdTime"===t));if(!n||!s)return{...t,multidimensionalDefinition:null};const{start:o,end:a}=i,l=null==o?null:o.getTime(),u=null==a?null:a.getTime(),c=l??u,d=u??l;if(null!=n.values){const t=n.values.filter((t=>{if(Array.isArray(t)){if(c===d)return t[0]<=c&&t[1]>=c;const e=t[0]<=c&&t[1]>c||t[0]<d&&t[1]>=d,r=t[0]>=c&&t[1]<=d||t[0]<c&&t[1]>d;return e||r}return c===d?t===c:t>=c&&t<=d}));if(t.length){const e=t.sort(((t,e)=>{const r=Array.isArray(t)?t[0]:t,i=Array.isArray(t)?t[1]:t,n=Array.isArray(e)?e[0]:e,s=Array.isArray(e)?e[1]:e;if(c===d)return r-n;return Math.abs(i-d)-Math.abs(s-d)}))[0];s.values=[e]}else r=null}else if(n.hasRegularIntervals&&n.extent){const[t,e]=n.extent;c>e||d<t?r=null:s.values=c===d?[c]:[Math.max(t,c),Math.min(e,d)]}}return null!=r&&R(r,this.multidimensionalSubset)?{...t,multidimensionalDefinition:null}:{...t,multidimensionalDefinition:r}}async updateRasterFunction(){if(!this.loaded||"imagery-tile"!==this.type||!this.rasterFunction&&!this._cachedRasterFunctionJson||JSON.stringify(this.rasterFunction)===JSON.stringify(this._cachedRasterFunctionJson))return;if(this._isConstructedFromFunctionRaster&&"Function"===this.raster.datasetFormat){const t=this.raster.rasterFunction.toJSON();return!this.rasterFunction&&t&&this._set("rasterFunction",y.fromJSON(t)),void(this._cachedRasterFunctionJson=this.rasterFunction?.toJSON())}let t,e=this.raster,r=!1;"Function"===e.datasetFormat?(t=e.primaryRasters.rasters,e=t[0],r=!0):t=[e];const{rasterFunction:i}=this;if(i){const r={raster:e};t.length>1&&t.forEach((t=>r[t.url]=t));const n=v(i.functionDefinition?.toJSON()??i.toJSON(),r),s=new F({rasterFunction:n});s.rasterJobHandler=this._rasterJobHandler.instance,await s.open(),this._cachedRasterFunctionJson=this.rasterFunction?.toJSON(),this.raster=s}else this.raster=e,this._cachedRasterFunctionJson=null,await e.when();if(this._cachedRendererJson=null,!r&&!i)return;const{bandIds:n}=this,{bandCount:s}=this.raster.rasterInfo,o=n?.length?n.some((t=>t>=s)):s>=3;n&&(o||this.renderer&&"raster-stretch"!==this.renderer.type)&&this._set("bandIds",null),this._configDefaultRenderer("auto")}async updateRenderer(){const{loaded:t,symbolizer:e}=this;if(!t||!e||!this.renderer)return;const{rasterInfo:r}=this.raster,i=_(r,{multidimensionalDefinition:this.multidimensionalDefinition,multidimensionalSubset:this.multidimensionalSubset}),n=i?.name,s=O({...this.renderer.toJSON(),variableName:n});if(JSON.stringify(this._cachedRendererJson)===JSON.stringify(s))return;const o=this._rasterJobHandler.instance;o&&(e.rasterInfo=z(r,n),e.rendererJSON=s,e.bind(),await o.updateSymbolizer(e),this._cachedRendererJson=s)}async applyRenderer(t,e){const r=t&&t.pixelBlock;if(!(null!=r&&r.pixels&&r.pixels.length>0))return null;let i;await this.updateRenderer();const n=this._rasterJobHandler.instance,s=this.bandIds??[];return i=n?await n.symbolize({...t,simpleStretchParams:e,bandIds:s}):this.symbolizer.symbolize({...t,simpleStretchParams:e,bandIds:s}),i}getTileUrl(t,e,r){return"RasterTileServer"===this.raster.datasetFormat?`${this.url}/tile/${t}/${e}/${r}`:""}getCompatibleTileInfo(t,e,r=!1){if(!this.loaded||null==e)return null;if(r&&t.equals(this.spatialReference))return this.tileInfo;const i=d(t);return g.create({size:256,spatialReference:t,origin:i?{x:i.origin[0],y:i.origin[1]}:{x:e.xmin,y:e.ymax}})}getCompatibleFullExtent(t){return this.loaded?(this._compatibleFullExtent&&this._compatibleFullExtent.spatialReference.equals(t)||(this._compatibleFullExtent=this.raster.computeExtent(t)),this._compatibleFullExtent):null}async fetchTile(t,e,r,i={}){if(L(this),i.requestAsImageElement){const s=this.getTileUrl(t,e,r);return n(s,{responseType:"image",query:{...this.refreshParameters,...this.raster.ioConfig.customFetchParameters},signal:i.signal}).then((t=>t.data))}const{rasterInfo:s}=this;if(null!=s.multidimensionalInfo&&null==(i=this.normalizeRasterFetchOptions(i)).multidimensionalDefinition){const n=i.tileInfo||s.storageInfo.tileInfo;return{extent:this.raster.getTileExtentFromTileInfo(t,e,r,n),pixelBlock:null}}return await this._initJobHandler(),await this.updateRasterFunction(),"raster-shaded-relief"===this.renderer?.type&&(i={...i,buffer:{cols:1,rows:1}}),this.raster.fetchTile(t,e,r,i)}async fetchPixels(t,e,r,i={}){return null!=this.rasterInfo.multidimensionalInfo&&null==(i=this.normalizeRasterFetchOptions(i)).multidimensionalDefinition?{extent:t,pixelBlock:null}:(await this._initJobHandler(),await this.updateRasterFunction(),e=Math.round(e),r=Math.round(r),this.raster.fetchPixels(t,e,r,i))}async identify(t,e={}){const{raster:r,rasterInfo:i}=this;if(null!=i.multidimensionalInfo){if(!(i.hasMultidimensionalTranspose&&!!(I(e.multidimensionalDefinition)||e.transposedVariableName||e.timeExtent))&&null==(e=this.normalizeRasterFetchOptions(e)).multidimensionalDefinition)return{location:t,value:null}}const n=this.multidimensionalSubset?.areaOfInterest;if(n&&!n.contains(t))throw new s("imagery-tile-mixin:identify","the request cannot be fulfilled when falling outside of the multidimensional subset");return r.identify(t,e)}increaseRasterJobHandlerUsage(){this._rasterJobHandler.refCount++}decreaseRasterJobHandlerUsage(){this._rasterJobHandler.refCount--,this._rasterJobHandler.refCount<=0&&this._shutdownJobHandler()}hasStandardTime(){const t=this.rasterInfo?.multidimensionalInfo;if(null==t||"standard-time"!==this.rasterInfo?.dataType)return!1;const e=this.multidimensionalDefinition,r=e?.[0]?.variableName;return t.variables.some((t=>t.name===r&&(!e?.[0].dimensionName||t.dimensions.some((t=>"StdTime"===t.name)))))}getStandardTimeValue(t){return new Date(24*(t-25569)*3600*1e3).toString()}getMultidimensionalSubsetVariables(t){const e=t??this.rasterInfo?.multidimensionalInfo;return S(this.multidimensionalSubset,e)}_configDefaultSettings(){this._configDefaultInterpolation(),this.multidimensionalDefinition||(this.multidimensionalDefinition=J(this.raster.rasterInfo,{multidimensionalSubset:this.multidimensionalSubset})),this.rasterFunction&&"Function"===this.raster.datasetFormat&&(this._cachedRasterFunctionJson=this.rasterFunction.toJSON()),this._configDefaultRenderer()}_initJobHandler(){if(null!=this._rasterJobHandler.connectionPromise)return this._rasterJobHandler.connectionPromise;const t=new b;return this._rasterJobHandler.connectionPromise=t.initialize().then((async()=>{L(this),this._rasterJobHandler.instance=t,this.raster.rasterJobHandler=t,"Function"===this.raster.datasetFormat&&this.raster.syncJobHandler(),this.rasterFunction&&await this.updateRasterFunction().catch((()=>{})),this.renderer&&this.updateRenderer()})).catch((()=>{})),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,this.raster&&(this.raster.rasterJobHandler=null)}_configDefaultInterpolation(){if(null==this.interpolation){L(this);const{raster:t}=this,e=P(t.rasterInfo,t.tileType,this.sourceJSON?.defaultResamplingMethod);this._set("interpolation",e)}}_configDefaultRenderer(t="no"){L(this);const{rasterInfo:e}=this.raster;!this.bandIds&&e.bandCount>1&&(this.bandIds=C(e));const r=_(e,{multidimensionalDefinition:this.multidimensionalDefinition,multidimensionalSubset:this.multidimensionalSubset}),i=r?.name;if(!this.renderer||"override"===t){const t=E(e,{bandIds:this.bandIds,variableName:i}),r=e.statistics,n=r&&r.length>0?r[0]:null,s=n?.max??0,o=n?.min??0;"WCSServer"===this.raster.datasetFormat&&"raster-stretch"===t.type&&(s>1e24||o<-1e24)&&(t.dynamicRangeAdjustment=!0,t.statistics=null,"none"===t.stretchType&&(t.stretchType="min-max")),this.renderer=t}const n=O({...this.renderer.toJSON(),variableName:i}),s=z(e,i);this.symbolizer?(this.symbolizer.rendererJSON=n,this.symbolizer.rasterInfo=s):this.symbolizer=new A({rendererJSON:n,rasterInfo:s});const o=this.symbolizer.bind();if(o.success){if("auto"===t){const{colormap:t}=this.raster.rasterInfo,e=this.renderer;if(null!=t&&"raster-colormap"===e.type){const t=E(this.raster.rasterInfo);JSON.stringify(t)!==JSON.stringify(e)&&this._configDefaultRenderer("override")}else if("raster-stretch"===e.type){const t=this.bandIds?.length,r=e.statistics?.length;!e.dynamicRangeAdjustment&&r&&t&&r!==t&&this._configDefaultRenderer("override")}}}else B.warn("imagery-tile-mixin",o.error||"The given renderer is not supported by the layer."),"auto"===t&&this._configDefaultRenderer("override")}};function L(t){if(!t.raster||!t.rasterInfo)throw new s("imagery-tile","no raster")}return t([a()],V.prototype,"_cachedRendererJson",void 0),t([a()],V.prototype,"_cachedRasterFunctionJson",void 0),t([a()],V.prototype,"_compatibleFullExtent",void 0),t([a()],V.prototype,"_isConstructedFromFunctionRaster",void 0),t([a()],V.prototype,"_rasterJobHandler",void 0),t([a()],V.prototype,"bandIds",void 0),t([a({json:{origins:{service:{read:{source:"copyrightText"}}}}})],V.prototype,"copyright",void 0),t([a({json:{read:!1}})],V.prototype,"fullExtent",null),t([a()],V.prototype,"interpolation",void 0),t([a()],V.prototype,"ioConfig",void 0),t([a({type:[p],json:{write:!0}})],V.prototype,"multidimensionalDefinition",null),t([a({type:f,json:{write:!0}})],V.prototype,"multidimensionalSubset",void 0),t([a()],V.prototype,"raster",void 0),t([a({type:y,json:{name:"renderingRule",write:!0}})],V.prototype,"rasterFunction",null),t([a()],V.prototype,"rasterInfo",void 0),t([a()],V.prototype,"sourceJSON",void 0),t([a({readOnly:!0,type:k,json:{read:!1}})],V.prototype,"spatialReference",void 0),t([a({type:g})],V.prototype,"tileInfo",void 0),t([a(h)],V.prototype,"url",null),t([a({types:e,json:{name:"layerDefinition.drawingInfo.renderer",write:{overridePolicy(){const t="raster-stretch"===this.renderer?.type&&"none"===this.renderer.stretchType&&!this.renderer.useGamma;return{enabled:!this.loaded||"Raster"===this.raster.tileType||!t}}},origins:{"web-scene":{types:r,name:"layerDefinition.drawingInfo.renderer",write:{overridePolicy:t=>({enabled:t&&"vector-field"!==t.type&&"flow"!==t.type})}}}}})],V.prototype,"renderer",null),t([u("renderer")],V.prototype,"readRenderer",null),t([a()],V.prototype,"symbolizer",void 0),V=t([c("esri.layers.ImageryTileMixin")],V),V};export{V as ImageryTileMixin};
5
+ import{_ as e}from"../../chunks/tslib.es6.js";import"../../geometry.js";import{rasterRendererTypes as t,websceneRasterRendererTypes as r,read as i}from"../../rasterRenderers.js";import n from"../../request.js";import s from"../../core/Error.js";import o from"../../core/Logger.js";import{property as a}from"../../core/accessorSupport/decorators/property.js";import{ensureClass as l}from"../../core/accessorSupport/ensureType.js";import"../../core/arrayUtils.js";import"../../core/has.js";import{reader as u}from"../../core/accessorSupport/decorators/reader.js";import{subclass as c}from"../../core/accessorSupport/decorators/subclass.js";import{getInfo as d}from"../../geometry/support/spatialReferenceUtils.js";import{sanitizeUrl as m}from"../support/arcgisLayerUrl.js";import{url as h}from"../support/commonProperties.js";import p from"../support/DimensionalDefinition.js";import f from"../support/MultidimensionalSubset.js";import y from"../support/RasterFunction.js";import b from"../support/RasterJobHandler.js";import g from"../support/TileInfo.js";import F from"../support/rasterDatasets/FunctionRaster.js";import{getDefaultMultidimensionalDefinition as J,hasExcludedVariableOrDimension as R,getDefaultVariablInfo as _,isMultiSliceOrRangeDefinition as I,getSubsetVariablesFromMdInfo as S}from"../support/rasterDatasets/multidimensionalUtils.js";import{snapToRaster as x,clip as w}from"../support/rasterFunctions/clipUtils.js";import{create as v}from"../support/rasterFunctions/rasterFunctionHelper.js";import{load as j,projectExtent as D,projectPolygon as H}from"../support/rasterFunctions/rasterProjectionHelper.js";import{computeStatisticsHistograms as T}from"../support/rasterFunctions/stretchUtils.js";import{convertVectorFieldData as N}from"../support/rasterFunctions/vectorFieldUtils.js";import{normalizeRendererJSON as O,getVariableRasterInfo as z,getDefaultInterpolation as P,getDefaultBandCombination as C,createDefaultRenderer as E}from"../../renderers/support/rasterRendererHelper.js";import A from"../../renderers/support/RasterSymbolizer.js";import M from"../../rest/support/ImageHistogramParameters.js";import{createFlowMesh as U}from"../../views/2d/engine/flow/dataUtils.js";import k from"../../geometry/SpatialReference.js";import q from"../../geometry/Point.js";const B=o.getLogger("esri.layers.mixins.ImageryTileMixin"),V=o=>{let V=class extends o{constructor(...e){super(...e),this._isConstructedFromFunctionRaster=!1,this._rasterJobHandler={instance:null,refCount:0,connectionPromise:null},this.bandIds=null,this.copyright=null,this.interpolation="nearest",this.multidimensionalSubset=null,this.raster=null,this.rasterInfo=null,this.sourceJSON=null,this.spatialReference=null,this.symbolizer=null,this._isConstructedFromFunctionRaster="Function"===e[0]?.raster?.datasetFormat}get fullExtent(){return this.rasterInfo?.extent}set multidimensionalDefinition(e){this._set("multidimensionalDefinition",e),this.updateRenderer()}set rasterFunction(e){"none"===e?.functionName?.toLowerCase()&&(e=void 0),this._set("rasterFunction",e),this.updateRasterFunction()}set url(e){this._set("url",m(e,B))}set renderer(e){null==e&&null==this.rasterFunction?this._configDefaultRenderer("override"):(this._set("renderer",e),this.updateRenderer())}readRenderer(e,t,r){const n=t?.layerDefinition?.drawingInfo?.renderer;return i(n,r)||void 0}async convertVectorFieldData(e,t){if(null==e||!this.rasterInfo)return null;const r=this._rasterJobHandler.instance,i=this.rasterInfo.dataType;return r?r.convertVectorFieldData({pixelBlock:e,dataType:i},t):N(e,i)}async computeStatisticsHistograms(e,t){e=l(M,e).clone();const{rasterInfo:r}=this,{geometry:i}=e;if(null==i)throw new s("imagery-tile-mixin:compute-statistics-histograms","geometry must be specified");let n=i;const{spatialReference:o}=r;i.spatialReference.equals(o)||(await j(),n="extent"===i.type?D(i,o):H(i,o));const a=e.pixelSize??new q({x:r.pixelSize.x,y:r.pixelSize.y,spatialReference:o}),{extent:u,width:c,height:d}=x(r,n,a),m=await this.fetchPixels(u,c,d,{...t,interpolation:"nearest"});if(null==m.pixelBlock)throw new s("imagery-tile-mixin:compute-statistics-histograms","failed to fetch pixels");const h=await w(m.pixelBlock,u,n),p=this._rasterJobHandler.instance;return p?p.computeStatisticsHistograms({pixelBlock:h},t):T(h)}async createFlowMesh(e,t){const r=this._rasterJobHandler.instance;return r?r.createFlowMesh(e,t):U(e.meshType,e.simulationSettings,e.flowData,null!=t.signal?t.signal:(new AbortController).signal)}normalizeRasterFetchOptions(e){const{multidimensionalInfo:t}=this.rasterInfo??{};if(null==t)return e;let r=e.multidimensionalDefinition||this.multidimensionalDefinition;null!=r&&r.length||(r=J(this.raster.rasterInfo,{multidimensionalSubset:this.multidimensionalSubset}));const i=e.timeExtent||this.timeExtent;if(null!=r&&null!=i&&(null!=i.start||null!=i.end)){r=r.map((e=>e.clone()));const n=t.variables.find((({name:e})=>e===r[0].variableName))?.dimensions?.find((({name:e})=>"StdTime"===e)),s=r.find((({dimensionName:e})=>"StdTime"===e));if(!n||!s)return{...e,multidimensionalDefinition:null};const{start:o,end:a}=i,l=null==o?null:o.getTime(),u=null==a?null:a.getTime(),c=l??u,d=u??l;if(null!=n.values){const e=n.values.filter((e=>{if(Array.isArray(e)){if(c===d)return e[0]<=c&&e[1]>=c;const t=e[0]<=c&&e[1]>c||e[0]<d&&e[1]>=d,r=e[0]>=c&&e[1]<=d||e[0]<c&&e[1]>d;return t||r}return c===d?e===c:e>=c&&e<=d}));if(e.length){const t=e.sort(((e,t)=>{const r=Array.isArray(e)?e[0]:e,i=Array.isArray(e)?e[1]:e,n=Array.isArray(t)?t[0]:t,s=Array.isArray(t)?t[1]:t;if(c===d)return r-n;return Math.abs(i-d)-Math.abs(s-d)}))[0];s.values=[t]}else r=null}else if(n.hasRegularIntervals&&n.extent){const[e,t]=n.extent;c>t||d<e?r=null:s.values=c===d?[c]:[Math.max(e,c),Math.min(t,d)]}}return null!=r&&R(r,this.multidimensionalSubset)?{...e,multidimensionalDefinition:null}:{...e,multidimensionalDefinition:r}}async updateRasterFunction(){if(!this.loaded||"imagery-tile"!==this.type||!this.rasterFunction&&!this._cachedRasterFunctionJson||JSON.stringify(this.rasterFunction)===JSON.stringify(this._cachedRasterFunctionJson))return;if(this._isConstructedFromFunctionRaster&&"Function"===this.raster.datasetFormat){const e=this.raster.rasterFunction.toJSON();return!this.rasterFunction&&e&&this._set("rasterFunction",y.fromJSON(e)),void(this._cachedRasterFunctionJson=this.rasterFunction?.toJSON())}let e,t=this.raster,r=!1;"Function"===t.datasetFormat?(e=t.primaryRasters.rasters,t=e[0],r=!0):e=[t];const{rasterFunction:i}=this;if(i){const r={raster:t};e.length>1&&e.forEach((e=>r[e.url]=e));const n=v(i.functionDefinition?.toJSON()??i.toJSON(),r),s=new F({rasterFunction:n});s.rasterJobHandler=this._rasterJobHandler.instance,await s.open(),this._cachedRasterFunctionJson=this.rasterFunction?.toJSON(),this.raster=s}else this.raster=t,this._cachedRasterFunctionJson=null,await t.when();if(this._cachedRendererJson=null,!r&&!i)return;const{bandIds:n}=this,{bandCount:s}=this.raster.rasterInfo,o=n?.length?n.some((e=>e>=s)):s>=3;n&&(o||this.renderer&&"raster-stretch"!==this.renderer.type)&&this._set("bandIds",null),this._configDefaultRenderer("auto")}async updateRenderer(){const{loaded:e,symbolizer:t}=this;if(!e||!t||!this.renderer)return;const{rasterInfo:r}=this.raster,i=_(r,{multidimensionalDefinition:this.multidimensionalDefinition,multidimensionalSubset:this.multidimensionalSubset}),n=i?.name,s=O({...this.renderer.toJSON(),variableName:n});if(JSON.stringify(this._cachedRendererJson)===JSON.stringify(s))return;const o=this._rasterJobHandler.instance;o&&(t.rasterInfo=z(r,n),t.rendererJSON=s,t.bind(),await o.updateSymbolizer(t),this._cachedRendererJson=s)}async applyRenderer(e,t){const r=e&&e.pixelBlock;if(!(null!=r&&r.pixels&&r.pixels.length>0))return null;let i;await this.updateRenderer();const n=this._rasterJobHandler.instance,s=this.bandIds??[];return i=n?await n.symbolize({...e,simpleStretchParams:t,bandIds:s}):this.symbolizer.symbolize({...e,simpleStretchParams:t,bandIds:s}),i}getTileUrl(e,t,r){return"RasterTileServer"===this.raster.datasetFormat?`${this.url}/tile/${e}/${t}/${r}`:""}getCompatibleTileInfo(e,t,r=!1){if(!this.loaded||null==t)return null;if(r&&e.equals(this.spatialReference))return this.tileInfo;const i=d(e);return g.create({size:256,spatialReference:e,origin:i?{x:i.origin[0],y:i.origin[1]}:{x:t.xmin,y:t.ymax}})}getCompatibleFullExtent(e){return this.loaded?(this._compatibleFullExtent&&this._compatibleFullExtent.spatialReference.equals(e)||(this._compatibleFullExtent=this.raster.computeExtent(e)),this._compatibleFullExtent):null}async fetchTile(e,t,r,i={}){if(L(this),i.requestAsImageElement){const s=this.getTileUrl(e,t,r);return n(s,{responseType:"image",query:{...this.refreshParameters,...this.raster.ioConfig.customFetchParameters},signal:i.signal}).then((e=>e.data))}const{rasterInfo:s}=this;if(null!=s.multidimensionalInfo&&null==(i=this.normalizeRasterFetchOptions(i)).multidimensionalDefinition){const n=i.tileInfo||s.storageInfo.tileInfo;return{extent:this.raster.getTileExtentFromTileInfo(e,t,r,n),pixelBlock:null}}return await this._initJobHandler(),await this.updateRasterFunction(),"raster-shaded-relief"===this.renderer?.type&&(i={...i,buffer:{cols:1,rows:1}}),this.raster.fetchTile(e,t,r,i)}async fetchPixels(e,t,r,i={}){return null!=this.rasterInfo.multidimensionalInfo&&null==(i=this.normalizeRasterFetchOptions(i)).multidimensionalDefinition?{extent:e,pixelBlock:null}:(await this._initJobHandler(),await this.updateRasterFunction(),t=Math.round(t),r=Math.round(r),this.raster.fetchPixels(e,t,r,i))}async identify(e,t={}){const{raster:r,rasterInfo:i}=this;if(null!=i.multidimensionalInfo){if(!(i.hasMultidimensionalTranspose&&!!(I(t.multidimensionalDefinition)||t.transposedVariableName||t.timeExtent))&&null==(t=this.normalizeRasterFetchOptions(t)).multidimensionalDefinition)return{location:e,value:null}}const n=this.multidimensionalSubset?.areaOfInterest;if(n&&!n.contains(e))throw new s("imagery-tile-mixin:identify","the request cannot be fulfilled when falling outside of the multidimensional subset");return r.identify(e,t)}increaseRasterJobHandlerUsage(){this._rasterJobHandler.refCount++}decreaseRasterJobHandlerUsage(){this._rasterJobHandler.refCount--,this._rasterJobHandler.refCount<=0&&this._shutdownJobHandler()}hasStandardTime(){const e=this.rasterInfo?.multidimensionalInfo;if(null==e||"standard-time"!==this.rasterInfo?.dataType)return!1;const t=this.multidimensionalDefinition,r=t?.[0]?.variableName;return e.variables.some((e=>e.name===r&&(!t?.[0].dimensionName||e.dimensions.some((e=>"StdTime"===e.name)))))}getStandardTimeValue(e){return new Date(24*(e-25569)*3600*1e3).toString()}getMultidimensionalSubsetVariables(e){const t=e??this.rasterInfo?.multidimensionalInfo;return S(this.multidimensionalSubset,t)}_configDefaultSettings(){this._configDefaultInterpolation(),this.multidimensionalDefinition||(this.multidimensionalDefinition=J(this.raster.rasterInfo,{multidimensionalSubset:this.multidimensionalSubset})),this.rasterFunction&&"Function"===this.raster.datasetFormat&&(this._cachedRasterFunctionJson=this.rasterFunction.toJSON()),this._configDefaultRenderer()}_initJobHandler(){if(null!=this._rasterJobHandler.connectionPromise)return this._rasterJobHandler.connectionPromise;const e=new b;return this._rasterJobHandler.connectionPromise=e.initialize().then((async()=>{L(this),this._rasterJobHandler.instance=e,this.raster.rasterJobHandler=e,"Function"===this.raster.datasetFormat&&this.raster.syncJobHandler(),this.rasterFunction&&await this.updateRasterFunction().catch((()=>{})),this.renderer&&this.updateRenderer()})).catch((()=>{})),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,this.raster&&(this.raster.rasterJobHandler=null)}_configDefaultInterpolation(){if(null==this.interpolation){L(this);const{raster:e}=this,t=P(e.rasterInfo,e.tileType,this.sourceJSON?.defaultResamplingMethod);this._set("interpolation",t)}}_configDefaultRenderer(e="no"){L(this);const{rasterInfo:t}=this.raster;!this.bandIds&&t.bandCount>1&&(this.bandIds=C(t));const r=_(t,{multidimensionalDefinition:this.multidimensionalDefinition,multidimensionalSubset:this.multidimensionalSubset}),i=r?.name;if(!this.renderer||"override"===e){const e=E(t,{bandIds:this.bandIds,variableName:i}),r=t.statistics,n=r&&r.length>0?r[0]:null,s=n?.max??0,o=n?.min??0;"WCSServer"===this.raster.datasetFormat&&"raster-stretch"===e.type&&(s>1e24||o<-1e24)&&(e.dynamicRangeAdjustment=!0,e.statistics=null,"none"===e.stretchType&&(e.stretchType="min-max")),this.renderer=e}const n=O({...this.renderer.toJSON(),variableName:i}),s=z(t,i);this.symbolizer?(this.symbolizer.rendererJSON=n,this.symbolizer.rasterInfo=s):this.symbolizer=new A({rendererJSON:n,rasterInfo:s});const o=this.symbolizer.bind();if(o.success){if("auto"===e){const{colormap:e}=this.raster.rasterInfo,t=this.renderer;if(null!=e&&"raster-colormap"===t.type){const e=E(this.raster.rasterInfo);JSON.stringify(e)!==JSON.stringify(t)&&this._configDefaultRenderer("override")}else if("raster-stretch"===t.type){const e=this.bandIds?.length,r=t.statistics?.length;!t.dynamicRangeAdjustment&&r&&e&&r!==e&&this._configDefaultRenderer("override")}}}else B.warn("imagery-tile-mixin",o.error||"The given renderer is not supported by the layer."),"auto"===e&&this._configDefaultRenderer("override")}};function L(e){if(!e.raster||!e.rasterInfo)throw new s("imagery-tile","no raster")}return e([a({clonable:!1})],V.prototype,"_cachedRendererJson",void 0),e([a({clonable:!1})],V.prototype,"_cachedRasterFunctionJson",void 0),e([a({clonable:!1})],V.prototype,"_compatibleFullExtent",void 0),e([a({clonable:!1})],V.prototype,"_isConstructedFromFunctionRaster",void 0),e([a({clonable:!1})],V.prototype,"_rasterJobHandler",void 0),e([a()],V.prototype,"bandIds",void 0),e([a({json:{origins:{service:{read:{source:"copyrightText"}}}}})],V.prototype,"copyright",void 0),e([a({json:{read:!1}})],V.prototype,"fullExtent",null),e([a()],V.prototype,"interpolation",void 0),e([a()],V.prototype,"ioConfig",void 0),e([a({type:[p],json:{write:!0}})],V.prototype,"multidimensionalDefinition",null),e([a({type:f,json:{write:!0}})],V.prototype,"multidimensionalSubset",void 0),e([a()],V.prototype,"raster",void 0),e([a({type:y,json:{name:"renderingRule",write:!0}})],V.prototype,"rasterFunction",null),e([a()],V.prototype,"rasterInfo",void 0),e([a()],V.prototype,"sourceJSON",void 0),e([a({readOnly:!0,type:k,json:{read:!1}})],V.prototype,"spatialReference",void 0),e([a({type:g})],V.prototype,"tileInfo",void 0),e([a(h)],V.prototype,"url",null),e([a({types:t,json:{name:"layerDefinition.drawingInfo.renderer",write:{overridePolicy(){const e="raster-stretch"===this.renderer?.type&&"none"===this.renderer.stretchType&&!this.renderer.useGamma;return{enabled:!this.loaded||"Raster"===this.raster.tileType||!e}}},origins:{"web-scene":{types:r,name:"layerDefinition.drawingInfo.renderer",write:{overridePolicy:e=>({enabled:e&&"vector-field"!==e.type&&"flow"!==e.type})}}}}})],V.prototype,"renderer",null),e([u("renderer")],V.prototype,"readRenderer",null),e([a({clonable:!1})],V.prototype,"symbolizer",void 0),V=e([c("esri.layers.ImageryTileMixin")],V),V};export{V as ImageryTileMixin};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.28/esri/copyright.txt for details.
4
4
  */
5
- import{difference as e,isSome as a}from"../../core/arrayUtils.js";import r from"../../core/Error.js";import{debounce as t}from"../../core/promiseUtils.js";import{updateOrigins as s}from"../../core/accessorSupport/originUtils.js";import o from"../FeatureLayer.js";import{save as l,saveAs as n,getLayerJSON as i,setCommonItemProperties as c,getPortalItem as u,addItem as p,ensureLayerConfig as m,ensureItemConfig as f,createErrorMessage as y}from"./utils.js";import{parse as d}from"../support/arcgisLayerUrl.js";import{fetchFeatureService as h}from"../support/fetchService.js";import{isLayerWithFeatureLayerSource as w}from"../support/layerUtils.js";import{createForItemWrite as v}from"../../portal/support/jsonContext.js";import{getWGS84ExtentForItem as S,removeTypeKeyword as b,TypeKeyword as I,addTypeKeyword as T,toggleTypeKeword as $}from"../../portal/support/portalItemUtils.js";const E="Feature Service",P="feature-layer-utils",A=`${P}-save`,L=`${P}-save-as`,j=`${P}-saveall`,N=`${P}-saveall-as`;function U(e){return{isValid:w(e)&&("feature"!==e.type||!e.dynamicDataSource),errorMessage:"Feature layer should be a layer or table in a map or feature service"}}function x(e){const a=[],r=[];for(const{layer:t,layerJSON:s}of e)t.isTable?r.push(s):a.push(s);return{layers:a,tables:r}}function g(e){return x([e])}async function O(e,a){return/\/\d+\/?$/.test(e.url)?g(a[0]):J(a,e)}async function J(e,a){if(!a)return x(e);const{layer:{url:r,customParameters:t,apiKey:s}}=e[0];let o=await a.fetchData("json");o&&null!=o.layers&&null!=o.tables||(o=await M(o,{url:r??"",customParameters:t,apiKey:s},e.map((e=>e.layer.layerId))));for(const l of e)F(l.layer,l.layerJSON,o);return o}async function M(e,a,r){e||={},e.layers||=[],e.tables||=[];const{url:t,customParameters:s,apiKey:o}=a,{serviceJSON:l,layersJSON:n}=await h(t,{customParameters:s,apiKey:o}),i=R(e.layers,l.layers,r),c=R(e.tables,l.tables,r);e.layers=i.itemResources,e.tables=c.itemResources;const u=[...i.added,...c.added],p=n?[...n.layers,...n.tables]:[];return await D(e,u,t,p),e}function R(a,r,t){const s=e(a,r,((e,a)=>e.id===a.id));a=a.filter((e=>!s.removed.some((a=>a.id===e.id))));const o=s.added.map((({id:e})=>({id:e})));return o.forEach((({id:e})=>{a.push({id:e})})),{itemResources:a,added:o.filter((({id:e})=>!t.includes(e)))}}async function D(e,a,r,t){const s=a.map((({id:e})=>new o({url:r,layerId:e,sourceJSON:t.find((({id:a})=>a===e))})));await Promise.allSettled(s.map((e=>e.load()))),s.forEach((a=>{const{layerId:r,loaded:t,defaultPopupTemplate:s}=a;if(!t||null==s)return;F(a,{id:r,popupInfo:s.toJSON()},e)}))}function F(e,a,r){e.isTable?K(r.tables,a):K(r.layers,a)}function K(e,a){const r=e.findIndex((({id:e})=>e===a.id));-1===r?e.push(a):e[r]=a}function Y(e,a){if(!e.length)throw new r(`${a}:missing-parameters`,"'layers' array should contain at least one feature layer")}function _(e,a){const t=e.map((e=>e.portalItem.id));if(new Set(t).size>1)throw new r(`${a}:invalid-parameters`,"All layers in the 'layers' array should be loaded from the same portal item")}function z(e,a){const t=e.map((e=>e.layerId));if(new Set(t).size!==t.length)throw new r(`${a}:invalid-parameters`,"'layers' array should contain only one instance each of layer or table in a feature service")}async function B(e){Y(e,j),await Promise.all(e.map((e=>e.load())));for(const a of e)m(a,j,U),f(a,j,E);_(e,j),z(e,j)}async function G(e,a){const{url:r,layerId:t,title:s,fullExtent:o,isTable:l}=e,n=d(r);a.url="FeatureServer"===n?.serverType?r:`${r}/${t}`,a.title||=s,a.extent=null,l||null==o||(a.extent=await S(o)),b(a,I.METADATA),b(a,I.MULTI_LAYER),T(a,I.SINGLE_LAYER),l&&T(a,I.TABLE)}function C(e,a){for(const l of e){const t=l.parsedUrl.path,s=d(t),o=s?.url.path;if(!o)throw new r(`${a}:invalid-parameters`,y(l,`has unsupported url pattern: ${t}`),{layer:l});const n=s?.serverType;if("FeatureServer"!==n&&"MapServer"!==n)throw new r(`${a}:invalid-parameters`,y(l,`has unsupported server type: ${n}`),{layer:l});if("MapServer"===n&&e.length>1)throw new r(`${a}:invalid-parameters`,"Only one layer or table in a map service can be saved")}const t=d(e[0].parsedUrl.path),s=t?.url.path,o=e.every((e=>{const a=d(e.parsedUrl.path);return a?.url.path===s}));if(!o)throw new r(`${a}:invalid-parameters`,"'layers' array should only contain layers or tables that belong to the same feature service")}async function V(e){Y(e,N),await Promise.all(e.map((e=>e.load())));for(const a of e)m(a,N,U);C(e,N),z(e,N)}async function k(e,r){let t=0,s=0;for(const{isTable:a}of r)a?s++:t++;const o=r[0].parsedUrl.path,l=d(o);if(e.url="FeatureServer"===l?.serverType?l.url.path:o,e.title||=l.title,e.extent=null,t>0){const t=r.map((e=>e.fullExtent)).filter(a).reduce(((e,a)=>e.clone().union(a)));t&&(e.extent=await S(t))}b(e,I.METADATA),$(e,I.MULTI_LAYER,r.length>1),$(e,I.SINGLE_LAYER,1===r.length),$(e,I.TABLE,s>0&&0===t),c(e)}const q=t(H);async function H(e,a){return l({layer:e,itemType:E,validateLayer:U,createItemData:(e,a)=>O(a,[e]),errorNamePrefix:A},a)}const Q=t((async(e,a)=>{await B(e);const r=e[0].portalItem,t=v(r),o=await Promise.all(e.map((e=>i(e,t,a)))),l=await O(r,e.map(((e,a)=>({layer:e,layerJSON:o[a]}))));return c(r),await r.update({data:l}),await Promise.all(e.slice(1).map((e=>e.portalItem.reload()))),s(t),r.clone()})),W=t(X);async function X(e,a,r){return n({layer:e,itemType:E,validateLayer:U,createItemData:(e,a)=>Promise.resolve(g(e)),errorNamePrefix:L,newItem:a,setItemProperties:G},r)}const Z=t((async(e,a,r)=>{await V(e);const t=u(a,N,E),o=v(t),l=await Promise.all(e.map((e=>i(e,o,r)))),n=await J(e.map(((e,a)=>({layer:e,layerJSON:l[a]}))));await k(t,e),await p(t,n,r);for(const s of e)s.portalItem=t.clone();return s(o),t}));export{q as save,Q as saveAll,Z as saveAllAs,W as saveAs};
5
+ import{difference as e,isSome as a}from"../../core/arrayUtils.js";import r from"../../core/Error.js";import{updateOrigins as t}from"../../core/accessorSupport/originUtils.js";import s from"../FeatureLayer.js";import{save as o,getLayerJSON as l,setCommonItemProperties as n,saveAs as i,getPortalItem as u,addItem as c,ensureLayerConfig as p,ensureItemConfig as m,createErrorMessage as f}from"./utils.js";import{parse as y}from"../support/arcgisLayerUrl.js";import{fetchFeatureService as d}from"../support/fetchService.js";import{isLayerWithFeatureLayerSource as h}from"../support/layerUtils.js";import{createForItemWrite as w}from"../../portal/support/jsonContext.js";import{getWGS84ExtentForItem as v,removeTypeKeyword as S,TypeKeyword as b,toggleTypeKeword as I,addTypeKeyword as T}from"../../portal/support/portalItemUtils.js";const $="Feature Service",E="feature-layer-utils",P=`${E}-save`,A=`${E}-save-as`,L=`${E}-saveall`,j=`${E}-saveall-as`;function N(e){return{isValid:h(e)&&("feature"!==e.type||!e.dynamicDataSource),errorMessage:"Feature layer should be a layer or table in a map or feature service"}}function x(e){const a=[],r=[];for(const{layer:t,layerJSON:s}of e)t.isTable?r.push(s):a.push(s);return{layers:a,tables:r}}function U(e){return x([e])}async function g(e,a){return/\/\d+\/?$/.test(e.url)?U(a[0]):O(a,e)}async function O(e,a){if(!a)return x(e);const{layer:{url:r,customParameters:t,apiKey:s}}=e[0];let o=await a.fetchData("json");o&&null!=o.layers&&null!=o.tables||(o=await J(o,{url:r??"",customParameters:t,apiKey:s},e.map((e=>e.layer.layerId))));for(const l of e)D(l.layer,l.layerJSON,o);return o}async function J(e,a,r){e||={},e.layers||=[],e.tables||=[];const{url:t,customParameters:s,apiKey:o}=a,{serviceJSON:l,layersJSON:n}=await d(t,{customParameters:s,apiKey:o}),i=M(e.layers,l.layers,r),u=M(e.tables,l.tables,r);e.layers=i.itemResources,e.tables=u.itemResources;const c=[...i.added,...u.added],p=n?[...n.layers,...n.tables]:[];return await R(e,c,t,p),e}function M(a,r,t){const s=e(a,r,((e,a)=>e.id===a.id));a=a.filter((e=>!s.removed.some((a=>a.id===e.id))));const o=s.added.map((({id:e})=>({id:e})));return o.forEach((({id:e})=>{a.push({id:e})})),{itemResources:a,added:o.filter((({id:e})=>!t.includes(e)))}}async function R(e,a,r,t){const o=a.map((({id:e})=>new s({url:r,layerId:e,sourceJSON:t.find((({id:a})=>a===e))})));await Promise.allSettled(o.map((e=>e.load()))),o.forEach((a=>{const{layerId:r,loaded:t,defaultPopupTemplate:s}=a;if(!t||null==s)return;D(a,{id:r,popupInfo:s.toJSON()},e)}))}function D(e,a,r){e.isTable?F(r.tables,a):F(r.layers,a)}function F(e,a){const r=e.findIndex((({id:e})=>e===a.id));-1===r?e.push(a):e[r]=a}function K(e,a){if(!e.length)throw new r(`${a}:missing-parameters`,"'layers' array should contain at least one feature layer")}function Y(e,a){const t=e.map((e=>e.portalItem.id));if(new Set(t).size>1)throw new r(`${a}:invalid-parameters`,"All layers in the 'layers' array should be loaded from the same portal item")}function _(e,a){const t=e.map((e=>e.layerId));if(new Set(t).size!==t.length)throw new r(`${a}:invalid-parameters`,"'layers' array should contain only one instance each of layer or table in a feature service")}async function z(e){K(e,L),await Promise.all(e.map((e=>e.load())));for(const a of e)p(a,L,N),m(a,L,$);Y(e,L),_(e,L)}async function B(e,a){const{url:r,layerId:t,title:s,fullExtent:o,isTable:l}=e,n=y(r);a.url="FeatureServer"===n?.serverType?r:`${r}/${t}`,a.title||=s,a.extent=null,l||null==o||(a.extent=await v(o)),S(a,b.METADATA),S(a,b.MULTI_LAYER),T(a,b.SINGLE_LAYER),l&&T(a,b.TABLE)}function G(e,a){for(const l of e){const t=l.parsedUrl.path,s=y(t),o=s?.url.path;if(!o)throw new r(`${a}:invalid-parameters`,f(l,`has unsupported url pattern: ${t}`),{layer:l});const n=s?.serverType;if("FeatureServer"!==n&&"MapServer"!==n)throw new r(`${a}:invalid-parameters`,f(l,`has unsupported server type: ${n}`),{layer:l});if("MapServer"===n&&e.length>1)throw new r(`${a}:invalid-parameters`,"Only one layer or table in a map service can be saved")}const t=y(e[0].parsedUrl.path),s=t?.url.path,o=e.every((e=>{const a=y(e.parsedUrl.path);return a?.url.path===s}));if(!o)throw new r(`${a}:invalid-parameters`,"'layers' array should only contain layers or tables that belong to the same feature service")}async function C(e){K(e,j),await Promise.all(e.map((e=>e.load())));for(const a of e)p(a,j,N);G(e,j),_(e,j)}async function V(e,r){let t=0,s=0;for(const{isTable:a}of r)a?s++:t++;const o=r[0].parsedUrl.path,l=y(o);if(e.url="FeatureServer"===l?.serverType?l.url.path:o,e.title||=l.title,e.extent=null,t>0){const t=r.map((e=>e.fullExtent)).filter(a).reduce(((e,a)=>e.clone().union(a)));t&&(e.extent=await v(t))}S(e,b.METADATA),I(e,b.MULTI_LAYER,r.length>1),I(e,b.SINGLE_LAYER,1===r.length),I(e,b.TABLE,s>0&&0===t),n(e)}async function k(e,a){return o({layer:e,itemType:$,validateLayer:N,createItemData:(e,a)=>g(a,[e]),errorNamePrefix:P},a)}async function q(e,a){await z(e);const r=e[0].portalItem,s=w(r),o=await Promise.all(e.map((e=>l(e,s,a)))),i=await g(r,e.map(((e,a)=>({layer:e,layerJSON:o[a]}))));return n(r),await r.update({data:i}),await Promise.all(e.slice(1).map((e=>e.portalItem.reload()))),t(s),r.clone()}async function H(e,a,r){return i({layer:e,itemType:$,validateLayer:N,createItemData:(e,a)=>Promise.resolve(U(e)),errorNamePrefix:A,newItem:a,setItemProperties:B},r)}async function Q(e,a,r){await C(e);const s=u(a,j,$),o=w(s),n=await Promise.all(e.map((e=>l(e,o,r)))),i=await O(e.map(((e,a)=>({layer:e,layerJSON:n[a]}))));await V(s,e),await c(s,i,r);for(const t of e)t.portalItem=s.clone();return t(o),s}export{k as save,q as saveAll,Q as saveAllAs,H as saveAs};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.28/esri/copyright.txt for details.
4
4
  */
5
- import{debounce as e}from"../../core/promiseUtils.js";import{save as t,saveAs as r}from"./utils.js";import{getWGS84ExtentForItem as a,addTypeKeyword as i,TypeKeyword as s}from"../../portal/support/portalItemUtils.js";const l="Image Service",o="imagery-layer-save",n="imagery-layer-save-as",y="imagery-tile-layer-save",m="imagery-tile-layer-save-as";function c(e){if("imagery"===e.type)return{isValid:!0};const{raster:t}=e;return{isValid:"RasterTileServer"===t?.datasetFormat&&("Raster"===t.tileType||"Map"===t.tileType),errorMessage:"imagery tile layer should be created from a tiled image service."}}function p(e){const t=e.layerJSON;return Promise.resolve(t&&Object.keys(t).length?t:null)}async function u(e,t){const{parsedUrl:r,title:l,fullExtent:o}=e;t.url=r.path,t.title||=l,t.extent=await a(o),"imagery-tile"===e.type&&i(t,s.TILED_IMAGERY)}const f=e(g);async function g(e,r){const a="imagery"===e.type?o:y;return t({layer:e,itemType:l,validateLayer:c,createItemData:p,errorNamePrefix:a},r)}const v=e(d);async function d(e,t,a){const i="imagery"===e.type?n:m;return r({layer:e,itemType:l,validateLayer:c,createItemData:p,errorNamePrefix:i,newItem:t,setItemProperties:u},a)}export{f as save,v as saveAs};
5
+ import{save as e,saveAs as t}from"./utils.js";import{getWGS84ExtentForItem as r,addTypeKeyword as a,TypeKeyword as i}from"../../portal/support/portalItemUtils.js";const s="Image Service",l="imagery-layer-save",y="imagery-layer-save-as",n="imagery-tile-layer-save",o="imagery-tile-layer-save-as";function m(e){if("imagery"===e.type)return{isValid:!0};const{raster:t}=e;return{isValid:"RasterTileServer"===t?.datasetFormat&&("Raster"===t.tileType||"Map"===t.tileType),errorMessage:"imagery tile layer should be created from a tiled image service."}}function c(e){const t=e.layerJSON;return Promise.resolve(t&&Object.keys(t).length?t:null)}async function p(e,t){const{parsedUrl:s,title:l,fullExtent:y}=e;t.url=s.path,t.title||=l,t.extent=await r(y),"imagery-tile"===e.type&&a(t,i.TILED_IMAGERY)}async function u(t,r){const a="imagery"===t.type?l:n;return e({layer:t,itemType:s,validateLayer:m,createItemData:c,errorNamePrefix:a},r)}async function g(e,r,a){const i="imagery"===e.type?y:o;return t({layer:e,itemType:s,validateLayer:m,createItemData:c,errorNamePrefix:i,newItem:r,setItemProperties:p},a)}export{u as save,g as saveAs};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.28/esri/copyright.txt for details.
4
4
  */
5
- import{debounce as e}from"../../core/promiseUtils.js";import{save as t,saveAs as r}from"./utils.js";import{getWGS84ExtentForItem as a,addTypeKeyword as s,TypeKeyword as l}from"../../portal/support/portalItemUtils.js";const n="Stream Service",o="stream-layer-save",i="stream-layer-save-as";function m(e){return{isValid:"stream"===e.type&&!!e.url&&!e.webSocketUrl,errorMessage:"Stream layer should be created using a url to a stream service"}}function c(e){const t=e.layerJSON;return Promise.resolve(t&&Object.keys(t).length?t:null)}async function u(e,t){const{parsedUrl:r,title:n,fullExtent:o}=e;t.url=r.path,t.title||=n,t.extent=null,null!=o&&(t.extent=await a(o)),s(t,l.SINGLE_LAYER)}const p=e(y);async function y(e,r){return t({layer:e,itemType:n,validateLayer:m,createItemData:c,errorNamePrefix:o},r)}const f=e(v);async function v(e,t,a){return r({layer:e,itemType:n,validateLayer:m,createItemData:c,errorNamePrefix:i,newItem:t,setItemProperties:u},a)}export{p as save,f as saveAs};
5
+ import{save as e,saveAs as t}from"./utils.js";import{getWGS84ExtentForItem as r,addTypeKeyword as a,TypeKeyword as s}from"../../portal/support/portalItemUtils.js";const l="Stream Service",n="stream-layer-save",i="stream-layer-save-as";function o(e){return{isValid:"stream"===e.type&&!!e.url&&!e.webSocketUrl,errorMessage:"Stream layer should be created using a url to a stream service"}}function m(e){const t=e.layerJSON;return Promise.resolve(t&&Object.keys(t).length?t:null)}async function u(e,t){const{parsedUrl:l,title:n,fullExtent:i}=e;t.url=l.path,t.title||=n,t.extent=null,null!=i&&(t.extent=await r(i)),a(t,s.SINGLE_LAYER)}async function c(t,r){return e({layer:t,itemType:l,validateLayer:o,createItemData:m,errorNamePrefix:n},r)}async function y(e,r,a){return t({layer:e,itemType:l,validateLayer:o,createItemData:m,errorNamePrefix:i,newItem:r,setItemProperties:u},a)}export{c as save,y as saveAs};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.28/esri/copyright.txt for details.
4
4
  */
5
- const e={namespace:void 0,performanceLogger:()=>{},eventHandlerInterceptor:void 0,styleApplyer:(e,r,o)=>{e.style[r]=o}},r=r=>({...e,...r});export{r as applyDefaultProjectionOptions};
5
+ const e={namespace:void 0,performanceLogger:()=>{},eventHandlerInterceptor:void 0,styleApplyer:(e,r,t)=>{"-"===r.charAt(0)?e.style.setProperty(r,t):e.style[r]=t}},r=r=>({...e,...r});export{r as applyDefaultProjectionOptions};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arcgis/core",
3
- "version": "4.28.0-next.20230818",
3
+ "version": "4.28.0-next.20230821",
4
4
  "homepage": "https://js.arcgis.com",
5
5
  "description": "ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API",
6
6
  "keywords": [
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.28/esri/copyright.txt for details.
4
4
  */
5
- import{_ as t}from"../../chunks/tslib.es6.js";import{ClonableMixin as r}from"../../core/Clonable.js";import{JSONSupport as o}from"../../core/JSONSupport.js";import{property as e}from"../../core/accessorSupport/decorators/property.js";import{Integer as s}from"../../core/accessorSupport/ensureType.js";import"../../core/arrayUtils.js";import"../../core/has.js";import{enumeration as i}from"../../core/accessorSupport/decorators/enumeration.js";import{subclass as a}from"../../core/accessorSupport/decorators/subclass.js";import{formatDate as m,convertDateFormatToIntlOptions as p,utcTimeZone as n,formatDateOnly as d,formatTimeOnly as u,formatTimestamp as c,dateFormatJSONMap as l}from"../../intl/date.js";import{formatNumber as f,convertNumberFormatToIntlOptions as h}from"../../intl/number.js";let j=class extends(r(o)){constructor(t){super(t),this.dateFormat=null,this.digitSeparator=!1,this.places=null}formatNumber(t){return f(t,h(this))}formatDate(t,r=!1){return this.dateFormat?m(t,{...p(this.dateFormat),...r&&n}):this.formatNumber(t)}formatDateOnly(t){const r=(this.dateFormat&&p(this.dateFormat))??void 0;return d(t,r)}formatTimeOnly(t){const r=(this.dateFormat&&p(this.dateFormat))??void 0;return u(t,r)}formatTimestamp(t){const r=(this.dateFormat&&p(this.dateFormat))??void 0;return c(t,r)}formatRasterPixelValue(t){return t=t.trim(),/\d{2}-\d{2}/.test(t)?t:t.includes(",")?this._formatDelimitedString(t,",",", "):t.includes(";")?this._formatDelimitedString(t,";","; "):t.includes(" ")?this._formatDelimitedString(t," "," "):this.formatNumber(Number(t))}_formatDelimitedString(t,r,o){return t&&r&&o?t.trim().split(r).map((t=>this.formatNumber(Number(t)))).join(o):t}};t([i(l)],j.prototype,"dateFormat",void 0),t([e({type:Boolean,json:{write:!0}})],j.prototype,"digitSeparator",void 0),t([e({type:s,json:{write:!0}})],j.prototype,"places",void 0),j=t([a("esri.popup.support.FieldInfoFormat")],j);const F=j;export{F as default};
5
+ import{_ as t}from"../../chunks/tslib.es6.js";import{ClonableMixin as r}from"../../core/Clonable.js";import{JSONSupport as o}from"../../core/JSONSupport.js";import{property as e}from"../../core/accessorSupport/decorators/property.js";import{Integer as s}from"../../core/accessorSupport/ensureType.js";import"../../core/arrayUtils.js";import"../../core/has.js";import{enumeration as i}from"../../core/accessorSupport/decorators/enumeration.js";import{subclass as m}from"../../core/accessorSupport/decorators/subclass.js";import{formatDate as a,convertDateFormatToIntlOptions as p,formatDateOnly as n,formatTimeOnly as u,formatTimestamp as d,dateFormatJSONMap as c}from"../../intl/date.js";import{formatNumber as l,convertNumberFormatToIntlOptions as f}from"../../intl/number.js";let h=class extends(r(o)){constructor(t){super(t),this.dateFormat=null,this.digitSeparator=!1,this.places=null}formatNumber(t){return l(t,f(this))}formatDate(t,r){return this.dateFormat?a(t,{...p(this.dateFormat??"short-date-short-time"),timeZone:r}):this.formatNumber(t)}formatDateOnly(t){return n(t,p(this.dateFormat??"short-date"))}formatTimeOnly(t){return u(t,p(this.dateFormat??"short-time"))}formatTimestamp(t,r){return d(t,{...p(this.dateFormat??"short-date-short-time"),timeZone:r})}formatRasterPixelValue(t){return t=t.trim(),/\d{2}-\d{2}/.test(t)?t:t.includes(",")?this._formatDelimitedString(t,",",", "):t.includes(";")?this._formatDelimitedString(t,";","; "):t.includes(" ")?this._formatDelimitedString(t," "," "):this.formatNumber(Number(t))}_formatDelimitedString(t,r,o){return t&&r&&o?t.trim().split(r).map((t=>this.formatNumber(Number(t)))).join(o):t}};t([i(c)],h.prototype,"dateFormat",void 0),t([e({type:Boolean,json:{write:!0}})],h.prototype,"digitSeparator",void 0),t([e({type:s,json:{write:!0}})],h.prototype,"places",void 0),h=t([m("esri.popup.support.FieldInfoFormat")],h);const j=h;export{j as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.28/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../chunks/tslib.es6.js";import{getAssetUrl as t}from"../assets.js";import{id as i}from"../kernel.js";import r from"../core/Error.js";import{JSONSupportMixin as o}from"../core/JSONSupport.js";import{clone as s,fixJson as a}from"../core/lang.js";import n from"../core/Loadable.js";import{isDataProtocol as l,makeAbsolute as p}from"../core/urlUtils.js";import{property as c}from"../core/accessorSupport/decorators/property.js";import{ensureClass as d}from"../core/accessorSupport/ensureType.js";import{reader as u}from"../core/accessorSupport/decorators/reader.js";import{subclass as m}from"../core/accessorSupport/decorators/subclass.js";import h from"../geometry/Extent.js";import g from"./Portal.js";import y from"./PortalItemResource.js";import v from"./PortalRating.js";var w;const f=new Set(["Map Service","Feature Service","Feature Collection","Scene Service","Image Service","Stream Service","Vector Tile Service","GeoJson","CSV","KML","WFS","WMTS","WMS","Feed"]),b=new Set(["KML","GeoJson","CSV"]);let k=w=class extends(o(n)){static from(e){return d(w,e)}constructor(e){super(e),this.access=null,this.accessInformation=null,this.apiKey=null,this.applicationProxies=null,this.avgRating=null,this.categories=null,this.created=null,this.culture=null,this.description=null,this.extent=null,this.groupCategories=null,this.id=null,this.isOrgItem=!1,this.itemControl=null,this.licenseInfo=null,this.modified=null,this.name=null,this.numComments=null,this.numRatings=null,this.numViews=null,this.owner=null,this.ownerFolder=null,this.portal=null,this.screenshots=null,this.size=null,this.snippet=null,this.sourceJSON=null,this.sourceUrl=null,this.spatialReference=null,this.tags=null,this.title=null,this.type=null,this.typeKeywords=null,this.url=null}destroy(){this.portal=null}get displayName(){const e=this.type,t=this.typeKeywords||[];let i=e;return"Feature Service"===e||"Feature Collection"===e?i=t.includes("Table")?"Table":t.includes("Route Layer")?"Route Layer":t.includes("Markup")?"Markup":"Feature Layer":"Image Service"===e?i=t.includes("Elevation 3D Layer")?"Elevation Layer":t.includes("Tiled Imagery")?"Tiled Imagery Layer":"Imagery Layer":"Scene Service"===e?i="Scene Layer":"Video Service"===e?i="Video Layer":"Scene Package"===e?i="Scene Layer Package":"Stream Service"===e?i="Feature Layer":"Geoprocessing Service"===e?i=t.includes("Web Tool")?"Tool":"Geoprocessing Service":"Geocoding Service"===e?i="Locator":"Geoenrichment Service"===e?i="GeoEnrichment Service":"Microsoft Powerpoint"===e?i="Microsoft PowerPoint":"GeoJson"===e?i="GeoJSON":"Globe Service"===e?i="Globe Layer":"Vector Tile Service"===e?i="Tile Layer":"netCDF"===e?i="NetCDF":"Map Service"===e?i=t.includes("Spatiotemporal")||!t.includes("Hosted Service")&&!t.includes("Tiled")||t.includes("Relational")?"Map Image Layer":"Tile Layer":e&&e.toLowerCase().includes("add in")?i=e.replaceAll(/(add in)/gi,"Add-In"):"datastore catalog service"===e?i="Big Data File Share":"Compact Tile Package"===e?i="Tile Package (tpkx)":"OGCFeatureServer"===e?i="OGC Feature Layer":"web mapping application"===e&&t.includes("configurableApp")?i="Instant App":"Insights Page"===e?i="Insights Report":"Excalibur Imagery Project"===e&&(i="Excalibur Project"),i}readExtent(e){return e&&e.length?new h(e[0][0],e[0][1],e[1][0],e[1][1]):null}get iconUrl(){const e=this.type&&this.type.toLowerCase()||"",i=this.typeKeywords||[],r="esri/images/portal/",o="16";let s,a=!1,n=!1,l=!1,p=!1,c=!1,d=!1;return e.indexOf("service")>0||"feature collection"===e||"kml"===e||"wms"===e||"wmts"===e||"wfs"===e?(a=i.includes("Hosted Service"),"feature service"===e||"feature collection"===e||"kml"===e||"wfs"===e?(n=i.includes("Table"),l=i.includes("Route Layer"),p=i.includes("Markup"),c=i.includes("Spatiotemporal"),d=i.includes("UtilityNetwork"),s=c&&n?"spatiotemporaltable":n?"table":l?"routelayer":p?"markup":c?"spatiotemporal":a?"featureshosted":d?"utilitynetwork":"features"):s="map service"===e||"wms"===e||"wmts"===e?a||i.includes("Tiled")||"wmts"===e?"maptiles":"mapimages":"scene service"===e?i.includes("Line")?"sceneweblayerline":i.includes("3DObject")?"sceneweblayermultipatch":i.includes("Point")?"sceneweblayerpoint":i.includes("IntegratedMesh")?"sceneweblayermesh":i.includes("PointCloud")?"sceneweblayerpointcloud":i.includes("Polygon")?"sceneweblayerpolygon":i.includes("Building")?"sceneweblayerbuilding":i.includes("Voxel")?"sceneweblayervoxel":"sceneweblayer":"image service"===e?i.includes("Elevation 3D Layer")?"elevationlayer":i.includes("Tiled Imagery")?"tiledimagerylayer":"imagery":"stream service"===e?"streamlayer":"video service"===e?i.includes("Live Stream")?"livestreamvideolayer":"videolayer":"vector tile service"===e?"vectortile":"datastore catalog service"===e?"datastorecollection":"geocoding service"===e?"geocodeservice":"geoprocessing service"===e?i.includes("Web Tool")?"tool":"layers":"geodata service"===e?"geodataservice":"layers"):s="web map"===e||"cityengine web scene"===e?"maps":"web scene"===e?i.includes("ViewingMode-Local")?"webscenelocal":"websceneglobal":"web mapping application"===e&&i.includes("configurableApp")?"instantapps":"web mapping application"===e||"mobile application"===e||"application"===e||"operation view"===e||"desktop application"===e?"apps":"map document"===e||"map package"===e||"published map"===e||"scene document"===e||"globe document"===e||"basemap package"===e||"mobile basemap package"===e||"mobile map package"===e||"project package"===e||"project template"===e||"pro map"===e||"layout"===e||"layer"===e&&i.includes("ArcGIS Pro")||"explorer map"===e&&i.indexOf("Explorer Document")?"mapsgray":"service definition"===e||"csv"===e||"shapefile"===e||"cad drawing"===e||"geojson"===e||"netcdf"===e||"administrative report"===e?"datafiles":"explorer add in"===e||"desktop add in"===e||"windows viewer add in"===e||"windows viewer configuration"===e?"appsgray":"360 vr experience"===e?"360vr":"arcgis pro add in"===e||"arcgis pro configuration"===e?"addindesktop":"rule package"===e||"file geodatabase"===e||"sqlite geodatabase"===e||"csv collection"===e||"kml collection"===e||"windows mobile package"===e||"map template"===e||"desktop application template"===e||"gml"===e||"arcpad package"===e||"code sample"===e||"form"===e||"document link"===e||"earth configuration"===e||"operations dashboard add in"===e||"rules package"===e||"image"===e||"workflow manager package"===e||"explorer map"===e&&i.includes("Explorer Mapping Application")||i.includes("Document")?"datafilesgray":"network analysis service"===e||"geoprocessing service"===e||"geodata service"===e||"geometry service"===e||"geoprocessing package"===e||"locator package"===e||"geoprocessing sample"===e||"workflow manager service"===e?"toolsgray":"layer"===e||"layer package"===e||"explorer layer"===e?"layersgray":"scene package"===e?"scenepackage":"3dtiles package"===e?"3dtileslayerpackage":"3dtiles service"===e?"3dtileslayer":"mobile scene package"===e?"mobilescenepackage":"tile package"===e||"compact tile package"===e?"tilepackage":"task file"===e?"taskfile":"report template"===e?"report-template":"statistical data collection"===e?"statisticaldatacollection":"insights workbook"===e?"workbook":"insights model"===e?"insightsmodel":"insights page"===e?"insightspage":"insights theme"===e?"insightstheme":"hub initiative"===e?"hubinitiative":"hubpage"===e?"hubpage":"hub event"===e?"hubevent":"hub site application"===e?"hubsite":"hub project"===e?"hubproject":"relational database connection"===e?"relationaldatabaseconnection":"big data file share"===e?"datastorecollection":"image collection"===e?"imagecollection":"style"===e?"style":"desktop style"===e?"desktopstyle":"dashboard"===e?"dashboard":"raster function template"===e?"rasterprocessingtemplate":"vector tile package"===e?"vectortilepackage":"ortho mapping project"===e?"orthomappingproject":"ortho mapping template"===e?"orthomappingtemplate":"solution"===e?"solutions":"geopackage"===e?"geopackage":"deep learning package"===e?"deeplearningpackage":"real time analytic"===e?"realtimeanalytics":"big data analytic"===e?"bigdataanalytics":"feed"===e?"feed":"excalibur imagery project"===e?"excaliburimageryproject":"notebook"===e?"notebook":"storymap"===e?"storymap":"survey123 add in"===e?"survey123addin":"mission"===e?"mission":"mission report"===e?"missionreport":"mission template"===e?"missiontemplate":"quickcapture project"===e?"quickcaptureproject":"pro report"===e?"proreport":"pro report template"===e?"proreporttemplate":"urban model"===e?"urbanmodel":"web experience"===e?"experiencebuilder":"web experience template"===e?"webexperiencetemplate":"experience builder widget"===e?"experiencebuilderwidget":"experience builder widget package"===e?"experiencebuilderwidgetpackage":"workflow"===e?"workflow":"insights script"===e?"insightsscript":"kernel gateway connection"===e?"kernelgatewayconnection":"hub initiative template"===e?"hubinitiativetemplate":"storymap theme"===e?"storymaptheme":"knowledge graph"===e?"knowledgegraph":"native application"===e?"nativeapp":"native application installer"===e?"nativeappinstaller":"link chart"===e?"linkchart":"investigation"===e?"investigation":"ogcfeatureserver"===e?"features":"pro project"===e?"proproject":"insights workbook package"===e?"insightsworkbookpackage":"apache parquet"===e?"apacheparquet":"notebook code snippets"===e||"notebook code snippet library"===e?"notebookcodesnippets":"suitability model"===e?"suitabilitymodel":"esri classifier definition"===e?"classifierdefinition":"esri classification schema"===e?"classificationschema":"insights data engineering workbook"===e?"dataengineeringworkbook":"insights data engineering model"===e?"dataengineeringmodel":"deep learning studio project"===e?"deeplearningproject":"discussion"===e?"discussion":"allsource project"===e?"allsourceproject":"api key"===e?"apikey":"data pipeline"===e?"datapipelines":"maps",s?t(r+s+o+".png"):null}get isLayer(){return null!=this.type&&f.has(this.type)}get itemCdnUrl(){let e=this.itemUrl;return e&&i&&!i.findCredential(e)&&(e=i._normalizeAGOLorgDomain(e),e=e.replace(/^https?:\/\/www\.arcgis\.com/,"https://cdn.arcgis.com"),e=e.replace(/^https?:\/\/devext\.arcgis\.com/,"https://cdndev.arcgis.com"),e=e.replace(/^https?:\/\/qaext\.arcgis\.com/,"https://cdnqa.arcgis.com")),e}get itemPageUrl(){const e=this.portal?.itemPageUrl;return e&&this.id?`${e}?id=${this.id}`:null}get itemUrl(){const e=this.portal?.restUrl;return e&&this.id?`${e}/content/items/${this.id}`:null}get thumbnailUrl(){const e=this.itemUrl,t=this.thumbnail;return e&&t?this.portal?.normalizeUrl(`${e}/info/${t}?f=json`)??null:null}get userItemUrl(){const e=this.portal?.restUrl;if(!e)return null;const t=this.owner||this.portal?.user?.username;if(!t)return null;return`${e}/content/users/${this.ownerFolder?`${t}/${this.ownerFolder}`:t}/items/${this.id}`}load(e){const t=this.portal??(this.portal=g.getDefault()),i=t.load(e).then((()=>this.sourceJSON?this.sourceJSON:this.id&&this.itemUrl?t.request(this.itemUrl,{signal:null!=e?e.signal:null,query:{token:this.apiKey}}):{})).then((e=>{this.sourceJSON=e,this.read(e)}));return this.addResolvingPromise(i),Promise.resolve(this)}async addRating(e){const t={method:"post",query:{}};return e instanceof v&&(e=e.rating),null==e||isNaN(e)||"number"!=typeof e||(t.query.rating=e),this.portal?(await this.portal.request(this.itemUrl+"/addRating",t),new v({rating:e,created:new Date})):null}clone(){const e={access:this.access,accessInformation:this.accessInformation,applicationProxies:s(this.applicationProxies),avgRating:this.avgRating,categories:s(this.categories),created:s(this.created),culture:this.culture,description:this.description,extent:s(this.extent),groupCategories:s(this.groupCategories),id:this.id,itemControl:this.itemControl,licenseInfo:this.licenseInfo,modified:s(this.modified),name:this.name,numComments:this.numComments,numRatings:this.numRatings,numViews:this.numViews,owner:this.owner,ownerFolder:this.ownerFolder,portal:this.portal,screenshots:s(this.screenshots),size:this.size,snippet:this.snippet,sourceUrl:this.sourceUrl,spatialReference:this.spatialReference,tags:s(this.tags),thumbnail:this.thumbnail,title:this.title,type:this.type,typeKeywords:s(this.typeKeywords),url:this.url};this.loaded&&(e.loadStatus="loaded");const t=new w({sourceJSON:this.sourceJSON}).set(e);return t._set("isOrgItem",this.isOrgItem),t}createPostQuery(){const e=this.toJSON();for(const i of["tags","typeKeywords","categories"])e[i]=e[i]?.join(", ");const{extent:t}=e;return t&&(e.extent=JSON.stringify(t)),e}async deleteRating(){await this.portal.request(this.itemUrl+"/deleteRating",{method:"post"})}fetchData(e="json",t){return this.portal.request(this.itemUrl+"/data",{responseType:e,...t,query:{token:this.apiKey}})}async fetchRating(e){const t=await this.portal.request(this.itemUrl+"/rating",{query:{token:this.apiKey},...e});return null!=t.rating?(t.created=new Date(t.created),new v(t)):null}fetchRelatedItems(e,t){return this.portal.requestToTypedArray(this.itemUrl+"/relatedItems",{query:{...e,token:this.apiKey},...t},w)}getThumbnailUrl(e){let t=this.thumbnailUrl;return t&&e&&(t+=`&w=${e}`),t}reload(){return this.portal.request(this.itemUrl??"",{cacheBust:!0,query:{token:this.apiKey}}).then((e=>(this.sourceJSON=e,this.read(e),this)))}update(e){return this.id?this.load().then((()=>this.portal.signIn())).then((()=>{const t=e&&e.data,i={method:"post"};i.query=this.createPostQuery();for(const e in i.query)null===i.query[e]&&(i.query[e]="");return i.query.clearEmptyFields=!0,null!=t&&("string"==typeof t?i.query.text=t:"object"==typeof t&&(i.query.text=JSON.stringify(t))),this.portal.request(`${this.userItemUrl}/update`,i).then((()=>this.reload()))})):Promise.reject(new r("portal:item-does-not-exist","The item does not exist yet and cannot be updated"))}async copy(e){if(!this.id)throw new r("portal:item-does-not-exist","The item does not exist yet");await this.load();const{portal:t,itemUrl:i}=this;await t.signIn();const{copyResources:o,folder:s,tags:a,title:n}=e||{},l={method:"post",query:{copyPrivateResources:"all"===o,folder:"string"==typeof s?s:s?.id,includeResources:!!o,tags:a?.join(","),title:n}},{itemId:p}=await t.request(`${i}/copy`,l);return new w({id:p,portal:t})}updateThumbnail(e){return this.id?this.load().then((()=>this.portal.signIn())).then((()=>{const t=e.thumbnail,i=e.filename,r={method:"post"};if("string"==typeof t)l(t)?r.query={data:t}:r.query={url:p(t)},null!=i&&(r.query.filename=i);else{const e=new FormData;null!=i?e.append("file",t,i):e.append("file",t),r.body=e}return this.portal.request(`${this.userItemUrl}/updateThumbnail`,r).then((()=>this.reload()))})):Promise.reject(new r("portal:item-does-not-exist","The item does not exist yet and cannot be updated"))}async fetchResources(e={},t){const{fetchResources:i}=await import("./support/resourceUtils.js");return i(this,e,t)}async addResource(e,t,i){const{addOrUpdateResource:r}=await import("./support/resourceUtils.js");return e.portalItem=this,r(e,"add",t,i)}async removeResource(e,t){const{removeResource:i}=await import("./support/resourceUtils.js");if(e.portalItem&&e.portalItem.itemUrl!==this.itemUrl)throw new r("removeresource:portal-item-mismatch","The portal item associated with the provided resource does not match the item");return i(this,e,t)}async removeAllResources(e){const{removeAllResources:t}=await import("./support/resourceUtils.js");return t(this,e)}resourceFromPath(e){return new y({portalItem:this,path:e})}toJSON(){const e=this.extent,t={accessInformation:this.accessInformation,categories:s(this.categories),created:this.created&&this.created.getTime(),description:this.description,extent:e&&[[e.xmin,e.ymin],[e.xmax,e.ymax]],id:this.id,isOrgItem:this.isOrgItem,licenseInfo:this.licenseInfo,modified:this.modified&&this.modified.getTime(),name:this.name,owner:this.owner,ownerFolder:this.ownerFolder,snippet:this.snippet,sourceUrl:this.sourceUrl,spatialReference:this.spatialReference,tags:s(this.tags),thumbnail:this.thumbnail,title:this.title,type:this.type,typeKeywords:s(this.typeKeywords),url:this.url};return a(t)}static fromJSON(e){if(!e)return null;if(e.declaredClass)throw new Error("JSON object is already hydrated");return new w({sourceJSON:e})}_getPostQuery(){const e=this.toJSON();for(const t in e)"tags"===t&&null!==e[t]&&(e[t]=e[t].join(", ")),"typeKeywords"===t&&null!==e[t]&&(e[t]=e[t].join(", ")),"extent"===t&&e[t]&&(e[t]=JSON.stringify(e[t]));return e}};e([c({type:["private","shared","org","public"]})],k.prototype,"access",void 0),e([c()],k.prototype,"accessInformation",void 0),e([c({type:String})],k.prototype,"apiKey",void 0),e([c({json:{read:{source:"appProxies"}}})],k.prototype,"applicationProxies",void 0),e([c()],k.prototype,"avgRating",void 0),e([c()],k.prototype,"categories",void 0),e([c({type:Date})],k.prototype,"created",void 0),e([c()],k.prototype,"culture",void 0),e([c()],k.prototype,"description",void 0),e([c({readOnly:!0})],k.prototype,"displayName",null),e([c({type:h})],k.prototype,"extent",void 0),e([u("extent")],k.prototype,"readExtent",null),e([c()],k.prototype,"groupCategories",void 0),e([c({readOnly:!0})],k.prototype,"iconUrl",null),e([c()],k.prototype,"id",void 0),e([c({readOnly:!0})],k.prototype,"isLayer",null),e([c({type:Boolean,readOnly:!0})],k.prototype,"isOrgItem",void 0),e([c()],k.prototype,"itemControl",void 0),e([c({readOnly:!0})],k.prototype,"itemPageUrl",null),e([c({readOnly:!0})],k.prototype,"itemUrl",null),e([c()],k.prototype,"licenseInfo",void 0),e([c({type:Date})],k.prototype,"modified",void 0),e([c()],k.prototype,"name",void 0),e([c()],k.prototype,"numComments",void 0),e([c()],k.prototype,"numRatings",void 0),e([c()],k.prototype,"numViews",void 0),e([c()],k.prototype,"owner",void 0),e([c()],k.prototype,"ownerFolder",void 0),e([c({type:g})],k.prototype,"portal",void 0),e([c()],k.prototype,"screenshots",void 0),e([c()],k.prototype,"size",void 0),e([c()],k.prototype,"snippet",void 0),e([c()],k.prototype,"sourceJSON",void 0),e([c({type:String})],k.prototype,"sourceUrl",void 0),e([c({type:String})],k.prototype,"spatialReference",void 0),e([c()],k.prototype,"tags",void 0),e([c()],k.prototype,"thumbnail",void 0),e([c({readOnly:!0})],k.prototype,"thumbnailUrl",null),e([c()],k.prototype,"title",void 0),e([c()],k.prototype,"type",void 0),e([c()],k.prototype,"typeKeywords",void 0),e([c({type:String,json:{read(e,t){if(b.has(t.type)){const t=this.portal?.restUrl;e||=t&&this.id?`${t}/content/items/${this.id}/data`:null}return e}}})],k.prototype,"url",void 0),e([c({readOnly:!0})],k.prototype,"userItemUrl",null),k=w=e([m("esri.portal.PortalItem")],k);const S=k;export{S as default};
5
+ import{_ as e}from"../chunks/tslib.es6.js";import{getAssetUrl as t}from"../assets.js";import{id as i}from"../kernel.js";import r from"../core/Error.js";import{JSONSupportMixin as o}from"../core/JSONSupport.js";import{clone as s,fixJson as a}from"../core/lang.js";import n from"../core/Loadable.js";import{isDataProtocol as l,makeAbsolute as p}from"../core/urlUtils.js";import{property as c}from"../core/accessorSupport/decorators/property.js";import{ensureClass as d}from"../core/accessorSupport/ensureType.js";import{reader as u}from"../core/accessorSupport/decorators/reader.js";import{subclass as m}from"../core/accessorSupport/decorators/subclass.js";import h from"../geometry/Extent.js";import g from"./Portal.js";import y from"./PortalItemResource.js";import v from"./PortalRating.js";var w;const f=new Set(["Map Service","Feature Service","Feature Collection","Scene Service","Image Service","Stream Service","Vector Tile Service","GeoJson","CSV","KML","WFS","WMTS","WMS","Feed"]),b=new Set(["KML","GeoJson","CSV"]);let k=w=class extends(o(n)){static from(e){return d(w,e)}constructor(e){super(e),this.access=null,this.accessInformation=null,this.apiKey=null,this.applicationProxies=null,this.avgRating=null,this.categories=null,this.created=null,this.culture=null,this.description=null,this.extent=null,this.groupCategories=null,this.id=null,this.isOrgItem=!1,this.itemControl=null,this.licenseInfo=null,this.modified=null,this.name=null,this.numComments=null,this.numRatings=null,this.numViews=null,this.owner=null,this.ownerFolder=null,this.portal=null,this.screenshots=null,this.size=null,this.snippet=null,this.sourceJSON=null,this.sourceUrl=null,this.spatialReference=null,this.tags=null,this.title=null,this.type=null,this.typeKeywords=null,this.url=null}destroy(){this.portal=null}get displayName(){const e=this.type,t=this.typeKeywords||[];let i=e;return"Feature Service"===e||"Feature Collection"===e?i=t.includes("Table")?"Table":t.includes("Route Layer")?"Route Layer":t.includes("Markup")?"Markup":"Feature Layer":"Image Service"===e?i=t.includes("Elevation 3D Layer")?"Elevation Layer":t.includes("Tiled Imagery")?"Tiled Imagery Layer":"Imagery Layer":"Scene Service"===e?i="Scene Layer":"Video Service"===e?i="Video Layer":"Scene Package"===e?i="Scene Layer Package":"Stream Service"===e?i="Feature Layer":"Geoprocessing Service"===e?i=t.includes("Web Tool")?"Tool":"Geoprocessing Service":"Geocoding Service"===e?i="Locator":"Geoenrichment Service"===e?i="GeoEnrichment Service":"Microsoft Powerpoint"===e?i="Microsoft PowerPoint":"GeoJson"===e?i="GeoJSON":"Globe Service"===e?i="Globe Layer":"Vector Tile Service"===e?i="Tile Layer":"netCDF"===e?i="NetCDF":"Map Service"===e?i=t.includes("Spatiotemporal")||!t.includes("Hosted Service")&&!t.includes("Tiled")||t.includes("Relational")?"Map Image Layer":"Tile Layer":e&&e.toLowerCase().includes("add in")?i=e.replaceAll(/(add in)/gi,"Add-In"):"datastore catalog service"===e?i="Big Data File Share":"Compact Tile Package"===e?i="Tile Package (tpkx)":"OGCFeatureServer"===e?i="OGC Feature Layer":"web mapping application"===e&&t.includes("configurableApp")?i="Instant App":"Insights Page"===e?i="Insights Report":"Excalibur Imagery Project"===e&&(i="Excalibur Project"),i}readExtent(e){return e&&e.length?new h(e[0][0],e[0][1],e[1][0],e[1][1]):null}get iconUrl(){const e=this.type&&this.type.toLowerCase()||"",i=this.typeKeywords||[],r="esri/images/portal/",o="16";let s,a=!1,n=!1,l=!1,p=!1,c=!1,d=!1;return e.indexOf("service")>0||"feature collection"===e||"kml"===e||"wms"===e||"wmts"===e||"wfs"===e?(a=i.includes("Hosted Service"),"feature service"===e||"feature collection"===e||"kml"===e||"wfs"===e?(n=i.includes("Table"),l=i.includes("Route Layer"),p=i.includes("Markup"),c=i.includes("Spatiotemporal"),d=i.includes("UtilityNetwork"),s=c&&n?"spatiotemporaltable":n?"table":l?"routelayer":p?"markup":c?"spatiotemporal":a?"featureshosted":d?"utilitynetwork":"features"):s="map service"===e||"wms"===e||"wmts"===e?a||i.includes("Tiled")||"wmts"===e?"maptiles":"mapimages":"scene service"===e?i.includes("Line")?"sceneweblayerline":i.includes("3DObject")?"sceneweblayermultipatch":i.includes("Point")?"sceneweblayerpoint":i.includes("IntegratedMesh")?"sceneweblayermesh":i.includes("PointCloud")?"sceneweblayerpointcloud":i.includes("Polygon")?"sceneweblayerpolygon":i.includes("Building")?"sceneweblayerbuilding":i.includes("Voxel")?"sceneweblayervoxel":"sceneweblayer":"image service"===e?i.includes("Elevation 3D Layer")?"elevationlayer":i.includes("Tiled Imagery")?"tiledimagerylayer":"imagery":"stream service"===e?"streamlayer":"video service"===e?i.includes("Live Stream")?"livestreamvideolayer":"videolayer":"vector tile service"===e?"vectortile":"datastore catalog service"===e?"datastorecollection":"geocoding service"===e?"geocodeservice":"geoprocessing service"===e?i.includes("Web Tool")?"tool":"layers":"geodata service"===e?"geodataservice":"3dtiles service"===e?"3dtileslayer":"layers"):s="web map"===e||"cityengine web scene"===e?"maps":"web scene"===e?i.includes("ViewingMode-Local")?"webscenelocal":"websceneglobal":"web mapping application"===e&&i.includes("configurableApp")?"instantapps":"web mapping application"===e||"mobile application"===e||"application"===e||"operation view"===e||"desktop application"===e?"apps":"map document"===e||"map package"===e||"published map"===e||"scene document"===e||"globe document"===e||"basemap package"===e||"mobile basemap package"===e||"mobile map package"===e||"project package"===e||"project template"===e||"pro map"===e||"layout"===e||"layer"===e&&i.includes("ArcGIS Pro")||"explorer map"===e&&i.indexOf("Explorer Document")?"mapsgray":"service definition"===e||"csv"===e||"shapefile"===e||"cad drawing"===e||"geojson"===e||"netcdf"===e||"administrative report"===e?"datafiles":"explorer add in"===e||"desktop add in"===e||"windows viewer add in"===e||"windows viewer configuration"===e?"appsgray":"360 vr experience"===e?"360vr":"arcgis pro add in"===e||"arcgis pro configuration"===e?"addindesktop":"rule package"===e||"file geodatabase"===e||"sqlite geodatabase"===e||"csv collection"===e||"kml collection"===e||"windows mobile package"===e||"map template"===e||"desktop application template"===e||"gml"===e||"arcpad package"===e||"code sample"===e||"form"===e||"document link"===e||"earth configuration"===e||"operations dashboard add in"===e||"rules package"===e||"image"===e||"workflow manager package"===e||"explorer map"===e&&i.includes("Explorer Mapping Application")||i.includes("Document")?"datafilesgray":"network analysis service"===e||"geoprocessing service"===e||"geodata service"===e||"geometry service"===e||"geoprocessing package"===e||"locator package"===e||"geoprocessing sample"===e||"workflow manager service"===e?"toolsgray":"layer"===e||"layer package"===e||"explorer layer"===e?"layersgray":"scene package"===e?"scenepackage":"3dtiles package"===e?"3dtileslayerpackage":"mobile scene package"===e?"mobilescenepackage":"tile package"===e||"compact tile package"===e?"tilepackage":"task file"===e?"taskfile":"report template"===e?"report-template":"statistical data collection"===e?"statisticaldatacollection":"insights workbook"===e?"workbook":"insights model"===e?"insightsmodel":"insights page"===e?"insightspage":"insights theme"===e?"insightstheme":"hub initiative"===e?"hubinitiative":"hubpage"===e?"hubpage":"hub event"===e?"hubevent":"hub site application"===e?"hubsite":"hub project"===e?"hubproject":"relational database connection"===e?"relationaldatabaseconnection":"big data file share"===e?"datastorecollection":"image collection"===e?"imagecollection":"style"===e?"style":"desktop style"===e?"desktopstyle":"dashboard"===e?"dashboard":"raster function template"===e?"rasterprocessingtemplate":"vector tile package"===e?"vectortilepackage":"ortho mapping project"===e?"orthomappingproject":"ortho mapping template"===e?"orthomappingtemplate":"solution"===e?"solutions":"geopackage"===e?"geopackage":"deep learning package"===e?"deeplearningpackage":"real time analytic"===e?"realtimeanalytics":"big data analytic"===e?"bigdataanalytics":"feed"===e?"feed":"excalibur imagery project"===e?"excaliburimageryproject":"notebook"===e?"notebook":"storymap"===e?"storymap":"survey123 add in"===e?"survey123addin":"mission"===e?"mission":"mission report"===e?"missionreport":"mission template"===e?"missiontemplate":"quickcapture project"===e?"quickcaptureproject":"pro report"===e?"proreport":"pro report template"===e?"proreporttemplate":"urban model"===e?"urbanmodel":"web experience"===e?"experiencebuilder":"web experience template"===e?"webexperiencetemplate":"experience builder widget"===e?"experiencebuilderwidget":"experience builder widget package"===e?"experiencebuilderwidgetpackage":"workflow"===e?"workflow":"insights script"===e?"insightsscript":"kernel gateway connection"===e?"kernelgatewayconnection":"hub initiative template"===e?"hubinitiativetemplate":"storymap theme"===e?"storymaptheme":"knowledge graph"===e?"knowledgegraph":"native application"===e?"nativeapp":"native application installer"===e?"nativeappinstaller":"link chart"===e?"linkchart":"investigation"===e?"investigation":"ogcfeatureserver"===e?"features":"pro project"===e?"proproject":"insights workbook package"===e?"insightsworkbookpackage":"apache parquet"===e?"apacheparquet":"notebook code snippets"===e||"notebook code snippet library"===e?"notebookcodesnippets":"suitability model"===e?"suitabilitymodel":"esri classifier definition"===e?"classifierdefinition":"esri classification schema"===e?"classificationschema":"insights data engineering workbook"===e?"dataengineeringworkbook":"insights data engineering model"===e?"dataengineeringmodel":"deep learning studio project"===e?"deeplearningproject":"discussion"===e?"discussion":"allsource project"===e?"allsourceproject":"api key"===e?"apikey":"data pipeline"===e?"datapipelines":"maps",s?t(r+s+o+".png"):null}get isLayer(){return null!=this.type&&f.has(this.type)}get itemCdnUrl(){let e=this.itemUrl;return e&&i&&!i.findCredential(e)&&(e=i._normalizeAGOLorgDomain(e),e=e.replace(/^https?:\/\/www\.arcgis\.com/,"https://cdn.arcgis.com"),e=e.replace(/^https?:\/\/devext\.arcgis\.com/,"https://cdndev.arcgis.com"),e=e.replace(/^https?:\/\/qaext\.arcgis\.com/,"https://cdnqa.arcgis.com")),e}get itemPageUrl(){const e=this.portal?.itemPageUrl;return e&&this.id?`${e}?id=${this.id}`:null}get itemUrl(){const e=this.portal?.restUrl;return e&&this.id?`${e}/content/items/${this.id}`:null}get thumbnailUrl(){const e=this.itemUrl,t=this.thumbnail;return e&&t?this.portal?.normalizeUrl(`${e}/info/${t}?f=json`)??null:null}get userItemUrl(){const e=this.portal?.restUrl;if(!e)return null;const t=this.owner||this.portal?.user?.username;if(!t)return null;return`${e}/content/users/${this.ownerFolder?`${t}/${this.ownerFolder}`:t}/items/${this.id}`}load(e){const t=this.portal??(this.portal=g.getDefault()),i=t.load(e).then((()=>this.sourceJSON?this.sourceJSON:this.id&&this.itemUrl?t.request(this.itemUrl,{signal:null!=e?e.signal:null,query:{token:this.apiKey}}):{})).then((e=>{this.sourceJSON=e,this.read(e)}));return this.addResolvingPromise(i),Promise.resolve(this)}async addRating(e){const t={method:"post",query:{}};return e instanceof v&&(e=e.rating),null==e||isNaN(e)||"number"!=typeof e||(t.query.rating=e),this.portal?(await this.portal.request(this.itemUrl+"/addRating",t),new v({rating:e,created:new Date})):null}clone(){const e={access:this.access,accessInformation:this.accessInformation,applicationProxies:s(this.applicationProxies),avgRating:this.avgRating,categories:s(this.categories),created:s(this.created),culture:this.culture,description:this.description,extent:s(this.extent),groupCategories:s(this.groupCategories),id:this.id,itemControl:this.itemControl,licenseInfo:this.licenseInfo,modified:s(this.modified),name:this.name,numComments:this.numComments,numRatings:this.numRatings,numViews:this.numViews,owner:this.owner,ownerFolder:this.ownerFolder,portal:this.portal,screenshots:s(this.screenshots),size:this.size,snippet:this.snippet,sourceUrl:this.sourceUrl,spatialReference:this.spatialReference,tags:s(this.tags),thumbnail:this.thumbnail,title:this.title,type:this.type,typeKeywords:s(this.typeKeywords),url:this.url};this.loaded&&(e.loadStatus="loaded");const t=new w({sourceJSON:this.sourceJSON}).set(e);return t._set("isOrgItem",this.isOrgItem),t}createPostQuery(){const e=this.toJSON();for(const i of["tags","typeKeywords","categories"])e[i]=e[i]?.join(", ");const{extent:t}=e;return t&&(e.extent=JSON.stringify(t)),e}async deleteRating(){await this.portal.request(this.itemUrl+"/deleteRating",{method:"post"})}fetchData(e="json",t){return this.portal.request(this.itemUrl+"/data",{responseType:e,...t,query:{token:this.apiKey}})}async fetchRating(e){const t=await this.portal.request(this.itemUrl+"/rating",{query:{token:this.apiKey},...e});return null!=t.rating?(t.created=new Date(t.created),new v(t)):null}fetchRelatedItems(e,t){return this.portal.requestToTypedArray(this.itemUrl+"/relatedItems",{query:{...e,token:this.apiKey},...t},w)}getThumbnailUrl(e){let t=this.thumbnailUrl;return t&&e&&(t+=`&w=${e}`),t}reload(){return this.portal.request(this.itemUrl??"",{cacheBust:!0,query:{token:this.apiKey}}).then((e=>(this.sourceJSON=e,this.read(e),this)))}update(e){return this.id?this.load().then((()=>this.portal.signIn())).then((()=>{const t=e&&e.data,i={method:"post"};i.query=this.createPostQuery();for(const e in i.query)null===i.query[e]&&(i.query[e]="");return i.query.clearEmptyFields=!0,null!=t&&("string"==typeof t?i.query.text=t:"object"==typeof t&&(i.query.text=JSON.stringify(t))),this.portal.request(`${this.userItemUrl}/update`,i).then((()=>this.reload()))})):Promise.reject(new r("portal:item-does-not-exist","The item does not exist yet and cannot be updated"))}async copy(e){if(!this.id)throw new r("portal:item-does-not-exist","The item does not exist yet");await this.load();const{portal:t,itemUrl:i}=this;await t.signIn();const{copyResources:o,folder:s,tags:a,title:n}=e||{},l={method:"post",query:{copyPrivateResources:"all"===o,folder:"string"==typeof s?s:s?.id,includeResources:!!o,tags:a?.join(","),title:n}},{itemId:p}=await t.request(`${i}/copy`,l);return new w({id:p,portal:t})}updateThumbnail(e){return this.id?this.load().then((()=>this.portal.signIn())).then((()=>{const t=e.thumbnail,i=e.filename,r={method:"post"};if("string"==typeof t)l(t)?r.query={data:t}:r.query={url:p(t)},null!=i&&(r.query.filename=i);else{const e=new FormData;null!=i?e.append("file",t,i):e.append("file",t),r.body=e}return this.portal.request(`${this.userItemUrl}/updateThumbnail`,r).then((()=>this.reload()))})):Promise.reject(new r("portal:item-does-not-exist","The item does not exist yet and cannot be updated"))}async fetchResources(e={},t){const{fetchResources:i}=await import("./support/resourceUtils.js");return i(this,e,t)}async addResource(e,t,i){const{addOrUpdateResource:r}=await import("./support/resourceUtils.js");return e.portalItem=this,r(e,"add",t,i)}async removeResource(e,t){const{removeResource:i}=await import("./support/resourceUtils.js");if(e.portalItem&&e.portalItem.itemUrl!==this.itemUrl)throw new r("removeresource:portal-item-mismatch","The portal item associated with the provided resource does not match the item");return i(this,e,t)}async removeAllResources(e){const{removeAllResources:t}=await import("./support/resourceUtils.js");return t(this,e)}resourceFromPath(e){return new y({portalItem:this,path:e})}toJSON(){const e=this.extent,t={accessInformation:this.accessInformation,categories:s(this.categories),created:this.created&&this.created.getTime(),description:this.description,extent:e&&[[e.xmin,e.ymin],[e.xmax,e.ymax]],id:this.id,isOrgItem:this.isOrgItem,licenseInfo:this.licenseInfo,modified:this.modified&&this.modified.getTime(),name:this.name,owner:this.owner,ownerFolder:this.ownerFolder,snippet:this.snippet,sourceUrl:this.sourceUrl,spatialReference:this.spatialReference,tags:s(this.tags),thumbnail:this.thumbnail,title:this.title,type:this.type,typeKeywords:s(this.typeKeywords),url:this.url};return a(t)}static fromJSON(e){if(!e)return null;if(e.declaredClass)throw new Error("JSON object is already hydrated");return new w({sourceJSON:e})}_getPostQuery(){const e=this.toJSON();for(const t in e)"tags"===t&&null!==e[t]&&(e[t]=e[t].join(", ")),"typeKeywords"===t&&null!==e[t]&&(e[t]=e[t].join(", ")),"extent"===t&&e[t]&&(e[t]=JSON.stringify(e[t]));return e}};e([c({type:["private","shared","org","public"]})],k.prototype,"access",void 0),e([c()],k.prototype,"accessInformation",void 0),e([c({type:String})],k.prototype,"apiKey",void 0),e([c({json:{read:{source:"appProxies"}}})],k.prototype,"applicationProxies",void 0),e([c()],k.prototype,"avgRating",void 0),e([c()],k.prototype,"categories",void 0),e([c({type:Date})],k.prototype,"created",void 0),e([c()],k.prototype,"culture",void 0),e([c()],k.prototype,"description",void 0),e([c({readOnly:!0})],k.prototype,"displayName",null),e([c({type:h})],k.prototype,"extent",void 0),e([u("extent")],k.prototype,"readExtent",null),e([c()],k.prototype,"groupCategories",void 0),e([c({readOnly:!0})],k.prototype,"iconUrl",null),e([c()],k.prototype,"id",void 0),e([c({readOnly:!0})],k.prototype,"isLayer",null),e([c({type:Boolean,readOnly:!0})],k.prototype,"isOrgItem",void 0),e([c()],k.prototype,"itemControl",void 0),e([c({readOnly:!0})],k.prototype,"itemPageUrl",null),e([c({readOnly:!0})],k.prototype,"itemUrl",null),e([c()],k.prototype,"licenseInfo",void 0),e([c({type:Date})],k.prototype,"modified",void 0),e([c()],k.prototype,"name",void 0),e([c()],k.prototype,"numComments",void 0),e([c()],k.prototype,"numRatings",void 0),e([c()],k.prototype,"numViews",void 0),e([c()],k.prototype,"owner",void 0),e([c()],k.prototype,"ownerFolder",void 0),e([c({type:g})],k.prototype,"portal",void 0),e([c()],k.prototype,"screenshots",void 0),e([c()],k.prototype,"size",void 0),e([c()],k.prototype,"snippet",void 0),e([c()],k.prototype,"sourceJSON",void 0),e([c({type:String})],k.prototype,"sourceUrl",void 0),e([c({type:String})],k.prototype,"spatialReference",void 0),e([c()],k.prototype,"tags",void 0),e([c()],k.prototype,"thumbnail",void 0),e([c({readOnly:!0})],k.prototype,"thumbnailUrl",null),e([c()],k.prototype,"title",void 0),e([c()],k.prototype,"type",void 0),e([c()],k.prototype,"typeKeywords",void 0),e([c({type:String,json:{read(e,t){if(b.has(t.type)){const t=this.portal?.restUrl;e||=t&&this.id?`${t}/content/items/${this.id}/data`:null}return e}}})],k.prototype,"url",void 0),e([c({readOnly:!0})],k.prototype,"userItemUrl",null),k=w=e([m("esri.portal.PortalItem")],k);const S=k;export{S as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.28/esri/copyright.txt for details.
4
4
  */
5
- const c="20230818",b="5465cf0bab5f61830b7966935fc7bad0dfc2c098";export{c as buildDate,b as commitHash};
5
+ const c="20230821",a="accf51d40adc5636cda9c9f5d37a532b14bc0934";export{c as buildDate,a as commitHash};