@arcgis/core 4.23.0-next.20220131 → 4.23.0-next.20220202

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 (182) hide show
  1. package/Graphic.js +1 -1
  2. package/TimeExtent.js +1 -1
  3. package/assets/esri/core/workers/RemoteClient.js +1 -1
  4. package/assets/esri/core/workers/chunks/01a10fe5ad6941b0ee8c.js +1 -0
  5. package/assets/esri/core/workers/chunks/{7a5f5acfbd4ca1a5c1f3.js → 06116433eb6e669f146b.js} +1 -1
  6. package/assets/esri/core/workers/chunks/09a05d778b6fac710828.js +1 -0
  7. package/assets/esri/core/workers/chunks/{83d00afae4406ec78bc9.js → 0c6be307709523eb8a05.js} +1 -1
  8. package/assets/esri/core/workers/chunks/0e215fa28a0448169132.js +1 -0
  9. package/assets/esri/core/workers/chunks/{391e96192d1ec4e55ce2.js → 101b4f02f0572afb666f.js} +1 -1
  10. package/assets/esri/core/workers/chunks/11750e96065b4d7b926b.js +1 -0
  11. package/assets/esri/core/workers/chunks/{929c9b7cdab7c4ca3d87.js → 17c51f5a13f471e6656a.js} +1 -1
  12. package/assets/esri/core/workers/chunks/{ed0bcc66fb1e0ee75a4b.js → 1f34957ef42e5b5977d0.js} +1 -1
  13. package/assets/esri/core/workers/chunks/2f4e425be3a3bdfd8d29.js +1 -0
  14. package/assets/esri/core/workers/chunks/34bed896b68993cabaa1.js +1 -0
  15. package/assets/esri/core/workers/chunks/3e1679b01429fd73cffe.js +1 -0
  16. package/assets/esri/core/workers/chunks/{99619fcb772807c74f3b.js → 444829a840b8ded16fd7.js} +1 -1
  17. package/assets/esri/core/workers/chunks/467b5faa1c90d9821609.js +1 -0
  18. package/assets/esri/core/workers/chunks/49353182a16218a84251.js +1 -0
  19. package/assets/esri/core/workers/chunks/4bfc2eeb0738c393d8ec.js +1 -0
  20. package/assets/esri/core/workers/chunks/4de996ebc432f5e149bc.js +1 -0
  21. package/assets/esri/core/workers/chunks/{422537fc3df707bb62c9.js → 5038935db9b1ebe61d02.js} +1 -1
  22. package/assets/esri/core/workers/chunks/50976921acf7bd636123.js +1 -0
  23. package/assets/esri/core/workers/chunks/50ef2622fd0d9a241979.js +1 -0
  24. package/assets/esri/core/workers/chunks/{5790d171072b3c7d108f.js → 53aa2ab4e569c994a32d.js} +1 -1
  25. package/assets/esri/core/workers/chunks/{db3c729ce0c0b2690dc9.js → 574e33f28c106d607fe3.js} +1 -1
  26. package/assets/esri/core/workers/chunks/{952980635afc7ec81804.js → 5b02ba8ed152dba53155.js} +1 -1
  27. package/assets/esri/core/workers/chunks/60c06d1bb3f8a26cb5ac.js +1 -0
  28. package/assets/esri/core/workers/chunks/{c2253a9f29c1aabb2b75.js → 66c47983e93071de28b1.js} +1 -1
  29. package/assets/esri/core/workers/chunks/6be326edd9829781d926.js +1 -0
  30. package/assets/esri/core/workers/chunks/{5bcb3240b3c005e5fe72.js → 7215af7810d15e89aa5a.js} +1 -1
  31. package/assets/esri/core/workers/chunks/7509c1693ffedc0fa018.js +1 -0
  32. package/assets/esri/core/workers/chunks/76c1d663f6d3f935c87f.js +1 -0
  33. package/assets/esri/core/workers/chunks/7ccbb923f113b3e21545.js +1 -0
  34. package/assets/esri/core/workers/chunks/82194fec53054c37061f.js +1 -0
  35. package/assets/esri/core/workers/chunks/82c59a71b7f087148089.js +1 -0
  36. package/assets/esri/core/workers/chunks/84eee02122b56a22d49e.js +1 -0
  37. package/assets/esri/core/workers/chunks/{dd13772a5e2eccc6a2bc.js → 8598f762f15ca68d52b7.js} +1 -1
  38. package/assets/esri/core/workers/chunks/{fc046a15466c25d081ff.js → 88458dcaff8edc50620c.js} +1 -1
  39. package/assets/esri/core/workers/chunks/{5ec98f4ddac707d0fbd1.js → 88815d533808aabb1fa9.js} +1 -1
  40. package/assets/esri/core/workers/chunks/{0463ba46df855a92b9c0.js → 8941f09329d9d39fb2fe.js} +1 -1
  41. package/assets/esri/core/workers/chunks/{655b55ac0cd533d7e9d7.js → 8ad5dc818dc73f4b9a76.js} +1 -1
  42. package/assets/esri/core/workers/chunks/8e96cddb069b643d864a.js +1 -0
  43. package/assets/esri/core/workers/chunks/{f2124f4d0f2b8a91f0ea.js → 90c5edcd8a609224ce55.js} +1 -1
  44. package/assets/esri/core/workers/chunks/9230b20eba4304d421b4.js +1 -0
  45. package/assets/esri/core/workers/chunks/{bac9fc90e6756e211160.js → 94d9951509c0db09547a.js} +1 -1
  46. package/assets/esri/core/workers/chunks/996d6ae7f2e2273f9bce.js +1 -0
  47. package/assets/esri/core/workers/chunks/{37c03cfc19086ce631c6.js → 9bd603ec98d24cd918e9.js} +1 -1
  48. package/assets/esri/core/workers/chunks/{c1135cb02ec46c491459.js → 9ce961bc390202c87941.js} +1 -1
  49. package/assets/esri/core/workers/chunks/9d4a35d4a85db80c4071.js +1 -0
  50. package/assets/esri/core/workers/chunks/9f0ad28e66862ba971a3.js +1 -0
  51. package/assets/esri/core/workers/chunks/{b3f5e91116112b0b612a.js → 9fd47b8fe25657ac0237.js} +1 -1
  52. package/assets/esri/core/workers/chunks/{b9e9cb354822c6d995a4.js → a276e60209f3d877a8d0.js} +1 -1
  53. package/assets/esri/core/workers/chunks/{aeaa1667c2d9f1b3366b.js → a85ed251d3d3668e474f.js} +1 -1
  54. package/assets/esri/core/workers/chunks/{44f0c3663b293afbd172.js → acf10f747215e9ff54dc.js} +1 -1
  55. package/assets/esri/core/workers/chunks/{69fd99b7c76e9992ccf3.js → b32bf9808cb4be3a6bd0.js} +1 -1
  56. package/assets/esri/core/workers/chunks/b3dc80ddbfa81026e937.js +1 -0
  57. package/assets/esri/core/workers/chunks/b548e6b3add4154ac4e6.js +1 -0
  58. package/assets/esri/core/workers/chunks/b6c55bdd8c957b062bc1.js +1 -0
  59. package/assets/esri/core/workers/chunks/{1f8c6a179e39fd4c5e6f.js → bd152e8b43cc4a6844dd.js} +1 -1
  60. package/assets/esri/core/workers/chunks/{0d02c6ad1f4688bfa374.js → bf7c44644fe7b0aa60cf.js} +1 -1
  61. package/assets/esri/core/workers/chunks/c0dc5882362479794224.js +1 -0
  62. package/assets/esri/core/workers/chunks/c8b574a76807f4ea7a70.js +1 -0
  63. package/assets/esri/core/workers/chunks/d09a0b2dc3a6fc10fa41.js +1 -0
  64. package/assets/esri/core/workers/chunks/{ec10151a2a95e95a0bb5.js → d304fe0ac836afd46e3d.js} +1 -1
  65. package/assets/esri/core/workers/chunks/{37a7bd30352b1309b8f8.js → d3f05b8e4bd53eb1eb9d.js} +1 -1
  66. package/assets/esri/core/workers/chunks/{be588873c16770ceb9ef.js → d46b511bbb83e68f1ece.js} +1 -1
  67. package/assets/esri/core/workers/chunks/{17de7a324dfa7f57ad5d.js → d780e946149b1c3d1246.js} +1 -1
  68. package/assets/esri/core/workers/chunks/d80bcf5ed1f54e0c4f5a.js +1 -0
  69. package/assets/esri/core/workers/chunks/{8cbb04a9065aa3756638.js → dc04a8ba6c770bdc2bd4.js} +1 -1
  70. package/assets/esri/core/workers/chunks/{89820b200ee44e678af5.js → dd891a98105904f8a06b.js} +1 -1
  71. package/assets/esri/core/workers/chunks/e5ab037c2a90411c453b.js +1 -0
  72. package/assets/esri/core/workers/chunks/ef2df21e1af3aa7ced29.js +1 -0
  73. package/assets/esri/core/workers/chunks/f5a7281ae24e837efc61.js +1 -0
  74. package/assets/esri/core/workers/chunks/{2c607d30ff8ca1b61286.js → fe0c3b7c9b428d9c3f25.js} +1 -1
  75. package/chunks/Heatmap.glsl.js +10 -0
  76. package/chunks/HeatmapDensity.glsl.js +21 -0
  77. package/core/maybe.js +1 -1
  78. package/core/promiseUtils.js +1 -1
  79. package/interfaces.d.ts +6 -0
  80. package/layers/graphics/data/optimizedFeatureQueryEngineAdapter.js +1 -1
  81. package/layers/graphics/featureConversionUtils.js +1 -1
  82. package/layers/mixins/ArcGISImageService.js +1 -1
  83. package/layers/support/rasterFunctions/vectorFieldUtils.js +1 -1
  84. package/package.json +1 -1
  85. package/renderers/support/rendererConversion.js +1 -1
  86. package/rest/support/FeatureSet.js +1 -1
  87. package/support/featureFlags.js +1 -1
  88. package/support/revision.js +1 -1
  89. package/symbols/TextSymbol3DLayer.js +1 -1
  90. package/symbols/support/Symbol3DHalo.js +1 -1
  91. package/symbols/support/Symbol3DTextBackground.js +5 -0
  92. package/views/2d/engine/RasterVFContainer.js +5 -0
  93. package/views/2d/engine/RasterVFDisplayObject.js +1 -1
  94. package/views/2d/engine/flow/AnimatedFlowView2D.js +1 -1
  95. package/views/2d/engine/webgl/AttributeStoreView.js +1 -1
  96. package/views/2d/engine/webgl/brushes/raster/BrushVectorField.js +1 -1
  97. package/views/2d/engine/webgl/cpuMapped/Buffer.js +1 -1
  98. package/views/2d/engine/webgl/mesh/templates/WGLBaseTextTemplate.js +1 -1
  99. package/views/2d/layers/FeatureLayerView2D.js +1 -1
  100. package/views/2d/layers/ImageryLayerView2D.js +1 -1
  101. package/views/2d/layers/ImageryTileLayerView2D.js +1 -1
  102. package/views/2d/layers/features/processors/HeatmapProcessor.js +1 -1
  103. package/views/2d/layers/features/processors/SymbolProcessor.js +1 -1
  104. package/views/2d/layers/features/support/AttributeStore.js +1 -1
  105. package/views/2d/layers/features/support/ClusterStore.js +1 -1
  106. package/views/2d/layers/features/support/FeatureSetReaderJSON.js +1 -1
  107. package/views/2d/layers/imagery/BaseImageryTileSubView2D.js +1 -1
  108. package/views/2d/layers/imagery/ImageryTileView2D.js +1 -1
  109. package/views/2d/layers/imagery/ImageryVFStrategy.js +5 -0
  110. package/views/2d/layers/imagery/ImageryView2D.js +1 -1
  111. package/views/2d/layers/imagery/VectorFieldTileView2D.js +1 -1
  112. package/views/2d/layers/imagery/VectorFieldView2D.js +5 -0
  113. package/views/3d/environment/EnvironmentRenderer.js +1 -1
  114. package/views/3d/environment/SimpleAtmosphere.js +1 -1
  115. package/views/3d/interactive/analysisTools/lineOfSight/LineOfSightTool.js +1 -1
  116. package/views/3d/layers/FeatureLikeLayerView3D.js +1 -1
  117. package/views/3d/layers/VoxelLayerView3D.js +1 -1
  118. package/views/3d/layers/graphics/Graphics3DTextSymbolLayer.js +1 -1
  119. package/views/3d/layers/graphics/Graphics3DWebStyleSymbol.js +1 -1
  120. package/views/3d/layers/graphics/labelPlacement.js +1 -1
  121. package/views/3d/layers/support/HeatmapFeatureProcessor.js +1 -1
  122. package/views/3d/terrain/OverlayRenderer.js +1 -1
  123. package/views/3d/webgl-engine/lib/DrapedHeatmapRenderer.js +5 -0
  124. package/views/3d/webgl-engine/lib/TextRenderParameters.js +1 -1
  125. package/views/3d/webgl-engine/lib/TextRenderer.js +1 -1
  126. package/views/3d/webgl-engine/materials/HeatmapDensityMaterial.js +5 -0
  127. package/views/3d/webgl-engine/shaders/Heatmap.glsl.js +5 -0
  128. package/views/3d/webgl-engine/shaders/HeatmapDensity.glsl.js +5 -0
  129. package/views/3d/webgl-engine/shaders/HeatmapDensityTechnique.js +5 -0
  130. package/views/3d/webgl-engine/shaders/HeatmapTechnique.js +5 -0
  131. package/views/draw/support/Box.js +1 -1
  132. package/views/draw/support/GraphicMover.js +1 -1
  133. package/views/draw/support/HighlightHelper.js +5 -0
  134. package/views/draw/support/Reshape.js +1 -1
  135. package/views/draw/support/layerUtils.js +1 -1
  136. package/widgets/FeatureTable/FeatureTableViewModel.js +1 -1
  137. package/widgets/FeatureTable/Grid/Grid.js +1 -1
  138. package/widgets/FeatureTable/support/FeatureStore.js +1 -1
  139. package/widgets/FeatureTable.js +1 -1
  140. package/widgets/Sketch/SketchViewModel.js +1 -1
  141. package/widgets/Sketch.js +1 -1
  142. package/widgets/TimeSlider.js +1 -1
  143. package/widgets/Widget.js +1 -1
  144. package/widgets/support/vnodeCache.js +5 -0
  145. package/widgets/support/widgetUtils.js +1 -1
  146. package/assets/esri/core/workers/chunks/0453fad5cb819797b4f6.js +0 -1
  147. package/assets/esri/core/workers/chunks/0c15d77d8e817cf45a9a.js +0 -1
  148. package/assets/esri/core/workers/chunks/0cd0a6eef51fc5b9ea61.js +0 -1
  149. package/assets/esri/core/workers/chunks/0d684f16f37d5dc385dd.js +0 -1
  150. package/assets/esri/core/workers/chunks/16b6d0f8378582c051c3.js +0 -1
  151. package/assets/esri/core/workers/chunks/1877ab1b6a115dbba1c5.js +0 -1
  152. package/assets/esri/core/workers/chunks/1b2a961f776a0b57e57a.js +0 -1
  153. package/assets/esri/core/workers/chunks/1b3fd66577b19aa5f2b6.js +0 -1
  154. package/assets/esri/core/workers/chunks/1c733b7db092a2a88ef3.js +0 -1
  155. package/assets/esri/core/workers/chunks/27474b007988855bea9d.js +0 -1
  156. package/assets/esri/core/workers/chunks/2b25fc7945a187c2bb9d.js +0 -1
  157. package/assets/esri/core/workers/chunks/483d5d8593d96d0f0b15.js +0 -1
  158. package/assets/esri/core/workers/chunks/4ba6de8aa7e2960bad49.js +0 -1
  159. package/assets/esri/core/workers/chunks/4be35af7d6babbfe9d84.js +0 -1
  160. package/assets/esri/core/workers/chunks/5457962a70bd3c557a75.js +0 -1
  161. package/assets/esri/core/workers/chunks/57856b4a9b8784a69844.js +0 -1
  162. package/assets/esri/core/workers/chunks/57b349d1dbc0bed75b79.js +0 -1
  163. package/assets/esri/core/workers/chunks/5d11b97b667921d67ae7.js +0 -1
  164. package/assets/esri/core/workers/chunks/5dbe555a5a662ff3d9ce.js +0 -1
  165. package/assets/esri/core/workers/chunks/64b7e8d812ea8fcf269e.js +0 -1
  166. package/assets/esri/core/workers/chunks/75d812955a473d0e8960.js +0 -1
  167. package/assets/esri/core/workers/chunks/96f148a556a2418038de.js +0 -1
  168. package/assets/esri/core/workers/chunks/9876a1bae350795fab36.js +0 -1
  169. package/assets/esri/core/workers/chunks/a8692bffb76444c34760.js +0 -1
  170. package/assets/esri/core/workers/chunks/ba762bcfd74af0bb8218.js +0 -1
  171. package/assets/esri/core/workers/chunks/c984b3040e120e502b11.js +0 -1
  172. package/assets/esri/core/workers/chunks/cdbc005eebec1503b99d.js +0 -1
  173. package/assets/esri/core/workers/chunks/d1fe53b597351dc58305.js +0 -1
  174. package/assets/esri/core/workers/chunks/d98dab12b71912fa397b.js +0 -1
  175. package/assets/esri/core/workers/chunks/e218bde41ffbcc5194f5.js +0 -1
  176. package/assets/esri/core/workers/chunks/e287f49184d076af17e2.js +0 -1
  177. package/assets/esri/core/workers/chunks/e9e5196b44b6923be1a3.js +0 -1
  178. package/assets/esri/core/workers/chunks/ea595b0df5050eda2a13.js +0 -1
  179. package/assets/esri/core/workers/chunks/eb82ff10cef2bde6e57f.js +0 -1
  180. package/assets/esri/core/workers/chunks/ee6e0db58dc64410e687.js +0 -1
  181. package/assets/esri/core/workers/chunks/f0a9f161805fc7a30fc5.js +0 -1
  182. package/views/2d/layers/imagery/ImageryGraphicsView2D.js +0 -5
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.23/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../chunks/tslib.es6.js";import"../../geometry.js";import t from"../../Graphic.js";import{read as r,rasterRendererTypes as i,websceneRasterRendererTypes as s}from"../../rasterRenderers.js";import n from"../../request.js";import a from"../../core/Error.js";import{strict as o}from"../../core/jsonMap.js";import{clone as l}from"../../core/lang.js";import u from"../../core/Logger.js";import{isSome as p,isNone as c,unwrap as m}from"../../core/maybe.js";import{when as d}from"../../core/promiseUtils.js";import{urlToObject as h}from"../../core/urlUtils.js";import{aliasOf as f}from"../../core/accessorSupport/decorators/aliasOf.js";import{ensureClass as y,Integer as g,ensureNumber as R}from"../../core/accessorSupport/ensureType.js";import{property as v,ensureRange as x}from"../../core/accessorSupport/decorators/property.js";import{reader as b}from"../../core/accessorSupport/decorators/reader.js";import{subclass as S}from"../../core/accessorSupport/decorators/subclass.js";import{writer as I}from"../../core/accessorSupport/decorators/writer.js";import{opacity as _,url as w}from"../support/commonProperties.js";import F from"../support/DimensionalDefinition.js";import{ExportImageServiceParameters as O}from"../support/ExportImageServiceParameters.js";import D from"../support/Field.js";import P from"../support/FieldsIndex.js";import{isSupportedRendererType as T}from"../support/imageryRendererUtils.js";import j from"../support/MosaicRule.js";import N from"../support/PixelBlock.js";import{interpolationKebab as C,noDataInterpretationKebab as M}from"../support/rasterEnums.js";import J from"../support/RasterFunction.js";import q from"../support/RasterInfo.js";import V from"../support/RasterJobHandler.js";import{decode as A,getFormat as z}from"../support/rasterFormats/RasterCodec.js";import{uvComponentToVector as E}from"../support/rasterFunctions/vectorFieldUtils.js";import{getSupportedRendererTypes as Q,getDefaultBandCombination as U,createDefaultRenderer as H,normalizeRendererJSON as L}from"../../renderers/support/rasterRendererHelper.js";import k from"../../renderers/support/RasterSymbolizer.js";import{computeAngles as B,computePixelSpaceLocations as G,computeHistograms as W,computeStatisticsHistograms as X,getImageSpatialReferenceQueryParameter as Y,getSamples as K,identify as $}from"../../rest/imageService.js";import"../../core/unitUtils.js";import"../../kernel.js";import"../../rest/query/support/AttachmentInfo.js";import"../../rest/support/AttachmentQuery.js";import{executeForCount as Z}from"../../rest/query/executeForCount.js";import ee from"../../geometry/Extent.js";import"../../geometry/Geometry.js";import"../../geometry/Multipoint.js";import te from"../../geometry/Point.js";import re from"../../geometry/Polygon.js";import"../../geometry/Polyline.js";import"../../geometry/support/normalizeUtils.js";import"../support/arcgisLayerUrl.js";import"../../core/pbf.js";import"../../geometry/support/spatialReferenceUtils.js";import ie from"../../rest/support/Query.js";import{executeForIds as se}from"../../rest/query/executeForIds.js";import{executeQueryJSON as ne}from"../../rest/query/executeQueryJSON.js";import"../../core/has.js";import"../graphics/featureConversionUtils.js";import ae from"../../rest/support/FeatureSet.js";import"../../rest/support/RelationshipQuery.js";import"../../rest/support/TopFeaturesQuery.js";import oe from"../../rest/support/ImageAngleParameters.js";import le from"../../rest/support/ImageHistogramParameters.js";import ue from"../../rest/support/ImageIdentifyParameters.js";import pe from"../../rest/support/ImagePixelLocationParameters.js";import ce from"../../rest/support/ImageSampleParameters.js";import{createStreamlinesMesh as me}from"../../views/2d/engine/flow/dataUtils.js";import de from"../../geometry/SpatialReference.js";const he=u.getLogger("esri.layers.mixins.ArcGISImageService"),fe=o()({U1:"u1",U2:"u2",U4:"u4",U8:"u8",S8:"s8",U16:"u16",S16:"s16",U32:"u32",S32:"s32",F32:"f32",F64:"f64",C64:"c64",C128:"c128",UNKNOWN:"unknown"}),ye=new Set(["png","png8","png24","png32","jpg","bmp","gif","jpgpng","lerc","tiff"]),ge=x(R,{min:0,max:255});function Re(e){if(!e)return null;const t=JSON.stringify(e).match(/"rasterFunction":"(.*?")/gi),r=null==t?void 0:t.map((e=>e.replace('"rasterFunction":"',"").replace('"',"")));return r?r.join("/"):null}const ve=o=>{let u=class extends o{constructor(){super(...arguments),this._functionRasterInfos={},this._rasterJobHandler={instance:null,refCount:0,connectionPromise:null},this._symbolizer=null,this._defaultServiceMosaicRule=null,this._serviceSourceType=null,this._serviceSupportsMosaicRule=null,this.rasterAttributeTableFieldPrefix="Raster.",this.adjustAspectRatio=null,this.bandCount=null,this.bandIds=void 0,this.capabilities=null,this.compressionQuality=void 0,this.compressionTolerance=.01,this.copyright=null,this.definitionExpression=null,this.exportImageServiceParameters=null,this.rasterInfo=null,this.fields=null,this.fullExtent=null,this.hasMultidimensions=!1,this.imageMaxHeight=4100,this.imageMaxWidth=4100,this.interpolation=void 0,this.minScale=0,this.maxScale=0,this.multidimensionalInfo=null,this.noData=null,this.noDataInterpretation=void 0,this.objectIdField=null,this.geometryType="polygon",this.typeIdField=null,this.types=[],this.pixelSizeX=null,this.pixelSizeY=null,this.pixelFilter=null,this.raster=void 0,this.viewId=void 0,this.renderer=null,this.rasterAttributeTable=null,this.rasterFunctionInfos=null,this.serviceDataType=null,this.spatialReference=null,this.pixelType=null,this.serviceRasterInfo=null,this.sourceJSON=null,this.url=null,this.version=null}initialize(){this._set("exportImageServiceParameters",new O({layer:this}))}readDefaultServiceMosaicRule(e,t){return this._serviceSupportsMosaicRule?j.fromJSON(t):null}readServiceSourceType(e,t){return this._isMosaicDataset(t)?"mosaic-dataset":"raster-dataset"}readServiceSupportsMosaicRule(e,t){return this._isMosaicRuleSupported(t)}get rasterFunctionNamesIndex(){const e=new Map;return!this.rasterFunctionInfos||p(this.rasterFunctionInfos)&&this.rasterFunctionInfos.length<1||p(this.rasterFunctionInfos)&&this.rasterFunctionInfos.forEach((t=>{e.set(t.name.toLowerCase().replace(/ /gi,"_"),t.name)})),e}readBandIds(e,t){if(Array.isArray(e)&&e.length>0&&e.every((e=>"number"==typeof e)))return e}readCapabilities(e,t){return this._readCapabilities(t)}writeCompressionQuality(e,t,r){null!=e&&"lerc"!==this.format&&(t[r]=e)}writeCompressionTolerance(e,t,r){"lerc"===this.format&&null!=e&&(t[r]=e)}get fieldsIndex(){return this.fields?new P(this.fields):null}set format(e){e&&ye.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]=ge(e))}readObjectIdField(e,t){if(!e){const r=t.fields.filter((e=>"esriFieldTypeOID"===e.type||"oid"===e.type));e=r&&r[0]&&r[0].name}return e}get parsedUrl(){return this.url?h(this.url):null}readRenderer(e,t,i){var s,n;const a=null==t||null==(s=t.layerDefinition)||null==(n=s.drawingInfo)?void 0:n.renderer,o=r(a,i);return null==o?null:("vector-field"===o.type&&t.symbolTileSize&&!a.symbolTileSize&&(o.symbolTileSize=t.symbolTileSize),T(o)||he.warn("ArcGISImageService","Imagery layer doesn't support given renderer type."),o)}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 D({name:"Raster.ItemPixelValue",alias:"Item Pixel Value",domain:null,editable:!1,length:50,type:"string"}),r=new D({name:"Raster.ServicePixelValue",alias:"Service Pixel Value",domain:null,editable:!1,length:50,type:"string"}),i=new D({name:"Raster.ServicePixelValue.Raw",alias:"Raw Service Pixel Value",domain:null,editable:!1,length:50,type:"string"});let s=this.fields?l(this.fields):[];s.push(r),this.capabilities.operations.supportsQuery&&this.fields&&this.fields.length>0&&s.push(t),this.version>=10.4&&p(this.rasterFunctionInfos)&&this.rasterFunctionInfos.some((e=>"none"===e.name.toLowerCase()))&&s.push(i),p(this.rasterFunctionInfos)&&this.rasterFunctionInfos.filter((e=>"none"!==e.name.toLowerCase())).forEach((e=>{s.push(new D({name:"Raster.ServicePixelValue."+e.name,alias:e.name,domain:null,editable:!1,length:50,type:"string"}))})),null==this.pixelFilter||"esriImageServiceDataTypeVector-UV"!==this.serviceDataType&&"esriImageServiceDataTypeVector-MagDir"!==this.serviceDataType||(s.push(new D({name:"Raster.Magnitude",alias:"Magnitude",domain:null,editable:!1,type:"double"})),s.push(new D({name:"Raster.Direction",alias:"Direction",domain:null,editable:!1,type:"double"})));const n=this.rasterInfo.attributeTable&&this.rasterInfo.attributeTable.fields||null;if(n&&n.length>0){const t=n.filter((e=>"esriFieldTypeOID"!==e.type&&"value"!==e.name.toLowerCase())).map((t=>{const r=l(t);return r.name=e+t.name,r}));s=s.concat(t)}return s}set renderingRule(e){let t=e;t&&t.rasterFunction&&(t=J.fromJSON({...t.toJSON(),rasterFunction:t.rasterFunction,rasterFunctionArguments:t.rasterFunctionArguments})),this._set("renderingRule",t)}readRenderingRule(e,t){const r=t.rasterFunctionInfos;return t.renderingRule||r&&r.length&&"None"!==r[0].name?this._isRFTJson(t.renderingRule)?J.fromJSON({rasterFunctionDefinition:t.renderingRule}):J.fromJSON(t.renderingRule||{rasterFunctionInfos:t.rasterFunctionInfos}):null}writeRenderingRule(e,t,r){const i=e.toJSON();i.rasterFunctionDefinition?t[r]=i.rasterFunctionDefinition:t[r]=i}readSpatialReference(e,t){const r=e||t.extent.spatialReference;return r?de.fromJSON(r):null}readPixelType(e){return fe.fromJSON(e)||e}writePixelType(e,t,r){(c(this.serviceRasterInfo)||this.pixelType!==this.serviceRasterInfo.pixelType)&&(t[r]=fe.toJSON(e))}readVersion(e,t){let r=t.currentVersion;return r||(r=t.hasOwnProperty("fields")||t.hasOwnProperty("timeInfo")?10:9.3),r}applyFilter(e){let t=e;return this.pixelFilter&&(t=this._clonePixelData(e),this.pixelFilter(t)),t}async applyRenderer(e,t){let r=e;if(!this._isPicture()&&this.renderer&&this._symbolizer&&!this.pixelFilter){const i=JSON.stringify(this._cachedRendererJson)!==JSON.stringify(this.renderer.toJSON()),s=this._rasterJobHandler.instance,{bandIds:n}=this;if(s){i&&(this._symbolizer.bind(),await s.updateSymbolizer(this._symbolizer,t),this._cachedRendererJson=this.renderer.toJSON());const a=await s.symbolize({bandIds:n,...e},t);r={extent:e.extent,pixelBlock:a}}else r={extent:e.extent,pixelBlock:this._symbolizer.symbolize({bandIds:n,...e})}}return r}destroy(){this._shutdownJobHandler()}increaseRasterJobHandlerUsage(){this._rasterJobHandler.refCount++}decreaseRasterJobHandlerUsage(){this._rasterJobHandler.refCount--,this._rasterJobHandler.refCount<=0&&this._shutdownJobHandler()}async computeAngles(e,t){if(await this._fetchCapabilities(null==t?void 0:t.signal),!this.capabilities.operations.supportsComputeAngles)throw new a("imagery-layer:compute-angles","this operation is not supported on the input image service");return e=y(oe,e).clone(),B(this.url,e,this._getRequestOptions(t))}async computePixelSpaceLocations(e,t){if(await this._fetchCapabilities(null==t?void 0:t.signal),!this.capabilities.operations.supportsComputePixelLocation)throw new a("imagery-layer:compute-pixel-space-locations","this operation is not supported on the input image service");return e=y(pe,e).clone(),G(this.url,e,this._getRequestOptions(t))}async computeHistograms(e,t){if(await this._fetchCapabilities(null==t?void 0:t.signal),!this.capabilities.operations.supportsComputeHistograms)throw new a("imagery-layer:compute-histograms","this operation is not supported on the input image service");e=y(le,e).clone();const{raster:r,mosaicRule:i,renderingRule:s}=this;return s&&null==e.renderingRule&&(e.renderingRule=s),i&&null==e.mosaicRule&&(e.mosaicRule=i),r&&null==e.raster&&(e.raster=r),W(this.url,e,this._getRequestOptions(t))}async computeStatisticsHistograms(e,t){if(await this._fetchCapabilities(null==t?void 0:t.signal),!this.capabilities.operations.supportsComputeStatisticsHistograms)throw new a("imagery-layer:compute-statistics-histograms","this operation is not supported on the input image service");e=y(le,e).clone();const{raster:r,mosaicRule:i,renderingRule:s}=this;return s&&null==e.renderingRule&&(e.renderingRule=s),i&&null==e.mosaicRule&&(e.mosaicRule=i),r&&null==e.raster&&(e.raster=r),X(this.url,e,this._getRequestOptions(t))}getField(e){const{fieldsIndex:t}=this;return p(t)?t.get(e):void 0}getFieldDomain(e,t){const r=this.getField(e);return r?r.domain:null}fetchImage(e,t,r,i={}){if(null==e||null==t||null==r)return Promise.reject(new a("imagery-layer:fetch-image","Insufficient parameters for requesting an image. A valid extent, width and height values are required."));const s=this.renderer||this._symbolizer?this.generateRasterInfo(this.renderingRule,{signal:i.signal}):null;return d(s).then((s=>{s&&(this.rasterInfo=s);const n={imageServiceParameters:this.getExportImageServiceParameters(e,t,r,i.timeExtent),imageProps:{extent:e,width:t,height:r,format:this.format},requestAsImageElement:i.requestAsImageElement&&!this.pixelFilter||!1,signal:i.signal};return this._requestArrayBuffer(n)}))}fetchKeyProperties(e){return n(this.parsedUrl.path+"/keyProperties",{query:this._getQueryParams({renderingRule:this.version>=10.3?null==e?void 0:e.renderingRule:null})}).then((e=>e.data))}fetchRasterAttributeTable(e){return this.version<10.1?Promise.reject(new a("#fetchRasterAttributeTable()","Failed to get rasterAttributeTable")):n(this.parsedUrl.path+"/rasterAttributeTable",{query:this._getQueryParams({renderingRule:this.version>=10.3?null==e?void 0:e.renderingRule:null})}).then((e=>ae.fromJSON(e.data)))}async getCatalogItemRasterInfo(e,t){const r=n(this.parsedUrl.path+"/"+e+"/info",{query:this._getQueryParams(),...t}).then((e=>e.data)),i=n(this.parsedUrl.path+"/"+e+"/info/keyProperties",{query:this._getQueryParams(),...t}).then((e=>e.data)).catch((()=>{})),s=await Promise.all([r,i]);if(!s[0])return;const a=ee.fromJSON(s[0].extent),o=s[0].statistics?s[0].statistics.map((e=>({min:e[0],max:e[1],avg:e[2],stddev:e[3]}))):null;return new q({bandCount:s[0].bandCount,extent:a,spatialReference:a.sr,pixelSize:new te({x:s[0].pixelSizeX,y:s[0].pixelSizeY,spatialReference:a.sr}),pixelType:s[0].pixelType.toLowerCase(),statistics:o,histograms:s[0].histograms,keyProperties:s[1]||{}})}async getCatalogItemICSInfo(e,t){const{data:r}=await n(this.parsedUrl.path+"/"+e+"/info/ics",{query:this._getQueryParams(),...t}),i=r&&r.ics;if(!i)return;let s=null;try{s=(await n(this.parsedUrl.path+"/"+e+"/info",{query:this._getQueryParams(),...t})).data.extent}catch{}if(!s||!s.spatialReference)return{ics:i,icsToPixelTransform:null,icsExtent:null,northDirection:null};const a=this.version>=10.7?n(this.parsedUrl.path+"/"+e+"/info/icstopixel",{query:this._getQueryParams(),...t}).then((e=>e.data)).catch((()=>({}))):{},o=s.spatialReference,l={geometries:JSON.stringify({geometryType:"esriGeometryEnvelope",geometries:[s]}),inSR:o.wkid||JSON.stringify(o),outSR:"0:"+e},u=n(this.parsedUrl.path+"/project",{query:this._getQueryParams(l),...t}).then((e=>e.data)).catch((()=>({}))),p=5,c=(s.xmin+s.xmax)/2,m=(s.ymax-s.ymin)/(p+1),d=s.ymin+m,h=[];for(let n=0;n<p;n++)h.push({x:c,y:d+m*n});const f={geometries:JSON.stringify({geometryType:"esriGeometryPoint",geometries:h}),inSR:o.wkid||JSON.stringify(o),outSR:"0:"+e},y=n(this.parsedUrl.path+"/project",{query:this._getQueryParams(f),...t}).then((e=>e.data)).catch((()=>({}))),g=await Promise.all([a,u,y]);let R=g[0].ipxf;if(null==R){var v,x,b;const e=null==(v=i.geodataXform)?void 0:v.xf_0;"topup"===(null==e||null==(x=e.name)?void 0:x.toLowerCase())&&6===(null==e||null==(b=e.coefficients)?void 0:b.length)&&(R={affine:{name:"ics [sensor: Frame] to pixel (column, row) transformation",coefficients:e.coefficients,cellsizeRatio:0,type:"GeometricXform"}})}const S=ee.fromJSON(g[1]&&g[1].geometries&&g[1].geometries[0]);S&&(S.spatialReference=new de({wkid:0,imageCoordinateSystem:i}));const I=g[2].geometries?g[2].geometries.filter((e=>null!=e&&null!=e.x&&null!=e.y&&"NaN"!==e.x&&"NaN"!==e.y)):[],_=I.length;if(_<3)return{ics:i,icsToPixelTransform:R,icsExtent:S,northDirection:null};let w=0,F=0,O=0,D=0;for(let n=0;n<_;n++)w+=I[n].x,F+=I[n].y,O+=I[n].x*I[n].x,D+=I[n].x*I[n].y;const P=(_*D-w*F)/(_*O-w*w);let T=0;const j=I[p-1].x>I[0].x,N=I[p-1].y>I[0].y;return P===1/0?T=N?90:270:0===P?T=j?0:180:P>0?T=j?180*Math.atan(P)/Math.PI:180*Math.atan(P)/Math.PI+180:P<0&&(T=N?180+180*Math.atan(P)/Math.PI:360+180*Math.atan(P)/Math.PI),{ics:i,icsToPixelTransform:R,icsExtent:S,northDirection:T}}async generateRasterInfo(e,t){var r;if((!e||"none"===(null==e||null==(r=e.functionName)?void 0:r.toLowerCase())||this._isVectorFieldResampleFunction(e))&&p(this.serviceRasterInfo))return this.serviceRasterInfo;const i=Re(e);if(this._functionRasterInfos[i])return this._functionRasterInfos[i];const s=this._generateRasterInfo(e,t);this._functionRasterInfos[i]=s;try{return await s}catch{return this._functionRasterInfos[i]=null,null}}getExportImageServiceParameters(e,t,r,i){var s;e=e.clone().shiftCentralMeridian();const n=Y(e.spatialReference,this.parsedUrl.path);p(this.serviceRasterInfo)&&this.pixelType!==this.serviceRasterInfo.pixelType&&(this.exportImageServiceParameters.pixelType=this.pixelType);const a=this.exportImageServiceParameters.toJSON(),{bandIds:o,noData:l}=a;let{renderingRule:u}=a;const c=!this.renderer||"raster-stretch"===this.renderer.type;if(null!=o&&o.length&&this._hasRenderingRule(this.renderingRule)&&c){const e={rasterFunction:"ExtractBand",rasterFunctionArguments:{BandIds:o}};if("Stretch"===u.rasterFunction)e.rasterFunctionArguments.Raster=u.rasterFunctionArguments.Raster,u.rasterFunctionArguments.Raster=e;else if("Colormap"===u.rasterFunction){const t=u.rasterFunctionArguments.Raster;"Stretch"===(null==t?void 0:t.rasterFunction)?(e.rasterFunctionArguments.Raster=t.rasterFunctionArguments.Raster,t.rasterFunctionArguments.Raster=e):(e.rasterFunctionArguments.Raster=t,u.rasterFunctionArguments.Raster=e)}else e.rasterFunctionArguments.Raster=u,u=e;a.bandIds=void 0}else a.bandIds=null==o?void 0:o.join(",");l instanceof Array&&l.length>0&&(a.noData=l.join(","));const m=this._serviceSupportsMosaicRule?this._combineMosaicRuleWithTimeExtent(this.exportImageServiceParameters.mosaicRule,i):null;a.mosaicRule=m&&JSON.stringify(m),a.renderingRule=u&&null!=(s=u)&&s.rasterFunctionDefinition?JSON.stringify(u.rasterFunctionDefinition):JSON.stringify(u);const d={};if(i){const{start:e,end:t}=i.toJSON();e&&t&&e===t?d.time=""+e:null==e&&null==t||(d.time=`${null==e?"null":e},${null==t?"null":t}`)}return{bbox:e.xmin+","+e.ymin+","+e.xmax+","+e.ymax,bboxSR:n,imageSR:n,size:t+","+r,...a,...d}}async getSamples(e,t){if(await this._fetchCapabilities(null==t?void 0:t.signal),!this.capabilities.operations.supportsGetSamples)throw new a("imagery-layer:get-samples","getSamples operation is not supported on the input image service");e=y(ce,e).clone();const{raster:r}=this;return r&&null==e.raster&&(e.raster=r),K(this.url,e,this._getRequestOptions(t))}async identify(e,t){if(await this._fetchCapabilities(null==t?void 0:t.signal),!this.capabilities.operations.supportsIdentify)throw new a("imagery-layer:query-rasters","query operation is not supported on the input image service");e=y(ue,e).clone();const{raster:r,mosaicRule:i,renderingRule:s}=this;if(s&&null==e.renderingRule&&(e.renderingRule=s),i&&null==e.mosaicRule){const t=this._combineMosaicRuleWithTimeExtent(i,e.timeExtent);e.mosaicRule=m(t)}return r&&null==e.raster&&(e.raster=r),$(this.url,e,this._getRequestOptions(t))}createQuery(){const e=new ie;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)),se(this.url,e,t)}async queryRasterCount(e,t){return({query:e,requestOptions:t}=await this._prepareForQuery(e,t)),Z(this.url,e,t)}async queryVisibleRasters(e,t){if(!e)throw new a("imagery-layer: query-visible-rasters","missing query parameter");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 m="raster.servicepixelvalue",d=this.rasterFunctionNamesIndex;if(p(e.outFields)&&(o=e.outFields.some((e=>-1===e.toLowerCase().indexOf(m))),this.version>=10.4)){const t=e.outFields.filter((e=>e.toLowerCase().indexOf(m)>-1&&e.length>m.length)).map((e=>{const t=e.slice(m.length+1);return[this._updateRenderingRulesFunctionName(t,d),t]}));l=t.map((e=>new J({functionName:e[0]}))),u=t.map((e=>e[1])),0===l.length?this.renderingRule?(l.push(this.renderingRule),u.push(this.renderingRule.functionName)):l=null:this.renderingRule&&!l.some((e=>e.functionName===this.renderingRule.functionName))&&(l.push(this.renderingRule),u.push(this.renderingRule.functionName))}const h=c(e.outSpatialReference)||e.outSpatialReference.equals(this.spatialReference),f=e.timeExtent||this.timeExtent,y=this._combineMosaicRuleWithTimeExtent(this.exportImageServiceParameters.mosaicRule,f),g=this._getQueryParams({geometry:e.geometry,timeExtent:f,mosaicRule:y,renderingRule:this.version<10.4?this.renderingRule:null,renderingRules:l,pixelSize:r,returnCatalogItems:o,returnGeometry:h,raster:this.raster,maxItemCount:s?1:null});delete g.f;const R=new ue(g);try{var v,x;await this.generateRasterInfo(this.renderingRule);const r=await $(this.url,R,{signal:null==t?void 0:t.signal,query:{...this.customParameters}}),s=e.outFields,a=r.value.toLowerCase().indexOf("nodata")>-1;if(!(o&&!h&&(null==r||null==(v=r.catalogItems)?void 0:v.features.length)&&(n||!a)))return this._processVisibleRastersResponse(r,{returnDomainValues:i,templateRRFunctionNames:u,showNoDataRecords:n,templateFields:s});const l=this.objectIdField||"ObjectId",c=r.catalogItems.features,m=c.map((e=>{var t;return null==(t=e.attributes)?void 0:t[l]})),d=new ie({objectIds:m,returnGeometry:!0,outSpatialReference:e.outSpatialReference,outFields:[l]}),f=await this.queryRasters(d);return null!=f&&null!=(x=f.features)&&x.length&&f.features.forEach((t=>{c.forEach((r=>{r.attributes[l]===t.attributes[l]&&(r.geometry=new re(t.geometry),p(e.outSpatialReference)&&(r.geometry.spatialReference=e.outSpatialReference))}))})),this._processVisibleRastersResponse(r,{returnDomainValues:i,templateRRFunctionNames:u,showNoDataRecords:n,templateFields:s})}catch{throw new a("imagery-layer:query-visible-rasters","encountered error when querying visible rasters")}}async fetchVariableStatisticsHistograms(e,t){const r=n(this.parsedUrl.path+"/statistics",{query:this._getQueryParams({variable:e}),signal:t}).then((e=>{var t;return null==(t=e.data)?void 0:t.statistics})),i=n(this.parsedUrl.path+"/histograms",{query:this._getQueryParams({variable:e}),signal:t}).then((e=>{var t;return null==(t=e.data)?void 0:t.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 createStreamlinesMesh(e,t){const r=this._rasterJobHandler.instance;return r?r.createStreamlinesMesh(e,t):me(e.rendererSettings,e.flowData,p(t.signal)?t.signal:(new AbortController).signal)}async _fetchService(e){await this._fetchServiceInfo(e),p(this.serviceRasterInfo)&&!this.rasterInfo&&(this.rasterInfo=this.serviceRasterInfo);const t=this.sourceJSON,r=p(this.serviceRasterInfo)?Promise.resolve(this.serviceRasterInfo):this._fetchAuxiliaryRasterInfo({serviceInfo:t,signal:e}).then((e=>(this._set("serviceRasterInfo",e),e))),i=this._hasRenderingRule(this.renderingRule)?this.generateRasterInfo(this.renderingRule,{signal:e}):null,s=this._getRasterFunctionInfos();return Promise.all([r,i,s]).then((e=>{e[1]?this._set("rasterInfo",e[1]):this._set("rasterInfo",e[0]),e[2]&&this._set("rasterFunctionInfos",e[2]),this.renderer&&!this._isSupportedRenderer(this.renderer)&&(this.renderer=null,he.warn("ArcGISImageService","Switching to the default renderer. Renderer applied is not valid for this Imagery Layer")),this._configDefaultRenderer(),this.watch("renderer",(()=>this._configDefaultRenderer())),this.watch("renderingRule",(e=>{(this.renderer||this._symbolizer||this.popupEnabled&&this.popupTemplate)&&this.generateRasterInfo(e).then((e=>{e&&(this.rasterInfo=e)}))}));const t=p(this.serviceRasterInfo)&&this.serviceRasterInfo.multidimensionalInfo;t&&this._updateMultidimensionalDefinition(t)}))}_combineMosaicRuleWithTimeExtent(e,t){const r=this.timeInfo;if(c(e)||c(this.multidimensionalInfo)||c(t)||c(null==r?void 0:r.startField))return e;const{startField:i}=r;var s;if(e=e.clone(),"mosaic-dataset"===this._serviceSourceType)return e.multidimensionalDefinition=null==(s=e.multidimensionalDefinition)?void 0:s.filter((e=>e.dimensionName!==i)),this._cleanupMultidimensionalDefinition(e);e.multidimensionalDefinition=e.multidimensionalDefinition||[];const n=e.multidimensionalDefinition.filter((e=>e.dimensionName===i)),a=p(t.start)?t.start.getTime():null,o=p(t.end)?t.end.getTime():null,l=null==a||null==o||a===o,u=l?[a||o]:[[a,o]],m=this.version>=10.8;if(n.length)n.forEach((e=>{e.dimensionName===i&&(m?(e.dimensionName=null,e.isSlice=null,e.values=null):(e.isSlice=l,e.values=u))}));else if(!m){const t=e.multidimensionalDefinition.filter((e=>null!=e.variableName&&null==e.dimensionName));t.length?t.forEach((e=>{e.dimensionName=i,e.isSlice=l,e.values=u})):e.multidimensionalDefinition.push(new F({variableName:"",dimensionName:i,isSlice:l,values:u}))}return this._cleanupMultidimensionalDefinition(e)}_cleanupMultidimensionalDefinition(e){return c(e)?null:(e.multidimensionalDefinition&&(e.multidimensionalDefinition=e.multidimensionalDefinition.filter((e=>!(!e.variableName&&!e.dimensionName))),0===e.multidimensionalDefinition.length&&(e.multidimensionalDefinition=null)),"mosaic-dataset"!==this._serviceSourceType&&null==e.multidimensionalDefinition?null:e)}async _prepareForQuery(e,t){var r;if(await this._fetchCapabilities(null==(r=t)?void 0:r.signal),!this.capabilities.operations.supportsQuery)throw new a("imagery-layer:query-rasters","query operation is not supported on the input image service");return e=p(e)?y(ie,e):this.createQuery(),t=this._getRequestOptions(t),this.raster&&(t.query={...t.query,raster:this.raster}),{query:e,requestOptions:t}}async _initJobHandler(){if(null!=this._rasterJobHandler.connectionPromise)return this._rasterJobHandler.connectionPromise;const e=new V;this._rasterJobHandler.connectionPromise=e.initialize().then((()=>{this._rasterJobHandler.instance=e}),(()=>null)),await this._rasterJobHandler.connectionPromise}_shutdownJobHandler(){this._rasterJobHandler.instance&&this._rasterJobHandler.instance.destroy(),this._rasterJobHandler.instance=null,this._rasterJobHandler.connectionPromise=null,this._rasterJobHandler.refCount=0}_isSupportedRenderer(e){const{rasterInfo:t,renderingRule:r}=this;return"unique-value"===e.type&&this._hasRenderingRule(r)&&1===t.bandCount&&["u8","s8"].includes(t.pixelType)||Q(this.rasterInfo).includes(this.renderer.type)}async _fetchCapabilities(e){return this.capabilities||await this._fetchServiceInfo(e),this.capabilities}async _fetchServiceInfo(e){var t;let r=this.sourceJSON;if(!r){const{data:t,ssl:i}=await n(this.parsedUrl.path,{query:this._getQueryParams(),signal:e});r=t,this.sourceJSON=r,i&&(this.url=this.url.replace(/^http:/i,"https:"))}if((null==(t=r.capabilities)?void 0:t.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(r,{origin:"service",url:this.parsedUrl})}_isMosaicDataset(e){var t;return e.serviceSourceType?"esriImageServiceSourceTypeMosaicDataset"===e.serviceSourceType:(null==(t=e.fields)?void 0:t.length)>0}_isMosaicRuleSupported(e){var t;if(!e)return!1;const r=this._isMosaicDataset(e),i=e.currentVersion>=10.71&&e.hasMultidimensions&&e.timeInfo&&!(e.objectIdField&&(null==(t=e.fields)?void 0:t.length)>1);return r||i}_isVectorFieldResampleFunction(e){if(!p(e))return!1;const{functionName:t,functionArguments:r}=e,i="resample"===(null==t?void 0:t.toLowerCase()),s=(null==r?void 0:r.ResampleType)||(null==r?void 0:r.resampleType);return i&&(7===s||10===s)}_isPicture(){return!this.format||this.format.indexOf("jpg")>-1||this.format.indexOf("png")>-1}_configDefaultRenderer(){if(!this._isPicture()&&!this.pixelFilter){if(!this.bandIds&&this.rasterInfo.bandCount>=3){const e=U(this.rasterInfo);!e||3===this.rasterInfo.bandCount&&0===e[0]&&1===e[1]&&2===e[2]||(this.bandIds=e)}var e,t;if(!this.renderer)this.renderer=H(this.rasterInfo,{bandIds:this.bandIds,variableName:this.renderingRule?null:null==(e=this.mosaicRule)||null==(t=e.multidimensionalDefinition)?void 0:t[0].variableName});this._symbolizer?(this._symbolizer.rendererJSON=L(this.renderer.toJSON()),this._symbolizer.rasterInfo=this.rasterInfo):this._symbolizer=new k({rendererJSON:this.renderer.toJSON(),rasterInfo:this.rasterInfo}),this._symbolizer.bind().success||(this._symbolizer=null)}}_clonePixelData(e){return null==e?e:{extent:e.extent&&e.extent.clone(),pixelBlock:p(e.pixelBlock)&&e.pixelBlock.clone()}}_getQueryParams(e){p(null==e?void 0: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:{...null==e?void 0:e.query,...this.customParameters}}}_decodePixelBlock(e,t,r){return this._rasterJobHandler.instance?this._rasterJobHandler.instance.decode({data:e,options:t}):A(e,t,r)}async _fetchMultidimensionalInfo(e){var t;const r=await n(this.parsedUrl.path+"/multidimensionalInfo",{query:this._getQueryParams(),signal:e}).then((e=>{var t;return null==(t=e.data)?void 0:t.multidimensionalInfo}));return null!=(t=r.variables)&&t.length&&r.variables.forEach((e=>{var t;null!=(t=e.statistics)&&t.length&&e.statistics.forEach((e=>{e.avg=e.mean,e.stddev=e.standardDeviation}))})),r}async _getRasterFunctionInfos(e){const t=this.sourceJSON.rasterFunctionInfos;if(this.serviceRasterInfo)return t;if(t&&this.version>=10.3){var r;if(1===t.length&&"none"===t[0].name.toLowerCase())return t;return null==(r=(await n(this.parsedUrl.path+"/rasterFunctionInfos",{query:this._getQueryParams(),signal:e})).data)?void 0:r.rasterFunctionInfos}return null}async _fetchAuxiliaryRasterInfo(e){const t=e&&e.serviceInfo;if(!t)return Promise.reject(new a("imagery-layer:fetch-metadata","valid serviceInfo is required"));const r=e.signal,i=!!(t.hasRasterAttributeTable&&this.version>=10.1)&&n(this.parsedUrl.path+"/rasterAttributeTable",{query:this._getQueryParams({renderingRule:this.version>=10.1?null==e?void 0:e.renderingRule:null}),signal:r}).then((e=>ae.fromJSON(e.data))).catch((()=>null)),s=!!(t.hasColormap&&this.version>=10.1)&&n(this.parsedUrl.path+"/colormap",{query:this._getQueryParams({renderingRule:this.version>=10.6?null==e?void 0:e.renderingRule:null}),signal:r}).then((e=>{var t;return null==(t=e.data)?void 0:t.colormap})),o=!!(t.hasHistograms&&this.version>=10.1)&&n(this.parsedUrl.path+"/histograms",{query:this._getQueryParams({renderingRule:this.version>=10.1?null==e?void 0:e.renderingRule:null}),signal:r}).then((e=>{var t;return null==(t=e.data)?void 0:t.histograms})),l=this.version>=10.3&&n(this.parsedUrl.path+"/keyProperties",{query:this._getQueryParams({renderingRule:null==e?void 0:e.renderingRule}),signal:r}).then((e=>e.data)).catch((()=>{})),u=!!(t.hasMultidimensions&&this.version>=10.3)&&this._fetchMultidimensionalInfo(),p=await Promise.all([i,s,o,l,u]);let c=null;if(t.minValues&&t.minValues.length===t.bandCount){c=[];for(let e=0;e<t.minValues.length;e++)c.push({min:t.minValues[e],max:t.maxValues[e],avg:t.meanValues[e],stddev:t.stdvValues[e]})}const m=Math.ceil((t.extent.xmax-t.extent.xmin)/t.pixelSizeX-.1),d=Math.ceil((t.extent.ymax-t.extent.ymin)/t.pixelSizeY-.1),h=de.fromJSON(t.spatialReference||t.extent.spatialReference);return new q({width:m,height:d,bandCount:t.bandCount,extent:ee.fromJSON(t.extent),spatialReference:h,pixelSize:new te({x:t.pixelSizeX,y:t.pixelSizeY,spatialReference:h}),pixelType:t.pixelType.toLowerCase(),statistics:c,attributeTable:p[0]||null,colormap:p[1]||null,histograms:p[2]||null,keyProperties:p[3]||{},multidimensionalInfo:p[4]||null})}async _requestArrayBuffer(e){var t;const{imageProps:r,requestAsImageElement:i,signal:s}=e;if(i&&!this.pixelFilter&&(null==(t=r.format)?void 0:t.indexOf("png"))>-1){return{imageElement:(await n(this.parsedUrl.path+"/exportImage",{responseType:"image",query:this._getQueryParams({f:"image",...e.imageServiceParameters}),signal:s})).data,params:r}}const o=this._initJobHandler(),l=n(this.parsedUrl.path+"/exportImage",{responseType:"array-buffer",query:this._getQueryParams({f:"image",...e.imageServiceParameters}),signal:s}),u=(await Promise.all([l,o]))[0].data,p=r.format||"jpgpng";let c=p;if("bsq"!==c&&"bip"!==c&&(c=z(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.indexOf("png")>-1&&("png"===c||"jpg"===c)?A(u,{useCanvas:!0,...r},m):this._decodePixelBlock(u,{width:r.width,height:r.height,planes:null,pixelType:null,noDataValue:null,format:p},m);return{pixelData:{pixelBlock:await d,extent:r.extent},params:r}}async _generateRasterInfo(e,t){const{data:r}=await n(this.parsedUrl.path,{query:this._getQueryParams({renderingRule:e}),...t});return await this._fetchAuxiliaryRasterInfo({serviceInfo:r,renderingRule:e,...t})}_isValidCustomizedMosaicRule(e){var t;return e&&JSON.stringify(e.toJSON())!==JSON.stringify(null==(t=this._defaultServiceMosaicRule)?void 0:t.toJSON())}_updateMultidimensionalDefinition(e){if(this._isValidCustomizedMosaicRule(this.mosaicRule))return;const t=e.variables[0].dimensions,r="",i=[];for(const s in t)if(t.hasOwnProperty(s)){const e=t[s],n=e.extent;let a=!0,o=[n[0]];e.hasRanges&&!0===e.hasRanges?(a=!1,o=[e.values[0]]):"stdz"===e.name.toLowerCase()&&Math.abs(n[1])<=Math.abs(n[0])&&(o=[n[1]]),i.push(new F({variableName:r,dimensionName:t[s].name,isSlice:a,values:o}))}if(i.length>0){this.mosaicRule=this.mosaicRule||new j;const e=this.mosaicRule.multidimensionalDefinition;(!e||e&&e.length<=0)&&(this.mosaicRule.multidimensionalDefinition=i)}}_formatAttributeValue(e,t){if("string"==typeof e){const r=this.popupTemplate&&this.popupTemplate.fieldInfos,i=this._getFieldInfo(r,t),s=i&&i.format;if(s){let t,r;return e.trim().indexOf(",")>-1?(t=",",r=t+" ",this._formatDelimitedString(e,t,r,s)):e.trim().indexOf(" ")>-1?(t=r=" ",this._formatDelimitedString(e,t,r,s)):this._formatNumberFromString(e,s)}}return e}_getFieldInfo(e,t){if(!e||!e.length||!t)return;const r=t.toLowerCase();let i;return e.some((e=>!(!e.fieldName||e.fieldName.toLowerCase()!==r&&e.fieldName.toLowerCase()!==r.replace(/ /g,"_"))&&(i=e,!0))),i}_formatDelimitedString(e,t,r,i){return e&&t&&r&&i?e.trim().split(t).map((e=>this._formatNumberFromString(e,i))).join(r):e}_formatNumberFromString(e,t){if(!e||!t)return e;const r=Number(e);return isNaN(r)?e:t.format(r)}_processVisibleRastersResponse(e,r){r=r||{};const i=e.value,{templateRRFunctionNames:s,showNoDataRecords:n,returnDomainValues:a,templateFields:o}=r,l=e.processedValues;let u=e.catalogItems&&e.catalogItems.features,c=e.properties&&e.properties.Values&&e.properties.Values.map((e=>e.replace(/ /gi,", ")))||[];const m=this.objectIdField||"ObjectId",d="string"==typeof i&&i.toLowerCase().indexOf("nodata")>-1,h=[];if(i&&!u&&!d){const e={};e[m]=0;c=[i],u=[new t(this.fullExtent,null,e)]}if(!u)return[];let f,y,g;this._updateResponseFieldNames(u,o),d&&!n&&(u=[]);for(let t=0;t<u.length;t++){if(f=u[t],null!=i){if(y=c[t],g=this.renderingRule&&l&&l.length>0&&s&&s.length>0&&s.indexOf(this.renderingRule.functionName)>-1?l[s.indexOf(this.renderingRule.functionName)]:i,"nodata"===y.toLowerCase()&&!n)continue;const e="Raster.ItemPixelValue",r="Raster.ServicePixelValue";f.attributes[e]=this._formatAttributeValue(y,e),f.attributes[r]=this._formatAttributeValue(g,r),this._updateFeatureWithMagDirValues(f,y);const a=this.fields&&this.fields.length>0;let o=this.renderingRule&&p(this.serviceRasterInfo)&&this.serviceRasterInfo.attributeTable?a?y:i:g;this.renderingRule||(o=a?y:i),this._updateFeatureWithRasterAttributeTableValues(f,o)}if(f.sourceLayer=f.layer=this,a&&this._updateFeatureWithDomainValues(f),s&&l&&s.length===l.length)for(let e=0;e<s.length;e++){const t="Raster.ServicePixelValue."+s[e];f.attributes[t]=this._formatAttributeValue(l[e],t)}h.push(u[t])}return h}_updateFeatureWithRasterAttributeTableValues(e,t){const r=this.rasterInfo&&this.rasterInfo.attributeTable||p(this.serviceRasterInfo)&&this.serviceRasterInfo.attributeTable,i=r&&r.features;if(!i)return;const s=r.fields,n=s.map((e=>e.name)).filter((e=>"value"===e.toLowerCase())),a=n&&n[0];if(!a)return;const o=i.filter((e=>e.attributes[a]===(null!=t?parseInt(t,10):null)));o&&o[0]&&s.forEach((t=>{const r=this.rasterAttributeTableFieldPrefix+t.name;e.attributes[r]=this._formatAttributeValue(o[0].attributes[t.name],r)}))}_updateFeatureWithMagDirValues(e,t){if("esriImageServiceDataTypeVector-UV"!==this.serviceDataType&&"esriImageServiceDataTypeVector-MagDir"!==this.serviceDataType)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 N({height:1,width:1,pixelType:"f32",pixels:i,statistics:s});null!=this.pixelFilter&&this.pixelFilter({pixelBlock:n,extent:new ee(0,0,0,0,this.spatialReference)});const a="esriImageServiceDataTypeVector-MagDir"===this.serviceDataType?[n.pixels[0][0],n.pixels[1][0]]:E([n.pixels[0][0],n.pixels[1][0]]);e.attributes["Raster.Magnitude"]=a[0],e.attributes["Raster.Direction"]=a[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.filter((e=>e.code===r))[0];i&&(e.attributes[t.name]=i.name)}}))}_updateResponseFieldNames(e,t){if(!t||t.length<1)return;const r=this.fieldsIndex;p(r)&&e.forEach((e=>{if(e&&e.attributes)for(const i of t)if(r.has(i)){const t=r.get(i).name;t!==i&&(e.attributes[i]=e.attributes[t],delete e.attributes[t])}}))}_getRenderingRuleString(e){if(this._hasRenderingRule(e)){var t;let r=e.toJSON();return r=null!=(t=r.rasterFunctionDefinition)?t:r,(r.thumbnail||r.thumbnailEx)&&(r.thumbnail=r.thumbnailEx=null),JSON.stringify(r)}return null}_hasRenderingRule(e){return e&&e.functionName&&"none"!==e.functionName.toLowerCase()}_updateRenderingRulesFunctionName(e,t){if(!e||e.length<1)return;if("Raw"===e)return e.replace("Raw","None");const r=e.toLowerCase().replace(/ /gi,"_");return t.has(r)?t.get(r):e}_isRFTJson(e){return e&&e.name&&e.arguments&&e.function&&e.hasOwnProperty("functionType")}_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.indexOf("image")>-1,a="esriImageServiceDataTypeElevation"===e.serviceDataType,o=!!(e.spatialReference||e.extent&&e.extent.spatialReference),l=t.includes("edit");return{data:{supportsAttachment:!1},operations:{supportsComputeHistograms:n,supportsExportImage:n,supportsIdentify:n,supportsMeasure:t.indexOf("mensuration")>-1&&o,supportsDownload:t.indexOf("download")>-1,supportsQuery:t.indexOf("catalog")>-1&&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&&a,supportsComputePixelLocation:r>=10.7&&t.indexOf("catalog")>-1,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},query:{maxRecordCount:s,maxRecordCountFactor:void 0,supportsStatistics:!(null==i||!i.supportsStatistics),supportsOrderBy:!(null==i||!i.supportsOrderBy),supportsDistinct:!(null==i||!i.supportsDistinct),supportsPagination:!(null==i||!i.supportsPagination),supportsStandardizedQueriesOnly:!(null==i||!i.useStandardizedQueries),supportsPercentileStatistics:!(null==i||!i.supportsPercentileStatistics),supportsCentroid:!(null==i||!i.supportsReturningGeometryCentroid),supportsDistance:!(null==i||!i.supportsQueryWithDistance),supportsExtent:!(null==i||!i.supportsReturningQueryExtent),supportsGeometryProperties:!(null==i||!i.supportsReturningGeometryProperties),supportsHavingClause:!(null==i||!i.supportsHavingClause),supportsQuantization:!1,supportsQuantizationEditMode:!1,supportsQueryGeometry:!1,supportsResultType:!1,supportsMaxRecordCountFactor:!1,supportsSqlExpression:!1,supportsTopFeaturesQuery:!1,supportsQueryByOthers:!1,supportsHistoricMoment:!1,supportsFormatPBF:!1,supportsDisjointSpatialRelationship:!1,supportsCacheHint:!1,supportsSpatialAggregationStatistics:!1,supportedSpatialAggregationStatistics:{envelope:!1,centroid:!1,convexHull:!1},standardMaxRecordCount:void 0,tileMaxRecordCount:void 0}}}};return e([v()],u.prototype,"_functionRasterInfos",void 0),e([v()],u.prototype,"_rasterJobHandler",void 0),e([v()],u.prototype,"_symbolizer",void 0),e([v({dependsOn:["_serviceSupportsMosaicRule"]})],u.prototype,"_defaultServiceMosaicRule",void 0),e([b("_defaultServiceMosaicRule",["defaultMosaicMethod"])],u.prototype,"readDefaultServiceMosaicRule",null),e([v()],u.prototype,"_cachedRendererJson",void 0),e([v({readOnly:!0})],u.prototype,"_serviceSourceType",void 0),e([b("_serviceSourceType",["serviceSourceType","fields"])],u.prototype,"readServiceSourceType",null),e([v({readOnly:!0})],u.prototype,"_serviceSupportsMosaicRule",void 0),e([b("_serviceSupportsMosaicRule",["currentVersion","fields"])],u.prototype,"readServiceSupportsMosaicRule",null),e([v()],u.prototype,"rasterAttributeTableFieldPrefix",void 0),e([v({readOnly:!0})],u.prototype,"rasterFunctionNamesIndex",null),e([v()],u.prototype,"adjustAspectRatio",void 0),e([v({readOnly:!0}),f("serviceRasterInfo.bandCount")],u.prototype,"bandCount",void 0),e([v({type:[g],json:{write:!0}})],u.prototype,"bandIds",void 0),e([b("bandIds")],u.prototype,"readBandIds",null),e([v({readOnly:!0,json:{read:!1}})],u.prototype,"capabilities",void 0),e([b("service","capabilities",["capabilities","currentVersion","serviceDataType"])],u.prototype,"readCapabilities",null),e([v({type:Number})],u.prototype,"compressionQuality",void 0),e([I("compressionQuality")],u.prototype,"writeCompressionQuality",null),e([v({type:Number})],u.prototype,"compressionTolerance",void 0),e([I("compressionTolerance")],u.prototype,"writeCompressionTolerance",null),e([v({json:{read:{source:"copyrightText"}}})],u.prototype,"copyright",void 0),e([v({type:String,json:{name:"layerDefinition.definitionExpression",write:{enabled:!0,allowNull:!0}}})],u.prototype,"definitionExpression",void 0),e([v({readOnly:!0,constructOnly:!0})],u.prototype,"exportImageServiceParameters",void 0),e([v()],u.prototype,"rasterInfo",void 0),e([v({readOnly:!0,type:[D]})],u.prototype,"fields",void 0),e([v({readOnly:!0})],u.prototype,"fieldsIndex",null),e([v({type:["png","png8","png24","png32","jpg","bmp","gif","jpgpng","lerc","tiff"],json:{write:!0}})],u.prototype,"format",null),e([b("service","format",["serviceDataType"])],u.prototype,"readFormat",null),e([v({type:ee})],u.prototype,"fullExtent",void 0),e([v({readOnly:!0})],u.prototype,"hasMultidimensions",void 0),e([v({json:{read:{source:"maxImageHeight"}}})],u.prototype,"imageMaxHeight",void 0),e([v({json:{read:{source:"maxImageWidth"}}})],u.prototype,"imageMaxWidth",void 0),e([v({type:String,json:{type:C.jsonValues,read:C.read,write:C.write}})],u.prototype,"interpolation",void 0),e([v()],u.prototype,"minScale",void 0),e([b("service","minScale")],u.prototype,"readMinScale",null),e([v()],u.prototype,"maxScale",void 0),e([b("service","maxScale")],u.prototype,"readMaxScale",null),e([v({type:j})],u.prototype,"mosaicRule",null),e([b("mosaicRule",["mosaicRule","defaultMosaicMethod"])],u.prototype,"readMosaicRule",null),e([I("mosaicRule")],u.prototype,"writeMosaicRule",null),e([v({readOnly:!0}),f("serviceRasterInfo.multidimensionalInfo")],u.prototype,"multidimensionalInfo",void 0),e([v({json:{type:g}})],u.prototype,"noData",void 0),e([I("noData")],u.prototype,"writeNoData",null),e([v({type:String,json:{type:M.jsonValues,read:M.read,write:M.write}})],u.prototype,"noDataInterpretation",void 0),e([v({type:String,readOnly:!0,json:{read:{source:["fields"]}}})],u.prototype,"objectIdField",void 0),e([b("objectIdField")],u.prototype,"readObjectIdField",null),e([v({})],u.prototype,"geometryType",void 0),e([v({})],u.prototype,"typeIdField",void 0),e([v({})],u.prototype,"types",void 0),e([v({readOnly:!0})],u.prototype,"parsedUrl",null),e([v({readOnly:!0}),f("serviceRasterInfo.pixelSize.x")],u.prototype,"pixelSizeX",void 0),e([v({readOnly:!0}),f("serviceRasterInfo.pixelSize.y")],u.prototype,"pixelSizeY",void 0),e([v({type:Function})],u.prototype,"pixelFilter",void 0),e([v()],u.prototype,"raster",void 0),e([v()],u.prototype,"viewId",void 0),e([v({types:i,json:{name:"layerDefinition.drawingInfo.renderer",origins:{"web-scene":{types:s,name:"layerDefinition.drawingInfo.renderer",write:{overridePolicy:e=>({enabled:e&&"vector-field"!==e.type&&"animated-flow"!==e.type})}}}}})],u.prototype,"renderer",void 0),e([b("renderer")],u.prototype,"readRenderer",null),e([I("renderer")],u.prototype,"writeRenderer",null),e([v(_)],u.prototype,"opacity",void 0),e([v({readOnly:!0}),f("serviceRasterInfo.attributeTable")],u.prototype,"rasterAttributeTable",void 0),e([v({readOnly:!0})],u.prototype,"rasterFields",null),e([v({constructOnly:!0})],u.prototype,"rasterFunctionInfos",void 0),e([v({type:J})],u.prototype,"renderingRule",null),e([b("renderingRule",["renderingRule","rasterFunctionInfos"])],u.prototype,"readRenderingRule",null),e([I("renderingRule")],u.prototype,"writeRenderingRule",null),e([v()],u.prototype,"serviceDataType",void 0),e([v({readOnly:!0,type:de})],u.prototype,"spatialReference",void 0),e([b("spatialReference",["spatialReference","extent"])],u.prototype,"readSpatialReference",null),e([v({json:{type:fe.jsonValues}})],u.prototype,"pixelType",void 0),e([b("pixelType")],u.prototype,"readPixelType",null),e([I("pixelType")],u.prototype,"writePixelType",null),e([v({constructOnly:!0,type:q})],u.prototype,"serviceRasterInfo",void 0),e([v()],u.prototype,"sourceJSON",void 0),e([v(w)],u.prototype,"url",void 0),e([v({readOnly:!0})],u.prototype,"version",void 0),e([b("version",["currentVersion","fields","timeInfo"])],u.prototype,"readVersion",null),u=e([S("esri.layers.mixins.ArcGISImageService")],u),u};export{ve as ArcGISImageService};
5
+ import{_ as e}from"../../chunks/tslib.es6.js";import"../../geometry.js";import t from"../../Graphic.js";import{read as r,rasterRendererTypes as i,websceneRasterRendererTypes as s}from"../../rasterRenderers.js";import n from"../../request.js";import a from"../../core/Error.js";import{strict as o}from"../../core/jsonMap.js";import{clone as l}from"../../core/lang.js";import u from"../../core/Logger.js";import{isSome as p,isNone as c,unwrap as m}from"../../core/maybe.js";import{when as d}from"../../core/promiseUtils.js";import{urlToObject as h}from"../../core/urlUtils.js";import{aliasOf as f}from"../../core/accessorSupport/decorators/aliasOf.js";import{ensureClass as y,Integer as g,ensureNumber as R}from"../../core/accessorSupport/ensureType.js";import{property as v,ensureRange as x}from"../../core/accessorSupport/decorators/property.js";import{reader as b}from"../../core/accessorSupport/decorators/reader.js";import{subclass as S}from"../../core/accessorSupport/decorators/subclass.js";import{writer as I}from"../../core/accessorSupport/decorators/writer.js";import{opacity as w,url as _}from"../support/commonProperties.js";import F from"../support/DimensionalDefinition.js";import{ExportImageServiceParameters as O}from"../support/ExportImageServiceParameters.js";import D from"../support/Field.js";import P from"../support/FieldsIndex.js";import{isSupportedRendererType as T}from"../support/imageryRendererUtils.js";import j from"../support/MosaicRule.js";import N from"../support/PixelBlock.js";import{interpolationKebab as C,noDataInterpretationKebab as M}from"../support/rasterEnums.js";import J from"../support/RasterFunction.js";import q from"../support/RasterInfo.js";import V from"../support/RasterJobHandler.js";import{decode as A,getFormat as z}from"../support/rasterFormats/RasterCodec.js";import{uvComponentToVector as E}from"../support/rasterFunctions/vectorFieldUtils.js";import{getSupportedRendererTypes as Q,getDefaultBandCombination as U,createDefaultRenderer as H,normalizeRendererJSON as L}from"../../renderers/support/rasterRendererHelper.js";import k from"../../renderers/support/RasterSymbolizer.js";import{computeAngles as B,computePixelSpaceLocations as G,computeHistograms as W,computeStatisticsHistograms as X,getImageSpatialReferenceQueryParameter as Y,getSamples as K,identify as $}from"../../rest/imageService.js";import"../../core/unitUtils.js";import"../../kernel.js";import"../../rest/query/support/AttachmentInfo.js";import"../../rest/support/AttachmentQuery.js";import{executeForCount as Z}from"../../rest/query/executeForCount.js";import ee from"../../geometry/Extent.js";import"../../geometry/Geometry.js";import"../../geometry/Multipoint.js";import te from"../../geometry/Point.js";import re from"../../geometry/Polygon.js";import"../../geometry/Polyline.js";import"../../geometry/support/normalizeUtils.js";import"../support/arcgisLayerUrl.js";import"../../core/pbf.js";import"../../geometry/support/spatialReferenceUtils.js";import ie from"../../rest/support/Query.js";import{executeForIds as se}from"../../rest/query/executeForIds.js";import{executeQueryJSON as ne}from"../../rest/query/executeQueryJSON.js";import"../../core/has.js";import"../graphics/featureConversionUtils.js";import ae from"../../rest/support/FeatureSet.js";import"../../rest/support/RelationshipQuery.js";import"../../rest/support/TopFeaturesQuery.js";import oe from"../../rest/support/ImageAngleParameters.js";import le from"../../rest/support/ImageHistogramParameters.js";import ue from"../../rest/support/ImageIdentifyParameters.js";import pe from"../../rest/support/ImagePixelLocationParameters.js";import ce from"../../rest/support/ImageSampleParameters.js";import{createStreamlinesMesh as me}from"../../views/2d/engine/flow/dataUtils.js";import de from"../../geometry/SpatialReference.js";const he=u.getLogger("esri.layers.mixins.ArcGISImageService"),fe=o()({U1:"u1",U2:"u2",U4:"u4",U8:"u8",S8:"s8",U16:"u16",S16:"s16",U32:"u32",S32:"s32",F32:"f32",F64:"f64",C64:"c64",C128:"c128",UNKNOWN:"unknown"}),ye=new Set(["png","png8","png24","png32","jpg","bmp","gif","jpgpng","lerc","tiff"]),ge=x(R,{min:0,max:255});function Re(e){if(!e)return null;const t=JSON.stringify(e).match(/"rasterFunction":"(.*?")/gi),r=null==t?void 0:t.map((e=>e.replace('"rasterFunction":"',"").replace('"',"")));return r?r.join("/"):null}const ve=o=>{let u=class extends o{constructor(){super(...arguments),this._functionRasterInfos={},this._rasterJobHandler={instance:null,refCount:0,connectionPromise:null},this._defaultServiceMosaicRule=null,this._serviceSourceType=null,this._serviceSupportsMosaicRule=null,this.rasterAttributeTableFieldPrefix="Raster.",this.adjustAspectRatio=null,this.bandCount=null,this.bandIds=void 0,this.capabilities=null,this.compressionQuality=void 0,this.compressionTolerance=.01,this.copyright=null,this.definitionExpression=null,this.exportImageServiceParameters=null,this.rasterInfo=null,this.fields=null,this.fullExtent=null,this.hasMultidimensions=!1,this.imageMaxHeight=4100,this.imageMaxWidth=4100,this.interpolation=void 0,this.minScale=0,this.maxScale=0,this.multidimensionalInfo=null,this.noData=null,this.noDataInterpretation=void 0,this.objectIdField=null,this.geometryType="polygon",this.typeIdField=null,this.types=[],this.pixelSizeX=null,this.pixelSizeY=null,this.pixelFilter=null,this.raster=void 0,this.viewId=void 0,this.renderer=null,this.symbolizer=null,this.rasterAttributeTable=null,this.rasterFunctionInfos=null,this.serviceDataType=null,this.spatialReference=null,this.pixelType=null,this.serviceRasterInfo=null,this.sourceJSON=null,this.url=null,this.version=null}initialize(){this._set("exportImageServiceParameters",new O({layer:this}))}readDefaultServiceMosaicRule(e,t){return this._serviceSupportsMosaicRule?j.fromJSON(t):null}readServiceSourceType(e,t){return this._isMosaicDataset(t)?"mosaic-dataset":"raster-dataset"}readServiceSupportsMosaicRule(e,t){return this._isMosaicRuleSupported(t)}get rasterFunctionNamesIndex(){const e=new Map;return!this.rasterFunctionInfos||p(this.rasterFunctionInfos)&&this.rasterFunctionInfos.length<1||p(this.rasterFunctionInfos)&&this.rasterFunctionInfos.forEach((t=>{e.set(t.name.toLowerCase().replace(/ /gi,"_"),t.name)})),e}readBandIds(e,t){if(Array.isArray(e)&&e.length>0&&e.every((e=>"number"==typeof e)))return e}readCapabilities(e,t){return this._readCapabilities(t)}writeCompressionQuality(e,t,r){null!=e&&"lerc"!==this.format&&(t[r]=e)}writeCompressionTolerance(e,t,r){"lerc"===this.format&&null!=e&&(t[r]=e)}get fieldsIndex(){return this.fields?new P(this.fields):null}set format(e){e&&ye.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]=ge(e))}readObjectIdField(e,t){if(!e){const r=t.fields.filter((e=>"esriFieldTypeOID"===e.type||"oid"===e.type));e=r&&r[0]&&r[0].name}return e}get parsedUrl(){return this.url?h(this.url):null}readRenderer(e,t,i){var s,n;const a=null==t||null==(s=t.layerDefinition)||null==(n=s.drawingInfo)?void 0:n.renderer,o=r(a,i);return null==o?null:("vector-field"===o.type&&t.symbolTileSize&&!a.symbolTileSize&&(o.symbolTileSize=t.symbolTileSize),T(o)||he.warn("ArcGISImageService","Imagery layer doesn't support given renderer type."),o)}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 D({name:"Raster.ItemPixelValue",alias:"Item Pixel Value",domain:null,editable:!1,length:50,type:"string"}),r=new D({name:"Raster.ServicePixelValue",alias:"Service Pixel Value",domain:null,editable:!1,length:50,type:"string"}),i=new D({name:"Raster.ServicePixelValue.Raw",alias:"Raw Service Pixel Value",domain:null,editable:!1,length:50,type:"string"});let s=this.fields?l(this.fields):[];s.push(r),this.capabilities.operations.supportsQuery&&this.fields&&this.fields.length>0&&s.push(t),this.version>=10.4&&p(this.rasterFunctionInfos)&&this.rasterFunctionInfos.some((e=>"none"===e.name.toLowerCase()))&&s.push(i),p(this.rasterFunctionInfos)&&this.rasterFunctionInfos.filter((e=>"none"!==e.name.toLowerCase())).forEach((e=>{s.push(new D({name:"Raster.ServicePixelValue."+e.name,alias:e.name,domain:null,editable:!1,length:50,type:"string"}))})),null==this.pixelFilter||"esriImageServiceDataTypeVector-UV"!==this.serviceDataType&&"esriImageServiceDataTypeVector-MagDir"!==this.serviceDataType||(s.push(new D({name:"Raster.Magnitude",alias:"Magnitude",domain:null,editable:!1,type:"double"})),s.push(new D({name:"Raster.Direction",alias:"Direction",domain:null,editable:!1,type:"double"})));const n=this.rasterInfo.attributeTable&&this.rasterInfo.attributeTable.fields||null;if(n&&n.length>0){const t=n.filter((e=>"esriFieldTypeOID"!==e.type&&"value"!==e.name.toLowerCase())).map((t=>{const r=l(t);return r.name=e+t.name,r}));s=s.concat(t)}return s}set renderingRule(e){let t=e;t&&t.rasterFunction&&(t=J.fromJSON({...t.toJSON(),rasterFunction:t.rasterFunction,rasterFunctionArguments:t.rasterFunctionArguments})),this._set("renderingRule",t)}readRenderingRule(e,t){const r=t.rasterFunctionInfos;return t.renderingRule||r&&r.length&&"None"!==r[0].name?this._isRFTJson(t.renderingRule)?J.fromJSON({rasterFunctionDefinition:t.renderingRule}):J.fromJSON(t.renderingRule||{rasterFunctionInfos:t.rasterFunctionInfos}):null}writeRenderingRule(e,t,r){const i=e.toJSON();i.rasterFunctionDefinition?t[r]=i.rasterFunctionDefinition:t[r]=i}readSpatialReference(e,t){const r=e||t.extent.spatialReference;return r?de.fromJSON(r):null}readPixelType(e){return fe.fromJSON(e)||e}writePixelType(e,t,r){(c(this.serviceRasterInfo)||this.pixelType!==this.serviceRasterInfo.pixelType)&&(t[r]=fe.toJSON(e))}readVersion(e,t){let r=t.currentVersion;return r||(r=t.hasOwnProperty("fields")||t.hasOwnProperty("timeInfo")?10:9.3),r}applyFilter(e){let t=e;return this.pixelFilter&&(t=this._clonePixelData(e),this.pixelFilter(t)),t}async applyRenderer(e,t){let r=e;if(!this._isPicture()&&this.renderer&&this.symbolizer&&!this.pixelFilter){const i=JSON.stringify(this._cachedRendererJson)!==JSON.stringify(this.renderer.toJSON()),s=this._rasterJobHandler.instance,{bandIds:n}=this;if(s){i&&(this.symbolizer.bind(),await s.updateSymbolizer(this.symbolizer,t),this._cachedRendererJson=this.renderer.toJSON());const a=await s.symbolize({bandIds:n,...e},t);r={extent:e.extent,pixelBlock:a}}else r={extent:e.extent,pixelBlock:this.symbolizer.symbolize({bandIds:n,...e})}}return r}destroy(){this._shutdownJobHandler()}increaseRasterJobHandlerUsage(){this._rasterJobHandler.refCount++}decreaseRasterJobHandlerUsage(){this._rasterJobHandler.refCount--,this._rasterJobHandler.refCount<=0&&this._shutdownJobHandler()}async computeAngles(e,t){if(await this._fetchCapabilities(null==t?void 0:t.signal),!this.capabilities.operations.supportsComputeAngles)throw new a("imagery-layer:compute-angles","this operation is not supported on the input image service");return e=y(oe,e).clone(),B(this.url,e,this._getRequestOptions(t))}async computePixelSpaceLocations(e,t){if(await this._fetchCapabilities(null==t?void 0:t.signal),!this.capabilities.operations.supportsComputePixelLocation)throw new a("imagery-layer:compute-pixel-space-locations","this operation is not supported on the input image service");return e=y(pe,e).clone(),G(this.url,e,this._getRequestOptions(t))}async computeHistograms(e,t){if(await this._fetchCapabilities(null==t?void 0:t.signal),!this.capabilities.operations.supportsComputeHistograms)throw new a("imagery-layer:compute-histograms","this operation is not supported on the input image service");e=y(le,e).clone();const{raster:r,mosaicRule:i,renderingRule:s}=this;return s&&null==e.renderingRule&&(e.renderingRule=s),i&&null==e.mosaicRule&&(e.mosaicRule=i),r&&null==e.raster&&(e.raster=r),W(this.url,e,this._getRequestOptions(t))}async computeStatisticsHistograms(e,t){if(await this._fetchCapabilities(null==t?void 0:t.signal),!this.capabilities.operations.supportsComputeStatisticsHistograms)throw new a("imagery-layer:compute-statistics-histograms","this operation is not supported on the input image service");e=y(le,e).clone();const{raster:r,mosaicRule:i,renderingRule:s}=this;return s&&null==e.renderingRule&&(e.renderingRule=s),i&&null==e.mosaicRule&&(e.mosaicRule=i),r&&null==e.raster&&(e.raster=r),X(this.url,e,this._getRequestOptions(t))}getField(e){const{fieldsIndex:t}=this;return p(t)?t.get(e):void 0}getFieldDomain(e,t){const r=this.getField(e);return r?r.domain:null}fetchImage(e,t,r,i={}){if(null==e||null==t||null==r)return Promise.reject(new a("imagery-layer:fetch-image","Insufficient parameters for requesting an image. A valid extent, width and height values are required."));const s=this.renderer||this.symbolizer?this.generateRasterInfo(this.renderingRule,{signal:i.signal}):null;return d(s).then((s=>{s&&(this.rasterInfo=s);const n={imageServiceParameters:this.getExportImageServiceParameters(e,t,r,i.timeExtent),imageProps:{extent:e,width:t,height:r,format:this.format},requestAsImageElement:i.requestAsImageElement&&!this.pixelFilter||!1,signal:i.signal};return this._requestArrayBuffer(n)}))}fetchKeyProperties(e){return n(this.parsedUrl.path+"/keyProperties",{query:this._getQueryParams({renderingRule:this.version>=10.3?null==e?void 0:e.renderingRule:null})}).then((e=>e.data))}fetchRasterAttributeTable(e){return this.version<10.1?Promise.reject(new a("#fetchRasterAttributeTable()","Failed to get rasterAttributeTable")):n(this.parsedUrl.path+"/rasterAttributeTable",{query:this._getQueryParams({renderingRule:this.version>=10.3?null==e?void 0:e.renderingRule:null})}).then((e=>ae.fromJSON(e.data)))}async getCatalogItemRasterInfo(e,t){const r=n(this.parsedUrl.path+"/"+e+"/info",{query:this._getQueryParams(),...t}).then((e=>e.data)),i=n(this.parsedUrl.path+"/"+e+"/info/keyProperties",{query:this._getQueryParams(),...t}).then((e=>e.data)).catch((()=>{})),s=await Promise.all([r,i]);if(!s[0])return;const a=ee.fromJSON(s[0].extent),o=s[0].statistics?s[0].statistics.map((e=>({min:e[0],max:e[1],avg:e[2],stddev:e[3]}))):null;return new q({bandCount:s[0].bandCount,extent:a,spatialReference:a.sr,pixelSize:new te({x:s[0].pixelSizeX,y:s[0].pixelSizeY,spatialReference:a.sr}),pixelType:s[0].pixelType.toLowerCase(),statistics:o,histograms:s[0].histograms,keyProperties:s[1]||{}})}async getCatalogItemICSInfo(e,t){const{data:r}=await n(this.parsedUrl.path+"/"+e+"/info/ics",{query:this._getQueryParams(),...t}),i=r&&r.ics;if(!i)return;let s=null;try{s=(await n(this.parsedUrl.path+"/"+e+"/info",{query:this._getQueryParams(),...t})).data.extent}catch{}if(!s||!s.spatialReference)return{ics:i,icsToPixelTransform:null,icsExtent:null,northDirection:null};const a=this.version>=10.7?n(this.parsedUrl.path+"/"+e+"/info/icstopixel",{query:this._getQueryParams(),...t}).then((e=>e.data)).catch((()=>({}))):{},o=s.spatialReference,l={geometries:JSON.stringify({geometryType:"esriGeometryEnvelope",geometries:[s]}),inSR:o.wkid||JSON.stringify(o),outSR:"0:"+e},u=n(this.parsedUrl.path+"/project",{query:this._getQueryParams(l),...t}).then((e=>e.data)).catch((()=>({}))),p=5,c=(s.xmin+s.xmax)/2,m=(s.ymax-s.ymin)/(p+1),d=s.ymin+m,h=[];for(let n=0;n<p;n++)h.push({x:c,y:d+m*n});const f={geometries:JSON.stringify({geometryType:"esriGeometryPoint",geometries:h}),inSR:o.wkid||JSON.stringify(o),outSR:"0:"+e},y=n(this.parsedUrl.path+"/project",{query:this._getQueryParams(f),...t}).then((e=>e.data)).catch((()=>({}))),g=await Promise.all([a,u,y]);let R=g[0].ipxf;if(null==R){var v,x,b;const e=null==(v=i.geodataXform)?void 0:v.xf_0;"topup"===(null==e||null==(x=e.name)?void 0:x.toLowerCase())&&6===(null==e||null==(b=e.coefficients)?void 0:b.length)&&(R={affine:{name:"ics [sensor: Frame] to pixel (column, row) transformation",coefficients:e.coefficients,cellsizeRatio:0,type:"GeometricXform"}})}const S=ee.fromJSON(g[1]&&g[1].geometries&&g[1].geometries[0]);S&&(S.spatialReference=new de({wkid:0,imageCoordinateSystem:i}));const I=g[2].geometries?g[2].geometries.filter((e=>null!=e&&null!=e.x&&null!=e.y&&"NaN"!==e.x&&"NaN"!==e.y)):[],w=I.length;if(w<3)return{ics:i,icsToPixelTransform:R,icsExtent:S,northDirection:null};let _=0,F=0,O=0,D=0;for(let n=0;n<w;n++)_+=I[n].x,F+=I[n].y,O+=I[n].x*I[n].x,D+=I[n].x*I[n].y;const P=(w*D-_*F)/(w*O-_*_);let T=0;const j=I[p-1].x>I[0].x,N=I[p-1].y>I[0].y;return P===1/0?T=N?90:270:0===P?T=j?0:180:P>0?T=j?180*Math.atan(P)/Math.PI:180*Math.atan(P)/Math.PI+180:P<0&&(T=N?180+180*Math.atan(P)/Math.PI:360+180*Math.atan(P)/Math.PI),{ics:i,icsToPixelTransform:R,icsExtent:S,northDirection:T}}async generateRasterInfo(e,t){var r;if((!e||"none"===(null==e||null==(r=e.functionName)?void 0:r.toLowerCase())||this._isVectorFieldResampleFunction(e))&&p(this.serviceRasterInfo))return this.serviceRasterInfo;const i=Re(e);if(this._functionRasterInfos[i])return this._functionRasterInfos[i];const s=this._generateRasterInfo(e,t);this._functionRasterInfos[i]=s;try{return await s}catch{return this._functionRasterInfos[i]=null,null}}getExportImageServiceParameters(e,t,r,i){var s;e=e.clone().shiftCentralMeridian();const n=Y(e.spatialReference,this.parsedUrl.path);p(this.serviceRasterInfo)&&this.pixelType!==this.serviceRasterInfo.pixelType&&(this.exportImageServiceParameters.pixelType=this.pixelType);const a=this.exportImageServiceParameters.toJSON(),{bandIds:o,noData:l}=a;let{renderingRule:u}=a;const c=!this.renderer||"raster-stretch"===this.renderer.type;if(null!=o&&o.length&&this._hasRenderingRule(this.renderingRule)&&c){const e={rasterFunction:"ExtractBand",rasterFunctionArguments:{BandIds:o}};if("Stretch"===u.rasterFunction)e.rasterFunctionArguments.Raster=u.rasterFunctionArguments.Raster,u.rasterFunctionArguments.Raster=e;else if("Colormap"===u.rasterFunction){const t=u.rasterFunctionArguments.Raster;"Stretch"===(null==t?void 0:t.rasterFunction)?(e.rasterFunctionArguments.Raster=t.rasterFunctionArguments.Raster,t.rasterFunctionArguments.Raster=e):(e.rasterFunctionArguments.Raster=t,u.rasterFunctionArguments.Raster=e)}else e.rasterFunctionArguments.Raster=u,u=e;a.bandIds=void 0}else a.bandIds=null==o?void 0:o.join(",");l instanceof Array&&l.length>0&&(a.noData=l.join(","));const m=this._serviceSupportsMosaicRule?this._combineMosaicRuleWithTimeExtent(this.exportImageServiceParameters.mosaicRule,i):null;a.mosaicRule=m&&JSON.stringify(m),a.renderingRule=u&&null!=(s=u)&&s.rasterFunctionDefinition?JSON.stringify(u.rasterFunctionDefinition):JSON.stringify(u);const d={};if(i){const{start:e,end:t}=i.toJSON();e&&t&&e===t?d.time=""+e:null==e&&null==t||(d.time=`${null==e?"null":e},${null==t?"null":t}`)}return{bbox:e.xmin+","+e.ymin+","+e.xmax+","+e.ymax,bboxSR:n,imageSR:n,size:t+","+r,...a,...d}}async getSamples(e,t){if(await this._fetchCapabilities(null==t?void 0:t.signal),!this.capabilities.operations.supportsGetSamples)throw new a("imagery-layer:get-samples","getSamples operation is not supported on the input image service");e=y(ce,e).clone();const{raster:r}=this;return r&&null==e.raster&&(e.raster=r),K(this.url,e,this._getRequestOptions(t))}async identify(e,t){if(await this._fetchCapabilities(null==t?void 0:t.signal),!this.capabilities.operations.supportsIdentify)throw new a("imagery-layer:query-rasters","query operation is not supported on the input image service");e=y(ue,e).clone();const{raster:r,mosaicRule:i,renderingRule:s}=this;if(s&&null==e.renderingRule&&(e.renderingRule=s),i&&null==e.mosaicRule){const t=this._combineMosaicRuleWithTimeExtent(i,e.timeExtent);e.mosaicRule=m(t)}return r&&null==e.raster&&(e.raster=r),$(this.url,e,this._getRequestOptions(t))}createQuery(){const e=new ie;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)),se(this.url,e,t)}async queryRasterCount(e,t){return({query:e,requestOptions:t}=await this._prepareForQuery(e,t)),Z(this.url,e,t)}async queryVisibleRasters(e,t){if(!e)throw new a("imagery-layer: query-visible-rasters","missing query parameter");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 m="raster.servicepixelvalue",d=this.rasterFunctionNamesIndex;if(p(e.outFields)&&(o=e.outFields.some((e=>-1===e.toLowerCase().indexOf(m))),this.version>=10.4)){const t=e.outFields.filter((e=>e.toLowerCase().indexOf(m)>-1&&e.length>m.length)).map((e=>{const t=e.slice(m.length+1);return[this._updateRenderingRulesFunctionName(t,d),t]}));l=t.map((e=>new J({functionName:e[0]}))),u=t.map((e=>e[1])),0===l.length?this.renderingRule?(l.push(this.renderingRule),u.push(this.renderingRule.functionName)):l=null:this.renderingRule&&!l.some((e=>e.functionName===this.renderingRule.functionName))&&(l.push(this.renderingRule),u.push(this.renderingRule.functionName))}const h=c(e.outSpatialReference)||e.outSpatialReference.equals(this.spatialReference),f=e.timeExtent||this.timeExtent,y=this._combineMosaicRuleWithTimeExtent(this.exportImageServiceParameters.mosaicRule,f),g=this._getQueryParams({geometry:e.geometry,timeExtent:f,mosaicRule:y,renderingRule:this.version<10.4?this.renderingRule:null,renderingRules:l,pixelSize:r,returnCatalogItems:o,returnGeometry:h,raster:this.raster,maxItemCount:s?1:null});delete g.f;const R=new ue(g);try{var v,x;await this.generateRasterInfo(this.renderingRule);const r=await $(this.url,R,{signal:null==t?void 0:t.signal,query:{...this.customParameters}}),s=e.outFields,a=r.value.toLowerCase().indexOf("nodata")>-1;if(!(o&&!h&&(null==r||null==(v=r.catalogItems)?void 0:v.features.length)&&(n||!a)))return this._processVisibleRastersResponse(r,{returnDomainValues:i,templateRRFunctionNames:u,showNoDataRecords:n,templateFields:s});const l=this.objectIdField||"ObjectId",c=r.catalogItems.features,m=c.map((e=>{var t;return null==(t=e.attributes)?void 0:t[l]})),d=new ie({objectIds:m,returnGeometry:!0,outSpatialReference:e.outSpatialReference,outFields:[l]}),f=await this.queryRasters(d);return null!=f&&null!=(x=f.features)&&x.length&&f.features.forEach((t=>{c.forEach((r=>{r.attributes[l]===t.attributes[l]&&(r.geometry=new re(t.geometry),p(e.outSpatialReference)&&(r.geometry.spatialReference=e.outSpatialReference))}))})),this._processVisibleRastersResponse(r,{returnDomainValues:i,templateRRFunctionNames:u,showNoDataRecords:n,templateFields:s})}catch{throw new a("imagery-layer:query-visible-rasters","encountered error when querying visible rasters")}}async fetchVariableStatisticsHistograms(e,t){const r=n(this.parsedUrl.path+"/statistics",{query:this._getQueryParams({variable:e}),signal:t}).then((e=>{var t;return null==(t=e.data)?void 0:t.statistics})),i=n(this.parsedUrl.path+"/histograms",{query:this._getQueryParams({variable:e}),signal:t}).then((e=>{var t;return null==(t=e.data)?void 0:t.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 createStreamlinesMesh(e,t){const r=this._rasterJobHandler.instance;return r?r.createStreamlinesMesh(e,t):me(e.rendererSettings,e.flowData,p(t.signal)?t.signal:(new AbortController).signal)}async _fetchService(e){await this._fetchServiceInfo(e),p(this.serviceRasterInfo)&&!this.rasterInfo&&(this.rasterInfo=this.serviceRasterInfo);const t=this.sourceJSON,r=p(this.serviceRasterInfo)?Promise.resolve(this.serviceRasterInfo):this._fetchAuxiliaryRasterInfo({serviceInfo:t,signal:e}).then((e=>(this._set("serviceRasterInfo",e),e))),i=this._hasRenderingRule(this.renderingRule)?this.generateRasterInfo(this.renderingRule,{signal:e}):null,s=this._getRasterFunctionInfos();return Promise.all([r,i,s]).then((e=>{e[1]?this._set("rasterInfo",e[1]):this._set("rasterInfo",e[0]),e[2]&&this._set("rasterFunctionInfos",e[2]),this.renderer&&!this._isSupportedRenderer(this.renderer)&&(this.renderer=null,he.warn("ArcGISImageService","Switching to the default renderer. Renderer applied is not valid for this Imagery Layer")),this._configDefaultRenderer(),this.watch("renderer",(()=>this._configDefaultRenderer())),this.watch("renderingRule",(e=>{(this.renderer||this.symbolizer||this.popupEnabled&&this.popupTemplate)&&this.generateRasterInfo(e).then((e=>{e&&(this.rasterInfo=e)}))}));const t=p(this.serviceRasterInfo)&&this.serviceRasterInfo.multidimensionalInfo;t&&this._updateMultidimensionalDefinition(t)}))}_combineMosaicRuleWithTimeExtent(e,t){const r=this.timeInfo;if(c(e)||c(this.multidimensionalInfo)||c(t)||c(null==r?void 0:r.startField))return e;const{startField:i}=r;var s;if(e=e.clone(),"mosaic-dataset"===this._serviceSourceType)return e.multidimensionalDefinition=null==(s=e.multidimensionalDefinition)?void 0:s.filter((e=>e.dimensionName!==i)),this._cleanupMultidimensionalDefinition(e);e.multidimensionalDefinition=e.multidimensionalDefinition||[];const n=e.multidimensionalDefinition.filter((e=>e.dimensionName===i)),a=p(t.start)?t.start.getTime():null,o=p(t.end)?t.end.getTime():null,l=null==a||null==o||a===o,u=l?[a||o]:[[a,o]],m=this.version>=10.8;if(n.length)n.forEach((e=>{e.dimensionName===i&&(m?(e.dimensionName=null,e.isSlice=null,e.values=null):(e.isSlice=l,e.values=u))}));else if(!m){const t=e.multidimensionalDefinition.filter((e=>null!=e.variableName&&null==e.dimensionName));t.length?t.forEach((e=>{e.dimensionName=i,e.isSlice=l,e.values=u})):e.multidimensionalDefinition.push(new F({variableName:"",dimensionName:i,isSlice:l,values:u}))}return this._cleanupMultidimensionalDefinition(e)}_cleanupMultidimensionalDefinition(e){return c(e)?null:(e.multidimensionalDefinition&&(e.multidimensionalDefinition=e.multidimensionalDefinition.filter((e=>!(!e.variableName&&!e.dimensionName))),0===e.multidimensionalDefinition.length&&(e.multidimensionalDefinition=null)),"mosaic-dataset"!==this._serviceSourceType&&null==e.multidimensionalDefinition?null:e)}async _prepareForQuery(e,t){var r;if(await this._fetchCapabilities(null==(r=t)?void 0:r.signal),!this.capabilities.operations.supportsQuery)throw new a("imagery-layer:query-rasters","query operation is not supported on the input image service");return e=p(e)?y(ie,e):this.createQuery(),t=this._getRequestOptions(t),this.raster&&(t.query={...t.query,raster:this.raster}),{query:e,requestOptions:t}}async _initJobHandler(){if(null!=this._rasterJobHandler.connectionPromise)return this._rasterJobHandler.connectionPromise;const e=new V;this._rasterJobHandler.connectionPromise=e.initialize().then((()=>{this._rasterJobHandler.instance=e}),(()=>null)),await this._rasterJobHandler.connectionPromise}_shutdownJobHandler(){this._rasterJobHandler.instance&&this._rasterJobHandler.instance.destroy(),this._rasterJobHandler.instance=null,this._rasterJobHandler.connectionPromise=null,this._rasterJobHandler.refCount=0}_isSupportedRenderer(e){const{rasterInfo:t,renderingRule:r}=this;return"unique-value"===e.type&&this._hasRenderingRule(r)&&1===t.bandCount&&["u8","s8"].includes(t.pixelType)||Q(this.rasterInfo).includes(this.renderer.type)}async _fetchCapabilities(e){return this.capabilities||await this._fetchServiceInfo(e),this.capabilities}async _fetchServiceInfo(e){var t;let r=this.sourceJSON;if(!r){const{data:t,ssl:i}=await n(this.parsedUrl.path,{query:this._getQueryParams(),signal:e});r=t,this.sourceJSON=r,i&&(this.url=this.url.replace(/^http:/i,"https:"))}if((null==(t=r.capabilities)?void 0:t.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(r,{origin:"service",url:this.parsedUrl})}_isMosaicDataset(e){var t;return e.serviceSourceType?"esriImageServiceSourceTypeMosaicDataset"===e.serviceSourceType:(null==(t=e.fields)?void 0:t.length)>0}_isMosaicRuleSupported(e){var t;if(!e)return!1;const r=this._isMosaicDataset(e),i=e.currentVersion>=10.71&&e.hasMultidimensions&&e.timeInfo&&!(e.objectIdField&&(null==(t=e.fields)?void 0:t.length)>1);return r||i}_isVectorFieldResampleFunction(e){if(!p(e))return!1;const{functionName:t,functionArguments:r}=e,i="resample"===(null==t?void 0:t.toLowerCase()),s=(null==r?void 0:r.ResampleType)||(null==r?void 0:r.resampleType);return i&&(7===s||10===s)}_isPicture(){return!this.format||this.format.indexOf("jpg")>-1||this.format.indexOf("png")>-1}_configDefaultRenderer(){if(!this._isPicture()&&!this.pixelFilter){if(!this.bandIds&&this.rasterInfo.bandCount>=3){const e=U(this.rasterInfo);!e||3===this.rasterInfo.bandCount&&0===e[0]&&1===e[1]&&2===e[2]||(this.bandIds=e)}var e,t;if(!this.renderer)this.renderer=H(this.rasterInfo,{bandIds:this.bandIds,variableName:this.renderingRule?null:null==(e=this.mosaicRule)||null==(t=e.multidimensionalDefinition)?void 0:t[0].variableName});this.symbolizer?(this.symbolizer.rendererJSON=L(this.renderer.toJSON()),this.symbolizer.rasterInfo=this.rasterInfo):this.symbolizer=new k({rendererJSON:this.renderer.toJSON(),rasterInfo:this.rasterInfo}),this.symbolizer.bind().success||(this.symbolizer=null)}}_clonePixelData(e){return null==e?e:{extent:e.extent&&e.extent.clone(),pixelBlock:p(e.pixelBlock)&&e.pixelBlock.clone()}}_getQueryParams(e){p(null==e?void 0: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:{...null==e?void 0:e.query,...this.customParameters}}}_decodePixelBlock(e,t,r){return this._rasterJobHandler.instance?this._rasterJobHandler.instance.decode({data:e,options:t}):A(e,t,r)}async _fetchMultidimensionalInfo(e){var t;const r=await n(this.parsedUrl.path+"/multidimensionalInfo",{query:this._getQueryParams(),signal:e}).then((e=>{var t;return null==(t=e.data)?void 0:t.multidimensionalInfo}));return null!=(t=r.variables)&&t.length&&r.variables.forEach((e=>{var t;null!=(t=e.statistics)&&t.length&&e.statistics.forEach((e=>{e.avg=e.mean,e.stddev=e.standardDeviation}))})),r}async _getRasterFunctionInfos(e){const t=this.sourceJSON.rasterFunctionInfos;if(this.serviceRasterInfo)return t;if(t&&this.version>=10.3){var r;if(1===t.length&&"none"===t[0].name.toLowerCase())return t;return null==(r=(await n(this.parsedUrl.path+"/rasterFunctionInfos",{query:this._getQueryParams(),signal:e})).data)?void 0:r.rasterFunctionInfos}return null}async _fetchAuxiliaryRasterInfo(e){const t=e&&e.serviceInfo;if(!t)return Promise.reject(new a("imagery-layer:fetch-metadata","valid serviceInfo is required"));const r=e.signal,i=!!(t.hasRasterAttributeTable&&this.version>=10.1)&&n(this.parsedUrl.path+"/rasterAttributeTable",{query:this._getQueryParams({renderingRule:this.version>=10.1?null==e?void 0:e.renderingRule:null}),signal:r}).then((e=>ae.fromJSON(e.data))).catch((()=>null)),s=!!(t.hasColormap&&this.version>=10.1)&&n(this.parsedUrl.path+"/colormap",{query:this._getQueryParams({renderingRule:this.version>=10.6?null==e?void 0:e.renderingRule:null}),signal:r}).then((e=>{var t;return null==(t=e.data)?void 0:t.colormap})),o=!!(t.hasHistograms&&this.version>=10.1)&&n(this.parsedUrl.path+"/histograms",{query:this._getQueryParams({renderingRule:this.version>=10.1?null==e?void 0:e.renderingRule:null}),signal:r}).then((e=>{var t;return null==(t=e.data)?void 0:t.histograms})),l=this.version>=10.3&&n(this.parsedUrl.path+"/keyProperties",{query:this._getQueryParams({renderingRule:null==e?void 0:e.renderingRule}),signal:r}).then((e=>e.data)).catch((()=>{})),u=!!(t.hasMultidimensions&&this.version>=10.3)&&this._fetchMultidimensionalInfo(),p=await Promise.all([i,s,o,l,u]);let c=null;if(t.minValues&&t.minValues.length===t.bandCount){c=[];for(let e=0;e<t.minValues.length;e++)c.push({min:t.minValues[e],max:t.maxValues[e],avg:t.meanValues[e],stddev:t.stdvValues[e]})}const m=Math.ceil((t.extent.xmax-t.extent.xmin)/t.pixelSizeX-.1),d=Math.ceil((t.extent.ymax-t.extent.ymin)/t.pixelSizeY-.1),h=de.fromJSON(t.spatialReference||t.extent.spatialReference);return new q({width:m,height:d,bandCount:t.bandCount,extent:ee.fromJSON(t.extent),spatialReference:h,pixelSize:new te({x:t.pixelSizeX,y:t.pixelSizeY,spatialReference:h}),pixelType:t.pixelType.toLowerCase(),statistics:c,attributeTable:p[0]||null,colormap:p[1]||null,histograms:p[2]||null,keyProperties:p[3]||{},multidimensionalInfo:p[4]||null})}async _requestArrayBuffer(e){var t;const{imageProps:r,requestAsImageElement:i,signal:s}=e;if(i&&!this.pixelFilter&&(null==(t=r.format)?void 0:t.indexOf("png"))>-1){return{imageElement:(await n(this.parsedUrl.path+"/exportImage",{responseType:"image",query:this._getQueryParams({f:"image",...e.imageServiceParameters}),signal:s})).data,params:r}}const o=this._initJobHandler(),l=n(this.parsedUrl.path+"/exportImage",{responseType:"array-buffer",query:this._getQueryParams({f:"image",...e.imageServiceParameters}),signal:s}),u=(await Promise.all([l,o]))[0].data,p=r.format||"jpgpng";let c=p;if("bsq"!==c&&"bip"!==c&&(c=z(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.indexOf("png")>-1&&("png"===c||"jpg"===c)?A(u,{useCanvas:!0,...r},m):this._decodePixelBlock(u,{width:r.width,height:r.height,planes:null,pixelType:null,noDataValue:null,format:p},m);return{pixelData:{pixelBlock:await d,extent:r.extent},params:r}}async _generateRasterInfo(e,t){const{data:r}=await n(this.parsedUrl.path,{query:this._getQueryParams({renderingRule:e}),...t});return await this._fetchAuxiliaryRasterInfo({serviceInfo:r,renderingRule:e,...t})}_isValidCustomizedMosaicRule(e){var t;return e&&JSON.stringify(e.toJSON())!==JSON.stringify(null==(t=this._defaultServiceMosaicRule)?void 0:t.toJSON())}_updateMultidimensionalDefinition(e){if(this._isValidCustomizedMosaicRule(this.mosaicRule))return;const t=e.variables[0].dimensions,r="",i=[];for(const s in t)if(t.hasOwnProperty(s)){const e=t[s],n=e.extent;let a=!0,o=[n[0]];e.hasRanges&&!0===e.hasRanges?(a=!1,o=[e.values[0]]):"stdz"===e.name.toLowerCase()&&Math.abs(n[1])<=Math.abs(n[0])&&(o=[n[1]]),i.push(new F({variableName:r,dimensionName:t[s].name,isSlice:a,values:o}))}if(i.length>0){this.mosaicRule=this.mosaicRule||new j;const e=this.mosaicRule.multidimensionalDefinition;(!e||e&&e.length<=0)&&(this.mosaicRule.multidimensionalDefinition=i)}}_formatAttributeValue(e,t){if("string"==typeof e){const r=this.popupTemplate&&this.popupTemplate.fieldInfos,i=this._getFieldInfo(r,t),s=i&&i.format;if(s){let t,r;return e.trim().indexOf(",")>-1?(t=",",r=t+" ",this._formatDelimitedString(e,t,r,s)):e.trim().indexOf(" ")>-1?(t=r=" ",this._formatDelimitedString(e,t,r,s)):this._formatNumberFromString(e,s)}}return e}_getFieldInfo(e,t){if(!e||!e.length||!t)return;const r=t.toLowerCase();let i;return e.some((e=>!(!e.fieldName||e.fieldName.toLowerCase()!==r&&e.fieldName.toLowerCase()!==r.replace(/ /g,"_"))&&(i=e,!0))),i}_formatDelimitedString(e,t,r,i){return e&&t&&r&&i?e.trim().split(t).map((e=>this._formatNumberFromString(e,i))).join(r):e}_formatNumberFromString(e,t){if(!e||!t)return e;const r=Number(e);return isNaN(r)?e:t.format(r)}_processVisibleRastersResponse(e,r){r=r||{};const i=e.value,{templateRRFunctionNames:s,showNoDataRecords:n,returnDomainValues:a,templateFields:o}=r,l=e.processedValues;let u=e.catalogItems&&e.catalogItems.features,c=e.properties&&e.properties.Values&&e.properties.Values.map((e=>e.replace(/ /gi,", ")))||[];const m=this.objectIdField||"ObjectId",d="string"==typeof i&&i.toLowerCase().indexOf("nodata")>-1,h=[];if(i&&!u&&!d){const e={};e[m]=0;c=[i],u=[new t(this.fullExtent,null,e)]}if(!u)return[];let f,y,g;this._updateResponseFieldNames(u,o),d&&!n&&(u=[]);for(let t=0;t<u.length;t++){if(f=u[t],null!=i){if(y=c[t],g=this.renderingRule&&l&&l.length>0&&s&&s.length>0&&s.indexOf(this.renderingRule.functionName)>-1?l[s.indexOf(this.renderingRule.functionName)]:i,"nodata"===y.toLowerCase()&&!n)continue;const e="Raster.ItemPixelValue",r="Raster.ServicePixelValue";f.attributes[e]=this._formatAttributeValue(y,e),f.attributes[r]=this._formatAttributeValue(g,r),this._updateFeatureWithMagDirValues(f,y);const a=this.fields&&this.fields.length>0;let o=this.renderingRule&&p(this.serviceRasterInfo)&&this.serviceRasterInfo.attributeTable?a?y:i:g;this.renderingRule||(o=a?y:i),this._updateFeatureWithRasterAttributeTableValues(f,o)}if(f.sourceLayer=f.layer=this,a&&this._updateFeatureWithDomainValues(f),s&&l&&s.length===l.length)for(let e=0;e<s.length;e++){const t="Raster.ServicePixelValue."+s[e];f.attributes[t]=this._formatAttributeValue(l[e],t)}h.push(u[t])}return h}_updateFeatureWithRasterAttributeTableValues(e,t){const r=this.rasterInfo&&this.rasterInfo.attributeTable||p(this.serviceRasterInfo)&&this.serviceRasterInfo.attributeTable,i=r&&r.features;if(!i)return;const s=r.fields,n=s.map((e=>e.name)).filter((e=>"value"===e.toLowerCase())),a=n&&n[0];if(!a)return;const o=i.filter((e=>e.attributes[a]===(null!=t?parseInt(t,10):null)));o&&o[0]&&s.forEach((t=>{const r=this.rasterAttributeTableFieldPrefix+t.name;e.attributes[r]=this._formatAttributeValue(o[0].attributes[t.name],r)}))}_updateFeatureWithMagDirValues(e,t){if("esriImageServiceDataTypeVector-UV"!==this.serviceDataType&&"esriImageServiceDataTypeVector-MagDir"!==this.serviceDataType)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 N({height:1,width:1,pixelType:"f32",pixels:i,statistics:s});null!=this.pixelFilter&&this.pixelFilter({pixelBlock:n,extent:new ee(0,0,0,0,this.spatialReference)});const a="esriImageServiceDataTypeVector-MagDir"===this.serviceDataType?[n.pixels[0][0],n.pixels[1][0]]:E([n.pixels[0][0],n.pixels[1][0]]);e.attributes["Raster.Magnitude"]=a[0],e.attributes["Raster.Direction"]=a[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.filter((e=>e.code===r))[0];i&&(e.attributes[t.name]=i.name)}}))}_updateResponseFieldNames(e,t){if(!t||t.length<1)return;const r=this.fieldsIndex;p(r)&&e.forEach((e=>{if(e&&e.attributes)for(const i of t)if(r.has(i)){const t=r.get(i).name;t!==i&&(e.attributes[i]=e.attributes[t],delete e.attributes[t])}}))}_getRenderingRuleString(e){if(this._hasRenderingRule(e)){var t;let r=e.toJSON();return r=null!=(t=r.rasterFunctionDefinition)?t:r,(r.thumbnail||r.thumbnailEx)&&(r.thumbnail=r.thumbnailEx=null),JSON.stringify(r)}return null}_hasRenderingRule(e){return e&&e.functionName&&"none"!==e.functionName.toLowerCase()}_updateRenderingRulesFunctionName(e,t){if(!e||e.length<1)return;if("Raw"===e)return e.replace("Raw","None");const r=e.toLowerCase().replace(/ /gi,"_");return t.has(r)?t.get(r):e}_isRFTJson(e){return e&&e.name&&e.arguments&&e.function&&e.hasOwnProperty("functionType")}_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.indexOf("image")>-1,a="esriImageServiceDataTypeElevation"===e.serviceDataType,o=!!(e.spatialReference||e.extent&&e.extent.spatialReference),l=t.includes("edit");return{data:{supportsAttachment:!1},operations:{supportsComputeHistograms:n,supportsExportImage:n,supportsIdentify:n,supportsMeasure:t.indexOf("mensuration")>-1&&o,supportsDownload:t.indexOf("download")>-1,supportsQuery:t.indexOf("catalog")>-1&&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&&a,supportsComputePixelLocation:r>=10.7&&t.indexOf("catalog")>-1,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},query:{maxRecordCount:s,maxRecordCountFactor:void 0,supportsStatistics:!(null==i||!i.supportsStatistics),supportsOrderBy:!(null==i||!i.supportsOrderBy),supportsDistinct:!(null==i||!i.supportsDistinct),supportsPagination:!(null==i||!i.supportsPagination),supportsStandardizedQueriesOnly:!(null==i||!i.useStandardizedQueries),supportsPercentileStatistics:!(null==i||!i.supportsPercentileStatistics),supportsCentroid:!(null==i||!i.supportsReturningGeometryCentroid),supportsDistance:!(null==i||!i.supportsQueryWithDistance),supportsExtent:!(null==i||!i.supportsReturningQueryExtent),supportsGeometryProperties:!(null==i||!i.supportsReturningGeometryProperties),supportsHavingClause:!(null==i||!i.supportsHavingClause),supportsQuantization:!1,supportsQuantizationEditMode:!1,supportsQueryGeometry:!1,supportsResultType:!1,supportsMaxRecordCountFactor:!1,supportsSqlExpression:!1,supportsTopFeaturesQuery:!1,supportsQueryByOthers:!1,supportsHistoricMoment:!1,supportsFormatPBF:!1,supportsDisjointSpatialRelationship:!1,supportsCacheHint:!1,supportsSpatialAggregationStatistics:!1,supportedSpatialAggregationStatistics:{envelope:!1,centroid:!1,convexHull:!1},standardMaxRecordCount:void 0,tileMaxRecordCount:void 0}}}};return e([v()],u.prototype,"_functionRasterInfos",void 0),e([v()],u.prototype,"_rasterJobHandler",void 0),e([v({dependsOn:["_serviceSupportsMosaicRule"]})],u.prototype,"_defaultServiceMosaicRule",void 0),e([b("_defaultServiceMosaicRule",["defaultMosaicMethod"])],u.prototype,"readDefaultServiceMosaicRule",null),e([v()],u.prototype,"_cachedRendererJson",void 0),e([v({readOnly:!0})],u.prototype,"_serviceSourceType",void 0),e([b("_serviceSourceType",["serviceSourceType","fields"])],u.prototype,"readServiceSourceType",null),e([v({readOnly:!0})],u.prototype,"_serviceSupportsMosaicRule",void 0),e([b("_serviceSupportsMosaicRule",["currentVersion","fields"])],u.prototype,"readServiceSupportsMosaicRule",null),e([v()],u.prototype,"rasterAttributeTableFieldPrefix",void 0),e([v({readOnly:!0})],u.prototype,"rasterFunctionNamesIndex",null),e([v()],u.prototype,"adjustAspectRatio",void 0),e([v({readOnly:!0}),f("serviceRasterInfo.bandCount")],u.prototype,"bandCount",void 0),e([v({type:[g],json:{write:!0}})],u.prototype,"bandIds",void 0),e([b("bandIds")],u.prototype,"readBandIds",null),e([v({readOnly:!0,json:{read:!1}})],u.prototype,"capabilities",void 0),e([b("service","capabilities",["capabilities","currentVersion","serviceDataType"])],u.prototype,"readCapabilities",null),e([v({type:Number})],u.prototype,"compressionQuality",void 0),e([I("compressionQuality")],u.prototype,"writeCompressionQuality",null),e([v({type:Number})],u.prototype,"compressionTolerance",void 0),e([I("compressionTolerance")],u.prototype,"writeCompressionTolerance",null),e([v({json:{read:{source:"copyrightText"}}})],u.prototype,"copyright",void 0),e([v({type:String,json:{name:"layerDefinition.definitionExpression",write:{enabled:!0,allowNull:!0}}})],u.prototype,"definitionExpression",void 0),e([v({readOnly:!0,constructOnly:!0})],u.prototype,"exportImageServiceParameters",void 0),e([v()],u.prototype,"rasterInfo",void 0),e([v({readOnly:!0,type:[D]})],u.prototype,"fields",void 0),e([v({readOnly:!0})],u.prototype,"fieldsIndex",null),e([v({type:["png","png8","png24","png32","jpg","bmp","gif","jpgpng","lerc","tiff"],json:{write:!0}})],u.prototype,"format",null),e([b("service","format",["serviceDataType"])],u.prototype,"readFormat",null),e([v({type:ee})],u.prototype,"fullExtent",void 0),e([v({readOnly:!0})],u.prototype,"hasMultidimensions",void 0),e([v({json:{read:{source:"maxImageHeight"}}})],u.prototype,"imageMaxHeight",void 0),e([v({json:{read:{source:"maxImageWidth"}}})],u.prototype,"imageMaxWidth",void 0),e([v({type:String,json:{type:C.jsonValues,read:C.read,write:C.write}})],u.prototype,"interpolation",void 0),e([v()],u.prototype,"minScale",void 0),e([b("service","minScale")],u.prototype,"readMinScale",null),e([v()],u.prototype,"maxScale",void 0),e([b("service","maxScale")],u.prototype,"readMaxScale",null),e([v({type:j})],u.prototype,"mosaicRule",null),e([b("mosaicRule",["mosaicRule","defaultMosaicMethod"])],u.prototype,"readMosaicRule",null),e([I("mosaicRule")],u.prototype,"writeMosaicRule",null),e([v({readOnly:!0}),f("serviceRasterInfo.multidimensionalInfo")],u.prototype,"multidimensionalInfo",void 0),e([v({json:{type:g}})],u.prototype,"noData",void 0),e([I("noData")],u.prototype,"writeNoData",null),e([v({type:String,json:{type:M.jsonValues,read:M.read,write:M.write}})],u.prototype,"noDataInterpretation",void 0),e([v({type:String,readOnly:!0,json:{read:{source:["fields"]}}})],u.prototype,"objectIdField",void 0),e([b("objectIdField")],u.prototype,"readObjectIdField",null),e([v({})],u.prototype,"geometryType",void 0),e([v({})],u.prototype,"typeIdField",void 0),e([v({})],u.prototype,"types",void 0),e([v({readOnly:!0})],u.prototype,"parsedUrl",null),e([v({readOnly:!0}),f("serviceRasterInfo.pixelSize.x")],u.prototype,"pixelSizeX",void 0),e([v({readOnly:!0}),f("serviceRasterInfo.pixelSize.y")],u.prototype,"pixelSizeY",void 0),e([v({type:Function})],u.prototype,"pixelFilter",void 0),e([v()],u.prototype,"raster",void 0),e([v()],u.prototype,"viewId",void 0),e([v({types:i,json:{name:"layerDefinition.drawingInfo.renderer",origins:{"web-scene":{types:s,name:"layerDefinition.drawingInfo.renderer",write:{overridePolicy:e=>({enabled:e&&"vector-field"!==e.type&&"animated-flow"!==e.type})}}}}})],u.prototype,"renderer",void 0),e([b("renderer")],u.prototype,"readRenderer",null),e([I("renderer")],u.prototype,"writeRenderer",null),e([v()],u.prototype,"symbolizer",void 0),e([v(w)],u.prototype,"opacity",void 0),e([v({readOnly:!0}),f("serviceRasterInfo.attributeTable")],u.prototype,"rasterAttributeTable",void 0),e([v({readOnly:!0})],u.prototype,"rasterFields",null),e([v({constructOnly:!0})],u.prototype,"rasterFunctionInfos",void 0),e([v({type:J})],u.prototype,"renderingRule",null),e([b("renderingRule",["renderingRule","rasterFunctionInfos"])],u.prototype,"readRenderingRule",null),e([I("renderingRule")],u.prototype,"writeRenderingRule",null),e([v()],u.prototype,"serviceDataType",void 0),e([v({readOnly:!0,type:de})],u.prototype,"spatialReference",void 0),e([b("spatialReference",["spatialReference","extent"])],u.prototype,"readSpatialReference",null),e([v({json:{type:fe.jsonValues}})],u.prototype,"pixelType",void 0),e([b("pixelType")],u.prototype,"readPixelType",null),e([I("pixelType")],u.prototype,"writePixelType",null),e([v({constructOnly:!0,type:q})],u.prototype,"serviceRasterInfo",void 0),e([v()],u.prototype,"sourceJSON",void 0),e([v(_)],u.prototype,"url",void 0),e([v({readOnly:!0})],u.prototype,"version",void 0),e([b("version",["currentVersion","fields","timeInfo"])],u.prototype,"readVersion",null),u=e([S("esri.layers.mixins.ArcGISImageService")],u),u};export{ve 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.23/esri/copyright.txt for details.
4
4
  */
5
- import{JSONMap as t}from"../../../core/jsonMap.js";import{isSome as e}from"../../../core/maybe.js";import n from"../PixelBlock.js";import{isValidPixelBlock as r}from"./pixelUtils.js";const o=new Map;o.set("meter-per-second",1),o.set("kilometer-per-hour",.277778),o.set("knots",.514444),o.set("feet-per-second",.3048),o.set("mile-per-hour",.44704);const a=180/Math.PI,s=5,i=new t({esriMetersPerSecond:"meter-per-second",esriKilometersPerHour:"kilometer-per-hour",esriKnots:"knots",esriFeetPerSecond:"feet-per-second",esriMilesPerHour:"mile-per-hour"});function h(t,e){return o.get(t)/o.get(e)||1}function l(t){return(450-t)%360}function c(t,e="geographic"){const[n,r]=t,o=Math.sqrt(n*n+r*r);let s=Math.atan2(r,n)*a;return s=(360+s)%360,"geographic"===e&&(s=l(s)),[o,s]}function u(t,e="geographic"){let n=t[1];"geographic"===e&&(n=l(n)),n%=360;const r=t[0];return[r*Math.cos(n/a),r*Math.sin(n/a)]}function f(t,e,o="geographic",a=1){if(!r(t))return t;const{pixels:s,width:i,height:h}=t,l=i*h,f=s[0],p=s[1],m=n.createEmptyBand(t.pixelType,l),M=n.createEmptyBand(t.pixelType,l);let x=0;for(let n=0;n<h;n++)for(let t=0;t<i;t++)"vector-uv"===e?([m[x],M[x]]=c([f[x],p[x]],o),m[x]*=a):([m[x],M[x]]=u([f[x],p[x]],o),m[x]*=a,M[x]*=a),x++;const d=new n({pixelType:t.pixelType,width:t.width,height:t.height,mask:t.mask,validPixelCount:t.validPixelCount,maskIsAlpha:t.maskIsAlpha,pixels:[m,M]});return d.updateStatistics(),d}function p(t,e,n=1){if(1===n||!r(t))return t;const o=t.clone(),{pixels:a,width:s,height:i}=o,h=a[0],l=a[1];let c=0;for(let r=0;r<i;r++)for(let t=0;t<s;t++)"vector-uv"===e?(h[c]*=n,l[c]*=n):h[c]*=n,c++;return o.updateStatistics(),o}function m(t,n,r,o,a){if(!e(a)||!a.spatialReference.equals(t.spatialReference))return{extent:t,width:n,height:r,resolution:t.width/n};const s=a.xmin,i=a.ymax;o=Math.max(o||0,30);const h=Math.ceil(n*(1/o)),l=Math.ceil(r*(1/o)),c=((t.xmax-t.xmin)/h+(t.ymax-t.ymin)/l)/2;return t.xmin=s+Math.floor((t.xmin-s)/c)*c,t.xmax=s+Math.ceil((t.xmax-s)/c)*c,t.ymin=i+Math.floor((t.ymin-i)/c)*c,t.ymax=i+Math.ceil((t.ymax-i)/c)*c,{extent:t,width:Math.round(t.width/c),height:Math.round(t.height/c),resolution:c}}const M=x(0,0,0);function x(t=0,e=0,n=Math.PI,r=!0){r&&(n=(2*Math.PI-n)%(2*Math.PI));const o=r?-1:1,a=13*o,s=-7*o,i=-2*o,h=-16*o,l=29,[c,u]=g(0,e+a,n,l),[f,p]=g(t-5.5,e+s,n,l),[m,M]=g(t+5.5,e+s,n,l),[x,d]=g(t-1.5,e+i,n,l),[k,w]=g(t+1.5,e+i,n,l),[y,P]=g(t-1.5,e+h,n,l),[b,I]=g(t+1.5,e+h,n,l);return[c,u,f,p,x,d,k,w,m,M,y,P,b,I]}function d(t=0,e=Math.PI,n=!0){n&&(e=(2*Math.PI-e)%(2*Math.PI));const r=10,o=n?-1:1,a=5*o,i=20*o,h=25*o,l=45,c=0,u=0,f=2,p=0,m=f*o;let[M,x]=[c+r/2,u-i],[d,k]=[M+f,x],[w,y]=[d-p,k+m],[P,b]=[c-r/2,u-h],[I,v]=[P+p,b-m],A=Math.ceil(t/s),_=Math.floor(A/10);A-=8*_;const U=[],S=[];for(let s=0;s<A/2;s++,_--){_<=0&&A%2==1&&s===(A-1)/2&&(P=c,I=P+p,b=(b+x)/2,v=b-m);const[t,n]=g(P,b,e,l);if(_>0){const[r,o]=g(d,b,e,l),[a,s]=g(M,x,e,l);U.push(r),U.push(o),U.push(t),U.push(n),U.push(a),U.push(s)}else{const[r,o]=g(d,k,e,l),[a,s]=g(w,y,e,l),[i,h]=g(I,v,e,l);S.push(t),S.push(n),S.push(i),S.push(h),S.push(a),S.push(s),S.push(r),S.push(o)}b+=a,x+=a,k+=a,y+=a,v+=a}const[D,F]=g(c+r/2,u+i,e,l),j=r/2+f,[N,T]=g(c+j,u+i,e,l),[q,B]=g(c+r/2,u-h,e,l),[E,J]=g(c+j,u-h,e,l);return{pennants:U,barbs:S,shaft:[D,F,N,T,q,B,E,J]}}function g(t,e,n,r=1){const o=Math.sqrt(t*t+e*e)/r,a=(2*Math.PI+Math.atan2(e,t))%(2*Math.PI);return[o,(2*Math.PI+a-n)%(2*Math.PI)]}const k=[0,1,3,6,10,16,21,27,33,40,47,55,63],w=[0,.5,1,1.5,2],y=[0,.25,.5,1,1.5,2,2.5,3,3.5,4];function P(t,e,n,r){const o=h(r||"knots",n);let a;for(a=1;a<e.length;a++)if(a===e.length-1){if(t<e[a]*o)break}else if(t<=e[a]*o)break;return Math.min(a-1,e.length-2)}function b(t,e,n,r,o){let a=0;switch(e){case"beaufort_kn":a=P(t,k,"knots",n);break;case"beaufort_km":a=P(t,k,"kilometer-per-hour",n);break;case"beaufort_ft":a=P(t,k,"feet-per-second",n);break;case"beaufort_m":a=P(t,k,"meter-per-second",n);break;case"classified_arrow":a=P(t,o,r,n);break;case"ocean_current_m":a=P(t,w,"meter-per-second",n);break;case"ocean_current_kn":a=P(t,y,"knots",n)}return a}function I(t,e){const{style:n,inputUnit:r,outputUnit:o,breakValues:a}=e,s=i.fromJSON(r),h=i.fromJSON(o),l=7*6,c=15;let u=0,f=0;const{width:p,height:m,mask:x}=t,d=t.pixels[0],g=t.pixels[1],k=x?x.filter((t=>t>0)).length:p*m,w=new Float32Array(k*l),y=new Uint32Array(c*k);for(let i=0;i<m;i++)for(let t=0;t<p;t++){const e=i*p+t;if(!x||x[i*p+t]){var P;const r=null!=(P=(g[e]+360)%360/180*Math.PI)?P:2*Math.PI*Math.random(),o=b(d[e],n,s,h,a);for(let n=0;n<M.length;n+=2)w[u++]=(t+.5)/p,w[u++]=(i+.5)/m,w[u++]=M[n],w[u++]=M[n+1]+r,w[u++]=o,w[u++]=d[e];const c=7*(u/l-1);y[f++]=c,y[f++]=c+1,y[f++]=c+2,y[f++]=c+0,y[f++]=c+4,y[f++]=c+3,y[f++]=c+0,y[f++]=c+2,y[f++]=c+3,y[f++]=c+2,y[f++]=c+5,y[f++]=c+3,y[f++]=c+5,y[f++]=c+6,y[f++]=c+3}}return{vertexData:w,indexData:y}}const v=[];function A(t,e){if(0===v.length)for(let s=0;s<30;s++)v.push(d(5*s,0));const n=h(i.fromJSON(e.inputUnit),"knots"),{width:r,height:o,mask:a}=t,l=t.pixels[0],c=t.pixels[1],u=6,f=[],p=[];let m=0,M=0;for(let i=0;i<o;i++)for(let t=0;t<r;t++){const e=i*r+t,h=l[e]*n;if((!a||a[i*r+t])&&h>=s){var x;const n=null!=(x=(c[e]+360)%360/180*Math.PI)?x:2*Math.PI*Math.random(),{pennants:a,barbs:s,shaft:l}=v[Math.min(Math.floor(h/5),29)];if(a.length+s.length===0)continue;let d=f.length/u;const g=(t+.5)/r,k=(i+.5)/o;for(let t=0;t<a.length;t+=2)f[m++]=g,f[m++]=k,f[m++]=a[t],f[m++]=a[t+1]+n,f[m++]=0,f[m++]=h;for(let t=0;t<s.length;t+=2)f[m++]=g,f[m++]=k,f[m++]=s[t],f[m++]=s[t+1]+n,f[m++]=0,f[m++]=h;for(let t=0;t<l.length;t+=2)f[m++]=g,f[m++]=k,f[m++]=l[t],f[m++]=l[t+1]+n,f[m++]=0,f[m++]=h;for(let t=0;t<a.length/6;t++)p[M++]=d,p[M++]=d+1,p[M++]=d+2,d+=3;for(let t=0;t<s.length/8;t++)p[M++]=d,p[M++]=d+1,p[M++]=d+2,p[M++]=d+1,p[M++]=d+2,p[M++]=d+3,d+=4;p[M++]=d+0,p[M++]=d+1,p[M++]=d+2,p[M++]=d+1,p[M++]=d+3,p[M++]=d+2,d+=4}}return{vertexData:new Float32Array(f),indexData:new Uint32Array(p)}}function _(t,e){const n=4*6;let r=0,o=0;const{width:a,height:i,mask:h}=t,l=t.pixels[0],c=[],u=[],f="wind_speed"===e.style?s:Number.MAX_VALUE;for(let s=0;s<i;s++)for(let t=0;t<a;t++){const e=s*a+t;if((!h||h[s*a+t])&&l[e]<f){for(let n=0;n<4;n++)c[r++]=(t+.5)/a,c[r++]=(s+.5)/i,c[r++]=n<2?-.5:.5,c[r++]=n%2==0?-.5:.5,c[r++]=0,c[r++]=l[e];const h=4*(r/n-1);u[o++]=h,u[o++]=h+1,u[o++]=h+2,u[o++]=h+1,u[o++]=h+2,u[o++]=h+3}}return{vertexData:new Float32Array(c),indexData:new Uint32Array(u)}}function U(t,e){return"simple_scalar"===e.style?_(t,e):"wind_speed"===e.style?A(t,e):I(t,e)}function S(t,e,r,o=[0,0],a=.5){const{width:s,height:i,mask:h}=t,[l,f]=t.pixels,[p,m]=o,M=Math.round((s-p)/r),x=Math.round((i-m)/r),d=M*x,g=new Float32Array(d),k=new Float32Array(d),w=new Uint8Array(d),y="vector-uv"===e;for(let n=0;n<x;n++)for(let t=0;t<M;t++){let e=0;const o=n*M+t,x=Math.max(0,n*r+m),d=Math.max(0,t*r+p),P=Math.min(i,x+r),b=Math.min(s,d+r);for(let t=x;t<P;t++)for(let n=d;n<b;n++){const r=t*s+n;if(!h||h[r]){e++;const t=y?[l[r],f[r]]:[l[r],(360+f[r])%360],[n,a]=y?t:u(t);g[o]+=n,k[o]+=a}}if(e>=(P-x)*(b-d)*(1-a)){w[o]=1;const[t,n]=c([g[o]/e,k[o]/e]);g[o]=t,k[o]=n}else w[o]=0,g[o]=0,k[o]=0}const P=new n({width:M,height:x,pixels:[g,k],mask:w});return P.updateStatistics(),P}export{f as convertVectorFieldData,p as convertVectorFieldUnit,U as createVFMesh,_ as createVFMeshScalar,h as getUnitConversionFactor,S as sampleVectorField,m as snapImageToSymbolTile,i as unitKebabDict,c as uvComponentToVector};
5
+ import{JSONMap as t}from"../../../core/jsonMap.js";import{isSome as e}from"../../../core/maybe.js";import n from"../PixelBlock.js";import{isValidPixelBlock as r}from"./pixelUtils.js";const o=new Map;o.set("meter-per-second",1),o.set("kilometer-per-hour",.277778),o.set("knots",.514444),o.set("feet-per-second",.3048),o.set("mile-per-hour",.44704);const a=180/Math.PI,s=5,i=new t({esriMetersPerSecond:"meter-per-second",esriKilometersPerHour:"kilometer-per-hour",esriKnots:"knots",esriFeetPerSecond:"feet-per-second",esriMilesPerHour:"mile-per-hour"});function h(t,e){return o.get(t)/o.get(e)||1}function l(t){return(450-t)%360}function c(t,e="geographic"){const[n,r]=t,o=Math.sqrt(n*n+r*r);let s=Math.atan2(r,n)*a;return s=(360+s)%360,"geographic"===e&&(s=l(s)),[o,s]}function u(t,e="geographic"){let n=t[1];"geographic"===e&&(n=l(n)),n%=360;const r=t[0];return[r*Math.cos(n/a),r*Math.sin(n/a)]}function f(t,e,o="geographic",a=1){if(!r(t))return t;const{pixels:s,width:i,height:h}=t,l=i*h,f=s[0],p=s[1],m=n.createEmptyBand(t.pixelType,l),M=n.createEmptyBand(t.pixelType,l);let d=0;for(let n=0;n<h;n++)for(let t=0;t<i;t++)"vector-uv"===e?([m[d],M[d]]=c([f[d],p[d]],o),m[d]*=a):([m[d],M[d]]=u([f[d],p[d]],o),m[d]*=a,M[d]*=a),d++;const x=new n({pixelType:t.pixelType,width:t.width,height:t.height,mask:t.mask,validPixelCount:t.validPixelCount,maskIsAlpha:t.maskIsAlpha,pixels:[m,M]});return x.updateStatistics(),x}function p(t,e,n=1){if(1===n||!r(t))return t;const o=t.clone(),{pixels:a,width:s,height:i}=o,h=a[0],l=a[1];let c=0;for(let r=0;r<i;r++)for(let t=0;t<s;t++)"vector-uv"===e?(h[c]*=n,l[c]*=n):h[c]*=n,c++;return o.updateStatistics(),o}function m(t,n,r,o,a){if(!e(a)||!a.spatialReference.equals(t.spatialReference))return{extent:t,width:Math.round(n/o),height:Math.round(r/o),resolution:t.width/n};const s=a.xmin,i=a.ymax;o=Math.max(o||0,30);const h=(t.xmax-t.xmin)/n*o,l=(t.ymax-t.ymin)/r*o,c=(h+l)/2;return t.xmin=s+Math.floor((t.xmin-s)/h)*h,t.xmax=s+Math.ceil((t.xmax-s)/h)*h,t.ymin=i+Math.floor((t.ymin-i)/l)*l,t.ymax=i+Math.ceil((t.ymax-i)/l)*l,{extent:t,width:Math.round(t.width/h),height:Math.round(t.height/l),resolution:c}}const M=d(0,0,0);function d(t=0,e=0,n=Math.PI,r=!0){r&&(n=(2*Math.PI-n)%(2*Math.PI));const o=r?-1:1,a=13*o,s=-7*o,i=-2*o,h=-16*o,l=21.75,[c,u]=g(0,e+a,n,l),[f,p]=g(t-5.5,e+s,n,l),[m,M]=g(t+5.5,e+s,n,l),[d,x]=g(t-1.5,e+i,n,l),[k,w]=g(t+1.5,e+i,n,l),[y,P]=g(t-1.5,e+h,n,l),[b,I]=g(t+1.5,e+h,n,l);return[c,u,f,p,d,x,k,w,m,M,y,P,b,I]}function x(t=0,e=Math.PI,n=!0){n&&(e=(2*Math.PI-e)%(2*Math.PI));const r=10,o=n?-1:1,a=5*o,i=20*o,h=25*o,l=45,c=0,u=0,f=2,p=0,m=f*o;let[M,d]=[c+r/2,u-i],[x,k]=[M+f,d],[w,y]=[x-p,k+m],[P,b]=[c-r/2,u-h],[I,v]=[P+p,b-m],A=Math.ceil(t/s),_=Math.floor(A/10);A-=8*_;const U=[],S=[];for(let s=0;s<A/2;s++,_--){_<=0&&A%2==1&&s===(A-1)/2&&(P=c,I=P+p,b=(b+d)/2,v=b-m);const[t,n]=g(P,b,e,l);if(_>0){const[r,o]=g(x,b,e,l),[a,s]=g(M,d,e,l);U.push(r),U.push(o),U.push(t),U.push(n),U.push(a),U.push(s)}else{const[r,o]=g(x,k,e,l),[a,s]=g(w,y,e,l),[i,h]=g(I,v,e,l);S.push(t),S.push(n),S.push(i),S.push(h),S.push(a),S.push(s),S.push(r),S.push(o)}b+=a,d+=a,k+=a,y+=a,v+=a}const[D,F]=g(c+r/2,u+i,e,l),j=r/2+f,[N,J]=g(c+j,u+i,e,l),[O,T]=g(c+r/2,u-h,e,l),[q,B]=g(c+j,u-h,e,l);return{pennants:U,barbs:S,shaft:[D,F,N,J,O,T,q,B]}}function g(t,e,n,r=1){const o=Math.sqrt(t*t+e*e)/r,a=(2*Math.PI+Math.atan2(e,t))%(2*Math.PI);return[o,(2*Math.PI+a-n)%(2*Math.PI)]}const k=[0,1,3,6,10,16,21,27,33,40,47,55,63],w=[0,.5,1,1.5,2],y=[0,.25,.5,1,1.5,2,2.5,3,3.5,4];function P(t,e,n,r){const o=h(r||"knots",n);let a;for(a=1;a<e.length;a++)if(a===e.length-1){if(t<e[a]*o)break}else if(t<=e[a]*o)break;return Math.min(a-1,e.length-2)}function b(t,e,n,r,o){let a=0;switch(e){case"beaufort_kn":a=P(t,k,"knots",n);break;case"beaufort_km":a=P(t,k,"kilometer-per-hour",n);break;case"beaufort_ft":a=P(t,k,"feet-per-second",n);break;case"beaufort_m":a=P(t,k,"meter-per-second",n);break;case"classified_arrow":a=P(t,o,r,n);break;case"ocean_current_m":a=P(t,w,"meter-per-second",n);break;case"ocean_current_kn":a=P(t,y,"knots",n)}return a}function I(t,e){const{style:n,inputUnit:r,outputUnit:o,breakValues:a}=e,s=i.fromJSON(r),h=i.fromJSON(o),l=7*6,c=15;let u=0,f=0;const{width:p,height:m,mask:d}=t,x=t.pixels[0],g=t.pixels[1],k=d?d.filter((t=>t>0)).length:p*m,w=new Float32Array(k*l),y=new Uint32Array(c*k);for(let i=0;i<m;i++)for(let t=0;t<p;t++){const e=i*p+t;if(!d||d[i*p+t]){var P;const r=null!=(P=(g[e]+360)%360/180*Math.PI)?P:2*Math.PI*Math.random(),o=b(x[e],n,s,h,a);for(let n=0;n<M.length;n+=2)w[u++]=(t+.5)/p,w[u++]=(i+.5)/m,w[u++]=M[n],w[u++]=M[n+1]+r,w[u++]=o,w[u++]=x[e];const c=7*(u/l-1);y[f++]=c,y[f++]=c+1,y[f++]=c+2,y[f++]=c+0,y[f++]=c+4,y[f++]=c+3,y[f++]=c+0,y[f++]=c+2,y[f++]=c+3,y[f++]=c+2,y[f++]=c+5,y[f++]=c+3,y[f++]=c+5,y[f++]=c+6,y[f++]=c+3}}return{vertexData:w,indexData:y}}const v=[];function A(t,e){if(0===v.length)for(let s=0;s<30;s++)v.push(x(5*s,0));const n=h(i.fromJSON(e.inputUnit),"knots"),{width:r,height:o,mask:a}=t,l=t.pixels[0],c=t.pixels[1],u=6,f=[],p=[];let m=0,M=0;for(let i=0;i<o;i++)for(let t=0;t<r;t++){const e=i*r+t,h=l[e]*n;if((!a||a[i*r+t])&&h>=s){var d;const n=null!=(d=(c[e]+360)%360/180*Math.PI)?d:2*Math.PI*Math.random(),{pennants:a,barbs:s,shaft:l}=v[Math.min(Math.floor(h/5),29)];if(a.length+s.length===0)continue;let x=f.length/u;const g=(t+.5)/r,k=(i+.5)/o;for(let t=0;t<a.length;t+=2)f[m++]=g,f[m++]=k,f[m++]=a[t],f[m++]=a[t+1]+n,f[m++]=0,f[m++]=h;for(let t=0;t<s.length;t+=2)f[m++]=g,f[m++]=k,f[m++]=s[t],f[m++]=s[t+1]+n,f[m++]=0,f[m++]=h;for(let t=0;t<l.length;t+=2)f[m++]=g,f[m++]=k,f[m++]=l[t],f[m++]=l[t+1]+n,f[m++]=0,f[m++]=h;for(let t=0;t<a.length/6;t++)p[M++]=x,p[M++]=x+1,p[M++]=x+2,x+=3;for(let t=0;t<s.length/8;t++)p[M++]=x,p[M++]=x+1,p[M++]=x+2,p[M++]=x+1,p[M++]=x+2,p[M++]=x+3,x+=4;p[M++]=x+0,p[M++]=x+1,p[M++]=x+2,p[M++]=x+1,p[M++]=x+3,p[M++]=x+2,x+=4}}return{vertexData:new Float32Array(f),indexData:new Uint32Array(p)}}function _(t,e){const n=4*6;let r=0,o=0;const{width:a,height:l,mask:c}=t,u=t.pixels[0],f=[],p=[],m=h(i.fromJSON(e.inputUnit),"knots"),M="wind_speed"===e.style?s:Number.MAX_VALUE;for(let s=0;s<l;s++)for(let t=0;t<a;t++){const e=u[s*a+t]*m;if((!c||c[s*a+t])&&e<M){for(let n=0;n<4;n++)f[r++]=(t+.5)/a,f[r++]=(s+.5)/l,f[r++]=n<2?-.5:.5,f[r++]=n%2==0?-.5:.5,f[r++]=0,f[r++]=e;const i=4*(r/n-1);p[o++]=i,p[o++]=i+1,p[o++]=i+2,p[o++]=i+1,p[o++]=i+2,p[o++]=i+3}}return{vertexData:new Float32Array(f),indexData:new Uint32Array(p)}}function U(t,e){return"simple_scalar"===e.style?_(t,e):"wind_speed"===e.style?A(t,e):I(t,e)}function S(t,e,r,o=[0,0],a=.5){const{width:s,height:i,mask:h}=t,[l,f]=t.pixels,[p,m]=o,M=Math.round((s-p)/r),d=Math.round((i-m)/r),x=M*d,g=new Float32Array(x),k=new Float32Array(x),w=new Uint8Array(x),y="vector-uv"===e;for(let n=0;n<d;n++)for(let t=0;t<M;t++){let e=0;const o=n*M+t,d=Math.max(0,n*r+m),x=Math.max(0,t*r+p),P=Math.min(i,d+r),b=Math.min(s,x+r);for(let t=d;t<P;t++)for(let n=x;n<b;n++){const r=t*s+n;if(!h||h[r]){e++;const t=y?[l[r],f[r]]:[l[r],(360+f[r])%360],[n,a]=y?t:u(t);g[o]+=n,k[o]+=a}}if(e>=(P-d)*(b-x)*(1-a)){w[o]=1;const[t,n]=c([g[o]/e,k[o]/e]);g[o]=t,k[o]=n}else w[o]=0,g[o]=0,k[o]=0}const P=new n({width:M,height:d,pixels:[g,k],mask:w});return P.updateStatistics(),P}export{f as convertVectorFieldData,p as convertVectorFieldUnit,U as createVFMesh,_ as createVFMeshScalar,h as getUnitConversionFactor,S as sampleVectorField,m as snapImageToSymbolTile,i as unitKebabDict,c as uvComponentToVector};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arcgis/core",
3
- "version": "4.23.0-next.20220131",
3
+ "version": "4.23.0-next.20220202",
4
4
  "homepage": "https://js.arcgis.com",
5
5
  "description": "ArcGIS API for JavaScript: A complete 2D and 3D mapping and data visualization API",
6
6
  "keywords": [
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.23/esri/copyright.txt for details.
4
4
  */
5
- import"../../core/has.js";import r from"../../core/Error.js";import{isNone as e}from"../../core/maybe.js";import{to3D as n}from"../../symbols/support/symbolConversion.js";function o(r){return e(r)||"simple"===r.type||"unique-value"===r.type||"class-breaks"===r.type||"dictionary"===r.type}function s(n){if(e(n))return null;if(!o(n))return new r("renderer-conversion-3d:unsupported-renderer",`Unsupported renderer of type '${n.type||n.declaredClass}'`,{renderer:n});switch(n.type){case"simple":return u(n);case"unique-value":return l(n);case"class-breaks":return i(n);case"dictionary":return null}return null}function t(e,n){if(!n)return null;let o;if(o=Array.isArray(n)?n:[n],o.length>0){const n=o.map((r=>r.details.symbol.type||r.details.symbol.declaredClass)).filter((r=>!!r));n.sort();const s=[];return n.forEach(((r,e)=>{0!==e&&r===n[e-1]||s.push(r)})),new r("renderer-conversion-3d:unsupported-symbols",`Renderer contains symbols (${s.join(", ")}) which are not supported in 3D`,{renderer:e,symbolErrors:o})}return null}function u(r){return t(r,n(r.symbol).error)}function l(r){const e=r.uniqueValueInfos.map((r=>n(r.symbol).error)).filter((r=>!!r)),o=n(r.defaultSymbol);return o.error&&e.unshift(o.error),t(r,e)}function i(r){const e=r.classBreakInfos.map((r=>n(r.symbol).error)).filter((r=>!!r)),o=n(r.defaultSymbol);return o.error&&e.unshift(o.error),t(r,e)}export{o as isSupportedRenderer3D,s as validateTo3D};
5
+ import"../../core/has.js";import r from"../../core/Error.js";import{isNone as e}from"../../core/maybe.js";import{to3D as n}from"../../symbols/support/symbolConversion.js";function o(r){return e(r)||"simple"===r.type||"unique-value"===r.type||"class-breaks"===r.type||"dictionary"===r.type||"heatmap"===r.type}function t(n){if(e(n))return null;if(!o(n))return new r("renderer-conversion-3d:unsupported-renderer",`Unsupported renderer of type '${n.type||n.declaredClass}'`,{renderer:n});switch(n.type){case"simple":return u(n);case"unique-value":return l(n);case"class-breaks":return i(n);case"dictionary":case"heatmap":return null}return null}function s(e,n){if(!n)return null;let o;if(o=Array.isArray(n)?n:[n],o.length>0){const n=o.map((r=>r.details.symbol.type||r.details.symbol.declaredClass)).filter((r=>!!r));n.sort();const t=[];return n.forEach(((r,e)=>{0!==e&&r===n[e-1]||t.push(r)})),new r("renderer-conversion-3d:unsupported-symbols",`Renderer contains symbols (${t.join(", ")}) which are not supported in 3D`,{renderer:e,symbolErrors:o})}return null}function u(r){return s(r,n(r.symbol).error)}function l(r){const e=r.uniqueValueInfos.map((r=>n(r.symbol).error)).filter((r=>!!r)),o=n(r.defaultSymbol);return o.error&&e.unshift(o.error),s(r,e)}function i(r){const e=r.classBreakInfos.map((r=>n(r.symbol).error)).filter((r=>!!r)),o=n(r.defaultSymbol);return o.error&&e.unshift(o.error),s(r,e)}export{o as isSupportedRenderer3D,t as validateTo3D};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.23/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../chunks/tslib.es6.js";import{geometryTypes as t}from"../../geometry.js";import r from"../../Graphic.js";import{JSONMap as o}from"../../core/jsonMap.js";import{JSONSupport as s}from"../../core/JSONSupport.js";import{clone as i}from"../../core/lang.js";import{isSome as n,unwrap as p}from"../../core/maybe.js";import{property as a}from"../../core/accessorSupport/decorators/property.js";import"../../core/accessorSupport/ensureType.js";import{reader as l}from"../../core/accessorSupport/decorators/reader.js";import{subclass as y}from"../../core/accessorSupport/decorators/subclass.js";import{writer as m}from"../../core/accessorSupport/decorators/writer.js";import u from"../../geometry/SpatialReference.js";import{fromJSON as c,isPolygon as f}from"../../geometry/support/jsonUtils.js";import h from"../../layers/support/Field.js";var d;const g=new o({esriGeometryPoint:"point",esriGeometryMultipoint:"multipoint",esriGeometryPolyline:"polyline",esriGeometryPolygon:"polygon",esriGeometryEnvelope:"extent",mesh:"mesh","":null});let j=d=class extends s{constructor(e){super(e),this.displayFieldName=null,this.exceededTransferLimit=!1,this.features=[],this.fields=null,this.geometryType=null,this.hasM=!1,this.hasZ=!1,this.queryGeometry=null,this.spatialReference=null}readFeatures(e,t){const o=u.fromJSON(t.spatialReference),s=[];for(let i=0;i<e.length;i++){const t=e[i],p=r.fromJSON(t),a=t.geometry&&t.geometry.spatialReference;n(p.geometry)&&!a&&(p.geometry.spatialReference=o),s.push(p)}return s}writeGeometryType(e,t,r,o){if(e)return void g.write(e,t,r,o);const{features:s}=this;if(s)for(const i of s)if(i&&n(i.geometry))return void g.write(i.geometry.type,t,r,o)}readQueryGeometry(e,t){if(!e)return null;const r=!!e.spatialReference,o=c(e);return!r&&t.spatialReference&&(o.spatialReference=u.fromJSON(t.spatialReference)),o}writeSpatialReference(e,t){if(e)return void(t.spatialReference=e.toJSON());const{features:r}=this;if(r)for(const o of r)if(o&&n(o.geometry)&&o.geometry.spatialReference)return void(t.spatialReference=o.geometry.spatialReference.toJSON())}clone(){return new d(this.cloneProperties())}cloneProperties(){return i({displayFieldName:this.displayFieldName,exceededTransferLimit:this.exceededTransferLimit,features:this.features,fields:this.fields,geometryType:this.geometryType,hasM:this.hasM,hasZ:this.hasZ,queryGeometry:this.queryGeometry,spatialReference:this.spatialReference,transform:this.transform})}toJSON(e){const t=this.write();if(t.features&&Array.isArray(e)&&e.length>0)for(let r=0;r<t.features.length;r++){const o=t.features[r];if(o.geometry){const t=e&&e[r];o.geometry=t&&t.toJSON()||o.geometry}}return t}quantize(e){const{scale:[t,r],translate:[o,s]}=e,i=e=>Math.round((e-o)/t),n=e=>Math.round((s-e)/r),a=this.features,l=this._getQuantizationFunction(this.geometryType,i,n);for(let y=0,m=a.length;y<m;y++)l(p(a[y].geometry))||(a.splice(y,1),y--,m--);return this.transform=e,this}unquantize(){const{geometryType:e,features:t,transform:r}=this;if(!r)return this;const{translate:[o,s],scale:[i,p]}=r,a=e=>e*i+o,l=e=>s-e*p,y=this._getHydrationFunction(e,a,l);for(const{geometry:m}of t)n(m)&&y(m);return this.transform=null,this}_quantizePoints(e,t,r){let o,s;const i=[];for(let n=0,p=e.length;n<p;n++){const p=e[n];if(n>0){const e=t(p[0]),n=r(p[1]);e===o&&n===s||(i.push([e-o,n-s]),o=e,s=n)}else o=t(p[0]),s=r(p[1]),i.push([o,s])}return i.length>0?i:null}_getQuantizationFunction(e,t,r){return"point"===e?e=>(e.x=t(e.x),e.y=r(e.y),e):"polyline"===e||"polygon"===e?e=>{const o=f(e)?e.rings:e.paths,s=[];for(let i=0,n=o.length;i<n;i++){const e=o[i],n=this._quantizePoints(e,t,r);n&&s.push(n)}return s.length>0?(f(e)?e.rings=s:e.paths=s,e):null}:"multipoint"===e?e=>{const o=this._quantizePoints(e.points,t,r);return o.length>0?(e.points=o,e):null}:"extent"===e?e=>e:null}_getHydrationFunction(e,t,r){return"point"===e?e=>{e.x=t(e.x),e.y=r(e.y)}:"polyline"===e||"polygon"===e?e=>{const o=f(e)?e.rings:e.paths;let s,i;for(let n=0,p=o.length;n<p;n++){const e=o[n];for(let o=0,n=e.length;o<n;o++){const n=e[o];o>0?(s+=n[0],i+=n[1]):(s=n[0],i=n[1]),n[0]=t(s),n[1]=r(i)}}}:"extent"===e?e=>{e.xmin=t(e.xmin),e.ymin=r(e.ymin),e.xmax=t(e.xmax),e.ymax=r(e.ymax)}:"multipoint"===e?e=>{const o=e.points;let s,i;for(let n=0,p=o.length;n<p;n++){const e=o[n];n>0?(s+=e[0],i+=e[1]):(s=e[0],i=e[1]),e[0]=t(s),e[1]=r(i)}}:void 0}};e([a({type:String,json:{write:!0}})],j.prototype,"displayFieldName",void 0),e([a({type:Boolean,json:{write:{overridePolicy:e=>({enabled:e})}}})],j.prototype,"exceededTransferLimit",void 0),e([a({type:[r],json:{write:!0}})],j.prototype,"features",void 0),e([l("features")],j.prototype,"readFeatures",null),e([a({type:[h],json:{write:!0}})],j.prototype,"fields",void 0),e([a({type:["point","multipoint","polyline","polygon","extent","mesh"],json:{read:{reader:g.read}}})],j.prototype,"geometryType",void 0),e([m("geometryType")],j.prototype,"writeGeometryType",null),e([a({type:Boolean,json:{write:{overridePolicy:e=>({enabled:e})}}})],j.prototype,"hasM",void 0),e([a({type:Boolean,json:{write:{overridePolicy:e=>({enabled:e})}}})],j.prototype,"hasZ",void 0),e([a({types:t,json:{write:!0}})],j.prototype,"queryGeometry",void 0),e([l("queryGeometry")],j.prototype,"readQueryGeometry",null),e([a({type:u,json:{write:!0}})],j.prototype,"spatialReference",void 0),e([m("spatialReference")],j.prototype,"writeSpatialReference",null),e([a({json:{write:!0}})],j.prototype,"transform",void 0),j=d=e([y("esri.rest.support.FeatureSet")],j),j.prototype.toJSON.isDefaultToJSON=!0;const x=j;export{x as default};
5
+ import{_ as e}from"../../chunks/tslib.es6.js";import{geometryTypes as t}from"../../geometry.js";import r from"../../Graphic.js";import{JSONMap as o}from"../../core/jsonMap.js";import{JSONSupport as s}from"../../core/JSONSupport.js";import{clone as i}from"../../core/lang.js";import{isSome as n,unwrap as a}from"../../core/maybe.js";import{property as p}from"../../core/accessorSupport/decorators/property.js";import"../../core/accessorSupport/ensureType.js";import{reader as l}from"../../core/accessorSupport/decorators/reader.js";import{subclass as y}from"../../core/accessorSupport/decorators/subclass.js";import{writer as m}from"../../core/accessorSupport/decorators/writer.js";import c from"../../geometry/SpatialReference.js";import{fromJSON as u,isPolygon as f}from"../../geometry/support/jsonUtils.js";import h from"../../layers/support/Field.js";var d;const g=new o({esriGeometryPoint:"point",esriGeometryMultipoint:"multipoint",esriGeometryPolyline:"polyline",esriGeometryPolygon:"polygon",esriGeometryEnvelope:"extent",mesh:"mesh","":null});let j=d=class extends s{constructor(e){super(e),this.displayFieldName=null,this.exceededTransferLimit=!1,this.features=[],this.fields=null,this.geometryType=null,this.hasM=!1,this.hasZ=!1,this.queryGeometry=null,this.spatialReference=null}readFeatures(e,t){const o=c.fromJSON(t.spatialReference),s=[];for(let i=0;i<e.length;i++){const t=e[i],a=r.fromJSON(t),p=t.geometry&&t.geometry.spatialReference;n(a.geometry)&&!p&&(a.geometry.spatialReference=o);const l=t.aggregateGeometries,y=a.aggregateGeometries;if(l&&n(y))for(const e in y){const t=y[e],r=l[e],s=null==r?void 0:r.spatialReference;n(t)&&!s&&(t.spatialReference=o)}s.push(a)}return s}writeGeometryType(e,t,r,o){if(e)return void g.write(e,t,r,o);const{features:s}=this;if(s)for(const i of s)if(i&&n(i.geometry))return void g.write(i.geometry.type,t,r,o)}readQueryGeometry(e,t){if(!e)return null;const r=!!e.spatialReference,o=u(e);return!r&&t.spatialReference&&(o.spatialReference=c.fromJSON(t.spatialReference)),o}writeSpatialReference(e,t){if(e)return void(t.spatialReference=e.toJSON());const{features:r}=this;if(r)for(const o of r)if(o&&n(o.geometry)&&o.geometry.spatialReference)return void(t.spatialReference=o.geometry.spatialReference.toJSON())}clone(){return new d(this.cloneProperties())}cloneProperties(){return i({displayFieldName:this.displayFieldName,exceededTransferLimit:this.exceededTransferLimit,features:this.features,fields:this.fields,geometryType:this.geometryType,hasM:this.hasM,hasZ:this.hasZ,queryGeometry:this.queryGeometry,spatialReference:this.spatialReference,transform:this.transform})}toJSON(e){const t=this.write();if(t.features&&Array.isArray(e)&&e.length>0)for(let r=0;r<t.features.length;r++){const o=t.features[r];if(o.geometry){const t=e&&e[r];o.geometry=t&&t.toJSON()||o.geometry}}return t}quantize(e){const{scale:[t,r],translate:[o,s]}=e,i=e=>Math.round((e-o)/t),n=e=>Math.round((s-e)/r),p=this.features,l=this._getQuantizationFunction(this.geometryType,i,n);for(let y=0,m=p.length;y<m;y++)l(a(p[y].geometry))||(p.splice(y,1),y--,m--);return this.transform=e,this}unquantize(){const{geometryType:e,features:t,transform:r}=this;if(!r)return this;const{translate:[o,s],scale:[i,a]}=r,p=e=>e*i+o,l=e=>s-e*a,y=this._getHydrationFunction(e,p,l);for(const{geometry:m}of t)n(m)&&y(m);return this.transform=null,this}_quantizePoints(e,t,r){let o,s;const i=[];for(let n=0,a=e.length;n<a;n++){const a=e[n];if(n>0){const e=t(a[0]),n=r(a[1]);e===o&&n===s||(i.push([e-o,n-s]),o=e,s=n)}else o=t(a[0]),s=r(a[1]),i.push([o,s])}return i.length>0?i:null}_getQuantizationFunction(e,t,r){return"point"===e?e=>(e.x=t(e.x),e.y=r(e.y),e):"polyline"===e||"polygon"===e?e=>{const o=f(e)?e.rings:e.paths,s=[];for(let i=0,n=o.length;i<n;i++){const e=o[i],n=this._quantizePoints(e,t,r);n&&s.push(n)}return s.length>0?(f(e)?e.rings=s:e.paths=s,e):null}:"multipoint"===e?e=>{const o=this._quantizePoints(e.points,t,r);return o.length>0?(e.points=o,e):null}:"extent"===e?e=>e:null}_getHydrationFunction(e,t,r){return"point"===e?e=>{e.x=t(e.x),e.y=r(e.y)}:"polyline"===e||"polygon"===e?e=>{const o=f(e)?e.rings:e.paths;let s,i;for(let n=0,a=o.length;n<a;n++){const e=o[n];for(let o=0,n=e.length;o<n;o++){const n=e[o];o>0?(s+=n[0],i+=n[1]):(s=n[0],i=n[1]),n[0]=t(s),n[1]=r(i)}}}:"extent"===e?e=>{e.xmin=t(e.xmin),e.ymin=r(e.ymin),e.xmax=t(e.xmax),e.ymax=r(e.ymax)}:"multipoint"===e?e=>{const o=e.points;let s,i;for(let n=0,a=o.length;n<a;n++){const e=o[n];n>0?(s+=e[0],i+=e[1]):(s=e[0],i=e[1]),e[0]=t(s),e[1]=r(i)}}:void 0}};e([p({type:String,json:{write:!0}})],j.prototype,"displayFieldName",void 0),e([p({type:Boolean,json:{write:{overridePolicy:e=>({enabled:e})}}})],j.prototype,"exceededTransferLimit",void 0),e([p({type:[r],json:{write:!0}})],j.prototype,"features",void 0),e([l("features")],j.prototype,"readFeatures",null),e([p({type:[h],json:{write:!0}})],j.prototype,"fields",void 0),e([p({type:["point","multipoint","polyline","polygon","extent","mesh"],json:{read:{reader:g.read}}})],j.prototype,"geometryType",void 0),e([m("geometryType")],j.prototype,"writeGeometryType",null),e([p({type:Boolean,json:{write:{overridePolicy:e=>({enabled:e})}}})],j.prototype,"hasM",void 0),e([p({type:Boolean,json:{write:{overridePolicy:e=>({enabled:e})}}})],j.prototype,"hasZ",void 0),e([p({types:t,json:{write:!0}})],j.prototype,"queryGeometry",void 0),e([l("queryGeometry")],j.prototype,"readQueryGeometry",null),e([p({type:c,json:{write:!0}})],j.prototype,"spatialReference",void 0),e([m("spatialReference")],j.prototype,"writeSpatialReference",null),e([p({json:{write:!0}})],j.prototype,"transform",void 0),j=d=e([y("esri.rest.support.FeatureSet")],j),j.prototype.toJSON.isDefaultToJSON=!0;const x=j;export{x 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.23/esri/copyright.txt for details.
4
4
  */
5
- import e from"../core/has.js";const r=()=>!!e("enable-feature:force-wosr"),a=()=>!!e("enable-feature:direct-3d-object-feature-layer-display"),t=()=>!!e("enable-feature:precipitation");export{a as enableDirect3DObjectFeatureLayerDisplay,t as enablePrecipitation,r as enableWebStyleForceWOSR};
5
+ import e from"../core/has.js";const r=()=>!!e("enable-feature:force-wosr"),a=()=>!!e("enable-feature:direct-3d-object-feature-layer-display"),t=()=>!!e("enable-feature:precipitation"),o=()=>!!e("enable-feature:text-backgrounds-3d");export{a as enableDirect3DObjectFeatureLayerDisplay,t as enablePrecipitation,o as enableTextBackgrounds3D,r as enableWebStyleForceWOSR};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.23/esri/copyright.txt for details.
4
4
  */
5
- const b="20220131",c="28cd6b6a22e238ddb4c2410b0b640a61ffb269ac";export{b as buildDate,c as commitHash};
5
+ const b="20220202",c="ec42815fca85b0dd4b56e790bbbdfe5ccff4337d";export{b as buildDate,c as commitHash};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.23/esri/copyright.txt for details.
4
4
  */
5
- import{_ as t}from"../chunks/tslib.es6.js";import{clone as e}from"../core/lang.js";import{isSome as o}from"../core/maybe.js";import{property as i}from"../core/accessorSupport/decorators/property.js";import"../core/accessorSupport/ensureType.js";import{enumeration as r}from"../core/accessorSupport/decorators/enumeration.js";import{subclass as s}from"../core/accessorSupport/decorators/subclass.js";import{writer as n}from"../core/accessorSupport/decorators/writer.js";import l from"./Font.js";import p from"./Symbol3DLayer.js";import{screenSizeProperty as a}from"./support/materialUtils.js";import{Symbol3DHalo as m}from"./support/Symbol3DHalo.js";import{Symbol3DMaterial as h}from"./support/Symbol3DMaterial.js";import{lineHeightProperty as c}from"./support/textUtils.js";var u;let f=u=class extends p{constructor(t){super(t),this._userSize=void 0,this.halo=null,this.horizontalAlignment="center",this.lineHeight=1,this.material=null,this.text=null,this.type="text",this.verticalAlignment="middle"}get font(){return this._get("font")||null}set font(t){o(t)&&o(this._userSize)&&(t.size=this._userSize),this._set("font",t)}writeFont(t,e,o,i){const r={...i,textSymbol3D:!0};e.font=t.write({},r),delete e.font.size}get size(){return o(this._userSize)?this._userSize:o(this.font)&&null!=this.font.size?this.font.size:9}set size(t){this._userSize=t,o(this.font)&&(this.font.size=this._userSize),this.notifyChange("size")}clone(){return new u({enabled:this.enabled,font:this.font&&e(this.font),halo:this.halo&&e(this.halo),horizontalAlignment:this.horizontalAlignment,lineHeight:this.lineHeight,material:o(this.material)?this.material.clone():null,size:this.size,text:this.text,verticalAlignment:this.verticalAlignment})}static fromTextSymbol(t){return new u({font:o(t.font)?t.font.clone():new l,halo:y(t.haloColor,t.haloSize),horizontalAlignment:t.horizontalAlignment,lineHeight:t.lineHeight,material:t.color?{color:t.color.clone()}:null,text:t.text,verticalAlignment:t.verticalAlignment})}};function y(t,o){return t&&o>0?{color:e(t),size:o}:null}t([i({type:l,json:{write:!0}})],f.prototype,"font",null),t([n("font")],f.prototype,"writeFont",null),t([i({type:m,json:{write:!0}})],f.prototype,"halo",void 0),t([i()],f.prototype,"horizontalAlignment",void 0),t([i(c)],f.prototype,"lineHeight",void 0),t([i({type:h,json:{write:!0}})],f.prototype,"material",void 0),t([i(a)],f.prototype,"size",null),t([i({type:String,json:{write:!0}})],f.prototype,"text",void 0),t([r({Text:"text"},{readOnly:!0})],f.prototype,"type",void 0),t([i()],f.prototype,"verticalAlignment",void 0),f=u=t([s("esri.symbols.TextSymbol3DLayer")],f);const z=f;export{z as default};
5
+ import{_ as t}from"../chunks/tslib.es6.js";import{clone as o}from"../core/lang.js";import{isSome as e}from"../core/maybe.js";import{property as r}from"../core/accessorSupport/decorators/property.js";import"../core/accessorSupport/ensureType.js";import{enumeration as i}from"../core/accessorSupport/decorators/enumeration.js";import{subclass as s}from"../core/accessorSupport/decorators/subclass.js";import{writer as n}from"../core/accessorSupport/decorators/writer.js";import l from"./Font.js";import a from"./Symbol3DLayer.js";import{screenSizeProperty as p}from"./support/materialUtils.js";import{Symbol3DHalo as m}from"./support/Symbol3DHalo.js";import{Symbol3DMaterial as h}from"./support/Symbol3DMaterial.js";import{Symbol3DTextBackground as c}from"./support/Symbol3DTextBackground.js";import{lineHeightProperty as u}from"./support/textUtils.js";var f;let y=f=class extends a{constructor(t){super(t),this._userSize=void 0,this.halo=null,this.horizontalAlignment="center",this.lineHeight=1,this.material=null,this.text=null,this.type="text",this.verticalAlignment="middle"}get font(){return this._get("font")||null}set font(t){e(t)&&e(this._userSize)&&(t.size=this._userSize),this._set("font",t)}writeFont(t,o,e,r){const i={...r,textSymbol3D:!0};o.font=t.write({},i),delete o.font.size}get size(){return e(this._userSize)?this._userSize:e(this.font)&&null!=this.font.size?this.font.size:9}set size(t){this._userSize=t,e(this.font)&&(this.font.size=this._userSize),this.notifyChange("size")}clone(){return new f({enabled:this.enabled,font:this.font&&o(this.font),halo:this.halo&&o(this.halo),horizontalAlignment:this.horizontalAlignment,lineHeight:this.lineHeight,material:e(this.material)?this.material.clone():null,size:this.size,text:this.text,verticalAlignment:this.verticalAlignment,background:o(this.background)})}static fromTextSymbol(t){return new f({font:e(t.font)?t.font.clone():new l,halo:g(t.haloColor,t.haloSize),horizontalAlignment:t.horizontalAlignment,lineHeight:t.lineHeight,material:t.color?new h({color:t.color.clone()}):null,text:t.text,verticalAlignment:t.verticalAlignment,background:t.backgroundColor?new c({color:t.backgroundColor.clone()}):null})}};function g(t,e){return t&&e>0?new m({color:o(t),size:e}):null}t([r({type:l,json:{write:!0}})],y.prototype,"font",null),t([n("font")],y.prototype,"writeFont",null),t([r({type:m,json:{write:!0}})],y.prototype,"halo",void 0),t([r()],y.prototype,"horizontalAlignment",void 0),t([r(u)],y.prototype,"lineHeight",void 0),t([r({type:h,json:{write:!0}})],y.prototype,"material",void 0),t([r({type:c,json:{write:!0,origins:{"web-document":{write:!1},"portal-item":{write:!1}}}})],y.prototype,"background",void 0),t([r(p)],y.prototype,"size",null),t([r({type:String,json:{write:!0}})],y.prototype,"text",void 0),t([i({Text:"text"},{readOnly:!0})],y.prototype,"type",void 0),t([r()],y.prototype,"verticalAlignment",void 0),y=f=t([s("esri.symbols.TextSymbol3DLayer")],y);const d=y;export{d as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.23/esri/copyright.txt for details.
4
4
  */
5
- import{_ as o}from"../../chunks/tslib.es6.js";import r from"../../Color.js";import{JSONSupport as s}from"../../core/JSONSupport.js";import{clone as t}from"../../core/lang.js";import{property as e}from"../../core/accessorSupport/decorators/property.js";import"../../core/accessorSupport/ensureType.js";import{subclass as p}from"../../core/accessorSupport/decorators/subclass.js";import{colorAndTransparencyProperty as c,screenSizeProperty as i}from"./materialUtils.js";var m;let l=m=class extends s{constructor(){super(...arguments),this.color=new r([0,0,0,1]),this.size=0}clone(){return new m({color:t(this.color),size:this.size})}};o([e(c)],l.prototype,"color",void 0),o([e(i)],l.prototype,"size",void 0),l=m=o([p("esri.symbols.support.Symbol3DHalo")],l);export{l as Symbol3DHalo};
5
+ import{_ as o}from"../../chunks/tslib.es6.js";import r from"../../Color.js";import{JSONSupport as s}from"../../core/JSONSupport.js";import{clone as t}from"../../core/lang.js";import{property as e}from"../../core/accessorSupport/decorators/property.js";import"../../core/accessorSupport/ensureType.js";import{subclass as p}from"../../core/accessorSupport/decorators/subclass.js";import{colorAndTransparencyProperty as c,screenSizeProperty as i}from"./materialUtils.js";var m;let l=m=class extends s{constructor(){super(...arguments),this.color=new r([0,0,0,1]),this.size=0}clone(){const o={color:t(this.color),size:this.size};return new m(o)}};o([e(c)],l.prototype,"color",void 0),o([e(i)],l.prototype,"size",void 0),l=m=o([p("esri.symbols.support.Symbol3DHalo")],l);export{l as Symbol3DHalo};
@@ -0,0 +1,5 @@
1
+ /*
2
+ All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
+ See https://js.arcgis.com/4.23/esri/copyright.txt for details.
4
+ */
5
+ import{_ as o}from"../../chunks/tslib.es6.js";import r from"../../Color.js";import{ClonableMixin as s}from"../../core/Clonable.js";import{JSONSupport as t}from"../../core/JSONSupport.js";import{property as e}from"../../core/accessorSupport/decorators/property.js";import"../../core/arrayUtils.js";import"../../core/has.js";import"../../core/accessorSupport/ensureType.js";import{subclass as p}from"../../core/accessorSupport/decorators/subclass.js";let c=class extends(s(t)){constructor(o){super(o),this.color=null}};o([e({type:r,json:{write:!0}})],c.prototype,"color",void 0),c=o([p("esri.symbols.support.Symbol3DTextBackground")],c);export{c as Symbol3DTextBackground};
@@ -0,0 +1,5 @@
1
+ /*
2
+ All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
+ See https://js.arcgis.com/4.23/esri/copyright.txt for details.
4
+ */
5
+ import{WGLDrawPhase as e}from"./webgl/enums.js";import r from"./webgl/WGLContainer.js";import s from"./webgl/brushes/raster/BrushVectorField.js";class t extends r{constructor(){super(...arguments),this.symbolTypes=["triangle"]}get requiresDedicatedFBO(){return!1}prepareRenderPasses(r){const t=r.registerRenderPass({name:"imagery (vf)",brushes:[s],target:()=>this.children,drawPhase:e.MAP});return[...super.prepareRenderPasses(r),t]}doRender(r){this.visible&&r.drawPhase===e.MAP&&this.symbolTypes.forEach((e=>{r.renderPass=e,super.doRender(r)}))}}export{t as RasterVFContainer};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.23/esri/copyright.txt for details.
4
4
  */
5
- import"../../../core/has.js";import{isSome as e}from"../../../core/maybe.js";import{c as t}from"../../../chunks/mat3f32.js";import{createVFMesh as a,createVFMeshScalar as s}from"../../../layers/support/rasterFunctions/vectorFieldUtils.js";import{DisplayObject as r}from"./DisplayObject.js";import{createProgramDescriptor as i}from"./webgl/Utils.js";import{BufferObject as o}from"../../webgl/BufferObject.js";import{Usage as l,DataType as c}from"../../webgl/enums.js";import{VertexArrayObject as n}from"../../webgl/VertexArrayObject.js";class m extends r{constructor(e=null){super(),this._source=null,this._symbolizerParameters=null,this._vaoInvalidated=!0,this.coordScale=[1,1],this.height=null,this.stencilRef=0,this.rawPixelData=null,this.width=null,this.source=e}destroy(){var t,a;e(this.vaoData)&&(null==(t=this.vaoData.magdir)||t.vao.dispose(),null==(a=this.vaoData.scalar)||a.vao.dispose(),this.vaoData=null)}get symbolizerParameters(){return this._symbolizerParameters}set symbolizerParameters(e){JSON.stringify(this._symbolizerParameters)!==JSON.stringify(e)&&(this._symbolizerParameters=e,this.invalidateVAO())}get source(){return this._source}set source(e){this._source=e,this.invalidateVAO()}invalidateVAO(){var t,a;!this._vaoInvalidated&&e(this.vaoData)&&(null==(t=this.vaoData.magdir)||t.vao.dispose(),null==(a=this.vaoData.scalar)||a.vao.dispose(),this.vaoData=null,this._vaoInvalidated=!0,this.requestRender())}updateVectorFieldVAO(t){if(this._vaoInvalidated){if(this._vaoInvalidated=!1,e(this.source)&&!e(this.vaoData)){const{style:e}=this.symbolizerParameters;switch(e){case"beaufort_ft":case"beaufort_km":case"beaufort_kn":case"beaufort_m":case"beaufort_mi":case"classified_arrow":case"ocean_current_kn":case"ocean_current_m":case"single_arrow":{const e=a(this.source,this.symbolizerParameters),s=this._createVectorFieldVAO(t.context,e);this.vaoData={magdir:s}}break;case"simple_scalar":{const e=s(this.source,this.symbolizerParameters),a=this._createVectorFieldVAO(t.context,e);this.vaoData={scalar:a}}break;case"wind_speed":{const e=a(this.source,this.symbolizerParameters),r=this._createVectorFieldVAO(t.context,e),i=s(this.source,this.symbolizerParameters),o=this._createVectorFieldVAO(t.context,i);this.vaoData={magdir:r,scalar:o}}}}this.ready(),this.requestRender()}}_createTransforms(){return{dvs:t()}}onAttach(){this.invalidateVAO()}onDetach(){this.invalidateVAO()}_createVectorFieldVAO(e,t){const{vertexData:a,indexData:s}=t,r=o.createVertex(e,l.STATIC_DRAW,new Float32Array(a)),m=o.createIndex(e,l.STATIC_DRAW,new Uint32Array(s)),h=i("vector-field",{geometry:[{location:0,name:"a_pos",count:2,type:c.FLOAT,normalized:!1},{location:1,name:"a_offset",count:2,type:c.FLOAT,normalized:!1},{location:2,name:"a_vv",count:2,type:c.FLOAT,normalized:!1}]});return{vao:new n(e,h.attributes,h.bufferLayouts,{geometry:r},m),elementCount:s.length}}}export{m as RasterVFDisplayObject};
5
+ import"../../../core/has.js";import{isSome as t}from"../../../core/maybe.js";import{b as e,c as s,r as a,j as r,m as i}from"../../../chunks/mat3.js";import{c as o}from"../../../chunks/mat3f32.js";import{f as n}from"../../../chunks/vec2f32.js";import{createVFMesh as l,createVFMeshScalar as c}from"../../../layers/support/rasterFunctions/vectorFieldUtils.js";import{DisplayObject as h}from"./DisplayObject.js";import{createProgramDescriptor as m}from"./webgl/Utils.js";import{BufferObject as u}from"../../webgl/BufferObject.js";import{Usage as d,DataType as v}from"../../webgl/enums.js";import{VertexArrayObject as f}from"../../webgl/VertexArrayObject.js";class _ extends h{constructor(t=null){super(),this._source=null,this._symbolizerParameters=null,this._vaoInvalidated=!0,this.coordScale=[1,1],this.height=null,this.stencilRef=0,this.resolution=null,this.pixelRatio=1,this.x=0,this.y=0,this.rotation=0,this.rawPixelData=null,this.width=null,this.source=t}destroy(){var e,s;t(this.vaoData)&&(null==(e=this.vaoData.magdir)||e.vao.dispose(),null==(s=this.vaoData.scalar)||s.vao.dispose(),this.vaoData=null)}get symbolizerParameters(){return this._symbolizerParameters}set symbolizerParameters(t){JSON.stringify(this._symbolizerParameters)!==JSON.stringify(t)&&(this._symbolizerParameters=t,this.invalidateVAO())}get source(){return this._source}set source(t){this._source=t,this.invalidateVAO()}invalidateVAO(){var e,s;!this._vaoInvalidated&&t(this.vaoData)&&(null==(e=this.vaoData.magdir)||e.vao.dispose(),null==(s=this.vaoData.scalar)||s.vao.dispose(),this.vaoData=null,this._vaoInvalidated=!0,this.requestRender())}updateVectorFieldVAO(e){if(this._vaoInvalidated){if(this._vaoInvalidated=!1,t(this.source)&&!t(this.vaoData)){const{style:t}=this.symbolizerParameters;switch(t){case"beaufort_ft":case"beaufort_km":case"beaufort_kn":case"beaufort_m":case"beaufort_mi":case"classified_arrow":case"ocean_current_kn":case"ocean_current_m":case"single_arrow":{const t=l(this.source,this.symbolizerParameters),s=this._createVectorFieldVAO(e.context,t);this.vaoData={magdir:s}}break;case"simple_scalar":{const t=c(this.source,this.symbolizerParameters),s=this._createVectorFieldVAO(e.context,t);this.vaoData={scalar:s}}break;case"wind_speed":{const t=l(this.source,this.symbolizerParameters),s=this._createVectorFieldVAO(e.context,t),a=c(this.source,this.symbolizerParameters),r=this._createVectorFieldVAO(e.context,a);this.vaoData={magdir:s,scalar:r}}}}this.ready(),this.requestRender()}}_createTransforms(){return{dvs:o()}}setTransform(t){const o=e(this.transforms.dvs),[l,c]=t.toScreenNoRotation([0,0],[this.x,this.y]),h=this.resolution/this.pixelRatio/t.resolution,m=h*this.width,u=h*this.height,d=Math.PI*this.rotation/180;s(o,o,n(l,c)),s(o,o,n(m/2,u/2)),a(o,o,-d),s(o,o,n(-m/2,-u/2)),r(o,o,n(m,u)),i(this.transforms.dvs,t.displayViewMat3,o)}onAttach(){this.invalidateVAO()}onDetach(){this.invalidateVAO()}_createVectorFieldVAO(t,e){const{vertexData:s,indexData:a}=e,r=u.createVertex(t,d.STATIC_DRAW,new Float32Array(s)),i=u.createIndex(t,d.STATIC_DRAW,new Uint32Array(a)),o=m("vector-field",{geometry:[{location:0,name:"a_pos",count:2,type:v.FLOAT,normalized:!1},{location:1,name:"a_offset",count:2,type:v.FLOAT,normalized:!1},{location:2,name:"a_vv",count:2,type:v.FLOAT,normalized:!1}]});return{vao:new f(t,o.attributes,o.bufferLayouts,{geometry:r},i),elementCount:a.length}}}export{_ as RasterVFDisplayObject};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.23/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../../chunks/tslib.es6.js";import t from"../../../../Graphic.js";import r from"../../../../core/Accessor.js";import{property as s}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/arrayUtils.js";import"../../../../core/has.js";import"../../../../core/accessorSupport/ensureType.js";import{subclass as o}from"../../../../core/accessorSupport/decorators/subclass.js";import{loadImagery as i}from"./dataUtils.js";import a from"./FlowContainer.js";import n from"./FlowStrategy.js";import l from"./FlowStyle.js";let p=class extends r{constructor(){super(...arguments),this._loadImagery=(e,t,r,s)=>i(this.layer,e,t,r,s),this._createStreamlinesMesh=(e,t,r)=>this.layer.createStreamlinesMesh({flowData:t,rendererSettings:e},{signal:r}),this.container=null,this.layer=null,this.type="rasterAnimatedFlow",this.redrawOrRefetch=async()=>{this._rendererChanged()}}get updating(){return!this._strategy||this._strategy.updating}update(e){e.stationary?this._strategy.update(e):this.layerView.requestUpdate()}hitTest(e){return new t({attributes:{},geometry:e.clone(),layer:this.layer})}install(e){this.container=new a,e.addChild(this.container),this._strategy=new n({flowContainer:this.container}),this._rendererChanged()}uninstall(){this._strategy.destroy(),this.container.removeAllChildren(),this.container.remove()}moveEnd(){}async doRefresh(){}attach(){}_rendererChanged(){if("animated-flow"!==this.layer.renderer.type)return;const e=new l(this._loadImagery,this._createStreamlinesMesh,this.layer.renderer);this.container.flowStyle=e,this.layerView.requestUpdate()}};e([s()],p.prototype,"_strategy",void 0),e([s()],p.prototype,"container",void 0),e([s()],p.prototype,"layer",void 0),e([s()],p.prototype,"layerView",void 0),e([s()],p.prototype,"type",void 0),e([s()],p.prototype,"updating",null),p=e([o("esri.views.2d.engine.flow.AnimatedFlowView2D")],p);const h=p;export{h as default};
5
+ import{_ as e}from"../../../../chunks/tslib.es6.js";import t from"../../../../Graphic.js";import r from"../../../../core/Accessor.js";import{property as s}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/arrayUtils.js";import"../../../../core/has.js";import"../../../../core/accessorSupport/ensureType.js";import{subclass as o}from"../../../../core/accessorSupport/decorators/subclass.js";import{loadImagery as a}from"./dataUtils.js";import i from"./FlowContainer.js";import n from"./FlowStrategy.js";import l from"./FlowStyle.js";let p=class extends r{constructor(){super(...arguments),this._loadImagery=(e,t,r,s)=>a(this.layer,e,t,r,s),this._createStreamlinesMesh=(e,t,r)=>this.layer.createStreamlinesMesh({flowData:t,rendererSettings:e},{signal:r}),this.attached=!1,this.container=null,this.layer=null,this.type="rasterAnimatedFlow",this.redrawOrRefetch=async()=>{this._rendererChanged()}}get updating(){return!this._strategy||this._strategy.updating}attach(){this.container=new i,this._strategy=new n({flowContainer:this.container}),this._rendererChanged()}detach(){this._strategy.destroy(),this.container.removeAllChildren(),this.container=null}update(e){e.stationary?this._strategy.update(e):this.layerView.requestUpdate()}hitTest(e){return new t({attributes:{},geometry:e.clone(),layer:this.layer})}moveEnd(){}async doRefresh(){}_rendererChanged(){if("animated-flow"!==this.layer.renderer.type)return;const e=new l(this._loadImagery,this._createStreamlinesMesh,this.layer.renderer);this.container.flowStyle=e,this.layerView.requestUpdate()}};e([s()],p.prototype,"_strategy",void 0),e([s()],p.prototype,"attached",void 0),e([s()],p.prototype,"container",void 0),e([s()],p.prototype,"layer",void 0),e([s()],p.prototype,"layerView",void 0),e([s()],p.prototype,"type",void 0),e([s()],p.prototype,"updating",null),p=e([o("esri.views.2d.engine.flow.AnimatedFlowView2D")],p);const h=p;export{h as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.23/esri/copyright.txt for details.
4
4
  */
5
- import t from"../../../../core/Error.js";import e from"../../../../core/has.js";import i from"../../../../core/Logger.js";import{isNone as s,mapMany as r,isSome as a,andThen as h,unwrap as d,forEachSome as n,mapOr as o,unwrapOr as u}from"../../../../core/maybe.js";import{createResolver as l}from"../../../../core/promiseUtils.js";import{ATTRIBUTE_DATA_VV as p,TEXTURE_BINDING_ATTRIBUTE_DATA_0 as _,TEXTURE_BINDING_ATTRIBUTE_DATA_1 as x,TEXTURE_BINDING_ATTRIBUTE_DATA_2 as c,TEXTURE_BINDING_ATTRIBUTE_DATA_3 as g}from"./definitions.js";import{getDisplayIdTexel as f}from"./DisplayId.js";import{getPixelArrayCtor as T,getPixelBytes as b}from"./Utils.js";import{createDebugLogger as m,DEBUG_ATTR_UPDATES as y}from"./util/debug.js";import{TextureWrapMode as w,PixelFormat as z,PixelType as E,TextureSamplingMode as U,TextureType as D,TargetType as S,DepthStencilTargetType as A}from"../../../webgl/enums.js";import{FramebufferObject as j}from"../../../webgl/FramebufferObject.js";import{Texture as k}from"../../../webgl/Texture.js";const M=i.getLogger("esri.views.2d.engine.webgl.AttributeStoreView"),N=m(y,M);class O{constructor(t,e,i){this._texture=null,this._lastTexture=null,this._fbos={},this.texelSize=4;const{buffer:s,pixelType:r,textureOnly:a}=t,h=T(r);this.shared=i,this.pixelType=r,this.size=e,this.textureOnly=a,a||(this.data=new h(d(s))),this._resetRange()}destroy(){h(this._texture,(t=>t.dispose()));for(const t in this._fbos)h(this._fbos[t],(e=>{"0"===t&&e.detachColorTexture(),e.dispose()})),this._fbos[t]=null;this._texture=null}get _textureDesc(){return{target:D.TEXTURE_2D,wrapMode:w.CLAMP_TO_EDGE,pixelFormat:z.RGBA,dataType:this.pixelType,samplingMode:U.NEAREST,width:this.size,height:this.size}}setData(t,e,i){const s=f(t),r=d(this.data),a=s*this.texelSize+e;!r||a>=r.length||(r[a]=i,this.dirtyStart=Math.min(this.dirtyStart,s),this.dirtyEnd=Math.max(this.dirtyEnd,s))}getData(t,e){if(s(this.data))return null;const i=f(t)*this.texelSize+e;return!this.data||i>=this.data.length?null:this.data[i]}getTexture(t){return u(this._texture,(()=>this._initTexture(t)))}getFBO(t,e=0){if(s(this._fbos[e])){const i={colorTarget:S.TEXTURE,depthStencilTarget:A.NONE},s=0===e?this.getTexture(t):this._textureDesc;this._fbos[e]=new j(t,i,s)}return this._fbos[e]}get locked(){return!(this.pixelType!==E.UNSIGNED_BYTE||!this.shared||this.textureOnly||!e("esri-atomics")||!this.data)&&1===Atomics.load(this.data,0)}get hasDirty(){const t=this.dirtyStart;return this.dirtyEnd>=t}updateTexture(e,i){if(!this.locked){try{const i=this.dirtyStart,s=this.dirtyEnd;if(!this.hasDirty)return;this._resetRange();const r=d(this.data).buffer,a=this.getTexture(e),h=4,n=(i-i%this.size)/this.size,o=(s-s%this.size)/this.size,u=n,l=this.size,p=o,_=n*this.size*h,x=(l+p*this.size)*h-_,c=T(this.pixelType),g=new c(r,_*c.BYTES_PER_ELEMENT,x),f=this.size,b=p-u+1;if(b>this.size)return void M.error(new t("mapview-webgl","Out-of-bounds index when updating AttributeData"));a.updateData(0,0,u,f,b,g)}catch(s){}i()}}update(t){const{data:e,start:i,end:s}=t;if(a(e)){const s=this.data,r=i*this.texelSize;for(let i=0;i<e.length;i++){const a=1<<i%this.texelSize;t.layout&a&&(s[r+i]=e[i])}}this.dirtyStart=Math.min(this.dirtyStart,i),this.dirtyEnd=Math.max(this.dirtyEnd,s)}resize(t,e){const i=this.size;if(this.size=e,this.textureOnly)return void(i!==this.size&&(this._lastTexture=this._texture,this._texture=null));const s=T(this.pixelType);this.destroy(),this.data=new s(d(t.buffer))}_resetRange(){this.dirtyStart=2147483647,this.dirtyEnd=0}_initTexture(t){const e=new k(t,this._textureDesc,u(this.data,void 0));if(a(this._lastTexture)&&this._fbos[0]){const i=this._lastTexture.descriptor.width,s=this._lastTexture.descriptor.height,r=this._lastTexture.descriptor.dataType,a=this._lastTexture.descriptor.pixelFormat,h=this.getFBO(t),d=b(r),n=new(T(r))(new ArrayBuffer(i*s*d*this.texelSize)),o=t.getBoundFramebufferObject(),{x:u,y:l,width:p,height:_}=t.getViewport();t.bindFramebuffer(h),h.readPixels(0,0,i,s,a,r,n),e.updateData(0,0,0,2*i,s/2,n),t.setViewport(u,l,p,_),t.bindFramebuffer(o)}return this.destroy(),this._texture=e,this._texture}}class F{constructor(t){this._onUpdate=t,this._initialized=!1,this._forceNextUpload=!1,this._locked=!1}initialize(t){const{blocks:e,shared:i,size:h}=t;if(this.shared=i,this.size=h,N("Initializing AttributeStoreView",t),s(this._data))this._data=r(e,(t=>new O(t,h,i)));else for(let r=0;r<this._data.length;r++){const t=this._data[r],d=e[r];a(d)&&(s(t)?this._data[r]=new O(d,h,i):t.resize(d,h))}this._initialized=!0}destroy(){h(this._data,(t=>r(t,(t=>t.destroy())))),h(this._defaultTexture,(t=>t.dispose()))}isEmpty(){const t=this._data;return s(t)}isUpdating(){const t=a(this._pendingAttributeUpdate),i=t;return e("esri-2d-log-updating")&&console.log(`Updating AttributeStoreView ${i}\n -> hasPendingUpdate ${t}`),i}getBlock(t){if(s(this._data))return null;return this._data[t]}setLabelMinZoom(t,e){this.setData(t,0,1,e)}getLabelMinZoom(t){return this.getData(t,0,1,255)}getFilterFlags(t){return this.getData(t,0,0,0)}getVVSize(t){return this.getData(t,p,0,0)}getData(t,e,i,r){if(!this._data)return 0;const h=d(this._data)[e];if(s(h))return 0;const n=h.getData(t,i);return a(n)?n:r}setData(t,e,i,s){const r=d(this._data)[e];d(r).setData(t,i,s)}lockTextureUpload(){this._locked=!0}unlockTextureUpload(){this._locked=!1}forceTextureUpload(){this._forceNextUpload=!0}async requestUpdate(e){if(this._pendingAttributeUpdate)return void M.error(new t("mapview-webgl","Tried to update attribute data with a pending update"));const i=l();return N("AttributeStoreView Update Requested",e),this._pendingAttributeUpdate={data:e,resolver:i},i.promise}update(){if(this._initialized&&a(this._pendingAttributeUpdate)){const{data:t,resolver:e}=this._pendingAttributeUpdate,i=d(this._data);for(let s=0;s<t.blocks.length;s++){const e=t.blocks[s],r=i[s];h(r,(t=>h(e,(e=>{N(`Updating block ${s}`,e),t.update(e)}))))}this._pendingAttributeUpdate=null,e(),this._onUpdate()}}bindTextures(t,e=!0){this.update();const i=this._getDefaultTexture(t);if(!this._initialized)return t.bindTexture(i,_),void(e&&(t.bindTexture(i,x),t.bindTexture(i,c),t.bindTexture(i,g)));const s=d(this._data);this._locked&&!this._forceNextUpload||(n(s,(e=>e.updateTexture(t,(()=>this._onUpdate())))),this._forceNextUpload=!1),t.bindTexture(o(s[0],i,(e=>e.getTexture(t))),_),e&&(t.bindTexture(o(s[1],i,(e=>e.getTexture(t))),x),t.bindTexture(o(s[2],i,(e=>e.getTexture(t))),c),t.bindTexture(o(s[3],i,(e=>e.getTexture(t))),g))}_getDefaultTexture(t){if(s(this._defaultTexture)){const e={wrapMode:w.CLAMP_TO_EDGE,pixelFormat:z.RGBA,dataType:E.UNSIGNED_BYTE,samplingMode:U.NEAREST,width:1,height:1};this._defaultTexture=new k(t,e,new Uint8Array(4))}return this._defaultTexture}}export{F as AttributeStoreView};
5
+ import t from"../../../../core/Error.js";import e from"../../../../core/has.js";import i from"../../../../core/Logger.js";import{isNone as s,mapMany as r,isSome as a,applySome as h,unwrap as d,forEachSome as n,mapOr as o,unwrapOr as u}from"../../../../core/maybe.js";import{createResolver as l}from"../../../../core/promiseUtils.js";import{ATTRIBUTE_DATA_VV as p,TEXTURE_BINDING_ATTRIBUTE_DATA_0 as _,TEXTURE_BINDING_ATTRIBUTE_DATA_1 as x,TEXTURE_BINDING_ATTRIBUTE_DATA_2 as c,TEXTURE_BINDING_ATTRIBUTE_DATA_3 as g}from"./definitions.js";import{getDisplayIdTexel as f}from"./DisplayId.js";import{getPixelArrayCtor as T,getPixelBytes as b}from"./Utils.js";import{createDebugLogger as m,DEBUG_ATTR_UPDATES as y}from"./util/debug.js";import{TextureWrapMode as w,PixelFormat as z,PixelType as E,TextureSamplingMode as U,TextureType as D,TargetType as S,DepthStencilTargetType as A}from"../../../webgl/enums.js";import{FramebufferObject as j}from"../../../webgl/FramebufferObject.js";import{Texture as k}from"../../../webgl/Texture.js";const M=i.getLogger("esri.views.2d.engine.webgl.AttributeStoreView"),N=m(y,M);class O{constructor(t,e,i){this._texture=null,this._lastTexture=null,this._fbos={},this.texelSize=4;const{buffer:s,pixelType:r,textureOnly:a}=t,h=T(r);this.shared=i,this.pixelType=r,this.size=e,this.textureOnly=a,a||(this.data=new h(d(s))),this._resetRange()}destroy(){h(this._texture,(t=>t.dispose()));for(const t in this._fbos)h(this._fbos[t],(e=>{"0"===t&&e.detachColorTexture(),e.dispose()})),this._fbos[t]=null;this._texture=null}get _textureDesc(){return{target:D.TEXTURE_2D,wrapMode:w.CLAMP_TO_EDGE,pixelFormat:z.RGBA,dataType:this.pixelType,samplingMode:U.NEAREST,width:this.size,height:this.size}}setData(t,e,i){const s=f(t),r=d(this.data),a=s*this.texelSize+e;!r||a>=r.length||(r[a]=i,this.dirtyStart=Math.min(this.dirtyStart,s),this.dirtyEnd=Math.max(this.dirtyEnd,s))}getData(t,e){if(s(this.data))return null;const i=f(t)*this.texelSize+e;return!this.data||i>=this.data.length?null:this.data[i]}getTexture(t){return u(this._texture,(()=>this._initTexture(t)))}getFBO(t,e=0){if(s(this._fbos[e])){const i={colorTarget:S.TEXTURE,depthStencilTarget:A.NONE},s=0===e?this.getTexture(t):this._textureDesc;this._fbos[e]=new j(t,i,s)}return this._fbos[e]}get locked(){return!(this.pixelType!==E.UNSIGNED_BYTE||!this.shared||this.textureOnly||!e("esri-atomics")||!this.data)&&1===Atomics.load(this.data,0)}get hasDirty(){const t=this.dirtyStart;return this.dirtyEnd>=t}updateTexture(e,i){if(!this.locked){try{const i=this.dirtyStart,s=this.dirtyEnd;if(!this.hasDirty)return;this._resetRange();const r=d(this.data).buffer,a=this.getTexture(e),h=4,n=(i-i%this.size)/this.size,o=(s-s%this.size)/this.size,u=n,l=this.size,p=o,_=n*this.size*h,x=(l+p*this.size)*h-_,c=T(this.pixelType),g=new c(r,_*c.BYTES_PER_ELEMENT,x),f=this.size,b=p-u+1;if(b>this.size)return void M.error(new t("mapview-webgl","Out-of-bounds index when updating AttributeData"));a.updateData(0,0,u,f,b,g)}catch(s){}i()}}update(t){const{data:e,start:i,end:s}=t;if(a(e)){const s=this.data,r=i*this.texelSize;for(let i=0;i<e.length;i++){const a=1<<i%this.texelSize;t.layout&a&&(s[r+i]=e[i])}}this.dirtyStart=Math.min(this.dirtyStart,i),this.dirtyEnd=Math.max(this.dirtyEnd,s)}resize(t,e){const i=this.size;if(this.size=e,this.textureOnly)return void(i!==this.size&&(this._lastTexture=this._texture,this._texture=null));const s=T(this.pixelType);this.destroy(),this.data=new s(d(t.buffer))}_resetRange(){this.dirtyStart=2147483647,this.dirtyEnd=0}_initTexture(t){const e=new k(t,this._textureDesc,u(this.data,void 0));if(a(this._lastTexture)&&this._fbos[0]){const i=this._lastTexture.descriptor.width,s=this._lastTexture.descriptor.height,r=this._lastTexture.descriptor.dataType,a=this._lastTexture.descriptor.pixelFormat,h=this.getFBO(t),d=b(r),n=new(T(r))(new ArrayBuffer(i*s*d*this.texelSize)),o=t.getBoundFramebufferObject(),{x:u,y:l,width:p,height:_}=t.getViewport();t.bindFramebuffer(h),h.readPixels(0,0,i,s,a,r,n),e.updateData(0,0,0,2*i,s/2,n),t.setViewport(u,l,p,_),t.bindFramebuffer(o)}return this.destroy(),this._texture=e,this._texture}}class F{constructor(t){this._onUpdate=t,this._initialized=!1,this._forceNextUpload=!1,this._locked=!1}initialize(t){const{blocks:e,shared:i,size:h}=t;if(this.shared=i,this.size=h,N("Initializing AttributeStoreView",t),s(this._data))this._data=r(e,(t=>new O(t,h,i)));else for(let r=0;r<this._data.length;r++){const t=this._data[r],d=e[r];a(d)&&(s(t)?this._data[r]=new O(d,h,i):t.resize(d,h))}this._initialized=!0}destroy(){h(this._data,(t=>r(t,(t=>t.destroy())))),h(this._defaultTexture,(t=>t.dispose()))}isEmpty(){const t=this._data;return s(t)}isUpdating(){const t=a(this._pendingAttributeUpdate),i=t;return e("esri-2d-log-updating")&&console.log(`Updating AttributeStoreView ${i}\n -> hasPendingUpdate ${t}`),i}getBlock(t){if(s(this._data))return null;return this._data[t]}setLabelMinZoom(t,e){this.setData(t,0,1,e)}getLabelMinZoom(t){return this.getData(t,0,1,255)}getFilterFlags(t){return this.getData(t,0,0,0)}getVVSize(t){return this.getData(t,p,0,0)}getData(t,e,i,r){if(!this._data)return 0;const h=d(this._data)[e];if(s(h))return 0;const n=h.getData(t,i);return a(n)?n:r}setData(t,e,i,s){const r=d(this._data)[e];d(r).setData(t,i,s)}lockTextureUpload(){this._locked=!0}unlockTextureUpload(){this._locked=!1}forceTextureUpload(){this._forceNextUpload=!0}async requestUpdate(e){if(this._pendingAttributeUpdate)return void M.error(new t("mapview-webgl","Tried to update attribute data with a pending update"));const i=l();return N("AttributeStoreView Update Requested",e),this._pendingAttributeUpdate={data:e,resolver:i},i.promise}update(){if(this._initialized&&a(this._pendingAttributeUpdate)){const{data:t,resolver:e}=this._pendingAttributeUpdate,i=d(this._data);for(let s=0;s<t.blocks.length;s++){const e=t.blocks[s],r=i[s];h(r,(t=>h(e,(e=>{N(`Updating block ${s}`,e),t.update(e)}))))}this._pendingAttributeUpdate=null,e(),this._onUpdate()}}bindTextures(t,e=!0){this.update();const i=this._getDefaultTexture(t);if(!this._initialized)return t.bindTexture(i,_),void(e&&(t.bindTexture(i,x),t.bindTexture(i,c),t.bindTexture(i,g)));const s=d(this._data);this._locked&&!this._forceNextUpload||(n(s,(e=>e.updateTexture(t,(()=>this._onUpdate())))),this._forceNextUpload=!1),t.bindTexture(o(s[0],i,(e=>e.getTexture(t))),_),e&&(t.bindTexture(o(s[1],i,(e=>e.getTexture(t))),x),t.bindTexture(o(s[2],i,(e=>e.getTexture(t))),c),t.bindTexture(o(s[3],i,(e=>e.getTexture(t))),g))}_getDefaultTexture(t){if(s(this._defaultTexture)){const e={wrapMode:w.CLAMP_TO_EDGE,pixelFormat:z.RGBA,dataType:E.UNSIGNED_BYTE,samplingMode:U.NEAREST,width:1,height:1};this._defaultTexture=new k(t,e,new Uint8Array(4))}return this._defaultTexture}}export{F as AttributeStoreView};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.23/esri/copyright.txt for details.
4
4
  */
5
- import{isNone as e}from"../../../../../../core/maybe.js";import a from"../WGLBrush.js";import{BlendFactor as t,StencilOperation as r,CompareFunction as s,PrimitiveType as o,DataType as n}from"../../../../../webgl/enums.js";const i=new Float32Array([.27058823529411763,.4588235294117647,.7098039215686275,1,.396078431372549,.5372549019607843,.7215686274509804,1,.5176470588235295,.6196078431372549,.7294117647058823,1,.6352941176470588,.7058823529411765,.7411764705882353,1,.7529411764705882,.8,.7450980392156863,1,.8705882352941177,.8901960784313725,.7490196078431373,1,1,1,.7490196078431373,1,1,.8627450980392157,.6313725490196078,1,.9803921568627451,.7254901960784313,.5176470588235295,1,.9607843137254902,.596078431372549,.4117647058823529,1,.9294117647058824,.4588235294117647,.3176470588235294,1,.9098039215686274,.08235294117647059,.08235294117647059,1]),c={beaufort_ft:i,beaufort_m:i,beaufort_km:i,beaufort_mi:i,beaufort_kn:new Float32Array([.1568627450980392,.5725490196078431,.7803921568627451,1,.34901960784313724,.6352941176470588,.7294117647058823,1,.5058823529411764,.7019607843137254,.6705882352941176,1,.6274509803921569,.7607843137254902,.6078431372549019,1,.7490196078431373,.8313725490196079,.5411764705882353,1,.8549019607843137,.9019607843137255,.4666666666666667,1,.9803921568627451,.9803921568627451,.39215686274509803,1,.9882352941176471,.8352941176470589,.3254901960784314,1,.9882352941176471,.7019607843137254,.4,1,.9803921568627451,.5529411764705883,.20392156862745098,1,.9686274509803922,.43137254901960786,.16470588235294117,1,.9411764705882353,.2784313725490196,.11372549019607843,1]),classified_arrow:new Float32Array([.2196078431372549,.6588235294117647,0,1,.5450980392156862,1.2117647058823529,0,1,1,1,0,1,1,.5019607843137255,0,1,1,0,0,1]),ocean_current_m:new Float32Array([.3058823529411765,.10196078431372549,.6,1,.7019607843137254,.10588235294117647,.10196078431372549,1,.792156862745098,.5019607843137255,.10196078431372549,1,.6941176470588235,.6941176470588235,.6941176470588235,1]),ocean_current_kn:new Float32Array([0,0,0,1,0,.1450980392156863,.39215686274509803,1,.3058823529411765,.10196078431372549,.6,1,.592156862745098,0,.39215686274509803,1,.7019607843137254,.10588235294117647,.10196078431372549,1,.6941176470588235,.3058823529411765,.10196078431372549,1,.792156862745098,.5019607843137255,.10196078431372549,1,.6941176470588235,.7019607843137254,.20392156862745098,1,.6941176470588235,.6941176470588235,.6941176470588235,1]),single_arrow:new Float32Array([0,92/255,230/255,1]),wind_speed:new Float32Array([0,0,0,1])};class l extends a{constructor(){super(...arguments),this._desc={magdir:{vsPath:"raster/magdir",fsPath:"raster/magdir",attributes:new Map([["a_pos",0],["a_offset",1],["a_vv",2]])},scalar:{vsPath:"raster/scalar",fsPath:"raster/scalar",attributes:new Map([["a_pos",0],["a_offset",1],["a_vv",2]])}}}dispose(){}prepareState({context:e},a){e.setBlendingEnabled(!0),e.setBlendFunctionSeparate(t.ONE,t.ONE_MINUS_SRC_ALPHA,t.ONE,t.ONE_MINUS_SRC_ALPHA),e.setColorMask(!0,!0,!0,!0),e.setStencilWriteMask(0),e.setStencilTestEnabled(!0),e.setStencilOp(r.KEEP,r.KEEP,r.REPLACE),e.setStencilFunction(s.EQUAL,a.stencilRef,255)}draw(a,t){if(e(t.source)||0===t.source.validPixelCount)return;const{timeline:r}=a;if(r.begin(this.name),t.updateVectorFieldVAO(a),"scalar"===a.renderPass){const e=t.vaoData.scalar;e&&this._drawScalars(a,t,e.vao,e.elementCount)}else{const e=t.vaoData.magdir;e&&this._drawTriangles(a,t,e.vao,e.elementCount)}r.end(this.name)}_drawTriangles(e,a,t,r){const{context:s,painter:i}=e,{symbolizerParameters:l}=a,m=l.dataRange?["dataRange"]:[];"geographic"===l.rotationType&&m.push("rotationGeographic");const d=i.materialManager.getProgram(e,this._desc.magdir,m);s.useProgram(d);const{coordScale:f,opacity:_,transforms:u}=a;d.setUniform2fv("u_coordScale",f),d.setUniform1f("u_opacity",_),d.setUniformMatrix3fv("u_dvsMat3",u.dvs);const{style:g,dataRange:p,rotation:y,symbolPercentRange:S}=l;d.setUniform4fv("u_colors",c[g]||c.single_arrow),d.setUniform2fv("u_dataRange",p),d.setUniform1f("u_rotation",y),d.setUniform2fv("u_symbolPercentRange",S);const v=this._getSymbolSize(e,a);d.setUniform2fv("u_symbolSize",v),s.bindVAO(t),s.drawElements(o.TRIANGLES,r,n.UNSIGNED_INT,0)}_drawScalars(e,a,t,r){const{context:s,painter:i}=e,{symbolizerParameters:c}=a,l=[];"wind_speed"===c.style?l.push("innerCircle"):c.dataRange&&l.push("dataRange"),"geographic"===c.rotationType&&l.push("rotationGeographic");const m=i.materialManager.getProgram(e,this._desc.scalar,l);s.useProgram(m);const{coordScale:d,opacity:f,transforms:_}=a;m.setUniform2fv("u_coordScale",d),m.setUniform1f("u_opacity",f),m.setUniformMatrix3fv("u_dvsMat3",_.dvs);const{dataRange:u,symbolPercentRange:g}=c;m.setUniform2fv("u_dataRange",u),m.setUniform2fv("u_symbolPercentRange",g);const p=this._getSymbolSize(e,a);m.setUniform2fv("u_symbolSize",p),s.bindVAO(t),s.drawElements(o.TRIANGLES,r,n.UNSIGNED_INT,0)}_getSymbolSize(e,a){const t=2**(e.displayLevel-a.key.level),{symbolTileSize:r}=a.symbolizerParameters;return[r/(Math.round((a.width-a.offset[0])/r)*r)/t,r/(Math.round((a.height-a.offset[1])/r)*r)/t]}}export{l as default};
5
+ import{isNone as e}from"../../../../../../core/maybe.js";import a from"../WGLBrush.js";import{BlendFactor as t,StencilOperation as r,CompareFunction as s,PrimitiveType as o,DataType as n}from"../../../../../webgl/enums.js";const i=new Float32Array([.27058823529411763,.4588235294117647,.7098039215686275,1,.396078431372549,.5372549019607843,.7215686274509804,1,.5176470588235295,.6196078431372549,.7294117647058823,1,.6352941176470588,.7058823529411765,.7411764705882353,1,.7529411764705882,.8,.7450980392156863,1,.8705882352941177,.8901960784313725,.7490196078431373,1,1,1,.7490196078431373,1,1,.8627450980392157,.6313725490196078,1,.9803921568627451,.7254901960784313,.5176470588235295,1,.9607843137254902,.596078431372549,.4117647058823529,1,.9294117647058824,.4588235294117647,.3176470588235294,1,.9098039215686274,.08235294117647059,.08235294117647059,1]),l={beaufort_ft:i,beaufort_m:i,beaufort_km:i,beaufort_mi:i,beaufort_kn:new Float32Array([.1568627450980392,.5725490196078431,.7803921568627451,1,.34901960784313724,.6352941176470588,.7294117647058823,1,.5058823529411764,.7019607843137254,.6705882352941176,1,.6274509803921569,.7607843137254902,.6078431372549019,1,.7490196078431373,.8313725490196079,.5411764705882353,1,.8549019607843137,.9019607843137255,.4666666666666667,1,.9803921568627451,.9803921568627451,.39215686274509803,1,.9882352941176471,.8352941176470589,.3254901960784314,1,.9882352941176471,.7019607843137254,.4,1,.9803921568627451,.5529411764705883,.20392156862745098,1,.9686274509803922,.43137254901960786,.16470588235294117,1,.9411764705882353,.2784313725490196,.11372549019607843,1]),classified_arrow:new Float32Array([.2196078431372549,.6588235294117647,0,1,.5450980392156862,1.2117647058823529,0,1,1,1,0,1,1,.5019607843137255,0,1,1,0,0,1]),ocean_current_m:new Float32Array([.3058823529411765,.10196078431372549,.6,1,.7019607843137254,.10588235294117647,.10196078431372549,1,.792156862745098,.5019607843137255,.10196078431372549,1,.6941176470588235,.6941176470588235,.6941176470588235,1]),ocean_current_kn:new Float32Array([0,0,0,1,0,.1450980392156863,.39215686274509803,1,.3058823529411765,.10196078431372549,.6,1,.592156862745098,0,.39215686274509803,1,.7019607843137254,.10588235294117647,.10196078431372549,1,.6941176470588235,.3058823529411765,.10196078431372549,1,.792156862745098,.5019607843137255,.10196078431372549,1,.6941176470588235,.7019607843137254,.20392156862745098,1,.6941176470588235,.6941176470588235,.6941176470588235,1]),single_arrow:new Float32Array([0,92/255,230/255,1]),wind_speed:new Float32Array([0,0,0,1])};class c extends a{constructor(){super(...arguments),this._desc={magdir:{vsPath:"raster/magdir",fsPath:"raster/magdir",attributes:new Map([["a_pos",0],["a_offset",1],["a_vv",2]])},scalar:{vsPath:"raster/scalar",fsPath:"raster/scalar",attributes:new Map([["a_pos",0],["a_offset",1],["a_vv",2]])}}}dispose(){}prepareState({context:e},a){e.setBlendingEnabled(!0),e.setBlendFunctionSeparate(t.ONE,t.ONE_MINUS_SRC_ALPHA,t.ONE,t.ONE_MINUS_SRC_ALPHA),e.setColorMask(!0,!0,!0,!0),e.setStencilWriteMask(0),e.setStencilTestEnabled(!0),e.setStencilOp(r.KEEP,r.KEEP,r.REPLACE),e.setStencilFunction(s.EQUAL,a.stencilRef,255)}draw(a,t){if(e(t.source)||0===t.source.validPixelCount)return;const{timeline:r}=a;if(r.begin(this.name),t.updateVectorFieldVAO(a),"scalar"===a.renderPass){const e=t.vaoData.scalar;e&&this._drawScalars(a,t,e.vao,e.elementCount)}else{const e=t.vaoData.magdir;e&&this._drawTriangles(a,t,e.vao,e.elementCount)}r.end(this.name)}_drawTriangles(e,a,t,r){const{context:s,painter:i}=e,{symbolizerParameters:c}=a,m=c.dataRange?["dataRange"]:[];"geographic"===c.rotationType&&m.push("rotationGeographic");const d=i.materialManager.getProgram(e,this._desc.magdir,m);s.useProgram(d);const{coordScale:f,opacity:_,transforms:u}=a;d.setUniform2fv("u_coordScale",f),d.setUniform1f("u_opacity",_),d.setUniformMatrix3fv("u_dvsMat3",u.dvs);const{style:g,dataRange:p,rotation:y,symbolPercentRange:S}=c;d.setUniform4fv("u_colors",l[g]||l.single_arrow),d.setUniform2fv("u_dataRange",p),d.setUniform1f("u_rotation",y),d.setUniform2fv("u_symbolPercentRange",S);const v=this._getSymbolSize(e,a);d.setUniform2fv("u_symbolSize",v),s.bindVAO(t),s.drawElements(o.TRIANGLES,r,n.UNSIGNED_INT,0)}_drawScalars(e,a,t,r){const{context:s,painter:i}=e,{symbolizerParameters:l}=a,c=[];"wind_speed"===l.style?c.push("innerCircle"):l.dataRange&&c.push("dataRange"),"geographic"===l.rotationType&&c.push("rotationGeographic");const m=i.materialManager.getProgram(e,this._desc.scalar,c);s.useProgram(m);const{coordScale:d,opacity:f,transforms:_}=a;m.setUniform2fv("u_coordScale",d),m.setUniform1f("u_opacity",f),m.setUniformMatrix3fv("u_dvsMat3",_.dvs);const{dataRange:u,symbolPercentRange:g}=l;m.setUniform2fv("u_dataRange",u),m.setUniform2fv("u_symbolPercentRange",g);const p=this._getSymbolSize(e,a);m.setUniform2fv("u_symbolSize",p),s.bindVAO(t),s.drawElements(o.TRIANGLES,r,n.UNSIGNED_INT,0)}_getSymbolSize(e,a){const t=a.key?2**(e.displayLevel-a.key.level):a.resolution/e.state.resolution,{symbolTileSize:r}=a.symbolizerParameters;return[r/(Math.round((a.width-a.offset[0])/r)*r)/t,r/(Math.round((a.height-a.offset[1])/r)*r)/t]}}export{c 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.23/esri/copyright.txt for details.
4
4
  */
5
- import{andThen as t,isSome as i,unwrapOrThrow as s,isNone as r}from"../../../../../core/maybe.js";import{TypedBuffer as e}from"../BufferPool.js";import{FreeList as h}from"./FreeList.js";import{BufferObject as n}from"../../../../webgl/BufferObject.js";import{Usage as a}from"../../../../webgl/enums.js";const d=1.25,u=32767,c=u<<16|u;class p{constructor(t,i,s){const r=e.create(i*s*Uint32Array.BYTES_PER_ELEMENT);this.strideInt=s,this.bufferType=t,this.dirty={start:1/0,end:0},this.gpu=null,this._cpu=r,this.clear()}get elementSize(){return this._cpu.length/this.strideInt}destroy(){t(this.gpu,(t=>t.dispose())),t(this._cpu,(t=>t.destroy())),t(this._cpu2,(t=>t.destroy()))}clear(){this.dirty.start=1/0,this.dirty.end=0,this.freeList=new h({start:0,end:this._cpu.length/this.strideInt}),this.fillPointer=0}ensure(t){if(this.maxAvailableSpace()>=t)return;if(t*this.strideInt>this._cpu.length-this.fillPointer){i(this.gpu)&&(this.gpu=null);const s=this._cpu.length/this.strideInt,r=Math.round((s+t)*d),e=r*this.strideInt;this._cpu.expand(e*Uint32Array.BYTES_PER_ELEMENT),this.freeList.free(s,r-s)}}set(t,i){this._cpu.array[t]!==i&&(this._cpu.array[t]=i,this.dirty.start=Math.min(t,this.dirty.start),this.dirty.end=Math.max(t,this.dirty.end))}getBuffer(){if(!this._cpu2){const t=this._cpu.slice();this._cpu2=t}return this._cpu2.length!==this._cpu.length&&this._cpu2.expand(this._cpu.length*this._cpu.array.BYTES_PER_ELEMENT),this._cpu2.set(this._cpu),this._cpu2}get bufferSize(){return this._cpu.length/this.strideInt}maxAvailableSpace(){return this.freeList.maxAvailableSpace()}insert(t,i,r,e){const h=r*this.strideInt,n=i*this.strideInt*Uint32Array.BYTES_PER_ELEMENT,a=new Uint32Array(t,n,h),d=s(this.freeList.firstFit(r),"First fit region must be defined")*this.strideInt,u=h,c=d/this.strideInt-i;if(0!==e)for(let s=0;s<a.length;s++)a[s]+=e;return this._cpu.array.set(a,d),this.dirty.start=Math.min(this.dirty.start,d),this.dirty.end=Math.max(this.dirty.end,d+u),this.fillPointer=Math.max(this.fillPointer,d+u),c}free(t,i,s){const r=t*this.strideInt,e=(t+i)*this.strideInt;if(!0===s)for(let h=t;h!==t+i;h++)this._cpu.array[h*this.strideInt]=c;this.dirty.start=Math.min(this.dirty.start,r),this.dirty.end=Math.max(this.dirty.end,e),this.freeList.free(t,i)}upload(t){if(this.dirty.end){if(r(this.gpu))return this.gpu=this._createBuffer(t),this.dirty.start=1/0,void(this.dirty.end=0);this.gpu.setSubDataFromView(this._cpu.array,this.dirty.start,this.dirty.start,this.dirty.end),this.dirty.start=1/0,this.dirty.end=0}}_createBuffer(t){const i=a.DYNAMIC_DRAW;return"index"===this.bufferType?n.createIndex(t,i,this._cpu.array):n.createVertex(t,i,this._cpu.array)}}export{p as Buffer};
5
+ import{applySome as t,isSome as i,unwrapOrThrow as s,isNone as r}from"../../../../../core/maybe.js";import{TypedBuffer as e}from"../BufferPool.js";import{FreeList as h}from"./FreeList.js";import{BufferObject as n}from"../../../../webgl/BufferObject.js";import{Usage as a}from"../../../../webgl/enums.js";const d=1.25,u=32767,c=u<<16|u;class p{constructor(t,i,s){const r=e.create(i*s*Uint32Array.BYTES_PER_ELEMENT);this.strideInt=s,this.bufferType=t,this.dirty={start:1/0,end:0},this.gpu=null,this._cpu=r,this.clear()}get elementSize(){return this._cpu.length/this.strideInt}destroy(){t(this.gpu,(t=>t.dispose())),t(this._cpu,(t=>t.destroy())),t(this._cpu2,(t=>t.destroy()))}clear(){this.dirty.start=1/0,this.dirty.end=0,this.freeList=new h({start:0,end:this._cpu.length/this.strideInt}),this.fillPointer=0}ensure(t){if(this.maxAvailableSpace()>=t)return;if(t*this.strideInt>this._cpu.length-this.fillPointer){i(this.gpu)&&(this.gpu=null);const s=this._cpu.length/this.strideInt,r=Math.round((s+t)*d),e=r*this.strideInt;this._cpu.expand(e*Uint32Array.BYTES_PER_ELEMENT),this.freeList.free(s,r-s)}}set(t,i){this._cpu.array[t]!==i&&(this._cpu.array[t]=i,this.dirty.start=Math.min(t,this.dirty.start),this.dirty.end=Math.max(t,this.dirty.end))}getBuffer(){if(!this._cpu2){const t=this._cpu.slice();this._cpu2=t}return this._cpu2.length!==this._cpu.length&&this._cpu2.expand(this._cpu.length*this._cpu.array.BYTES_PER_ELEMENT),this._cpu2.set(this._cpu),this._cpu2}get bufferSize(){return this._cpu.length/this.strideInt}maxAvailableSpace(){return this.freeList.maxAvailableSpace()}insert(t,i,r,e){const h=r*this.strideInt,n=i*this.strideInt*Uint32Array.BYTES_PER_ELEMENT,a=new Uint32Array(t,n,h),d=s(this.freeList.firstFit(r),"First fit region must be defined")*this.strideInt,u=h,c=d/this.strideInt-i;if(0!==e)for(let s=0;s<a.length;s++)a[s]+=e;return this._cpu.array.set(a,d),this.dirty.start=Math.min(this.dirty.start,d),this.dirty.end=Math.max(this.dirty.end,d+u),this.fillPointer=Math.max(this.fillPointer,d+u),c}free(t,i,s){const r=t*this.strideInt,e=(t+i)*this.strideInt;if(!0===s)for(let h=t;h!==t+i;h++)this._cpu.array[h*this.strideInt]=c;this.dirty.start=Math.min(this.dirty.start,r),this.dirty.end=Math.max(this.dirty.end,e),this.freeList.free(t,i)}upload(t){if(this.dirty.end){if(r(this.gpu))return this.gpu=this._createBuffer(t),this.dirty.start=1/0,void(this.dirty.end=0);this.gpu.setSubDataFromView(this._cpu.array,this.dirty.start,this.dirty.start,this.dirty.end),this.dirty.start=1/0,this.dirty.end=0}}_createBuffer(t){const i=a.DYNAMIC_DRAW;return"index"===this.bufferType?n.createIndex(t,i,this._cpu.array):n.createVertex(t,i,this._cpu.array)}}export{p as Buffer};