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

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 (101) hide show
  1. package/assets/esri/core/workers/RemoteClient.js +1 -1
  2. package/assets/esri/core/workers/chunks/{791220164501a791b2cd.js → 0896986aa60516f716f1.js} +1 -1
  3. package/assets/esri/core/workers/chunks/{59e18862b803fdc41786.js → 0c145b87c24bf6c7d572.js} +1 -1
  4. package/assets/esri/core/workers/chunks/2504c43fac77ecd9ec2a.js +1 -0
  5. package/assets/esri/core/workers/chunks/{39de883f236e2a8d9024.js → 30d7796ee6f7e4a6a3e1.js} +2 -2
  6. package/assets/esri/core/workers/chunks/{39de883f236e2a8d9024.js.LICENSE.txt → 30d7796ee6f7e4a6a3e1.js.LICENSE.txt} +0 -0
  7. package/assets/esri/core/workers/chunks/3281656a9bd3627e41ff.js +1 -0
  8. package/assets/esri/core/workers/chunks/374ee2b2cad26f7ad572.js +1 -0
  9. package/assets/esri/core/workers/chunks/4d14be8c7e8adaa91876.js +1011 -0
  10. package/assets/esri/core/workers/chunks/{c22d7622294fe4aefe0b.js → 4f2d2cc71f5ff5ac2a60.js} +1 -1
  11. package/assets/esri/core/workers/chunks/8b1d5b7e9de73bc9da3a.js +1 -0
  12. package/assets/esri/core/workers/chunks/9dc4db35c387e11e9beb.js +1 -0
  13. package/assets/esri/core/workers/chunks/{42987dcfda665c860151.js → a23376df9696ebe5b5cd.js} +1 -1
  14. package/assets/esri/core/workers/chunks/{e4ad2cf5d6bded02e392.js → ed763fc352d0b55e5867.js} +1 -1
  15. package/assets/esri/core/workers/chunks/{a05f6afcf56245824853.js → f1fdb335c5f9ec8b27cb.js} +1 -1
  16. package/assets/esri/core/workers/chunks/{9493a8e5d6001b6bf275.js → f59f82a43437a51c934c.js} +1 -1
  17. package/assets/esri/widgets/support/t9n/DatePicker.json +1 -1
  18. package/assets/esri/widgets/support/t9n/DatePicker_en.json +1 -1
  19. package/assets/esri/widgets/support/t9n/TimePicker.json +1 -1
  20. package/assets/esri/widgets/support/t9n/TimePicker_en.json +1 -1
  21. package/chunks/DefaultMaterial.glsl.js +42 -37
  22. package/chunks/RealisticTree.glsl.js +25 -25
  23. package/geometry/support/MeshMaterial.js +1 -1
  24. package/geometry/support/MeshMaterialMetallicRoughness.js +1 -1
  25. package/geometry/support/meshUtils/loadGLTFMesh.js +1 -1
  26. package/layers/mixins/ArcGISImageService.js +1 -1
  27. package/package.json +2 -2
  28. package/support/revision.js +1 -1
  29. package/views/2d/engine/webgl/util/Matcher.js +1 -1
  30. package/views/2d/layers/features/support/AttributeStore.js +1 -1
  31. package/views/3d/environment/ChapmanAtmosphere.js +1 -1
  32. package/views/3d/environment/EnvironmentRenderer.js +1 -1
  33. package/views/3d/environment/PanoramicAtmosphere.js +1 -1
  34. package/views/3d/environment/SimpleAtmosphere.js +1 -1
  35. package/views/3d/environment/resources/MarsAtmosphereTexture.js +1 -1
  36. package/views/3d/environment/resources/SimpleAtmosphereTexture.js +1 -1
  37. package/views/3d/glTF/LoaderResult.js +1 -1
  38. package/views/3d/glTF/internal/Resource.js +1 -1
  39. package/views/3d/glTF/internal/TextureTransformUtils.js +5 -0
  40. package/views/3d/glTF/loader.js +1 -1
  41. package/views/3d/interactive/editingTools/reshapeGraphic/ReshapeOperation.js +1 -1
  42. package/views/3d/layers/BuildingComponentSublayerView3D.js +1 -1
  43. package/views/3d/layers/ElevationLayerView3D.js +1 -1
  44. package/views/3d/layers/I3SMeshView3D.js +1 -1
  45. package/views/3d/layers/I3SMeshViewLabeler.js +1 -1
  46. package/views/3d/layers/IntegratedMeshLayerView3D.js +1 -1
  47. package/views/3d/layers/PointCloudLayerView3D.js +1 -1
  48. package/views/3d/layers/SceneLayerGraphicsView3D.js +1 -1
  49. package/views/3d/layers/SceneLayerView3D.js +1 -1
  50. package/views/3d/layers/TileLayerView3D.js +1 -1
  51. package/views/3d/layers/VoxelLayerView3D.js +1 -1
  52. package/views/3d/layers/graphics/Graphics3DMeshFillSymbolLayer.js +1 -1
  53. package/views/3d/layers/graphics/objectResourceUtils.js +1 -1
  54. package/views/3d/layers/i3s/I3SElevationProvider.js +1 -1
  55. package/views/3d/layers/i3s/I3SQueryEngine.js +1 -1
  56. package/views/3d/layers/support/FeatureTileTree3DDebugger.js +1 -1
  57. package/views/3d/layers/support/StageLayerElevationProvider.js +1 -1
  58. package/views/3d/support/CombinedElevationProvider.js +1 -1
  59. package/views/3d/support/pointsOfInterest/StableSurfaceCenter.js +1 -1
  60. package/views/3d/terrain/OverlayManager.js +1 -1
  61. package/views/3d/webgl-engine/collections/Component/Material/ComponentMaterial.js +1 -1
  62. package/views/3d/webgl-engine/collections/Component/Material/ComponentTechniqueConfiguration.js +1 -1
  63. package/views/3d/webgl-engine/core/shaderLibrary/default/DefaultMaterialAuxiliaryPasses.glsl.js +22 -22
  64. package/views/3d/webgl-engine/core/shaderLibrary/shading/PhysicallyBasedRenderingParameters.glsl.js +19 -10
  65. package/views/3d/webgl-engine/core/shaderLibrary/shading/TextureTransformUV.glsl.js +15 -0
  66. package/views/3d/webgl-engine/materials/DefaultMaterial.js +1 -1
  67. package/views/3d/webgl-engine/shaders/DefaultMaterial.glsl.js +1 -1
  68. package/views/3d/webgl-engine/shaders/DefaultMaterialTechnique.js +1 -1
  69. package/views/3d/webgl-engine/shaders/DefaultMaterialTechniqueConfiguration.js +1 -1
  70. package/views/3d/webgl-engine/shaders/RealisticTreeTechnique.js +1 -1
  71. package/views/input/recognizers/DoubleTapDrag.js +1 -1
  72. package/views/input/recognizers/Drag.js +1 -1
  73. package/views/input/recognizers/ImmediateDoubleClick.js +1 -1
  74. package/views/input/recognizers/PointerClickHoldAndDrag.js +1 -1
  75. package/views/input/recognizers/SingleAndDoubleClick.js +1 -1
  76. package/views/input/recognizers/VerticalTwoFingerDrag.js +1 -1
  77. package/views/input/recognizers/support.js +1 -1
  78. package/views/interactive/editGeometry/operations/OffsetEdgeVertex.js +1 -1
  79. package/views/overlay/ViewOverlay.js +1 -1
  80. package/widgets/AreaMeasurement3D.js +1 -1
  81. package/widgets/BuildingExplorer/BuildingExplorerViewModel.js +1 -1
  82. package/widgets/BuildingExplorer.js +1 -1
  83. package/widgets/CoordinateConversion/support/Format.js +1 -1
  84. package/widgets/Daylight.js +1 -1
  85. package/widgets/DirectLineMeasurement3D.js +1 -1
  86. package/widgets/ElevationProfile.js +1 -1
  87. package/widgets/LineOfSight.js +1 -1
  88. package/widgets/ShadowCast.js +1 -1
  89. package/widgets/Slice.js +1 -1
  90. package/widgets/Slider.js +1 -1
  91. package/widgets/TimeSlider.js +1 -1
  92. package/widgets/Weather.js +1 -1
  93. package/widgets/Zoom.js +1 -1
  94. package/widgets/support/DatePicker.js +1 -1
  95. package/widgets/support/TimePicker.js +1 -1
  96. package/assets/esri/core/workers/chunks/0b269862733afe740a63.js +0 -1
  97. package/assets/esri/core/workers/chunks/290cd411d0d18b1d0efd.js +0 -1
  98. package/assets/esri/core/workers/chunks/85a2cf095f002b2c486f.js +0 -1
  99. package/assets/esri/core/workers/chunks/b312dd3027492007d75e.js +0 -1
  100. package/assets/esri/core/workers/chunks/bf348f6f52701fa6016e.js +0 -987
  101. package/assets/esri/core/workers/chunks/c79d4cb3332550fb0df5.js +0 -1
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.25/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../chunks/tslib.es6.js";import"../../geometry.js";import t from"../../Graphic.js";import{rasterRendererTypes as r,websceneRasterRendererTypes as i,read as s}from"../../rasterRenderers.js";import n from"../../request.js";import o from"../../core/Error.js";import{strict as a}from"../../core/jsonMap.js";import{clone as l}from"../../core/lang.js";import u from"../../core/Logger.js";import{isSome as p,isNone as c,unwrap as m}from"../../core/maybe.js";import{when as d}from"../../core/promiseUtils.js";import{watch as h}from"../../core/reactiveUtils.js";import{urlToObject as f}from"../../core/urlUtils.js";import{property as y,ensureRange as g}from"../../core/accessorSupport/decorators/property.js";import{Integer as R,ensureClass as v,ensureNumber as S}from"../../core/accessorSupport/ensureType.js";import{reader as b}from"../../core/accessorSupport/decorators/reader.js";import{subclass as I}from"../../core/accessorSupport/decorators/subclass.js";import{writer as x}from"../../core/accessorSupport/decorators/writer.js";import{opacity as _,url as w}from"../support/commonProperties.js";import F from"../support/DimensionalDefinition.js";import{ExportImageServiceParameters as D}from"../support/ExportImageServiceParameters.js";import j from"../support/Field.js";import P from"../support/FieldsIndex.js";import{isSupportedRendererType as T}from"../support/imageryRendererUtils.js";import N from"../support/MosaicRule.js";import O from"../support/PixelBlock.js";import{interpolationKebab as C,noDataInterpretationKebab as M}from"../support/rasterEnums.js";import J from"../support/RasterFunction.js";import q from"../support/RasterInfo.js";import V from"../support/RasterJobHandler.js";import{getDefaultMultidimensionalDefinition as A}from"../support/rasterDatasets/multidimensionalUtils.js";import{decode as E,getFormat as Q}from"../support/rasterFormats/RasterCodec.js";import{uvComponentToVector as H}from"../support/rasterFunctions/vectorFieldUtils.js";import{getSupportedRendererTypes as U,getDefaultBandCombination as z,createDefaultRenderer as L,normalizeRendererJSON as B}from"../../renderers/support/rasterRendererHelper.js";import k from"../../renderers/support/RasterSymbolizer.js";import{computeAngles as G,computePixelSpaceLocations as W,computeHistograms as K,computeStatisticsHistograms as X,getImageSpatialReferenceQueryParameter as $,getSamples as Y,identify as Z}from"../../rest/imageService.js";import"../../core/has.js";import"../support/source/DataLayerSource.js";import{executeQueryJSON as ee}from"../../rest/query/executeQueryJSON.js";import"../../core/unitUtils.js";import"../../geometry/support/spatialReferenceUtils.js";import"../graphics/featureConversionUtils.js";import te from"../../geometry/Extent.js";import"../../geometry/Geometry.js";import"../../geometry/Multipoint.js";import"../../geometry/Point.js";import re from"../../geometry/Polygon.js";import"../../geometry/Polyline.js";import"../../geometry/support/normalizeUtils.js";import"../../core/pbf.js";import ie from"../../rest/support/FeatureSet.js";import se from"../../rest/support/Query.js";import"../../kernel.js";import"../../rest/query/support/AttachmentInfo.js";import"../../rest/support/AttachmentQuery.js";import{executeForCount as ne}from"../../rest/query/executeForCount.js";import{executeForIds as oe}from"../../rest/query/executeForIds.js";import"../../rest/support/RelationshipQuery.js";import"../../rest/support/TopFeaturesQuery.js";import{fetchServiceRasterInfo as ae,generateRasterInfo as le}from"../../rest/imageService/fetchRasterInfo.js";import{getCatalogItemRasterInfo as ue}from"../../rest/imageService/getCatalogItemRasterInfo.js";import pe from"../../rest/support/ImageAngleParameters.js";import ce from"../../rest/support/ImageHistogramParameters.js";import me from"../../rest/support/ImageIdentifyParameters.js";import de from"../../rest/support/ImagePixelLocationParameters.js";import he from"../../rest/support/ImageSampleParameters.js";import{createFlowMesh as fe}from"../../views/2d/engine/flow/dataUtils.js";import ye from"../../geometry/SpatialReference.js";const ge=a()({U1:"u1",U2:"u2",U4:"u4",U8:"u8",S8:"s8",U16:"u16",S16:"s16",U32:"u32",S32:"s32",F32:"f32",F64:"f64",C64:"c64",C128:"c128",UNKNOWN:"unknown"}),Re=new Set(["png","png8","png24","png32","jpg","bmp","gif","jpgpng","lerc","tiff"]),ve=g(S,{min:0,max:255});function Se(e){if(!e)return null;const t=JSON.stringify(e).match(/"rasterFunction":"(.*?")/gi)?.map((e=>e.replace('"rasterFunction":"',"").replace('"',"")));return t?t.join("/"):null}const be=a=>{let g=class extends a{constructor(){super(...arguments),this._functionRasterInfos={},this._rasterJobHandler={instance:null,refCount:0,connectionPromise:null},this._defaultServiceMosaicRule=null,this._serviceSourceType=null,this._serviceSupportsMosaicRule=null,this._rasterAttributeTableFieldPrefix="Raster.",this.adjustAspectRatio=null,this.bandIds=void 0,this.capabilities=null,this.compressionQuality=void 0,this.compressionTolerance=.01,this.copyright=null,this.definitionExpression=null,this.exportImageServiceParameters=null,this.rasterInfo=null,this.fields=null,this.fullExtent=null,this.hasMultidimensions=!1,this.imageMaxHeight=4100,this.imageMaxWidth=4100,this.interpolation=void 0,this.minScale=0,this.maxScale=0,this.noData=null,this.noDataInterpretation=void 0,this.objectIdField=null,this.geometryType="polygon",this.typeIdField=null,this.types=[],this.pixelFilter=null,this.raster=void 0,this.viewId=void 0,this.symbolizer=null,this.rasterFunctionInfos=null,this.serviceDataType=null,this.spatialReference=null,this.pixelType=null,this.serviceRasterInfo=null,this.sourceJSON=null,this.url=null,this.version=void 0}initialize(){this._set("exportImageServiceParameters",new D({layer:this}))}readDefaultServiceMosaicRule(e,t){return this._serviceSupportsMosaicRule?N.fromJSON(t):null}readServiceSourceType(e,t){return this._isMosaicDataset(t)?"mosaic-dataset":"raster-dataset"}readServiceSupportsMosaicRule(e,t){return this._isMosaicRuleSupported(t)}get _rasterFunctionNamesIndex(){const e=new Map;return!this.rasterFunctionInfos||p(this.rasterFunctionInfos)&&this.rasterFunctionInfos.length<1||p(this.rasterFunctionInfos)&&this.rasterFunctionInfos.forEach((t=>{e.set(t.name.toLowerCase().replace(/ /gi,"_"),t.name)})),e}readBandIds(e,t){if(Array.isArray(e)&&e.length>0&&e.every((e=>"number"==typeof e)))return e}readCapabilities(e,t){return this._readCapabilities(t)}writeCompressionQuality(e,t,r){null!=e&&"lerc"!==this.format&&(t[r]=e)}writeCompressionTolerance(e,t,r){"lerc"===this.format&&null!=e&&(t[r]=e)}get fieldsIndex(){return this.fields?new P(this.fields):null}set format(e){e&&Re.has(e.toLowerCase())&&this._set("format",e.toLowerCase())}readFormat(e,t){return"esriImageServiceDataTypeVector-UV"===t.serviceDataType||"esriImageServiceDataTypeVector-MagDir"===t.serviceDataType||null!=this.pixelFilter?"lerc":"jpgpng"}readMinScale(e,t){return null!=t.minLOD&&null!=t.maxLOD?e:0}readMaxScale(e,t){return null!=t.minLOD&&null!=t.maxLOD?e:0}set mosaicRule(e){let t=e;t&&t.mosaicMethod&&(t=N.fromJSON({...t.toJSON(),mosaicMethod:t.mosaicMethod,mosaicOperation:t.mosaicOperation})),this._set("mosaicRule",t)}readMosaicRule(e,t){const r=e||t.mosaicRule;return r?N.fromJSON(r):this._isMosaicRuleSupported(t)?N.fromJSON(t):null}writeMosaicRule(e,t,r){let i=this.mosaicRule;const s=this.definitionExpression;i?s&&s!==i.where&&(i=i.clone(),i.where=s):s&&(i=new N({where:s})),this._isValidCustomizedMosaicRule(i)&&(t[r]=i.toJSON())}get multidimensionalInfo(){return p(this.serviceRasterInfo)?this.serviceRasterInfo.multidimensionalInfo:null}writeNoData(e,t,r){null!=e&&"number"==typeof e&&(t[r]=ve(e))}readObjectIdField(e,t){if(!e){const r=t.fields.filter((e=>"esriFieldTypeOID"===e.type||"oid"===e.type));e=r&&r[0]&&r[0].name}return e}get parsedUrl(){return this.url?f(this.url):null}set renderer(e){this.loaded&&(e=this._configRenderer(e)),this._set("renderer",e)}readRenderer(e,t,r){const i=t?.layerDefinition?.drawingInfo?.renderer,n=s(i,r);return null==n?null:("vector-field"===n.type&&t.symbolTileSize&&!i.symbolTileSize&&(n.symbolTileSize=t.symbolTileSize),T(n)||u.getLogger(this.declaredClass).warn("ArcGISImageService","Imagery layer doesn't support given renderer type."),n)}writeRenderer(e,t,r){t.layerDefinition=t.layerDefinition||{},t.layerDefinition.drawingInfo=t.layerDefinition.drawingInfo||{},t.layerDefinition.drawingInfo.renderer=e.toJSON(),"vector-field"===e.type&&(t.symbolTileSize=e.symbolTileSize)}get rasterFields(){const e=this._rasterAttributeTableFieldPrefix||"Raster.",t=new j({name:"Raster.ItemPixelValue",alias:"Item Pixel Value",domain:null,editable:!1,length:50,type:"string"}),r=new j({name:"Raster.ServicePixelValue",alias:"Service Pixel Value",domain:null,editable:!1,length:50,type:"string"}),i=new j({name:"Raster.ServicePixelValue.Raw",alias:"Raw Service Pixel Value",domain:null,editable:!1,length:50,type:"string"});let s=this.fields?l(this.fields):[];s.push(r),this.capabilities.operations.supportsQuery&&this.fields&&this.fields.length>0&&s.push(t),this.version>=10.4&&p(this.rasterFunctionInfos)&&this.rasterFunctionInfos.some((e=>"none"===e.name.toLowerCase()))&&s.push(i),p(this.rasterFunctionInfos)&&this.rasterFunctionInfos.filter((e=>"none"!==e.name.toLowerCase())).forEach((e=>{s.push(new j({name:"Raster.ServicePixelValue."+e.name,alias:e.name,domain:null,editable:!1,length:50,type:"string"}))})),this._isVectorDataSet()&&(s.push(new j({name:"Raster.Magnitude",alias:"Magnitude",domain:null,editable:!1,type:"double"})),s.push(new j({name:"Raster.Direction",alias:"Direction",domain:null,editable:!1,type:"double"})));const{attributeTable:n}=this.rasterInfo;if(p(n)){const t=n.fields.filter((e=>"esriFieldTypeOID"!==e.type&&"value"!==e.name.toLowerCase())).map((t=>{const r=l(t);return r.name=e+t.name,r}));s=s.concat(t)}return s}set renderingRule(e){let t=e;t&&t.rasterFunction&&(t=J.fromJSON({...t.toJSON(),rasterFunction:t.rasterFunction,rasterFunctionArguments:t.rasterFunctionArguments})),this._set("renderingRule",t)}readRenderingRule(e,t){const r=t.rasterFunctionInfos;return t.renderingRule||r&&r.length&&"None"!==r[0].name?this._isRFTJson(t.renderingRule)?J.fromJSON({rasterFunctionDefinition:t.renderingRule}):J.fromJSON(t.renderingRule||{rasterFunctionInfos:t.rasterFunctionInfos}):null}writeRenderingRule(e,t,r){const i=e.toJSON();i.rasterFunctionDefinition?t[r]=i.rasterFunctionDefinition:t[r]=i}readSpatialReference(e,t){const r=e||t.extent.spatialReference;return r?ye.fromJSON(r):null}readPixelType(e){return ge.fromJSON(e)||e}writePixelType(e,t,r){(c(this.serviceRasterInfo)||this.pixelType!==this.serviceRasterInfo.pixelType)&&(t[r]=ge.toJSON(e))}readVersion(e,t){let r=t.currentVersion;return r||(r=t.hasOwnProperty("fields")||t.hasOwnProperty("timeInfo")?10:9.3),r}applyFilter(e){let t=e;return this.pixelFilter&&(t=this._clonePixelData(e),this.pixelFilter(t)),t}async applyRenderer(e,t){let r=e;if(!this._isPicture()&&this.renderer&&this.symbolizer&&!this.pixelFilter){const i=JSON.stringify(this._cachedRendererJson)!==JSON.stringify(this.renderer.toJSON()),s=this._rasterJobHandler.instance,{bandIds:n}=this;if(s){i&&(this.symbolizer.bind(),await s.updateSymbolizer(this.symbolizer,t),this._cachedRendererJson=this.renderer.toJSON());const o=await s.symbolize({bandIds:n,...e},t);r={extent:e.extent,pixelBlock:o}}else r={extent:e.extent,pixelBlock:this.symbolizer.symbolize({bandIds:n,...e})}}return r}destroy(){this._shutdownJobHandler()}increaseRasterJobHandlerUsage(){this._rasterJobHandler.refCount++}decreaseRasterJobHandlerUsage(){this._rasterJobHandler.refCount--,this._rasterJobHandler.refCount<=0&&this._shutdownJobHandler()}async computeAngles(e,t){if(await this._fetchCapabilities(t?.signal),!this.capabilities.operations.supportsComputeAngles)throw new o("imagery-layer:compute-angles","this operation is not supported on the input image service");return e=v(pe,e).clone(),G(this.url,e,this._getRequestOptions(t))}async computePixelSpaceLocations(e,t){if(await this._fetchCapabilities(t?.signal),!this.capabilities.operations.supportsComputePixelLocation)throw new o("imagery-layer:compute-pixel-space-locations","this operation is not supported on the input image service");return e=v(de,e).clone(),W(this.url,e,this._getRequestOptions(t))}async computeHistograms(e,t){if(await this._fetchCapabilities(t?.signal),!this.capabilities.operations.supportsComputeHistograms)throw new o("imagery-layer:compute-histograms","this operation is not supported on the input image service");e=v(ce,e).clone();const{raster:r,mosaicRule:i,renderingRule:s}=this;return s&&null==e.renderingRule&&(e.renderingRule=s),i&&null==e.mosaicRule&&(e.mosaicRule=i),r&&null==e.raster&&(e.raster=r),K(this.url,e,this._getRequestOptions(t))}async computeStatisticsHistograms(e,t){if(await this._fetchCapabilities(t?.signal),!this.capabilities.operations.supportsComputeStatisticsHistograms)throw new o("imagery-layer:compute-statistics-histograms","this operation is not supported on the input image service");e=v(ce,e).clone();const{raster:r,mosaicRule:i,renderingRule:s}=this;return s&&null==e.renderingRule&&(e.renderingRule=s),i&&null==e.mosaicRule&&(e.mosaicRule=i),r&&null==e.raster&&(e.raster=r),X(this.url,e,this._getRequestOptions(t))}getField(e){const{fieldsIndex:t}=this;return p(t)?t.get(e):void 0}getFieldDomain(e,t){const r=this.getField(e);return r?r.domain:null}fetchImage(e,t,r,i={}){if(null==e||null==t||null==r)return Promise.reject(new o("imagery-layer:fetch-image","Insufficient parameters for requesting an image. A valid extent, width and height values are required."));const s=this.renderer||this.symbolizer?this.generateRasterInfo(this.renderingRule,{signal:i.signal}):null;return d(s).then((s=>{s&&(this.rasterInfo=s);const n={imageServiceParameters:this.getExportImageServiceParameters(e,t,r,i.timeExtent),imageProps:{extent:e,width:t,height:r,format:this.format},requestAsImageElement:i.requestAsImageElement&&!this.pixelFilter||!1,signal:i.signal};return this._requestArrayBuffer(n)}))}fetchKeyProperties(e){return n(this.parsedUrl.path+"/keyProperties",{query:this._getQueryParams({renderingRule:this.version>=10.3?e?.renderingRule:null})}).then((e=>e.data))}fetchRasterAttributeTable(e){return this.version<10.1?Promise.reject(new o("#fetchRasterAttributeTable()","Failed to get rasterAttributeTable")):n(this.parsedUrl.path+"/rasterAttributeTable",{query:this._getQueryParams({renderingRule:this.version>=10.3?e?.renderingRule:null})}).then((e=>ie.fromJSON(e.data)))}getCatalogItemRasterInfo(e,t){const r={...t,query:this._getQueryParams()};return ue(this.parsedUrl.path,e,r)}async getCatalogItemICSInfo(e,t){const{data:r}=await n(this.parsedUrl.path+"/"+e+"/info/ics",{query:this._getQueryParams(),...t}),i=r&&r.ics;if(!i)return;let s=null;try{s=(await n(this.parsedUrl.path+"/"+e+"/info",{query:this._getQueryParams(),...t})).data.extent}catch{}if(!s||!s.spatialReference)return{ics:i,icsToPixelTransform:null,icsExtent:null,northDirection:null};const o=this.version>=10.7?n(this.parsedUrl.path+"/"+e+"/info/icstopixel",{query:this._getQueryParams(),...t}).then((e=>e.data)).catch((()=>({}))):{},a=s.spatialReference,l={geometries:JSON.stringify({geometryType:"esriGeometryEnvelope",geometries:[s]}),inSR:a.wkid||JSON.stringify(a),outSR:"0:"+e},u=n(this.parsedUrl.path+"/project",{query:this._getQueryParams(l),...t}).then((e=>e.data)).catch((()=>({}))),p=5,c=(s.xmin+s.xmax)/2,m=(s.ymax-s.ymin)/(p+1),d=s.ymin+m,h=[];for(let n=0;n<p;n++)h.push({x:c,y:d+m*n});const f={geometries:JSON.stringify({geometryType:"esriGeometryPoint",geometries:h}),inSR:a.wkid||JSON.stringify(a),outSR:"0:"+e},y=n(this.parsedUrl.path+"/project",{query:this._getQueryParams(f),...t}).then((e=>e.data)).catch((()=>({}))),g=await Promise.all([o,u,y]);let R=g[0].ipxf;if(null==R){const e=i.geodataXform?.xf_0;"topup"===e?.name?.toLowerCase()&&6===e?.coefficients?.length&&(R={affine:{name:"ics [sensor: Frame] to pixel (column, row) transformation",coefficients:e.coefficients,cellsizeRatio:0,type:"GeometricXform"}})}const v=te.fromJSON(g[1]&&g[1].geometries&&g[1].geometries[0]);v&&(v.spatialReference=new ye({wkid:0,imageCoordinateSystem:i}));const S=g[2].geometries?g[2].geometries.filter((e=>null!=e&&null!=e.x&&null!=e.y&&"NaN"!==e.x&&"NaN"!==e.y)):[],b=S.length;if(b<3)return{ics:i,icsToPixelTransform:R,icsExtent:v,northDirection:null};let I=0,x=0,_=0,w=0;for(let n=0;n<b;n++)I+=S[n].x,x+=S[n].y,_+=S[n].x*S[n].x,w+=S[n].x*S[n].y;const F=(b*w-I*x)/(b*_-I*I);let D=0;const j=S[p-1].x>S[0].x,P=S[p-1].y>S[0].y;return F===1/0?D=P?90:270:0===F?D=j?0:180:F>0?D=j?180*Math.atan(F)/Math.PI:180*Math.atan(F)/Math.PI+180:F<0&&(D=P?180+180*Math.atan(F)/Math.PI:360+180*Math.atan(F)/Math.PI),{ics:i,icsToPixelTransform:R,icsExtent:v,northDirection:D}}async generateRasterInfo(e,t){if(await this.load(),!e||"none"===e?.functionName?.toLowerCase()||this._isVectorFieldResampleFunction(e))return this.serviceRasterInfo;const r=Se(e);if(this._functionRasterInfos[r])return this._functionRasterInfos[r];const i=this._generateRasterInfo(e,t);this._functionRasterInfos[r]=i;try{return await i}catch{return this._functionRasterInfos[r]=null,null}}getExportImageServiceParameters(e,t,r,i){e=e.clone().shiftCentralMeridian();const s=$(e.spatialReference,this.parsedUrl.path);this.pixelType!==this.serviceRasterInfo.pixelType&&(this.exportImageServiceParameters.pixelType=this.pixelType);const n=this.exportImageServiceParameters.toJSON(),{bandIds:o,noData:a}=n;let{renderingRule:l}=n;const u=this.renderingRule?.rasterFunctionDefinition,p=!this.renderer||"raster-stretch"===this.renderer.type;if(o?.length&&this._hasRenderingRule(this.renderingRule)&&!u&&p){const e={rasterFunction:"ExtractBand",rasterFunctionArguments:{BandIds:o}};if("Stretch"===l.rasterFunction)e.rasterFunctionArguments.Raster=l.rasterFunctionArguments.Raster,l.rasterFunctionArguments.Raster=e;else if("Colormap"===l.rasterFunction){const t=l.rasterFunctionArguments.Raster;"Stretch"===t?.rasterFunction?(e.rasterFunctionArguments.Raster=t.rasterFunctionArguments.Raster,t.rasterFunctionArguments.Raster=e):(e.rasterFunctionArguments.Raster=t,l.rasterFunctionArguments.Raster=e)}else e.rasterFunctionArguments.Raster=l,l=e;n.bandIds=void 0}else n.bandIds=o?.join(",");a instanceof Array&&a.length>0&&(n.noData=a.join(","));const c=this._serviceSupportsMosaicRule?this._combineMosaicRuleWithTimeExtent(this.exportImageServiceParameters.mosaicRule,i):null;n.mosaicRule=c&&JSON.stringify(c),n.renderingRule=this._getRenderingRuleString(J.fromJSON(l));const m={};if(i){const{start:e,end:t}=i.toJSON();e&&t&&e===t?m.time=""+e:null==e&&null==t||(m.time=`${e??"null"},${t??"null"}`)}return{bbox:e.xmin+","+e.ymin+","+e.xmax+","+e.ymax,bboxSR:s,imageSR:s,size:t+","+r,...n,...m}}async getSamples(e,t){if(await this._fetchCapabilities(t?.signal),!this.capabilities.operations.supportsGetSamples)throw new o("imagery-layer:get-samples","getSamples operation is not supported on the input image service");e=v(he,e).clone();const{raster:r}=this;return r&&null==e.raster&&(e.raster=r),Y(this.url,e,this._getRequestOptions(t))}async identify(e,t){if(await this._fetchCapabilities(t?.signal),!this.capabilities.operations.supportsIdentify)throw new o("imagery-layer:query-rasters","query operation is not supported on the input image service");e=v(me,e).clone();const{raster:r,mosaicRule:i,renderingRule:s}=this;if(s&&null==e.renderingRule&&(e.renderingRule=s),i&&null==e.mosaicRule){const t=this._combineMosaicRuleWithTimeExtent(i,e.timeExtent);e.mosaicRule=m(t)}return r&&null==e.raster&&(e.raster=r),Z(this.url,e,this._getRequestOptions(t))}createQuery(){const e=new se;return e.outFields=["*"],e.returnGeometry=!0,e.where=this.definitionExpression||"1=1",e}async queryRasters(e,t){return({query:e,requestOptions:t}=await this._prepareForQuery(e,t)),ee(this.url,e,t)}async queryObjectIds(e,t){return({query:e,requestOptions:t}=await this._prepareForQuery(e,t)),oe(this.url,e,t)}async queryRasterCount(e,t){return({query:e,requestOptions:t}=await this._prepareForQuery(e,t)),ne(this.url,e,t)}async queryVisibleRasters(e,t){if(!e)throw new o("imagery-layer: query-visible-rasters","missing query parameter");await this.load();const{pixelSize:r,returnDomainValues:i,returnTopmostRaster:s,showNoDataRecords:n}=t||{pixelSize:null,returnDomainValues:!1,returnTopmostRaster:!1,showNoDataRecords:!1};let a=!1,l=null,u=null;const m="raster.servicepixelvalue",d=this._rasterFunctionNamesIndex;if(p(e.outFields)&&(a=e.outFields.some((e=>!e.toLowerCase().includes(m))),this.version>=10.4)){const t=e.outFields.filter((e=>e.toLowerCase().includes(m)&&e.length>m.length)).map((e=>{const t=e.slice(m.length+1);return[this._updateRenderingRulesFunctionName(t,d),t]}));l=t.map((e=>new J({functionName:e[0]}))),u=t.map((e=>e[1])),0===l.length?this.renderingRule?(l.push(this.renderingRule),u.push(this.renderingRule.functionName)):l=null:this.renderingRule&&!l.some((e=>e.functionName===this.renderingRule.functionName))&&(l.push(this.renderingRule),u.push(this.renderingRule.functionName))}const h=c(e.outSpatialReference)||e.outSpatialReference.equals(this.spatialReference),f=e.timeExtent||this.timeExtent,y=this._combineMosaicRuleWithTimeExtent(this.exportImageServiceParameters.mosaicRule,f),g=this._getQueryParams({geometry:e.geometry,timeExtent:f,mosaicRule:y,renderingRule:this.version<10.4?this.renderingRule:null,renderingRules:l,pixelSize:r,returnCatalogItems:a,returnGeometry:h,raster:this.raster,maxItemCount:s?1:null});delete g.f;const R=new me(g);try{await this.generateRasterInfo(this.renderingRule);const r=await Z(this.url,R,{signal:t?.signal,query:{...this.customParameters}}),s=e.outFields,o=r.value.toLowerCase().includes("nodata");if(!(a&&!h&&r?.catalogItems?.features.length&&(n||!o)))return this._processVisibleRastersResponse(r,{returnDomainValues:i,templateRRFunctionNames:u,showNoDataRecords:n,templateFields:s});const l=this.objectIdField||"ObjectId",c=r.catalogItems.features,m=c.map((e=>e.attributes?.[l])),d=new se({objectIds:m,returnGeometry:!0,outSpatialReference:e.outSpatialReference,outFields:[l]}),f=await this.queryRasters(d);return f?.features?.length&&f.features.forEach((t=>{c.forEach((r=>{r.attributes[l]===t.attributes[l]&&(r.geometry=new re(t.geometry),p(e.outSpatialReference)&&(r.geometry.spatialReference=e.outSpatialReference))}))})),this._processVisibleRastersResponse(r,{returnDomainValues:i,templateRRFunctionNames:u,showNoDataRecords:n,templateFields:s})}catch{throw new o("imagery-layer:query-visible-rasters","encountered error when querying visible rasters")}}async fetchVariableStatisticsHistograms(e,t){const r=n(this.parsedUrl.path+"/statistics",{query:this._getQueryParams({variable:e}),signal:t}).then((e=>e.data?.statistics)),i=n(this.parsedUrl.path+"/histograms",{query:this._getQueryParams({variable:e}),signal:t}).then((e=>e.data?.histograms)),s=await Promise.all([r,i]);return s[0]&&s[0].forEach((e=>{e.avg=e.mean,e.stddev=e.standardDeviation})),{statistics:s[0]||null,histograms:s[1]||null}}async createFlowMesh(e,t){const r=this._rasterJobHandler.instance;return r?r.createFlowMesh(e,t):fe(e.meshType,e.simulationSettings,e.flowData,p(t.signal)?t.signal:(new AbortController).signal)}async _fetchService(e){await this._fetchServiceInfo(e),this.rasterInfo||(this.rasterInfo=this.serviceRasterInfo);const t=this.sourceJSON,r=p(this.serviceRasterInfo)?Promise.resolve(this.serviceRasterInfo):ae(this.parsedUrl.path,t,{signal:e,query:this._getQueryParams()}).then((e=>(this._set("serviceRasterInfo",e),e))),i=this._hasRenderingRule(this.renderingRule)?this.generateRasterInfo(this.renderingRule,{signal:e}):null,s=this._getRasterFunctionInfos();return Promise.all([r,i,s]).then((e=>{e[1]?this._set("rasterInfo",e[1]):this._set("rasterInfo",e[0]),e[2]&&this._set("rasterFunctionInfos",e[2]),this.renderer&&!this._isSupportedRenderer(this.renderer)&&(this._set("renderer",null),u.getLogger(this.declaredClass).warn("ArcGISImageService","Switching to the default renderer. Renderer applied is not valid for this Imagery Layer")),this._set("renderer",this._configRenderer(this.renderer)),this.addHandles(h((()=>this.renderingRule),(e=>{(this.renderer||this.symbolizer||this.popupEnabled&&this.popupTemplate)&&this.generateRasterInfo(e).then((e=>{e&&(this.rasterInfo=e)}))})));const{serviceRasterInfo:t}=this;p(t.multidimensionalInfo)&&this._updateMultidimensionalDefinition(t)}))}_combineMosaicRuleWithTimeExtent(e,t){const r=this.timeInfo;if(c(e)||c(this.multidimensionalInfo)||c(t)||c(r?.startField))return e;const{startField:i}=r,s=this.multidimensionalInfo.variables.some((e=>e.dimensions.some((e=>e.name===i))))?i:"StdTime";if(e=e.clone(),"mosaic-dataset"===this._serviceSourceType)return e.multidimensionalDefinition=e.multidimensionalDefinition?.filter((e=>e.dimensionName!==s)),this._cleanupMultidimensionalDefinition(e);e.multidimensionalDefinition=e.multidimensionalDefinition||[];const n=e.multidimensionalDefinition.filter((e=>e.dimensionName===s)),o=p(t.start)?t.start.getTime():null,a=p(t.end)?t.end.getTime():null,l=null==o||null==a||o===a,u=l?[o||a]:[[o,a]],m=this.version>=10.8;if(n.length)n.forEach((e=>{e.dimensionName===s&&(m?(e.dimensionName=null,e.isSlice=null,e.values=null):(e.isSlice=l,e.values=u))}));else if(!m){const t=e.multidimensionalDefinition.filter((e=>null!=e.variableName&&null==e.dimensionName));t.length?t.forEach((e=>{e.dimensionName=s,e.isSlice=l,e.values=u})):e.multidimensionalDefinition.push(new F({variableName:"",dimensionName:s,isSlice:l,values:u}))}return this._cleanupMultidimensionalDefinition(e)}_cleanupMultidimensionalDefinition(e){return c(e)?null:(e.multidimensionalDefinition&&(e.multidimensionalDefinition=e.multidimensionalDefinition.filter((e=>!(!e.variableName&&!e.dimensionName))),0===e.multidimensionalDefinition.length&&(e.multidimensionalDefinition=null)),"mosaic-dataset"!==this._serviceSourceType&&null==e.multidimensionalDefinition?null:e)}async _prepareForQuery(e,t){if(await this._fetchCapabilities(t?.signal),!this.capabilities.operations.supportsQuery)throw new o("imagery-layer:query-rasters","query operation is not supported on the input image service");return e=p(e)?v(se,e):this.createQuery(),t=this._getRequestOptions(t),this.raster&&(t.query={...t.query,raster:this.raster}),{query:e,requestOptions:t}}async _initJobHandler(){if(null!=this._rasterJobHandler.connectionPromise)return this._rasterJobHandler.connectionPromise;const e=new V;this._rasterJobHandler.connectionPromise=e.initialize().then((()=>{this._rasterJobHandler.instance=e}),(()=>null)),await this._rasterJobHandler.connectionPromise}_shutdownJobHandler(){this._rasterJobHandler.instance&&this._rasterJobHandler.instance.destroy(),this._rasterJobHandler.instance=null,this._rasterJobHandler.connectionPromise=null,this._rasterJobHandler.refCount=0,this._cachedRendererJson=null}_isSupportedRenderer(e){const{rasterInfo:t,renderingRule:r}=this;return"unique-value"===e.type&&this._hasRenderingRule(r)&&1===t.bandCount&&["u8","s8"].includes(t.pixelType)||U(this.rasterInfo).includes(this.renderer.type)}async _fetchCapabilities(e){return this.capabilities||await this._fetchServiceInfo(e),this.capabilities}async _fetchServiceInfo(e){let t=this.sourceJSON;if(!t){const{data:r,ssl:i}=await n(this.parsedUrl.path,{query:this._getQueryParams(),signal:e});t=r,this.sourceJSON=t,i&&(this.url=this.url.replace(/^http:/i,"https:"))}if(t.capabilities?.toLowerCase().split(",").map((e=>e.trim())).indexOf("tilesonly")>-1)throw new o("imagery-layer:fetch-service-info","use ImageryTileLayer to open tiles-only image services");this.read(t,{origin:"service",url:this.parsedUrl})}_isMosaicDataset(e){return e.serviceSourceType?"esriImageServiceSourceTypeMosaicDataset"===e.serviceSourceType:e.fields?.length>0}_isMosaicRuleSupported(e){if(!e)return!1;const t=this._isMosaicDataset(e),r=e.currentVersion>=10.71&&e.hasMultidimensions&&e.timeInfo&&!(e.objectIdField&&e.fields?.length>1);return t||r}_isVectorFieldResampleFunction(e){if(c(e))return!1;const{functionName:t,functionArguments:r}=e,i="resample"===t?.toLowerCase(),s=r?.ResampleType||r?.resampleType;return i&&(7===s||10===s)}_isPicture(){return!this.format||this.format.includes("jpg")||this.format.includes("png")}_configRenderer(e){if(!this._isPicture()&&!this.pixelFilter||this._isVectorDataSet()){if(!this.bandIds&&this.rasterInfo.bandCount>=3){const e=z(this.rasterInfo);!e||3===this.rasterInfo.bandCount&&0===e[0]&&1===e[1]&&2===e[2]||(this.bandIds=e)}e||(e=L(this.rasterInfo,{bandIds:this.bandIds,variableName:this.renderingRule?null:this.mosaicRule?.multidimensionalDefinition?.[0].variableName}));const t=B(e.toJSON());this.symbolizer?(this.symbolizer.rendererJSON=t,this.symbolizer.rasterInfo=this.rasterInfo):this.symbolizer=new k({rendererJSON:t,rasterInfo:this.rasterInfo}),this.symbolizer.bind().success||(this.symbolizer=null)}return e}_clonePixelData(e){return null==e?e:{extent:e.extent&&e.extent.clone(),pixelBlock:p(e.pixelBlock)&&e.pixelBlock.clone()}}_getQueryParams(e){p(e?.renderingRule)&&"string"!=typeof e.renderingRule&&(e.renderingRule=this._getRenderingRuleString(e.renderingRule));const{raster:t,viewId:r}=this;return{raster:t,viewId:r,f:"json",...e,...this.customParameters}}_getRequestOptions(e){return{...e,query:{...e?.query,...this.customParameters}}}_decodePixelBlock(e,t,r){return this._rasterJobHandler.instance?this._rasterJobHandler.instance.decode({data:e,options:t}):E(e,t,r)}async _getRasterFunctionInfos(e){const t=this.sourceJSON.rasterFunctionInfos;if(this.loaded)return t;if(t&&this.version>=10.3){if(1===t.length&&"none"===t[0].name.toLowerCase())return t;return(await n(this.parsedUrl.path+"/rasterFunctionInfos",{query:this._getQueryParams(),signal:e})).data?.rasterFunctionInfos}return null}async _requestArrayBuffer(e){const{imageProps:t,requestAsImageElement:r,signal:i}=e;if(r&&!this.pixelFilter&&t.format?.indexOf("png")>-1){return{imageElement:(await n(this.parsedUrl.path+"/exportImage",{responseType:"image",query:this._getQueryParams({f:"image",...e.imageServiceParameters}),signal:i})).data,params:t}}const s=this._initJobHandler(),a=n(this.parsedUrl.path+"/exportImage",{responseType:"array-buffer",query:this._getQueryParams({f:"image",...e.imageServiceParameters}),signal:i}),l=(await Promise.all([a,s]))[0].data,u=t.format||"jpgpng";let p=u;if("bsq"!==p&&"bip"!==p&&(p=Q(l)),!p)throw new o("imagery-layer:fetch-image","unsupported format signature "+String.fromCharCode.apply(null,new Uint8Array(l)));const c={signal:i},m="gif"===u||"bmp"===u||u.includes("png")&&("png"===p||"jpg"===p)?E(l,{useCanvas:!0,...t},c):this._decodePixelBlock(l,{width:t.width,height:t.height,planes:null,pixelType:null,noDataValue:null,format:u},c);return{pixelData:{pixelBlock:await m,extent:t.extent},params:t}}_generateRasterInfo(e,t){const r={...t,query:this._getQueryParams()};return le(this.parsedUrl.path,e,r)}_isValidCustomizedMosaicRule(e){return e&&JSON.stringify(e.toJSON())!==JSON.stringify(this._defaultServiceMosaicRule?.toJSON())}_updateMultidimensionalDefinition(e){if(this._isValidCustomizedMosaicRule(this.mosaicRule))return;const t=A(e);if(p(t)&&t.length>0){this.mosaicRule=this.mosaicRule||new N;const e=this.mosaicRule.multidimensionalDefinition;(!e||e&&e.length<=0)&&(this.mosaicRule.multidimensionalDefinition=t)}}_processVisibleRastersResponse(e,r){r=r||{};const i=e.value,{templateRRFunctionNames:s,showNoDataRecords:n,returnDomainValues:o,templateFields:a}=r,l=e.processedValues;let u=e.catalogItems&&e.catalogItems.features,c=e.properties&&e.properties.Values&&e.properties.Values.map((e=>e.replace(/ /gi,", ")))||[];const m=this.objectIdField||"ObjectId",d="string"==typeof i&&i.toLowerCase().includes("nodata"),h=[];if(i&&!u&&!d){const e={};e[m]=0;c=[i],u=[new t(this.fullExtent,null,e)]}if(!u)return[];let f,y,g;this._updateResponseFieldNames(u,a),d&&!n&&(u=[]);for(let t=0;t<u.length;t++){if(f=u[t],null!=i){if(y=c[t],g=this.renderingRule&&l&&l.length>0&&s&&s.length>0&&s.includes(this.renderingRule.functionName)?l[s.indexOf(this.renderingRule.functionName)]:i,"nodata"===y.toLowerCase()&&!n)continue;const e="Raster.ItemPixelValue",r="Raster.ServicePixelValue";f.attributes[e]=y,f.attributes[r]=g,this._updateFeatureWithMagDirValues(f,y);const o=this.fields&&this.fields.length>0;let a=this.renderingRule&&p(this.serviceRasterInfo.attributeTable)?o?y:i:g;this.renderingRule||(a=o?y:i),this._updateFeatureWithRasterAttributeTableValues(f,a)}if(f.sourceLayer=f.layer=this,o&&this._updateFeatureWithDomainValues(f),s&&l&&s.length===l.length)for(let e=0;e<s.length;e++){const t="Raster.ServicePixelValue."+s[e];f.attributes[t]=l[e]}h.push(u[t])}return h}_updateFeatureWithRasterAttributeTableValues(e,t){const r=this.rasterInfo&&this.rasterInfo.attributeTable||this.serviceRasterInfo.attributeTable;if(c(r))return;const{features:i,fields:s}=r,n=s.map((e=>e.name)).filter((e=>"value"===e.toLowerCase())),o=n&&n[0];if(!o)return;const a=i.filter((e=>e.attributes[o]===(null!=t?parseInt(t,10):null)));a&&a[0]&&s.forEach((t=>{const r=this._rasterAttributeTableFieldPrefix+t.name;e.attributes[r]=a[0].attributes[t.name]}))}_updateFeatureWithMagDirValues(e,t){if(!this._isVectorDataSet())return;const r=t.split(/,\s*/).map((e=>parseFloat(e))),i=r.map((e=>[e])),s=r.map((e=>({minValue:e,maxValue:e,noDataValue:null}))),n=new O({height:1,width:1,pixelType:"f32",pixels:i,statistics:s});null!=this.pixelFilter&&this.pixelFilter({pixelBlock:n,extent:new te(0,0,0,0,this.spatialReference)});const o="esriImageServiceDataTypeVector-MagDir"===this.serviceDataType?[n.pixels[0][0],n.pixels[1][0]]:H([n.pixels[0][0],n.pixels[1][0]]);e.attributes["Raster.Magnitude"]=o[0],e.attributes["Raster.Direction"]=o[1]}_updateFeatureWithDomainValues(e){const t=this.fields&&this.fields.filter((e=>e.domain&&"coded-value"===e.domain.type));null!=t&&t.forEach((t=>{const r=e.attributes[t.name];if(null!=r){const i=t.domain.codedValues.find((e=>e.code===r));i&&(e.attributes[t.name]=i.name)}}))}_updateResponseFieldNames(e,t){if(!t||t.length<1)return;const r=this.fieldsIndex;c(r)||e.forEach((e=>{if(e&&e.attributes)for(const i of t)if(r.has(i)){const t=r.get(i).name;t!==i&&(e.attributes[i]=e.attributes[t],delete e.attributes[t])}}))}_getRenderingRuleString(e){if(this._hasRenderingRule(e)){let t=e.toJSON();return t=t.rasterFunctionDefinition??t,(t.thumbnail||t.thumbnailEx)&&(t.thumbnail=t.thumbnailEx=null),JSON.stringify(t)}return null}_hasRenderingRule(e){return e&&e.functionName&&"none"!==e.functionName.toLowerCase()}_updateRenderingRulesFunctionName(e,t){if(!e||e.length<1)return;if("Raw"===e)return e.replace("Raw","None");const r=e.toLowerCase().replace(/ /gi,"_");return t.has(r)?t.get(r):e}_isRFTJson(e){return e&&e.name&&e.arguments&&e.function&&e.hasOwnProperty("functionType")}_isVectorDataSet(){return"esriImageServiceDataTypeVector-UV"===this.serviceDataType||"esriImageServiceDataTypeVector-MagDir"===this.serviceDataType}_readCapabilities(e){const t=e.capabilities?e.capabilities.toLowerCase().split(",").map((e=>e.trim())):["image","catalog"],{currentVersion:r,advancedQueryCapabilities:i,maxRecordCount:s}=e,n=t.includes("image"),o="esriImageServiceDataTypeElevation"===e.serviceDataType,a=!!(e.spatialReference||e.extent&&e.extent.spatialReference),l=t.includes("edit");return{data:{supportsAttachment:!1},operations:{supportsComputeHistograms:n,supportsExportImage:n,supportsIdentify:n,supportsMeasure:t.includes("mensuration")&&a,supportsDownload:t.includes("download"),supportsQuery:t.includes("catalog")&&e.fields&&e.fields.length>0,supportsGetSamples:r>=10.2&&n,supportsProject:r>=10.3&&n,supportsComputeStatisticsHistograms:r>=10.4&&n,supportsQueryBoundary:r>=10.6&&n,supportsCalculateVolume:r>=10.7&&o,supportsComputePixelLocation:r>=10.7&&t.includes("catalog"),supportsComputeAngles:r>=10.91,supportsAdd:l,supportsDelete:l,supportsEditing:l,supportsUpdate:l,supportsCalculate:!1,supportsTruncate:!1,supportsValidateSql:!1,supportsChangeTracking:!1,supportsQueryAttachments:!1,supportsResizeAttachments:!1,supportsSync:!1,supportsExceedsLimitStatistics:!1,supportsQueryAnalytics:!1,supportsQueryTopFeatures:!1},query:{maxRecordCount:s,maxRecordCountFactor:void 0,supportsStatistics:!!i?.supportsStatistics,supportsOrderBy:!!i?.supportsOrderBy,supportsDistinct:!!i?.supportsDistinct,supportsPagination:!!i?.supportsPagination,supportsStandardizedQueriesOnly:!!i?.useStandardizedQueries,supportsPercentileStatistics:!!i?.supportsPercentileStatistics,supportsCentroid:!!i?.supportsReturningGeometryCentroid,supportsDistance:!!i?.supportsQueryWithDistance,supportsExtent:!!i?.supportsReturningQueryExtent,supportsGeometryProperties:!!i?.supportsReturningGeometryProperties,supportsHavingClause:!!i?.supportsHavingClause,supportsQuantization:!1,supportsQuantizationEditMode:!1,supportsQueryGeometry:!1,supportsResultType:!1,supportsMaxRecordCountFactor:!1,supportsSqlExpression:!1,supportsTopFeaturesQuery:!1,supportsQueryByOthers:!1,supportsHistoricMoment:!1,supportsFormatPBF:!1,supportsDisjointSpatialRelationship:!1,supportsCacheHint:!1,supportsSpatialAggregationStatistics:!1,supportedSpatialAggregationStatistics:{envelope:!1,centroid:!1,convexHull:!1},supportsDefaultSpatialReference:!!i?.supportsDefaultSR,supportsCompactGeometry:!1,standardMaxRecordCount:void 0,tileMaxRecordCount:void 0}}}};return e([y()],g.prototype,"_functionRasterInfos",void 0),e([y()],g.prototype,"_rasterJobHandler",void 0),e([y({dependsOn:["_serviceSupportsMosaicRule"]})],g.prototype,"_defaultServiceMosaicRule",void 0),e([b("_defaultServiceMosaicRule",["defaultMosaicMethod"])],g.prototype,"readDefaultServiceMosaicRule",null),e([y()],g.prototype,"_cachedRendererJson",void 0),e([y({readOnly:!0})],g.prototype,"_serviceSourceType",void 0),e([b("_serviceSourceType",["serviceSourceType","fields"])],g.prototype,"readServiceSourceType",null),e([y({readOnly:!0})],g.prototype,"_serviceSupportsMosaicRule",void 0),e([b("_serviceSupportsMosaicRule",["currentVersion","fields"])],g.prototype,"readServiceSupportsMosaicRule",null),e([y()],g.prototype,"_rasterAttributeTableFieldPrefix",void 0),e([y({readOnly:!0})],g.prototype,"_rasterFunctionNamesIndex",null),e([y()],g.prototype,"adjustAspectRatio",void 0),e([y({type:[R],json:{write:!0}})],g.prototype,"bandIds",void 0),e([b("bandIds")],g.prototype,"readBandIds",null),e([y({readOnly:!0,json:{read:!1}})],g.prototype,"capabilities",void 0),e([b("service","capabilities",["capabilities","currentVersion","serviceDataType"])],g.prototype,"readCapabilities",null),e([y({type:Number})],g.prototype,"compressionQuality",void 0),e([x("compressionQuality")],g.prototype,"writeCompressionQuality",null),e([y({type:Number})],g.prototype,"compressionTolerance",void 0),e([x("compressionTolerance")],g.prototype,"writeCompressionTolerance",null),e([y({json:{read:{source:"copyrightText"}}})],g.prototype,"copyright",void 0),e([y({type:String,json:{name:"layerDefinition.definitionExpression",write:{enabled:!0,allowNull:!0}}})],g.prototype,"definitionExpression",void 0),e([y({readOnly:!0,constructOnly:!0})],g.prototype,"exportImageServiceParameters",void 0),e([y()],g.prototype,"rasterInfo",void 0),e([y({readOnly:!0,type:[j]})],g.prototype,"fields",void 0),e([y({readOnly:!0})],g.prototype,"fieldsIndex",null),e([y({type:["png","png8","png24","png32","jpg","bmp","gif","jpgpng","lerc","tiff"],json:{write:!0}})],g.prototype,"format",null),e([b("service","format",["serviceDataType"])],g.prototype,"readFormat",null),e([y({type:te})],g.prototype,"fullExtent",void 0),e([y({readOnly:!0})],g.prototype,"hasMultidimensions",void 0),e([y({json:{read:{source:"maxImageHeight"}}})],g.prototype,"imageMaxHeight",void 0),e([y({json:{read:{source:"maxImageWidth"}}})],g.prototype,"imageMaxWidth",void 0),e([y({type:String,json:{type:C.jsonValues,read:C.read,write:C.write}})],g.prototype,"interpolation",void 0),e([y()],g.prototype,"minScale",void 0),e([b("service","minScale")],g.prototype,"readMinScale",null),e([y()],g.prototype,"maxScale",void 0),e([b("service","maxScale")],g.prototype,"readMaxScale",null),e([y({type:N})],g.prototype,"mosaicRule",null),e([b("mosaicRule",["mosaicRule","defaultMosaicMethod"])],g.prototype,"readMosaicRule",null),e([x("mosaicRule")],g.prototype,"writeMosaicRule",null),e([y()],g.prototype,"multidimensionalInfo",null),e([y({json:{type:R}})],g.prototype,"noData",void 0),e([x("noData")],g.prototype,"writeNoData",null),e([y({type:String,json:{type:M.jsonValues,read:M.read,write:M.write}})],g.prototype,"noDataInterpretation",void 0),e([y({type:String,readOnly:!0,json:{read:{source:["fields"]}}})],g.prototype,"objectIdField",void 0),e([b("objectIdField")],g.prototype,"readObjectIdField",null),e([y({})],g.prototype,"geometryType",void 0),e([y({})],g.prototype,"typeIdField",void 0),e([y({})],g.prototype,"types",void 0),e([y({readOnly:!0})],g.prototype,"parsedUrl",null),e([y({type:Function})],g.prototype,"pixelFilter",void 0),e([y()],g.prototype,"raster",void 0),e([y()],g.prototype,"viewId",void 0),e([y({types:r,json:{name:"layerDefinition.drawingInfo.renderer",origins:{"web-scene":{types:i,name:"layerDefinition.drawingInfo.renderer",write:{overridePolicy:e=>({enabled:e&&"vector-field"!==e.type&&"flow"!==e.type})}}}}})],g.prototype,"renderer",null),e([b("renderer")],g.prototype,"readRenderer",null),e([x("renderer")],g.prototype,"writeRenderer",null),e([y()],g.prototype,"symbolizer",void 0),e([y(_)],g.prototype,"opacity",void 0),e([y({readOnly:!0})],g.prototype,"rasterFields",null),e([y({constructOnly:!0})],g.prototype,"rasterFunctionInfos",void 0),e([y({type:J})],g.prototype,"renderingRule",null),e([b("renderingRule",["renderingRule","rasterFunctionInfos"])],g.prototype,"readRenderingRule",null),e([x("renderingRule")],g.prototype,"writeRenderingRule",null),e([y()],g.prototype,"serviceDataType",void 0),e([y({readOnly:!0,type:ye})],g.prototype,"spatialReference",void 0),e([b("spatialReference",["spatialReference","extent"])],g.prototype,"readSpatialReference",null),e([y({json:{type:ge.jsonValues}})],g.prototype,"pixelType",void 0),e([b("pixelType")],g.prototype,"readPixelType",null),e([x("pixelType")],g.prototype,"writePixelType",null),e([y({constructOnly:!0,type:q})],g.prototype,"serviceRasterInfo",void 0),e([y()],g.prototype,"sourceJSON",void 0),e([y(w)],g.prototype,"url",void 0),e([y({readOnly:!0})],g.prototype,"version",void 0),e([b("version",["currentVersion","fields","timeInfo"])],g.prototype,"readVersion",null),g=e([I("esri.layers.mixins.ArcGISImageService")],g),g};export{be as ArcGISImageService};
5
+ import{_ as e}from"../../chunks/tslib.es6.js";import"../../geometry.js";import t from"../../Graphic.js";import{rasterRendererTypes as r,websceneRasterRendererTypes as i,read as s}from"../../rasterRenderers.js";import n from"../../request.js";import o from"../../core/Error.js";import{strict as a}from"../../core/jsonMap.js";import{clone as l}from"../../core/lang.js";import u from"../../core/Logger.js";import{isSome as p,isNone as c,unwrap as m}from"../../core/maybe.js";import{when as d}from"../../core/promiseUtils.js";import{watch as h}from"../../core/reactiveUtils.js";import{urlToObject as f}from"../../core/urlUtils.js";import{property as y,ensureRange as g}from"../../core/accessorSupport/decorators/property.js";import{Integer as R,ensureClass as v,ensureNumber as S}from"../../core/accessorSupport/ensureType.js";import{reader as b}from"../../core/accessorSupport/decorators/reader.js";import{subclass as I}from"../../core/accessorSupport/decorators/subclass.js";import{writer as x}from"../../core/accessorSupport/decorators/writer.js";import{opacity as _,url as w}from"../support/commonProperties.js";import F from"../support/DimensionalDefinition.js";import{ExportImageServiceParameters as D}from"../support/ExportImageServiceParameters.js";import j from"../support/Field.js";import P from"../support/FieldsIndex.js";import{isSupportedRendererType as T}from"../support/imageryRendererUtils.js";import N from"../support/MosaicRule.js";import O from"../support/PixelBlock.js";import{interpolationKebab as C,noDataInterpretationKebab as M}from"../support/rasterEnums.js";import J from"../support/RasterFunction.js";import q from"../support/RasterInfo.js";import V from"../support/RasterJobHandler.js";import{getDefaultMultidimensionalDefinition as A}from"../support/rasterDatasets/multidimensionalUtils.js";import{decode as E,getFormat as Q}from"../support/rasterFormats/RasterCodec.js";import{uvComponentToVector as H}from"../support/rasterFunctions/vectorFieldUtils.js";import{getSupportedRendererTypes as U,getDefaultBandCombination as z,createDefaultRenderer as L,normalizeRendererJSON as B}from"../../renderers/support/rasterRendererHelper.js";import k from"../../renderers/support/RasterSymbolizer.js";import{computeAngles as G,computePixelSpaceLocations as W,computeHistograms as K,computeStatisticsHistograms as X,getImageSpatialReferenceQueryParameter as $,getSamples as Y,identify as Z}from"../../rest/imageService.js";import"../../core/has.js";import"../support/source/DataLayerSource.js";import{executeQueryJSON as ee}from"../../rest/query/executeQueryJSON.js";import"../../core/unitUtils.js";import"../../geometry/support/spatialReferenceUtils.js";import"../graphics/featureConversionUtils.js";import te from"../../geometry/Extent.js";import"../../geometry/Geometry.js";import"../../geometry/Multipoint.js";import"../../geometry/Point.js";import re from"../../geometry/Polygon.js";import"../../geometry/Polyline.js";import"../../geometry/support/normalizeUtils.js";import"../../core/pbf.js";import ie from"../../rest/support/FeatureSet.js";import se from"../../rest/support/Query.js";import"../../kernel.js";import"../../rest/query/support/AttachmentInfo.js";import"../../rest/support/AttachmentQuery.js";import{executeForCount as ne}from"../../rest/query/executeForCount.js";import{executeForIds as oe}from"../../rest/query/executeForIds.js";import"../../rest/support/RelationshipQuery.js";import"../../rest/support/TopFeaturesQuery.js";import{fetchServiceRasterInfo as ae,generateRasterInfo as le}from"../../rest/imageService/fetchRasterInfo.js";import{getCatalogItemRasterInfo as ue}from"../../rest/imageService/getCatalogItemRasterInfo.js";import pe from"../../rest/support/ImageAngleParameters.js";import ce from"../../rest/support/ImageHistogramParameters.js";import me from"../../rest/support/ImageIdentifyParameters.js";import de from"../../rest/support/ImagePixelLocationParameters.js";import he from"../../rest/support/ImageSampleParameters.js";import{createFlowMesh as fe}from"../../views/2d/engine/flow/dataUtils.js";import ye from"../../geometry/SpatialReference.js";const ge=a()({U1:"u1",U2:"u2",U4:"u4",U8:"u8",S8:"s8",U16:"u16",S16:"s16",U32:"u32",S32:"s32",F32:"f32",F64:"f64",C64:"c64",C128:"c128",UNKNOWN:"unknown"}),Re=new Set(["png","png8","png24","png32","jpg","bmp","gif","jpgpng","lerc","tiff"]),ve=g(S,{min:0,max:255});function Se(e){if(!e)return null;const t=JSON.stringify(e).match(/"rasterFunction":"(.*?")/gi)?.map((e=>e.replace('"rasterFunction":"',"").replace('"',"")));return t?t.join("/"):null}const be=a=>{let g=class extends a{constructor(){super(...arguments),this._functionRasterInfos={},this._rasterJobHandler={instance:null,refCount:0,connectionPromise:null},this._defaultServiceMosaicRule=null,this._serviceSourceType=null,this._serviceSupportsMosaicRule=null,this._rasterAttributeTableFieldPrefix="Raster.",this.adjustAspectRatio=null,this.bandIds=void 0,this.capabilities=null,this.compressionQuality=void 0,this.compressionTolerance=.01,this.copyright=null,this.definitionExpression=null,this.exportImageServiceParameters=null,this.rasterInfo=null,this.fields=null,this.fullExtent=null,this.hasMultidimensions=!1,this.imageMaxHeight=4100,this.imageMaxWidth=4100,this.interpolation=void 0,this.minScale=0,this.maxScale=0,this.noData=null,this.noDataInterpretation=void 0,this.objectIdField=null,this.geometryType="polygon",this.typeIdField=null,this.types=[],this.pixelFilter=null,this.raster=void 0,this.viewId=void 0,this.symbolizer=null,this.rasterFunctionInfos=null,this.serviceDataType=null,this.spatialReference=null,this.pixelType=null,this.serviceRasterInfo=null,this.sourceJSON=null,this.url=null,this.version=void 0}initialize(){this._set("exportImageServiceParameters",new D({layer:this}))}readDefaultServiceMosaicRule(e,t){return this._serviceSupportsMosaicRule?N.fromJSON(t):null}readServiceSourceType(e,t){return this._isMosaicDataset(t)?"mosaic-dataset":"raster-dataset"}readServiceSupportsMosaicRule(e,t){return this._isMosaicRuleSupported(t)}get _rasterFunctionNamesIndex(){const e=new Map;return!this.rasterFunctionInfos||p(this.rasterFunctionInfos)&&this.rasterFunctionInfos.length<1||p(this.rasterFunctionInfos)&&this.rasterFunctionInfos.forEach((t=>{e.set(t.name.toLowerCase().replace(/ /gi,"_"),t.name)})),e}readBandIds(e,t){if(Array.isArray(e)&&e.length>0&&e.every((e=>"number"==typeof e)))return e}readCapabilities(e,t){return this._readCapabilities(t)}writeCompressionQuality(e,t,r){null!=e&&"lerc"!==this.format&&(t[r]=e)}writeCompressionTolerance(e,t,r){"lerc"===this.format&&null!=e&&(t[r]=e)}get fieldsIndex(){return this.fields?new P(this.fields):null}set format(e){e&&Re.has(e.toLowerCase())&&this._set("format",e.toLowerCase())}readFormat(e,t){return"esriImageServiceDataTypeVector-UV"===t.serviceDataType||"esriImageServiceDataTypeVector-MagDir"===t.serviceDataType||null!=this.pixelFilter?"lerc":"jpgpng"}readMinScale(e,t){return null!=t.minLOD&&null!=t.maxLOD?e:0}readMaxScale(e,t){return null!=t.minLOD&&null!=t.maxLOD?e:0}set mosaicRule(e){let t=e;t&&t.mosaicMethod&&(t=N.fromJSON({...t.toJSON(),mosaicMethod:t.mosaicMethod,mosaicOperation:t.mosaicOperation})),this._set("mosaicRule",t)}readMosaicRule(e,t){const r=e||t.mosaicRule;return r?N.fromJSON(r):this._isMosaicRuleSupported(t)?N.fromJSON(t):null}writeMosaicRule(e,t,r){let i=this.mosaicRule;const s=this.definitionExpression;i?s&&s!==i.where&&(i=i.clone(),i.where=s):s&&(i=new N({where:s})),this._isValidCustomizedMosaicRule(i)&&(t[r]=i.toJSON())}get multidimensionalInfo(){return p(this.serviceRasterInfo)?this.serviceRasterInfo.multidimensionalInfo:null}writeNoData(e,t,r){null!=e&&"number"==typeof e&&(t[r]=ve(e))}readObjectIdField(e,t){if(!e){const r=t.fields.filter((e=>"esriFieldTypeOID"===e.type||"oid"===e.type));e=r&&r[0]&&r[0].name}return e}get parsedUrl(){return this.url?f(this.url):null}set renderer(e){this.loaded&&(e=this._configRenderer(e)),this._set("renderer",e)}readRenderer(e,t,r){const i=t?.layerDefinition?.drawingInfo?.renderer,n=s(i,r);return null==n?null:("vector-field"===n.type&&t.symbolTileSize&&!i.symbolTileSize&&(n.symbolTileSize=t.symbolTileSize),T(n)||u.getLogger(this.declaredClass).warn("ArcGISImageService","Imagery layer doesn't support given renderer type."),n)}writeRenderer(e,t,r){t.layerDefinition=t.layerDefinition||{},t.layerDefinition.drawingInfo=t.layerDefinition.drawingInfo||{},t.layerDefinition.drawingInfo.renderer=e.toJSON(),"vector-field"===e.type&&(t.symbolTileSize=e.symbolTileSize)}get rasterFields(){const e=this._rasterAttributeTableFieldPrefix||"Raster.",t=new j({name:"Raster.ItemPixelValue",alias:"Item Pixel Value",domain:null,editable:!1,length:50,type:"string"}),r=new j({name:"Raster.ServicePixelValue",alias:"Service Pixel Value",domain:null,editable:!1,length:50,type:"string"}),i=new j({name:"Raster.ServicePixelValue.Raw",alias:"Raw Service Pixel Value",domain:null,editable:!1,length:50,type:"string"});let s=this.fields?l(this.fields):[];s.push(r),this.capabilities.operations.supportsQuery&&this.fields&&this.fields.length>0&&s.push(t),this.version>=10.4&&p(this.rasterFunctionInfos)&&this.rasterFunctionInfos.some((e=>"none"===e.name.toLowerCase()))&&s.push(i),p(this.rasterFunctionInfos)&&this.rasterFunctionInfos.filter((e=>"none"!==e.name.toLowerCase())).forEach((e=>{s.push(new j({name:"Raster.ServicePixelValue."+e.name,alias:e.name,domain:null,editable:!1,length:50,type:"string"}))})),this._isVectorDataSet()&&(s.push(new j({name:"Raster.Magnitude",alias:"Magnitude",domain:null,editable:!1,type:"double"})),s.push(new j({name:"Raster.Direction",alias:"Direction",domain:null,editable:!1,type:"double"})));const{attributeTable:n}=this.rasterInfo;if(p(n)){const t=n.fields.filter((e=>"esriFieldTypeOID"!==e.type&&"value"!==e.name.toLowerCase())).map((t=>{const r=l(t);return r.name=e+t.name,r}));s=s.concat(t)}return s}set renderingRule(e){let t=e;t&&t.rasterFunction&&(t=J.fromJSON({...t.toJSON(),rasterFunction:t.rasterFunction,rasterFunctionArguments:t.rasterFunctionArguments})),this._set("renderingRule",t)}readRenderingRule(e,t){const r=t.rasterFunctionInfos;return t.renderingRule||r&&r.length&&"None"!==r[0].name?this._isRFTJson(t.renderingRule)?J.fromJSON({rasterFunctionDefinition:t.renderingRule}):J.fromJSON(t.renderingRule||{rasterFunctionInfos:t.rasterFunctionInfos}):null}writeRenderingRule(e,t,r){const i=e.toJSON();i.rasterFunctionDefinition?t[r]=i.rasterFunctionDefinition:t[r]=i}readSpatialReference(e,t){const r=e||t.extent.spatialReference;return r?ye.fromJSON(r):null}readPixelType(e){return ge.fromJSON(e)||e}writePixelType(e,t,r){(c(this.serviceRasterInfo)||this.pixelType!==this.serviceRasterInfo.pixelType)&&(t[r]=ge.toJSON(e))}readVersion(e,t){let r=t.currentVersion;return r||(r=t.hasOwnProperty("fields")||t.hasOwnProperty("timeInfo")?10:9.3),r}applyFilter(e){let t=e;return this.pixelFilter&&(t=this._clonePixelData(e),this.pixelFilter(t)),t}async applyRenderer(e,t){let r=e;if(!this._isPicture()&&this.renderer&&this.symbolizer&&!this.pixelFilter){const i=JSON.stringify(this._cachedRendererJson)!==JSON.stringify(this.renderer.toJSON()),s=this._rasterJobHandler.instance,{bandIds:n}=this;if(s){i&&(this.symbolizer.bind(),await s.updateSymbolizer(this.symbolizer,t),this._cachedRendererJson=this.renderer.toJSON());const o=await s.symbolize({bandIds:n,...e},t);r={extent:e.extent,pixelBlock:o}}else r={extent:e.extent,pixelBlock:this.symbolizer.symbolize({bandIds:n,...e})}}return r}destroy(){this._shutdownJobHandler()}increaseRasterJobHandlerUsage(){this._rasterJobHandler.refCount++}decreaseRasterJobHandlerUsage(){this._rasterJobHandler.refCount--,this._rasterJobHandler.refCount<=0&&this._shutdownJobHandler()}async computeAngles(e,t){if(await this._fetchCapabilities(t?.signal),!this.capabilities.operations.supportsComputeAngles)throw new o("imagery-layer:compute-angles","this operation is not supported on the input image service");return e=v(pe,e).clone(),G(this.url,e,this._getRequestOptions(t))}async computePixelSpaceLocations(e,t){if(await this._fetchCapabilities(t?.signal),!this.capabilities.operations.supportsComputePixelLocation)throw new o("imagery-layer:compute-pixel-space-locations","this operation is not supported on the input image service");return e=v(de,e).clone(),W(this.url,e,this._getRequestOptions(t))}async computeHistograms(e,t){if(await this._fetchCapabilities(t?.signal),!this.capabilities.operations.supportsComputeHistograms)throw new o("imagery-layer:compute-histograms","this operation is not supported on the input image service");e=v(ce,e).clone();const{raster:r,mosaicRule:i,renderingRule:s}=this;return s&&null==e.renderingRule&&(e.renderingRule=s),i&&null==e.mosaicRule&&(e.mosaicRule=i),r&&null==e.raster&&(e.raster=r),K(this.url,e,this._getRequestOptions(t))}async computeStatisticsHistograms(e,t){if(await this._fetchCapabilities(t?.signal),!this.capabilities.operations.supportsComputeStatisticsHistograms)throw new o("imagery-layer:compute-statistics-histograms","this operation is not supported on the input image service");e=v(ce,e).clone();const{raster:r,mosaicRule:i,renderingRule:s}=this;return s&&null==e.renderingRule&&(e.renderingRule=s),i&&null==e.mosaicRule&&(e.mosaicRule=i),r&&null==e.raster&&(e.raster=r),X(this.url,e,this._getRequestOptions(t))}getField(e){const{fieldsIndex:t}=this;return p(t)?t.get(e):void 0}getFieldDomain(e,t){const r=this.getField(e);return r?r.domain:null}fetchImage(e,t,r,i={}){if(null==e||null==t||null==r)return Promise.reject(new o("imagery-layer:fetch-image","Insufficient parameters for requesting an image. A valid extent, width and height values are required."));const s=this.renderer||this.symbolizer?this.generateRasterInfo(this.renderingRule,{signal:i.signal}):null;return d(s).then((s=>{s&&(this.rasterInfo=s);const n={imageServiceParameters:this.getExportImageServiceParameters(e,t,r,i.timeExtent),imageProps:{extent:e,width:t,height:r,format:this.format},requestAsImageElement:i.requestAsImageElement&&!this.pixelFilter||!1,signal:i.signal};return this._requestArrayBuffer(n)}))}fetchKeyProperties(e){return n(this.parsedUrl.path+"/keyProperties",{query:this._getQueryParams({renderingRule:this.version>=10.3?e?.renderingRule:null})}).then((e=>e.data))}fetchRasterAttributeTable(e){return this.version<10.1?Promise.reject(new o("#fetchRasterAttributeTable()","Failed to get rasterAttributeTable")):n(this.parsedUrl.path+"/rasterAttributeTable",{query:this._getQueryParams({renderingRule:this.version>=10.3?e?.renderingRule:null})}).then((e=>ie.fromJSON(e.data)))}getCatalogItemRasterInfo(e,t){const r={...t,query:this._getQueryParams()};return ue(this.parsedUrl.path,e,r)}async getCatalogItemICSInfo(e,t){const{data:r}=await n(this.parsedUrl.path+"/"+e+"/info/ics",{query:this._getQueryParams(),...t}),i=r&&r.ics;if(!i)return;let s=null;try{s=(await n(this.parsedUrl.path+"/"+e+"/info",{query:this._getQueryParams(),...t})).data.extent}catch{}if(!s||!s.spatialReference)return{ics:i,icsToPixelTransform:null,icsExtent:null,northDirection:null};const o=this.version>=10.7?n(this.parsedUrl.path+"/"+e+"/info/icstopixel",{query:this._getQueryParams(),...t}).then((e=>e.data)).catch((()=>({}))):{},a=s.spatialReference,l={geometries:JSON.stringify({geometryType:"esriGeometryEnvelope",geometries:[s]}),inSR:a.wkid||JSON.stringify(a),outSR:"0:"+e},u=n(this.parsedUrl.path+"/project",{query:this._getQueryParams(l),...t}).then((e=>e.data)).catch((()=>({}))),p=5,c=(s.xmin+s.xmax)/2,m=(s.ymax-s.ymin)/(p+1),d=s.ymin+m,h=[];for(let n=0;n<p;n++)h.push({x:c,y:d+m*n});const f={geometries:JSON.stringify({geometryType:"esriGeometryPoint",geometries:h}),inSR:a.wkid||JSON.stringify(a),outSR:"0:"+e},y=n(this.parsedUrl.path+"/project",{query:this._getQueryParams(f),...t}).then((e=>e.data)).catch((()=>({}))),g=await Promise.all([o,u,y]);let R=g[0].ipxf;if(null==R){const e=i.geodataXform?.xf_0;"topup"===e?.name?.toLowerCase()&&6===e?.coefficients?.length&&(R={affine:{name:"ics [sensor: Frame] to pixel (column, row) transformation",coefficients:e.coefficients,cellsizeRatio:0,type:"GeometricXform"}})}const v=te.fromJSON(g[1]&&g[1].geometries&&g[1].geometries[0]);v&&(v.spatialReference=new ye({wkid:0,imageCoordinateSystem:i}));const S=g[2].geometries?g[2].geometries.filter((e=>null!=e&&null!=e.x&&null!=e.y&&"NaN"!==e.x&&"NaN"!==e.y)):[],b=S.length;if(b<3)return{ics:i,icsToPixelTransform:R,icsExtent:v,northDirection:null};let I=0,x=0,_=0,w=0;for(let n=0;n<b;n++)I+=S[n].x,x+=S[n].y,_+=S[n].x*S[n].x,w+=S[n].x*S[n].y;const F=(b*w-I*x)/(b*_-I*I);let D=0;const j=S[p-1].x>S[0].x,P=S[p-1].y>S[0].y;return F===1/0?D=P?90:270:0===F?D=j?0:180:F>0?D=j?180*Math.atan(F)/Math.PI:180*Math.atan(F)/Math.PI+180:F<0&&(D=P?180+180*Math.atan(F)/Math.PI:360+180*Math.atan(F)/Math.PI),{ics:i,icsToPixelTransform:R,icsExtent:v,northDirection:D}}async generateRasterInfo(e,t){if(this.serviceRasterInfo&&(!e||"none"===e.functionName?.toLowerCase()||this._isVectorFieldResampleFunction(e)))return this.serviceRasterInfo;const r=Se(e);if(this._functionRasterInfos[r])return this._functionRasterInfos[r];const i=this._generateRasterInfo(e,t);this._functionRasterInfos[r]=i;try{return await i}catch{return this._functionRasterInfos[r]=null,null}}getExportImageServiceParameters(e,t,r,i){e=e.clone().shiftCentralMeridian();const s=$(e.spatialReference,this.parsedUrl.path);this.pixelType!==this.serviceRasterInfo.pixelType&&(this.exportImageServiceParameters.pixelType=this.pixelType);const n=this.exportImageServiceParameters.toJSON(),{bandIds:o,noData:a}=n;let{renderingRule:l}=n;const u=this.renderingRule?.rasterFunctionDefinition,p=!this.renderer||"raster-stretch"===this.renderer.type;if(o?.length&&this._hasRenderingRule(this.renderingRule)&&!u&&p){const e={rasterFunction:"ExtractBand",rasterFunctionArguments:{BandIds:o}};if("Stretch"===l.rasterFunction)e.rasterFunctionArguments.Raster=l.rasterFunctionArguments.Raster,l.rasterFunctionArguments.Raster=e;else if("Colormap"===l.rasterFunction){const t=l.rasterFunctionArguments.Raster;"Stretch"===t?.rasterFunction?(e.rasterFunctionArguments.Raster=t.rasterFunctionArguments.Raster,t.rasterFunctionArguments.Raster=e):(e.rasterFunctionArguments.Raster=t,l.rasterFunctionArguments.Raster=e)}else e.rasterFunctionArguments.Raster=l,l=e;n.bandIds=void 0}else n.bandIds=o?.join(",");a instanceof Array&&a.length>0&&(n.noData=a.join(","));const c=this._serviceSupportsMosaicRule?this._combineMosaicRuleWithTimeExtent(this.exportImageServiceParameters.mosaicRule,i):null;n.mosaicRule=c&&JSON.stringify(c),n.renderingRule=this._getRenderingRuleString(J.fromJSON(l));const m={};if(i){const{start:e,end:t}=i.toJSON();e&&t&&e===t?m.time=""+e:null==e&&null==t||(m.time=`${e??"null"},${t??"null"}`)}return{bbox:e.xmin+","+e.ymin+","+e.xmax+","+e.ymax,bboxSR:s,imageSR:s,size:t+","+r,...n,...m}}async getSamples(e,t){if(await this._fetchCapabilities(t?.signal),!this.capabilities.operations.supportsGetSamples)throw new o("imagery-layer:get-samples","getSamples operation is not supported on the input image service");e=v(he,e).clone();const{raster:r}=this;return r&&null==e.raster&&(e.raster=r),Y(this.url,e,this._getRequestOptions(t))}async identify(e,t){if(await this._fetchCapabilities(t?.signal),!this.capabilities.operations.supportsIdentify)throw new o("imagery-layer:query-rasters","query operation is not supported on the input image service");e=v(me,e).clone();const{raster:r,mosaicRule:i,renderingRule:s}=this;if(s&&null==e.renderingRule&&(e.renderingRule=s),i&&null==e.mosaicRule){const t=this._combineMosaicRuleWithTimeExtent(i,e.timeExtent);e.mosaicRule=m(t)}return r&&null==e.raster&&(e.raster=r),Z(this.url,e,this._getRequestOptions(t))}createQuery(){const e=new se;return e.outFields=["*"],e.returnGeometry=!0,e.where=this.definitionExpression||"1=1",e}async queryRasters(e,t){return({query:e,requestOptions:t}=await this._prepareForQuery(e,t)),ee(this.url,e,t)}async queryObjectIds(e,t){return({query:e,requestOptions:t}=await this._prepareForQuery(e,t)),oe(this.url,e,t)}async queryRasterCount(e,t){return({query:e,requestOptions:t}=await this._prepareForQuery(e,t)),ne(this.url,e,t)}async queryVisibleRasters(e,t){if(!e)throw new o("imagery-layer: query-visible-rasters","missing query parameter");await this.load();const{pixelSize:r,returnDomainValues:i,returnTopmostRaster:s,showNoDataRecords:n}=t||{pixelSize:null,returnDomainValues:!1,returnTopmostRaster:!1,showNoDataRecords:!1};let a=!1,l=null,u=null;const m="raster.servicepixelvalue",d=this._rasterFunctionNamesIndex;if(p(e.outFields)&&(a=e.outFields.some((e=>!e.toLowerCase().includes(m))),this.version>=10.4)){const t=e.outFields.filter((e=>e.toLowerCase().includes(m)&&e.length>m.length)).map((e=>{const t=e.slice(m.length+1);return[this._updateRenderingRulesFunctionName(t,d),t]}));l=t.map((e=>new J({functionName:e[0]}))),u=t.map((e=>e[1])),0===l.length?this.renderingRule?(l.push(this.renderingRule),u.push(this.renderingRule.functionName)):l=null:this.renderingRule&&!l.some((e=>e.functionName===this.renderingRule.functionName))&&(l.push(this.renderingRule),u.push(this.renderingRule.functionName))}const h=c(e.outSpatialReference)||e.outSpatialReference.equals(this.spatialReference),f=e.timeExtent||this.timeExtent,y=this._combineMosaicRuleWithTimeExtent(this.exportImageServiceParameters.mosaicRule,f),g=this._getQueryParams({geometry:e.geometry,timeExtent:f,mosaicRule:y,renderingRule:this.version<10.4?this.renderingRule:null,renderingRules:l,pixelSize:r,returnCatalogItems:a,returnGeometry:h,raster:this.raster,maxItemCount:s?1:null});delete g.f;const R=new me(g);try{await this.generateRasterInfo(this.renderingRule);const r=await Z(this.url,R,{signal:t?.signal,query:{...this.customParameters}}),s=e.outFields,o=r.value.toLowerCase().includes("nodata");if(!(a&&!h&&r?.catalogItems?.features.length&&(n||!o)))return this._processVisibleRastersResponse(r,{returnDomainValues:i,templateRRFunctionNames:u,showNoDataRecords:n,templateFields:s});const l=this.objectIdField||"ObjectId",c=r.catalogItems.features,m=c.map((e=>e.attributes?.[l])),d=new se({objectIds:m,returnGeometry:!0,outSpatialReference:e.outSpatialReference,outFields:[l]}),f=await this.queryRasters(d);return f?.features?.length&&f.features.forEach((t=>{c.forEach((r=>{r.attributes[l]===t.attributes[l]&&(r.geometry=new re(t.geometry),p(e.outSpatialReference)&&(r.geometry.spatialReference=e.outSpatialReference))}))})),this._processVisibleRastersResponse(r,{returnDomainValues:i,templateRRFunctionNames:u,showNoDataRecords:n,templateFields:s})}catch{throw new o("imagery-layer:query-visible-rasters","encountered error when querying visible rasters")}}async fetchVariableStatisticsHistograms(e,t){const r=n(this.parsedUrl.path+"/statistics",{query:this._getQueryParams({variable:e}),signal:t}).then((e=>e.data?.statistics)),i=n(this.parsedUrl.path+"/histograms",{query:this._getQueryParams({variable:e}),signal:t}).then((e=>e.data?.histograms)),s=await Promise.all([r,i]);return s[0]&&s[0].forEach((e=>{e.avg=e.mean,e.stddev=e.standardDeviation})),{statistics:s[0]||null,histograms:s[1]||null}}async createFlowMesh(e,t){const r=this._rasterJobHandler.instance;return r?r.createFlowMesh(e,t):fe(e.meshType,e.simulationSettings,e.flowData,p(t.signal)?t.signal:(new AbortController).signal)}async _fetchService(e){await this._fetchServiceInfo(e),this.rasterInfo||(this.rasterInfo=this.serviceRasterInfo);const t=this.sourceJSON,r=p(this.serviceRasterInfo)?Promise.resolve(this.serviceRasterInfo):ae(this.parsedUrl.path,t,{signal:e,query:this._getQueryParams()}).then((e=>(this._set("serviceRasterInfo",e),e))),i=this._hasRenderingRule(this.renderingRule)?this.generateRasterInfo(this.renderingRule,{signal:e}):null,s=this._getRasterFunctionInfos();return Promise.all([r,i,s]).then((e=>{e[1]?this._set("rasterInfo",e[1]):this._set("rasterInfo",e[0]),e[2]&&this._set("rasterFunctionInfos",e[2]),this.renderer&&!this._isSupportedRenderer(this.renderer)&&(this._set("renderer",null),u.getLogger(this.declaredClass).warn("ArcGISImageService","Switching to the default renderer. Renderer applied is not valid for this Imagery Layer")),this._set("renderer",this._configRenderer(this.renderer)),this.addHandles(h((()=>this.renderingRule),(e=>{(this.renderer||this.symbolizer||this.popupEnabled&&this.popupTemplate)&&this.generateRasterInfo(e).then((e=>{e&&(this.rasterInfo=e)}))})));const{serviceRasterInfo:t}=this;p(t.multidimensionalInfo)&&this._updateMultidimensionalDefinition(t)}))}_combineMosaicRuleWithTimeExtent(e,t){const r=this.timeInfo;if(c(e)||c(this.multidimensionalInfo)||c(t)||c(r?.startField))return e;const{startField:i}=r,s=this.multidimensionalInfo.variables.some((e=>e.dimensions.some((e=>e.name===i))))?i:"StdTime";if(e=e.clone(),"mosaic-dataset"===this._serviceSourceType)return e.multidimensionalDefinition=e.multidimensionalDefinition?.filter((e=>e.dimensionName!==s)),this._cleanupMultidimensionalDefinition(e);e.multidimensionalDefinition=e.multidimensionalDefinition||[];const n=e.multidimensionalDefinition.filter((e=>e.dimensionName===s)),o=p(t.start)?t.start.getTime():null,a=p(t.end)?t.end.getTime():null,l=null==o||null==a||o===a,u=l?[o||a]:[[o,a]],m=this.version>=10.8;if(n.length)n.forEach((e=>{e.dimensionName===s&&(m?(e.dimensionName=null,e.isSlice=null,e.values=null):(e.isSlice=l,e.values=u))}));else if(!m){const t=e.multidimensionalDefinition.filter((e=>null!=e.variableName&&null==e.dimensionName));t.length?t.forEach((e=>{e.dimensionName=s,e.isSlice=l,e.values=u})):e.multidimensionalDefinition.push(new F({variableName:"",dimensionName:s,isSlice:l,values:u}))}return this._cleanupMultidimensionalDefinition(e)}_cleanupMultidimensionalDefinition(e){return c(e)?null:(e.multidimensionalDefinition&&(e.multidimensionalDefinition=e.multidimensionalDefinition.filter((e=>!(!e.variableName&&!e.dimensionName))),0===e.multidimensionalDefinition.length&&(e.multidimensionalDefinition=null)),"mosaic-dataset"!==this._serviceSourceType&&null==e.multidimensionalDefinition?null:e)}async _prepareForQuery(e,t){if(await this._fetchCapabilities(t?.signal),!this.capabilities.operations.supportsQuery)throw new o("imagery-layer:query-rasters","query operation is not supported on the input image service");return e=p(e)?v(se,e):this.createQuery(),t=this._getRequestOptions(t),this.raster&&(t.query={...t.query,raster:this.raster}),{query:e,requestOptions:t}}async _initJobHandler(){if(null!=this._rasterJobHandler.connectionPromise)return this._rasterJobHandler.connectionPromise;const e=new V;this._rasterJobHandler.connectionPromise=e.initialize().then((()=>{this._rasterJobHandler.instance=e}),(()=>null)),await this._rasterJobHandler.connectionPromise}_shutdownJobHandler(){this._rasterJobHandler.instance&&this._rasterJobHandler.instance.destroy(),this._rasterJobHandler.instance=null,this._rasterJobHandler.connectionPromise=null,this._rasterJobHandler.refCount=0,this._cachedRendererJson=null}_isSupportedRenderer(e){const{rasterInfo:t,renderingRule:r}=this;return"unique-value"===e.type&&this._hasRenderingRule(r)&&1===t.bandCount&&["u8","s8"].includes(t.pixelType)||U(this.rasterInfo).includes(this.renderer.type)}async _fetchCapabilities(e){return this.capabilities||await this._fetchServiceInfo(e),this.capabilities}async _fetchServiceInfo(e){let t=this.sourceJSON;if(!t){const{data:r,ssl:i}=await n(this.parsedUrl.path,{query:this._getQueryParams(),signal:e});t=r,this.sourceJSON=t,i&&(this.url=this.url.replace(/^http:/i,"https:"))}if(t.capabilities?.toLowerCase().split(",").map((e=>e.trim())).indexOf("tilesonly")>-1)throw new o("imagery-layer:fetch-service-info","use ImageryTileLayer to open tiles-only image services");this.read(t,{origin:"service",url:this.parsedUrl})}_isMosaicDataset(e){return e.serviceSourceType?"esriImageServiceSourceTypeMosaicDataset"===e.serviceSourceType:e.fields?.length>0}_isMosaicRuleSupported(e){if(!e)return!1;const t=this._isMosaicDataset(e),r=e.currentVersion>=10.71&&e.hasMultidimensions&&e.timeInfo&&!(e.objectIdField&&e.fields?.length>1);return t||r}_isVectorFieldResampleFunction(e){if(c(e))return!1;const{functionName:t,functionArguments:r}=e,i="resample"===t?.toLowerCase(),s=r?.ResampleType||r?.resampleType;return i&&(7===s||10===s)}_isPicture(){return!this.format||this.format.includes("jpg")||this.format.includes("png")}_configRenderer(e){if(!this._isPicture()&&!this.pixelFilter||this._isVectorDataSet()){if(!this.bandIds&&this.rasterInfo.bandCount>=3){const e=z(this.rasterInfo);!e||3===this.rasterInfo.bandCount&&0===e[0]&&1===e[1]&&2===e[2]||(this.bandIds=e)}e||(e=L(this.rasterInfo,{bandIds:this.bandIds,variableName:this.renderingRule?null:this.mosaicRule?.multidimensionalDefinition?.[0].variableName}));const t=B(e.toJSON());this.symbolizer?(this.symbolizer.rendererJSON=t,this.symbolizer.rasterInfo=this.rasterInfo):this.symbolizer=new k({rendererJSON:t,rasterInfo:this.rasterInfo}),this.symbolizer.bind().success||(this.symbolizer=null)}return e}_clonePixelData(e){return null==e?e:{extent:e.extent&&e.extent.clone(),pixelBlock:p(e.pixelBlock)&&e.pixelBlock.clone()}}_getQueryParams(e){p(e?.renderingRule)&&"string"!=typeof e.renderingRule&&(e.renderingRule=this._getRenderingRuleString(e.renderingRule));const{raster:t,viewId:r}=this;return{raster:t,viewId:r,f:"json",...e,...this.customParameters}}_getRequestOptions(e){return{...e,query:{...e?.query,...this.customParameters}}}_decodePixelBlock(e,t,r){return this._rasterJobHandler.instance?this._rasterJobHandler.instance.decode({data:e,options:t}):E(e,t,r)}async _getRasterFunctionInfos(e){const t=this.sourceJSON.rasterFunctionInfos;if(this.loaded)return t;if(t&&this.version>=10.3){if(1===t.length&&"none"===t[0].name.toLowerCase())return t;return(await n(this.parsedUrl.path+"/rasterFunctionInfos",{query:this._getQueryParams(),signal:e})).data?.rasterFunctionInfos}return null}async _requestArrayBuffer(e){const{imageProps:t,requestAsImageElement:r,signal:i}=e;if(r&&!this.pixelFilter&&t.format?.indexOf("png")>-1){return{imageElement:(await n(this.parsedUrl.path+"/exportImage",{responseType:"image",query:this._getQueryParams({f:"image",...e.imageServiceParameters}),signal:i})).data,params:t}}const s=this._initJobHandler(),a=n(this.parsedUrl.path+"/exportImage",{responseType:"array-buffer",query:this._getQueryParams({f:"image",...e.imageServiceParameters}),signal:i}),l=(await Promise.all([a,s]))[0].data,u=t.format||"jpgpng";let p=u;if("bsq"!==p&&"bip"!==p&&(p=Q(l)),!p)throw new o("imagery-layer:fetch-image","unsupported format signature "+String.fromCharCode.apply(null,new Uint8Array(l)));const c={signal:i},m="gif"===u||"bmp"===u||u.includes("png")&&("png"===p||"jpg"===p)?E(l,{useCanvas:!0,...t},c):this._decodePixelBlock(l,{width:t.width,height:t.height,planes:null,pixelType:null,noDataValue:null,format:u},c);return{pixelData:{pixelBlock:await m,extent:t.extent},params:t}}_generateRasterInfo(e,t){const r={...t,query:this._getQueryParams()};return le(this.parsedUrl.path,e,r)}_isValidCustomizedMosaicRule(e){return e&&JSON.stringify(e.toJSON())!==JSON.stringify(this._defaultServiceMosaicRule?.toJSON())}_updateMultidimensionalDefinition(e){if(this._isValidCustomizedMosaicRule(this.mosaicRule))return;const t=A(e);if(p(t)&&t.length>0){this.mosaicRule=this.mosaicRule||new N;const e=this.mosaicRule.multidimensionalDefinition;(!e||e&&e.length<=0)&&(this.mosaicRule.multidimensionalDefinition=t)}}_processVisibleRastersResponse(e,r){r=r||{};const i=e.value,{templateRRFunctionNames:s,showNoDataRecords:n,returnDomainValues:o,templateFields:a}=r,l=e.processedValues;let u=e.catalogItems&&e.catalogItems.features,c=e.properties&&e.properties.Values&&e.properties.Values.map((e=>e.replace(/ /gi,", ")))||[];const m=this.objectIdField||"ObjectId",d="string"==typeof i&&i.toLowerCase().includes("nodata"),h=[];if(i&&!u&&!d){const e={};e[m]=0;c=[i],u=[new t(this.fullExtent,null,e)]}if(!u)return[];let f,y,g;this._updateResponseFieldNames(u,a),d&&!n&&(u=[]);for(let t=0;t<u.length;t++){if(f=u[t],null!=i){if(y=c[t],g=this.renderingRule&&l&&l.length>0&&s&&s.length>0&&s.includes(this.renderingRule.functionName)?l[s.indexOf(this.renderingRule.functionName)]:i,"nodata"===y.toLowerCase()&&!n)continue;const e="Raster.ItemPixelValue",r="Raster.ServicePixelValue";f.attributes[e]=y,f.attributes[r]=g,this._updateFeatureWithMagDirValues(f,y);const o=this.fields&&this.fields.length>0;let a=this.renderingRule&&p(this.serviceRasterInfo.attributeTable)?o?y:i:g;this.renderingRule||(a=o?y:i),this._updateFeatureWithRasterAttributeTableValues(f,a)}if(f.sourceLayer=f.layer=this,o&&this._updateFeatureWithDomainValues(f),s&&l&&s.length===l.length)for(let e=0;e<s.length;e++){const t="Raster.ServicePixelValue."+s[e];f.attributes[t]=l[e]}h.push(u[t])}return h}_updateFeatureWithRasterAttributeTableValues(e,t){const r=this.rasterInfo&&this.rasterInfo.attributeTable||this.serviceRasterInfo.attributeTable;if(c(r))return;const{features:i,fields:s}=r,n=s.map((e=>e.name)).filter((e=>"value"===e.toLowerCase())),o=n&&n[0];if(!o)return;const a=i.filter((e=>e.attributes[o]===(null!=t?parseInt(t,10):null)));a&&a[0]&&s.forEach((t=>{const r=this._rasterAttributeTableFieldPrefix+t.name;e.attributes[r]=a[0].attributes[t.name]}))}_updateFeatureWithMagDirValues(e,t){if(!this._isVectorDataSet())return;const r=t.split(/,\s*/).map((e=>parseFloat(e))),i=r.map((e=>[e])),s=r.map((e=>({minValue:e,maxValue:e,noDataValue:null}))),n=new O({height:1,width:1,pixelType:"f32",pixels:i,statistics:s});null!=this.pixelFilter&&this.pixelFilter({pixelBlock:n,extent:new te(0,0,0,0,this.spatialReference)});const o="esriImageServiceDataTypeVector-MagDir"===this.serviceDataType?[n.pixels[0][0],n.pixels[1][0]]:H([n.pixels[0][0],n.pixels[1][0]]);e.attributes["Raster.Magnitude"]=o[0],e.attributes["Raster.Direction"]=o[1]}_updateFeatureWithDomainValues(e){const t=this.fields&&this.fields.filter((e=>e.domain&&"coded-value"===e.domain.type));null!=t&&t.forEach((t=>{const r=e.attributes[t.name];if(null!=r){const i=t.domain.codedValues.find((e=>e.code===r));i&&(e.attributes[t.name]=i.name)}}))}_updateResponseFieldNames(e,t){if(!t||t.length<1)return;const r=this.fieldsIndex;c(r)||e.forEach((e=>{if(e&&e.attributes)for(const i of t)if(r.has(i)){const t=r.get(i).name;t!==i&&(e.attributes[i]=e.attributes[t],delete e.attributes[t])}}))}_getRenderingRuleString(e){if(this._hasRenderingRule(e)){let t=e.toJSON();return t=t.rasterFunctionDefinition??t,(t.thumbnail||t.thumbnailEx)&&(t.thumbnail=t.thumbnailEx=null),JSON.stringify(t)}return null}_hasRenderingRule(e){return e&&e.functionName&&"none"!==e.functionName.toLowerCase()}_updateRenderingRulesFunctionName(e,t){if(!e||e.length<1)return;if("Raw"===e)return e.replace("Raw","None");const r=e.toLowerCase().replace(/ /gi,"_");return t.has(r)?t.get(r):e}_isRFTJson(e){return e&&e.name&&e.arguments&&e.function&&e.hasOwnProperty("functionType")}_isVectorDataSet(){return"esriImageServiceDataTypeVector-UV"===this.serviceDataType||"esriImageServiceDataTypeVector-MagDir"===this.serviceDataType}_readCapabilities(e){const t=e.capabilities?e.capabilities.toLowerCase().split(",").map((e=>e.trim())):["image","catalog"],{currentVersion:r,advancedQueryCapabilities:i,maxRecordCount:s}=e,n=t.includes("image"),o="esriImageServiceDataTypeElevation"===e.serviceDataType,a=!!(e.spatialReference||e.extent&&e.extent.spatialReference),l=t.includes("edit");return{data:{supportsAttachment:!1},operations:{supportsComputeHistograms:n,supportsExportImage:n,supportsIdentify:n,supportsMeasure:t.includes("mensuration")&&a,supportsDownload:t.includes("download"),supportsQuery:t.includes("catalog")&&e.fields&&e.fields.length>0,supportsGetSamples:r>=10.2&&n,supportsProject:r>=10.3&&n,supportsComputeStatisticsHistograms:r>=10.4&&n,supportsQueryBoundary:r>=10.6&&n,supportsCalculateVolume:r>=10.7&&o,supportsComputePixelLocation:r>=10.7&&t.includes("catalog"),supportsComputeAngles:r>=10.91,supportsAdd:l,supportsDelete:l,supportsEditing:l,supportsUpdate:l,supportsCalculate:!1,supportsTruncate:!1,supportsValidateSql:!1,supportsChangeTracking:!1,supportsQueryAttachments:!1,supportsResizeAttachments:!1,supportsSync:!1,supportsExceedsLimitStatistics:!1,supportsQueryAnalytics:!1,supportsQueryTopFeatures:!1},query:{maxRecordCount:s,maxRecordCountFactor:void 0,supportsStatistics:!!i?.supportsStatistics,supportsOrderBy:!!i?.supportsOrderBy,supportsDistinct:!!i?.supportsDistinct,supportsPagination:!!i?.supportsPagination,supportsStandardizedQueriesOnly:!!i?.useStandardizedQueries,supportsPercentileStatistics:!!i?.supportsPercentileStatistics,supportsCentroid:!!i?.supportsReturningGeometryCentroid,supportsDistance:!!i?.supportsQueryWithDistance,supportsExtent:!!i?.supportsReturningQueryExtent,supportsGeometryProperties:!!i?.supportsReturningGeometryProperties,supportsHavingClause:!!i?.supportsHavingClause,supportsQuantization:!1,supportsQuantizationEditMode:!1,supportsQueryGeometry:!1,supportsResultType:!1,supportsMaxRecordCountFactor:!1,supportsSqlExpression:!1,supportsTopFeaturesQuery:!1,supportsQueryByOthers:!1,supportsHistoricMoment:!1,supportsFormatPBF:!1,supportsDisjointSpatialRelationship:!1,supportsCacheHint:!1,supportsSpatialAggregationStatistics:!1,supportedSpatialAggregationStatistics:{envelope:!1,centroid:!1,convexHull:!1},supportsDefaultSpatialReference:!!i?.supportsDefaultSR,supportsCompactGeometry:!1,standardMaxRecordCount:void 0,tileMaxRecordCount:void 0}}}};return e([y()],g.prototype,"_functionRasterInfos",void 0),e([y()],g.prototype,"_rasterJobHandler",void 0),e([y({dependsOn:["_serviceSupportsMosaicRule"]})],g.prototype,"_defaultServiceMosaicRule",void 0),e([b("_defaultServiceMosaicRule",["defaultMosaicMethod"])],g.prototype,"readDefaultServiceMosaicRule",null),e([y()],g.prototype,"_cachedRendererJson",void 0),e([y({readOnly:!0})],g.prototype,"_serviceSourceType",void 0),e([b("_serviceSourceType",["serviceSourceType","fields"])],g.prototype,"readServiceSourceType",null),e([y({readOnly:!0})],g.prototype,"_serviceSupportsMosaicRule",void 0),e([b("_serviceSupportsMosaicRule",["currentVersion","fields"])],g.prototype,"readServiceSupportsMosaicRule",null),e([y()],g.prototype,"_rasterAttributeTableFieldPrefix",void 0),e([y({readOnly:!0})],g.prototype,"_rasterFunctionNamesIndex",null),e([y()],g.prototype,"adjustAspectRatio",void 0),e([y({type:[R],json:{write:!0}})],g.prototype,"bandIds",void 0),e([b("bandIds")],g.prototype,"readBandIds",null),e([y({readOnly:!0,json:{read:!1}})],g.prototype,"capabilities",void 0),e([b("service","capabilities",["capabilities","currentVersion","serviceDataType"])],g.prototype,"readCapabilities",null),e([y({type:Number})],g.prototype,"compressionQuality",void 0),e([x("compressionQuality")],g.prototype,"writeCompressionQuality",null),e([y({type:Number})],g.prototype,"compressionTolerance",void 0),e([x("compressionTolerance")],g.prototype,"writeCompressionTolerance",null),e([y({json:{read:{source:"copyrightText"}}})],g.prototype,"copyright",void 0),e([y({type:String,json:{name:"layerDefinition.definitionExpression",write:{enabled:!0,allowNull:!0}}})],g.prototype,"definitionExpression",void 0),e([y({readOnly:!0,constructOnly:!0})],g.prototype,"exportImageServiceParameters",void 0),e([y()],g.prototype,"rasterInfo",void 0),e([y({readOnly:!0,type:[j]})],g.prototype,"fields",void 0),e([y({readOnly:!0})],g.prototype,"fieldsIndex",null),e([y({type:["png","png8","png24","png32","jpg","bmp","gif","jpgpng","lerc","tiff"],json:{write:!0}})],g.prototype,"format",null),e([b("service","format",["serviceDataType"])],g.prototype,"readFormat",null),e([y({type:te})],g.prototype,"fullExtent",void 0),e([y({readOnly:!0})],g.prototype,"hasMultidimensions",void 0),e([y({json:{read:{source:"maxImageHeight"}}})],g.prototype,"imageMaxHeight",void 0),e([y({json:{read:{source:"maxImageWidth"}}})],g.prototype,"imageMaxWidth",void 0),e([y({type:String,json:{type:C.jsonValues,read:C.read,write:C.write}})],g.prototype,"interpolation",void 0),e([y()],g.prototype,"minScale",void 0),e([b("service","minScale")],g.prototype,"readMinScale",null),e([y()],g.prototype,"maxScale",void 0),e([b("service","maxScale")],g.prototype,"readMaxScale",null),e([y({type:N})],g.prototype,"mosaicRule",null),e([b("mosaicRule",["mosaicRule","defaultMosaicMethod"])],g.prototype,"readMosaicRule",null),e([x("mosaicRule")],g.prototype,"writeMosaicRule",null),e([y()],g.prototype,"multidimensionalInfo",null),e([y({json:{type:R}})],g.prototype,"noData",void 0),e([x("noData")],g.prototype,"writeNoData",null),e([y({type:String,json:{type:M.jsonValues,read:M.read,write:M.write}})],g.prototype,"noDataInterpretation",void 0),e([y({type:String,readOnly:!0,json:{read:{source:["fields"]}}})],g.prototype,"objectIdField",void 0),e([b("objectIdField")],g.prototype,"readObjectIdField",null),e([y({})],g.prototype,"geometryType",void 0),e([y({})],g.prototype,"typeIdField",void 0),e([y({})],g.prototype,"types",void 0),e([y({readOnly:!0})],g.prototype,"parsedUrl",null),e([y({type:Function})],g.prototype,"pixelFilter",void 0),e([y()],g.prototype,"raster",void 0),e([y()],g.prototype,"viewId",void 0),e([y({types:r,json:{name:"layerDefinition.drawingInfo.renderer",origins:{"web-scene":{types:i,name:"layerDefinition.drawingInfo.renderer",write:{overridePolicy:e=>({enabled:e&&"vector-field"!==e.type&&"flow"!==e.type})}}}}})],g.prototype,"renderer",null),e([b("renderer")],g.prototype,"readRenderer",null),e([x("renderer")],g.prototype,"writeRenderer",null),e([y()],g.prototype,"symbolizer",void 0),e([y(_)],g.prototype,"opacity",void 0),e([y({readOnly:!0})],g.prototype,"rasterFields",null),e([y({constructOnly:!0})],g.prototype,"rasterFunctionInfos",void 0),e([y({type:J})],g.prototype,"renderingRule",null),e([b("renderingRule",["renderingRule","rasterFunctionInfos"])],g.prototype,"readRenderingRule",null),e([x("renderingRule")],g.prototype,"writeRenderingRule",null),e([y()],g.prototype,"serviceDataType",void 0),e([y({readOnly:!0,type:ye})],g.prototype,"spatialReference",void 0),e([b("spatialReference",["spatialReference","extent"])],g.prototype,"readSpatialReference",null),e([y({json:{type:ge.jsonValues}})],g.prototype,"pixelType",void 0),e([b("pixelType")],g.prototype,"readPixelType",null),e([x("pixelType")],g.prototype,"writePixelType",null),e([y({constructOnly:!0,type:q})],g.prototype,"serviceRasterInfo",void 0),e([y()],g.prototype,"sourceJSON",void 0),e([y(w)],g.prototype,"url",void 0),e([y({readOnly:!0})],g.prototype,"version",void 0),e([b("version",["currentVersion","fields","timeInfo"])],g.prototype,"readVersion",null),g=e([I("esri.layers.mixins.ArcGISImageService")],g),g};export{be as ArcGISImageService};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arcgis/core",
3
- "version": "4.25.0-next.20220721",
3
+ "version": "4.25.0-next.20220722",
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": [
@@ -25,7 +25,7 @@
25
25
  "process": false
26
26
  },
27
27
  "dependencies": {
28
- "@esri/arcgis-html-sanitizer": "~2.10.0",
28
+ "@esri/arcgis-html-sanitizer": "~2.11.0",
29
29
  "@esri/calcite-colors": "~6.0.1",
30
30
  "@esri/calcite-components": "1.0.0-beta.86",
31
31
  "@popperjs/core": "~2.11.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.25/esri/copyright.txt for details.
4
4
  */
5
- const d="20220721",c="da8f6db97c8af3da470cb1fd178fccd1bade917f";export{d as buildDate,c as commitHash};
5
+ const b="20220722",c="73515eb1a8c4414ecd04f091dbbe3c42b4802b50";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.25/esri/copyright.txt for details.
4
4
  */
5
- import e from"../../../../../core/Error.js";import t from"../../../../../core/Logger.js";import s from"../../../../../core/LRUCache.js";import{createRendererExpression as r}from"../../../../../support/arcadeOnDemand.js";import i from"../../../arcade/callExpressionWithFeature.js";import{expandSymbol as a}from"../../../layers/support/cimSymbolUtils.js";const n=t.getLogger("esri/views/2d/engine/webgl/util/Matcher");async function l(e,t,s,r){switch(e.type){case"simple":case"heatmap":return o.fromBasicRenderer(e,t,s,r);case"map":return m.fromUVRenderer(e,t,s,r);case"interval":return c.fromCBRenderer(e,t,s,r);case"dictionary":return p.fromDictionaryRenderer(e,t,s,r);case"pie-chart":return u.fromPieChartRenderer(e,t,s,r);case"subtype":return u.fromSubtypes(e,t,s,r)}}class o{constructor(){this.type="feature",this._defaultResult=null}static async fromBasicRenderer(e,t,s,r){const i=new o;if(e.symbol){const n=await a(e.symbol,s,r),l=t.createTemplateGroup(n,null);i.setDefault(l)}return i}static async fromPieChartRenderer(e,t,s,r){const i=new o;if(e.markerSymbol){const n=await a(e.markerSymbol,s,r);let l;e.fillSymbol&&(l=await a(e.fillSymbol,s,r));const o=t.createTemplateGroup(n,l);i.setDefault(o)}return i}size(){return 1}getDefault(){return this._defaultResult}setDefault(e){this._defaultResult=e}match(e,t,s,r,i){return this.getDefault()}async analyze(e,t,s,r,i,a){return null}}class u extends o{constructor(e,t){super(),this._subMatchers=e,this._subtypeField=t}static async fromSubtypes(e,t,s,r){const i=new Map,a=[];for(const n in e.renderers){const o=parseInt(n,10),u=l(e.renderers[n],t,s,r).then((e=>i.set(o,e)));a.push(u)}return await Promise.all(a),new u(i,e.subtypeField)}match(e,t,s,r,i){const a=t.readAttribute(this._subtypeField),n=this._subMatchers.get(a);return n?n.match(e,t,s,r,i):null}}class c extends o{constructor(e,t,s,r){super(),this.type="interval",this._intervals=[],this._isMaxInclusive=t,this._fieldIndex=r,this._field=e,this._normalizationInfo=s}static async fromCBRenderer(e,t,s,r){const{isMaxInclusive:i,normalizationField:n,normalizationTotal:l,normalizationType:o}=e,u=e.field,m=new c(u,i,{normalizationField:n,normalizationTotal:l,normalizationType:o},e.fieldIndex),d=await a(e.backgroundFillSymbol,s,r);await Promise.all(e.intervals.map((async e=>{const i=await a(e.symbol,s,r),n=await t.createTemplateGroup(i,d),l={min:e.min,max:e.max};m.add(l,n)})));const h=await a(e.defaultSymbol,s,r);if(h){const e=await t.createTemplateGroup(h,d);m.setDefault(e)}return m}add(e,t){this._intervals.push({interval:e,result:t}),this._intervals.sort(((e,t)=>e.interval.min-t.interval.min))}size(){return super.size()+this._intervals.length}match(e,t,s,r,i){if(null==this._fieldIndex&&!this._field)return this.getDefault();const a=null!=this._fieldIndex?t.getComputedNumericAtIndex(this._fieldIndex):this._getValueFromField(t);if(!a&&(null==a||isNaN(a)))return this.getDefault();for(let n=0;n<this._intervals.length;n++){const{interval:e,result:t}=this._intervals[n],s=a>=e.min,r=this._isMaxInclusive?a<=e.max:a<e.max;if(s&&r)return t}return this.getDefault()}_needsNormalization(){const e=this._normalizationInfo;return e&&(e.normalizationField||e.normalizationTotal||e.normalizationType)}_getValueFromField(e){const t=e.readAttribute(this._field);if(!this._needsNormalization()||null==t)return t;const{normalizationField:s,normalizationTotal:r,normalizationType:i}=this._normalizationInfo,a=!!s&&e.readAttribute(s);if(i)switch(i){case"esriNormalizeByField":return a?t/a:void 0;case"esriNormalizeByLog":return Math.log(t)*Math.LOG10E;case"esriNormalizeByPercentOfTotal":return t/r*100;default:return void n.error(`Found unknown normalization type: ${i}`)}else n.error("Normalization is required, but no type was set!")}}class m extends o{constructor(e,t,s){super(),this.type="map",this._nullResult=null,this._resultsMap=new Map,this._fieldsIndex=s,this._fields=e,this._seperator=t||""}static async fromUVRenderer(e,t,s,r){const i=e.fieldDelimiter,n=[e.field];e.field2&&n.push(e.field2),e.field3&&n.push(e.field3);const l=await a(e.backgroundFillSymbol,s,r),o=new m(n,i,e.fieldIndex);await Promise.all(e.map.map((async e=>{const i=await a(e.symbol,s,r),n=await t.createTemplateGroup(i,l);"<Null>"===e.value?o.setNullResult(n):o.add(e.value,n)})));const u=await a(e.defaultSymbol,s,r);if(u){const e=await t.createTemplateGroup(u,l);o.setDefault(e)}return o}setNullResult(e){this._nullResult=e}add(e,t){this._resultsMap.set(e.toString(),t)}size(){return super.size()+this._resultsMap.size}match(e,t,s,r,i){if(null==this._fieldsIndex&&!this._fields)return this.getDefault();const a=null!=this._fieldsIndex?t.getComputedStringAtIndex(this._fieldsIndex):this._getValueFromFields(t);if(null!==this._nullResult&&(null==a||""===a||"<Null>"===a))return this._nullResult;if(!a&&null==a)return this.getDefault();const n=a.toString();return this._resultsMap.has(n)?this._resultsMap.get(n):this.getDefault()}_getValueFromFields(e){const t=[];for(const s of this._fields){const r=e.readAttribute(s);null==r||""===r?t.push("<Null>"):t.push(r)}return t.join(this._seperator)}}async function d(e,t){const s=e||1;if("number"==typeof s)return(e,t,r)=>s;const a=await r(s,t.spatialReference,t.fields);return(e,s,r)=>i(a,e,{$view:r},t.geometryType,s)||1}let h;async function f(){return h||(h=import("../../../layers/features/createSymbolSchema.js")),h}class p extends o{constructor(e,t,r,i,a,n){super(),this.type="dictionary",this._groupIdCache=new s(100),this._loader=e,this._fieldMap=e.fieldMap,this._symbolFields=e.getSymbolFields(),this._templates=t,this._info=r,this._scaleFn=i,this._schemaUtilsModule=a,this._symbolOptions=n}static async fromDictionaryRenderer(e,t,s,r){const[{DictionaryLoader:i},a]=await Promise.all([import("../../../../../renderers/support/DictionaryLoader.js"),f()]),n=new i(e.url,e.config,e.fieldMap);await n.fetchResources({spatialReference:s.spatialReference,fields:s.fields});const l=await d(e.scaleExpression,s);return new p(n,t,s,l,a,e.symbolOptions)}async _analyzeFeature(t,s,r,i,l){const o=t.readLegacyFeature(),u=this._scaleFn(o,r,i),c=this._attributeHash(o)+"-"+u,m=this._groupIdCache.get(c);if(m)return m;const d={...i,spatialReference:this._info.spatialReference,abortOptions:l,fields:this._info.fields},h=await this._loader.getSymbolAsync(o,d),f=this._schemaUtilsModule.createSymbolSchema(h,this._symbolOptions),p=a(f,this._info,s,l).then((t=>{if("expanded-cim"!==t.type)return n.error(new e("mapview-bad-type",`Found unexpected type ${t.type} in dictionary response`)),null;t.hash+="-"+u;for(const e of t.layers)e.scaleFactor=u,e.templateHash+="-"+u;return this._templates.createTemplateGroup(t,null)}));return this._groupIdCache.put(c,p,1),p}async analyze(e,t,s,r,i,a){const n=t.getCursor(),l=[];for(;n.next();)l.push(this._analyzeFeature(n,s,r,i,a));return Promise.all(l)}match(e,t,s,r,i){return null}_attributeHash(e){let t="";for(const s of this._symbolFields){const r=this._fieldMap[s];r&&(t+=e.attributes[r]+"-")}return t}}export{p as DictionaryMatcher,o as FeatureMatcher,c as IntervalMatcher,m as MapMatcher,u as SubtypeMatcher,l as createMatcher};
5
+ import e from"../../../../../core/Error.js";import t from"../../../../../core/Logger.js";import s from"../../../../../core/LRUCache.js";import{createRendererExpression as r}from"../../../../../support/arcadeOnDemand.js";import i from"../../../arcade/callExpressionWithFeature.js";import{expandSymbol as a}from"../../../layers/support/cimSymbolUtils.js";const n=t.getLogger("esri/views/2d/engine/webgl/util/Matcher");async function l(e,t,s,r){switch(e.type){case"simple":case"heatmap":return o.fromBasicRenderer(e,t,s,r);case"map":return m.fromUVRenderer(e,t,s,r);case"interval":return c.fromCBRenderer(e,t,s,r);case"dictionary":return p.fromDictionaryRenderer(e,t,s,r);case"pie-chart":return u.fromPieChartRenderer(e,t,s,r);case"subtype":return u.fromSubtypes(e,t,s,r)}}class o{constructor(){this.type="feature",this._defaultResult=null}static async fromBasicRenderer(e,t,s,r){const i=new o;if(e.symbol){const n=await a(e.symbol,s,r),l=t.createTemplateGroup(n,null);i.setDefault(l)}return i}static async fromPieChartRenderer(e,t,s,r){const i=new o;if(e.markerSymbol){const n=await a(e.markerSymbol,s,r);let l;e.fillSymbol&&(l=await a(e.fillSymbol,s,r));const o=t.createTemplateGroup(n,l);i.setDefault(o)}return i}size(){return 1}getDefault(){return this._defaultResult}setDefault(e){this._defaultResult=e}match(e,t,s,r,i){return this.getDefault()}async analyze(e,t,s,r,i,a){return null}}class u extends o{constructor(e,t){super(),this._subMatchers=e,this._subtypeField=t}static async fromSubtypes(e,t,s,r){const i=new Map,a=[];for(const n in e.renderers){const o=parseInt(n,10),u=l(e.renderers[n],t,s,r).then((e=>i.set(o,e)));a.push(u)}return await Promise.all(a),new u(i,e.subtypeField)}match(e,t,s,r,i){const a=t.readAttribute(this._subtypeField),n=this._subMatchers.get(a);return n?n.match(e,t,s,r,i):null}}class c extends o{constructor(e,t,s,r){super(),this.type="interval",this._intervals=[],this._isMaxInclusive=t,this._fieldIndex=r,this._field=e,this._normalizationInfo=s}static async fromCBRenderer(e,t,s,r){const{isMaxInclusive:i,normalizationField:n,normalizationTotal:l,normalizationType:o}=e,u=e.field,m=new c(u,i,{normalizationField:n,normalizationTotal:l,normalizationType:o},e.fieldIndex),d=await a(e.backgroundFillSymbol,s,r);await Promise.all(e.intervals.map((async e=>{const i=await a(e.symbol,s,r),n=await t.createTemplateGroup(i,d),l={min:e.min,max:e.max};m.add(l,n)})));const h=await a(e.defaultSymbol,s,r);if(h){const e=await t.createTemplateGroup(h,d);m.setDefault(e)}return m}add(e,t){this._intervals.push({interval:e,result:t}),this._intervals.sort(((e,t)=>e.interval.min-t.interval.min))}size(){return super.size()+this._intervals.length}match(e,t,s,r,i){if(null==this._fieldIndex&&!this._field)return this.getDefault();const a=null!=this._fieldIndex?t.getComputedNumericAtIndex(this._fieldIndex):this._getValueFromField(t);if(null==a||isNaN(a)||a===1/0||a===-1/0)return this.getDefault();for(let n=0;n<this._intervals.length;n++){const{interval:e,result:t}=this._intervals[n],s=a>=e.min,r=this._isMaxInclusive?a<=e.max:a<e.max;if(s&&r)return t}return this.getDefault()}_needsNormalization(){const e=this._normalizationInfo;return e&&(e.normalizationField||e.normalizationTotal||e.normalizationType)}_getValueFromField(e){const t=e.readAttribute(this._field);if(!this._needsNormalization()||null==t)return t;const{normalizationField:s,normalizationTotal:r,normalizationType:i}=this._normalizationInfo,a=!!s&&e.readAttribute(s);if(i)switch(i){case"esriNormalizeByField":return a?t/a:void 0;case"esriNormalizeByLog":return Math.log(t)*Math.LOG10E;case"esriNormalizeByPercentOfTotal":return t/r*100;default:return void n.error(`Found unknown normalization type: ${i}`)}else n.error("Normalization is required, but no type was set!")}}class m extends o{constructor(e,t,s){super(),this.type="map",this._nullResult=null,this._resultsMap=new Map,this._fieldsIndex=s,this._fields=e,this._seperator=t||""}static async fromUVRenderer(e,t,s,r){const i=e.fieldDelimiter,n=[e.field];e.field2&&n.push(e.field2),e.field3&&n.push(e.field3);const l=await a(e.backgroundFillSymbol,s,r),o=new m(n,i,e.fieldIndex);await Promise.all(e.map.map((async e=>{const i=await a(e.symbol,s,r),n=await t.createTemplateGroup(i,l);"<Null>"===e.value?o.setNullResult(n):o.add(e.value,n)})));const u=await a(e.defaultSymbol,s,r);if(u){const e=await t.createTemplateGroup(u,l);o.setDefault(e)}return o}setNullResult(e){this._nullResult=e}add(e,t){this._resultsMap.set(e.toString(),t)}size(){return super.size()+this._resultsMap.size}match(e,t,s,r,i){if(null==this._fieldsIndex&&!this._fields)return this.getDefault();const a=null!=this._fieldsIndex?t.getComputedStringAtIndex(this._fieldsIndex):this._getValueFromFields(t);if(null!==this._nullResult&&(null==a||""===a||"<Null>"===a))return this._nullResult;if(null==a)return this.getDefault();const n=a.toString();return this._resultsMap.has(n)?this._resultsMap.get(n):this.getDefault()}_getValueFromFields(e){const t=[];for(const s of this._fields){const r=e.readAttribute(s);null==r||""===r?t.push("<Null>"):t.push(r)}return t.join(this._seperator)}}async function d(e,t){const s=e||1;if("number"==typeof s)return(e,t,r)=>s;const a=await r(s,t.spatialReference,t.fields);return(e,s,r)=>i(a,e,{$view:r},t.geometryType,s)||1}let h;async function f(){return h||(h=import("../../../layers/features/createSymbolSchema.js")),h}class p extends o{constructor(e,t,r,i,a,n){super(),this.type="dictionary",this._groupIdCache=new s(100),this._loader=e,this._fieldMap=e.fieldMap,this._symbolFields=e.getSymbolFields(),this._templates=t,this._info=r,this._scaleFn=i,this._schemaUtilsModule=a,this._symbolOptions=n}static async fromDictionaryRenderer(e,t,s,r){const[{DictionaryLoader:i},a]=await Promise.all([import("../../../../../renderers/support/DictionaryLoader.js"),f()]),n=new i(e.url,e.config,e.fieldMap);await n.fetchResources({spatialReference:s.spatialReference,fields:s.fields});const l=await d(e.scaleExpression,s);return new p(n,t,s,l,a,e.symbolOptions)}async _analyzeFeature(t,s,r,i,l){const o=t.readLegacyFeature(),u=this._scaleFn(o,r,i),c=this._attributeHash(o)+"-"+u,m=this._groupIdCache.get(c);if(m)return m;const d={...i,spatialReference:this._info.spatialReference,abortOptions:l,fields:this._info.fields},h=await this._loader.getSymbolAsync(o,d),f=this._schemaUtilsModule.createSymbolSchema(h,this._symbolOptions),p=a(f,this._info,s,l).then((t=>{if("expanded-cim"!==t.type)return n.error(new e("mapview-bad-type",`Found unexpected type ${t.type} in dictionary response`)),null;t.hash+="-"+u;for(const e of t.layers)e.scaleFactor=u,e.templateHash+="-"+u;return this._templates.createTemplateGroup(t,null)}));return this._groupIdCache.put(c,p,1),p}async analyze(e,t,s,r,i,a){const n=t.getCursor(),l=[];for(;n.next();)l.push(this._analyzeFeature(n,s,r,i,a));return Promise.all(l)}match(e,t,s,r,i){return null}_attributeHash(e){let t="";for(const s of this._symbolFields){const r=this._fieldMap[s];r&&(t+=e.attributes[r]+"-")}return t}}export{p as DictionaryMatcher,o as FeatureMatcher,c as IntervalMatcher,m as MapMatcher,u as SubtypeMatcher,l as createMatcher};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.25/esri/copyright.txt for details.
4
4
  */
5
- import t from"../../../../../core/Error.js";import has from"../../../../../core/has.js";import e from"../../../../../core/Logger.js";import{clamp as i}from"../../../../../core/mathUtils.js";import{isNone as s,isSome as r,mapMany as a,forEachSome as o,applySome as n,unwrap as l}from"../../../../../core/maybe.js";import{createResolver as h,isAbortError as u}from"../../../../../core/promiseUtils.js";import{diff as c}from"../../../../../core/accessorSupport/diffUtils.js";import d from"../../../../../layers/support/FieldsIndex.js";import{MAX_FILTERS as p,HIGHLIGHT_FLAG as g,ATTRIBUTE_DATA_VV as _,NAN_MAGIC_NUMBER as f,ATTRIBUTE_DATA_ANIMATION as y,ATTRIBUTE_DATA_GPGPU as m}from"../../../engine/webgl/definitions.js";import{DISPLAY_ID_TYPE_AGGREGATE as b,DISPLAY_ID_TYPE_FEATURE as x,getDisplayIdTexel as T,getDisplayIdType as S,getDisplayIdFilterMask as z}from"../../../engine/webgl/DisplayId.js";import{getPixelArrayCtor as A}from"../../../engine/webgl/Utils.js";import{createDebugLogger as E,DEBUG_ATTR_UPDATES as w}from"../../../engine/webgl/util/debug.js";import{getVisualVariableSizeValueRepresentationRatio as U}from"../tileRenderers/support/visualVariablesUtils.js";import{PixelType as D}from"../../../../webgl/enums.js";const k=e.getLogger("esri.views.layers.2d.features.support.AttributeStore"),C=E(w,k),F={sharedArrayBuffer:has("esri-shared-array-buffer"),atomics:has("esri-atomics")};function M(t,e){return i=>e(t(i))}class B{constructor(t,e,i,s){this.size=0,this.texelSize=4;const{pixelType:r,layout:a,textureOnly:o}=s;this.textureOnly=o||!1,this.pixelType=r,this._ctype=e,this.layout=a,this._resetRange(),this._shared=t,this.size=i,o||(this.data=this._initData(r,i,t,e))}get buffer(){return n(this.data,(t=>t.buffer))}unsetComponentAllTexels(t,e){const i=l(this.data);for(let s=0;s<this.size*this.size;s++)i[s*this.texelSize+t]&=~e;this.dirtyStart=0,this.dirtyEnd=this.size*this.size-1}setComponentAllTexels(t,e){const i=l(this.data);for(let s=0;s<this.size*this.size;s++)i[s*this.texelSize+t]|=255&e;this.dirtyStart=0,this.dirtyEnd=this.size*this.size-1}setComponent(t,e,i){const s=l(this.data);for(const r of i)s[r*this.texelSize+t]|=e,this.dirtyStart=Math.min(this.dirtyStart,r),this.dirtyEnd=Math.max(this.dirtyEnd,r)}setComponentTexel(t,e,i){l(this.data)[i*this.texelSize+t]|=e,this.dirtyStart=Math.min(this.dirtyStart,i),this.dirtyEnd=Math.max(this.dirtyEnd,i)}unsetComponentTexel(t,e,i){l(this.data)[i*this.texelSize+t]&=~e,this.dirtyStart=Math.min(this.dirtyStart,i),this.dirtyEnd=Math.max(this.dirtyEnd,i)}getData(t,e){const i=T(t);return l(this.data)[i*this.texelSize+e]}setData(t,e,i){const s=T(t),r=1<<e;0!=(this.layout&r)?(this.data[s*this.texelSize+e]=i,this.dirtyStart=Math.min(this.dirtyStart,s),this.dirtyEnd=Math.max(this.dirtyEnd,s)):k.error("mapview-attributes-store","Tried to set a value for a texel's readonly component")}lock(){this.pixelType===D.UNSIGNED_BYTE&&this._shared&&F.atomics&&"local"!==this._ctype&&Atomics.store(this.data,0,1)}unlock(){this.pixelType===D.UNSIGNED_BYTE&&this._shared&&F.atomics&&"local"!==this._ctype&&Atomics.store(this.data,0,0)}expand(t){if(this.size=t,!this.textureOnly){const e=this._initData(this.pixelType,t,this._shared,this._ctype),i=l(this.data);e.set(i),this.data=e}}toMessage(){const t=this.dirtyStart,e=this.dirtyEnd,i=this.texelSize;if(t>e)return null;this._resetRange();const s=!(this._shared||"local"===this._ctype),r=this.pixelType,a=this.layout,o=l(this.data);return{start:t,end:e,data:s&&o.slice(t*i,(e+1)*i)||null,pixelType:r,layout:a}}_initData(t,e,i,s){const r=i&&"local"!==s?SharedArrayBuffer:ArrayBuffer,a=A(t),o=new a(new r(e*e*4*a.BYTES_PER_ELEMENT));for(let n=0;n<o.length;n+=4)o[n+1]=255;return o}_resetRange(){this.dirtyStart=2147483647,this.dirtyEnd=0}}class v{constructor(t,e,i=(()=>{})){this._client=t,this.config=e,this._notifyChange=i,this._attributeComputeMap=new Map,this._blocks=new Array,this._filters=new Array(p),this._targetType=0,this._abortController=new AbortController,this._hasScaleExpr=!1,this._size=32,this._idsToHighlight=new Set;const s=e.supportsTextureFloat?D.FLOAT:D.UNSIGNED_BYTE;C(`Creating AttributeStore ${F.sharedArrayBuffer?"with":"without"} shared memory`),this._blockDescriptors=[{pixelType:D.UNSIGNED_BYTE,layout:1},{pixelType:D.UNSIGNED_BYTE,layout:15,textureOnly:!0},{pixelType:D.UNSIGNED_BYTE,layout:15,textureOnly:!0},{pixelType:s,layout:15},{pixelType:s,layout:15},{pixelType:s,layout:15},{pixelType:s,layout:15}],this._blocks=this._blockDescriptors.map((()=>null))}destroy(){this._abortController.abort()}get hasScaleExpr(){return this._hasScaleExpr}get _signal(){return this._abortController.signal}get hasHighlight(){return this._idsToHighlight.size>0}isUpdating(){return!!this._currUpdate||!!this._nextUpdate}update(t,e){this.config=e;const i=e.schema.processors[0].storage,a=c(this._schema,i);if((t.targets.feature||t.targets.aggregate)&&(t.storage.data=!0),a&&(has("esri-2d-update-debug")&&console.debug("Applying Update - AttributeStore:",a),t.storage.data=!0,this._schema=i,this._attributeComputeMap.clear(),!s(i))){switch(i.target){case"feature":this._targetType=x;break;case"aggregate":this._targetType=b}if("subtype"===i.type)for(const t in i.mapping){const e=i.mapping[t];if(r(e)&&r(e.vvMapping))for(const t of e.vvMapping)this._bindAttribute(t)}else{if(r(i.vvMapping))for(const t of i.vvMapping)this._bindAttribute(t);if(r(i.attributeMapping))for(const t of i.attributeMapping)this._bindAttribute(t)}}}onTileData(t,e){if(s(e.addOrUpdate))return;const i=e.addOrUpdate.getCursor();for(;i.next();){const t=i.getDisplayId();this.setAttributeData(t,i)}}invalidateResources(){this._createResourcesPromise=null,this._abortController.abort(),this._abortController=new AbortController}async setHighlight(t,e){const i=1,s=this._getBlock(0),r=e.map((t=>T(t)));s.lock(),s.unsetComponentAllTexels(0,i),s.setComponent(0,i,r),s.unlock(),this._idsToHighlight.clear();for(const a of t)this._idsToHighlight.add(a);await this.sendUpdates()}async updateFilters(t,e,i){const{service:s,spatialReference:r}=i,{filters:a}=e,o=a.map(((t,e)=>this._updateFilter(t,e,s,r)));(await Promise.all(o)).some((t=>t))&&(t.storage.filters=!0,has("esri-2d-update-debug")&&console.debug("Applying Update - AttributeStore:","Filters changed"))}setData(t,e,i,s){const r=T(t);this._ensureSizeForTexel(r),this._getBlock(e).setData(t,i,s)}getData(t,e,i){return this._getBlock(e).getData(t,i)}getHighlightFlag(t){return this._idsToHighlight.has(t)?g:0}unsetAttributeData(t){const e=T(t);this._getBlock(0).setData(e,0,0)}setAttributeData(t,e){const s=T(t);if(this._ensureSizeForTexel(s),this._getBlock(0).setData(s,0,this.getFilterFlags(e)),this._targetType!==S(t))return;const r=this._attributeComputeMap,a=this.config.supportsTextureFloat?1:2,o=4;r.size&&r.forEach(((t,r)=>{const n=r*a%o,l=Math.floor(r*a/o),h=this._getBlock(l+_),u=t(e);if(this.config.supportsTextureFloat)h.setData(s,n,u);else if(u===f)h.setData(s,n,255),h.setData(s,n+1,255);else{const t=i(Math.round(u),-32767,32766)+32768,e=255&t,r=(65280&t)>>8;h.setData(s,n,e),h.setData(s,n+1,r)}}))}sendUpdates(){if(has("esri-2d-update-debug")&&console.debug("AttributeStore::sendUpdate"),this._notifyChange(),this._nextUpdate)return this._nextUpdate.promise;if(this._currUpdate)return this._nextUpdate=h(),this._nextUpdate.promise;const e={blocks:this._blocks.map((t=>r(t)?t.toMessage():null))};return this._currUpdate=this._createResources().then((()=>{const t=()=>{if(this._currUpdate=null,this._nextUpdate){const t=this._nextUpdate;this._nextUpdate=null,this.sendUpdates().then((()=>t.resolve()))}else has("esri-2d-update-debug")&&console.debug("AttributeStore::sendUpdate::No additional updates queued");this._notifyChange()};has("esri-2d-update-debug")&&console.debug("AttributeStore::sendUpdate::client.update");const i=this._client.update(e,this._signal).then(t).catch(t);return this._client.render(this._signal),i})).catch((e=>{if(u(e))return this._createResourcesPromise=null,this._createResources();this._notifyChange(),k.error(new t("mapview-attribute-store","Encountered an error during client update",e))})),this._currUpdate}_ensureSizeForTexel(t){for(;t>=this._size*this._size;)if(this._expand())return}_bindAttribute(t){function e(){return t.normalizationField?e=>{const i=e.readAttribute(t.normalizationField);if(!i)return null;return e.readAttribute(t.field)/i}:e=>e.readAttribute(t.field)}function i(){return t.normalizationField&&k.warn("mapview-arcade","Ignoring normalizationField specified with an arcade expression which is not supported."),e=>e.getComputedNumericAtIndex(t.fieldIndex)}let s;if(null!=t.fieldIndex)s=i();else{if(!t.field)return;s=e()}if(t.valueRepresentation){s=M(s,(e=>U(e,t.valueRepresentation)))}const r=t=>null===t||isNaN(t)||t===1/0?f:t;this._attributeComputeMap.set(t.binding,M(s,r))}_createResources(){if(r(this._createResourcesPromise))return this._createResourcesPromise;this._getBlock(y),this._getBlock(m),C("Initializing AttributeStore");const e={shared:F.sharedArrayBuffer&&!("local"===this._client.type),size:this._size,blocks:a(this._blocks,(t=>({textureOnly:t.textureOnly,buffer:t.buffer,pixelType:t.pixelType})))},i=this._client.initialize(e,this._signal).catch((e=>{u(e)?this._createResourcesPromise=null:k.error(new t("mapview-attribute-store","Encountered an error during client initialization",e))}));return this._createResourcesPromise=i,i.then((()=>s(this._createResourcesPromise)?this._createResources():void 0)),i}_getBlock(t){const e=this._blocks[t];if(r(e))return e;C(`Initializing AttributeBlock at index ${t}`);const i=F.sharedArrayBuffer,s=this._client.type,a=new B(i,s,this._size,this._blockDescriptors[t]);return this._blocks[t]=a,this._createResourcesPromise=null,a}_expand(){if(this._size<this.config.maxTextureSize){const t=this._size<<=1;return C("Expanding block size to",t,this._blocks),o(this._blocks,(e=>e.expand(t))),this._createResourcesPromise=null,this._size=t,0}return k.error(new t("mapview-limitations","Maximum number of onscreen features exceeded.")),-1}async _updateFilter(t,e,i,a){const o=this._filters[e],n=r(o)&&o.hash;if(!o&&!t)return!1;if(n===JSON.stringify(t))return!1;if(s(t)){if(!o)return!1;const t=1<<e+1,i=this._getBlock(0);return this._filters[e]=null,i.setComponentAllTexels(0,t),this.sendUpdates(),!0}const l=await this._getFilter(e,i);return await l.update(t,a),!0}async _getFilter(t,e){const i=this._filters[t];if(r(i))return i;const{default:s}=await import("./FeatureFilter.js"),a=new s({geometryType:e.geometryType,hasM:!1,hasZ:!1,timeInfo:e.timeInfo,fieldsIndex:new d(e.fields)});return this._filters[t]=a,a}isVisible(t){return!!(2&this._getBlock(0).getData(t,0))}getFilterFlags(t){let e=0;const i=z(t.getDisplayId());for(let a=0;a<this._filters.length;a++){const r=!!(i&1<<a),o=this._filters[a];e|=(!r||s(o)||o.check(t)?1:0)<<a}let r=0;if(this._idsToHighlight.size){const e=t.getObjectId();r=this.getHighlightFlag(e)}return e<<1|r}}export{v as default};
5
+ import t from"../../../../../core/Error.js";import has from"../../../../../core/has.js";import e from"../../../../../core/Logger.js";import{clamp as i}from"../../../../../core/mathUtils.js";import{isNone as s,isSome as r,mapMany as a,forEachSome as o,applySome as n,unwrap as l}from"../../../../../core/maybe.js";import{createResolver as h,isAbortError as u}from"../../../../../core/promiseUtils.js";import{diff as c}from"../../../../../core/accessorSupport/diffUtils.js";import d from"../../../../../layers/support/FieldsIndex.js";import{MAX_FILTERS as p,HIGHLIGHT_FLAG as g,ATTRIBUTE_DATA_VV as _,NAN_MAGIC_NUMBER as f,ATTRIBUTE_DATA_ANIMATION as y,ATTRIBUTE_DATA_GPGPU as m}from"../../../engine/webgl/definitions.js";import{DISPLAY_ID_TYPE_AGGREGATE as b,DISPLAY_ID_TYPE_FEATURE as x,getDisplayIdTexel as T,getDisplayIdType as S,getDisplayIdFilterMask as z}from"../../../engine/webgl/DisplayId.js";import{getPixelArrayCtor as A}from"../../../engine/webgl/Utils.js";import{createDebugLogger as E,DEBUG_ATTR_UPDATES as w}from"../../../engine/webgl/util/debug.js";import{getVisualVariableSizeValueRepresentationRatio as U}from"../tileRenderers/support/visualVariablesUtils.js";import{PixelType as D}from"../../../../webgl/enums.js";const k=e.getLogger("esri.views.layers.2d.features.support.AttributeStore"),C=E(w,k),F={sharedArrayBuffer:has("esri-shared-array-buffer"),atomics:has("esri-atomics")};function M(t,e){return i=>e(t(i))}class B{constructor(t,e,i,s){this.size=0,this.texelSize=4;const{pixelType:r,layout:a,textureOnly:o}=s;this.textureOnly=o||!1,this.pixelType=r,this._ctype=e,this.layout=a,this._resetRange(),this._shared=t,this.size=i,o||(this.data=this._initData(r,i,t,e))}get buffer(){return n(this.data,(t=>t.buffer))}unsetComponentAllTexels(t,e){const i=l(this.data);for(let s=0;s<this.size*this.size;s++)i[s*this.texelSize+t]&=~e;this.dirtyStart=0,this.dirtyEnd=this.size*this.size-1}setComponentAllTexels(t,e){const i=l(this.data);for(let s=0;s<this.size*this.size;s++)i[s*this.texelSize+t]|=255&e;this.dirtyStart=0,this.dirtyEnd=this.size*this.size-1}setComponent(t,e,i){const s=l(this.data);for(const r of i)s[r*this.texelSize+t]|=e,this.dirtyStart=Math.min(this.dirtyStart,r),this.dirtyEnd=Math.max(this.dirtyEnd,r)}setComponentTexel(t,e,i){l(this.data)[i*this.texelSize+t]|=e,this.dirtyStart=Math.min(this.dirtyStart,i),this.dirtyEnd=Math.max(this.dirtyEnd,i)}unsetComponentTexel(t,e,i){l(this.data)[i*this.texelSize+t]&=~e,this.dirtyStart=Math.min(this.dirtyStart,i),this.dirtyEnd=Math.max(this.dirtyEnd,i)}getData(t,e){const i=T(t);return l(this.data)[i*this.texelSize+e]}setData(t,e,i){const s=T(t),r=1<<e;0!=(this.layout&r)?(this.data[s*this.texelSize+e]=i,this.dirtyStart=Math.min(this.dirtyStart,s),this.dirtyEnd=Math.max(this.dirtyEnd,s)):k.error("mapview-attributes-store","Tried to set a value for a texel's readonly component")}lock(){this.pixelType===D.UNSIGNED_BYTE&&this._shared&&F.atomics&&"local"!==this._ctype&&Atomics.store(this.data,0,1)}unlock(){this.pixelType===D.UNSIGNED_BYTE&&this._shared&&F.atomics&&"local"!==this._ctype&&Atomics.store(this.data,0,0)}expand(t){if(this.size=t,!this.textureOnly){const e=this._initData(this.pixelType,t,this._shared,this._ctype),i=l(this.data);e.set(i),this.data=e}}toMessage(){const t=this.dirtyStart,e=this.dirtyEnd,i=this.texelSize;if(t>e)return null;this._resetRange();const s=!(this._shared||"local"===this._ctype),r=this.pixelType,a=this.layout,o=l(this.data);return{start:t,end:e,data:s&&o.slice(t*i,(e+1)*i)||null,pixelType:r,layout:a}}_initData(t,e,i,s){const r=i&&"local"!==s?SharedArrayBuffer:ArrayBuffer,a=A(t),o=new a(new r(e*e*4*a.BYTES_PER_ELEMENT));for(let n=0;n<o.length;n+=4)o[n+1]=255;return o}_resetRange(){this.dirtyStart=2147483647,this.dirtyEnd=0}}class v{constructor(t,e,i=(()=>{})){this._client=t,this.config=e,this._notifyChange=i,this._attributeComputeMap=new Map,this._blocks=new Array,this._filters=new Array(p),this._targetType=0,this._abortController=new AbortController,this._hasScaleExpr=!1,this._size=32,this._idsToHighlight=new Set;const s=e.supportsTextureFloat?D.FLOAT:D.UNSIGNED_BYTE;C(`Creating AttributeStore ${F.sharedArrayBuffer?"with":"without"} shared memory`),this._blockDescriptors=[{pixelType:D.UNSIGNED_BYTE,layout:1},{pixelType:D.UNSIGNED_BYTE,layout:15,textureOnly:!0},{pixelType:D.UNSIGNED_BYTE,layout:15,textureOnly:!0},{pixelType:s,layout:15},{pixelType:s,layout:15},{pixelType:s,layout:15},{pixelType:s,layout:15}],this._blocks=this._blockDescriptors.map((()=>null))}destroy(){this._abortController.abort()}get hasScaleExpr(){return this._hasScaleExpr}get _signal(){return this._abortController.signal}get hasHighlight(){return this._idsToHighlight.size>0}isUpdating(){return!!this._currUpdate||!!this._nextUpdate}update(t,e){this.config=e;const i=e.schema.processors[0].storage,a=c(this._schema,i);if((t.targets.feature||t.targets.aggregate)&&(t.storage.data=!0),a&&(has("esri-2d-update-debug")&&console.debug("Applying Update - AttributeStore:",a),t.storage.data=!0,this._schema=i,this._attributeComputeMap.clear(),!s(i))){switch(i.target){case"feature":this._targetType=x;break;case"aggregate":this._targetType=b}if("subtype"===i.type)for(const t in i.mapping){const e=i.mapping[t];if(r(e)&&r(e.vvMapping))for(const t of e.vvMapping)this._bindAttribute(t)}else{if(r(i.vvMapping))for(const t of i.vvMapping)this._bindAttribute(t);if(r(i.attributeMapping))for(const t of i.attributeMapping)this._bindAttribute(t)}}}onTileData(t,e){if(s(e.addOrUpdate))return;const i=e.addOrUpdate.getCursor();for(;i.next();){const t=i.getDisplayId();this.setAttributeData(t,i)}}invalidateResources(){this._createResourcesPromise=null,this._abortController.abort(),this._abortController=new AbortController}async setHighlight(t,e){const i=1,s=this._getBlock(0),r=e.map((t=>T(t)));s.lock(),s.unsetComponentAllTexels(0,i),s.setComponent(0,i,r),s.unlock(),this._idsToHighlight.clear();for(const a of t)this._idsToHighlight.add(a);await this.sendUpdates()}async updateFilters(t,e,i){const{service:s,spatialReference:r}=i,{filters:a}=e,o=a.map(((t,e)=>this._updateFilter(t,e,s,r)));(await Promise.all(o)).some((t=>t))&&(t.storage.filters=!0,has("esri-2d-update-debug")&&console.debug("Applying Update - AttributeStore:","Filters changed"))}setData(t,e,i,s){const r=T(t);this._ensureSizeForTexel(r),this._getBlock(e).setData(t,i,s)}getData(t,e,i){return this._getBlock(e).getData(t,i)}getHighlightFlag(t){return this._idsToHighlight.has(t)?g:0}unsetAttributeData(t){const e=T(t);this._getBlock(0).setData(e,0,0)}setAttributeData(t,e){const s=T(t);if(this._ensureSizeForTexel(s),this._getBlock(0).setData(s,0,this.getFilterFlags(e)),this._targetType!==S(t))return;const r=this._attributeComputeMap,a=this.config.supportsTextureFloat?1:2,o=4;r.size&&r.forEach(((t,r)=>{const n=r*a%o,l=Math.floor(r*a/o),h=this._getBlock(l+_),u=t(e);if(this.config.supportsTextureFloat)h.setData(s,n,u);else if(u===f)h.setData(s,n,255),h.setData(s,n+1,255);else{const t=i(Math.round(u),-32767,32766)+32768,e=255&t,r=(65280&t)>>8;h.setData(s,n,e),h.setData(s,n+1,r)}}))}sendUpdates(){if(has("esri-2d-update-debug")&&console.debug("AttributeStore::sendUpdate"),this._notifyChange(),this._nextUpdate)return this._nextUpdate.promise;if(this._currUpdate)return this._nextUpdate=h(),this._nextUpdate.promise;const e={blocks:this._blocks.map((t=>r(t)?t.toMessage():null))};return this._currUpdate=this._createResources().then((()=>{const t=()=>{if(this._currUpdate=null,this._nextUpdate){const t=this._nextUpdate;this._nextUpdate=null,this.sendUpdates().then((()=>t.resolve()))}else has("esri-2d-update-debug")&&console.debug("AttributeStore::sendUpdate::No additional updates queued");this._notifyChange()};has("esri-2d-update-debug")&&console.debug("AttributeStore::sendUpdate::client.update");const i=this._client.update(e,this._signal).then(t).catch(t);return this._client.render(this._signal),i})).catch((e=>{if(u(e))return this._createResourcesPromise=null,this._createResources();this._notifyChange(),k.error(new t("mapview-attribute-store","Encountered an error during client update",e))})),this._currUpdate}_ensureSizeForTexel(t){for(;t>=this._size*this._size;)if(this._expand())return}_bindAttribute(t){function e(){return t.normalizationField?e=>{const i=e.readAttribute(t.normalizationField);if(!i)return null;return e.readAttribute(t.field)/i}:e=>e.readAttribute(t.field)}function i(){return t.normalizationField&&k.warn("mapview-arcade","Ignoring normalizationField specified with an arcade expression which is not supported."),e=>e.getComputedNumericAtIndex(t.fieldIndex)}let s;if(null!=t.fieldIndex)s=i();else{if(!t.field)return;s=e()}if(t.valueRepresentation){s=M(s,(e=>U(e,t.valueRepresentation)))}const r=t=>null===t||isNaN(t)||t===1/0||t===-1/0?f:t;this._attributeComputeMap.set(t.binding,M(s,r))}_createResources(){if(r(this._createResourcesPromise))return this._createResourcesPromise;this._getBlock(y),this._getBlock(m),C("Initializing AttributeStore");const e={shared:F.sharedArrayBuffer&&!("local"===this._client.type),size:this._size,blocks:a(this._blocks,(t=>({textureOnly:t.textureOnly,buffer:t.buffer,pixelType:t.pixelType})))},i=this._client.initialize(e,this._signal).catch((e=>{u(e)?this._createResourcesPromise=null:k.error(new t("mapview-attribute-store","Encountered an error during client initialization",e))}));return this._createResourcesPromise=i,i.then((()=>s(this._createResourcesPromise)?this._createResources():void 0)),i}_getBlock(t){const e=this._blocks[t];if(r(e))return e;C(`Initializing AttributeBlock at index ${t}`);const i=F.sharedArrayBuffer,s=this._client.type,a=new B(i,s,this._size,this._blockDescriptors[t]);return this._blocks[t]=a,this._createResourcesPromise=null,a}_expand(){if(this._size<this.config.maxTextureSize){const t=this._size<<=1;return C("Expanding block size to",t,this._blocks),o(this._blocks,(e=>e.expand(t))),this._createResourcesPromise=null,this._size=t,0}return k.error(new t("mapview-limitations","Maximum number of onscreen features exceeded.")),-1}async _updateFilter(t,e,i,a){const o=this._filters[e],n=r(o)&&o.hash;if(!o&&!t)return!1;if(n===JSON.stringify(t))return!1;if(s(t)){if(!o)return!1;const t=1<<e+1,i=this._getBlock(0);return this._filters[e]=null,i.setComponentAllTexels(0,t),this.sendUpdates(),!0}const l=await this._getFilter(e,i);return await l.update(t,a),!0}async _getFilter(t,e){const i=this._filters[t];if(r(i))return i;const{default:s}=await import("./FeatureFilter.js"),a=new s({geometryType:e.geometryType,hasM:!1,hasZ:!1,timeInfo:e.timeInfo,fieldsIndex:new d(e.fields)});return this._filters[t]=a,a}isVisible(t){return!!(2&this._getBlock(0).getData(t,0))}getFilterFlags(t){let e=0;const i=z(t.getDisplayId());for(let a=0;a<this._filters.length;a++){const r=!!(i&1<<a),o=this._filters[a];e|=(!r||s(o)||o.check(t)?1:0)<<a}let r=0;if(this._idsToHighlight.size){const e=t.getObjectId();r=this.getHighlightFlag(e)}return e<<1|r}}export{v as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.25/esri/copyright.txt for details.
4
4
  */
5
- import e from"../../../core/Handles.js";import{lerp as t,smoothstep as s}from"../../../core/mathUtils.js";import{releaseMaybe as i,disposeMaybe as r,destroyMaybe as a,isSome as o,isNone as n,unwrapOr as h}from"../../../core/maybe.js";import{on as d}from"../../../core/reactiveUtils.js";import{s as u}from"../../../chunks/vec2.js";import{l as p}from"../../../chunks/vec3.js";import{s as m}from"../../../chunks/vec4.js";import{earth as l}from"../../../geometry/support/Ellipsoid.js";import{atmosphereHeight as _,innerAtmosphereDepth as c,computeInnerAltitudeFade as v}from"./atmosphereUtils.js";import{ChapmanAtmospherePassParameters as T,ChapmanAtmosphereTechnique as f}from"./ChapmanAtmosphereTechnique.js";import{ChapmanAtmosphereTechniqueConfiguration as R}from"./ChapmanAtmosphereTechniqueConfiguration.js";import{Pos2Tex as w}from"../webgl-engine/lib/DefaultVertexBufferLayouts.js";import{createQuadVAO as b}from"../webgl-engine/lib/glUtil3D.js";import{PrimitiveType as x}from"../../webgl/enums.js";class E{constructor(e){this._view=e,this.type="realistic",this._passParameters=new T,this._lowerElevationBoundRadius=0,this._lowerBoundEarthRadius=l.radius,this._darkenHaze=!1,this._updateRadius(l.radius)}destroy(){this._atmosphereTechnique=i(this._atmosphereTechnique),this._atmosphereHazeTechnique=i(this._atmosphereHazeTechnique),this._vao=r(this._vao),this._handles=a(this._handles)}when(){return Promise.resolve()}initializeRenderContext(t){const s=t.renderContext.rctx,i=this._handles=new e,r=this._view.basemapTerrain;o(r.rootTiles)&&this._updateElevation({spatialReference:r.spatialReference,tile:r.rootTiles[0],extent:r.rootTiles[0].extent,context:"ground"}),i.add(d((()=>this._view.basemapTerrain),"elevation-change",(e=>this._updateElevation(e)),{onListenerAdd:()=>this._updateElevation()})),i.add(d((()=>this._view.basemapTerrain),"elevation-bounds-change",(()=>this._updateVisibleElevationBounds())));const a=new R;a.haze=!1,this._atmosphereTechnique=t.shaderTechniqueRepository.acquire(f,a),a.haze=!0,this._atmosphereHazeTechnique=t.shaderTechniqueRepository.acquire(f,a),this._vao=b(s,w)}render(e){this._render(e,this._atmosphereTechnique,e.offscreenRenderingHelper.depthTexture)}renderHaze(e,t){this._darkenHaze=t,this._render(e,this._atmosphereHazeTechnique,e.offscreenRenderingHelper.linearDepthTexture)}_render(e,t,s){if(n(s))return;this._update(e.bindParameters.camera),this._passParameters.depthTex=s;const i=e.rctx.bindTechnique(t,this._passParameters,e.bindParameters);e.offscreenRenderingHelper.renderDepthDetached((()=>{this._renderCommon(i,e)}))}_renderCommon(e,t){n(this._vao)||(t.rctx.bindVAO(this._vao),e.assertCompatibleVertexAttributeLocations(this._vao),t.rctx.drawArrays(x.TRIANGLE_STRIP,0,4))}_adjustRadiusForTesselation(e){return e*Math.cos(Math.PI/16/16)}_updateElevation(e){const t=e?e.tile:h(this._view.basemapTerrain.rootTiles,[null])[0];if(n(t)||0!==t.level)return;const s=this._adjustRadiusForTesselation(l.radius+t.elevationBounds[0]);s!==this._lowerElevationBoundRadius&&(this._lowerElevationBoundRadius=s,this._lowerBoundEarthRadius=-1,this._updateVisibleElevationBounds())}_updateVisibleElevationBounds(){const e=this._adjustRadiusForTesselation(l.radius+this._view.basemapTerrain.elevationBounds.min);(this._lowerBoundEarthRadius<0||e<this._lowerBoundEarthRadius)&&this._updateRadius(e)}_updateRadius(e){this._lowerBoundEarthRadius=e,u(this._passParameters.radii,e,e+_),this._passParameters.innerFadeDistance=2*Math.sqrt((2*e-c)*c)}_update(e){if(n(e))return;const i=p(e.eye),r=i*i,a=r-this._passParameters.radii[1]*this._passParameters.radii[1],o=Math.min(1,Math.max(0,(i-this._passParameters.radii[0])/_));m(this._passParameters.heightParameters,i,r,a,o),this._passParameters.altitudeFade=v(i-this._lowerBoundEarthRadius),this._passParameters.hazeStrength=this._darkenHaze?t(.6,1,s(9500,10500,i-l.radius)):1}static isSupported(e){return e.renderContext.rctx.capabilities.depthTexture}}export{E as ChapmanAtmosphere};
5
+ import e from"../../../core/Handles.js";import{lerp as t,smoothstep as s}from"../../../core/mathUtils.js";import{releaseMaybe as i,disposeMaybe as a,destroyMaybe as r,isSome as o,isNone as n,unwrapOr as h}from"../../../core/maybe.js";import{on as d}from"../../../core/reactiveUtils.js";import{s as u}from"../../../chunks/vec2.js";import{l as p}from"../../../chunks/vec3.js";import{s as m}from"../../../chunks/vec4.js";import{earth as l}from"../../../geometry/support/Ellipsoid.js";import{atmosphereHeight as _,innerAtmosphereDepth as c,computeInnerAltitudeFade as v}from"./atmosphereUtils.js";import{ChapmanAtmospherePassParameters as T,ChapmanAtmosphereTechnique as f}from"./ChapmanAtmosphereTechnique.js";import{ChapmanAtmosphereTechniqueConfiguration as R}from"./ChapmanAtmosphereTechniqueConfiguration.js";import{Pos2Tex as b}from"../webgl-engine/lib/DefaultVertexBufferLayouts.js";import{createQuadVAO as w}from"../webgl-engine/lib/glUtil3D.js";import{PrimitiveType as x}from"../../webgl/enums.js";class E{constructor(e){this._view=e,this.type="realistic",this._passParameters=new T,this._lowerElevationBoundRadius=0,this._lowerBoundEarthRadius=l.radius,this._darkenHaze=!1,this._updateRadius(l.radius)}destroy(){this._atmosphereTechnique=i(this._atmosphereTechnique),this._atmosphereHazeTechnique=i(this._atmosphereHazeTechnique),this._vao=a(this._vao),this._handles=r(this._handles)}initializeRenderContext(t){const s=t.renderContext.rctx,i=this._handles=new e,a=this._view.basemapTerrain;o(a.rootTiles)&&this._updateElevation({spatialReference:a.spatialReference,tile:a.rootTiles[0],extent:a.rootTiles[0].extent,context:"ground"}),i.add(d((()=>this._view.basemapTerrain),"elevation-change",(e=>this._updateElevation(e)),{onListenerAdd:()=>this._updateElevation()})),i.add(d((()=>this._view.basemapTerrain),"elevation-bounds-change",(()=>this._updateVisibleElevationBounds())));const r=new R;r.haze=!1,this._atmosphereTechnique=t.shaderTechniqueRepository.acquire(f,r),r.haze=!0,this._atmosphereHazeTechnique=t.shaderTechniqueRepository.acquire(f,r),this._vao=w(s,b)}render(e){this._render(e,this._atmosphereTechnique,e.offscreenRenderingHelper.depthTexture)}renderHaze(e,t){this._darkenHaze=t,this._render(e,this._atmosphereHazeTechnique,e.offscreenRenderingHelper.linearDepthTexture)}_render(e,t,s){if(n(s))return;this._update(e.bindParameters.camera),this._passParameters.depthTex=s;const i=e.rctx.bindTechnique(t,this._passParameters,e.bindParameters);e.offscreenRenderingHelper.renderDepthDetached((()=>{this._renderCommon(i,e)}))}_renderCommon(e,t){n(this._vao)||(t.rctx.bindVAO(this._vao),e.assertCompatibleVertexAttributeLocations(this._vao),t.rctx.drawArrays(x.TRIANGLE_STRIP,0,4))}_adjustRadiusForTesselation(e){return e*Math.cos(Math.PI/16/16)}_updateElevation(e){const t=e?e.tile:h(this._view.basemapTerrain.rootTiles,[null])[0];if(n(t)||0!==t.level)return;const s=this._adjustRadiusForTesselation(l.radius+t.elevationBounds[0]);s!==this._lowerElevationBoundRadius&&(this._lowerElevationBoundRadius=s,this._lowerBoundEarthRadius=-1,this._updateVisibleElevationBounds())}_updateVisibleElevationBounds(){const e=this._adjustRadiusForTesselation(l.radius+this._view.basemapTerrain.elevationBounds.min);(this._lowerBoundEarthRadius<0||e<this._lowerBoundEarthRadius)&&this._updateRadius(e)}_updateRadius(e){this._lowerBoundEarthRadius=e,u(this._passParameters.radii,e,e+_),this._passParameters.innerFadeDistance=2*Math.sqrt((2*e-c)*c)}_update(e){if(n(e))return;const i=p(e.eye),a=i*i,r=a-this._passParameters.radii[1]*this._passParameters.radii[1],o=Math.min(1,Math.max(0,(i-this._passParameters.radii[0])/_));m(this._passParameters.heightParameters,i,a,r,o),this._passParameters.altitudeFade=v(i-this._lowerBoundEarthRadius),this._passParameters.hazeStrength=this._darkenHaze?t(.6,1,s(9500,10500,i-l.radius)):1}static isSupported(e){return e.renderContext.rctx.capabilities.depthTexture}}export{E as ChapmanAtmosphere};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.25/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../core/Accessor.js";import"../../../core/has.js";import s from"../../../core/Handles.js";import{lerp as i}from"../../../core/mathUtils.js";import{destroyMaybe as r,isSome as o,isNone as n}from"../../../core/maybe.js";import{when as h,syncAndInitial as a,watch as p,initial as d}from"../../../core/reactiveUtils.js";import{property as l}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/arrayUtils.js";import"../../../core/accessorSupport/ensureType.js";import{subclass as _}from"../../../core/accessorSupport/decorators/subclass.js";import{l as m}from"../../../chunks/vec3.js";import{getReferenceEllipsoid as c}from"../../../geometry/projectionEllipsoid.js";import{isMoon as u,isEarth as g}from"../../../geometry/support/spatialReferenceUtils.js";import{ChapmanAtmosphere as w}from"./ChapmanAtmosphere.js";import{CloudsComposition as y}from"./CloudsComposition.js";import{isReadyCloudsData as v}from"./CloudsData.js";import{CloudsGenerator as f}from"./CloudsGenerator.js";import{cloudPresets as A}from"./CloudsPresets.js";import{Fog as R}from"./Fog.js";import{PanoramicAtmosphere as b}from"./PanoramicAtmosphere.js";import{Precipitation as E}from"./Precipitation.js";import N from"./SimpleAtmosphere.js";import{Stars as j}from"./Stars.js";import{weatherHeightLimit as x}from"./weather.js";import{ShaderOutput as C}from"../webgl-engine/core/shaderLibrary/ShaderOutput.js";import{RenderSlot as T}from"../webgl-engine/lib/RenderSlot.js";var O;const P=[T.POSTPROCESSING_ENVIRONMENT_OPAQUE,T.POSTPROCESSING_ENVIRONMENT_TRANSPARENT];let S,M=O=class extends t{constructor(e){super(e),this._handles=new s,this._context=null,this._pendingAtmosphere=null,this._atmosphere=null}initialize(){this.view._stage.addRenderPlugin(P,this)}destroy(){this._pendingAtmosphere=r(this._pendingAtmosphere),null!=this.view?._stage&&this.view._stage.removeRenderPlugin(this),this._handles=r(this._handles),this._set("view",null)}get atmosphereType(){return o(this._pendingAtmosphere)?this._pendingAtmosphere.type:o(this._atmosphere)?this._atmosphere.type:"none"}get canRender(){return!!this.view.basemapTerrain?.renderer.canRender||"global"!==this.view.viewingMode}get needsLinearDepth(){return o(this._atmosphere)&&"realistic"===this._atmosphere.type}updateAnimation(e){return!!o(this._precipitation)&&this._precipitation.update(e)}get updating(){return o(this._pendingAtmosphere)||o(this._stars)&&this._stars.updating||o(this._clouds)&&this._clouds.running}get weatherVisible(){return m(this.view.state.camera.eye)-c(this.view.spatialReference).radius<=x}get _stars(){const e=this.view,t=e.environment?.starsEnabled??!1,s=this._get("_stars");return!t||n(this._context)?(r(s),null):o(s)?s:new j({view:e,requestRender:()=>this._setNeedsRender()})}get _precipitation(){const e=this._get("_precipitation");if(!this._precipitationEnabled||n(this._context))return r(e),null;const t=this.view,s=this._context;return o(e)&&e.context===s?e:(r(e),new E({context:s,view:t}))}get _clouds(){const e=this._get("_clouds");if(!this.weatherEnabled||n(this._context))return r(e),null;if(o(e))return e;const t=this.view,s=this._context;return r(e),new f({context:s,view:t,requestRender:()=>this._setNeedsRender()})}get _cloudsComposition(){const e=this._get("_cloudsComposition");if(!this.weatherEnabled||n(this._context))return r(e),null;const t=this.view.state.viewingMode,s=this._context.renderContext.rctx,i=c(this.view.spatialReference).radius;return o(e)&&e.viewingMode===t&&e.planetRadius===i?e:(r(e),new y({rctx:s,viewingMode:t,planetRadius:i,requestRender:()=>this._setNeedsRender()}))}get _fog(){const e=this._get("_fog");if(!this.weatherEnabled||n(this._context))return r(e),null;if(o(e))return e;const t=this.view,s=this._context;return r(e),new R({context:s,view:t})}get weatherEnabled(){return!!this.view?.environmentManager?.weatherEnabled}get _precipitationEnabled(){return this.weatherEnabled&&("rainy"===this.view.environment.weather.type||"snowy"===this.view.environment.weather.type)}initializeRenderContext(e=null){this._context=e,this._handles.add([h((()=>this.view?.basemapTerrain),(()=>this._updateBasemapTerrain()),a),p((()=>({viewingMode:this.view.viewingMode,atmosphereEnabled:this.view.environment.atmosphereEnabled,atmosphereQuality:this.view.environment.atmosphere.quality})),(()=>this._updateAtmosphere()),a),p((()=>this._stars),(()=>this._setNeedsRender())),p((()=>this._clouds),(()=>this._updateWeather(this._weatherUpdateParameters)),d),p((()=>this._precipitation),(()=>this._setNeedsRender())),p((()=>this._fog),(()=>this._updateFog(this._weatherUpdateParameters)),d),p((()=>this._weatherUpdateParameters),(e=>{this._updateWeather(e),this._updateFog(e)}),a)])}uninitializeRenderContext(){this._context=null,this._atmosphere=r(this._atmosphere),this._set("_stars",r(this._stars)),this._set("_precipitation",r(this._precipitation)),this._set("_clouds",r(this._clouds)),this._set("_cloudsComposition",r(this._cloudsComposition)),this._set("_fog",r(this._fog))}prepareRender(e){e.bindParameters.clouds.data=v(this._clouds)?this._clouds:null}render(e){if(e.output===C.Color)switch(e.bindParameters.slot){case T.POSTPROCESSING_ENVIRONMENT_OPAQUE:o(this._stars)&&this._stars.render(e),o(this._atmosphere)&&(this._atmosphere.render(e),o(this._cloudsComposition)&&o(e.bindParameters.clouds.data)&&(this.weatherVisible&&o(this._clouds)&&this._clouds.ensureWeatherTile(),this._cloudsComposition.render(e,o(this.view.animation))));break;case T.POSTPROCESSING_ENVIRONMENT_TRANSPARENT:if(o(this._atmosphere)){const t=this.weatherEnabled?this.view.environment.weather.type:"disabled";if(this._atmosphere.renderHaze(e,"rainy"===t),o(this._fog)){const s="foggy"===t||"rainy"===t||"snowy"===t;(s||"realistic"!==this._selectAtmosphereType())&&this._fog.render(e,s,"rainy"===t)}if(o(this._precipitation)){const t=this.view.environment.weather;"rainy"!==t.type&&"snowy"!==t.type||this._precipitation.render(e,t.precipitation,t.type)}}}}get _weatherUpdateParameters(){const e=this.weatherEnabled?this.view.environment.weather:null;return n(e)?null:"rainy"===e.type||"snowy"===e.type?{type:e.type,weatherAdjustment:e.cloudCover,effect:e.precipitation}:{type:e.type,weatherAdjustment:"foggy"===e.type?e.fogStrength:e.cloudCover}}_updateWeather(e){n(e)||n(this._clouds)||(this._clouds.applyPreset(A[e.type],e.weatherAdjustment),this._setNeedsRender())}_setNeedsRender(){o(this._context)&&this._context.requestRender()}_updateFog(e){if(!n(this._fog)&&!n(e))switch(e.type){case"foggy":this._fog.strength=i(3e-5,.005,e.weatherAdjustment**3),this._setNeedsRender();break;case"rainy":case"snowy":this._fog.strength=i(4e-6,2e-4,e.effect**3),this._setNeedsRender();break;default:this._fog.strength=4e-6,this._setNeedsRender()}}_updateAtmosphere(){const e=this._selectAtmosphereType();if(this.atmosphereType===e)return;o(this._pendingAtmosphere)&&(this._pendingAtmosphere!==this._atmosphere&&this._pendingAtmosphere.destroy(),this._pendingAtmosphere=null);const t=this._getAtmosphereClass();if(!t)return o(this._atmosphere)&&(this._atmosphere.destroy(),this._atmosphere=null,this._setNeedsRender()),void this._updateBasemapTerrain();const s=new t(this.view);o(this._context)&&s.initializeRenderContext(this._context),n(this._atmosphere)&&(this._atmosphere=s,this._setNeedsRender()),this._pendingAtmosphere=s,s.when().then((()=>{o(this._atmosphere)&&this._pendingAtmosphere&&this._pendingAtmosphere!==this._atmosphere&&(this._atmosphere.destroy(),this._atmosphere=this._pendingAtmosphere),this._pendingAtmosphere=null,this._setNeedsRender(),this._updateBasemapTerrain()})).catch((()=>{this._pendingAtmosphere===s&&(this._pendingAtmosphere=null)}))}_getAtmosphereClass(){switch(this._selectAtmosphereType()){case"none":return null;case"realistic":return w;case"panoramic":return b;case"simple":return N;default:return}}_selectAtmosphereType(){const e=this.view.get("environment.atmosphereEnabled"),t=this.view.get("environment.atmosphere.quality"),s=this.view.viewingMode;return!e||null==t||u(this.view.spatialReference)?"none":"local"===s?"panoramic":"high"===t&&o(this._context)&&w.isSupported(this._context)&&g(this.view.spatialReference)?"realistic":"simple"}_updateBasemapTerrain(){this.view.basemapTerrain&&(this.view.basemapTerrain.velvetOverground=o(this._atmosphere)&&"simple"===this.atmosphereType)}get test(){return{atmosphere:this._atmosphere,clouds:this._clouds,selectAtmosphereType:()=>this._selectAtmosphereType(),stubGetAtmosphereClass:e=>{S=O.prototype._getAtmosphereClass,O.prototype._getAtmosphereClass=e},restoreGetAtmosphereClass:()=>{O.prototype._getAtmosphereClass=S}}}};e([l({constructOnly:!0})],M.prototype,"view",void 0),e([l({type:Boolean,readOnly:!0})],M.prototype,"updating",null),e([l({readOnly:!0})],M.prototype,"weatherVisible",null),e([l()],M.prototype,"_context",void 0),e([l()],M.prototype,"_pendingAtmosphere",void 0),e([l({readOnly:!0})],M.prototype,"_stars",null),e([l({readOnly:!0})],M.prototype,"_precipitation",null),e([l({readOnly:!0})],M.prototype,"_clouds",null),e([l({readOnly:!0})],M.prototype,"_cloudsComposition",null),e([l({readOnly:!0})],M.prototype,"_fog",null),e([l({readOnly:!0})],M.prototype,"weatherEnabled",null),e([l({readOnly:!0})],M.prototype,"_precipitationEnabled",null),e([l({readOnly:!0})],M.prototype,"_weatherUpdateParameters",null),M=O=e([_("esri.views.3d.environment.EnvironmentRenderer")],M);export{M as EnvironmentRenderer};
5
+ import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../core/Accessor.js";import"../../../core/has.js";import s from"../../../core/Handles.js";import{lerp as r}from"../../../core/mathUtils.js";import{destroyMaybe as i,isSome as o,isNone as n}from"../../../core/maybe.js";import{when as a,syncAndInitial as h,watch as p,initial as l}from"../../../core/reactiveUtils.js";import{property as d}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/arrayUtils.js";import"../../../core/accessorSupport/ensureType.js";import{subclass as _}from"../../../core/accessorSupport/decorators/subclass.js";import{l as m}from"../../../chunks/vec3.js";import{getReferenceEllipsoid as c}from"../../../geometry/projectionEllipsoid.js";import{isMoon as u,isEarth as w}from"../../../geometry/support/spatialReferenceUtils.js";import{ChapmanAtmosphere as y}from"./ChapmanAtmosphere.js";import{CloudsComposition as g}from"./CloudsComposition.js";import{isReadyCloudsData as v}from"./CloudsData.js";import{CloudsGenerator as f}from"./CloudsGenerator.js";import{cloudPresets as R}from"./CloudsPresets.js";import{Fog as b}from"./Fog.js";import{PanoramicAtmosphere as E}from"./PanoramicAtmosphere.js";import{Precipitation as j}from"./Precipitation.js";import N from"./SimpleAtmosphere.js";import{Stars as x}from"./Stars.js";import{weatherHeightLimit as C}from"./weather.js";import{ShaderOutput as T}from"../webgl-engine/core/shaderLibrary/ShaderOutput.js";import{RenderSlot as A}from"../webgl-engine/lib/RenderSlot.js";var O;const P=[A.POSTPROCESSING_ENVIRONMENT_OPAQUE,A.POSTPROCESSING_ENVIRONMENT_TRANSPARENT];let S,M=O=class extends t{constructor(e){super(e),this._handles=new s,this._context=null,this._atmosphere=null}initialize(){this.view._stage.addRenderPlugin(P,this)}destroy(){null!=this.view?._stage&&this.view._stage.removeRenderPlugin(this),this._handles=i(this._handles),this._set("view",null)}get atmosphereType(){return o(this._atmosphere)?this._atmosphere.type:"none"}get canRender(){return!!this.view.basemapTerrain?.renderer.canRender||"global"!==this.view.viewingMode}get needsLinearDepth(){return o(this._atmosphere)&&"realistic"===this._atmosphere.type}updateAnimation(e){return!!o(this._precipitation)&&this._precipitation.update(e)}get updating(){return o(this._stars)&&this._stars.updating||o(this._clouds)&&this._clouds.running}get weatherVisible(){return m(this.view.state.camera.eye)-c(this.view.spatialReference).radius<=C}get _stars(){const e=this.view,t=e.environment?.starsEnabled??!1,s=this._get("_stars");return!t||n(this._context)?(i(s),null):o(s)?s:new x({view:e,requestRender:()=>this._setNeedsRender()})}get _precipitation(){const e=this._get("_precipitation");if(!this._precipitationEnabled||n(this._context))return i(e),null;const t=this.view,s=this._context;return o(e)&&e.context===s?e:(i(e),new j({context:s,view:t}))}get _clouds(){const e=this._get("_clouds");if(!this.weatherEnabled||n(this._context))return i(e),null;if(o(e))return e;const t=this.view,s=this._context;return i(e),new f({context:s,view:t,requestRender:()=>this._setNeedsRender()})}get _cloudsComposition(){const e=this._get("_cloudsComposition");if(!this.weatherEnabled||n(this._context))return i(e),null;const t=this.view.state.viewingMode,s=this._context.renderContext.rctx,r=c(this.view.spatialReference).radius;return o(e)&&e.viewingMode===t&&e.planetRadius===r?e:(i(e),new g({rctx:s,viewingMode:t,planetRadius:r,requestRender:()=>this._setNeedsRender()}))}get _fog(){const e=this._get("_fog");if(!this.weatherEnabled||n(this._context))return i(e),null;if(o(e))return e;const t=this.view,s=this._context;return i(e),new b({context:s,view:t})}get weatherEnabled(){return!!this.view?.environmentManager?.weatherEnabled}get _precipitationEnabled(){return this.weatherEnabled&&("rainy"===this.view.environment.weather.type||"snowy"===this.view.environment.weather.type)}initializeRenderContext(e=null){this._context=e,this._handles.add([a((()=>this.view?.basemapTerrain),(()=>this._updateBasemapTerrain()),h),p((()=>({viewingMode:this.view.viewingMode,atmosphereEnabled:this.view.environment.atmosphereEnabled,atmosphereQuality:this.view.environment.atmosphere.quality})),(()=>this._updateAtmosphere()),h),p((()=>this._stars),(()=>this._setNeedsRender())),p((()=>this._clouds),(()=>this._updateWeather(this._weatherUpdateParameters)),l),p((()=>this._precipitation),(()=>this._setNeedsRender())),p((()=>this._fog),(()=>this._updateFog(this._weatherUpdateParameters)),l),p((()=>this._weatherUpdateParameters),(e=>{this._updateWeather(e),this._updateFog(e)}),h)])}uninitializeRenderContext(){this._context=null,this._atmosphere=i(this._atmosphere),this._set("_stars",i(this._stars)),this._set("_precipitation",i(this._precipitation)),this._set("_clouds",i(this._clouds)),this._set("_cloudsComposition",i(this._cloudsComposition)),this._set("_fog",i(this._fog))}prepareRender(e){e.bindParameters.clouds.data=v(this._clouds)?this._clouds:null}render(e){if(e.output===T.Color)switch(e.bindParameters.slot){case A.POSTPROCESSING_ENVIRONMENT_OPAQUE:o(this._stars)&&this._stars.render(e),o(this._atmosphere)&&(this._atmosphere.render(e),o(this._cloudsComposition)&&o(e.bindParameters.clouds.data)&&(this.weatherVisible&&o(this._clouds)&&this._clouds.ensureWeatherTile(),this._cloudsComposition.render(e,o(this.view.animation))));break;case A.POSTPROCESSING_ENVIRONMENT_TRANSPARENT:if(o(this._atmosphere)){const t=this.weatherEnabled?this.view.environment.weather.type:"disabled";if(this._atmosphere.renderHaze(e,"rainy"===t),o(this._fog)){const s="foggy"===t||"rainy"===t||"snowy"===t;(s||"realistic"!==this._selectAtmosphereType())&&this._fog.render(e,s,"rainy"===t)}if(o(this._precipitation)){const t=this.view.environment.weather;"rainy"!==t.type&&"snowy"!==t.type||this._precipitation.render(e,t.precipitation,t.type)}}}}get _weatherUpdateParameters(){const e=this.weatherEnabled?this.view.environment.weather:null;return n(e)?null:"rainy"===e.type||"snowy"===e.type?{type:e.type,weatherAdjustment:e.cloudCover,effect:e.precipitation}:{type:e.type,weatherAdjustment:"foggy"===e.type?e.fogStrength:e.cloudCover}}_updateWeather(e){n(e)||n(this._clouds)||(this._clouds.applyPreset(R[e.type],e.weatherAdjustment),this._setNeedsRender())}_setNeedsRender(){o(this._context)&&this._context.requestRender()}_updateFog(e){if(!n(this._fog)&&!n(e))switch(e.type){case"foggy":this._fog.strength=r(3e-5,.005,e.weatherAdjustment**3),this._setNeedsRender();break;case"rainy":case"snowy":this._fog.strength=r(4e-6,2e-4,e.effect**3),this._setNeedsRender();break;default:this._fog.strength=4e-6,this._setNeedsRender()}}_updateAtmosphere(){const e=this._selectAtmosphereType();if(this.atmosphereType===e)return;const t=this._getAtmosphereClass();if(!t)return o(this._atmosphere)&&(this._atmosphere.destroy(),this._atmosphere=null,this._setNeedsRender()),void this._updateBasemapTerrain();o(this._context)&&(i(this._atmosphere),this._atmosphere=new t(this.view),this._atmosphere.initializeRenderContext(this._context),this._setNeedsRender(),this._updateBasemapTerrain())}_getAtmosphereClass(){switch(this._selectAtmosphereType()){case"none":return null;case"realistic":return y;case"panoramic":return E;case"simple":return N;default:return}}_selectAtmosphereType(){const e=this.view.get("environment.atmosphereEnabled"),t=this.view.get("environment.atmosphere.quality"),s=this.view.viewingMode;return!e||null==t||u(this.view.spatialReference)?"none":"local"===s?"panoramic":"high"===t&&o(this._context)&&y.isSupported(this._context)&&w(this.view.spatialReference)?"realistic":"simple"}_updateBasemapTerrain(){this.view.basemapTerrain&&(this.view.basemapTerrain.velvetOverground=o(this._atmosphere)&&"simple"===this.atmosphereType)}get test(){return{atmosphere:this._atmosphere,clouds:this._clouds,selectAtmosphereType:()=>this._selectAtmosphereType(),stubGetAtmosphereClass:e=>{S=O.prototype._getAtmosphereClass,O.prototype._getAtmosphereClass=e},restoreGetAtmosphereClass:()=>{O.prototype._getAtmosphereClass=S}}}};e([d({constructOnly:!0})],M.prototype,"view",void 0),e([d({type:Boolean,readOnly:!0})],M.prototype,"updating",null),e([d({readOnly:!0})],M.prototype,"weatherVisible",null),e([d()],M.prototype,"_context",void 0),e([d({readOnly:!0})],M.prototype,"_stars",null),e([d({readOnly:!0})],M.prototype,"_precipitation",null),e([d({readOnly:!0})],M.prototype,"_clouds",null),e([d({readOnly:!0})],M.prototype,"_cloudsComposition",null),e([d({readOnly:!0})],M.prototype,"_fog",null),e([d({readOnly:!0})],M.prototype,"weatherEnabled",null),e([d({readOnly:!0})],M.prototype,"_precipitationEnabled",null),e([d({readOnly:!0})],M.prototype,"_weatherUpdateParameters",null),M=O=e([_("esri.views.3d.environment.EnvironmentRenderer")],M);export{M as EnvironmentRenderer};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.25/esri/copyright.txt for details.
4
4
  */
5
- import e from"../../../core/Logger.js";import{disposeMaybe as r,abortMaybe as t,isNone as o}from"../../../core/maybe.js";import{createResolver as s,isAbortError as i}from"../../../core/promiseUtils.js";import{c as a}from"../../../chunks/mat4.js";import{c as n}from"../../../chunks/mat4f64.js";import{requestImage as m}from"../../../support/requestImageUtils.js";import{S as l}from"../../../chunks/SimpleAtmosphere.glsl.js";import{SimpleAtmosphereTechnique as h}from"./SimpleAtmosphereTechnique.js";import{SimpleAtmosphereTechniqueConfiguration as p,SimpleAtmosphereGeometry as c}from"./SimpleAtmosphereTechniqueConfiguration.js";import u from"./resources/SimpleAtmosphereTexture.js";import{glLayout as f}from"../support/buffer/glUtil.js";import{newLayout as g}from"../support/buffer/InterleavedLayout.js";import{Default3D as _}from"../webgl-engine/lib/DefaultVertexAttributeLocations.js";import d from"../webgl-engine/lib/GeometryUtil.js";import{VertexArrayObject as b}from"../webgl-engine/lib/VertexArrayObject.js";import{VertexAttribute as y}from"../webgl-engine/lib/VertexAttribute.js";import{BufferObject as j}from"../../webgl/BufferObject.js";import{PixelFormat as v,PixelType as x,TextureWrapMode as A,TextureSamplingMode as w,PrimitiveType as C,Usage as T}from"../../webgl/enums.js";import{Texture as P}from"../../webgl/Texture.js";import{vertexCount as q}from"../../webgl/Util.js";class I{constructor(){this.type="panoramic",this._techniqueConfig=new p,this._passParameters=new l,this._readyResolver=s(),this._readyController=new AbortController}destroy(){this._readyResolver.reject(),this._passParameters.texture=r(this._passParameters.texture),this._vao=r(this._vao),this._readyController=t(this._readyController)}when(){return this._readyResolver.promise}initializeRenderContext(r){this._techniqueConfig.geometry=c.Cylinder,this._technique=r.shaderTechniqueRepository.acquire(h,this._techniqueConfig);const t=r.renderContext.rctx;this._vao=this._createVertexArrayObject(t),this._vaoCount=q(this._vao,"geometry"),m(u,{signal:this._readyController.signal}).then((e=>{this._passParameters.texture=new P(t,{pixelFormat:v.RGBA,dataType:x.UNSIGNED_BYTE,wrapMode:A.CLAMP_TO_EDGE,samplingMode:w.LINEAR,flipped:!0},e),r.requestRender(),this._readyController=null,this._readyResolver.resolve()})).catch((r=>{i(r)||e.getLogger("esri.views.3d.environment.PanoramicAtmosphere").error("Unable to initialize atmosphere: image request failed",r),this._readyResolver.reject()}))}render(e){if(o(this._vao)||o(this._passParameters.texture))return;const r=e.rctx,t=r.bindTechnique(this._technique,this._passParameters,e.bindParameters);O(R,e.bindParameters.camera.viewMatrix),t.setUniformMatrix4fv("view",R),r.bindVAO(this._vao),t.assertCompatibleVertexAttributeLocations(this._vao),r.drawArrays(C.TRIANGLES,0,this._vaoCount)}renderHaze(){return!1}_createVertexArrayObject(e){const r=d.createPolySphereGeometry(1,2,!1),t=r.indices.get(y.POSITION);for(let a=0;a<t.length;a+=3){const e=t[a];t[a]=t[a+2],t[a+2]=e}const o=r.vertexAttributes.get(y.POSITION).data,s=S.createBuffer(t.length),i=s.position;for(let a=0;a<t.length;++a){const e=3*t[a];i.set(a,0,o[e]),i.set(a,1,o[e+1]),i.set(a,2,o[e+2])}return new b(e,_,{geometry:f(S)},{geometry:j.createVertex(e,T.STATIC_DRAW,s.buffer)})}}function O(e,r){a(e,r),e[12]=0,e[13]=0,e[14]=0,e[15]=1}const R=n(),S=g().vec3f(y.POSITION);export{I as PanoramicAtmosphere};
5
+ import{disposeMaybe as e,isNone as t}from"../../../core/maybe.js";import{c as r}from"../../../chunks/mat4.js";import{c as i}from"../../../chunks/mat4f64.js";import{S as s}from"../../../chunks/SimpleAtmosphere.glsl.js";import{SimpleAtmosphereTechnique as o}from"./SimpleAtmosphereTechnique.js";import{SimpleAtmosphereTechniqueConfiguration as a,SimpleAtmosphereGeometry as n}from"./SimpleAtmosphereTechniqueConfiguration.js";import{earthAtmosphereTextureSimple as m}from"./resources/SimpleAtmosphereTexture.js";import{glLayout as p}from"../support/buffer/glUtil.js";import{newLayout as h}from"../support/buffer/InterleavedLayout.js";import{Default3D as c}from"../webgl-engine/lib/DefaultVertexAttributeLocations.js";import u from"../webgl-engine/lib/GeometryUtil.js";import{VertexArrayObject as f}from"../webgl-engine/lib/VertexArrayObject.js";import{VertexAttribute as l}from"../webgl-engine/lib/VertexAttribute.js";import{BufferObject as b}from"../../webgl/BufferObject.js";import{PixelFormat as g,PixelType as _,TextureWrapMode as x,TextureSamplingMode as d,PrimitiveType as j,Usage as A}from"../../webgl/enums.js";import{Texture as y}from"../../webgl/Texture.js";import{vertexCount as w}from"../../webgl/Util.js";class v{constructor(){this.type="panoramic",this._techniqueConfig=new a,this._passParameters=new s}destroy(){this._passParameters.texture=e(this._passParameters.texture),this._vao=e(this._vao)}initializeRenderContext(e){this._techniqueConfig.geometry=n.Cylinder,this._technique=e.shaderTechniqueRepository.acquire(o,this._techniqueConfig);const t=e.renderContext.rctx;this._vao=this._createVertexArrayObject(t),this._vaoCount=w(this._vao,"geometry"),this._passParameters.texture=new y(t,{pixelFormat:g.RGBA,dataType:_.UNSIGNED_BYTE,wrapMode:x.CLAMP_TO_EDGE,samplingMode:d.LINEAR,flipped:!0,width:1,height:512},m),e.requestRender()}render(e){if(t(this._vao)||t(this._passParameters.texture))return;const r=e.rctx,i=r.bindTechnique(this._technique,this._passParameters,e.bindParameters);T(P,e.bindParameters.camera.viewMatrix),i.setUniformMatrix4fv("view",P),r.bindVAO(this._vao),i.assertCompatibleVertexAttributeLocations(this._vao),r.drawArrays(j.TRIANGLES,0,this._vaoCount)}renderHaze(){return!1}_createVertexArrayObject(e){const t=u.createPolySphereGeometry(1,2,!1),r=t.indices.get(l.POSITION);for(let a=0;a<r.length;a+=3){const e=r[a];r[a]=r[a+2],r[a+2]=e}const i=t.vertexAttributes.get(l.POSITION).data,s=C.createBuffer(r.length),o=s.position;for(let a=0;a<r.length;++a){const e=3*r[a];o.set(a,0,i[e]),o.set(a,1,i[e+1]),o.set(a,2,i[e+2])}return new f(e,c,{geometry:p(C)},{geometry:b.createVertex(e,A.STATIC_DRAW,s.buffer)})}}function T(e,t){r(e,t),e[12]=0,e[13]=0,e[14]=0,e[15]=1}const P=i(),C=h().vec3f(l.POSITION);export{v as PanoramicAtmosphere};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.25/esri/copyright.txt for details.
4
4
  */
5
- import e from"../../../core/Logger.js";import{lerp as t,clamp as r}from"../../../core/mathUtils.js";import{removeMaybe as s,disposeMaybe as i,abortMaybe as a,isNone as o}from"../../../core/maybe.js";import{createResolver as n,throwIfAborted as h,isAbortError as m}from"../../../core/promiseUtils.js";import{watch as c,syncAndInitial as u}from"../../../core/reactiveUtils.js";import{u as p}from"../../../chunks/mat4.js";import{c as l}from"../../../chunks/mat4f64.js";import{s as _}from"../../../chunks/vec2.js";import{l as d,g as f,a as g,i as R,f as j,p as y}from"../../../chunks/vec3.js";import{c as b}from"../../../chunks/vec3f64.js";import{getReferenceEllipsoid as x}from"../../../geometry/projectionEllipsoid.js";import{isMars as T}from"../../../geometry/support/spatialReferenceUtils.js";import{requestImage as v}from"../../../support/requestImageUtils.js";import{computeInnerAltitudeFade as V,innerAtmosphereDepth as q}from"./atmosphereUtils.js";import{S as A}from"../../../chunks/SimpleAtmosphere.glsl.js";import{SimpleAtmosphereTechnique as w}from"./SimpleAtmosphereTechnique.js";import{SimpleAtmosphereTechniqueConfiguration as C,SimpleAtmosphereGeometry as P}from"./SimpleAtmosphereTechniqueConfiguration.js";import S from"./resources/MarsAtmosphereTexture.js";import U from"./resources/SimpleAtmosphereTexture.js";import{makePiecewiseLinearFunction as F}from"../support/mathUtils.js";import{glLayout as M}from"../support/buffer/glUtil.js";import{newLayout as I}from"../support/buffer/InterleavedLayout.js";import{Default3D as O}from"../webgl-engine/lib/DefaultVertexAttributeLocations.js";import{createQuadVAO as E}from"../webgl-engine/lib/glUtil3D.js";import{project as L}from"../webgl-engine/lib/Util.js";import{VertexArrayObject as W}from"../webgl-engine/lib/VertexArrayObject.js";import{VertexAttribute as k}from"../webgl-engine/lib/VertexAttribute.js";import{BufferObject as N}from"../../webgl/BufferObject.js";import{PixelFormat as D,PixelType as G,TextureWrapMode as B,TextureSamplingMode as H,PrimitiveType as z,Usage as Y}from"../../webgl/enums.js";import{Texture as J}from"../../webgl/Texture.js";import{vertexCount as K}from"../../webgl/Util.js";const Q=128,X=-q,Z=0,$=50,ee=()=>1-511/512,te=F([[50,.1015625],[500,.21875],[5e3,1-250/512],[5e4,.4140625]]);class re{constructor(e){this.view=e,this.type="simple",this._passParameters=new A,this._fadeVaoCount=0,this._readyResolver=n(),this._readyController=new AbortController,this._texV1=1,this._isOnMars=T(e.spatialReference);const t=x(e.spatialReference);this._planetRadius=t.radius,this._outerRimWidth=t.outerAtmosphereRimWidth,this._innerRimFactor=(this._planetRadius+X)/this._planetRadius,this._middleRimFactor=(this._planetRadius+Z)/this._planetRadius,this._outerRimFactor=(this._planetRadius+this._outerRimWidth)/this._planetRadius,this._texV0=Z/this._outerRimWidth,this._texVScale=this._texV1-this._texV0}destroy(){this._readyResolver.reject(),this._cameraChangeHandle=s(this._cameraChangeHandle),this._passParameters.texture=i(this._passParameters.texture),this._fadeVao=i(this._fadeVao),this._vao=i(this._vao),this._readyController=a(this._readyController)}when(){return this._readyResolver.promise}async initializeRenderContext(t){this._shaderTechniqueRepository=t.shaderTechniqueRepository;const r=t.renderContext.rctx;this._cameraChangeHandle=c((()=>this.view.state?.camera),(()=>t.requestRender()),u),this._vao=this._createRibbon(r),this._vaoCount=K(this._vao,"geometry"),this._fadeVao=E(r),this._fadeVaoCount=K(this._fadeVao,"geometry");const s=this._isOnMars?S:U,i=this._readyController.signal;try{const e=await v(s,{signal:i});h(i),this._passParameters.texture=new J(r,{pixelFormat:D.RGBA,dataType:G.UNSIGNED_BYTE,wrapMode:B.CLAMP_TO_EDGE,samplingMode:H.LINEAR,flipped:!0},e),t.requestRender(),this._readyController=null,this._readyResolver.resolve()}catch(a){m(a)||e.getLogger("esri.views.3d.environment.SimpleAtmosphere").error("Unable to initialize simple atmosphere: image request failed",a),this._readyResolver.reject(a)}}get _coneTechnique(){if(o(this._coneTechniqueCached)){const e=new C;e.geometry=P.Cone,this._coneTechniqueCached=this._shaderTechniqueRepository.acquire(w,e)}return this._coneTechniqueCached}get _undergroundTechnique(){if(o(this._undergroundTechniqueCached)){const e=new C;e.geometry=P.Underground,this._undergroundTechniqueCached=this._shaderTechniqueRepository.acquire(w,e)}return this._undergroundTechniqueCached}render(e){if(o(this._vao)||o(this._passParameters.texture))return;const t=e.bindParameters.camera;this._update(t);const r=e.rctx;this._passParameters.undergroundFadeAlpha<1&&(r.bindTechnique(this._coneTechnique,this._passParameters,e.bindParameters),r.bindVAO(this._vao),r.drawArrays(z.TRIANGLES,0,this._vaoCount)),this._passParameters.undergroundFadeAlpha>0&&(r.bindTechnique(this._undergroundTechnique,this._passParameters,e.bindParameters),r.bindVAO(this._fadeVao),r.drawArrays(z.TRIANGLE_STRIP,0,this._fadeVaoCount))}renderHaze(){return!1}_update(e){const s=b(),i=this._planetRadius,a=d(e.eye),o=a-i;if(o<0){const e=Math.min(-o/5e3,1);this._passParameters.undergroundFadeAlpha=e}else this._passParameters.undergroundFadeAlpha=0;const n=Math.max($,o),h=i+X;this._passParameters.innerScale=ne(i+n,i,h)-1,this._passParameters.altitudeFade=V(o),f(s,e.eye,(i+$)/a),se(s,e.center,e.up,i,this._passParameters.silhouette);const m=this._computeScreenRimWidth(e,s,e.up,this._passParameters.silhouette),c=ee(),u=te(o);let p=this._texV0+c*this._texVScale,l=this._texV0+m*u*this._texVScale;if(o>$){se(e.eye,e.center,e.up,i,this._passParameters.silhouette);const s=this._computeScreenRimWidth(e,e.eye,e.up,this._passParameters.silhouette),a=r((s-1.5)/(m-1.5),0,1);p=this._texV0+a*c*this._texVScale,l=this._texV0+t(this._texV1,m*u,a)*this._texVScale}_(this._passParameters.texV,p,l)}_createRibbon(e){const t=new Float32Array(3+3*Q*3),r=new Uint32Array(3*Q*5);t[0]=0,t[1]=0,t[2]=-1;for(let a=0;a<Q;a++){const e=9*a+3;t[e+0]=a,t[e+1]=this._innerRimFactor,t[e+2]=-1,t[e+3]=a,t[e+4]=this._middleRimFactor,t[e+5]=0,t[e+6]=a,t[e+7]=this._outerRimFactor,t[e+8]=1;const s=3*a+1,i=a===Q-1?1:s+3,o=15*a;r[o+0]=s,r[o+1]=s+1,r[o+2]=i+1,r[o+3]=i+1,r[o+4]=i,r[o+5]=s,r[o+6]=s+1,r[o+7]=s+2,r[o+8]=i+2,r[o+9]=i+2,r[o+10]=i+1,r[o+11]=s+1,r[o+12]=s,r[o+13]=i,r[o+14]=0}const s=he.createBuffer(r.length),i=s.position;for(let a=0;a<r.length;++a){const e=3*r[a];i.set(a,0,t[e]),i.set(a,1,t[e+1]),i.set(a,2,t[e+2])}return new W(e,O,{geometry:M(he)},{geometry:N.createVertex(e,Y.STATIC_DRAW,s.buffer)})}_computeScreenRimWidth(e,t,r,s){return g(ae,s.center,s.v2),f(oe,ae,this._outerRimFactor),p(ie,t,ae,r),L(ae,ie,e.projectionMatrix,e.viewport),L(oe,ie,e.projectionMatrix,e.viewport),R(ae,oe)/e.height}}function se(e,t,r,s,i){const a=d(e),o=s*Math.sqrt(a*a-s*s)/a,n=Math.sqrt(s*s-o*o),h=i.v1,m=i.v2;return f(i.center,e,n/a),j(h,e,t),y(h)<1&&j(h,e,r),f(h,h,o/d(h)),j(m,h,e),f(m,m,o/d(m)),o}const ie=l(),ae=b(),oe=b();function ne(e,t,r){return e*e/(Math.sqrt(e*e-t*t)*Math.sqrt(e*e-r*r)+t*r)}const he=I().vec3f(k.POSITION);export{re as default};
5
+ import{lerp as e,clamp as t}from"../../../core/mathUtils.js";import{removeMaybe as s,disposeMaybe as r,isNone as i}from"../../../core/maybe.js";import{watch as a,syncAndInitial as o}from"../../../core/reactiveUtils.js";import{u as n}from"../../../chunks/mat4.js";import{c as h}from"../../../chunks/mat4f64.js";import{s as m}from"../../../chunks/vec2.js";import{l as c,g as u,a as p,i as _,f as d,p as l}from"../../../chunks/vec3.js";import{c as f}from"../../../chunks/vec3f64.js";import{getReferenceEllipsoid as g}from"../../../geometry/projectionEllipsoid.js";import{isMars as R}from"../../../geometry/support/spatialReferenceUtils.js";import{computeInnerAltitudeFade as x,innerAtmosphereDepth as b}from"./atmosphereUtils.js";import{S as j}from"../../../chunks/SimpleAtmosphere.glsl.js";import{SimpleAtmosphereTechnique as T}from"./SimpleAtmosphereTechnique.js";import{SimpleAtmosphereTechniqueConfiguration as V,SimpleAtmosphereGeometry as y}from"./SimpleAtmosphereTechniqueConfiguration.js";import{marsAtmosphereTextureSimple as q}from"./resources/MarsAtmosphereTexture.js";import{earthAtmosphereTextureSimple as A}from"./resources/SimpleAtmosphereTexture.js";import{makePiecewiseLinearFunction as w}from"../support/mathUtils.js";import{glLayout as P}from"../support/buffer/glUtil.js";import{newLayout as v}from"../support/buffer/InterleavedLayout.js";import{Default3D as C}from"../webgl-engine/lib/DefaultVertexAttributeLocations.js";import{createQuadVAO as S}from"../webgl-engine/lib/glUtil3D.js";import{project as F}from"../webgl-engine/lib/Util.js";import{VertexArrayObject as M}from"../webgl-engine/lib/VertexArrayObject.js";import{VertexAttribute as U}from"../webgl-engine/lib/VertexAttribute.js";import{BufferObject as I}from"../../webgl/BufferObject.js";import{PixelFormat as O,PixelType as E,TextureWrapMode as W,TextureSamplingMode as k,PrimitiveType as L,Usage as N}from"../../webgl/enums.js";import{Texture as D}from"../../webgl/Texture.js";import{vertexCount as G}from"../../webgl/Util.js";const B=128,H=-b,z=0,Y=50,J=()=>1-511/512,K=w([[50,.1015625],[500,.21875],[5e3,1-250/512],[5e4,.4140625]]);class Q{constructor(e){this.view=e,this.type="simple",this._passParameters=new j,this._fadeVaoCount=0,this._texV1=1,this._isOnMars=R(e.spatialReference);const t=g(e.spatialReference);this._planetRadius=t.radius,this._outerRimWidth=t.outerAtmosphereRimWidth,this._innerRimFactor=(this._planetRadius+H)/this._planetRadius,this._middleRimFactor=(this._planetRadius+z)/this._planetRadius,this._outerRimFactor=(this._planetRadius+this._outerRimWidth)/this._planetRadius,this._texV0=z/this._outerRimWidth,this._texVScale=this._texV1-this._texV0}destroy(){this._cameraChangeHandle=s(this._cameraChangeHandle),this._passParameters.texture=r(this._passParameters.texture),this._fadeVao=r(this._fadeVao),this._vao=r(this._vao)}async initializeRenderContext(e){this._shaderTechniqueRepository=e.shaderTechniqueRepository;const t=e.renderContext.rctx;this._cameraChangeHandle=a((()=>this.view.state?.camera),(()=>e.requestRender()),o),this._vao=this._createRibbon(t),this._vaoCount=G(this._vao,"geometry"),this._fadeVao=S(t),this._fadeVaoCount=G(this._fadeVao,"geometry");const s=this._isOnMars?q:A;this._passParameters.texture=new D(t,{pixelFormat:O.RGBA,dataType:E.UNSIGNED_BYTE,wrapMode:W.CLAMP_TO_EDGE,samplingMode:k.LINEAR,flipped:!0,width:1,height:512},s),e.requestRender()}get _coneTechnique(){if(i(this._coneTechniqueCached)){const e=new V;e.geometry=y.Cone,this._coneTechniqueCached=this._shaderTechniqueRepository.acquire(T,e)}return this._coneTechniqueCached}get _undergroundTechnique(){if(i(this._undergroundTechniqueCached)){const e=new V;e.geometry=y.Underground,this._undergroundTechniqueCached=this._shaderTechniqueRepository.acquire(T,e)}return this._undergroundTechniqueCached}render(e){if(i(this._vao)||i(this._passParameters.texture))return;const t=e.bindParameters.camera;this._update(t);const s=e.rctx;this._passParameters.undergroundFadeAlpha<1&&(s.bindTechnique(this._coneTechnique,this._passParameters,e.bindParameters),s.bindVAO(this._vao),s.drawArrays(L.TRIANGLES,0,this._vaoCount)),this._passParameters.undergroundFadeAlpha>0&&(s.bindTechnique(this._undergroundTechnique,this._passParameters,e.bindParameters),s.bindVAO(this._fadeVao),s.drawArrays(L.TRIANGLE_STRIP,0,this._fadeVaoCount))}renderHaze(){return!1}_update(s){const r=f(),i=this._planetRadius,a=c(s.eye),o=a-i;if(o<0){const e=Math.min(-o/5e3,1);this._passParameters.undergroundFadeAlpha=e}else this._passParameters.undergroundFadeAlpha=0;const n=Math.max(Y,o),h=i+H;this._passParameters.innerScale=te(i+n,i,h)-1,this._passParameters.altitudeFade=x(o),u(r,s.eye,(i+Y)/a),X(r,s.center,s.up,i,this._passParameters.silhouette);const p=this._computeScreenRimWidth(s,r,s.up,this._passParameters.silhouette),_=J(),d=K(o);let l=this._texV0+_*this._texVScale,g=this._texV0+p*d*this._texVScale;if(o>Y){X(s.eye,s.center,s.up,i,this._passParameters.silhouette);const r=this._computeScreenRimWidth(s,s.eye,s.up,this._passParameters.silhouette),a=t((r-1.5)/(p-1.5),0,1);l=this._texV0+a*_*this._texVScale,g=this._texV0+e(this._texV1,p*d,a)*this._texVScale}m(this._passParameters.texV,l,g)}_createRibbon(e){const t=new Float32Array(3+3*B*3),s=new Uint32Array(3*B*5);t[0]=0,t[1]=0,t[2]=-1;for(let a=0;a<B;a++){const e=9*a+3;t[e+0]=a,t[e+1]=this._innerRimFactor,t[e+2]=-1,t[e+3]=a,t[e+4]=this._middleRimFactor,t[e+5]=0,t[e+6]=a,t[e+7]=this._outerRimFactor,t[e+8]=1;const r=3*a+1,i=a===B-1?1:r+3,o=15*a;s[o+0]=r,s[o+1]=r+1,s[o+2]=i+1,s[o+3]=i+1,s[o+4]=i,s[o+5]=r,s[o+6]=r+1,s[o+7]=r+2,s[o+8]=i+2,s[o+9]=i+2,s[o+10]=i+1,s[o+11]=r+1,s[o+12]=r,s[o+13]=i,s[o+14]=0}const r=se.createBuffer(s.length),i=r.position;for(let a=0;a<s.length;++a){const e=3*s[a];i.set(a,0,t[e]),i.set(a,1,t[e+1]),i.set(a,2,t[e+2])}return new M(e,C,{geometry:P(se)},{geometry:I.createVertex(e,N.STATIC_DRAW,r.buffer)})}_computeScreenRimWidth(e,t,s,r){return p($,r.center,r.v2),u(ee,$,this._outerRimFactor),n(Z,t,$,s),F($,Z,e.projectionMatrix,e.viewport),F(ee,Z,e.projectionMatrix,e.viewport),_($,ee)/e.height}}function X(e,t,s,r,i){const a=c(e),o=r*Math.sqrt(a*a-r*r)/a,n=Math.sqrt(r*r-o*o),h=i.v1,m=i.v2;return u(i.center,e,n/a),d(h,e,t),l(h)<1&&d(h,e,s),u(h,h,o/c(h)),d(m,h,e),u(m,m,o/c(m)),o}const Z=h(),$=f(),ee=f();function te(e,t,s){return e*e/(Math.sqrt(e*e-t*t)*Math.sqrt(e*e-s*s)+t*s)}const se=v().vec3f(U.POSITION);export{Q as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.25/esri/copyright.txt for details.
4
4
  */
5
- const A="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAIACAYAAAE00TaTAAAACXBIWXMAAA7AAAAOwAFq1okJAAAKT2lDQ1BQaG90b3Nob3AgSUNDIHByb2ZpbGUAAHjanVNnVFPpFj333vRCS4iAlEtvUhUIIFJCi4AUkSYqIQkQSoghodkVUcERRUUEG8igiAOOjoCMFVEsDIoK2AfkIaKOg6OIisr74Xuja9a89+bN/rXXPues852zzwfACAyWSDNRNYAMqUIeEeCDx8TG4eQuQIEKJHAAEAizZCFz/SMBAPh+PDwrIsAHvgABeNMLCADATZvAMByH/w/qQplcAYCEAcB0kThLCIAUAEB6jkKmAEBGAYCdmCZTAKAEAGDLY2LjAFAtAGAnf+bTAICd+Jl7AQBblCEVAaCRACATZYhEAGg7AKzPVopFAFgwABRmS8Q5ANgtADBJV2ZIALC3AMDOEAuyAAgMADBRiIUpAAR7AGDIIyN4AISZABRG8lc88SuuEOcqAAB4mbI8uSQ5RYFbCC1xB1dXLh4ozkkXKxQ2YQJhmkAuwnmZGTKBNA/g88wAAKCRFRHgg/P9eM4Ors7ONo62Dl8t6r8G/yJiYuP+5c+rcEAAAOF0ftH+LC+zGoA7BoBt/qIl7gRoXgugdfeLZrIPQLUAoOnaV/Nw+H48PEWhkLnZ2eXk5NhKxEJbYcpXff5nwl/AV/1s+X48/Pf14L7iJIEyXYFHBPjgwsz0TKUcz5IJhGLc5o9H/LcL//wd0yLESWK5WCoU41EScY5EmozzMqUiiUKSKcUl0v9k4t8s+wM+3zUAsGo+AXuRLahdYwP2SycQWHTA4vcAAPK7b8HUKAgDgGiD4c93/+8//UegJQCAZkmScQAAXkQkLlTKsz/HCAAARKCBKrBBG/TBGCzABhzBBdzBC/xgNoRCJMTCQhBCCmSAHHJgKayCQiiGzbAdKmAv1EAdNMBRaIaTcA4uwlW4Dj1wD/phCJ7BKLyBCQRByAgTYSHaiAFiilgjjggXmYX4IcFIBBKLJCDJiBRRIkuRNUgxUopUIFVIHfI9cgI5h1xGupE7yAAygvyGvEcxlIGyUT3UDLVDuag3GoRGogvQZHQxmo8WoJvQcrQaPYw2oefQq2gP2o8+Q8cwwOgYBzPEbDAuxsNCsTgsCZNjy7EirAyrxhqwVqwDu4n1Y8+xdwQSgUXACTYEd0IgYR5BSFhMWE7YSKggHCQ0EdoJNwkDhFHCJyKTqEu0JroR+cQYYjIxh1hILCPWEo8TLxB7iEPENyQSiUMyJ7mQAkmxpFTSEtJG0m5SI+ksqZs0SBojk8naZGuyBzmULCAryIXkneTD5DPkG+Qh8lsKnWJAcaT4U+IoUspqShnlEOU05QZlmDJBVaOaUt2ooVQRNY9aQq2htlKvUYeoEzR1mjnNgxZJS6WtopXTGmgXaPdpr+h0uhHdlR5Ol9BX0svpR+iX6AP0dwwNhhWDx4hnKBmbGAcYZxl3GK+YTKYZ04sZx1QwNzHrmOeZD5lvVVgqtip8FZHKCpVKlSaVGyovVKmqpqreqgtV81XLVI+pXlN9rkZVM1PjqQnUlqtVqp1Q61MbU2epO6iHqmeob1Q/pH5Z/YkGWcNMw09DpFGgsV/jvMYgC2MZs3gsIWsNq4Z1gTXEJrHN2Xx2KruY/R27iz2qqaE5QzNKM1ezUvOUZj8H45hx+Jx0TgnnKKeX836K3hTvKeIpG6Y0TLkxZVxrqpaXllirSKtRq0frvTau7aedpr1Fu1n7gQ5Bx0onXCdHZ4/OBZ3nU9lT3acKpxZNPTr1ri6qa6UbobtEd79up+6Ynr5egJ5Mb6feeb3n+hx9L/1U/W36p/VHDFgGswwkBtsMzhg8xTVxbzwdL8fb8VFDXcNAQ6VhlWGX4YSRudE8o9VGjUYPjGnGXOMk423GbcajJgYmISZLTepN7ppSTbmmKaY7TDtMx83MzaLN1pk1mz0x1zLnm+eb15vft2BaeFostqi2uGVJsuRaplnutrxuhVo5WaVYVVpds0atna0l1rutu6cRp7lOk06rntZnw7Dxtsm2qbcZsOXYBtuutm22fWFnYhdnt8Wuw+6TvZN9un2N/T0HDYfZDqsdWh1+c7RyFDpWOt6azpzuP33F9JbpL2dYzxDP2DPjthPLKcRpnVOb00dnF2e5c4PziIuJS4LLLpc+Lpsbxt3IveRKdPVxXeF60vWdm7Obwu2o26/uNu5p7ofcn8w0nymeWTNz0MPIQ+BR5dE/C5+VMGvfrH5PQ0+BZ7XnIy9jL5FXrdewt6V3qvdh7xc+9j5yn+M+4zw33jLeWV/MN8C3yLfLT8Nvnl+F30N/I/9k/3r/0QCngCUBZwOJgUGBWwL7+Hp8Ib+OPzrbZfay2e1BjKC5QRVBj4KtguXBrSFoyOyQrSH355jOkc5pDoVQfujW0Adh5mGLw34MJ4WHhVeGP45wiFga0TGXNXfR3ENz30T6RJZE3ptnMU85ry1KNSo+qi5qPNo3ujS6P8YuZlnM1VidWElsSxw5LiquNm5svt/87fOH4p3iC+N7F5gvyF1weaHOwvSFpxapLhIsOpZATIhOOJTwQRAqqBaMJfITdyWOCnnCHcJnIi/RNtGI2ENcKh5O8kgqTXqS7JG8NXkkxTOlLOW5hCepkLxMDUzdmzqeFpp2IG0yPTq9MYOSkZBxQqohTZO2Z+pn5mZ2y6xlhbL+xW6Lty8elQfJa7OQrAVZLQq2QqboVFoo1yoHsmdlV2a/zYnKOZarnivN7cyzytuQN5zvn//tEsIS4ZK2pYZLVy0dWOa9rGo5sjxxedsK4xUFK4ZWBqw8uIq2Km3VT6vtV5eufr0mek1rgV7ByoLBtQFr6wtVCuWFfevc1+1dT1gvWd+1YfqGnRs+FYmKrhTbF5cVf9go3HjlG4dvyr+Z3JS0qavEuWTPZtJm6ebeLZ5bDpaql+aXDm4N2dq0Dd9WtO319kXbL5fNKNu7g7ZDuaO/PLi8ZafJzs07P1SkVPRU+lQ27tLdtWHX+G7R7ht7vPY07NXbW7z3/T7JvttVAVVN1WbVZftJ+7P3P66Jqun4lvttXa1ObXHtxwPSA/0HIw6217nU1R3SPVRSj9Yr60cOxx++/p3vdy0NNg1VjZzG4iNwRHnk6fcJ3/ceDTradox7rOEH0x92HWcdL2pCmvKaRptTmvtbYlu6T8w+0dbq3nr8R9sfD5w0PFl5SvNUyWna6YLTk2fyz4ydlZ19fi753GDborZ752PO32oPb++6EHTh0kX/i+c7vDvOXPK4dPKy2+UTV7hXmq86X23qdOo8/pPTT8e7nLuarrlca7nuer21e2b36RueN87d9L158Rb/1tWeOT3dvfN6b/fF9/XfFt1+cif9zsu72Xcn7q28T7xf9EDtQdlD3YfVP1v+3Njv3H9qwHeg89HcR/cGhYPP/pH1jw9DBY+Zj8uGDYbrnjg+OTniP3L96fynQ89kzyaeF/6i/suuFxYvfvjV69fO0ZjRoZfyl5O/bXyl/erA6xmv28bCxh6+yXgzMV70VvvtwXfcdx3vo98PT+R8IH8o/2j5sfVT0Kf7kxmTk/8EA5jz/GMzLdsAAAAgY0hSTQAAeiUAAICDAAD5/wAAgOkAAHUwAADqYAAAOpgAABdvkl/FRgAAAp1JREFUSMd9lcmSEzEQRCtflnqxYZgIThBDAP//kXDQ0pJtuDhqycxWZ5fKERFCERARIAVEyCjCtSFFEjWVa9q7OdJE0oiidIhKhRBROlhloiGVhaYERQHJWFEwMpYKrjUlibI2cqSJIJEpKNmM2c3GkRTOJDnThTMpnMWu0VFszs3Jfbe5bza3w+a229yOIs6zmP3czfn1K2w/for8+EVU15pNmmyqkeJyclinXNJRu1xrUaJmjmdzJiejVNt7zZVBRAIq1RwrsrrWnez+SR7WmQQP/1itKz2q/pmzuJtYnNy2bth9x9z2NLfDcB7FHOcGx6ebOb9/iPzxG/ztg4iorglFiKjzF9HSNphCoRb1OY3RZQJrYgRdT68bmgXGDdBzrTG8qNS7QP/m19ef7tGlcoH7vESYkK70uoPuOLEetz0IqeGoWQW6MlB/j36EnipYGKPWwDRg/RkNhXCNJIzAhMk6PrDePJNII6JHqM5VWqYApCtNFPe0GFFGtOWopWCrEVBSoiQi06KkRRaD08IlxXa/ifz8Jvz2LvjyLnh7F/r8Rei8a8xfjNkIrpmMOQ1C02COrkTEHxGhh+6DQJfXc/eZprXxcIyVIf1LJVgWvKaHvwI/1aQxtv851SQ/nqGXL6MHFVY3nmhLyqKsWO/+qzWif+yS1TpNKq8NezjGPCV69ciZoQj1PwfN6QRpWyCGVMe1D/AAHt3/gefu1Ign3AVpjOiNXkN90JlpL6TUnzFEUU+Jvks0tkp/dY3Fy1TzI24BWwsYJPyg11Q0FqDwK72xIz2kLojbeuxS1FpgtfNWyMX1gFw0j3W7RNeSHTVEe3VaV7SdCzVywFaEt02w7QH7Eeg4AvZDNdJ+Cu1HENsutO+Byi6ilEBZ9BeCNBJceJIjHgAAAABJRU5ErkJggg==";export{A as default};
5
+ const e=new Uint8ClampedArray([0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,2,0,0,0,2,0,0,0,2,0,0,0,2,0,0,0,3,0,0,0,3,0,0,0,3,0,0,0,4,0,0,0,4,0,0,0,4,0,0,0,5,0,0,0,5,0,0,0,5,0,0,0,5,0,0,0,5,0,0,0,5,0,0,0,5,0,0,0,6,0,0,0,6,0,0,0,7,0,0,0,7,0,0,0,7,0,0,0,8,0,0,0,8,0,0,0,8,0,0,0,9,0,0,0,9,0,0,0,9,0,0,0,10,0,0,0,10,0,0,0,11,0,0,0,11,0,0,0,11,0,0,0,12,0,0,0,12,0,0,0,12,0,0,0,13,0,0,0,13,0,0,0,14,0,0,0,14,0,0,0,14,0,0,0,14,0,0,0,14,0,0,0,15,0,0,0,15,0,0,0,16,0,0,0,16,0,0,0,16,0,0,0,17,0,0,0,17,0,0,0,18,0,0,0,18,0,0,0,19,0,0,0,19,0,0,0,19,0,0,0,20,0,0,0,20,0,0,0,21,0,0,0,21,0,0,0,22,0,0,0,22,11,0,0,23,11,0,0,23,11,0,0,23,11,0,0,23,11,0,0,24,11,0,0,24,11,0,0,24,10,0,0,25,10,0,0,25,10,0,0,26,10,0,0,26,9,0,0,27,9,0,0,27,9,0,0,28,9,0,0,28,9,0,0,29,9,0,0,29,8,0,0,30,8,0,0,30,8,0,0,31,8,0,0,31,8,0,0,32,8,0,0,32,8,0,0,32,8,0,0,32,8,0,0,33,8,0,0,33,8,0,0,34,7,0,0,35,7,0,0,35,7,0,0,36,7,0,0,36,7,7,0,37,7,7,0,37,7,7,0,38,7,7,0,38,13,7,0,39,13,7,0,39,13,6,0,40,13,6,0,40,12,6,0,41,12,6,0,41,12,6,0,41,12,6,0,42,12,6,0,42,12,6,0,43,12,6,0,43,12,6,0,44,12,6,0,44,11,6,0,45,11,6,6,45,11,6,6,46,11,5,5,47,11,5,5,47,11,5,5,48,11,5,5,48,10,5,5,49,10,5,5,49,10,5,5,50,15,5,5,51,15,5,5,51,15,5,5,51,15,5,5,51,15,5,5,52,15,5,5,52,14,5,5,53,14,5,5,54,14,5,5,54,14,5,5,55,14,5,5,55,14,5,5,56,13,4,4,57,13,4,4,57,13,4,4,58,13,4,4,58,13,4,4,59,13,4,4,59,17,4,4,60,17,4,4,60,17,4,4,60,17,4,4,61,17,4,4,61,16,4,4,62,16,4,4,63,16,4,4,63,16,8,4,64,16,8,4,64,16,8,4,65,15,8,4,66,15,8,4,66,15,8,4,67,19,8,4,68,19,8,4,68,18,7,4,69,18,7,4,69,18,7,4,69,18,7,4,70,18,7,4,70,18,7,4,71,18,7,4,71,18,7,4,72,17,7,3,73,17,7,3,73,21,7,3,74,21,7,3,74,20,7,3,75,20,7,3,76,20,7,3,76,20,7,3,77,20,7,3,77,20,7,3,78,20,7,3,78,20,7,7,78,19,6,6,79,19,10,6,80,19,10,6,80,22,9,6,81,22,9,6,81,22,9,6,82,22,9,6,83,22,9,6,83,21,9,6,84,21,9,6,84,21,9,6,85,21,9,6,86,21,9,6,86,23,9,6,87,23,9,6,87,23,9,6,87,23,9,6,88,23,9,6,88,23,9,6,89,23,8,6,90,23,8,6,90,22,8,6,91,22,8,6,91,25,8,6,92,25,8,5,93,25,8,5,93,24,8,5,94,24,8,5,94,24,11,5,95,24,11,5,96,24,11,5,96,26,11,5,97,26,11,5,97,26,11,5,97,26,10,5,98,26,10,5,98,26,10,5,99,25,10,5,100,25,10,5,100,25,10,5,101,25,10,5,101,25,10,5,102,27,10,5,103,27,10,5,103,27,10,5,104,27,10,5,104,27,12,5,105,26,12,5,106,26,12,5,106,29,12,5,106,29,12,5,106,29,12,7,107,28,12,7,108,28,12,7,108,28,12,7,109,28,12,7,109,30,12,7,110,30,11,7,111,30,11,7,111,30,11,7,112,30,11,7,112,29,11,7,113,29,11,7,114,29,11,7,114,31,11,7,115,31,11,7,115,31,11,7,115,31,11,7,116,31,11,7,116,33,13,7,117,33,13,9,117,32,13,9,118,32,13,9,118,32,13,9,119,34,15,8,120,34,15,8,120,34,15,8,121,36,15,8,121,36,15,8,122,36,15,8,122,35,15,8,123,37,14,8,124,37,14,8,124,37,14,8,124,37,14,8,124,39,14,8,125,39,16,8,125,38,16,8,126,38,16,8,127,38,16,8,127,40,16,10,128,40,16,10,128,40,16,10,129,42,18,10,129,41,18,10,130,41,18,10,130,43,18,10,131,43,18,10,131,42,17,10,132,42,17,12,132,42,17,12,133,44,17,12,133,44,17,12,133,46,17,11,134,46,17,11,134,45,19,11,135,45,19,11,135,47,19,11,136,47,19,11,136,47,19,11,137,47,19,11,137,48,20,11,138,48,20,11,138,50,20,13,139,50,20,13,139,49,20,13,140,49,22,13,140,51,22,13,141,51,22,13,141,50,22,13,142,52,22,13,142,52,21,12,143,53,21,12,143,53,21,12,143,53,21,12,143,53,21,14,144,53,23,14,144,55,23,14,145,55,23,14,145,56,23,14,146,56,23,14,146,57,24,14,147,57,24,14,147,59,24,16,148,59,24,16,148,58,24,15,149,58,26,15,149,58,26,15,149,60,26,15,150,60,26,15,150,61,25,15,151,61,25,15,151,62,25,17,152,62,25,17,152,64,25,17,152,64,27,17,152,63,27,17,153,63,27,17,153,65,27,17,153,66,28,17,154,66,28,17,154,67,28,16,155,67,28,16,155,67,30,16,155,69,29,18,156,69,29,18,156,68,29,18,157,70,29,18,157,70,29,18,157,71,31,18,158,71,31,18,158,72,30,19,159,72,30,19,159,74,30,19,159,73,30,19,160,73,32,19,160,74,32,19,161,74,32,21,161,76,32,21,161,78,33,21,161,78,33,21,161,79,35,20,162,78,34,20,163,79,34,22,164,81,36,22,164,82,36,22,165,81,35,22,166,82,37,21,167,84,37,21,167,85,36,21,168,86,38,23,169,88,38,23,169,88,38,23,170,88,39,23,170,89,39,24,171,91,40,24,171,92,40,24,172,93,40,24,173,94,41,25,173,95,41,25,174,96,42,25,175,98,42,25,175,99,43,26,176,99,43,26,177,101,45,26,177,102,44,26,178,103,46,27,179,104,46,27,179,105,46,27,179,106,45,28,180,108,47,28,180,108,46,28,181,109,48,28,182,111,48,29,182,111,49,29,183,114,49,29,184,114,50,30,184,114,50,30,185,116,51,30,185,117,51,30,186,119,52,31,187,119,53,31,187,121,53,31,188,122,54,33,188,123,54,32,189,124,55,32,189,125,55,32,189,126,56,34,190,128,56,34,190,128,57,33,191,130,57,33,191,131,58,35,192,131,58,35,192,133,59,34,193,134,60,35,194,135,60,35,194,136,61,37,195,139,61,37,195,139,62,36,196,141,62,36,196,141,63,38,197,142,63,38,197,143,64,39,198,144,64,39,198,146,66,39,198,146,67,39,198,147,67,38,199,147,68,40,199,149,68,40,200,150,69,40,200,152,70,41,201,154,71,41,201,154,71,42,202,155,72,42,202,156,73,41,203,157,73,43,203,158,74,42,204,160,75,44,204,161,76,44,204,162,77,44,205,164,77,45,205,165,78,45,206,166,79,45,206,168,80,46,207,169,81,46,207,170,83,47,207,171,83,47,207,172,83,47,207,174,85,48,208,175,85,48,208,177,85,48,209,178,87,49,209,180,87,49,210,181,87,49,210,182,89,50,210,182,89,50,211,185,91,50,211,186,91,51,212,186,93,51,212,189,94,52,212,190,95,51,213,192,96,51,213,193,96,53,213,194,97,52,214,195,98,54,214,197,98,55,215,198,100,55,215,199,101,55,215,200,102,55,216,202,103,55,216,203,104,55,216,204,105,57,216,205,106,57,216,207,107,58,216,208,108,58,217,209,109,59,217,210,110,60,217,211,111,60,218,212,112,61,218,213,113,61,218,214,114,62,219,217,115,63,219,217,116,64,219,218,118,64,220,219,119,65,220,220,121,66,220,222,121,67,221,222,122,67,221,222,123,68,221,223,124,69,222,224,125,70,222,225,127,71,222,226,128,72,223,228,129,73,223,228,130,74,223,229,132,75,223,230,135,79,224,231,138,81,224,233,141,84,224,233,144,87,225,235,147,91,225,236,150,94,225,237,154,97,225,238,158,102,225,239,161,107,225,239,165,110,225,240,168,114,226,241,172,118,226,241,176,122,226,241,181,126,226,242,183,130,227,243,186,135,227,243,190,139,227,244,194,143,227,244,197,147,228,244,200,150,228,245,204,154,228,245,207,157,228,245,210,161,229,246,212,164,229,246,215,167,229,246,217,169,229,246,220,172,230,247,221,174,230]);export{e as marsAtmosphereTextureSimple};