@arcgis/core 4.24.0-next.20220331 → 4.24.0-next.20220401

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 (124) hide show
  1. package/WebScene.js +1 -1
  2. package/analysis/LineOfSightAnalysisObserver.js +1 -1
  3. package/analysis/LineOfSightAnalysisTarget.js +1 -1
  4. package/assets/esri/core/workers/RemoteClient.js +1 -1
  5. package/assets/esri/core/workers/chunks/0eb9c9477d36cd212f8b.js +1 -0
  6. package/assets/esri/core/workers/chunks/10779a256841c37f2429.js +1 -0
  7. package/assets/esri/core/workers/chunks/125b14c2ccd96d7c20c2.js +1 -0
  8. package/assets/esri/core/workers/chunks/{19cb7315d403a4cd4f59.js → 2530e8ccf6e12787ce76.js} +1 -1
  9. package/assets/esri/core/workers/chunks/{302c68c5b91d1ab4fd47.js → 560234694f3e53802aff.js} +1 -1
  10. package/assets/esri/core/workers/chunks/5633710daeb3bbb79bcf.js +1 -0
  11. package/assets/esri/core/workers/chunks/6f7917da7166e8c6854b.js +1 -0
  12. package/assets/esri/core/workers/chunks/7388824eac8da01ea03d.js +1 -0
  13. package/assets/esri/core/workers/chunks/794b47764ebb0257ed41.js +1 -0
  14. package/assets/esri/core/workers/chunks/81e9d860a044acec74ce.js +1 -0
  15. package/assets/esri/core/workers/chunks/{9a32f129f0d67547e44c.js → 831dc0187f71e658550c.js} +1 -1
  16. package/assets/esri/core/workers/chunks/{d162d1b7b97a58e97d8c.js → 8958cd555f4887526e8b.js} +1 -1
  17. package/assets/esri/core/workers/chunks/{e57b71ba70f088a3a052.js → 90dcd86cdef90099abfa.js} +1 -1
  18. package/assets/esri/core/workers/chunks/{a5b54e134ae59629d6d1.js → 93067e27eea5844edc6c.js} +1 -1
  19. package/assets/esri/core/workers/chunks/{0b63c9d5d9c004923a97.js → b26bd8fde2fc65bb67fb.js} +1 -1
  20. package/assets/esri/core/workers/chunks/{b81e1df3a47b61421295.js → b34ba22c7a5adce8a7a2.js} +1 -1
  21. package/assets/esri/core/workers/chunks/c28f7ae4756ad1ba94bd.js +1 -0
  22. package/assets/esri/core/workers/chunks/{e1408ff1b8343674e6ef.js → c59b0b58e24e6a60cf3e.js} +1 -1
  23. package/assets/esri/core/workers/chunks/{f4e79769297ad9c1d508.js → c7cee13a962396b23a5e.js} +1 -1
  24. package/assets/esri/core/workers/chunks/{cb38754110b7a0e901f6.js → cd3679fa86129ebabfdf.js} +1 -1
  25. package/assets/esri/core/workers/chunks/{224c0e64160bdc170051.js → d076627bb7dadea89e89.js} +1 -1
  26. package/assets/esri/core/workers/chunks/e06ad3a3d71154fed654.js +1 -0
  27. package/assets/esri/core/workers/chunks/{7a77d4cd27c30f1a5cae.js → ee3387a43dfbb3df23e1.js} +1 -1
  28. package/assets/esri/core/workers/chunks/{fbb7a121a45f8ca7d89c.js → f4fc165420d449e442b8.js} +1 -1
  29. package/assets/esri/themes/base/widgets/_Widget.scss +2 -2
  30. package/assets/esri/themes/dark/main.css +1 -1
  31. package/assets/esri/themes/dark-blue/main.css +1 -1
  32. package/assets/esri/themes/dark-green/main.css +1 -1
  33. package/assets/esri/themes/dark-purple/main.css +1 -1
  34. package/assets/esri/themes/dark-red/main.css +1 -1
  35. package/assets/esri/themes/light/main.css +1 -1
  36. package/assets/esri/themes/light/view.css +1 -1
  37. package/assets/esri/themes/light-blue/main.css +1 -1
  38. package/assets/esri/themes/light-green/main.css +1 -1
  39. package/assets/esri/themes/light-purple/main.css +1 -1
  40. package/assets/esri/themes/light-red/main.css +1 -1
  41. package/core/AsyncUpdate.js +1 -1
  42. package/exports/csv.js +1 -1
  43. package/geometry/support/meshUtils/exporters/gltf/geometry.js +1 -1
  44. package/geometry/support/normalizeUtils.js +1 -1
  45. package/interfaces.d.ts +120 -0
  46. package/layers/MapImageLayer.js +1 -1
  47. package/layers/RouteLayer.js +1 -1
  48. package/layers/VectorTileLayer.js +1 -1
  49. package/layers/graphics/editingSupport.js +1 -1
  50. package/layers/mixins/ArcGISImageService.js +1 -1
  51. package/layers/support/RasterJobHandler.js +1 -1
  52. package/layers/support/SpriteSource.js +1 -1
  53. package/layers/support/Sublayer.js +1 -1
  54. package/layers/support/TilemapCache.js +1 -1
  55. package/layers/support/vectorTileLayerLoader.js +1 -1
  56. package/libs/i3s/I3SModule.js +1 -1
  57. package/libs/vxl/VxlModule.js +1 -1
  58. package/package.json +1 -1
  59. package/portal/support/layersLoader.js +1 -1
  60. package/portal/support/portalLayers.js +1 -1
  61. package/renderers/support/DictionaryLoader.js +1 -1
  62. package/rest/query/operations/query.js +1 -1
  63. package/rest/query/operations/queryTopFeatures.js +1 -1
  64. package/rest/support/DirectionLine.js +1 -1
  65. package/rest/support/DirectionPoint.js +1 -1
  66. package/rest/support/PointBarrier.js +1 -1
  67. package/rest/support/PolygonBarrier.js +1 -1
  68. package/rest/support/PolylineBarrier.js +1 -1
  69. package/rest/support/RouteInfo.js +1 -1
  70. package/rest/support/Stop.js +1 -1
  71. package/smartMapping/labels/clusters.js +1 -1
  72. package/smartMapping/renderers/color.js +1 -1
  73. package/smartMapping/support/adapters/SceneLayerAdapter.js +1 -1
  74. package/support/elevationInfoUtils.js +1 -1
  75. package/support/revision.js +1 -1
  76. package/symbols/support/previewSymbol3D.js +1 -1
  77. package/symbols/support/symbolLayerUtils.js +1 -1
  78. package/views/2d/engine/vectorTiles/TileParser.js +1 -1
  79. package/views/2d/engine/webgl/util/Lock.js +1 -1
  80. package/views/2d/layers/RouteLayerView2D.js +1 -1
  81. package/views/2d/layers/features/support/AttributeStore.js +1 -1
  82. package/views/2d/layers/features/support/FeatureSetReaderPBF.js +1 -1
  83. package/views/2d/layers/support/webStyleUtils.js +1 -1
  84. package/views/3d/analysis/LineOfSight/LineOfSightController.js +1 -1
  85. package/views/3d/analysis/LineOfSight/LineOfSightIntersectionResult.js +1 -1
  86. package/views/3d/analysis/LineOfSight/LineOfSightRayIntersector.js +1 -1
  87. package/views/3d/interactive/analysisTools/lineOfSight/LineOfSightTool.js +1 -1
  88. package/views/3d/layers/BuildingComponentSublayerView3D.js +1 -1
  89. package/views/3d/layers/FeatureLikeLayerView3D.js +1 -1
  90. package/views/3d/layers/ImageryLayerView3D.js +1 -1
  91. package/views/3d/layers/RouteLayerView3D.js +1 -1
  92. package/views/3d/layers/SceneLayerGraphicsView3D.js +1 -1
  93. package/views/3d/layers/i3s/I3SNodeLoader.js +1 -1
  94. package/views/3d/layers/support/PopupSceneLayerView.js +1 -1
  95. package/views/3d/support/debugFlags.js +1 -1
  96. package/views/3d/terrain/TerrainSurface.js +1 -1
  97. package/views/3d/webgl-engine/lib/Renderer.js +1 -1
  98. package/views/SceneView.js +1 -1
  99. package/views/layers/ImageryTileLayerView.js +1 -1
  100. package/views/layers/MapImageLayerView.js +1 -1
  101. package/views/layers/TileLayerView.js +1 -1
  102. package/views/support/DefaultsFromMap.js +1 -1
  103. package/widgets/Bookmarks/BookmarksViewModel.js +1 -1
  104. package/widgets/CoordinateConversion/CoordinateConversionViewModel.js +1 -1
  105. package/widgets/Directions/DirectionsViewModel.js +1 -1
  106. package/widgets/Directions.js +1 -1
  107. package/widgets/Editor.js +1 -1
  108. package/widgets/Feature/support/featureUtils.js +1 -1
  109. package/widgets/FeatureForm/InputField.js +1 -1
  110. package/widgets/FeatureTable/support/FeatureStore.js +1 -1
  111. package/widgets/FloorFilter/FloorFilterViewModel.js +1 -1
  112. package/widgets/Legend/support/ActiveLayerInfo.js +1 -1
  113. package/widgets/Popup/actionUtils.js +1 -1
  114. package/widgets/Search/SearchViewModel.js +1 -1
  115. package/assets/esri/core/workers/chunks/113362697da1b69deaed.js +0 -1
  116. package/assets/esri/core/workers/chunks/1e590d63187ada4f5ff7.js +0 -1
  117. package/assets/esri/core/workers/chunks/391a330182c616cfffaf.js +0 -1
  118. package/assets/esri/core/workers/chunks/3a85312fd7d0cda9ce93.js +0 -1
  119. package/assets/esri/core/workers/chunks/3c00e38d3b16f4a53a4f.js +0 -1
  120. package/assets/esri/core/workers/chunks/4a82a6a473b3d540d0be.js +0 -1
  121. package/assets/esri/core/workers/chunks/5b4d9786c010d265346c.js +0 -1
  122. package/assets/esri/core/workers/chunks/bbfc98e33d4630eb9e5c.js +0 -1
  123. package/assets/esri/core/workers/chunks/bd725783b85f308e2c89.js +0 -1
  124. package/assets/esri/core/workers/chunks/d343f05a3366f95e0494.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.24/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../chunks/tslib.es6.js";import"../../geometry.js";import t from"../../Graphic.js";import{read as r,rasterRendererTypes as i,websceneRasterRendererTypes as s}from"../../rasterRenderers.js";import n from"../../request.js";import a from"../../core/Error.js";import{strict as o}from"../../core/jsonMap.js";import{clone as l}from"../../core/lang.js";import u from"../../core/Logger.js";import{isSome as p,isNone as c,unwrap as m}from"../../core/maybe.js";import{when as d}from"../../core/promiseUtils.js";import{urlToObject as h}from"../../core/urlUtils.js";import{aliasOf as f}from"../../core/accessorSupport/decorators/aliasOf.js";import{ensureClass as y,Integer as g,ensureNumber as R}from"../../core/accessorSupport/ensureType.js";import{property as v,ensureRange as b}from"../../core/accessorSupport/decorators/property.js";import{reader as S}from"../../core/accessorSupport/decorators/reader.js";import{subclass as x}from"../../core/accessorSupport/decorators/subclass.js";import{writer as I}from"../../core/accessorSupport/decorators/writer.js";import{opacity as _,url as w}from"../support/commonProperties.js";import F from"../support/DimensionalDefinition.js";import{ExportImageServiceParameters as D}from"../support/ExportImageServiceParameters.js";import P from"../support/Field.js";import T from"../support/FieldsIndex.js";import{isSupportedRendererType as j}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{decode as A,getFormat as z}from"../support/rasterFormats/RasterCodec.js";import{uvComponentToVector as E}from"../support/rasterFunctions/vectorFieldUtils.js";import{getSupportedRendererTypes as Q,getDefaultBandCombination as U,createDefaultRenderer as H,normalizeRendererJSON as L}from"../../renderers/support/rasterRendererHelper.js";import k from"../../renderers/support/RasterSymbolizer.js";import{computeAngles as B,computePixelSpaceLocations as G,computeHistograms as W,computeStatisticsHistograms as X,getImageSpatialReferenceQueryParameter as Y,getSamples as K,identify as $}from"../../rest/imageService.js";import"../../core/unitUtils.js";import"../../kernel.js";import"../../rest/query/support/AttachmentInfo.js";import"../../rest/support/AttachmentQuery.js";import{executeForCount as Z}from"../../rest/query/executeForCount.js";import ee from"../../geometry/Extent.js";import"../../geometry/Geometry.js";import"../../geometry/Multipoint.js";import te from"../../geometry/Point.js";import re from"../../geometry/Polygon.js";import"../../geometry/Polyline.js";import"../../geometry/support/normalizeUtils.js";import"../../core/pbf.js";import"../../geometry/support/spatialReferenceUtils.js";import ie from"../../rest/support/Query.js";import{executeForIds as se}from"../../rest/query/executeForIds.js";import{executeQueryJSON as ne}from"../../rest/query/executeQueryJSON.js";import"../../core/has.js";import"../graphics/featureConversionUtils.js";import ae from"../../rest/support/FeatureSet.js";import"../../rest/support/RelationshipQuery.js";import"../../rest/support/TopFeaturesQuery.js";import oe from"../../rest/support/ImageAngleParameters.js";import le from"../../rest/support/ImageHistogramParameters.js";import ue from"../../rest/support/ImageIdentifyParameters.js";import pe from"../../rest/support/ImagePixelLocationParameters.js";import ce from"../../rest/support/ImageSampleParameters.js";import{createStreamlinesMesh as me}from"../../views/2d/engine/flow/dataUtils.js";import de from"../../geometry/SpatialReference.js";const he=u.getLogger("esri.layers.mixins.ArcGISImageService"),fe=o()({U1:"u1",U2:"u2",U4:"u4",U8:"u8",S8:"s8",U16:"u16",S16:"s16",U32:"u32",S32:"s32",F32:"f32",F64:"f64",C64:"c64",C128:"c128",UNKNOWN:"unknown"}),ye=new Set(["png","png8","png24","png32","jpg","bmp","gif","jpgpng","lerc","tiff"]),ge=b(R,{min:0,max:255});function Re(e){if(!e)return null;const t=JSON.stringify(e).match(/"rasterFunction":"(.*?")/gi),r=null==t?void 0:t.map((e=>e.replace('"rasterFunction":"',"").replace('"',"")));return r?r.join("/"):null}const ve=o=>{let u=class extends o{constructor(){super(...arguments),this._functionRasterInfos={},this._rasterJobHandler={instance:null,refCount:0,connectionPromise:null},this._defaultServiceMosaicRule=null,this._serviceSourceType=null,this._serviceSupportsMosaicRule=null,this.rasterAttributeTableFieldPrefix="Raster.",this.adjustAspectRatio=null,this.bandCount=null,this.bandIds=void 0,this.capabilities=null,this.compressionQuality=void 0,this.compressionTolerance=.01,this.copyright=null,this.definitionExpression=null,this.exportImageServiceParameters=null,this.rasterInfo=null,this.fields=null,this.fullExtent=null,this.hasMultidimensions=!1,this.imageMaxHeight=4100,this.imageMaxWidth=4100,this.interpolation=void 0,this.minScale=0,this.maxScale=0,this.multidimensionalInfo=null,this.noData=null,this.noDataInterpretation=void 0,this.objectIdField=null,this.geometryType="polygon",this.typeIdField=null,this.types=[],this.pixelSizeX=null,this.pixelSizeY=null,this.pixelFilter=null,this.raster=void 0,this.viewId=void 0,this.symbolizer=null,this.rasterAttributeTable=null,this.rasterFunctionInfos=null,this.serviceDataType=null,this.spatialReference=null,this.pixelType=null,this.serviceRasterInfo=null,this.sourceJSON=null,this.url=null,this.version=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 T(this.fields):null}set format(e){e&&ye.has(e.toLowerCase())&&this._set("format",e.toLowerCase())}readFormat(e,t){return"esriImageServiceDataTypeVector-UV"===t.serviceDataType||"esriImageServiceDataTypeVector-MagDir"===t.serviceDataType||null!=this.pixelFilter?"lerc":"jpgpng"}readMinScale(e,t){return null!=t.minLOD&&null!=t.maxLOD?e:0}readMaxScale(e,t){return null!=t.minLOD&&null!=t.maxLOD?e:0}set mosaicRule(e){let t=e;t&&t.mosaicMethod&&(t=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())}writeNoData(e,t,r){null!=e&&"number"==typeof e&&(t[r]=ge(e))}readObjectIdField(e,t){if(!e){const r=t.fields.filter((e=>"esriFieldTypeOID"===e.type||"oid"===e.type));e=r&&r[0]&&r[0].name}return e}get parsedUrl(){return this.url?h(this.url):null}set renderer(e){this.loaded&&(e=this._configRenderer(e)),this._set("renderer",e)}readRenderer(e,t,i){var s,n;const a=null==t||null==(s=t.layerDefinition)||null==(n=s.drawingInfo)?void 0:n.renderer,o=r(a,i);return null==o?null:("vector-field"===o.type&&t.symbolTileSize&&!a.symbolTileSize&&(o.symbolTileSize=t.symbolTileSize),j(o)||he.warn("ArcGISImageService","Imagery layer doesn't support given renderer type."),o)}writeRenderer(e,t,r){t.layerDefinition=t.layerDefinition||{},t.layerDefinition.drawingInfo=t.layerDefinition.drawingInfo||{},t.layerDefinition.drawingInfo.renderer=e.toJSON(),"vector-field"===e.type&&(t.symbolTileSize=e.symbolTileSize)}get rasterFields(){const e=this.rasterAttributeTableFieldPrefix||"Raster.",t=new P({name:"Raster.ItemPixelValue",alias:"Item Pixel Value",domain:null,editable:!1,length:50,type:"string"}),r=new P({name:"Raster.ServicePixelValue",alias:"Service Pixel Value",domain:null,editable:!1,length:50,type:"string"}),i=new P({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 P({name:"Raster.ServicePixelValue."+e.name,alias:e.name,domain:null,editable:!1,length:50,type:"string"}))})),null==this.pixelFilter||"esriImageServiceDataTypeVector-UV"!==this.serviceDataType&&"esriImageServiceDataTypeVector-MagDir"!==this.serviceDataType||(s.push(new P({name:"Raster.Magnitude",alias:"Magnitude",domain:null,editable:!1,type:"double"})),s.push(new P({name:"Raster.Direction",alias:"Direction",domain:null,editable:!1,type:"double"})));const n=this.rasterInfo.attributeTable&&this.rasterInfo.attributeTable.fields||null;if(n&&n.length>0){const t=n.filter((e=>"esriFieldTypeOID"!==e.type&&"value"!==e.name.toLowerCase())).map((t=>{const r=l(t);return r.name=e+t.name,r}));s=s.concat(t)}return s}set renderingRule(e){let t=e;t&&t.rasterFunction&&(t=J.fromJSON({...t.toJSON(),rasterFunction:t.rasterFunction,rasterFunctionArguments:t.rasterFunctionArguments})),this._set("renderingRule",t)}readRenderingRule(e,t){const r=t.rasterFunctionInfos;return t.renderingRule||r&&r.length&&"None"!==r[0].name?this._isRFTJson(t.renderingRule)?J.fromJSON({rasterFunctionDefinition:t.renderingRule}):J.fromJSON(t.renderingRule||{rasterFunctionInfos:t.rasterFunctionInfos}):null}writeRenderingRule(e,t,r){const i=e.toJSON();i.rasterFunctionDefinition?t[r]=i.rasterFunctionDefinition:t[r]=i}readSpatialReference(e,t){const r=e||t.extent.spatialReference;return r?de.fromJSON(r):null}readPixelType(e){return fe.fromJSON(e)||e}writePixelType(e,t,r){(c(this.serviceRasterInfo)||this.pixelType!==this.serviceRasterInfo.pixelType)&&(t[r]=fe.toJSON(e))}readVersion(e,t){let r=t.currentVersion;return r||(r=t.hasOwnProperty("fields")||t.hasOwnProperty("timeInfo")?10:9.3),r}applyFilter(e){let t=e;return this.pixelFilter&&(t=this._clonePixelData(e),this.pixelFilter(t)),t}async applyRenderer(e,t){let r=e;if(!this._isPicture()&&this.renderer&&this.symbolizer&&!this.pixelFilter){const i=JSON.stringify(this._cachedRendererJson)!==JSON.stringify(this.renderer.toJSON()),s=this._rasterJobHandler.instance,{bandIds:n}=this;if(s){i&&(this.symbolizer.bind(),await s.updateSymbolizer(this.symbolizer,t),this._cachedRendererJson=this.renderer.toJSON());const a=await s.symbolize({bandIds:n,...e},t);r={extent:e.extent,pixelBlock:a}}else r={extent:e.extent,pixelBlock:this.symbolizer.symbolize({bandIds:n,...e})}}return r}destroy(){this._shutdownJobHandler()}increaseRasterJobHandlerUsage(){this._rasterJobHandler.refCount++}decreaseRasterJobHandlerUsage(){this._rasterJobHandler.refCount--,this._rasterJobHandler.refCount<=0&&this._shutdownJobHandler()}async computeAngles(e,t){if(await this._fetchCapabilities(null==t?void 0:t.signal),!this.capabilities.operations.supportsComputeAngles)throw new a("imagery-layer:compute-angles","this operation is not supported on the input image service");return e=y(oe,e).clone(),B(this.url,e,this._getRequestOptions(t))}async computePixelSpaceLocations(e,t){if(await this._fetchCapabilities(null==t?void 0:t.signal),!this.capabilities.operations.supportsComputePixelLocation)throw new a("imagery-layer:compute-pixel-space-locations","this operation is not supported on the input image service");return e=y(pe,e).clone(),G(this.url,e,this._getRequestOptions(t))}async computeHistograms(e,t){if(await this._fetchCapabilities(null==t?void 0:t.signal),!this.capabilities.operations.supportsComputeHistograms)throw new a("imagery-layer:compute-histograms","this operation is not supported on the input image service");e=y(le,e).clone();const{raster:r,mosaicRule:i,renderingRule:s}=this;return s&&null==e.renderingRule&&(e.renderingRule=s),i&&null==e.mosaicRule&&(e.mosaicRule=i),r&&null==e.raster&&(e.raster=r),W(this.url,e,this._getRequestOptions(t))}async computeStatisticsHistograms(e,t){if(await this._fetchCapabilities(null==t?void 0:t.signal),!this.capabilities.operations.supportsComputeStatisticsHistograms)throw new a("imagery-layer:compute-statistics-histograms","this operation is not supported on the input image service");e=y(le,e).clone();const{raster:r,mosaicRule:i,renderingRule:s}=this;return s&&null==e.renderingRule&&(e.renderingRule=s),i&&null==e.mosaicRule&&(e.mosaicRule=i),r&&null==e.raster&&(e.raster=r),X(this.url,e,this._getRequestOptions(t))}getField(e){const{fieldsIndex:t}=this;return p(t)?t.get(e):void 0}getFieldDomain(e,t){const r=this.getField(e);return r?r.domain:null}fetchImage(e,t,r,i={}){if(null==e||null==t||null==r)return Promise.reject(new a("imagery-layer:fetch-image","Insufficient parameters for requesting an image. A valid extent, width and height values are required."));const s=this.renderer||this.symbolizer?this.generateRasterInfo(this.renderingRule,{signal:i.signal}):null;return d(s).then((s=>{s&&(this.rasterInfo=s);const n={imageServiceParameters:this.getExportImageServiceParameters(e,t,r,i.timeExtent),imageProps:{extent:e,width:t,height:r,format:this.format},requestAsImageElement:i.requestAsImageElement&&!this.pixelFilter||!1,signal:i.signal};return this._requestArrayBuffer(n)}))}fetchKeyProperties(e){return n(this.parsedUrl.path+"/keyProperties",{query:this._getQueryParams({renderingRule:this.version>=10.3?null==e?void 0:e.renderingRule:null})}).then((e=>e.data))}fetchRasterAttributeTable(e){return this.version<10.1?Promise.reject(new a("#fetchRasterAttributeTable()","Failed to get rasterAttributeTable")):n(this.parsedUrl.path+"/rasterAttributeTable",{query:this._getQueryParams({renderingRule:this.version>=10.3?null==e?void 0:e.renderingRule:null})}).then((e=>ae.fromJSON(e.data)))}async getCatalogItemRasterInfo(e,t){const r=n(this.parsedUrl.path+"/"+e+"/info",{query:this._getQueryParams(),...t}).then((e=>e.data)),i=n(this.parsedUrl.path+"/"+e+"/info/keyProperties",{query:this._getQueryParams(),...t}).then((e=>e.data)).catch((()=>{})),s=await Promise.all([r,i]);if(!s[0])return;const a=ee.fromJSON(s[0].extent),o=s[0].statistics?s[0].statistics.map((e=>({min:e[0],max:e[1],avg:e[2],stddev:e[3]}))):null;return new q({bandCount:s[0].bandCount,extent:a,spatialReference:a.sr,pixelSize:new te({x:s[0].pixelSizeX,y:s[0].pixelSizeY,spatialReference:a.sr}),pixelType:s[0].pixelType.toLowerCase(),statistics:o,histograms:s[0].histograms,keyProperties:s[1]||{}})}async getCatalogItemICSInfo(e,t){const{data:r}=await n(this.parsedUrl.path+"/"+e+"/info/ics",{query:this._getQueryParams(),...t}),i=r&&r.ics;if(!i)return;let s=null;try{s=(await n(this.parsedUrl.path+"/"+e+"/info",{query:this._getQueryParams(),...t})).data.extent}catch{}if(!s||!s.spatialReference)return{ics:i,icsToPixelTransform:null,icsExtent:null,northDirection:null};const a=this.version>=10.7?n(this.parsedUrl.path+"/"+e+"/info/icstopixel",{query:this._getQueryParams(),...t}).then((e=>e.data)).catch((()=>({}))):{},o=s.spatialReference,l={geometries:JSON.stringify({geometryType:"esriGeometryEnvelope",geometries:[s]}),inSR:o.wkid||JSON.stringify(o),outSR:"0:"+e},u=n(this.parsedUrl.path+"/project",{query:this._getQueryParams(l),...t}).then((e=>e.data)).catch((()=>({}))),p=5,c=(s.xmin+s.xmax)/2,m=(s.ymax-s.ymin)/(p+1),d=s.ymin+m,h=[];for(let n=0;n<p;n++)h.push({x:c,y:d+m*n});const f={geometries:JSON.stringify({geometryType:"esriGeometryPoint",geometries:h}),inSR:o.wkid||JSON.stringify(o),outSR:"0:"+e},y=n(this.parsedUrl.path+"/project",{query:this._getQueryParams(f),...t}).then((e=>e.data)).catch((()=>({}))),g=await Promise.all([a,u,y]);let R=g[0].ipxf;if(null==R){var v,b,S;const e=null==(v=i.geodataXform)?void 0:v.xf_0;"topup"===(null==e||null==(b=e.name)?void 0:b.toLowerCase())&&6===(null==e||null==(S=e.coefficients)?void 0:S.length)&&(R={affine:{name:"ics [sensor: Frame] to pixel (column, row) transformation",coefficients:e.coefficients,cellsizeRatio:0,type:"GeometricXform"}})}const x=ee.fromJSON(g[1]&&g[1].geometries&&g[1].geometries[0]);x&&(x.spatialReference=new de({wkid:0,imageCoordinateSystem:i}));const I=g[2].geometries?g[2].geometries.filter((e=>null!=e&&null!=e.x&&null!=e.y&&"NaN"!==e.x&&"NaN"!==e.y)):[],_=I.length;if(_<3)return{ics:i,icsToPixelTransform:R,icsExtent:x,northDirection:null};let w=0,F=0,D=0,P=0;for(let n=0;n<_;n++)w+=I[n].x,F+=I[n].y,D+=I[n].x*I[n].x,P+=I[n].x*I[n].y;const T=(_*P-w*F)/(_*D-w*w);let j=0;const N=I[p-1].x>I[0].x,O=I[p-1].y>I[0].y;return T===1/0?j=O?90:270:0===T?j=N?0:180:T>0?j=N?180*Math.atan(T)/Math.PI:180*Math.atan(T)/Math.PI+180:T<0&&(j=O?180+180*Math.atan(T)/Math.PI:360+180*Math.atan(T)/Math.PI),{ics:i,icsToPixelTransform:R,icsExtent:x,northDirection:j}}async generateRasterInfo(e,t){var r;if((!e||"none"===(null==e||null==(r=e.functionName)?void 0:r.toLowerCase())||this._isVectorFieldResampleFunction(e))&&p(this.serviceRasterInfo))return this.serviceRasterInfo;const i=Re(e);if(this._functionRasterInfos[i])return this._functionRasterInfos[i];const s=this._generateRasterInfo(e,t);this._functionRasterInfos[i]=s;try{return await s}catch{return this._functionRasterInfos[i]=null,null}}getExportImageServiceParameters(e,t,r,i){var s;e=e.clone().shiftCentralMeridian();const n=Y(e.spatialReference,this.parsedUrl.path);p(this.serviceRasterInfo)&&this.pixelType!==this.serviceRasterInfo.pixelType&&(this.exportImageServiceParameters.pixelType=this.pixelType);const a=this.exportImageServiceParameters.toJSON(),{bandIds:o,noData:l}=a;let{renderingRule:u}=a;const c=null==(s=this.renderingRule)?void 0:s.rasterFunctionDefinition,m=!this.renderer||"raster-stretch"===this.renderer.type;if(null!=o&&o.length&&this._hasRenderingRule(this.renderingRule)&&!c&&m){const e={rasterFunction:"ExtractBand",rasterFunctionArguments:{BandIds:o}};if("Stretch"===u.rasterFunction)e.rasterFunctionArguments.Raster=u.rasterFunctionArguments.Raster,u.rasterFunctionArguments.Raster=e;else if("Colormap"===u.rasterFunction){const t=u.rasterFunctionArguments.Raster;"Stretch"===(null==t?void 0:t.rasterFunction)?(e.rasterFunctionArguments.Raster=t.rasterFunctionArguments.Raster,t.rasterFunctionArguments.Raster=e):(e.rasterFunctionArguments.Raster=t,u.rasterFunctionArguments.Raster=e)}else e.rasterFunctionArguments.Raster=u,u=e;a.bandIds=void 0}else a.bandIds=null==o?void 0:o.join(",");l instanceof Array&&l.length>0&&(a.noData=l.join(","));const d=this._serviceSupportsMosaicRule?this._combineMosaicRuleWithTimeExtent(this.exportImageServiceParameters.mosaicRule,i):null;a.mosaicRule=d&&JSON.stringify(d),a.renderingRule=this._getRenderingRuleString(J.fromJSON(u));const h={};if(i){const{start:e,end:t}=i.toJSON();e&&t&&e===t?h.time=""+e:null==e&&null==t||(h.time=`${null==e?"null":e},${null==t?"null":t}`)}return{bbox:e.xmin+","+e.ymin+","+e.xmax+","+e.ymax,bboxSR:n,imageSR:n,size:t+","+r,...a,...h}}async getSamples(e,t){if(await this._fetchCapabilities(null==t?void 0:t.signal),!this.capabilities.operations.supportsGetSamples)throw new a("imagery-layer:get-samples","getSamples operation is not supported on the input image service");e=y(ce,e).clone();const{raster:r}=this;return r&&null==e.raster&&(e.raster=r),K(this.url,e,this._getRequestOptions(t))}async identify(e,t){if(await this._fetchCapabilities(null==t?void 0:t.signal),!this.capabilities.operations.supportsIdentify)throw new a("imagery-layer:query-rasters","query operation is not supported on the input image service");e=y(ue,e).clone();const{raster:r,mosaicRule:i,renderingRule:s}=this;if(s&&null==e.renderingRule&&(e.renderingRule=s),i&&null==e.mosaicRule){const t=this._combineMosaicRuleWithTimeExtent(i,e.timeExtent);e.mosaicRule=m(t)}return r&&null==e.raster&&(e.raster=r),$(this.url,e,this._getRequestOptions(t))}createQuery(){const e=new ie;return e.outFields=["*"],e.returnGeometry=!0,e.where=this.definitionExpression||"1=1",e}async queryRasters(e,t){return({query:e,requestOptions:t}=await this._prepareForQuery(e,t)),ne(this.url,e,t)}async queryObjectIds(e,t){return({query:e,requestOptions:t}=await this._prepareForQuery(e,t)),se(this.url,e,t)}async queryRasterCount(e,t){return({query:e,requestOptions:t}=await this._prepareForQuery(e,t)),Z(this.url,e,t)}async queryVisibleRasters(e,t){if(!e)throw new a("imagery-layer: query-visible-rasters","missing query parameter");const{pixelSize:r,returnDomainValues:i,returnTopmostRaster:s,showNoDataRecords:n}=t||{pixelSize:null,returnDomainValues:!1,returnTopmostRaster:!1,showNoDataRecords:!1};let o=!1,l=null,u=null;const m="raster.servicepixelvalue",d=this.rasterFunctionNamesIndex;if(p(e.outFields)&&(o=e.outFields.some((e=>!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:o,returnGeometry:h,raster:this.raster,maxItemCount:s?1:null});delete g.f;const R=new ue(g);try{var v,b;await this.generateRasterInfo(this.renderingRule);const r=await $(this.url,R,{signal:null==t?void 0:t.signal,query:{...this.customParameters}}),s=e.outFields,a=r.value.toLowerCase().includes("nodata");if(!(o&&!h&&(null==r||null==(v=r.catalogItems)?void 0:v.features.length)&&(n||!a)))return this._processVisibleRastersResponse(r,{returnDomainValues:i,templateRRFunctionNames:u,showNoDataRecords:n,templateFields:s});const l=this.objectIdField||"ObjectId",c=r.catalogItems.features,m=c.map((e=>{var t;return null==(t=e.attributes)?void 0:t[l]})),d=new ie({objectIds:m,returnGeometry:!0,outSpatialReference:e.outSpatialReference,outFields:[l]}),f=await this.queryRasters(d);return null!=f&&null!=(b=f.features)&&b.length&&f.features.forEach((t=>{c.forEach((r=>{r.attributes[l]===t.attributes[l]&&(r.geometry=new re(t.geometry),p(e.outSpatialReference)&&(r.geometry.spatialReference=e.outSpatialReference))}))})),this._processVisibleRastersResponse(r,{returnDomainValues:i,templateRRFunctionNames:u,showNoDataRecords:n,templateFields:s})}catch{throw new a("imagery-layer:query-visible-rasters","encountered error when querying visible rasters")}}async fetchVariableStatisticsHistograms(e,t){const r=n(this.parsedUrl.path+"/statistics",{query:this._getQueryParams({variable:e}),signal:t}).then((e=>{var t;return null==(t=e.data)?void 0:t.statistics})),i=n(this.parsedUrl.path+"/histograms",{query:this._getQueryParams({variable:e}),signal:t}).then((e=>{var t;return null==(t=e.data)?void 0:t.histograms})),s=await Promise.all([r,i]);return s[0]&&s[0].forEach((e=>{e.avg=e.mean,e.stddev=e.standardDeviation})),{statistics:s[0]||null,histograms:s[1]||null}}async createStreamlinesMesh(e,t){const r=this._rasterJobHandler.instance;return r?r.createStreamlinesMesh(e,t):me(e.rendererSettings,e.flowData,p(t.signal)?t.signal:(new AbortController).signal)}async _fetchService(e){await this._fetchServiceInfo(e),p(this.serviceRasterInfo)&&!this.rasterInfo&&(this.rasterInfo=this.serviceRasterInfo);const t=this.sourceJSON,r=p(this.serviceRasterInfo)?Promise.resolve(this.serviceRasterInfo):this._fetchAuxiliaryRasterInfo({serviceInfo:t,signal:e}).then((e=>(this._set("serviceRasterInfo",e),e))),i=this._hasRenderingRule(this.renderingRule)?this.generateRasterInfo(this.renderingRule,{signal:e}):null,s=this._getRasterFunctionInfos();return Promise.all([r,i,s]).then((e=>{e[1]?this._set("rasterInfo",e[1]):this._set("rasterInfo",e[0]),e[2]&&this._set("rasterFunctionInfos",e[2]),this.renderer&&!this._isSupportedRenderer(this.renderer)&&(this._set("renderer",null),he.warn("ArcGISImageService","Switching to the default renderer. Renderer applied is not valid for this Imagery Layer")),this._set("renderer",this._configRenderer(this.renderer)),this.watch("renderingRule",(e=>{(this.renderer||this.symbolizer||this.popupEnabled&&this.popupTemplate)&&this.generateRasterInfo(e).then((e=>{e&&(this.rasterInfo=e)}))}));const t=p(this.serviceRasterInfo)&&this.serviceRasterInfo.multidimensionalInfo;t&&this._updateMultidimensionalDefinition(t)}))}_combineMosaicRuleWithTimeExtent(e,t){const r=this.timeInfo;if(c(e)||c(this.multidimensionalInfo)||c(t)||c(null==r?void 0:r.startField))return e;const{startField:i}=r;var s;if(e=e.clone(),"mosaic-dataset"===this._serviceSourceType)return e.multidimensionalDefinition=null==(s=e.multidimensionalDefinition)?void 0:s.filter((e=>e.dimensionName!==i)),this._cleanupMultidimensionalDefinition(e);e.multidimensionalDefinition=e.multidimensionalDefinition||[];const n=e.multidimensionalDefinition.filter((e=>e.dimensionName===i)),a=p(t.start)?t.start.getTime():null,o=p(t.end)?t.end.getTime():null,l=null==a||null==o||a===o,u=l?[a||o]:[[a,o]],m=this.version>=10.8;if(n.length)n.forEach((e=>{e.dimensionName===i&&(m?(e.dimensionName=null,e.isSlice=null,e.values=null):(e.isSlice=l,e.values=u))}));else if(!m){const t=e.multidimensionalDefinition.filter((e=>null!=e.variableName&&null==e.dimensionName));t.length?t.forEach((e=>{e.dimensionName=i,e.isSlice=l,e.values=u})):e.multidimensionalDefinition.push(new F({variableName:"",dimensionName:i,isSlice:l,values:u}))}return this._cleanupMultidimensionalDefinition(e)}_cleanupMultidimensionalDefinition(e){return c(e)?null:(e.multidimensionalDefinition&&(e.multidimensionalDefinition=e.multidimensionalDefinition.filter((e=>!(!e.variableName&&!e.dimensionName))),0===e.multidimensionalDefinition.length&&(e.multidimensionalDefinition=null)),"mosaic-dataset"!==this._serviceSourceType&&null==e.multidimensionalDefinition?null:e)}async _prepareForQuery(e,t){var r;if(await this._fetchCapabilities(null==(r=t)?void 0:r.signal),!this.capabilities.operations.supportsQuery)throw new a("imagery-layer:query-rasters","query operation is not supported on the input image service");return e=p(e)?y(ie,e):this.createQuery(),t=this._getRequestOptions(t),this.raster&&(t.query={...t.query,raster:this.raster}),{query:e,requestOptions:t}}async _initJobHandler(){if(null!=this._rasterJobHandler.connectionPromise)return this._rasterJobHandler.connectionPromise;const e=new V;this._rasterJobHandler.connectionPromise=e.initialize().then((()=>{this._rasterJobHandler.instance=e}),(()=>null)),await this._rasterJobHandler.connectionPromise}_shutdownJobHandler(){this._rasterJobHandler.instance&&this._rasterJobHandler.instance.destroy(),this._rasterJobHandler.instance=null,this._rasterJobHandler.connectionPromise=null,this._rasterJobHandler.refCount=0}_isSupportedRenderer(e){const{rasterInfo:t,renderingRule:r}=this;return"unique-value"===e.type&&this._hasRenderingRule(r)&&1===t.bandCount&&["u8","s8"].includes(t.pixelType)||Q(this.rasterInfo).includes(this.renderer.type)}async _fetchCapabilities(e){return this.capabilities||await this._fetchServiceInfo(e),this.capabilities}async _fetchServiceInfo(e){var t;let r=this.sourceJSON;if(!r){const{data:t,ssl:i}=await n(this.parsedUrl.path,{query:this._getQueryParams(),signal:e});r=t,this.sourceJSON=r,i&&(this.url=this.url.replace(/^http:/i,"https:"))}if((null==(t=r.capabilities)?void 0:t.toLowerCase().split(",").map((e=>e.trim())).indexOf("tilesonly"))>-1)throw new a("imagery-layer:fetch-service-info","use ImageryTileLayer to open tiles-only image services");this.read(r,{origin:"service",url:this.parsedUrl})}_isMosaicDataset(e){var t;return e.serviceSourceType?"esriImageServiceSourceTypeMosaicDataset"===e.serviceSourceType:(null==(t=e.fields)?void 0:t.length)>0}_isMosaicRuleSupported(e){var t;if(!e)return!1;const r=this._isMosaicDataset(e),i=e.currentVersion>=10.71&&e.hasMultidimensions&&e.timeInfo&&!(e.objectIdField&&(null==(t=e.fields)?void 0:t.length)>1);return r||i}_isVectorFieldResampleFunction(e){if(c(e))return!1;const{functionName:t,functionArguments:r}=e,i="resample"===(null==t?void 0:t.toLowerCase()),s=(null==r?void 0:r.ResampleType)||(null==r?void 0:r.resampleType);return i&&(7===s||10===s)}_isPicture(){return!this.format||this.format.includes("jpg")||this.format.includes("png")}_configRenderer(e){if(!this._isPicture()&&!this.pixelFilter){if(!this.bandIds&&this.rasterInfo.bandCount>=3){const e=U(this.rasterInfo);!e||3===this.rasterInfo.bandCount&&0===e[0]&&1===e[1]&&2===e[2]||(this.bandIds=e)}var t,r;if(!e)e=H(this.rasterInfo,{bandIds:this.bandIds,variableName:this.renderingRule?null:null==(t=this.mosaicRule)||null==(r=t.multidimensionalDefinition)?void 0:r[0].variableName});const i=L(e.toJSON());this.symbolizer?(this.symbolizer.rendererJSON=i,this.symbolizer.rasterInfo=this.rasterInfo):this.symbolizer=new k({rendererJSON:i,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(null==e?void 0:e.renderingRule)&&"string"!=typeof e.renderingRule&&(e.renderingRule=this._getRenderingRuleString(e.renderingRule));const{raster:t,viewId:r}=this;return{raster:t,viewId:r,f:"json",...e,...this.customParameters}}_getRequestOptions(e){return{...e,query:{...null==e?void 0:e.query,...this.customParameters}}}_decodePixelBlock(e,t,r){return this._rasterJobHandler.instance?this._rasterJobHandler.instance.decode({data:e,options:t}):A(e,t,r)}async _fetchMultidimensionalInfo(e){var t;const r=await n(this.parsedUrl.path+"/multidimensionalInfo",{query:this._getQueryParams(),signal:e}).then((e=>{var t;return null==(t=e.data)?void 0:t.multidimensionalInfo}));return null!=(t=r.variables)&&t.length&&r.variables.forEach((e=>{var t;null!=(t=e.statistics)&&t.length&&e.statistics.forEach((e=>{e.avg=e.mean,e.stddev=e.standardDeviation}))})),r}async _getRasterFunctionInfos(e){const t=this.sourceJSON.rasterFunctionInfos;if(this.serviceRasterInfo)return t;if(t&&this.version>=10.3){var r;if(1===t.length&&"none"===t[0].name.toLowerCase())return t;return null==(r=(await n(this.parsedUrl.path+"/rasterFunctionInfos",{query:this._getQueryParams(),signal:e})).data)?void 0:r.rasterFunctionInfos}return null}async _fetchAuxiliaryRasterInfo(e){const t=e&&e.serviceInfo;if(!t)return Promise.reject(new a("imagery-layer:fetch-metadata","valid serviceInfo is required"));const r=e.signal,i=!!(t.hasRasterAttributeTable&&this.version>=10.1)&&n(this.parsedUrl.path+"/rasterAttributeTable",{query:this._getQueryParams({renderingRule:this.version>=10.1?null==e?void 0:e.renderingRule:null}),signal:r}).then((e=>ae.fromJSON(e.data))).catch((()=>null)),s=!!(t.hasColormap&&this.version>=10.1)&&n(this.parsedUrl.path+"/colormap",{query:this._getQueryParams({renderingRule:this.version>=10.6?null==e?void 0:e.renderingRule:null}),signal:r}).then((e=>{var t;return null==(t=e.data)?void 0:t.colormap})),o=!!(t.hasHistograms&&this.version>=10.1)&&n(this.parsedUrl.path+"/histograms",{query:this._getQueryParams({renderingRule:this.version>=10.1?null==e?void 0:e.renderingRule:null}),signal:r}).then((e=>{var t;return null==(t=e.data)?void 0:t.histograms})),l=this.version>=10.3&&n(this.parsedUrl.path+"/keyProperties",{query:this._getQueryParams({renderingRule:null==e?void 0:e.renderingRule}),signal:r}).then((e=>e.data)).catch((()=>{})),u=!!(t.hasMultidimensions&&this.version>=10.3)&&this._fetchMultidimensionalInfo(),p=await Promise.all([i,s,o,l,u]);let c=null;if(t.minValues&&t.minValues.length===t.bandCount){c=[];for(let e=0;e<t.minValues.length;e++)c.push({min:t.minValues[e],max:t.maxValues[e],avg:t.meanValues[e],stddev:t.stdvValues[e]})}const m=Math.ceil((t.extent.xmax-t.extent.xmin)/t.pixelSizeX-.1),d=Math.ceil((t.extent.ymax-t.extent.ymin)/t.pixelSizeY-.1),h=de.fromJSON(t.spatialReference||t.extent.spatialReference);return new q({width:m,height:d,bandCount:t.bandCount,extent:ee.fromJSON(t.extent),spatialReference:h,pixelSize:new te({x:t.pixelSizeX,y:t.pixelSizeY,spatialReference:h}),pixelType:t.pixelType.toLowerCase(),statistics:c,attributeTable:p[0]||null,colormap:p[1]||null,histograms:p[2]||null,keyProperties:p[3]||{},multidimensionalInfo:p[4]||null})}async _requestArrayBuffer(e){var t;const{imageProps:r,requestAsImageElement:i,signal:s}=e;if(i&&!this.pixelFilter&&(null==(t=r.format)?void 0:t.indexOf("png"))>-1){return{imageElement:(await n(this.parsedUrl.path+"/exportImage",{responseType:"image",query:this._getQueryParams({f:"image",...e.imageServiceParameters}),signal:s})).data,params:r}}const o=this._initJobHandler(),l=n(this.parsedUrl.path+"/exportImage",{responseType:"array-buffer",query:this._getQueryParams({f:"image",...e.imageServiceParameters}),signal:s}),u=(await Promise.all([l,o]))[0].data,p=r.format||"jpgpng";let c=p;if("bsq"!==c&&"bip"!==c&&(c=z(u)),!c)throw new a("imagery-layer:fetch-image","unsupported format signature "+String.fromCharCode.apply(null,new Uint8Array(u)));const m={signal:s},d="gif"===p||"bmp"===p||p.includes("png")&&("png"===c||"jpg"===c)?A(u,{useCanvas:!0,...r},m):this._decodePixelBlock(u,{width:r.width,height:r.height,planes:null,pixelType:null,noDataValue:null,format:p},m);return{pixelData:{pixelBlock:await d,extent:r.extent},params:r}}async _generateRasterInfo(e,t){const{data:r}=await n(this.parsedUrl.path,{query:this._getQueryParams({renderingRule:e}),...t});return await this._fetchAuxiliaryRasterInfo({serviceInfo:r,renderingRule:e,...t})}_isValidCustomizedMosaicRule(e){var t;return e&&JSON.stringify(e.toJSON())!==JSON.stringify(null==(t=this._defaultServiceMosaicRule)?void 0:t.toJSON())}_updateMultidimensionalDefinition(e){if(this._isValidCustomizedMosaicRule(this.mosaicRule))return;const t=e.variables[0].dimensions,r="",i=[];for(const s in t)if(t.hasOwnProperty(s)){const e=t[s],n=e.extent;let a=!0,o=[n[0]];e.hasRanges&&!0===e.hasRanges?(a=!1,o=[e.values[0]]):"stdz"===e.name.toLowerCase()&&Math.abs(n[1])<=Math.abs(n[0])&&(o=[n[1]]),i.push(new F({variableName:r,dimensionName:t[s].name,isSlice:a,values:o}))}if(i.length>0){this.mosaicRule=this.mosaicRule||new N;const e=this.mosaicRule.multidimensionalDefinition;(!e||e&&e.length<=0)&&(this.mosaicRule.multidimensionalDefinition=i)}}_formatAttributeValue(e,t){if("string"==typeof e){const r=this.popupTemplate&&this.popupTemplate.fieldInfos,i=this._getFieldInfo(r,t),s=i&&i.format;if(s){let t,r;return e.trim().includes(",")?(t=",",r=t+" ",this._formatDelimitedString(e,t,r,s)):e.trim().includes(";")?(t=";",r=t+" ",this._formatDelimitedString(e,t,r,s)):e.trim().includes(" ")?(t=r=" ",this._formatDelimitedString(e,t,r,s)):this._formatNumberFromString(e,s)}}return e}_getFieldInfo(e,t){if(!e||!e.length||!t)return;const r=t.toLowerCase();let i;return e.some((e=>!(!e.fieldName||e.fieldName.toLowerCase()!==r&&e.fieldName.toLowerCase()!==r.replace(/ /g,"_"))&&(i=e,!0))),i}_formatDelimitedString(e,t,r,i){return e&&t&&r&&i?e.trim().split(t).map((e=>this._formatNumberFromString(e,i))).join(r):e}_formatNumberFromString(e,t){if(!e||!t)return e;const r=Number(e);return isNaN(r)?e:t.format(r)}_processVisibleRastersResponse(e,r){r=r||{};const i=e.value,{templateRRFunctionNames:s,showNoDataRecords:n,returnDomainValues:a,templateFields:o}=r,l=e.processedValues;let u=e.catalogItems&&e.catalogItems.features,c=e.properties&&e.properties.Values&&e.properties.Values.map((e=>e.replace(/ /gi,", ")))||[];const m=this.objectIdField||"ObjectId",d="string"==typeof i&&i.toLowerCase().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,o),d&&!n&&(u=[]);for(let t=0;t<u.length;t++){if(f=u[t],null!=i){if(y=c[t],g=this.renderingRule&&l&&l.length>0&&s&&s.length>0&&s.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]=this._formatAttributeValue(y,e),f.attributes[r]=this._formatAttributeValue(g,r),this._updateFeatureWithMagDirValues(f,y);const a=this.fields&&this.fields.length>0;let o=this.renderingRule&&p(this.serviceRasterInfo)&&this.serviceRasterInfo.attributeTable?a?y:i:g;this.renderingRule||(o=a?y:i),this._updateFeatureWithRasterAttributeTableValues(f,o)}if(f.sourceLayer=f.layer=this,a&&this._updateFeatureWithDomainValues(f),s&&l&&s.length===l.length)for(let e=0;e<s.length;e++){const t="Raster.ServicePixelValue."+s[e];f.attributes[t]=this._formatAttributeValue(l[e],t)}h.push(u[t])}return h}_updateFeatureWithRasterAttributeTableValues(e,t){const r=this.rasterInfo&&this.rasterInfo.attributeTable||p(this.serviceRasterInfo)&&this.serviceRasterInfo.attributeTable,i=r&&r.features;if(!i)return;const s=r.fields,n=s.map((e=>e.name)).filter((e=>"value"===e.toLowerCase())),a=n&&n[0];if(!a)return;const o=i.filter((e=>e.attributes[a]===(null!=t?parseInt(t,10):null)));o&&o[0]&&s.forEach((t=>{const r=this.rasterAttributeTableFieldPrefix+t.name;e.attributes[r]=this._formatAttributeValue(o[0].attributes[t.name],r)}))}_updateFeatureWithMagDirValues(e,t){if("esriImageServiceDataTypeVector-UV"!==this.serviceDataType&&"esriImageServiceDataTypeVector-MagDir"!==this.serviceDataType)return;const r=t.split(/,\s*/).map((e=>parseFloat(e))),i=r.map((e=>[e])),s=r.map((e=>({minValue:e,maxValue:e,noDataValue:null}))),n=new O({height:1,width:1,pixelType:"f32",pixels:i,statistics:s});null!=this.pixelFilter&&this.pixelFilter({pixelBlock:n,extent:new ee(0,0,0,0,this.spatialReference)});const a="esriImageServiceDataTypeVector-MagDir"===this.serviceDataType?[n.pixels[0][0],n.pixels[1][0]]:E([n.pixels[0][0],n.pixels[1][0]]);e.attributes["Raster.Magnitude"]=a[0],e.attributes["Raster.Direction"]=a[1]}_updateFeatureWithDomainValues(e){const t=this.fields&&this.fields.filter((e=>e.domain&&"coded-value"===e.domain.type));null!=t&&t.forEach((t=>{const r=e.attributes[t.name];if(null!=r){const i=t.domain.codedValues.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)){var t;let r=e.toJSON();return r=null!=(t=r.rasterFunctionDefinition)?t:r,(r.thumbnail||r.thumbnailEx)&&(r.thumbnail=r.thumbnailEx=null),JSON.stringify(r)}return null}_hasRenderingRule(e){return e&&e.functionName&&"none"!==e.functionName.toLowerCase()}_updateRenderingRulesFunctionName(e,t){if(!e||e.length<1)return;if("Raw"===e)return e.replace("Raw","None");const r=e.toLowerCase().replace(/ /gi,"_");return t.has(r)?t.get(r):e}_isRFTJson(e){return e&&e.name&&e.arguments&&e.function&&e.hasOwnProperty("functionType")}_readCapabilities(e){const t=e.capabilities?e.capabilities.toLowerCase().split(",").map((e=>e.trim())):["image","catalog"],{currentVersion:r,advancedQueryCapabilities:i,maxRecordCount:s}=e,n=t.includes("image"),a="esriImageServiceDataTypeElevation"===e.serviceDataType,o=!!(e.spatialReference||e.extent&&e.extent.spatialReference),l=t.includes("edit");return{data:{supportsAttachment:!1},operations:{supportsComputeHistograms:n,supportsExportImage:n,supportsIdentify:n,supportsMeasure:t.includes("mensuration")&&o,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&&a,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},query:{maxRecordCount:s,maxRecordCountFactor:void 0,supportsStatistics:!(null==i||!i.supportsStatistics),supportsOrderBy:!(null==i||!i.supportsOrderBy),supportsDistinct:!(null==i||!i.supportsDistinct),supportsPagination:!(null==i||!i.supportsPagination),supportsStandardizedQueriesOnly:!(null==i||!i.useStandardizedQueries),supportsPercentileStatistics:!(null==i||!i.supportsPercentileStatistics),supportsCentroid:!(null==i||!i.supportsReturningGeometryCentroid),supportsDistance:!(null==i||!i.supportsQueryWithDistance),supportsExtent:!(null==i||!i.supportsReturningQueryExtent),supportsGeometryProperties:!(null==i||!i.supportsReturningGeometryProperties),supportsHavingClause:!(null==i||!i.supportsHavingClause),supportsQuantization:!1,supportsQuantizationEditMode:!1,supportsQueryGeometry:!1,supportsResultType:!1,supportsMaxRecordCountFactor:!1,supportsSqlExpression:!1,supportsTopFeaturesQuery:!1,supportsQueryByOthers:!1,supportsHistoricMoment:!1,supportsFormatPBF:!1,supportsDisjointSpatialRelationship:!1,supportsCacheHint:!1,supportsSpatialAggregationStatistics:!1,supportedSpatialAggregationStatistics:{envelope:!1,centroid:!1,convexHull:!1},supportsDefaultSpatialReference:!(null==i||!i.supportsDefaultSR),supportsCompactGeometry:!1,standardMaxRecordCount:void 0,tileMaxRecordCount:void 0}}}};return e([v()],u.prototype,"_functionRasterInfos",void 0),e([v()],u.prototype,"_rasterJobHandler",void 0),e([v({dependsOn:["_serviceSupportsMosaicRule"]})],u.prototype,"_defaultServiceMosaicRule",void 0),e([S("_defaultServiceMosaicRule",["defaultMosaicMethod"])],u.prototype,"readDefaultServiceMosaicRule",null),e([v()],u.prototype,"_cachedRendererJson",void 0),e([v({readOnly:!0})],u.prototype,"_serviceSourceType",void 0),e([S("_serviceSourceType",["serviceSourceType","fields"])],u.prototype,"readServiceSourceType",null),e([v({readOnly:!0})],u.prototype,"_serviceSupportsMosaicRule",void 0),e([S("_serviceSupportsMosaicRule",["currentVersion","fields"])],u.prototype,"readServiceSupportsMosaicRule",null),e([v()],u.prototype,"rasterAttributeTableFieldPrefix",void 0),e([v({readOnly:!0})],u.prototype,"rasterFunctionNamesIndex",null),e([v()],u.prototype,"adjustAspectRatio",void 0),e([v({readOnly:!0}),f("serviceRasterInfo.bandCount")],u.prototype,"bandCount",void 0),e([v({type:[g],json:{write:!0}})],u.prototype,"bandIds",void 0),e([S("bandIds")],u.prototype,"readBandIds",null),e([v({readOnly:!0,json:{read:!1}})],u.prototype,"capabilities",void 0),e([S("service","capabilities",["capabilities","currentVersion","serviceDataType"])],u.prototype,"readCapabilities",null),e([v({type:Number})],u.prototype,"compressionQuality",void 0),e([I("compressionQuality")],u.prototype,"writeCompressionQuality",null),e([v({type:Number})],u.prototype,"compressionTolerance",void 0),e([I("compressionTolerance")],u.prototype,"writeCompressionTolerance",null),e([v({json:{read:{source:"copyrightText"}}})],u.prototype,"copyright",void 0),e([v({type:String,json:{name:"layerDefinition.definitionExpression",write:{enabled:!0,allowNull:!0}}})],u.prototype,"definitionExpression",void 0),e([v({readOnly:!0,constructOnly:!0})],u.prototype,"exportImageServiceParameters",void 0),e([v()],u.prototype,"rasterInfo",void 0),e([v({readOnly:!0,type:[P]})],u.prototype,"fields",void 0),e([v({readOnly:!0})],u.prototype,"fieldsIndex",null),e([v({type:["png","png8","png24","png32","jpg","bmp","gif","jpgpng","lerc","tiff"],json:{write:!0}})],u.prototype,"format",null),e([S("service","format",["serviceDataType"])],u.prototype,"readFormat",null),e([v({type:ee})],u.prototype,"fullExtent",void 0),e([v({readOnly:!0})],u.prototype,"hasMultidimensions",void 0),e([v({json:{read:{source:"maxImageHeight"}}})],u.prototype,"imageMaxHeight",void 0),e([v({json:{read:{source:"maxImageWidth"}}})],u.prototype,"imageMaxWidth",void 0),e([v({type:String,json:{type:C.jsonValues,read:C.read,write:C.write}})],u.prototype,"interpolation",void 0),e([v()],u.prototype,"minScale",void 0),e([S("service","minScale")],u.prototype,"readMinScale",null),e([v()],u.prototype,"maxScale",void 0),e([S("service","maxScale")],u.prototype,"readMaxScale",null),e([v({type:N})],u.prototype,"mosaicRule",null),e([S("mosaicRule",["mosaicRule","defaultMosaicMethod"])],u.prototype,"readMosaicRule",null),e([I("mosaicRule")],u.prototype,"writeMosaicRule",null),e([v({readOnly:!0}),f("serviceRasterInfo.multidimensionalInfo")],u.prototype,"multidimensionalInfo",void 0),e([v({json:{type:g}})],u.prototype,"noData",void 0),e([I("noData")],u.prototype,"writeNoData",null),e([v({type:String,json:{type:M.jsonValues,read:M.read,write:M.write}})],u.prototype,"noDataInterpretation",void 0),e([v({type:String,readOnly:!0,json:{read:{source:["fields"]}}})],u.prototype,"objectIdField",void 0),e([S("objectIdField")],u.prototype,"readObjectIdField",null),e([v({})],u.prototype,"geometryType",void 0),e([v({})],u.prototype,"typeIdField",void 0),e([v({})],u.prototype,"types",void 0),e([v({readOnly:!0})],u.prototype,"parsedUrl",null),e([v({readOnly:!0}),f("serviceRasterInfo.pixelSize.x")],u.prototype,"pixelSizeX",void 0),e([v({readOnly:!0}),f("serviceRasterInfo.pixelSize.y")],u.prototype,"pixelSizeY",void 0),e([v({type:Function})],u.prototype,"pixelFilter",void 0),e([v()],u.prototype,"raster",void 0),e([v()],u.prototype,"viewId",void 0),e([v({types:i,json:{name:"layerDefinition.drawingInfo.renderer",origins:{"web-scene":{types:s,name:"layerDefinition.drawingInfo.renderer",write:{overridePolicy:e=>({enabled:e&&"vector-field"!==e.type&&"flow"!==e.type})}}}}})],u.prototype,"renderer",null),e([S("renderer")],u.prototype,"readRenderer",null),e([I("renderer")],u.prototype,"writeRenderer",null),e([v()],u.prototype,"symbolizer",void 0),e([v(_)],u.prototype,"opacity",void 0),e([v({readOnly:!0}),f("serviceRasterInfo.attributeTable")],u.prototype,"rasterAttributeTable",void 0),e([v({readOnly:!0})],u.prototype,"rasterFields",null),e([v({constructOnly:!0})],u.prototype,"rasterFunctionInfos",void 0),e([v({type:J})],u.prototype,"renderingRule",null),e([S("renderingRule",["renderingRule","rasterFunctionInfos"])],u.prototype,"readRenderingRule",null),e([I("renderingRule")],u.prototype,"writeRenderingRule",null),e([v()],u.prototype,"serviceDataType",void 0),e([v({readOnly:!0,type:de})],u.prototype,"spatialReference",void 0),e([S("spatialReference",["spatialReference","extent"])],u.prototype,"readSpatialReference",null),e([v({json:{type:fe.jsonValues}})],u.prototype,"pixelType",void 0),e([S("pixelType")],u.prototype,"readPixelType",null),e([I("pixelType")],u.prototype,"writePixelType",null),e([v({constructOnly:!0,type:q})],u.prototype,"serviceRasterInfo",void 0),e([v()],u.prototype,"sourceJSON",void 0),e([v(w)],u.prototype,"url",void 0),e([v({readOnly:!0})],u.prototype,"version",void 0),e([S("version",["currentVersion","fields","timeInfo"])],u.prototype,"readVersion",null),u=e([x("esri.layers.mixins.ArcGISImageService")],u),u};export{ve as ArcGISImageService};
5
+ import{_ as e}from"../../chunks/tslib.es6.js";import"../../geometry.js";import t from"../../Graphic.js";import{read as r,rasterRendererTypes as i,websceneRasterRendererTypes as s}from"../../rasterRenderers.js";import n from"../../request.js";import a from"../../core/Error.js";import{strict as o}from"../../core/jsonMap.js";import{clone as l}from"../../core/lang.js";import u from"../../core/Logger.js";import{isSome as p,isNone as c,unwrap as m}from"../../core/maybe.js";import{when as d}from"../../core/promiseUtils.js";import{urlToObject as h}from"../../core/urlUtils.js";import{aliasOf as f}from"../../core/accessorSupport/decorators/aliasOf.js";import{ensureClass as y,Integer as g,ensureNumber as R}from"../../core/accessorSupport/ensureType.js";import{property as v,ensureRange as b}from"../../core/accessorSupport/decorators/property.js";import{reader as S}from"../../core/accessorSupport/decorators/reader.js";import{subclass as x}from"../../core/accessorSupport/decorators/subclass.js";import{writer as I}from"../../core/accessorSupport/decorators/writer.js";import{opacity as w,url as _}from"../support/commonProperties.js";import F from"../support/DimensionalDefinition.js";import{ExportImageServiceParameters as D}from"../support/ExportImageServiceParameters.js";import P from"../support/Field.js";import T from"../support/FieldsIndex.js";import{isSupportedRendererType as j}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{decode as A,getFormat as z}from"../support/rasterFormats/RasterCodec.js";import{uvComponentToVector as E}from"../support/rasterFunctions/vectorFieldUtils.js";import{getSupportedRendererTypes as Q,getDefaultBandCombination as U,createDefaultRenderer as H,normalizeRendererJSON as L}from"../../renderers/support/rasterRendererHelper.js";import k from"../../renderers/support/RasterSymbolizer.js";import{computeAngles as B,computePixelSpaceLocations as G,computeHistograms as W,computeStatisticsHistograms as X,getImageSpatialReferenceQueryParameter as Y,getSamples as K,identify as $}from"../../rest/imageService.js";import"../../core/unitUtils.js";import"../../kernel.js";import"../../rest/query/support/AttachmentInfo.js";import"../../rest/support/AttachmentQuery.js";import{executeForCount as Z}from"../../rest/query/executeForCount.js";import ee from"../../geometry/Extent.js";import"../../geometry/Geometry.js";import"../../geometry/Multipoint.js";import te from"../../geometry/Point.js";import re from"../../geometry/Polygon.js";import"../../geometry/Polyline.js";import"../../geometry/support/normalizeUtils.js";import"../../core/pbf.js";import"../../geometry/support/spatialReferenceUtils.js";import ie from"../../rest/support/Query.js";import{executeForIds as se}from"../../rest/query/executeForIds.js";import{executeQueryJSON as ne}from"../../rest/query/executeQueryJSON.js";import"../../core/has.js";import"../graphics/featureConversionUtils.js";import ae from"../../rest/support/FeatureSet.js";import"../../rest/support/RelationshipQuery.js";import"../../rest/support/TopFeaturesQuery.js";import oe from"../../rest/support/ImageAngleParameters.js";import le from"../../rest/support/ImageHistogramParameters.js";import ue from"../../rest/support/ImageIdentifyParameters.js";import pe from"../../rest/support/ImagePixelLocationParameters.js";import ce from"../../rest/support/ImageSampleParameters.js";import{createStreamlinesMesh as me}from"../../views/2d/engine/flow/dataUtils.js";import de from"../../geometry/SpatialReference.js";const he=u.getLogger("esri.layers.mixins.ArcGISImageService"),fe=o()({U1:"u1",U2:"u2",U4:"u4",U8:"u8",S8:"s8",U16:"u16",S16:"s16",U32:"u32",S32:"s32",F32:"f32",F64:"f64",C64:"c64",C128:"c128",UNKNOWN:"unknown"}),ye=new Set(["png","png8","png24","png32","jpg","bmp","gif","jpgpng","lerc","tiff"]),ge=b(R,{min:0,max:255});function Re(e){if(!e)return null;const t=JSON.stringify(e).match(/"rasterFunction":"(.*?")/gi),r=null==t?void 0:t.map((e=>e.replace('"rasterFunction":"',"").replace('"',"")));return r?r.join("/"):null}const ve=o=>{let u=class extends o{constructor(){super(...arguments),this._functionRasterInfos={},this._rasterJobHandler={instance:null,refCount:0,connectionPromise:null},this._defaultServiceMosaicRule=null,this._serviceSourceType=null,this._serviceSupportsMosaicRule=null,this.rasterAttributeTableFieldPrefix="Raster.",this.adjustAspectRatio=null,this.bandCount=null,this.bandIds=void 0,this.capabilities=null,this.compressionQuality=void 0,this.compressionTolerance=.01,this.copyright=null,this.definitionExpression=null,this.exportImageServiceParameters=null,this.rasterInfo=null,this.fields=null,this.fullExtent=null,this.hasMultidimensions=!1,this.imageMaxHeight=4100,this.imageMaxWidth=4100,this.interpolation=void 0,this.minScale=0,this.maxScale=0,this.multidimensionalInfo=null,this.noData=null,this.noDataInterpretation=void 0,this.objectIdField=null,this.geometryType="polygon",this.typeIdField=null,this.types=[],this.pixelSizeX=null,this.pixelSizeY=null,this.pixelFilter=null,this.raster=void 0,this.viewId=void 0,this.symbolizer=null,this.rasterAttributeTable=null,this.rasterFunctionInfos=null,this.serviceDataType=null,this.spatialReference=null,this.pixelType=null,this.serviceRasterInfo=null,this.sourceJSON=null,this.url=null,this.version=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 T(this.fields):null}set format(e){e&&ye.has(e.toLowerCase())&&this._set("format",e.toLowerCase())}readFormat(e,t){return"esriImageServiceDataTypeVector-UV"===t.serviceDataType||"esriImageServiceDataTypeVector-MagDir"===t.serviceDataType||null!=this.pixelFilter?"lerc":"jpgpng"}readMinScale(e,t){return null!=t.minLOD&&null!=t.maxLOD?e:0}readMaxScale(e,t){return null!=t.minLOD&&null!=t.maxLOD?e:0}set mosaicRule(e){let t=e;t&&t.mosaicMethod&&(t=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())}writeNoData(e,t,r){null!=e&&"number"==typeof e&&(t[r]=ge(e))}readObjectIdField(e,t){if(!e){const r=t.fields.filter((e=>"esriFieldTypeOID"===e.type||"oid"===e.type));e=r&&r[0]&&r[0].name}return e}get parsedUrl(){return this.url?h(this.url):null}set renderer(e){this.loaded&&(e=this._configRenderer(e)),this._set("renderer",e)}readRenderer(e,t,i){var s,n;const a=null==t||null==(s=t.layerDefinition)||null==(n=s.drawingInfo)?void 0:n.renderer,o=r(a,i);return null==o?null:("vector-field"===o.type&&t.symbolTileSize&&!a.symbolTileSize&&(o.symbolTileSize=t.symbolTileSize),j(o)||he.warn("ArcGISImageService","Imagery layer doesn't support given renderer type."),o)}writeRenderer(e,t,r){t.layerDefinition=t.layerDefinition||{},t.layerDefinition.drawingInfo=t.layerDefinition.drawingInfo||{},t.layerDefinition.drawingInfo.renderer=e.toJSON(),"vector-field"===e.type&&(t.symbolTileSize=e.symbolTileSize)}get rasterFields(){const e=this.rasterAttributeTableFieldPrefix||"Raster.",t=new P({name:"Raster.ItemPixelValue",alias:"Item Pixel Value",domain:null,editable:!1,length:50,type:"string"}),r=new P({name:"Raster.ServicePixelValue",alias:"Service Pixel Value",domain:null,editable:!1,length:50,type:"string"}),i=new P({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 P({name:"Raster.ServicePixelValue."+e.name,alias:e.name,domain:null,editable:!1,length:50,type:"string"}))})),null==this.pixelFilter||"esriImageServiceDataTypeVector-UV"!==this.serviceDataType&&"esriImageServiceDataTypeVector-MagDir"!==this.serviceDataType||(s.push(new P({name:"Raster.Magnitude",alias:"Magnitude",domain:null,editable:!1,type:"double"})),s.push(new P({name:"Raster.Direction",alias:"Direction",domain:null,editable:!1,type:"double"})));const n=this.rasterInfo.attributeTable&&this.rasterInfo.attributeTable.fields||null;if(n&&n.length>0){const t=n.filter((e=>"esriFieldTypeOID"!==e.type&&"value"!==e.name.toLowerCase())).map((t=>{const r=l(t);return r.name=e+t.name,r}));s=s.concat(t)}return s}set renderingRule(e){let t=e;t&&t.rasterFunction&&(t=J.fromJSON({...t.toJSON(),rasterFunction:t.rasterFunction,rasterFunctionArguments:t.rasterFunctionArguments})),this._set("renderingRule",t)}readRenderingRule(e,t){const r=t.rasterFunctionInfos;return t.renderingRule||r&&r.length&&"None"!==r[0].name?this._isRFTJson(t.renderingRule)?J.fromJSON({rasterFunctionDefinition:t.renderingRule}):J.fromJSON(t.renderingRule||{rasterFunctionInfos:t.rasterFunctionInfos}):null}writeRenderingRule(e,t,r){const i=e.toJSON();i.rasterFunctionDefinition?t[r]=i.rasterFunctionDefinition:t[r]=i}readSpatialReference(e,t){const r=e||t.extent.spatialReference;return r?de.fromJSON(r):null}readPixelType(e){return fe.fromJSON(e)||e}writePixelType(e,t,r){(c(this.serviceRasterInfo)||this.pixelType!==this.serviceRasterInfo.pixelType)&&(t[r]=fe.toJSON(e))}readVersion(e,t){let r=t.currentVersion;return r||(r=t.hasOwnProperty("fields")||t.hasOwnProperty("timeInfo")?10:9.3),r}applyFilter(e){let t=e;return this.pixelFilter&&(t=this._clonePixelData(e),this.pixelFilter(t)),t}async applyRenderer(e,t){let r=e;if(!this._isPicture()&&this.renderer&&this.symbolizer&&!this.pixelFilter){const i=JSON.stringify(this._cachedRendererJson)!==JSON.stringify(this.renderer.toJSON()),s=this._rasterJobHandler.instance,{bandIds:n}=this;if(s){i&&(this.symbolizer.bind(),await s.updateSymbolizer(this.symbolizer,t),this._cachedRendererJson=this.renderer.toJSON());const a=await s.symbolize({bandIds:n,...e},t);r={extent:e.extent,pixelBlock:a}}else r={extent:e.extent,pixelBlock:this.symbolizer.symbolize({bandIds:n,...e})}}return r}destroy(){this._shutdownJobHandler()}increaseRasterJobHandlerUsage(){this._rasterJobHandler.refCount++}decreaseRasterJobHandlerUsage(){this._rasterJobHandler.refCount--,this._rasterJobHandler.refCount<=0&&this._shutdownJobHandler()}async computeAngles(e,t){if(await this._fetchCapabilities(null==t?void 0:t.signal),!this.capabilities.operations.supportsComputeAngles)throw new a("imagery-layer:compute-angles","this operation is not supported on the input image service");return e=y(oe,e).clone(),B(this.url,e,this._getRequestOptions(t))}async computePixelSpaceLocations(e,t){if(await this._fetchCapabilities(null==t?void 0:t.signal),!this.capabilities.operations.supportsComputePixelLocation)throw new a("imagery-layer:compute-pixel-space-locations","this operation is not supported on the input image service");return e=y(pe,e).clone(),G(this.url,e,this._getRequestOptions(t))}async computeHistograms(e,t){if(await this._fetchCapabilities(null==t?void 0:t.signal),!this.capabilities.operations.supportsComputeHistograms)throw new a("imagery-layer:compute-histograms","this operation is not supported on the input image service");e=y(le,e).clone();const{raster:r,mosaicRule:i,renderingRule:s}=this;return s&&null==e.renderingRule&&(e.renderingRule=s),i&&null==e.mosaicRule&&(e.mosaicRule=i),r&&null==e.raster&&(e.raster=r),W(this.url,e,this._getRequestOptions(t))}async computeStatisticsHistograms(e,t){if(await this._fetchCapabilities(null==t?void 0:t.signal),!this.capabilities.operations.supportsComputeStatisticsHistograms)throw new a("imagery-layer:compute-statistics-histograms","this operation is not supported on the input image service");e=y(le,e).clone();const{raster:r,mosaicRule:i,renderingRule:s}=this;return s&&null==e.renderingRule&&(e.renderingRule=s),i&&null==e.mosaicRule&&(e.mosaicRule=i),r&&null==e.raster&&(e.raster=r),X(this.url,e,this._getRequestOptions(t))}getField(e){const{fieldsIndex:t}=this;return p(t)?t.get(e):void 0}getFieldDomain(e,t){const r=this.getField(e);return r?r.domain:null}fetchImage(e,t,r,i={}){if(null==e||null==t||null==r)return Promise.reject(new a("imagery-layer:fetch-image","Insufficient parameters for requesting an image. A valid extent, width and height values are required."));const s=this.renderer||this.symbolizer?this.generateRasterInfo(this.renderingRule,{signal:i.signal}):null;return d(s).then((s=>{s&&(this.rasterInfo=s);const n={imageServiceParameters:this.getExportImageServiceParameters(e,t,r,i.timeExtent),imageProps:{extent:e,width:t,height:r,format:this.format},requestAsImageElement:i.requestAsImageElement&&!this.pixelFilter||!1,signal:i.signal};return this._requestArrayBuffer(n)}))}fetchKeyProperties(e){return n(this.parsedUrl.path+"/keyProperties",{query:this._getQueryParams({renderingRule:this.version>=10.3?null==e?void 0:e.renderingRule:null})}).then((e=>e.data))}fetchRasterAttributeTable(e){return this.version<10.1?Promise.reject(new a("#fetchRasterAttributeTable()","Failed to get rasterAttributeTable")):n(this.parsedUrl.path+"/rasterAttributeTable",{query:this._getQueryParams({renderingRule:this.version>=10.3?null==e?void 0:e.renderingRule:null})}).then((e=>ae.fromJSON(e.data)))}async getCatalogItemRasterInfo(e,t){const r=n(this.parsedUrl.path+"/"+e+"/info",{query:this._getQueryParams(),...t}).then((e=>e.data)),i=n(this.parsedUrl.path+"/"+e+"/info/keyProperties",{query:this._getQueryParams(),...t}).then((e=>e.data)).catch((()=>{})),s=await Promise.all([r,i]);if(!s[0])return;const a=ee.fromJSON(s[0].extent),o=s[0].statistics?s[0].statistics.map((e=>({min:e[0],max:e[1],avg:e[2],stddev:e[3]}))):null;return new q({bandCount:s[0].bandCount,extent:a,spatialReference:a.sr,pixelSize:new te({x:s[0].pixelSizeX,y:s[0].pixelSizeY,spatialReference:a.sr}),pixelType:s[0].pixelType.toLowerCase(),statistics:o,histograms:s[0].histograms,keyProperties:s[1]||{}})}async getCatalogItemICSInfo(e,t){const{data:r}=await n(this.parsedUrl.path+"/"+e+"/info/ics",{query:this._getQueryParams(),...t}),i=r&&r.ics;if(!i)return;let s=null;try{s=(await n(this.parsedUrl.path+"/"+e+"/info",{query:this._getQueryParams(),...t})).data.extent}catch{}if(!s||!s.spatialReference)return{ics:i,icsToPixelTransform:null,icsExtent:null,northDirection:null};const a=this.version>=10.7?n(this.parsedUrl.path+"/"+e+"/info/icstopixel",{query:this._getQueryParams(),...t}).then((e=>e.data)).catch((()=>({}))):{},o=s.spatialReference,l={geometries:JSON.stringify({geometryType:"esriGeometryEnvelope",geometries:[s]}),inSR:o.wkid||JSON.stringify(o),outSR:"0:"+e},u=n(this.parsedUrl.path+"/project",{query:this._getQueryParams(l),...t}).then((e=>e.data)).catch((()=>({}))),p=5,c=(s.xmin+s.xmax)/2,m=(s.ymax-s.ymin)/(p+1),d=s.ymin+m,h=[];for(let n=0;n<p;n++)h.push({x:c,y:d+m*n});const f={geometries:JSON.stringify({geometryType:"esriGeometryPoint",geometries:h}),inSR:o.wkid||JSON.stringify(o),outSR:"0:"+e},y=n(this.parsedUrl.path+"/project",{query:this._getQueryParams(f),...t}).then((e=>e.data)).catch((()=>({}))),g=await Promise.all([a,u,y]);let R=g[0].ipxf;if(null==R){var v,b,S;const e=null==(v=i.geodataXform)?void 0:v.xf_0;"topup"===(null==e||null==(b=e.name)?void 0:b.toLowerCase())&&6===(null==e||null==(S=e.coefficients)?void 0:S.length)&&(R={affine:{name:"ics [sensor: Frame] to pixel (column, row) transformation",coefficients:e.coefficients,cellsizeRatio:0,type:"GeometricXform"}})}const x=ee.fromJSON(g[1]&&g[1].geometries&&g[1].geometries[0]);x&&(x.spatialReference=new de({wkid:0,imageCoordinateSystem:i}));const I=g[2].geometries?g[2].geometries.filter((e=>null!=e&&null!=e.x&&null!=e.y&&"NaN"!==e.x&&"NaN"!==e.y)):[],w=I.length;if(w<3)return{ics:i,icsToPixelTransform:R,icsExtent:x,northDirection:null};let _=0,F=0,D=0,P=0;for(let n=0;n<w;n++)_+=I[n].x,F+=I[n].y,D+=I[n].x*I[n].x,P+=I[n].x*I[n].y;const T=(w*P-_*F)/(w*D-_*_);let j=0;const N=I[p-1].x>I[0].x,O=I[p-1].y>I[0].y;return T===1/0?j=O?90:270:0===T?j=N?0:180:T>0?j=N?180*Math.atan(T)/Math.PI:180*Math.atan(T)/Math.PI+180:T<0&&(j=O?180+180*Math.atan(T)/Math.PI:360+180*Math.atan(T)/Math.PI),{ics:i,icsToPixelTransform:R,icsExtent:x,northDirection:j}}async generateRasterInfo(e,t){var r;if((!e||"none"===(null==e||null==(r=e.functionName)?void 0:r.toLowerCase())||this._isVectorFieldResampleFunction(e))&&p(this.serviceRasterInfo))return this.serviceRasterInfo;const i=Re(e);if(this._functionRasterInfos[i])return this._functionRasterInfos[i];const s=this._generateRasterInfo(e,t);this._functionRasterInfos[i]=s;try{return await s}catch{return this._functionRasterInfos[i]=null,null}}getExportImageServiceParameters(e,t,r,i){var s;e=e.clone().shiftCentralMeridian();const n=Y(e.spatialReference,this.parsedUrl.path);p(this.serviceRasterInfo)&&this.pixelType!==this.serviceRasterInfo.pixelType&&(this.exportImageServiceParameters.pixelType=this.pixelType);const a=this.exportImageServiceParameters.toJSON(),{bandIds:o,noData:l}=a;let{renderingRule:u}=a;const c=null==(s=this.renderingRule)?void 0:s.rasterFunctionDefinition,m=!this.renderer||"raster-stretch"===this.renderer.type;if(null!=o&&o.length&&this._hasRenderingRule(this.renderingRule)&&!c&&m){const e={rasterFunction:"ExtractBand",rasterFunctionArguments:{BandIds:o}};if("Stretch"===u.rasterFunction)e.rasterFunctionArguments.Raster=u.rasterFunctionArguments.Raster,u.rasterFunctionArguments.Raster=e;else if("Colormap"===u.rasterFunction){const t=u.rasterFunctionArguments.Raster;"Stretch"===(null==t?void 0:t.rasterFunction)?(e.rasterFunctionArguments.Raster=t.rasterFunctionArguments.Raster,t.rasterFunctionArguments.Raster=e):(e.rasterFunctionArguments.Raster=t,u.rasterFunctionArguments.Raster=e)}else e.rasterFunctionArguments.Raster=u,u=e;a.bandIds=void 0}else a.bandIds=null==o?void 0:o.join(",");l instanceof Array&&l.length>0&&(a.noData=l.join(","));const d=this._serviceSupportsMosaicRule?this._combineMosaicRuleWithTimeExtent(this.exportImageServiceParameters.mosaicRule,i):null;a.mosaicRule=d&&JSON.stringify(d),a.renderingRule=this._getRenderingRuleString(J.fromJSON(u));const h={};if(i){const{start:e,end:t}=i.toJSON();e&&t&&e===t?h.time=""+e:null==e&&null==t||(h.time=`${null==e?"null":e},${null==t?"null":t}`)}return{bbox:e.xmin+","+e.ymin+","+e.xmax+","+e.ymax,bboxSR:n,imageSR:n,size:t+","+r,...a,...h}}async getSamples(e,t){if(await this._fetchCapabilities(null==t?void 0:t.signal),!this.capabilities.operations.supportsGetSamples)throw new a("imagery-layer:get-samples","getSamples operation is not supported on the input image service");e=y(ce,e).clone();const{raster:r}=this;return r&&null==e.raster&&(e.raster=r),K(this.url,e,this._getRequestOptions(t))}async identify(e,t){if(await this._fetchCapabilities(null==t?void 0:t.signal),!this.capabilities.operations.supportsIdentify)throw new a("imagery-layer:query-rasters","query operation is not supported on the input image service");e=y(ue,e).clone();const{raster:r,mosaicRule:i,renderingRule:s}=this;if(s&&null==e.renderingRule&&(e.renderingRule=s),i&&null==e.mosaicRule){const t=this._combineMosaicRuleWithTimeExtent(i,e.timeExtent);e.mosaicRule=m(t)}return r&&null==e.raster&&(e.raster=r),$(this.url,e,this._getRequestOptions(t))}createQuery(){const e=new ie;return e.outFields=["*"],e.returnGeometry=!0,e.where=this.definitionExpression||"1=1",e}async queryRasters(e,t){return({query:e,requestOptions:t}=await this._prepareForQuery(e,t)),ne(this.url,e,t)}async queryObjectIds(e,t){return({query:e,requestOptions:t}=await this._prepareForQuery(e,t)),se(this.url,e,t)}async queryRasterCount(e,t){return({query:e,requestOptions:t}=await this._prepareForQuery(e,t)),Z(this.url,e,t)}async queryVisibleRasters(e,t){if(!e)throw new a("imagery-layer: query-visible-rasters","missing query parameter");const{pixelSize:r,returnDomainValues:i,returnTopmostRaster:s,showNoDataRecords:n}=t||{pixelSize:null,returnDomainValues:!1,returnTopmostRaster:!1,showNoDataRecords:!1};let o=!1,l=null,u=null;const m="raster.servicepixelvalue",d=this.rasterFunctionNamesIndex;if(p(e.outFields)&&(o=e.outFields.some((e=>!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:o,returnGeometry:h,raster:this.raster,maxItemCount:s?1:null});delete g.f;const R=new ue(g);try{var v,b;await this.generateRasterInfo(this.renderingRule);const r=await $(this.url,R,{signal:null==t?void 0:t.signal,query:{...this.customParameters}}),s=e.outFields,a=r.value.toLowerCase().includes("nodata");if(!(o&&!h&&(null==r||null==(v=r.catalogItems)?void 0:v.features.length)&&(n||!a)))return this._processVisibleRastersResponse(r,{returnDomainValues:i,templateRRFunctionNames:u,showNoDataRecords:n,templateFields:s});const l=this.objectIdField||"ObjectId",c=r.catalogItems.features,m=c.map((e=>{var t;return null==(t=e.attributes)?void 0:t[l]})),d=new ie({objectIds:m,returnGeometry:!0,outSpatialReference:e.outSpatialReference,outFields:[l]}),f=await this.queryRasters(d);return null!=f&&null!=(b=f.features)&&b.length&&f.features.forEach((t=>{c.forEach((r=>{r.attributes[l]===t.attributes[l]&&(r.geometry=new re(t.geometry),p(e.outSpatialReference)&&(r.geometry.spatialReference=e.outSpatialReference))}))})),this._processVisibleRastersResponse(r,{returnDomainValues:i,templateRRFunctionNames:u,showNoDataRecords:n,templateFields:s})}catch{throw new a("imagery-layer:query-visible-rasters","encountered error when querying visible rasters")}}async fetchVariableStatisticsHistograms(e,t){const r=n(this.parsedUrl.path+"/statistics",{query:this._getQueryParams({variable:e}),signal:t}).then((e=>{var t;return null==(t=e.data)?void 0:t.statistics})),i=n(this.parsedUrl.path+"/histograms",{query:this._getQueryParams({variable:e}),signal:t}).then((e=>{var t;return null==(t=e.data)?void 0:t.histograms})),s=await Promise.all([r,i]);return s[0]&&s[0].forEach((e=>{e.avg=e.mean,e.stddev=e.standardDeviation})),{statistics:s[0]||null,histograms:s[1]||null}}async createStreamlinesMesh(e,t){const r=this._rasterJobHandler.instance;return r?r.createStreamlinesMesh(e,t):me(e.rendererSettings,e.flowData,p(t.signal)?t.signal:(new AbortController).signal)}async _fetchService(e){await this._fetchServiceInfo(e),p(this.serviceRasterInfo)&&!this.rasterInfo&&(this.rasterInfo=this.serviceRasterInfo);const t=this.sourceJSON,r=p(this.serviceRasterInfo)?Promise.resolve(this.serviceRasterInfo):this._fetchAuxiliaryRasterInfo({serviceInfo:t,signal:e}).then((e=>(this._set("serviceRasterInfo",e),e))),i=this._hasRenderingRule(this.renderingRule)?this.generateRasterInfo(this.renderingRule,{signal:e}):null,s=this._getRasterFunctionInfos();return Promise.all([r,i,s]).then((e=>{e[1]?this._set("rasterInfo",e[1]):this._set("rasterInfo",e[0]),e[2]&&this._set("rasterFunctionInfos",e[2]),this.renderer&&!this._isSupportedRenderer(this.renderer)&&(this._set("renderer",null),he.warn("ArcGISImageService","Switching to the default renderer. Renderer applied is not valid for this Imagery Layer")),this._set("renderer",this._configRenderer(this.renderer)),this.watch("renderingRule",(e=>{(this.renderer||this.symbolizer||this.popupEnabled&&this.popupTemplate)&&this.generateRasterInfo(e).then((e=>{e&&(this.rasterInfo=e)}))}));const t=p(this.serviceRasterInfo)&&this.serviceRasterInfo.multidimensionalInfo;t&&this._updateMultidimensionalDefinition(t)}))}_combineMosaicRuleWithTimeExtent(e,t){const r=this.timeInfo;if(c(e)||c(this.multidimensionalInfo)||c(t)||c(null==r?void 0:r.startField))return e;const{startField:i}=r;var s;if(e=e.clone(),"mosaic-dataset"===this._serviceSourceType)return e.multidimensionalDefinition=null==(s=e.multidimensionalDefinition)?void 0:s.filter((e=>e.dimensionName!==i)),this._cleanupMultidimensionalDefinition(e);e.multidimensionalDefinition=e.multidimensionalDefinition||[];const n=e.multidimensionalDefinition.filter((e=>e.dimensionName===i)),a=p(t.start)?t.start.getTime():null,o=p(t.end)?t.end.getTime():null,l=null==a||null==o||a===o,u=l?[a||o]:[[a,o]],m=this.version>=10.8;if(n.length)n.forEach((e=>{e.dimensionName===i&&(m?(e.dimensionName=null,e.isSlice=null,e.values=null):(e.isSlice=l,e.values=u))}));else if(!m){const t=e.multidimensionalDefinition.filter((e=>null!=e.variableName&&null==e.dimensionName));t.length?t.forEach((e=>{e.dimensionName=i,e.isSlice=l,e.values=u})):e.multidimensionalDefinition.push(new F({variableName:"",dimensionName:i,isSlice:l,values:u}))}return this._cleanupMultidimensionalDefinition(e)}_cleanupMultidimensionalDefinition(e){return c(e)?null:(e.multidimensionalDefinition&&(e.multidimensionalDefinition=e.multidimensionalDefinition.filter((e=>!(!e.variableName&&!e.dimensionName))),0===e.multidimensionalDefinition.length&&(e.multidimensionalDefinition=null)),"mosaic-dataset"!==this._serviceSourceType&&null==e.multidimensionalDefinition?null:e)}async _prepareForQuery(e,t){var r;if(await this._fetchCapabilities(null==(r=t)?void 0:r.signal),!this.capabilities.operations.supportsQuery)throw new a("imagery-layer:query-rasters","query operation is not supported on the input image service");return e=p(e)?y(ie,e):this.createQuery(),t=this._getRequestOptions(t),this.raster&&(t.query={...t.query,raster:this.raster}),{query:e,requestOptions:t}}async _initJobHandler(){if(null!=this._rasterJobHandler.connectionPromise)return this._rasterJobHandler.connectionPromise;const e=new V;this._rasterJobHandler.connectionPromise=e.initialize().then((()=>{this._rasterJobHandler.instance=e}),(()=>null)),await this._rasterJobHandler.connectionPromise}_shutdownJobHandler(){this._rasterJobHandler.instance&&this._rasterJobHandler.instance.destroy(),this._rasterJobHandler.instance=null,this._rasterJobHandler.connectionPromise=null,this._rasterJobHandler.refCount=0}_isSupportedRenderer(e){const{rasterInfo:t,renderingRule:r}=this;return"unique-value"===e.type&&this._hasRenderingRule(r)&&1===t.bandCount&&["u8","s8"].includes(t.pixelType)||Q(this.rasterInfo).includes(this.renderer.type)}async _fetchCapabilities(e){return this.capabilities||await this._fetchServiceInfo(e),this.capabilities}async _fetchServiceInfo(e){var t;let r=this.sourceJSON;if(!r){const{data:t,ssl:i}=await n(this.parsedUrl.path,{query:this._getQueryParams(),signal:e});r=t,this.sourceJSON=r,i&&(this.url=this.url.replace(/^http:/i,"https:"))}if((null==(t=r.capabilities)?void 0:t.toLowerCase().split(",").map((e=>e.trim())).indexOf("tilesonly"))>-1)throw new a("imagery-layer:fetch-service-info","use ImageryTileLayer to open tiles-only image services");this.read(r,{origin:"service",url:this.parsedUrl})}_isMosaicDataset(e){var t;return e.serviceSourceType?"esriImageServiceSourceTypeMosaicDataset"===e.serviceSourceType:(null==(t=e.fields)?void 0:t.length)>0}_isMosaicRuleSupported(e){var t;if(!e)return!1;const r=this._isMosaicDataset(e),i=e.currentVersion>=10.71&&e.hasMultidimensions&&e.timeInfo&&!(e.objectIdField&&(null==(t=e.fields)?void 0:t.length)>1);return r||i}_isVectorFieldResampleFunction(e){if(c(e))return!1;const{functionName:t,functionArguments:r}=e,i="resample"===(null==t?void 0:t.toLowerCase()),s=(null==r?void 0:r.ResampleType)||(null==r?void 0:r.resampleType);return i&&(7===s||10===s)}_isPicture(){return!this.format||this.format.includes("jpg")||this.format.includes("png")}_configRenderer(e){if(!this._isPicture()&&!this.pixelFilter){if(!this.bandIds&&this.rasterInfo.bandCount>=3){const e=U(this.rasterInfo);!e||3===this.rasterInfo.bandCount&&0===e[0]&&1===e[1]&&2===e[2]||(this.bandIds=e)}var t,r;if(!e)e=H(this.rasterInfo,{bandIds:this.bandIds,variableName:this.renderingRule?null:null==(t=this.mosaicRule)||null==(r=t.multidimensionalDefinition)?void 0:r[0].variableName});const i=L(e.toJSON());this.symbolizer?(this.symbolizer.rendererJSON=i,this.symbolizer.rasterInfo=this.rasterInfo):this.symbolizer=new k({rendererJSON:i,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(null==e?void 0:e.renderingRule)&&"string"!=typeof e.renderingRule&&(e.renderingRule=this._getRenderingRuleString(e.renderingRule));const{raster:t,viewId:r}=this;return{raster:t,viewId:r,f:"json",...e,...this.customParameters}}_getRequestOptions(e){return{...e,query:{...null==e?void 0:e.query,...this.customParameters}}}_decodePixelBlock(e,t,r){return this._rasterJobHandler.instance?this._rasterJobHandler.instance.decode({data:e,options:t}):A(e,t,r)}async _fetchMultidimensionalInfo(e){var t;const r=await n(this.parsedUrl.path+"/multidimensionalInfo",{query:this._getQueryParams(),signal:e}).then((e=>{var t;return null==(t=e.data)?void 0:t.multidimensionalInfo}));return null!=(t=r.variables)&&t.length&&r.variables.forEach((e=>{var t;null!=(t=e.statistics)&&t.length&&e.statistics.forEach((e=>{e.avg=e.mean,e.stddev=e.standardDeviation}))})),r}async _getRasterFunctionInfos(e){const t=this.sourceJSON.rasterFunctionInfos;if(this.serviceRasterInfo)return t;if(t&&this.version>=10.3){var r;if(1===t.length&&"none"===t[0].name.toLowerCase())return t;return null==(r=(await n(this.parsedUrl.path+"/rasterFunctionInfos",{query:this._getQueryParams(),signal:e})).data)?void 0:r.rasterFunctionInfos}return null}async _fetchAuxiliaryRasterInfo(e){const t=e&&e.serviceInfo;if(!t)throw new a("imagery-layer:fetch-metadata","valid serviceInfo is required");const r=e.signal,i=!!(t.hasRasterAttributeTable&&this.version>=10.1)&&n(this.parsedUrl.path+"/rasterAttributeTable",{query:this._getQueryParams({renderingRule:this.version>=10.1?null==e?void 0:e.renderingRule:null}),signal:r}).then((e=>ae.fromJSON(e.data))).catch((()=>null)),s=!!(t.hasColormap&&this.version>=10.1)&&n(this.parsedUrl.path+"/colormap",{query:this._getQueryParams({renderingRule:this.version>=10.6?null==e?void 0:e.renderingRule:null}),signal:r}).then((e=>{var t;return null==(t=e.data)?void 0:t.colormap})),o=!!(t.hasHistograms&&this.version>=10.1)&&n(this.parsedUrl.path+"/histograms",{query:this._getQueryParams({renderingRule:this.version>=10.1?null==e?void 0:e.renderingRule:null}),signal:r}).then((e=>{var t;return null==(t=e.data)?void 0:t.histograms})),l=this.version>=10.3&&n(this.parsedUrl.path+"/keyProperties",{query:this._getQueryParams({renderingRule:null==e?void 0:e.renderingRule}),signal:r}).then((e=>e.data)).catch((()=>{})),u=!!(t.hasMultidimensions&&this.version>=10.3)&&this._fetchMultidimensionalInfo(),p=await Promise.all([i,s,o,l,u]);let c=null;if(t.minValues&&t.minValues.length===t.bandCount){c=[];for(let e=0;e<t.minValues.length;e++)c.push({min:t.minValues[e],max:t.maxValues[e],avg:t.meanValues[e],stddev:t.stdvValues[e]})}const m=Math.ceil((t.extent.xmax-t.extent.xmin)/t.pixelSizeX-.1),d=Math.ceil((t.extent.ymax-t.extent.ymin)/t.pixelSizeY-.1),h=de.fromJSON(t.spatialReference||t.extent.spatialReference);return new q({width:m,height:d,bandCount:t.bandCount,extent:ee.fromJSON(t.extent),spatialReference:h,pixelSize:new te({x:t.pixelSizeX,y:t.pixelSizeY,spatialReference:h}),pixelType:t.pixelType.toLowerCase(),statistics:c,attributeTable:p[0]||null,colormap:p[1]||null,histograms:p[2]||null,keyProperties:p[3]||{},multidimensionalInfo:p[4]||null})}async _requestArrayBuffer(e){var t;const{imageProps:r,requestAsImageElement:i,signal:s}=e;if(i&&!this.pixelFilter&&(null==(t=r.format)?void 0:t.indexOf("png"))>-1){return{imageElement:(await n(this.parsedUrl.path+"/exportImage",{responseType:"image",query:this._getQueryParams({f:"image",...e.imageServiceParameters}),signal:s})).data,params:r}}const o=this._initJobHandler(),l=n(this.parsedUrl.path+"/exportImage",{responseType:"array-buffer",query:this._getQueryParams({f:"image",...e.imageServiceParameters}),signal:s}),u=(await Promise.all([l,o]))[0].data,p=r.format||"jpgpng";let c=p;if("bsq"!==c&&"bip"!==c&&(c=z(u)),!c)throw new a("imagery-layer:fetch-image","unsupported format signature "+String.fromCharCode.apply(null,new Uint8Array(u)));const m={signal:s},d="gif"===p||"bmp"===p||p.includes("png")&&("png"===c||"jpg"===c)?A(u,{useCanvas:!0,...r},m):this._decodePixelBlock(u,{width:r.width,height:r.height,planes:null,pixelType:null,noDataValue:null,format:p},m);return{pixelData:{pixelBlock:await d,extent:r.extent},params:r}}async _generateRasterInfo(e,t){const{data:r}=await n(this.parsedUrl.path,{query:this._getQueryParams({renderingRule:e}),...t});return await this._fetchAuxiliaryRasterInfo({serviceInfo:r,renderingRule:e,...t})}_isValidCustomizedMosaicRule(e){var t;return e&&JSON.stringify(e.toJSON())!==JSON.stringify(null==(t=this._defaultServiceMosaicRule)?void 0:t.toJSON())}_updateMultidimensionalDefinition(e){if(this._isValidCustomizedMosaicRule(this.mosaicRule))return;const t=e.variables[0].dimensions,r="",i=[];for(const s in t)if(t.hasOwnProperty(s)){const e=t[s],n=e.extent;let a=!0,o=[n[0]];e.hasRanges&&!0===e.hasRanges?(a=!1,o=[e.values[0]]):"stdz"===e.name.toLowerCase()&&Math.abs(n[1])<=Math.abs(n[0])&&(o=[n[1]]),i.push(new F({variableName:r,dimensionName:t[s].name,isSlice:a,values:o}))}if(i.length>0){this.mosaicRule=this.mosaicRule||new N;const e=this.mosaicRule.multidimensionalDefinition;(!e||e&&e.length<=0)&&(this.mosaicRule.multidimensionalDefinition=i)}}_formatAttributeValue(e,t){if("string"==typeof e){const r=this.popupTemplate&&this.popupTemplate.fieldInfos,i=this._getFieldInfo(r,t),s=i&&i.format;if(s){let t,r;return e.trim().includes(",")?(t=",",r=t+" ",this._formatDelimitedString(e,t,r,s)):e.trim().includes(";")?(t=";",r=t+" ",this._formatDelimitedString(e,t,r,s)):e.trim().includes(" ")?(t=r=" ",this._formatDelimitedString(e,t,r,s)):this._formatNumberFromString(e,s)}}return e}_getFieldInfo(e,t){if(!e||!e.length||!t)return;const r=t.toLowerCase();let i;return e.some((e=>!(!e.fieldName||e.fieldName.toLowerCase()!==r&&e.fieldName.toLowerCase()!==r.replace(/ /g,"_"))&&(i=e,!0))),i}_formatDelimitedString(e,t,r,i){return e&&t&&r&&i?e.trim().split(t).map((e=>this._formatNumberFromString(e,i))).join(r):e}_formatNumberFromString(e,t){if(!e||!t)return e;const r=Number(e);return isNaN(r)?e:t.format(r)}_processVisibleRastersResponse(e,r){r=r||{};const i=e.value,{templateRRFunctionNames:s,showNoDataRecords:n,returnDomainValues:a,templateFields:o}=r,l=e.processedValues;let u=e.catalogItems&&e.catalogItems.features,c=e.properties&&e.properties.Values&&e.properties.Values.map((e=>e.replace(/ /gi,", ")))||[];const m=this.objectIdField||"ObjectId",d="string"==typeof i&&i.toLowerCase().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,o),d&&!n&&(u=[]);for(let t=0;t<u.length;t++){if(f=u[t],null!=i){if(y=c[t],g=this.renderingRule&&l&&l.length>0&&s&&s.length>0&&s.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]=this._formatAttributeValue(y,e),f.attributes[r]=this._formatAttributeValue(g,r),this._updateFeatureWithMagDirValues(f,y);const a=this.fields&&this.fields.length>0;let o=this.renderingRule&&p(this.serviceRasterInfo)&&this.serviceRasterInfo.attributeTable?a?y:i:g;this.renderingRule||(o=a?y:i),this._updateFeatureWithRasterAttributeTableValues(f,o)}if(f.sourceLayer=f.layer=this,a&&this._updateFeatureWithDomainValues(f),s&&l&&s.length===l.length)for(let e=0;e<s.length;e++){const t="Raster.ServicePixelValue."+s[e];f.attributes[t]=this._formatAttributeValue(l[e],t)}h.push(u[t])}return h}_updateFeatureWithRasterAttributeTableValues(e,t){const r=this.rasterInfo&&this.rasterInfo.attributeTable||p(this.serviceRasterInfo)&&this.serviceRasterInfo.attributeTable,i=r&&r.features;if(!i)return;const s=r.fields,n=s.map((e=>e.name)).filter((e=>"value"===e.toLowerCase())),a=n&&n[0];if(!a)return;const o=i.filter((e=>e.attributes[a]===(null!=t?parseInt(t,10):null)));o&&o[0]&&s.forEach((t=>{const r=this.rasterAttributeTableFieldPrefix+t.name;e.attributes[r]=this._formatAttributeValue(o[0].attributes[t.name],r)}))}_updateFeatureWithMagDirValues(e,t){if("esriImageServiceDataTypeVector-UV"!==this.serviceDataType&&"esriImageServiceDataTypeVector-MagDir"!==this.serviceDataType)return;const r=t.split(/,\s*/).map((e=>parseFloat(e))),i=r.map((e=>[e])),s=r.map((e=>({minValue:e,maxValue:e,noDataValue:null}))),n=new O({height:1,width:1,pixelType:"f32",pixels:i,statistics:s});null!=this.pixelFilter&&this.pixelFilter({pixelBlock:n,extent:new ee(0,0,0,0,this.spatialReference)});const a="esriImageServiceDataTypeVector-MagDir"===this.serviceDataType?[n.pixels[0][0],n.pixels[1][0]]:E([n.pixels[0][0],n.pixels[1][0]]);e.attributes["Raster.Magnitude"]=a[0],e.attributes["Raster.Direction"]=a[1]}_updateFeatureWithDomainValues(e){const t=this.fields&&this.fields.filter((e=>e.domain&&"coded-value"===e.domain.type));null!=t&&t.forEach((t=>{const r=e.attributes[t.name];if(null!=r){const i=t.domain.codedValues.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)){var t;let r=e.toJSON();return r=null!=(t=r.rasterFunctionDefinition)?t:r,(r.thumbnail||r.thumbnailEx)&&(r.thumbnail=r.thumbnailEx=null),JSON.stringify(r)}return null}_hasRenderingRule(e){return e&&e.functionName&&"none"!==e.functionName.toLowerCase()}_updateRenderingRulesFunctionName(e,t){if(!e||e.length<1)return;if("Raw"===e)return e.replace("Raw","None");const r=e.toLowerCase().replace(/ /gi,"_");return t.has(r)?t.get(r):e}_isRFTJson(e){return e&&e.name&&e.arguments&&e.function&&e.hasOwnProperty("functionType")}_readCapabilities(e){const t=e.capabilities?e.capabilities.toLowerCase().split(",").map((e=>e.trim())):["image","catalog"],{currentVersion:r,advancedQueryCapabilities:i,maxRecordCount:s}=e,n=t.includes("image"),a="esriImageServiceDataTypeElevation"===e.serviceDataType,o=!!(e.spatialReference||e.extent&&e.extent.spatialReference),l=t.includes("edit");return{data:{supportsAttachment:!1},operations:{supportsComputeHistograms:n,supportsExportImage:n,supportsIdentify:n,supportsMeasure:t.includes("mensuration")&&o,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&&a,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},query:{maxRecordCount:s,maxRecordCountFactor:void 0,supportsStatistics:!(null==i||!i.supportsStatistics),supportsOrderBy:!(null==i||!i.supportsOrderBy),supportsDistinct:!(null==i||!i.supportsDistinct),supportsPagination:!(null==i||!i.supportsPagination),supportsStandardizedQueriesOnly:!(null==i||!i.useStandardizedQueries),supportsPercentileStatistics:!(null==i||!i.supportsPercentileStatistics),supportsCentroid:!(null==i||!i.supportsReturningGeometryCentroid),supportsDistance:!(null==i||!i.supportsQueryWithDistance),supportsExtent:!(null==i||!i.supportsReturningQueryExtent),supportsGeometryProperties:!(null==i||!i.supportsReturningGeometryProperties),supportsHavingClause:!(null==i||!i.supportsHavingClause),supportsQuantization:!1,supportsQuantizationEditMode:!1,supportsQueryGeometry:!1,supportsResultType:!1,supportsMaxRecordCountFactor:!1,supportsSqlExpression:!1,supportsTopFeaturesQuery:!1,supportsQueryByOthers:!1,supportsHistoricMoment:!1,supportsFormatPBF:!1,supportsDisjointSpatialRelationship:!1,supportsCacheHint:!1,supportsSpatialAggregationStatistics:!1,supportedSpatialAggregationStatistics:{envelope:!1,centroid:!1,convexHull:!1},supportsDefaultSpatialReference:!(null==i||!i.supportsDefaultSR),supportsCompactGeometry:!1,standardMaxRecordCount:void 0,tileMaxRecordCount:void 0}}}};return e([v()],u.prototype,"_functionRasterInfos",void 0),e([v()],u.prototype,"_rasterJobHandler",void 0),e([v({dependsOn:["_serviceSupportsMosaicRule"]})],u.prototype,"_defaultServiceMosaicRule",void 0),e([S("_defaultServiceMosaicRule",["defaultMosaicMethod"])],u.prototype,"readDefaultServiceMosaicRule",null),e([v()],u.prototype,"_cachedRendererJson",void 0),e([v({readOnly:!0})],u.prototype,"_serviceSourceType",void 0),e([S("_serviceSourceType",["serviceSourceType","fields"])],u.prototype,"readServiceSourceType",null),e([v({readOnly:!0})],u.prototype,"_serviceSupportsMosaicRule",void 0),e([S("_serviceSupportsMosaicRule",["currentVersion","fields"])],u.prototype,"readServiceSupportsMosaicRule",null),e([v()],u.prototype,"rasterAttributeTableFieldPrefix",void 0),e([v({readOnly:!0})],u.prototype,"rasterFunctionNamesIndex",null),e([v()],u.prototype,"adjustAspectRatio",void 0),e([v({readOnly:!0}),f("serviceRasterInfo.bandCount")],u.prototype,"bandCount",void 0),e([v({type:[g],json:{write:!0}})],u.prototype,"bandIds",void 0),e([S("bandIds")],u.prototype,"readBandIds",null),e([v({readOnly:!0,json:{read:!1}})],u.prototype,"capabilities",void 0),e([S("service","capabilities",["capabilities","currentVersion","serviceDataType"])],u.prototype,"readCapabilities",null),e([v({type:Number})],u.prototype,"compressionQuality",void 0),e([I("compressionQuality")],u.prototype,"writeCompressionQuality",null),e([v({type:Number})],u.prototype,"compressionTolerance",void 0),e([I("compressionTolerance")],u.prototype,"writeCompressionTolerance",null),e([v({json:{read:{source:"copyrightText"}}})],u.prototype,"copyright",void 0),e([v({type:String,json:{name:"layerDefinition.definitionExpression",write:{enabled:!0,allowNull:!0}}})],u.prototype,"definitionExpression",void 0),e([v({readOnly:!0,constructOnly:!0})],u.prototype,"exportImageServiceParameters",void 0),e([v()],u.prototype,"rasterInfo",void 0),e([v({readOnly:!0,type:[P]})],u.prototype,"fields",void 0),e([v({readOnly:!0})],u.prototype,"fieldsIndex",null),e([v({type:["png","png8","png24","png32","jpg","bmp","gif","jpgpng","lerc","tiff"],json:{write:!0}})],u.prototype,"format",null),e([S("service","format",["serviceDataType"])],u.prototype,"readFormat",null),e([v({type:ee})],u.prototype,"fullExtent",void 0),e([v({readOnly:!0})],u.prototype,"hasMultidimensions",void 0),e([v({json:{read:{source:"maxImageHeight"}}})],u.prototype,"imageMaxHeight",void 0),e([v({json:{read:{source:"maxImageWidth"}}})],u.prototype,"imageMaxWidth",void 0),e([v({type:String,json:{type:C.jsonValues,read:C.read,write:C.write}})],u.prototype,"interpolation",void 0),e([v()],u.prototype,"minScale",void 0),e([S("service","minScale")],u.prototype,"readMinScale",null),e([v()],u.prototype,"maxScale",void 0),e([S("service","maxScale")],u.prototype,"readMaxScale",null),e([v({type:N})],u.prototype,"mosaicRule",null),e([S("mosaicRule",["mosaicRule","defaultMosaicMethod"])],u.prototype,"readMosaicRule",null),e([I("mosaicRule")],u.prototype,"writeMosaicRule",null),e([v({readOnly:!0}),f("serviceRasterInfo.multidimensionalInfo")],u.prototype,"multidimensionalInfo",void 0),e([v({json:{type:g}})],u.prototype,"noData",void 0),e([I("noData")],u.prototype,"writeNoData",null),e([v({type:String,json:{type:M.jsonValues,read:M.read,write:M.write}})],u.prototype,"noDataInterpretation",void 0),e([v({type:String,readOnly:!0,json:{read:{source:["fields"]}}})],u.prototype,"objectIdField",void 0),e([S("objectIdField")],u.prototype,"readObjectIdField",null),e([v({})],u.prototype,"geometryType",void 0),e([v({})],u.prototype,"typeIdField",void 0),e([v({})],u.prototype,"types",void 0),e([v({readOnly:!0})],u.prototype,"parsedUrl",null),e([v({readOnly:!0}),f("serviceRasterInfo.pixelSize.x")],u.prototype,"pixelSizeX",void 0),e([v({readOnly:!0}),f("serviceRasterInfo.pixelSize.y")],u.prototype,"pixelSizeY",void 0),e([v({type:Function})],u.prototype,"pixelFilter",void 0),e([v()],u.prototype,"raster",void 0),e([v()],u.prototype,"viewId",void 0),e([v({types:i,json:{name:"layerDefinition.drawingInfo.renderer",origins:{"web-scene":{types:s,name:"layerDefinition.drawingInfo.renderer",write:{overridePolicy:e=>({enabled:e&&"vector-field"!==e.type&&"flow"!==e.type})}}}}})],u.prototype,"renderer",null),e([S("renderer")],u.prototype,"readRenderer",null),e([I("renderer")],u.prototype,"writeRenderer",null),e([v()],u.prototype,"symbolizer",void 0),e([v(w)],u.prototype,"opacity",void 0),e([v({readOnly:!0}),f("serviceRasterInfo.attributeTable")],u.prototype,"rasterAttributeTable",void 0),e([v({readOnly:!0})],u.prototype,"rasterFields",null),e([v({constructOnly:!0})],u.prototype,"rasterFunctionInfos",void 0),e([v({type:J})],u.prototype,"renderingRule",null),e([S("renderingRule",["renderingRule","rasterFunctionInfos"])],u.prototype,"readRenderingRule",null),e([I("renderingRule")],u.prototype,"writeRenderingRule",null),e([v()],u.prototype,"serviceDataType",void 0),e([v({readOnly:!0,type:de})],u.prototype,"spatialReference",void 0),e([S("spatialReference",["spatialReference","extent"])],u.prototype,"readSpatialReference",null),e([v({json:{type:fe.jsonValues}})],u.prototype,"pixelType",void 0),e([S("pixelType")],u.prototype,"readPixelType",null),e([I("pixelType")],u.prototype,"writePixelType",null),e([v({constructOnly:!0,type:q})],u.prototype,"serviceRasterInfo",void 0),e([v()],u.prototype,"sourceJSON",void 0),e([v(_)],u.prototype,"url",void 0),e([v({readOnly:!0})],u.prototype,"version",void 0),e([S("version",["currentVersion","fields","timeInfo"])],u.prototype,"readVersion",null),u=e([x("esri.layers.mixins.ArcGISImageService")],u),u};export{ve as ArcGISImageService};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.24/esri/copyright.txt for details.
4
4
  */
5
- import e from"../../core/Error.js";import{isSome as r}from"../../core/maybe.js";import{open as o}from"../../core/workers/workers.js";import t from"./PixelBlock.js";class n{constructor(){this._workerThread=null,this._destroyed=!1}async initialize(){const e=await o("RasterWorker");this._destroyed?e.close():this._workerThread=e}destroy(){this._destroyed=!0,this._workerThread&&(this._workerThread.close(),this._workerThread=null)}async convertVectorFieldData(r,o){if(!this._workerThread)throw new e("raster-jobhandler:no-connection","no available worker connection");const n=await this._workerThread.invoke("convertVectorFieldData",{pixelBlock:r.pixelBlock.toJSON(),type:r.dataType},o);return n?new t(n):null}async decode(r,o){if(!this._workerThread)throw new e("raster-jobhandler:no-connection","no available worker connection");const n=await this._workerThread.invoke("decode",r,o);return n?new t(n):null}async symbolize(o,n){if(!this._workerThread)throw new e("raster-jobhandler:no-connection","no available worker connection");const a={extent:o.extent&&o.extent.toJSON(),pixelBlock:r(o.pixelBlock)&&o.pixelBlock.toJSON(),simpleStretchParams:o.simpleStretchParams,bandIds:o.bandIds},i=await this._workerThread.invoke("symbolize",a,n);return i?new t(i):null}async updateSymbolizer(r,o){var t;if(!this._workerThread)throw new e("raster-jobhandler:no-connection","no available worker connection");const n=null==r||null==(t=r.rendererJSON)?void 0:t.histograms;await Promise.all(this._workerThread.broadcast("updateSymbolizer",{symbolizerJSON:r.toJSON(),histograms:n},o))}async stretch(r,o){if(!this._workerThread)throw new e("raster-jobhandler:no-connection","no available worker connection");if(null==r||!r.pixelBlock)return null;const n={srcPixelBlock:r.pixelBlock.toJSON(),stretchParams:r.stretchParams},a=await this._workerThread.invoke("stretch",n,o);return a?new t(a):null}async split(r,o){if(!this._workerThread)throw new e("raster-jobhandler:no-connection","no available worker connection");if(null==r||!r.pixelBlock)return null;const n={srcPixelBlock:r.pixelBlock.toJSON(),tileSize:r.tileSize,maximumPyramidLevel:r.maximumPyramidLevel},a=await this._workerThread.invoke("split",n,o);return a&&a.forEach(((e,r)=>{a.set(r,e?t.fromJSON(e):null)})),Promise.resolve(a)}async estimateStatisticsHistograms(r,o){if(!this._workerThread)throw new e("raster-jobhandler:no-connection","no available worker connection");if(null==r||!r.pixelBlock)return null;const t={srcPixelBlock:r.pixelBlock.toJSON()},n=await this._workerThread.invoke("estimateStatisticsHistograms",t,o);return Promise.resolve(n)}async mosaicAndTransform(o,n){var a;if(!this._workerThread)throw new e("raster-jobhandler:no-connection","no available worker connection");if(null==o||null==(a=o.srcPixelBlocks)||!a.length)return{pixelBlock:null};const i={...o,srcPixelBlocks:o.srcPixelBlocks.map((e=>r(e)?e.toJSON():null))},s=await this._workerThread.invoke("mosaicAndTransform",i,n);return{pixelBlock:s.pixelBlock?new t(s.pixelBlock):null,localNorthDirections:s.localNorthDirections}}async createStreamlinesMesh(r,o){if(!this._workerThread)throw new e("raster-jobhandler:no-connection","no available worker connection");const t={buffer:r.flowData.data.buffer,width:r.flowData.width,height:r.flowData.height},n=r.rendererSettings,a=await this._workerThread.invoke("createStreamlinesMesh",{flowData:t,rendererSettings:n},{...o,transferList:[t.buffer]});return{vertexData:new Float32Array(a.vertexBuffer),indexData:new Uint32Array(a.indexBuffer)}}getProjectionOffsetGrid(o,t){if(!this._workerThread)throw new e("raster-jobhandler:no-connection","no available worker connection");const n=r(o.datumTransformation)?o.datumTransformation.steps.map((e=>({wkid:e.wkid,wkt:e.wkt,isInverse:e.isInverse}))):null,a=r(o.rasterTransform)?o.rasterTransform.toJSON():null,i={projectedExtent:o.projectedExtent.toJSON(),srcBufferExtent:o.srcBufferExtent.toJSON(),pixelSize:o.pixelSize,hasWrapAround:o.hasWrapAround,spacing:o.spacing,datumTransformationSteps:n,rasterTransform:a,isAdaptive:o.isAdaptive,includeGCSGrid:o.includeGCSGrid};return this._workerThread.invoke("getProjectionOffsetGrid",i,t)}}export{n as default};
5
+ import e from"../../core/Error.js";import{isSome as r}from"../../core/maybe.js";import{open as o}from"../../core/workers/workers.js";import t from"./PixelBlock.js";class n{constructor(){this._workerThread=null,this._destroyed=!1}async initialize(){const e=await o("RasterWorker");this._destroyed?e.close():this._workerThread=e}destroy(){this._destroyed=!0,this._workerThread&&(this._workerThread.close(),this._workerThread=null)}async convertVectorFieldData(r,o){if(!this._workerThread)throw new e("raster-jobhandler:no-connection","no available worker connection");const n=await this._workerThread.invoke("convertVectorFieldData",{pixelBlock:r.pixelBlock.toJSON(),type:r.dataType},o);return n?new t(n):null}async decode(r,o){if(!this._workerThread)throw new e("raster-jobhandler:no-connection","no available worker connection");const n=await this._workerThread.invoke("decode",r,o);return n?new t(n):null}async symbolize(o,n){if(!this._workerThread)throw new e("raster-jobhandler:no-connection","no available worker connection");const a={extent:o.extent&&o.extent.toJSON(),pixelBlock:r(o.pixelBlock)&&o.pixelBlock.toJSON(),simpleStretchParams:o.simpleStretchParams,bandIds:o.bandIds},i=await this._workerThread.invoke("symbolize",a,n);return i?new t(i):null}async updateSymbolizer(r,o){var t;if(!this._workerThread)throw new e("raster-jobhandler:no-connection","no available worker connection");const n=null==r||null==(t=r.rendererJSON)?void 0:t.histograms;await Promise.all(this._workerThread.broadcast("updateSymbolizer",{symbolizerJSON:r.toJSON(),histograms:n},o))}async stretch(r,o){if(!this._workerThread)throw new e("raster-jobhandler:no-connection","no available worker connection");if(null==r||!r.pixelBlock)return null;const n={srcPixelBlock:r.pixelBlock.toJSON(),stretchParams:r.stretchParams},a=await this._workerThread.invoke("stretch",n,o);return a?new t(a):null}async split(r,o){if(!this._workerThread)throw new e("raster-jobhandler:no-connection","no available worker connection");if(null==r||!r.pixelBlock)return null;const n={srcPixelBlock:r.pixelBlock.toJSON(),tileSize:r.tileSize,maximumPyramidLevel:r.maximumPyramidLevel},a=await this._workerThread.invoke("split",n,o);return a&&a.forEach(((e,r)=>{a.set(r,e?t.fromJSON(e):null)})),a}async estimateStatisticsHistograms(r,o){if(!this._workerThread)throw new e("raster-jobhandler:no-connection","no available worker connection");if(null==r||!r.pixelBlock)return null;const t={srcPixelBlock:r.pixelBlock.toJSON()};return await this._workerThread.invoke("estimateStatisticsHistograms",t,o)}async mosaicAndTransform(o,n){var a;if(!this._workerThread)throw new e("raster-jobhandler:no-connection","no available worker connection");if(null==o||null==(a=o.srcPixelBlocks)||!a.length)return{pixelBlock:null};const i={...o,srcPixelBlocks:o.srcPixelBlocks.map((e=>r(e)?e.toJSON():null))},s=await this._workerThread.invoke("mosaicAndTransform",i,n);return{pixelBlock:s.pixelBlock?new t(s.pixelBlock):null,localNorthDirections:s.localNorthDirections}}async createStreamlinesMesh(r,o){if(!this._workerThread)throw new e("raster-jobhandler:no-connection","no available worker connection");const t={buffer:r.flowData.data.buffer,width:r.flowData.width,height:r.flowData.height},n=r.rendererSettings,a=await this._workerThread.invoke("createStreamlinesMesh",{flowData:t,rendererSettings:n},{...o,transferList:[t.buffer]});return{vertexData:new Float32Array(a.vertexBuffer),indexData:new Uint32Array(a.indexBuffer)}}getProjectionOffsetGrid(o,t){if(!this._workerThread)throw new e("raster-jobhandler:no-connection","no available worker connection");const n=r(o.datumTransformation)?o.datumTransformation.steps.map((e=>({wkid:e.wkid,wkt:e.wkt,isInverse:e.isInverse}))):null,a=r(o.rasterTransform)?o.rasterTransform.toJSON():null,i={projectedExtent:o.projectedExtent.toJSON(),srcBufferExtent:o.srcBufferExtent.toJSON(),pixelSize:o.pixelSize,hasWrapAround:o.hasWrapAround,spacing:o.spacing,datumTransformationSteps:n,rasterTransform:a,isAdaptive:o.isAdaptive,includeGCSGrid:o.includeGCSGrid};return this._workerThread.invoke("getProjectionOffsetGrid",i,t)}}export{n 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.24/esri/copyright.txt for details.
4
4
  */
5
- import t from"../../request.js";import e from"../../core/Error.js";import i from"../../core/Logger.js";import{urlToObject as s,objectToQuery as a}from"../../core/urlUtils.js";const r=i.getLogger("esri.layers.support.SpriteSource"),h=1.15;class o{constructor(t,e,i,s){this.baseURL=t,this.devicePixelRatio=e,this.maxTextureSize=i,this._spriteImageFormat=s,this._isRetina=!1,this._spritesData={},this.image=null,this.width=null,this.height=null,this.loadStatus="not-loaded"}get spriteNames(){const t=[];for(const e in this._spritesData)t.push(e);return t.sort(),t}getSpriteInfo(t){return this._spritesData[t]}async load(t){if(this.baseURL){this.loadStatus="loading";try{await this._loadSprites(t),this.loadStatus="loaded"}catch{this.loadStatus="failed"}}else this.loadStatus="failed"}_loadSprites(i){this._isRetina=this.devicePixelRatio>h;const o=s(this.baseURL),l=o.query?"?"+a(o.query):"",n=this._isRetina?"@2x":"",d=`${o.path}${n}.${this._spriteImageFormat}${l}`,g=`${o.path}${n}.json${l}`;return Promise.all([t(g,i),t(d,{responseType:"image",...i})]).then((([t,i])=>{const s=Object.keys(t.data);if(!s||0===s.length||1===s.length&&"_ssl"===s[0]||!i||!i.data)return this._spritesData=this.image=null,this.width=this.height=0,Promise.resolve(null);this._spritesData=t.data;const a=i.data,h=Math.max(this.maxTextureSize,4096);if(a.width>h||a.height>h){const t=`Sprite resource for style ${o.path} is bigger than the maximum allowed of ${h} pixels}`;throw r.error(t),new e("SpriteSource",t)}this.width=a.width,this.height=a.height;const l=document.createElement("canvas"),n=l.getContext("2d");l.width=a.width,l.height=a.height,n.drawImage(a,0,0,a.width,a.height);const d=n.getImageData(0,0,a.width,a.height),g=new Uint8Array(d.data);let m;for(let e=0;e<g.length;e+=4)m=g[e+3]/255,g[e]=g[e]*m,g[e+1]=g[e+1]*m,g[e+2]=g[e+2]*m;this.image=g}))}}export{o as default};
5
+ import t from"../../request.js";import e from"../../core/Error.js";import i from"../../core/Logger.js";import{urlToObject as s,objectToQuery as a}from"../../core/urlUtils.js";const h=i.getLogger("esri.layers.support.SpriteSource"),r=1.15;class o{constructor(t,e,i,s){this.baseURL=t,this.devicePixelRatio=e,this.maxTextureSize=i,this._spriteImageFormat=s,this._isRetina=!1,this._spritesData={},this.image=null,this.width=null,this.height=null,this.loadStatus="not-loaded"}get spriteNames(){const t=[];for(const e in this._spritesData)t.push(e);return t.sort(),t}getSpriteInfo(t){return this._spritesData[t]}async load(t){if(this.baseURL){this.loadStatus="loading";try{await this._loadSprites(t),this.loadStatus="loaded"}catch{this.loadStatus="failed"}}else this.loadStatus="failed"}_loadSprites(i){this._isRetina=this.devicePixelRatio>r;const o=s(this.baseURL),l=o.query?"?"+a(o.query):"",n=this._isRetina?"@2x":"",d=`${o.path}${n}.${this._spriteImageFormat}${l}`,g=`${o.path}${n}.json${l}`;return Promise.all([t(g,i),t(d,{responseType:"image",...i})]).then((([t,i])=>{const s=Object.keys(t.data);if(!s||0===s.length||1===s.length&&"_ssl"===s[0]||!i||!i.data)return this._spritesData=this.image=null,this.width=this.height=0,null;this._spritesData=t.data;const a=i.data,r=Math.max(this.maxTextureSize,4096);if(a.width>r||a.height>r){const t=`Sprite resource for style ${o.path} is bigger than the maximum allowed of ${r} pixels}`;throw h.error(t),new e("SpriteSource",t)}this.width=a.width,this.height=a.height;const l=document.createElement("canvas"),n=l.getContext("2d");l.width=a.width,l.height=a.height,n.drawImage(a,0,0,a.width,a.height);const d=n.getImageData(0,0,a.width,a.height),g=new Uint8Array(d.data);let u;for(let e=0;e<g.length;e+=4)u=g[e+3]/255,g[e]=g[e]*u,g[e+1]=g[e+1]*u,g[e+2]=g[e+2]*u;this.image=g}))}}export{o 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.24/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../chunks/tslib.es6.js";import"../../geometry.js";import r from"../../PopupTemplate.js";import"../../renderers/ClassBreaksRenderer.js";import"../../renderers/DictionaryRenderer.js";import"../../renderers/DotDensityRenderer.js";import"../../renderers/HeatmapRenderer.js";import"../../renderers/Renderer.js";import"../../renderers/SimpleRenderer.js";import"../../renderers/UniqueValueRenderer.js";import"../../renderers/support/jsonUtils.js";import{rendererTypes as i,webSceneRendererTypes as t}from"../../renderers/support/types.js";import o from"../../request.js";import{isSymbol3D as l}from"../../symbols.js";import s from"../../core/Collection.js";import a from"../../core/Error.js";import{HandleOwnerMixin as n}from"../../core/HandleOwner.js";import{IdentifiableMixin as p}from"../../core/Identifiable.js";import{clone as y}from"../../core/lang.js";import d from"../../core/Loadable.js";import u from"../../core/Logger.js";import{isSome as c}from"../../core/maybe.js";import{MultiOriginJSONMixin as f}from"../../core/MultiOriginJSONSupport.js";import{objectToQuery as m}from"../../core/urlUtils.js";import{property as h}from"../../core/accessorSupport/decorators/property.js";import{getProperties as b}from"../../core/accessorSupport/utils.js";import{cast as g}from"../../core/accessorSupport/decorators/cast.js";import{reader as S}from"../../core/accessorSupport/decorators/reader.js";import{subclass as I}from"../../core/accessorSupport/decorators/subclass.js";import{writer as v}from"../../core/accessorSupport/decorators/writer.js";import{ensureInteger as w,ensureType as j,Integer as D,ensureClass as L}from"../../core/accessorSupport/ensureType.js";import{OriginId as E,nameToId as F}from"../../core/accessorSupport/PropertyOrigin.js";import x from"./FeatureType.js";import O from"./Field.js";import P from"./FieldsIndex.js";import _ from"./LabelClass.js";import T from"./LayerFloorInfo.js";import{DataLayerSource as N}from"./source/DataLayerSource.js";import{MapLayerSource as M}from"./source/MapLayerSource.js";import V from"../../rest/support/Query.js";import{createPopupTemplate as A}from"../../support/popupUtils.js";import{combineFloorsDefinitionExpression as U}from"../../views/support/floorFilterUtils.js";import C from"../../geometry/Extent.js";var R;function k(e){return e&&"esriSMS"===e.type}function q(e,r,i){var t;const o=this.originIdOf(r)>=F(i.origin);return{ignoreOrigin:!0,allowNull:o,enabled:!!i&&("map-image"===(null==(t=i.layer)?void 0:t.type)&&(i.writeSublayerStructure||o))}}function $(e,r,i){var t;return{enabled:!!i&&("tile"===(null==(t=i.layer)?void 0:t.type)&&this._isOverridden(r))}}function J(e,r,i){return{ignoreOrigin:!0,enabled:i&&i.writeSublayerStructure||!1}}function B(e,r,i){return{ignoreOrigin:!0,enabled:!!i&&(i.writeSublayerStructure||this.originIdOf(r)>=F(i.origin))}}const Q=u.getLogger("esri.layers.support.Sublayer");let G=0;const H=new Set;H.add("layer"),H.add("parent"),H.add("loaded"),H.add("loadStatus"),H.add("loadError"),H.add("loadWarnings");let K=R=class extends(n(f(p(d)))){constructor(e){super(e),this.capabilities=void 0,this.fields=null,this.fullExtent=null,this.globalIdField=null,this.legendEnabled=!0,this.objectIdField=null,this.popupEnabled=!0,this.popupTemplate=null,this.sourceJSON=null,this.title=null,this.typeIdField=null,this.types=null}async load(e){return this.addResolvingPromise((async()=>{var r;if(!this.layer&&!this.url)throw new a("sublayer:missing-layer","Sublayer can't be loaded without being part of a layer",{sublayer:this});let i=null;if(!this.layer||this.originIdOf("url")>E.SERVICE||"data-layer"===(null==(r=this.source)?void 0:r.type)){i=(await o(this.url,{responseType:"json",query:{f:"json"},...e})).data}else{var t;let r=this.id;"map-layer"===(null==(t=this.source)?void 0:t.type)&&(r=this.source.mapLayerId),i=await this.layer.fetchSublayerInfo(r,e)}i&&(this.sourceJSON=i,this.read({layerDefinition:i},{origin:"service"}))})()),this}readCapabilities(e,r){const i=(e=(r=r.layerDefinition||r).capabilities||e)?e.toLowerCase().split(",").map((e=>e.trim())):[];return{exportMap:{supportsModification:!!r.canModifyLayer},operations:{supportsQuery:i.includes("query")}}}set definitionExpression(e){this._setAndNotifyLayer("definitionExpression",e)}get fieldsIndex(){return new P(this.fields||[])}set floorInfo(e){this._setAndNotifyLayer("floorInfo",e)}readGlobalIdFieldFromService(e,r){if((r=r.layerDefinition||r).globalIdField)return r.globalIdField;if(r.fields)for(const i of r.fields)if("esriFieldTypeGlobalID"===i.type)return i.name}get id(){const e=this._get("id");return null==e?G++:e}set id(e){this._get("id")!==e&&(!1!==this.get("layer.capabilities.exportMap.supportsDynamicLayers")?this._set("id",e):this._logLockedError("id","capability not available 'layer.capabilities.exportMap.supportsDynamicLayers'"))}set labelingInfo(e){this._setAndNotifyLayer("labelingInfo",e)}writeLabelingInfo(e,r,i,t){e&&e.length&&(r.layerDefinition={drawingInfo:{labelingInfo:e.map((e=>e.write({},t)))}})}set labelsVisible(e){this._setAndNotifyLayer("labelsVisible",e)}set layer(e){this._set("layer",e),this.sublayers&&this.sublayers.forEach((r=>r.layer=e))}set listMode(e){this._set("listMode",e)}set minScale(e){this._setAndNotifyLayer("minScale",e)}readMinScale(e,r){return r.minScale||r.layerDefinition&&r.layerDefinition.minScale||0}set maxScale(e){this._setAndNotifyLayer("maxScale",e)}readMaxScale(e,r){return r.maxScale||r.layerDefinition&&r.layerDefinition.maxScale||0}get effectiveScaleRange(){const{minScale:e,maxScale:r}=this;return{minScale:e,maxScale:r}}readObjectIdFieldFromService(e,r){if((r=r.layerDefinition||r).objectIdField)return r.objectIdField;if(r.fields)for(const i of r.fields)if("esriFieldTypeOID"===i.type)return i.name}set opacity(e){this._setAndNotifyLayer("opacity",e)}readOpacity(e,r){const i=r.layerDefinition;return 1-.01*(null!=i.transparency?i.transparency:i.drawingInfo.transparency)}writeOpacity(e,r,i,t){r.layerDefinition={drawingInfo:{transparency:100-100*e}}}writeParent(e,r){this.parent&&this.parent!==this.layer?r.parentLayerId=w(this.parent.id):r.parentLayerId=-1}get defaultPopupTemplate(){return this.createPopupTemplate()}set renderer(e){if(e)for(const r of e.getSymbols())if(l(r)){Q.warn("Sublayer renderer should use 2D symbols");break}this._setAndNotifyLayer("renderer",e)}get source(){return this._get("source")||new M({mapLayerId:this.id})}set source(e){this._setAndNotifyLayer("source",e)}set sublayers(e){this._handleSublayersChange(e,this._get("sublayers")),this._set("sublayers",e)}castSublayers(e){return j(s.ofType(R),e)}writeSublayers(e,r,i){this.get("sublayers.length")&&(r[i]=this.sublayers.map((e=>e.id)).toArray().reverse())}readTypeIdField(e,r){let i=(r=r.layerDefinition||r).typeIdField;if(i&&r.fields){i=i.toLowerCase();const e=r.fields.find((e=>e.name.toLowerCase()===i));e&&(i=e.name)}return null}get url(){var e,r;const i=null!=(e=null==(r=this.layer)?void 0:r.parsedUrl)?e:this._lastParsedUrl,t=this.source;if(!i)return null;if(this._lastParsedUrl=i,"map-layer"===(null==t?void 0:t.type))return`${i.path}/${t.mapLayerId}`;const o={layer:JSON.stringify({source:this.source})};return`${i.path}/dynamicLayer?${m(o)}`}set url(e){e?this._override("url",e):this._clearOverride("url")}set visible(e){this._setAndNotifyLayer("visible",e)}writeVisible(e,r,i,t){r[i]=this.getAtOrigin("defaultVisibility","service")||e}clone(){const{store:e}=b(this),r=new R;return b(r).store=e.clone(H),this.commitProperty("url"),r._lastParsedUrl=this._lastParsedUrl,r}createPopupTemplate(e){return A(this,e)}createQuery(){return new V({returnGeometry:!0,where:this.definitionExpression||"1=1"})}async createFeatureLayer(){var e,r;if(this.hasOwnProperty("sublayers"))return null;const i=null==(e=this.layer)?void 0:e.parsedUrl,t=new(0,(await import("../FeatureLayer.js")).default)({url:i.path});return i&&this.source&&("map-layer"===this.source.type?t.layerId=this.source.mapLayerId:t.dynamicDataSource=this.source),null!=this.layer.refreshInterval&&(t.refreshInterval=this.layer.refreshInterval),this.definitionExpression&&(t.definitionExpression=this.definitionExpression),this.floorInfo&&(t.floorInfo=y(this.floorInfo)),this.originIdOf("labelingInfo")>E.SERVICE&&(t.labelingInfo=y(this.labelingInfo)),this.originIdOf("labelsVisible")>E.DEFAULTS&&(t.labelsVisible=this.labelsVisible),this.originIdOf("legendEnabled")>E.DEFAULTS&&(t.legendEnabled=this.legendEnabled),this.originIdOf("visible")>E.DEFAULTS&&(t.visible=this.visible),this.originIdOf("minScale")>E.DEFAULTS&&(t.minScale=this.minScale),this.originIdOf("maxScale")>E.DEFAULTS&&(t.maxScale=this.maxScale),this.originIdOf("opacity")>E.DEFAULTS&&(t.opacity=this.opacity),this.originIdOf("popupTemplate")>E.DEFAULTS&&(t.popupTemplate=y(this.popupTemplate)),this.originIdOf("renderer")>E.SERVICE&&(t.renderer=y(this.renderer)),"data-layer"===(null==(r=this.source)?void 0:r.type)&&(t.dynamicDataSource=this.source.clone()),this.originIdOf("title")>E.DEFAULTS&&(t.title=this.title),"map-image"===this.layer.type&&this.layer.originIdOf("customParameters")>E.DEFAULTS&&(t.customParameters=this.layer.customParameters),"tile"===this.layer.type&&this.layer.originIdOf("customParameters")>E.DEFAULTS&&(t.customParameters=this.layer.customParameters),t}getField(e){return this.fieldsIndex.get(e)}getFeatureType(e){const{typeIdField:r,types:i}=this;if(!r||!e)return null;const t=e.attributes?e.attributes[r]:void 0;if(null==t)return null;let o=null;return i.some((e=>{const{id:r}=e;return null!=r&&(r.toString()===t.toString()&&(o=e),!!o)})),o}getFieldDomain(e,r){const i=r&&r.feature,t=this.getFeatureType(i);if(t){const r=t.domains&&t.domains[e];if(r&&"inherited"!==r.type)return r}return this._getLayerDomain(e)}async queryFeatures(e=this.createQuery(),r){var i,t,o,l;if(await this.load(),!this.get("capabilities.operations.supportsQuery"))throw new a("Sublayer.queryFeatures","this layer doesn't support queries.");const[{executeQuery:s},{default:n}]=await Promise.all([import("../../rest/query/operations/query.js"),import("../../rest/support/FeatureSet.js")]),p=await s(this.url,V.from(e),null!=(i=null==(t=this.layer)?void 0:t.spatialReference)?i:null,{...r,query:{...null==(o=this.layer)?void 0:o.customParameters,token:null==(l=this.layer)?void 0:l.apiKey}}),y=n.fromJSON(p.data);if(null!=y&&y.features)for(const a of y.features)a.sourceLayer=this;return y}toExportImageJSON(e){var r;const i={id:this.id,source:(null==(r=this.source)?void 0:r.toJSON())||{mapLayerId:this.id,type:"mapLayer"}};if(this.definitionExpression){const r=c(e)?U(e,this):this.definitionExpression;i.definitionExpression=r}else c(e)&&(i.definitionExpression=e);const t=["renderer","labelingInfo","opacity","labelsVisible"].reduce(((e,r)=>(e[r]=this.originIdOf(r),e)),{}),o=Object.keys(t).some((e=>t[e]>E.SERVICE));if(o){const e=i.drawingInfo={};t.renderer>E.SERVICE&&(e.renderer=this.renderer?this.renderer.toJSON():null),t.labelsVisible>E.SERVICE&&(e.showLabels=this.labelsVisible),this.labelsVisible&&t.labelingInfo>E.SERVICE&&(e.labelingInfo=this.labelingInfo?this.labelingInfo.map((e=>e.write({},{origin:"service",layer:this.layer}))):null,e.showLabels=!0),t.opacity>E.SERVICE&&(e.transparency=100-100*this.opacity),this._assignDefaultSymbolColors(e.renderer)}return i}_assignDefaultSymbolColors(e){this._forEachSimpleMarkerSymbols(e,(e=>{e.color||"esriSMSX"!==e.style&&"esriSMSCross"!==e.style||(e.outline&&e.outline.color?e.color=e.outline.color:e.color=[0,0,0,0])}))}_forEachSimpleMarkerSymbols(e,r){if(e){const i="uniqueValueInfos"in e?e.uniqueValueInfos:"classBreakInfos"in e?e.classBreakInfos:[];for(const e of i)k(e.symbol)&&r(e.symbol);"symbol"in e&&k(e.symbol)&&r(e.symbol),"defaultSymbol"in e&&k(e.defaultSymbol)&&r(e.defaultSymbol)}}_setAndNotifyLayer(e,r){const i=this.layer,t=this._get(e);let o,l;switch(e){case"definitionExpression":case"floorInfo":o="supportsSublayerDefinitionExpression";case"minScale":case"maxScale":case"visible":o="supportsSublayerVisibility";break;case"labelingInfo":case"labelsVisible":case"opacity":case"renderer":case"source":o="supportsDynamicLayers",l="supportsModification"}const s=b(this).getDefaultOrigin();if("service"!==s){if(o&&!1===this.get(`layer.capabilities.exportMap.${o}`))return void this._logLockedError(e,`capability not available 'layer.capabilities.exportMap.${o}'`);if(l&&!1===this.get(`capabilities.exportMap.${l}`))return void this._logLockedError(e,`capability not available 'capabilities.exportMap.${l}'`)}"source"!==e||"not-loaded"===this.loadStatus?(this._set(e,r),"service"!==s&&t!==r&&i&&i.emit&&i.emit("sublayer-update",{propertyName:e,target:this})):this._logLockedError(e,"'source' can't be changed after calling sublayer.load()")}_handleSublayersChange(e,r){r&&(r.forEach((e=>{e.parent=null,e.layer=null})),this.handles.removeAll()),e&&(e.forEach((e=>{e.parent=this,e.layer=this.layer})),this.handles.add([e.on("after-add",(({item:e})=>{e.parent=this,e.layer=this.layer})),e.on("after-remove",(({item:e})=>{e.parent=null,e.layer=null})),e.on("before-changes",(e=>{const r=this.get("layer.capabilities.exportMap.supportsSublayersChanges");null==r||r||(Q.error(new a("sublayer:sublayers-non-modifiable","Sublayer can't be added, moved, or removed from the layer's sublayers",{sublayer:this,layer:this.layer})),e.preventDefault())}))]))}_logLockedError(e,r){Q.error(new a("sublayer:locked",`Property '${e}' can't be changed on Sublayer from the layer '${this.layer.id}'`,{reason:r,sublayer:this,layer:this.layer}))}_getLayerDomain(e){const r=this.fieldsIndex.get(e);return r?r.domain:null}};K.test={isMapImageLayerOverridePolicy:e=>e===J||e===q,isTileImageLayerOverridePolicy:e=>e===$},e([h({readOnly:!0})],K.prototype,"capabilities",void 0),e([S("service","capabilities",["layerDefinition.canModifyLayer","layerDefinition.capabilities"])],K.prototype,"readCapabilities",null),e([h({type:String,value:null,json:{name:"layerDefinition.definitionExpression",write:{allowNull:!0,overridePolicy:q}}})],K.prototype,"definitionExpression",null),e([h({type:[O],json:{origins:{service:{read:{source:"layerDefinition.fields"}}}}})],K.prototype,"fields",void 0),e([h({readOnly:!0})],K.prototype,"fieldsIndex",null),e([h({type:T,value:null,json:{name:"layerDefinition.floorInfo",read:{source:"layerDefinition.floorInfo"},write:{target:"layerDefinition.floorInfo",overridePolicy:q},origins:{"web-scene":{read:!1,write:!1}}}})],K.prototype,"floorInfo",null),e([h({type:C,json:{read:{source:"layerDefinition.extent"}}})],K.prototype,"fullExtent",void 0),e([h({type:String})],K.prototype,"globalIdField",void 0),e([S("service","globalIdField",["layerDefinition.globalIdField","layerDefinition.fields"])],K.prototype,"readGlobalIdFieldFromService",null),e([h({type:D,json:{write:{ignoreOrigin:!0}}})],K.prototype,"id",null),e([h({value:null,type:[_],json:{read:{source:"layerDefinition.drawingInfo.labelingInfo"},write:{target:"layerDefinition.drawingInfo.labelingInfo",overridePolicy:J}}})],K.prototype,"labelingInfo",null),e([v("labelingInfo")],K.prototype,"writeLabelingInfo",null),e([h({type:Boolean,value:!0,json:{read:{source:"layerDefinition.drawingInfo.showLabels"},write:{target:"layerDefinition.drawingInfo.showLabels",overridePolicy:J}}})],K.prototype,"labelsVisible",null),e([h({value:null})],K.prototype,"layer",null),e([h({type:Boolean,value:!0,json:{origins:{service:{read:{enabled:!1}}},read:{source:"showLegend"},write:{target:"showLegend",overridePolicy:B}}})],K.prototype,"legendEnabled",void 0),e([h({type:["show","hide","hide-children"],value:"show",json:{read:!1,write:!1,origins:{"web-scene":{read:!0,write:!0}}}})],K.prototype,"listMode",null),e([h({type:Number,value:0,json:{write:{overridePolicy:J}}})],K.prototype,"minScale",null),e([S("minScale",["minScale","layerDefinition.minScale"])],K.prototype,"readMinScale",null),e([h({type:Number,value:0,json:{write:{overridePolicy:J}}})],K.prototype,"maxScale",null),e([S("maxScale",["maxScale","layerDefinition.maxScale"])],K.prototype,"readMaxScale",null),e([h({readOnly:!0})],K.prototype,"effectiveScaleRange",null),e([h({type:String})],K.prototype,"objectIdField",void 0),e([S("service","objectIdField",["layerDefinition.objectIdField","layerDefinition.fields"])],K.prototype,"readObjectIdFieldFromService",null),e([h({type:Number,value:1,json:{write:{target:"layerDefinition.drawingInfo.transparency",overridePolicy:J}}})],K.prototype,"opacity",null),e([S("opacity",["layerDefinition.drawingInfo.transparency","layerDefinition.transparency"])],K.prototype,"readOpacity",null),e([v("opacity")],K.prototype,"writeOpacity",null),e([h({json:{type:D,write:{target:"parentLayerId",writerEnsuresNonNull:!0,overridePolicy:J}}})],K.prototype,"parent",void 0),e([v("parent")],K.prototype,"writeParent",null),e([h({type:Boolean,value:!0,json:{read:{source:"disablePopup",reader:(e,r)=>!r.disablePopup},write:{target:"disablePopup",overridePolicy:B,writer(e,r,i){r[i]=!e}}}})],K.prototype,"popupEnabled",void 0),e([h({type:r,json:{read:{source:"popupInfo"},write:{target:"popupInfo",overridePolicy:B}}})],K.prototype,"popupTemplate",void 0),e([h({readOnly:!0})],K.prototype,"defaultPopupTemplate",null),e([h({types:i,value:null,json:{name:"layerDefinition.drawingInfo.renderer",write:{overridePolicy:J},origins:{"web-scene":{types:t,name:"layerDefinition.drawingInfo.renderer",write:{overridePolicy:J}}}}})],K.prototype,"renderer",null),e([h({types:{key:"type",base:null,typeMap:{"data-layer":N,"map-layer":M}},cast(e){if(e){if("mapLayerId"in e)return L(M,e);if("dataSource"in e)return L(N,e)}return e},json:{name:"layerDefinition.source",write:{overridePolicy:J}}})],K.prototype,"source",null),e([h()],K.prototype,"sourceJSON",void 0),e([h({value:null,json:{type:[D],write:{target:"subLayerIds",allowNull:!0,overridePolicy:J}}})],K.prototype,"sublayers",null),e([g("sublayers")],K.prototype,"castSublayers",null),e([v("sublayers")],K.prototype,"writeSublayers",null),e([h({type:String,json:{name:"name",write:{overridePolicy:B}}})],K.prototype,"title",void 0),e([h({type:String})],K.prototype,"typeIdField",void 0),e([S("typeIdField",["layerDefinition.typeIdField"])],K.prototype,"readTypeIdField",null),e([h({type:[x],json:{origins:{service:{read:{source:"layerDefinition.types"}}}}})],K.prototype,"types",void 0),e([h({type:String,json:{read:{source:"layerUrl"},write:{target:"layerUrl",overridePolicy:$}}})],K.prototype,"url",null),e([h({type:Boolean,value:!0,json:{read:{source:"defaultVisibility"},write:{target:"defaultVisibility",overridePolicy:J}}})],K.prototype,"visible",null),e([v("visible")],K.prototype,"writeVisible",null),K=R=e([I("esri.layers.support.Sublayer")],K);const W=K;export{W as default};
5
+ import{_ as e}from"../../chunks/tslib.es6.js";import"../../geometry.js";import r from"../../PopupTemplate.js";import"../../renderers/ClassBreaksRenderer.js";import"../../renderers/DictionaryRenderer.js";import"../../renderers/DotDensityRenderer.js";import"../../renderers/HeatmapRenderer.js";import"../../renderers/Renderer.js";import"../../renderers/SimpleRenderer.js";import"../../renderers/UniqueValueRenderer.js";import"../../renderers/support/jsonUtils.js";import{rendererTypes as i,webSceneRendererTypes as t}from"../../renderers/support/types.js";import o from"../../request.js";import{isSymbol3D as l}from"../../symbols.js";import s from"../../core/Collection.js";import a from"../../core/Error.js";import{HandleOwnerMixin as n}from"../../core/HandleOwner.js";import{IdentifiableMixin as p}from"../../core/Identifiable.js";import{clone as y}from"../../core/lang.js";import d from"../../core/Loadable.js";import u from"../../core/Logger.js";import{isSome as c}from"../../core/maybe.js";import{MultiOriginJSONMixin as f}from"../../core/MultiOriginJSONSupport.js";import{objectToQuery as m}from"../../core/urlUtils.js";import{property as h}from"../../core/accessorSupport/decorators/property.js";import{getProperties as b}from"../../core/accessorSupport/utils.js";import{cast as g}from"../../core/accessorSupport/decorators/cast.js";import{reader as S}from"../../core/accessorSupport/decorators/reader.js";import{subclass as I}from"../../core/accessorSupport/decorators/subclass.js";import{writer as v}from"../../core/accessorSupport/decorators/writer.js";import{ensureInteger as w,ensureType as j,Integer as D,ensureClass as L}from"../../core/accessorSupport/ensureType.js";import{OriginId as E,nameToId as F}from"../../core/accessorSupport/PropertyOrigin.js";import x from"./FeatureType.js";import O from"./Field.js";import P from"./FieldsIndex.js";import _ from"./LabelClass.js";import T from"./LayerFloorInfo.js";import{DataLayerSource as N}from"./source/DataLayerSource.js";import{MapLayerSource as M}from"./source/MapLayerSource.js";import V from"../../rest/support/Query.js";import{createPopupTemplate as A}from"../../support/popupUtils.js";import{combineFloorsDefinitionExpression as U}from"../../views/support/floorFilterUtils.js";import C from"../../geometry/Extent.js";var R;function k(e){return e&&"esriSMS"===e.type}function q(e,r,i){var t;const o=this.originIdOf(r)>=F(i.origin);return{ignoreOrigin:!0,allowNull:o,enabled:!!i&&("map-image"===(null==(t=i.layer)?void 0:t.type)&&(i.writeSublayerStructure||o))}}function $(e,r,i){var t;return{enabled:!!i&&("tile"===(null==(t=i.layer)?void 0:t.type)&&this._isOverridden(r))}}function J(e,r,i){return{ignoreOrigin:!0,enabled:i&&i.writeSublayerStructure||!1}}function B(e,r,i){return{ignoreOrigin:!0,enabled:!!i&&(i.writeSublayerStructure||this.originIdOf(r)>=F(i.origin))}}const Q=u.getLogger("esri.layers.support.Sublayer");let G=0;const H=new Set;H.add("layer"),H.add("parent"),H.add("loaded"),H.add("loadStatus"),H.add("loadError"),H.add("loadWarnings");let K=R=class extends(n(f(p(d)))){constructor(e){super(e),this.capabilities=void 0,this.fields=null,this.fullExtent=null,this.globalIdField=null,this.legendEnabled=!0,this.objectIdField=null,this.popupEnabled=!0,this.popupTemplate=null,this.sourceJSON=null,this.title=null,this.typeIdField=null,this.types=null}async load(e){return this.addResolvingPromise((async()=>{var r;if(!this.layer&&!this.url)throw new a("sublayer:missing-layer","Sublayer can't be loaded without being part of a layer",{sublayer:this});let i=null;if(!this.layer||this.originIdOf("url")>E.SERVICE||"data-layer"===(null==(r=this.source)?void 0:r.type)){i=(await o(this.url,{responseType:"json",query:{f:"json"},...e})).data}else{var t;let r=this.id;"map-layer"===(null==(t=this.source)?void 0:t.type)&&(r=this.source.mapLayerId),i=await this.layer.fetchSublayerInfo(r,e)}i&&(this.sourceJSON=i,this.read({layerDefinition:i},{origin:"service"}))})()),this}readCapabilities(e,r){const i=(e=(r=r.layerDefinition||r).capabilities||e)?e.toLowerCase().split(",").map((e=>e.trim())):[];return{exportMap:{supportsModification:!!r.canModifyLayer},operations:{supportsQuery:i.includes("query")}}}set definitionExpression(e){this._setAndNotifyLayer("definitionExpression",e)}get fieldsIndex(){return new P(this.fields||[])}set floorInfo(e){this._setAndNotifyLayer("floorInfo",e)}readGlobalIdFieldFromService(e,r){if((r=r.layerDefinition||r).globalIdField)return r.globalIdField;if(r.fields)for(const i of r.fields)if("esriFieldTypeGlobalID"===i.type)return i.name}get id(){const e=this._get("id");return null==e?G++:e}set id(e){this._get("id")!==e&&(!1!==this.get("layer.capabilities.exportMap.supportsDynamicLayers")?this._set("id",e):this._logLockedError("id","capability not available 'layer.capabilities.exportMap.supportsDynamicLayers'"))}set labelingInfo(e){this._setAndNotifyLayer("labelingInfo",e)}writeLabelingInfo(e,r,i,t){e&&e.length&&(r.layerDefinition={drawingInfo:{labelingInfo:e.map((e=>e.write({},t)))}})}set labelsVisible(e){this._setAndNotifyLayer("labelsVisible",e)}set layer(e){this._set("layer",e),this.sublayers&&this.sublayers.forEach((r=>r.layer=e))}set listMode(e){this._set("listMode",e)}set minScale(e){this._setAndNotifyLayer("minScale",e)}readMinScale(e,r){return r.minScale||r.layerDefinition&&r.layerDefinition.minScale||0}set maxScale(e){this._setAndNotifyLayer("maxScale",e)}readMaxScale(e,r){return r.maxScale||r.layerDefinition&&r.layerDefinition.maxScale||0}get effectiveScaleRange(){const{minScale:e,maxScale:r}=this;return{minScale:e,maxScale:r}}readObjectIdFieldFromService(e,r){if((r=r.layerDefinition||r).objectIdField)return r.objectIdField;if(r.fields)for(const i of r.fields)if("esriFieldTypeOID"===i.type)return i.name}set opacity(e){this._setAndNotifyLayer("opacity",e)}readOpacity(e,r){const i=r.layerDefinition;return 1-.01*(null!=i.transparency?i.transparency:i.drawingInfo.transparency)}writeOpacity(e,r,i,t){r.layerDefinition={drawingInfo:{transparency:100-100*e}}}writeParent(e,r){this.parent&&this.parent!==this.layer?r.parentLayerId=w(this.parent.id):r.parentLayerId=-1}get defaultPopupTemplate(){return this.createPopupTemplate()}set renderer(e){if(e)for(const r of e.getSymbols())if(l(r)){Q.warn("Sublayer renderer should use 2D symbols");break}this._setAndNotifyLayer("renderer",e)}get source(){return this._get("source")||new M({mapLayerId:this.id})}set source(e){this._setAndNotifyLayer("source",e)}set sublayers(e){this._handleSublayersChange(e,this._get("sublayers")),this._set("sublayers",e)}castSublayers(e){return j(s.ofType(R),e)}writeSublayers(e,r,i){this.get("sublayers.length")&&(r[i]=this.sublayers.map((e=>e.id)).toArray().reverse())}readTypeIdField(e,r){let i=(r=r.layerDefinition||r).typeIdField;if(i&&r.fields){i=i.toLowerCase();const e=r.fields.find((e=>e.name.toLowerCase()===i));e&&(i=e.name)}return null}get url(){var e,r;const i=null!=(e=null==(r=this.layer)?void 0:r.parsedUrl)?e:this._lastParsedUrl,t=this.source;if(!i)return null;if(this._lastParsedUrl=i,"map-layer"===(null==t?void 0:t.type))return`${i.path}/${t.mapLayerId}`;const o={layer:JSON.stringify({source:this.source})};return`${i.path}/dynamicLayer?${m(o)}`}set url(e){e?this._override("url",e):this._clearOverride("url")}set visible(e){this._setAndNotifyLayer("visible",e)}writeVisible(e,r,i,t){r[i]=this.getAtOrigin("defaultVisibility","service")||e}clone(){const{store:e}=b(this),r=new R;return b(r).store=e.clone(H),this.commitProperty("url"),r._lastParsedUrl=this._lastParsedUrl,r}createPopupTemplate(e){return A(this,e)}createQuery(){return new V({returnGeometry:!0,where:this.definitionExpression||"1=1"})}async createFeatureLayer(){var e,r;if(this.hasOwnProperty("sublayers"))return null;const i=null==(e=this.layer)?void 0:e.parsedUrl,t=new(0,(await import("../FeatureLayer.js")).default)({url:i.path});return i&&this.source&&("map-layer"===this.source.type?t.layerId=this.source.mapLayerId:t.dynamicDataSource=this.source),null!=this.layer.refreshInterval&&(t.refreshInterval=this.layer.refreshInterval),this.definitionExpression&&(t.definitionExpression=this.definitionExpression),this.floorInfo&&(t.floorInfo=y(this.floorInfo)),this.originIdOf("labelingInfo")>E.SERVICE&&(t.labelingInfo=y(this.labelingInfo)),this.originIdOf("labelsVisible")>E.DEFAULTS&&(t.labelsVisible=this.labelsVisible),this.originIdOf("legendEnabled")>E.DEFAULTS&&(t.legendEnabled=this.legendEnabled),this.originIdOf("visible")>E.DEFAULTS&&(t.visible=this.visible),this.originIdOf("minScale")>E.DEFAULTS&&(t.minScale=this.minScale),this.originIdOf("maxScale")>E.DEFAULTS&&(t.maxScale=this.maxScale),this.originIdOf("opacity")>E.DEFAULTS&&(t.opacity=this.opacity),this.originIdOf("popupTemplate")>E.DEFAULTS&&(t.popupTemplate=y(this.popupTemplate)),this.originIdOf("renderer")>E.SERVICE&&(t.renderer=y(this.renderer)),"data-layer"===(null==(r=this.source)?void 0:r.type)&&(t.dynamicDataSource=this.source.clone()),this.originIdOf("title")>E.DEFAULTS&&(t.title=this.title),"map-image"===this.layer.type&&this.layer.originIdOf("customParameters")>E.DEFAULTS&&(t.customParameters=this.layer.customParameters),"tile"===this.layer.type&&this.layer.originIdOf("customParameters")>E.DEFAULTS&&(t.customParameters=this.layer.customParameters),t}getField(e){return this.fieldsIndex.get(e)}getFeatureType(e){const{typeIdField:r,types:i}=this;if(!r||!e)return null;const t=e.attributes?e.attributes[r]:void 0;if(null==t)return null;let o=null;return i.some((e=>{const{id:r}=e;return null!=r&&(r.toString()===t.toString()&&(o=e),!!o)})),o}getFieldDomain(e,r){const i=r&&r.feature,t=this.getFeatureType(i);if(t){const r=t.domains&&t.domains[e];if(r&&"inherited"!==r.type)return r}return this._getLayerDomain(e)}async queryFeatures(e=this.createQuery(),r){var i,t,o,l;if(await this.load(),!this.get("capabilities.operations.supportsQuery"))throw new a("Sublayer.queryFeatures","this layer doesn't support queries.");const[{executeQuery:s},{default:n}]=await Promise.all([import("../../rest/query/operations/query.js"),import("../../rest/support/FeatureSet.js")]),p=await s(this.url,V.from(e),null!=(i=null==(t=this.layer)?void 0:t.spatialReference)?i:null,{...r,query:{...null==(o=this.layer)?void 0:o.customParameters,token:null==(l=this.layer)?void 0:l.apiKey}}),y=n.fromJSON(p.data);if(null!=y&&y.features)for(const a of y.features)a.sourceLayer=this;return y}toExportImageJSON(e){var r;const i={id:this.id,source:(null==(r=this.source)?void 0:r.toJSON())||{mapLayerId:this.id,type:"mapLayer"}};if(this.definitionExpression){const r=c(e)?U(e,this):this.definitionExpression;i.definitionExpression=r}else c(e)&&(i.definitionExpression=e);const t=["renderer","labelingInfo","opacity","labelsVisible"].reduce(((e,r)=>(e[r]=this.originIdOf(r),e)),{}),o=Object.keys(t).some((e=>t[e]>E.SERVICE));if(o){const e=i.drawingInfo={};t.renderer>E.SERVICE&&(e.renderer=this.renderer?this.renderer.toJSON():null),t.labelsVisible>E.SERVICE&&(e.showLabels=this.labelsVisible),this.labelsVisible&&t.labelingInfo>E.SERVICE&&(e.labelingInfo=this.labelingInfo?this.labelingInfo.map((e=>e.write({},{origin:"service",layer:this.layer}))):null,e.showLabels=!0),t.opacity>E.SERVICE&&(e.transparency=100-100*this.opacity),this._assignDefaultSymbolColors(e.renderer)}return i}_assignDefaultSymbolColors(e){this._forEachSimpleMarkerSymbols(e,(e=>{e.color||"esriSMSX"!==e.style&&"esriSMSCross"!==e.style||(e.outline&&e.outline.color?e.color=e.outline.color:e.color=[0,0,0,0])}))}_forEachSimpleMarkerSymbols(e,r){if(e){const i="uniqueValueInfos"in e?e.uniqueValueInfos:"classBreakInfos"in e?e.classBreakInfos:[];for(const e of i)k(e.symbol)&&r(e.symbol);"symbol"in e&&k(e.symbol)&&r(e.symbol),"defaultSymbol"in e&&k(e.defaultSymbol)&&r(e.defaultSymbol)}}_setAndNotifyLayer(e,r){const i=this.layer,t=this._get(e);let o,l;switch(e){case"definitionExpression":case"floorInfo":o="supportsSublayerDefinitionExpression";case"minScale":case"maxScale":case"visible":o="supportsSublayerVisibility";break;case"labelingInfo":case"labelsVisible":case"opacity":case"renderer":case"source":o="supportsDynamicLayers",l="supportsModification"}const s=b(this).getDefaultOrigin();if("service"!==s){if(o&&!1===this.get(`layer.capabilities.exportMap.${o}`))return void this._logLockedError(e,`capability not available 'layer.capabilities.exportMap.${o}'`);if(l&&!1===this.get(`capabilities.exportMap.${l}`))return void this._logLockedError(e,`capability not available 'capabilities.exportMap.${l}'`)}"source"!==e||"not-loaded"===this.loadStatus?(this._set(e,r),"service"!==s&&t!==r&&i&&i.emit&&i.emit("sublayer-update",{propertyName:e,target:this})):this._logLockedError(e,"'source' can't be changed after calling sublayer.load()")}_handleSublayersChange(e,r){r&&(r.forEach((e=>{e.parent=null,e.layer=null})),this.handles.removeAll()),e&&(e.forEach((e=>{e.parent=this,e.layer=this.layer})),this.handles.add([e.on("after-add",(({item:e})=>{e.parent=this,e.layer=this.layer})),e.on("after-remove",(({item:e})=>{e.parent=null,e.layer=null})),e.on("before-changes",(e=>{const r=this.get("layer.capabilities.exportMap.supportsSublayersChanges");null==r||r||(Q.error(new a("sublayer:sublayers-non-modifiable","Sublayer can't be added, moved, or removed from the layer's sublayers",{sublayer:this,layer:this.layer})),e.preventDefault())}))]))}_logLockedError(e,r){Q.error(new a("sublayer:locked",`Property '${String(e)}' can't be changed on Sublayer from the layer '${this.layer.id}'`,{reason:r,sublayer:this,layer:this.layer}))}_getLayerDomain(e){const r=this.fieldsIndex.get(e);return r?r.domain:null}};K.test={isMapImageLayerOverridePolicy:e=>e===J||e===q,isTileImageLayerOverridePolicy:e=>e===$},e([h({readOnly:!0})],K.prototype,"capabilities",void 0),e([S("service","capabilities",["layerDefinition.canModifyLayer","layerDefinition.capabilities"])],K.prototype,"readCapabilities",null),e([h({type:String,value:null,json:{name:"layerDefinition.definitionExpression",write:{allowNull:!0,overridePolicy:q}}})],K.prototype,"definitionExpression",null),e([h({type:[O],json:{origins:{service:{read:{source:"layerDefinition.fields"}}}}})],K.prototype,"fields",void 0),e([h({readOnly:!0})],K.prototype,"fieldsIndex",null),e([h({type:T,value:null,json:{name:"layerDefinition.floorInfo",read:{source:"layerDefinition.floorInfo"},write:{target:"layerDefinition.floorInfo",overridePolicy:q},origins:{"web-scene":{read:!1,write:!1}}}})],K.prototype,"floorInfo",null),e([h({type:C,json:{read:{source:"layerDefinition.extent"}}})],K.prototype,"fullExtent",void 0),e([h({type:String})],K.prototype,"globalIdField",void 0),e([S("service","globalIdField",["layerDefinition.globalIdField","layerDefinition.fields"])],K.prototype,"readGlobalIdFieldFromService",null),e([h({type:D,json:{write:{ignoreOrigin:!0}}})],K.prototype,"id",null),e([h({value:null,type:[_],json:{read:{source:"layerDefinition.drawingInfo.labelingInfo"},write:{target:"layerDefinition.drawingInfo.labelingInfo",overridePolicy:J}}})],K.prototype,"labelingInfo",null),e([v("labelingInfo")],K.prototype,"writeLabelingInfo",null),e([h({type:Boolean,value:!0,json:{read:{source:"layerDefinition.drawingInfo.showLabels"},write:{target:"layerDefinition.drawingInfo.showLabels",overridePolicy:J}}})],K.prototype,"labelsVisible",null),e([h({value:null})],K.prototype,"layer",null),e([h({type:Boolean,value:!0,json:{origins:{service:{read:{enabled:!1}}},read:{source:"showLegend"},write:{target:"showLegend",overridePolicy:B}}})],K.prototype,"legendEnabled",void 0),e([h({type:["show","hide","hide-children"],value:"show",json:{read:!1,write:!1,origins:{"web-scene":{read:!0,write:!0}}}})],K.prototype,"listMode",null),e([h({type:Number,value:0,json:{write:{overridePolicy:J}}})],K.prototype,"minScale",null),e([S("minScale",["minScale","layerDefinition.minScale"])],K.prototype,"readMinScale",null),e([h({type:Number,value:0,json:{write:{overridePolicy:J}}})],K.prototype,"maxScale",null),e([S("maxScale",["maxScale","layerDefinition.maxScale"])],K.prototype,"readMaxScale",null),e([h({readOnly:!0})],K.prototype,"effectiveScaleRange",null),e([h({type:String})],K.prototype,"objectIdField",void 0),e([S("service","objectIdField",["layerDefinition.objectIdField","layerDefinition.fields"])],K.prototype,"readObjectIdFieldFromService",null),e([h({type:Number,value:1,json:{write:{target:"layerDefinition.drawingInfo.transparency",overridePolicy:J}}})],K.prototype,"opacity",null),e([S("opacity",["layerDefinition.drawingInfo.transparency","layerDefinition.transparency"])],K.prototype,"readOpacity",null),e([v("opacity")],K.prototype,"writeOpacity",null),e([h({json:{type:D,write:{target:"parentLayerId",writerEnsuresNonNull:!0,overridePolicy:J}}})],K.prototype,"parent",void 0),e([v("parent")],K.prototype,"writeParent",null),e([h({type:Boolean,value:!0,json:{read:{source:"disablePopup",reader:(e,r)=>!r.disablePopup},write:{target:"disablePopup",overridePolicy:B,writer(e,r,i){r[i]=!e}}}})],K.prototype,"popupEnabled",void 0),e([h({type:r,json:{read:{source:"popupInfo"},write:{target:"popupInfo",overridePolicy:B}}})],K.prototype,"popupTemplate",void 0),e([h({readOnly:!0})],K.prototype,"defaultPopupTemplate",null),e([h({types:i,value:null,json:{name:"layerDefinition.drawingInfo.renderer",write:{overridePolicy:J},origins:{"web-scene":{types:t,name:"layerDefinition.drawingInfo.renderer",write:{overridePolicy:J}}}}})],K.prototype,"renderer",null),e([h({types:{key:"type",base:null,typeMap:{"data-layer":N,"map-layer":M}},cast(e){if(e){if("mapLayerId"in e)return L(M,e);if("dataSource"in e)return L(N,e)}return e},json:{name:"layerDefinition.source",write:{overridePolicy:J}}})],K.prototype,"source",null),e([h()],K.prototype,"sourceJSON",void 0),e([h({value:null,json:{type:[D],write:{target:"subLayerIds",allowNull:!0,overridePolicy:J}}})],K.prototype,"sublayers",null),e([g("sublayers")],K.prototype,"castSublayers",null),e([v("sublayers")],K.prototype,"writeSublayers",null),e([h({type:String,json:{name:"name",write:{overridePolicy:B}}})],K.prototype,"title",void 0),e([h({type:String})],K.prototype,"typeIdField",void 0),e([S("typeIdField",["layerDefinition.typeIdField"])],K.prototype,"readTypeIdField",null),e([h({type:[x],json:{origins:{service:{read:{source:"layerDefinition.types"}}}}})],K.prototype,"types",void 0),e([h({type:String,json:{read:{source:"layerUrl"},write:{target:"layerUrl",overridePolicy:$}}})],K.prototype,"url",null),e([h({type:Boolean,value:!0,json:{read:{source:"defaultVisibility"},write:{target:"defaultVisibility",overridePolicy:J}}})],K.prototype,"visible",null),e([v("visible")],K.prototype,"writeVisible",null),K=R=e([I("esri.layers.support.Sublayer")],K);const W=K;export{W 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.24/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../request.js";import i from"../../core/Accessor.js";import{ByteSizeUnit as r}from"../../core/byteSizeEstimations.js";import l from"../../core/Error.js";import{HandleOwnerMixin as s}from"../../core/HandleOwner.js";import a from"../../core/Logger.js";import o from"../../core/LRUCache.js";import n from"../../core/PooledArray.js";import{onAbort as c,isAbortError as h,isAborted as p,createAbortError as m}from"../../core/promiseUtils.js";import{watch as u,syncAndInitial as v}from"../../core/reactiveUtils.js";import{waitTicks as f}from"../../core/scheduling.js";import{objectToQuery as y}from"../../core/urlUtils.js";import{property as b}from"../../core/accessorSupport/decorators/property.js";import"../../core/arrayUtils.js";import"../../core/has.js";import{cast as d}from"../../core/accessorSupport/decorators/cast.js";import{subclass as _}from"../../core/accessorSupport/decorators/subclass.js";import{tilemapDefinitionId as g,Tilemap as w}from"./Tilemap.js";var T;const j=a.getLogger("esri.layers.support.TilemapCache");let z=T=class extends(s(i)){constructor(e){super(e),this._pendingTilemapRequests={},this._availableLevels={},this.levels=5,this.cacheByteSize=2*r.MEGABYTES,this.request=t,this._prefetchingEnabled=!0}initialize(){this._tilemapCache=new o(this.cacheByteSize),this.handles.add([this.watch(["layer.parsedUrl","layer.tileServers?","layer.apiKey?","layer.customParameters?"],(()=>this._initializeTilemapDefinition())),u((()=>{var e,t;return null==(e=this.layer)||null==(t=e.tileInfo)?void 0:t.lods}),(e=>this._initializeAvailableLevels(e)),v)]),this._initializeTilemapDefinition()}castLevels(e){return e<=2?(j.error("Minimum levels for Tilemap is 3, but got ",e),3):e}get size(){return 1<<this.levels}fetchTilemap(e,t,i,r){if(!this._availableLevels[e])return Promise.reject(new l("tilemap-cache:level-unavailable",`Level ${e} is unavailable in the service`));const s=this._tmpTilemapDefinition,a=this._tilemapFromCache(e,t,i,s);if(a)return Promise.resolve(a);const o=r&&r.signal;return r={...r,signal:null},new Promise(((e,t)=>{c(o,(()=>t(m())));const i=g(s);let l=this._pendingTilemapRequests[i];if(!l){l=w.fromDefinition(s,r).then((e=>(this._tilemapCache.put(i,e,e.byteSize),e)));const e=()=>delete this._pendingTilemapRequests[i];this._pendingTilemapRequests[i]=l,l.then(e,e)}l.then(e,t)}))}getAvailability(e,t,i){if(!this._availableLevels[e])return"unavailable";const r=this._tilemapFromCache(e,t,i,this._tmpTilemapDefinition);return r?r.getAvailability(t,i):"unknown"}fetchAvailability(e,t,i,r){return this._availableLevels[e]?this.fetchTilemap(e,t,i,r).catch((e=>e)).then((r=>{if(r instanceof w){const s=r.getAvailability(t,i);return"unavailable"===s?Promise.reject(new l("tile-map:tile-unavailable","Tile is not available",{level:e,row:t,col:i})):s}if(h(r))throw r;return"unknown"})):Promise.reject(new l("tilemap-cache:level-unavailable",`Level ${e} is unavailable in the service`))}fetchAvailabilityUpsample(e,t,i,r,l){r.level=e,r.row=t,r.col=i;const s=this.layer.tileInfo;s.updateTileInfo(r);const a=this.fetchAvailability(e,t,i,l).catch((e=>{if(h(e))throw e;if(s.upsampleTile(r))return this.fetchAvailabilityUpsample(r.level,r.row,r.col,r);throw e}));return this._fetchAvailabilityUpsamplePrefetch(r.id,e,t,i,l,a),a}async _fetchAvailabilityUpsamplePrefetch(e,t,i,r,l,s){if(!this._prefetchingEnabled)return;const a=`prefetch-${e}`;if(this.handles.has(a))return;const o=new AbortController;s.then((()=>o.abort()),(()=>o.abort()));let n=!1;const c={remove(){n||(n=!0,o.abort())}};if(this.handles.add(c,a),await f(10,o.signal).catch((()=>{})),n||(n=!0,this.handles.remove(a)),p(o))return;const h={id:e,level:t,row:i,col:r},m={...l,signal:o.signal},u=this.layer.tileInfo;for(let p=0;T._prefetches.length<T._maxPrefetch&&u.upsampleTile(h);++p){const e=this.fetchAvailability(h.level,h.row,h.col,m);T._prefetches.push(e);const t=()=>{T._prefetches.removeUnordered(e)};e.then(t,t)}}_initializeTilemapDefinition(){var e;if(!this.layer.parsedUrl)return;const{parsedUrl:t,apiKey:i,customParameters:r}=this.layer;this._tilemapCache.clear(),this._tmpTilemapDefinition={service:{url:t.path,query:y({...t.query,...r,token:null!=i?i:null==(e=t.query)?void 0:e.token}),tileServers:this.layer.tileServers,request:this.request,type:this.layer.type},width:this.size,height:this.size,level:0,row:0,col:0}}_tilemapFromCache(e,t,i,r){r.level=e,r.row=t-t%this.size,r.col=i-i%this.size;const l=g(r);return this._tilemapCache.get(l)}_initializeAvailableLevels(e){this._availableLevels={},e&&e.forEach((e=>this._availableLevels[e.level]=!0))}get test(){const e=this;return{get prefetchingEnabled(){return e._prefetchingEnabled},set prefetchingEnabled(t){e._prefetchingEnabled=t},hasTilemap:(t,i,r)=>!!e._tilemapFromCache(t,i,r,e._tmpTilemapDefinition)}}};z._maxPrefetch=4,z._prefetches=new n({initialSize:T._maxPrefetch}),e([b({constructOnly:!0,type:Number})],z.prototype,"levels",void 0),e([d("levels")],z.prototype,"castLevels",null),e([b({readOnly:!0,type:Number})],z.prototype,"size",null),e([b({constructOnly:!0,type:Number})],z.prototype,"cacheByteSize",void 0),e([b({constructOnly:!0})],z.prototype,"layer",void 0),e([b({constructOnly:!0})],z.prototype,"request",void 0),z=T=e([_("esri.layers.support.TilemapCache")],z);export{z as TilemapCache};
5
+ import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../request.js";import i from"../../core/Accessor.js";import{ByteSizeUnit as r}from"../../core/byteSizeEstimations.js";import l from"../../core/Error.js";import{HandleOwnerMixin as s}from"../../core/HandleOwner.js";import a from"../../core/Logger.js";import o from"../../core/LRUCache.js";import n from"../../core/PooledArray.js";import{onAbort as c,isAbortError as h,isAborted as p,createAbortError as m}from"../../core/promiseUtils.js";import{watch as u,syncAndInitial as v}from"../../core/reactiveUtils.js";import{waitTicks as f}from"../../core/scheduling.js";import{objectToQuery as y}from"../../core/urlUtils.js";import{property as b}from"../../core/accessorSupport/decorators/property.js";import"../../core/arrayUtils.js";import"../../core/has.js";import{cast as d}from"../../core/accessorSupport/decorators/cast.js";import{subclass as _}from"../../core/accessorSupport/decorators/subclass.js";import{tilemapDefinitionId as g,Tilemap as w}from"./Tilemap.js";var T;const j=a.getLogger("esri.layers.support.TilemapCache");let z=T=class extends(s(i)){constructor(e){super(e),this._pendingTilemapRequests={},this._availableLevels={},this.levels=5,this.cacheByteSize=2*r.MEGABYTES,this.request=t,this._prefetchingEnabled=!0}initialize(){this._tilemapCache=new o(this.cacheByteSize),this.handles.add([this.watch(["layer.parsedUrl","layer.tileServers?","layer.apiKey?","layer.customParameters?"],(()=>this._initializeTilemapDefinition())),u((()=>{var e,t;return null==(e=this.layer)||null==(t=e.tileInfo)?void 0:t.lods}),(e=>this._initializeAvailableLevels(e)),v)]),this._initializeTilemapDefinition()}castLevels(e){return e<=2?(j.error("Minimum levels for Tilemap is 3, but got ",e),3):e}get size(){return 1<<this.levels}fetchTilemap(e,t,i,r){if(!this._availableLevels[e])return Promise.reject(new l("tilemap-cache:level-unavailable",`Level ${e} is unavailable in the service`));const s=this._tmpTilemapDefinition,a=this._tilemapFromCache(e,t,i,s);if(a)return Promise.resolve(a);const o=r&&r.signal;return r={...r,signal:null},new Promise(((e,t)=>{c(o,(()=>t(m())));const i=g(s);let l=this._pendingTilemapRequests[i];if(!l){l=w.fromDefinition(s,r).then((e=>(this._tilemapCache.put(i,e,e.byteSize),e)));const e=()=>delete this._pendingTilemapRequests[i];this._pendingTilemapRequests[i]=l,l.then(e,e)}l.then(e,t)}))}getAvailability(e,t,i){if(!this._availableLevels[e])return"unavailable";const r=this._tilemapFromCache(e,t,i,this._tmpTilemapDefinition);return r?r.getAvailability(t,i):"unknown"}fetchAvailability(e,t,i,r){return this._availableLevels[e]?this.fetchTilemap(e,t,i,r).catch((e=>e)).then((r=>{if(r instanceof w){const s=r.getAvailability(t,i);if("unavailable"===s)throw new l("tile-map:tile-unavailable","Tile is not available",{level:e,row:t,col:i});return s}if(h(r))throw r;return"unknown"})):Promise.reject(new l("tilemap-cache:level-unavailable",`Level ${e} is unavailable in the service`))}fetchAvailabilityUpsample(e,t,i,r,l){r.level=e,r.row=t,r.col=i;const s=this.layer.tileInfo;s.updateTileInfo(r);const a=this.fetchAvailability(e,t,i,l).catch((e=>{if(h(e))throw e;if(s.upsampleTile(r))return this.fetchAvailabilityUpsample(r.level,r.row,r.col,r);throw e}));return this._fetchAvailabilityUpsamplePrefetch(r.id,e,t,i,l,a),a}async _fetchAvailabilityUpsamplePrefetch(e,t,i,r,l,s){if(!this._prefetchingEnabled)return;const a=`prefetch-${e}`;if(this.handles.has(a))return;const o=new AbortController;s.then((()=>o.abort()),(()=>o.abort()));let n=!1;const c={remove(){n||(n=!0,o.abort())}};if(this.handles.add(c,a),await f(10,o.signal).catch((()=>{})),n||(n=!0,this.handles.remove(a)),p(o))return;const h={id:e,level:t,row:i,col:r},m={...l,signal:o.signal},u=this.layer.tileInfo;for(let p=0;T._prefetches.length<T._maxPrefetch&&u.upsampleTile(h);++p){const e=this.fetchAvailability(h.level,h.row,h.col,m);T._prefetches.push(e);const t=()=>{T._prefetches.removeUnordered(e)};e.then(t,t)}}_initializeTilemapDefinition(){var e;if(!this.layer.parsedUrl)return;const{parsedUrl:t,apiKey:i,customParameters:r}=this.layer;this._tilemapCache.clear(),this._tmpTilemapDefinition={service:{url:t.path,query:y({...t.query,...r,token:null!=i?i:null==(e=t.query)?void 0:e.token}),tileServers:this.layer.tileServers,request:this.request,type:this.layer.type},width:this.size,height:this.size,level:0,row:0,col:0}}_tilemapFromCache(e,t,i,r){r.level=e,r.row=t-t%this.size,r.col=i-i%this.size;const l=g(r);return this._tilemapCache.get(l)}_initializeAvailableLevels(e){this._availableLevels={},e&&e.forEach((e=>this._availableLevels[e.level]=!0))}get test(){const e=this;return{get prefetchingEnabled(){return e._prefetchingEnabled},set prefetchingEnabled(t){e._prefetchingEnabled=t},hasTilemap:(t,i,r)=>!!e._tilemapFromCache(t,i,r,e._tmpTilemapDefinition)}}};z._maxPrefetch=4,z._prefetches=new n({initialSize:T._maxPrefetch}),e([b({constructOnly:!0,type:Number})],z.prototype,"levels",void 0),e([d("levels")],z.prototype,"castLevels",null),e([b({readOnly:!0,type:Number})],z.prototype,"size",null),e([b({constructOnly:!0,type:Number})],z.prototype,"cacheByteSize",void 0),e([b({constructOnly:!0})],z.prototype,"layer",void 0),e([b({constructOnly:!0})],z.prototype,"request",void 0),z=T=e([_("esri.layers.support.TilemapCache")],z);export{z as TilemapCache};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.24/esri/copyright.txt for details.
4
4
  */
5
- import e from"../../config.js";import r from"../../request.js";import{throwIfAborted as s}from"../../core/promiseUtils.js";import{removeTrailingSlash as t,getOrigin as o,isProtocolRelative as l,isAbsolute as i,join as n,normalize as u,removeFile as c,getAppBaseUrl as a,addQueryParameters as f}from"../../core/urlUtils.js";import p from"../../views/2d/engine/vectorTiles/style/VectorTileSource.js";const m=e.defaults&&e.defaults.io.corsEnabledServers;async function y(e,r){const s={source:null,sourceBase:null,sourceUrl:null,validatedSource:null,style:null,styleBase:null,styleUrl:null,sourceNameToSource:{},primarySourceName:"",spriteFormat:"png"},[t,o]="string"==typeof e?[e,null]:[null,e.jsonUrl];await h(s,"esri",e,o,r);const l={layerDefinition:s.validatedSource,url:t,serviceUrl:s.sourceUrl,style:s.style,styleUrl:s.styleUrl,spriteUrl:s.style.sprite&&S(s.styleBase,s.style.sprite),spriteFormat:s.spriteFormat,glyphsUrl:s.style.glyphs&&S(s.styleBase,s.style.glyphs),sourceNameToSource:s.sourceNameToSource,primarySourceName:s.primarySourceName};return d(l.spriteUrl),d(l.glyphsUrl),l}function d(e){if(!e)return;const r=o(e);m&&!m.includes(r)&&m.push(r)}function S(...e){let r;for(let s=0;s<e.length;++s)if(l(e[s])){if(r){const t=r.split("://")[0];r=t+":"+e[s].trim()}}else r=i(e[s])?e[s]:n(r,e[s]);return t(r)}async function h(e,t,o,l,i){let n,c,a;if(s(i),"string"==typeof o){const e=u(o);d(e),a=await r(e,{...i,responseType:"json",query:{f:"json",...null==i?void 0:i.query}}),a.ssl&&(n&&(n=n.replace(/^http:/i,"https:")),c&&(c=c.replace(/^http:/i,"https:"))),n=e,c=e}else a={data:o},n=o.jsonUrl||null,c=l;const f=a.data;return U(f)?(e.styleUrl=n||null,v(e,f,c,i)):x(f)?e.sourceUrl?w(e,f,c,!1,t,i):(e.sourceUrl=n||null,w(e,f,c,!0,t,i)):Promise.reject("You must specify the URL or the JSON for a service or for a style.")}function U(e){return!!e.sources}function x(e){return!U(e)}async function v(e,r,s,t){const o=s?c(s):a();e.styleBase=o,e.style=r,e.styleUrl&&d(e.styleUrl),r["sprite-format"]&&"webp"===r["sprite-format"].toLowerCase()&&(e.spriteFormat="webp");const l=[];if(r.sources&&r.sources.esri){const s=r.sources.esri;s.url?await h(e,"esri",S(o,s.url),void 0,t):l.push(h(e,"esri",s,o,t))}for(const i of Object.keys(r.sources))"esri"!==i&&"vector"===r.sources[i].type&&(r.sources[i].url?l.push(h(e,i,S(o,r.sources[i].url),void 0,t)):r.sources[i].tiles&&l.push(h(e,i,r.sources[i],o,t)));await Promise.all(l)}async function w(e,r,s,o,l,i){const n=s?t(s)+"/":a(),u=g(r,n),c=new p(l,f(n,null==i?void 0:i.query),u);if(!o&&e.primarySourceName in e.sourceNameToSource){const r=e.sourceNameToSource[e.primarySourceName];if(!r.isCompatibleWith(c))return Promise.resolve();null!=c.fullExtent&&(null!=r.fullExtent?r.fullExtent.union(c.fullExtent):r.fullExtent=c.fullExtent.clone()),r.tileInfo.lods.length<c.tileInfo.lods.length&&(r.tileInfo=c.tileInfo)}if(o?(e.sourceBase=n,e.source=r,e.validatedSource=u,e.primarySourceName=l,e.sourceUrl&&d(e.sourceUrl)):d(n),e.sourceNameToSource[l]=c,!e.style)return null==r.defaultStyles?Promise.reject():"string"==typeof r.defaultStyles?h(e,"",S(n,r.defaultStyles,"root.json"),void 0,i):h(e,"",r.defaultStyles,S(n,"root.json"),i)}function g(e,r){if(e.hasOwnProperty("tileInfo"))return e;const s={xmin:-20037507.067161843,ymin:-20037507.067161843,xmax:20037507.067161843,ymax:20037507.067161843,spatialReference:{wkid:102100}},t=512;let o=78271.51696400007,l=295828763.7957775;const i=[],n=e.hasOwnProperty("minzoom")?+e.minzoom:0,u=e.hasOwnProperty("maxzoom")?+e.maxzoom:22;for(let c=0;c<=u;c++)c>=n&&i.push({level:c,scale:l,resolution:o}),o/=2,l/=2;for(const c of e.tiles)d(S(r,c));return{capabilities:"TilesOnly",initialExtent:s,fullExtent:s,minScale:0,maxScale:0,tiles:e.tiles,tileInfo:{rows:t,cols:t,dpi:96,format:"pbf",origin:{x:-20037508.342787,y:20037508.342787},lods:i,spatialReference:{wkid:102100}}}}export{y as loadMetadata};
5
+ import e from"../../config.js";import r from"../../request.js";import{throwIfAborted as t}from"../../core/promiseUtils.js";import{removeTrailingSlash as s,getOrigin as o,isProtocolRelative as l,isAbsolute as n,join as i,normalize as u,removeFile as c,getAppBaseUrl as a,addQueryParameters as f}from"../../core/urlUtils.js";import p from"../../views/2d/engine/vectorTiles/style/VectorTileSource.js";const y=e.defaults&&e.defaults.io.corsEnabledServers;async function m(e,r){const t={source:null,sourceBase:null,sourceUrl:null,validatedSource:null,style:null,styleBase:null,styleUrl:null,sourceNameToSource:{},primarySourceName:"",spriteFormat:"png"},[s,o]="string"==typeof e?[e,null]:[null,e.jsonUrl];await S(t,"esri",e,o,r);const l={layerDefinition:t.validatedSource,url:s,serviceUrl:t.sourceUrl,style:t.style,styleUrl:t.styleUrl,spriteUrl:t.style.sprite&&h(t.styleBase,t.style.sprite),spriteFormat:t.spriteFormat,glyphsUrl:t.style.glyphs&&h(t.styleBase,t.style.glyphs),sourceNameToSource:t.sourceNameToSource,primarySourceName:t.primarySourceName};return d(l.spriteUrl),d(l.glyphsUrl),l}function d(e){if(!e)return;const r=o(e);y&&!y.includes(r)&&y.push(r)}function h(...e){let r;for(let t=0;t<e.length;++t)if(l(e[t])){if(r){const s=r.split("://")[0];r=s+":"+e[t].trim()}}else r=n(e[t])?e[t]:i(r,e[t]);return s(r)}async function S(e,s,o,l,n){let i,c,a;if(t(n),"string"==typeof o){const e=u(o);d(e),a=await r(e,{...n,responseType:"json",query:{f:"json",...null==n?void 0:n.query}}),a.ssl&&(i&&(i=i.replace(/^http:/i,"https:")),c&&(c=c.replace(/^http:/i,"https:"))),i=e,c=e}else a={data:o},i=o.jsonUrl||null,c=l;const f=a.data;if(U(f))return e.styleUrl=i||null,x(e,f,c,n);if(w(f))return e.sourceUrl?v(e,f,c,!1,s,n):(e.sourceUrl=i||null,v(e,f,c,!0,s,n));throw new Error("You must specify the URL or the JSON for a service or for a style.")}function U(e){return!!e.sources}function w(e){return!U(e)}async function x(e,r,t,s){const o=t?c(t):a();e.styleBase=o,e.style=r,e.styleUrl&&d(e.styleUrl),r["sprite-format"]&&"webp"===r["sprite-format"].toLowerCase()&&(e.spriteFormat="webp");const l=[];if(r.sources&&r.sources.esri){const t=r.sources.esri;t.url?await S(e,"esri",h(o,t.url),void 0,s):l.push(S(e,"esri",t,o,s))}for(const n of Object.keys(r.sources))"esri"!==n&&"vector"===r.sources[n].type&&(r.sources[n].url?l.push(S(e,n,h(o,r.sources[n].url),void 0,s)):r.sources[n].tiles&&l.push(S(e,n,r.sources[n],o,s)));await Promise.all(l)}async function v(e,r,t,o,l,n){const i=t?s(t)+"/":a(),u=g(r,i),c=new p(l,f(i,null==n?void 0:n.query),u);if(!o&&e.primarySourceName in e.sourceNameToSource){const r=e.sourceNameToSource[e.primarySourceName];if(!r.isCompatibleWith(c))return;null!=c.fullExtent&&(null!=r.fullExtent?r.fullExtent.union(c.fullExtent):r.fullExtent=c.fullExtent.clone()),r.tileInfo.lods.length<c.tileInfo.lods.length&&(r.tileInfo=c.tileInfo)}if(o?(e.sourceBase=i,e.source=r,e.validatedSource=u,e.primarySourceName=l,e.sourceUrl&&d(e.sourceUrl)):d(i),e.sourceNameToSource[l]=c,!e.style){if(null==r.defaultStyles)throw new Error;return"string"==typeof r.defaultStyles?S(e,"",h(i,r.defaultStyles,"root.json"),void 0,n):S(e,"",r.defaultStyles,h(i,"root.json"),n)}}function g(e,r){if(e.hasOwnProperty("tileInfo"))return e;const t={xmin:-20037507.067161843,ymin:-20037507.067161843,xmax:20037507.067161843,ymax:20037507.067161843,spatialReference:{wkid:102100}},s=512;let o=78271.51696400007,l=295828763.7957775;const n=[],i=e.hasOwnProperty("minzoom")?+e.minzoom:0,u=e.hasOwnProperty("maxzoom")?+e.maxzoom:22;for(let c=0;c<=u;c++)c>=i&&n.push({level:c,scale:l,resolution:o}),o/=2,l/=2;for(const c of e.tiles)d(h(r,c));return{capabilities:"TilesOnly",initialExtent:t,fullExtent:t,minScale:0,maxScale:0,tiles:e.tiles,tileInfo:{rows:s,cols:s,dpi:96,format:"pbf",origin:{x:-20037508.342787,y:20037508.342787},lods:n,spatialReference:{wkid:102100}}}}export{m as loadMetadata};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.24/esri/copyright.txt for details.
4
4
  */
5
- import{getAssetUrl as e}from"../../assets.js";function t(){return n||(n=new Promise((e=>import("../../chunks/i3s.js").then((e=>e.i)).then((({default:t})=>{const n=t({locateFile:i,onRuntimeInitialized:()=>e(n)});delete n.then})))).catch((e=>Promise.reject(e)))),n}function i(t){return e(`esri/libs/i3s/${t}`)}let n;export{t as get};
5
+ import{getAssetUrl as t}from"../../assets.js";function e(){return n||(n=new Promise((t=>import("../../chunks/i3s.js").then((t=>t.i)).then((({default:e})=>{const n=e({locateFile:i,onRuntimeInitialized:()=>t(n)});delete n.then})))).catch((t=>{throw t}))),n}function i(e){return t(`esri/libs/i3s/${e}`)}let n;export{e as get};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.24/esri/copyright.txt for details.
4
4
  */
5
- import{getAssetUrl as e}from"../../assets.js";function t(e){return new Promise((t=>import("../../chunks/vxlLayer.js").then((e=>e.v)).then((({default:n})=>{const r=n({locateFile:i,preinitializedWebGLContext:e,onRuntimeInitialized:()=>t(r)})})))).catch((e=>Promise.reject(e)))}function i(t){return e(`esri/libs/vxl/${t}`)}export{t as loadVoxelWASM};
5
+ import{getAssetUrl as t}from"../../assets.js";function e(t){return new Promise((e=>import("../../chunks/vxlLayer.js").then((t=>t.v)).then((({default:n})=>{const r=n({locateFile:i,preinitializedWebGLContext:t,onRuntimeInitialized:()=>e(r)})})))).catch((t=>{throw t}))}function i(e){return t(`esri/libs/vxl/${e}`)}export{e as loadVoxelWASM};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arcgis/core",
3
- "version": "4.24.0-next.20220331",
3
+ "version": "4.24.0-next.20220401",
4
4
  "homepage": "https://js.arcgis.com",
5
5
  "description": "ArcGIS API for JavaScript: A complete 2D and 3D mapping and data visualization API",
6
6
  "keywords": [
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.24/esri/copyright.txt for details.
4
4
  */
5
- import e from"../../core/Error.js";import{layerLookupMap as t}from"../../layers/support/lazyLayerLoader.js";import r from"../Portal.js";import{createForItem as n}from"./jsonContext.js";import{loadStyleRenderer as l}from"../../renderers/support/styleUtils.js";import{requestArcGISServiceJSON as a}from"../../support/requestPresets.js";async function o(e,t){const r=e.instance.portalItem;return r&&r.id?(await r.load(t),s(e),i(e,t)):Promise.resolve()}function s(t){const r=t.instance.portalItem;if(!t.supportedTypes.includes(r.type))throw new e("portal:invalid-layer-item-type","Invalid layer item type '${type}', expected '${expectedType}'",{type:r.type,expectedType:t.supportedTypes.join(", ")})}async function i(e,t){const r=e.instance,a=r.portalItem,{url:o,title:s}=a,i=n(a);if("group"===r.type)return r.read({title:s},i),u(r,e);o&&r.read({url:o},i);const c=await y(e,t);return c&&r.read(c,i),r.resourceReferences={portalItem:a,paths:i.readResourcePaths},r.read({title:s},i),l(r,i)}function u(r,n){let l;const a=r.portalItem.type;switch(a){case"Feature Service":case"Feature Collection":l=t.FeatureLayer;break;case"Stream Service":l=t.StreamLayer;break;case"Scene Service":l=t.SceneLayer;break;default:throw new e("portal:unsupported-item-type-as-group",`The item type '${a}' is not supported as a 'IGroupLayer'`)}let o;return l().then((e=>(o=e,y(n)))).then((async e=>"Feature Service"===a?(e=await m(e,r.portalItem.url),p(r,o,e)):h(e)>0?p(r,o,e):c(r,o)))}function c(e,t){return e.portalItem.url?a(e.portalItem.url).then((r=>{var n,l;function a(e){return{id:e.id,name:e.name}}r&&p(e,t,{layers:null==(n=r.layers)?void 0:n.map(a),tables:null==(l=r.tables)?void 0:l.map(a)})})):Promise.resolve()}function p(e,t,r){let n=r.layers||[];const l=r.tables||[];"Feature Collection"===e.portalItem.type&&(n.forEach((e=>{var t;"Table"===(null==e||null==(t=e.layerDefinition)?void 0:t.type)&&l.push(e)})),n=n.filter((e=>{var t;return"Table"!==(null==e||null==(t=e.layerDefinition)?void 0:t.type)}))),n.reverse().forEach((n=>{const l=d(e,t,r,n);e.add(l)})),l.reverse().forEach((n=>{const l=d(e,t,r,n);e.tables.add(l)}))}function d(e,t,n,l){const a=new t({portalItem:e.portalItem.clone(),layerId:l.id,sublayerTitleMode:"service-name"});if("Feature Collection"===e.portalItem.type){const t={origin:"portal-item",portal:e.portalItem.portal||r.getDefault()};a.read(l,t);const o=n.showLegend;null!=o&&a.read({showLegend:o},t)}return a}function y(e,t){if(!1===e.supportsData)return Promise.resolve(void 0);const r=e.instance;return r.portalItem.fetchData("json",t).catch((()=>null)).then((async e=>{if(I(r)){let t,n=!0;return e&&h(e)>0&&(null==r.layerId&&(r.layerId=f(e)),t=v(e,r.layerId),t&&(1===h(e)&&(n=!1),null!=e.showLegend&&(t.showLegend=e.showLegend))),n&&"service-name"!==r.sublayerTitleMode&&(r.sublayerTitleMode="item-title-and-service-name"),t}return e}))}async function m(e,t){var r,n;if(null==(null==(r=e)?void 0:r.layers)||null==(null==(n=e)?void 0:n.tables)){const r=await a(t);(e=e||{}).layers=e.layers||(null==r?void 0:r.layers),e.tables=e.tables||(null==r?void 0:r.tables)}return e}function f(e){const t=e.layers;if(t&&t.length)return t[0].id;const r=e.tables;return r&&r.length?r[0].id:null}function v(e,t){const r=e.layers;if(r)for(let l=0;l<r.length;l++)if(r[l].id===t)return r[l];const n=e.tables;if(n)for(let l=0;l<n.length;l++)if(n[l].id===t)return n[l];return null}function h(e){var t,r,n,l;return(null!=(t=null==e||null==(r=e.layers)?void 0:r.length)?t:0)+(null!=(n=null==e||null==(l=e.tables)?void 0:l.length)?n:0)}function I(e){return"stream"!==e.type&&"layerId"in e}export{f as getFirstLayerOrTableId,h as getNumLayersAndTables,o as load,m as preprocessFSItemData};
5
+ import e from"../../core/Error.js";import{layerLookupMap as t}from"../../layers/support/lazyLayerLoader.js";import r from"../Portal.js";import{createForItem as n}from"./jsonContext.js";import{loadStyleRenderer as l}from"../../renderers/support/styleUtils.js";import{requestArcGISServiceJSON as a}from"../../support/requestPresets.js";async function o(e,t){const r=e.instance.portalItem;if(r&&r.id)return await r.load(t),s(e),i(e,t)}function s(t){const r=t.instance.portalItem;if(!t.supportedTypes.includes(r.type))throw new e("portal:invalid-layer-item-type","Invalid layer item type '${type}', expected '${expectedType}'",{type:r.type,expectedType:t.supportedTypes.join(", ")})}async function i(e,t){const r=e.instance,a=r.portalItem,{url:o,title:s}=a,i=n(a);if("group"===r.type)return r.read({title:s},i),u(r,e);o&&r.read({url:o},i);const c=await y(e,t);return c&&r.read(c,i),r.resourceReferences={portalItem:a,paths:i.readResourcePaths},r.read({title:s},i),l(r,i)}function u(r,n){let l;const a=r.portalItem.type;switch(a){case"Feature Service":case"Feature Collection":l=t.FeatureLayer;break;case"Stream Service":l=t.StreamLayer;break;case"Scene Service":l=t.SceneLayer;break;default:throw new e("portal:unsupported-item-type-as-group",`The item type '${a}' is not supported as a 'IGroupLayer'`)}let o;return l().then((e=>(o=e,y(n)))).then((async e=>"Feature Service"===a?(e=await f(e,r.portalItem.url),p(r,o,e)):h(e)>0?p(r,o,e):c(r,o)))}function c(e,t){return e.portalItem.url?a(e.portalItem.url).then((r=>{var n,l;function a(e){return{id:e.id,name:e.name}}r&&p(e,t,{layers:null==(n=r.layers)?void 0:n.map(a),tables:null==(l=r.tables)?void 0:l.map(a)})})):Promise.resolve()}function p(e,t,r){let n=r.layers||[];const l=r.tables||[];"Feature Collection"===e.portalItem.type&&(n.forEach((e=>{var t;"Table"===(null==e||null==(t=e.layerDefinition)?void 0:t.type)&&l.push(e)})),n=n.filter((e=>{var t;return"Table"!==(null==e||null==(t=e.layerDefinition)?void 0:t.type)}))),n.reverse().forEach((n=>{const l=d(e,t,r,n);e.add(l)})),l.reverse().forEach((n=>{const l=d(e,t,r,n);e.tables.add(l)}))}function d(e,t,n,l){const a=new t({portalItem:e.portalItem.clone(),layerId:l.id,sublayerTitleMode:"service-name"});if("Feature Collection"===e.portalItem.type){const t={origin:"portal-item",portal:e.portalItem.portal||r.getDefault()};a.read(l,t);const o=n.showLegend;null!=o&&a.read({showLegend:o},t)}return a}function y(e,t){if(!1===e.supportsData)return Promise.resolve(void 0);const r=e.instance;return r.portalItem.fetchData("json",t).catch((()=>null)).then((async e=>{if(I(r)){let t,n=!0;return e&&h(e)>0&&(null==r.layerId&&(r.layerId=m(e)),t=v(e,r.layerId),t&&(1===h(e)&&(n=!1),null!=e.showLegend&&(t.showLegend=e.showLegend))),n&&"service-name"!==r.sublayerTitleMode&&(r.sublayerTitleMode="item-title-and-service-name"),t}return e}))}async function f(e,t){var r,n;if(null==(null==(r=e)?void 0:r.layers)||null==(null==(n=e)?void 0:n.tables)){const r=await a(t);(e=e||{}).layers=e.layers||(null==r?void 0:r.layers),e.tables=e.tables||(null==r?void 0:r.tables)}return e}function m(e){const t=e.layers;if(t&&t.length)return t[0].id;const r=e.tables;return r&&r.length?r[0].id:null}function v(e,t){const r=e.layers;if(r)for(let l=0;l<r.length;l++)if(r[l].id===t)return r[l];const n=e.tables;if(n)for(let l=0;l<n.length;l++)if(n[l].id===t)return n[l];return null}function h(e){var t,r,n,l;return(null!=(t=null==e||null==(r=e.layers)?void 0:r.length)?t:0)+(null!=(n=null==e||null==(l=e.tables)?void 0:l.length)?n:0)}function I(e){return"stream"!==e.type&&"layerId"in e}export{m as getFirstLayerOrTableId,h as getNumLayersAndTables,o as load,f as preprocessFSItemData};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.24/esri/copyright.txt for details.
4
4
  */
5
- import e from"../../core/Error.js";import{layerLookupMap as r}from"../../layers/support/lazyLayerLoader.js";import t from"../PortalItem.js";import{getNumLayersAndTables as a,preprocessFSItemData as n,getFirstLayerOrTableId as s}from"./layersLoader.js";import{hasTypeKeyword as o}from"./portalItemUtils.js";import{requestArcGISServiceJSON as c}from"../../support/requestPresets.js";function u(e){return!e.portalItem||e.portalItem instanceof t||(e={...e,portalItem:new t(e.portalItem)}),l(e.portalItem).then((r=>{const t={portalItem:e.portalItem,...r.properties},a=r.constructor;return Promise.resolve(new a(t))}))}function l(e){return e.load().then(i).then(y)}function i(r){switch(r.type){case"Map Service":return m(r);case"Feature Service":return p(r);case"Feature Collection":return L(r);case"Scene Service":return f(r);case"Image Service":return d(r);case"Stream Service":return N();case"Vector Tile Service":return S();case"KML":return I();case"WFS":return h();case"WMTS":return v();case"WMS":return g();case"Feed":return w();default:return Promise.reject(new e("portal:unknown-item-type","Unknown item type '${type}'",{type:r.type}))}}function y(e){return(0,r[e.className])().then((r=>({constructor:r,properties:e.properties})))}function m(e){return T(e).then((e=>e?{className:"TileLayer"}:{className:"MapImageLayer"}))}function p(e){return M(e).then((e=>{if("object"==typeof e){const r={};return null!=e.id&&(r.layerId=e.id),{className:"FeatureLayer",properties:r}}return{className:"GroupLayer"}}))}function f(e){return M(e).then((r=>{if("object"==typeof r){const t={};let a;if(null!=r.id?(t.layerId=r.id,a=`${e.url}/layers/${r.id}`):a=e.url,Array.isArray(e.typeKeywords)&&e.typeKeywords.length>0){const r={IntegratedMesh:"IntegratedMeshLayer","3DObject":"SceneLayer",Point:"SceneLayer",PointCloud:"PointCloudLayer",Building:"BuildingSceneLayer"};for(const t of Object.keys(r))if(e.typeKeywords.includes(t))return{className:r[t]}}return c(a).then((e=>{let r="SceneLayer";const a={Point:"SceneLayer","3DObject":"SceneLayer",IntegratedMesh:"IntegratedMeshLayer",PointCloud:"PointCloudLayer",Building:"BuildingSceneLayer"};return e&&e.layerType&&a[e.layerType]&&(r=a[e.layerType]),{className:r,properties:t}}))}return!1===r?c(e.url).then((e=>"Voxel"===(null==e?void 0:e.layerType)?{className:"VoxelLayer"}:{className:"GroupLayer"})):{className:"GroupLayer"}}))}async function L(e){await e.load();if(o(e,"Map Notes"))return{className:"MapNotesLayer"};if(o(e,"Route Layer"))return{className:"RouteLayer"};const r=await e.fetchData();return 1===a(r)?{className:"FeatureLayer"}:{className:"GroupLayer"}}async function d(e){var r,t,a;await e.load();const n=null!=(r=null==(t=e.typeKeywords)?void 0:t.map((e=>e.toLowerCase())))?r:[];if(n.includes("elevation 3d layer"))return{className:"ElevationLayer"};if(n.includes("tiled imagery"))return{className:"ImageryTileLayer"};const s=await e.fetchData(),o=null==s?void 0:s.layerType;if("ArcGISTiledImageServiceLayer"===o)return{className:"ImageryTileLayer"};if("ArcGISImageServiceLayer"===o)return{className:"ImageryLayer"};return"map"===(null==(a=(await c(e.url)).cacheType)?void 0:a.toLowerCase())?{className:"ImageryTileLayer"}:{className:"ImageryLayer"}}function N(){return{className:"StreamLayer"}}function S(){return{className:"VectorTileLayer"}}function I(){return{className:"KMLLayer"}}function h(){return{className:"WFSLayer"}}function g(){return{className:"WMSLayer"}}function v(){return{className:"WMTSLayer"}}function w(){return{className:"StreamLayer"}}function T(e){return c(e.url).then((e=>e.tileInfo))}function M(e){return!e.url||e.url.match(/\/\d+$/)?Promise.resolve({}):e.load().then((()=>e.fetchData())).then((async r=>{if("Feature Service"===e.type)return j(r=await n(r,e.url));return a(r)>0?j(r):c(e.url).then(j)}))}function j(e){return 1===a(e)&&{id:s(e)}}export{u as fromItem,i as selectLayerClassPath};
5
+ import e from"../../core/Error.js";import{layerLookupMap as r}from"../../layers/support/lazyLayerLoader.js";import t from"../PortalItem.js";import{getNumLayersAndTables as a,preprocessFSItemData as n,getFirstLayerOrTableId as s}from"./layersLoader.js";import{hasTypeKeyword as o}from"./portalItemUtils.js";import{requestArcGISServiceJSON as c}from"../../support/requestPresets.js";function u(e){return!e.portalItem||e.portalItem instanceof t||(e={...e,portalItem:new t(e.portalItem)}),l(e.portalItem).then((r=>{const t={portalItem:e.portalItem,...r.properties};return new(0,r.constructor)(t)}))}function l(e){return e.load().then(i).then(y)}function i(r){switch(r.type){case"Map Service":return m(r);case"Feature Service":return p(r);case"Feature Collection":return L(r);case"Scene Service":return f(r);case"Image Service":return d(r);case"Stream Service":return N();case"Vector Tile Service":return S();case"KML":return I();case"WFS":return h();case"WMTS":return w();case"WMS":return g();case"Feed":return v();default:return Promise.reject(new e("portal:unknown-item-type","Unknown item type '${type}'",{type:r.type}))}}function y(e){return(0,r[e.className])().then((r=>({constructor:r,properties:e.properties})))}function m(e){return T(e).then((e=>e?{className:"TileLayer"}:{className:"MapImageLayer"}))}function p(e){return M(e).then((e=>{if("object"==typeof e){const r={};return null!=e.id&&(r.layerId=e.id),{className:"FeatureLayer",properties:r}}return{className:"GroupLayer"}}))}function f(e){return M(e).then((r=>{if("object"==typeof r){const t={};let a;if(null!=r.id?(t.layerId=r.id,a=`${e.url}/layers/${r.id}`):a=e.url,Array.isArray(e.typeKeywords)&&e.typeKeywords.length>0){const r={IntegratedMesh:"IntegratedMeshLayer","3DObject":"SceneLayer",Point:"SceneLayer",PointCloud:"PointCloudLayer",Building:"BuildingSceneLayer"};for(const t of Object.keys(r))if(e.typeKeywords.includes(t))return{className:r[t]}}return c(a).then((e=>{let r="SceneLayer";const a={Point:"SceneLayer","3DObject":"SceneLayer",IntegratedMesh:"IntegratedMeshLayer",PointCloud:"PointCloudLayer",Building:"BuildingSceneLayer"};return e&&e.layerType&&a[e.layerType]&&(r=a[e.layerType]),{className:r,properties:t}}))}return!1===r?c(e.url).then((e=>"Voxel"===(null==e?void 0:e.layerType)?{className:"VoxelLayer"}:{className:"GroupLayer"})):{className:"GroupLayer"}}))}async function L(e){await e.load();if(o(e,"Map Notes"))return{className:"MapNotesLayer"};if(o(e,"Route Layer"))return{className:"RouteLayer"};const r=await e.fetchData();return 1===a(r)?{className:"FeatureLayer"}:{className:"GroupLayer"}}async function d(e){var r,t,a;await e.load();const n=null!=(r=null==(t=e.typeKeywords)?void 0:t.map((e=>e.toLowerCase())))?r:[];if(n.includes("elevation 3d layer"))return{className:"ElevationLayer"};if(n.includes("tiled imagery"))return{className:"ImageryTileLayer"};const s=await e.fetchData(),o=null==s?void 0:s.layerType;if("ArcGISTiledImageServiceLayer"===o)return{className:"ImageryTileLayer"};if("ArcGISImageServiceLayer"===o)return{className:"ImageryLayer"};return"map"===(null==(a=(await c(e.url)).cacheType)?void 0:a.toLowerCase())?{className:"ImageryTileLayer"}:{className:"ImageryLayer"}}function N(){return{className:"StreamLayer"}}function S(){return{className:"VectorTileLayer"}}function I(){return{className:"KMLLayer"}}function h(){return{className:"WFSLayer"}}function g(){return{className:"WMSLayer"}}function w(){return{className:"WMTSLayer"}}function v(){return{className:"StreamLayer"}}function T(e){return c(e.url).then((e=>e.tileInfo))}function M(e){return!e.url||e.url.match(/\/\d+$/)?Promise.resolve({}):e.load().then((()=>e.fetchData())).then((async r=>{if("Feature Service"===e.type)return j(r=await n(r,e.url));return a(r)>0?j(r):c(e.url).then(j)}))}function j(e){return 1===a(e)&&{id:s(e)}}export{u as fromItem,i as selectLayerClassPath};