@arcgis/core 4.30.0-next.20240213 → 4.30.0-next.20240214
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.
- package/TimeExtent.js +1 -1
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/051c00021039f20ad935.js +1 -0
- package/assets/esri/core/workers/chunks/08ba549f9c4afc42a21c.js +1 -0
- package/assets/esri/core/workers/chunks/{a384f29cb3256401962a.js → 1629a8c2085dce59cd1b.js} +1 -1
- package/assets/esri/core/workers/chunks/18512caeeb03b9759ab1.js +1 -0
- package/assets/esri/core/workers/chunks/{cc1c958aad790a44048b.js → 1ca28af7c516d8283bb0.js} +1 -1
- package/assets/esri/core/workers/chunks/1f8a0fb32b96e50f5909.js +1 -0
- package/assets/esri/core/workers/chunks/25f7e92cb4934c4930be.js +1 -0
- package/assets/esri/core/workers/chunks/2649166d1a462c7f8338.js +1 -0
- package/assets/esri/core/workers/chunks/51e4f771bfe352967c97.js +1 -0
- package/assets/esri/core/workers/chunks/5467bacd2771e6b1cdfa.js +1 -0
- package/assets/esri/core/workers/chunks/5638d95e600ff271c5b1.js +1 -0
- package/assets/esri/core/workers/chunks/58f088b08e12c5435dbc.js +1 -0
- package/assets/esri/core/workers/chunks/5aef1e898618f8dda2c9.js +1 -0
- package/assets/esri/core/workers/chunks/656ec8a14df0e4b68433.js +1 -0
- package/assets/esri/core/workers/chunks/66f21348fb68c83b9dc3.js +1108 -0
- package/assets/esri/core/workers/chunks/{eb2d6f1ee63b40ae0736.js → 774b655498289b1b36bb.js} +1 -1
- package/assets/esri/core/workers/chunks/9310f1de92d9b82dc803.js +1 -0
- package/assets/esri/core/workers/chunks/{f03d62ab7806b68d0b62.js → 9fbf61675e2a5374f754.js} +1 -1
- package/assets/esri/core/workers/chunks/a0b017a34cafd08ce945.js +1 -0
- package/assets/esri/core/workers/chunks/a28711db61c1df2d7bac.js +1 -0
- package/assets/esri/core/workers/chunks/aa9b46bcb75c96731de3.js +1 -0
- package/assets/esri/core/workers/chunks/c83da4659646ce3f5b50.js +1 -0
- package/assets/esri/core/workers/chunks/{05ebb9cec0e1826b283f.js → cafcc53175f9d4c5de2f.js} +1 -1
- package/assets/esri/core/workers/chunks/{1c6914ded7db720f7bf7.js → daf6eab5dd198ca9a67b.js} +1 -1
- package/assets/esri/core/workers/chunks/e03edeaf3af46495449e.js +1 -0
- package/assets/esri/core/workers/chunks/e0c9f29eedfa71554445.js +1 -0
- package/assets/esri/core/workers/chunks/e123017c670f22266768.js +1 -0
- package/assets/esri/core/workers/chunks/eba3a6f0a66b51b8ec12.js +1 -0
- package/assets/esri/core/workers/chunks/ebb294c82207f3ff9f04.js +1 -0
- package/assets/esri/core/workers/chunks/{e4da908079417cc2f495.js → ee0c77889059815a31b2.js} +1 -1
- package/assets/esri/core/workers/chunks/f36e55302b45e2936a5b.js +1 -0
- package/assets/esri/core/workers/chunks/f85e67d4a18603ccaaed.js +1 -0
- package/assets/esri/core/workers/chunks/f90bbebd2dc07a77ce09.js +1 -0
- package/chunks/vec32.js +1 -1
- package/interfaces.d.ts +131 -66
- package/layers/WFSLayer.js +1 -1
- package/layers/buildingSublayers/BuildingComponentSublayer.js +1 -1
- package/layers/graphics/sources/FeatureLayerSource.js +1 -1
- package/layers/mixins/ArcGISImageService.js +1 -1
- package/package.json +1 -1
- package/portal/Portal.js +1 -1
- package/portal/PortalGroup.js +1 -1
- package/portal/PortalUser.js +1 -1
- package/portal/support/geometryServiceUtils.js +1 -1
- package/rest/knowledgeGraph/wasmInterface/wasmToUpdateResponseFactories.js +1 -1
- package/rest/networks/support/Association.js +1 -1
- package/rest/places.js +1 -1
- package/rest/query/operations/pbfJSONFeatureSet.js +1 -1
- package/rest/support/ImageSampleParameters.js +1 -1
- package/smartMapping/support/adapters/FeatureLayerAdapter.js +1 -1
- package/smartMapping/support/adapters/SceneLayerAdapter.js +1 -1
- package/support/elevationInfoUtils.js +1 -1
- package/support/revision.js +1 -1
- package/symbols/cim/cimAnalyzer.js +1 -1
- package/symbols/cim/defaultCIMValues.js +1 -1
- package/symbols/cim/utils.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/labels/LabelMeshWriter.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/text/TextMeshWriter.js +1 -1
- package/views/3d/interactive/measurementTools/directLineMeasurement3D/DirectLineMeasurement3DView.js +1 -1
- package/views/3d/layers/BuildingComponentSublayerView3D.js +1 -1
- package/views/3d/layers/IntegratedMeshLayerView3D.js +1 -1
- package/views/3d/layers/SceneLayerView3D.js +1 -1
- package/views/3d/layers/graphics/Graphics3DMeshFillSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/objectResourceUtils.js +1 -1
- package/views/3d/layers/support/FeatureTileVisibility3D.js +1 -1
- package/views/3d/state/helpers/SceneIntersectionHelper.js +1 -1
- package/views/3d/terrain/OverlayFramebufferObject.js +1 -1
- package/views/3d/terrain/OverlayRenderer.js +1 -1
- package/views/3d/webgl/RenderNode.js +1 -1
- package/views/3d/webgl-engine/collections/Component/Material/ComponentTechniqueConfiguration.js +1 -1
- package/views/3d/webgl-engine/core/FBOCache.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/shading/ComputeNormalTexture.glsl.js +9 -7
- package/views/3d/webgl-engine/core/shaderLibrary/shading/ScreenSpaceConstants.js +5 -0
- package/views/3d/webgl-engine/core/shaderLibrary/shading/Water.glsl.js +8 -8
- package/views/3d/webgl-engine/effects/debug/RenderNodeVisualizerNode.js +1 -1
- package/views/3d/webgl-engine/effects/highlight/Highlight.js +1 -1
- package/views/3d/webgl-engine/effects/smaa/SMAA.js +1 -1
- package/views/3d/webgl-engine/effects/ssao/SSAO.js +1 -1
- package/views/3d/webgl-engine/lib/GLTextureMaterial.js +1 -1
- package/views/draw/drawSurfaces.js +1 -1
- package/views/layers/ImageryTileLayerView.js +1 -1
- package/webdoc/support/webdocLoadUtils.js +1 -1
- package/webdoc/support/webdocSaveUtils.js +1 -1
- package/widgets/Editor.js +1 -1
- package/widgets/FeatureForm.js +1 -1
- package/widgets/Print/PrintViewModel.js +1 -1
- package/widgets/Search/support/locatorUtils.js +1 -1
- package/widgets/Sketch/SketchViewModel.js +1 -1
- package/assets/esri/core/workers/chunks/00b9e92f8df245a83921.js +0 -1
- package/assets/esri/core/workers/chunks/02ee044597c89c86b934.js +0 -1
- package/assets/esri/core/workers/chunks/143ccb14c9e915dd1412.js +0 -1
- package/assets/esri/core/workers/chunks/24649b410b757599a549.js +0 -1
- package/assets/esri/core/workers/chunks/2519b207894132d5ea91.js +0 -1
- package/assets/esri/core/workers/chunks/30f9b2a3417cbcfeecca.js +0 -1
- package/assets/esri/core/workers/chunks/42ab9c282bb267c3db03.js +0 -1
- package/assets/esri/core/workers/chunks/49afeac45250b15b5f36.js +0 -1
- package/assets/esri/core/workers/chunks/50bb67f2eeace5d50673.js +0 -1
- package/assets/esri/core/workers/chunks/50cdc59426ba859027e2.js +0 -1
- package/assets/esri/core/workers/chunks/58c5861d060c808813a1.js +0 -1
- package/assets/esri/core/workers/chunks/5dbb3ef6fdd25ac632ad.js +0 -1
- package/assets/esri/core/workers/chunks/61c4bb58ef9f2d99c75e.js +0 -1
- package/assets/esri/core/workers/chunks/6e50220f8e2d392e2855.js +0 -1
- package/assets/esri/core/workers/chunks/6fd8047741a0df006ddd.js +0 -1
- package/assets/esri/core/workers/chunks/7709248f59520aee6f51.js +0 -1
- package/assets/esri/core/workers/chunks/8852a64918caf80fc414.js +0 -1
- package/assets/esri/core/workers/chunks/94dfb80ab23dda92918b.js +0 -1
- package/assets/esri/core/workers/chunks/9ebbc75ba5c623a322aa.js +0 -1
- package/assets/esri/core/workers/chunks/a74c59cf5d1c4e63a4e1.js +0 -1
- package/assets/esri/core/workers/chunks/be562536212360943388.js +0 -1
- package/assets/esri/core/workers/chunks/d06d36815c2121484a13.js +0 -1
- package/assets/esri/core/workers/chunks/d5f06a7b0ea7951c8dd0.js +0 -1
- package/assets/esri/core/workers/chunks/de6d54df7ae32694fd70.js +0 -1
- package/assets/esri/core/workers/chunks/f13c4b9692dad5802a32.js +0 -1106
- package/assets/esri/core/workers/chunks/f1e8f7d1a98b9e207b1b.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.30/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../chunks/tslib.es6.js";import"../../geometry.js";import t from"../../Graphic.js";import{rasterRendererTypes as r,websceneRasterRendererTypes as i,read as s}from"../../rasterRenderers.js";import n from"../../request.js";import{deprecatedProperty as o}from"../../core/deprecate.js";import a from"../../core/Error.js";import{clone as l}from"../../core/lang.js";import u from"../../core/Logger.js";import{watch as p}from"../../core/reactiveUtils.js";import{urlToObject as m}from"../../core/urlUtils.js";import{property as c,ensureRange as d}from"../../core/accessorSupport/decorators/property.js";import{Integer as h,ensureClass as g,ensureNumber as f}from"../../core/accessorSupport/ensureType.js";import{reader as y}from"../../core/accessorSupport/decorators/reader.js";import{subclass as R}from"../../core/accessorSupport/decorators/subclass.js";import{writer as b}from"../../core/accessorSupport/decorators/writer.js";import{srToRESTValue as I}from"../../geometry/support/spatialReferenceUtils.js";import{opacity as w,url as v}from"../support/commonProperties.js";import S from"../support/DimensionalDefinition.js";import{ExportImageServiceParameters as x}from"../support/ExportImageServiceParameters.js";import _ from"../support/Field.js";import F from"../support/FieldsIndex.js";import{createBitmap as D}from"../support/imageBitmapUtils.js";import{isSupportedRendererType as T}from"../support/imageryRendererUtils.js";import P from"../support/MosaicRule.js";import j from"../support/MultidimensionalSubset.js";import O from"../support/PixelBlock.js";import{interpolationKebab as M,noDataInterpretationKebab as C,pixelTypeKebabDict as N}from"../support/rasterEnums.js";import q from"../support/RasterFunction.js";import A from"../support/RasterInfo.js";import E from"../support/RasterJobHandler.js";import{intersectMultimensionalSubset as J,getSubsetVariablesFromMdInfo as V,getDefaultMultidimensionalDefinition as Q}from"../support/rasterDatasets/multidimensionalUtils.js";import{decode as H,getFormat as U}from"../support/rasterFormats/RasterCodec.js";import{uvComponentToVector as B}from"../support/rasterFunctions/vectorFieldUtils.js";import{getSupportedRendererTypes as L,getDefaultBandCombination as z,createDefaultRenderer as G,normalizeRendererJSON as k}from"../../renderers/support/rasterRendererHelper.js";import W from"../../renderers/support/RasterSymbolizer.js";import{computeAngles as $,computePixelSpaceLocations as X,computeHistograms as K,computeStatisticsHistograms as Y,measureHeight as Z,measureAreaAndPerimeter as ee,measureDistanceAndAngle as te,measurePointOrCentroid as re,measureLengthFromImage as ie,measureAreaFromImage as se,getImageSpatialReferenceQueryParameter as ne,getSamples as oe,identify as ae,imageToMap as le,imageToMapMultiray as ue,mapToImage as pe,findImages as me,getImageUrl as ce,queryBoundary as de,queryGPSInfo as he}from"../../rest/imageService.js";import"../../core/has.js";import"../support/source/DataLayerSource.js";import{executeQueryJSON as ge}from"../../rest/query/executeQueryJSON.js";import"../../config.js";import"../../kernel.js";import"../../core/unitUtils.js";import"../../geometry/ellipsoidUtils.js";import"../../geometry/support/aaBoundingBox.js";import"../../core/mathUtils.js";import fe from"../../geometry/Extent.js";import"../../geometry/Geometry.js";import"../../geometry/Multipoint.js";import"../../geometry/Point.js";import ye from"../../geometry/Polygon.js";import"../../geometry/Polyline.js";import"../../geometry/support/normalizeUtilsCommon.js";import Re from"../../geometry/SpatialReference.js";import"../../geometry/support/Ellipsoid.js";import"../../core/pbf.js";import be from"../../rest/support/FeatureSet.js";import Ie from"../../rest/support/Query.js";import"../../rest/query/support/AttachmentInfo.js";import"../../rest/support/AttachmentQuery.js";import{executeForCount as we}from"../../rest/query/executeForCount.js";import{executeForIds as ve}from"../../rest/query/executeForIds.js";import"../../rest/support/RelationshipQuery.js";import"../../rest/support/TopFeaturesQuery.js";import{generateRasterInfo as Se,fetchServiceRasterInfo as xe,patchServiceInfo as _e}from"../../rest/imageService/fetchRasterInfo.js";import{getCatalogItemRasterInfo as Fe}from"../../rest/imageService/getCatalogItemRasterInfo.js";import De from"../../rest/support/FindImagesParameters.js";import Te from"../../rest/support/ImageAngleParameters.js";import Pe from"../../rest/support/ImageAreaParameters.js";import je from"../../rest/support/ImageBoundaryParameters.js";import Oe from"../../rest/support/ImageDistanceParameters.js";import Me from"../../rest/support/ImageGPSInfoParameters.js";import Ce from"../../rest/support/ImageHeightParameters.js";import Ne from"../../rest/support/ImageHistogramParameters.js";import qe from"../../rest/support/ImageIdentifyParameters.js";import Ae from"../../rest/support/ImagePixelLocationParameters.js";import Ee from"../../rest/support/ImagePointParameters.js";import Je from"../../rest/support/ImageSampleParameters.js";import Ve from"../../rest/support/ImageToMapMultirayParameters.js";import Qe from"../../rest/support/ImageToMapParameters.js";import He from"../../rest/support/ImageUrlParameters.js";import Ue from"../../rest/support/MapToImageParameters.js";import Be from"../../rest/support/MeasureFromImageParameters.js";import{createFlowMesh as Le}from"../../views/2d/engine/flow/dataUtils.js";const ze=new Set(["png","png8","png24","png32","jpg","bmp","gif","jpgpng","lerc","tiff"]),Ge=d(f,{min:0,max:255});function ke(e){if(!e)return null;const t=JSON.stringify(e).match(/"rasterFunction":"(.*?")/gi),r=t?.map((e=>e.replace('"rasterFunction":"',"").replace('"',"")));return r?r.join("/"):null}const We=d=>{let f=class extends d{constructor(){super(...arguments),this._functionRasterInfos={},this._rasterJobHandler={instance:null,refCount:0,connectionPromise:null},this._cachedRendererJson=null,this._serviceSupportsMosaicRule=null,this._rasterAttributeTableFieldPrefix="Raster.",this.adjustAspectRatio=null,this.bandIds=void 0,this.capabilities=null,this.compressionQuality=void 0,this.compressionTolerance=.01,this.copyright=null,this.defaultMosaicRule=null,this.definitionExpression=null,this.exportImageServiceParameters=null,this.rasterInfo=null,this.fields=null,this.fullExtent=null,this.hasMultidimensions=!1,this.imageMaxHeight=4100,this.imageMaxWidth=4100,this.interpolation=void 0,this.minScale=0,this.maxScale=0,this.multidimensionalInfo=null,this.multidimensionalSubset=null,this.noData=null,this.noDataInterpretation=void 0,this.objectIdField=null,this.geometryType="polygon",this.typeIdField=null,this.types=[],this.pixelFilter=null,this.raster=void 0,this.sourceType=null,this.viewId=void 0,this.symbolizer=null,this.rasterFunctionInfos=null,this.serviceDataType=null,this.spatialReference=null,this.pixelType=null,this.serviceRasterInfo=null,this.sourceJSON=null,this.url=null,this.version=void 0}initialize(){this._set("exportImageServiceParameters",new x({layer:this}))}readServiceSupportsMosaicRule(e,t){return this._isMosaicRuleSupported(t)}get _rasterFunctionNamesIndex(){const e=new Map;return!this.rasterFunctionInfos||null!=this.rasterFunctionInfos&&this.rasterFunctionInfos.length<1||null!=this.rasterFunctionInfos&&this.rasterFunctionInfos.forEach((t=>{e.set(t.name.toLowerCase().replaceAll(/ /gi,"_"),t.name)})),e}readBandIds(e,t){if(Array.isArray(e)&&e.length>0&&e.every((e=>"number"==typeof e)))return e}readCapabilities(e,t){return this._readCapabilities(t)}writeCompressionQuality(e,t,r){null!=e&&"lerc"!==this.format&&(t[r]=e)}writeCompressionTolerance(e,t,r){"lerc"===this.format&&null!=e&&(t[r]=e)}readDefaultMosaicRule(e,t){return this._serviceSupportsMosaicRule?P.fromJSON(t):null}get fieldsIndex(){return this.fields?new F(this.fields):null}set format(e){e&&ze.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?.mosaicMethod&&(t=P.fromJSON({...t.toJSON(),mosaicMethod:t.mosaicMethod,mosaicOperation:t.mosaicOperation})),this._set("mosaicRule",t)}readMosaicRule(e,t){const r=e||t.mosaicRule;return r?P.fromJSON(r):this._isMosaicRuleSupported(t)?P.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 P({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.find((e=>"esriFieldTypeOID"===e.type||"oid"===e.type));e=r?.name}return e}get parsedUrl(){return m(this.url)}readSourceType(e,t){return this._isMosaicDataset(t)?"mosaic-dataset":"raster-dataset"}set renderer(e){this.loaded&&(e=this._configRenderer(e)),this._set("renderer",e)}readRenderer(e,t,r){const i=t?.layerDefinition?.drawingInfo?.renderer,n=s(i,r);return null==n?null:("vector-field"===n.type&&t.symbolTileSize&&!i.symbolTileSize&&(n.symbolTileSize=t.symbolTileSize),T(n)||u.getLogger(this).warn("ArcGISImageService","Imagery layer doesn't support given renderer type."),n)}writeRenderer(e,t,r){t.layerDefinition=t.layerDefinition||{},t.layerDefinition.drawingInfo=t.layerDefinition.drawingInfo||{},t.layerDefinition.drawingInfo.renderer=e.toJSON(),"vector-field"===e.type&&(t.symbolTileSize=e.symbolTileSize)}get rasterFields(){const e=this._rasterAttributeTableFieldPrefix,t=new _({name:"Raster.ItemPixelValue",alias:"Item Pixel Value",domain:null,editable:!1,length:50,type:"string"}),r=new _({name:"Raster.ServicePixelValue",alias:"Service Pixel Value",domain:null,editable:!1,length:50,type:"string"}),i=new _({name:"Raster.ServicePixelValue.Raw",alias:"Raw Service Pixel Value",domain:null,editable:!1,length:50,type:"string"});let s=this.fields?l(this.fields):[];s.push(r),this.capabilities?.operations.supportsQuery&&this.fields&&this.fields.length>0&&s.push(t),this.version>=10.4&&null!=this.rasterFunctionInfos&&this.rasterFunctionInfos.some((e=>"none"===e.name.toLowerCase()))&&s.push(i),null!=this.rasterFunctionInfos&&this.rasterFunctionInfos.filter((e=>"none"!==e.name.toLowerCase())).forEach((e=>{s.push(new _({name:"Raster.ServicePixelValue."+e.name,alias:e.name,domain:null,editable:!1,length:50,type:"string"}))})),this._isVectorDataSet()&&(s.push(new _({name:"Raster.Magnitude",alias:"Magnitude",domain:null,editable:!1,type:"double"})),s.push(new _({name:"Raster.Direction",alias:"Direction",domain:null,editable:!1,type:"double"})));const{attributeTable:n}=this.rasterInfo??{};if(null!=n){const t=n.fields.filter((e=>"esriFieldTypeOID"!==e.type&&"value"!==e.name.toLowerCase())).map((t=>{const r=l(t);return r.name=e+t.name,r}));s=s.concat(t)}return s}get renderingRule(){return o(u.getLogger(this),"renderingRule",{replacement:"rasterFunction",version:"4.27",warnOnce:!0}),this.rasterFunction}set renderingRule(e){o(u.getLogger(this),"renderingRule",{replacement:"rasterFunction",version:"4.27",warnOnce:!0}),this._set("rasterFunction",e)}set rasterFunction(e){let t=e;t?.rasterFunction&&(t=q.fromJSON({...t.toJSON(),rasterFunction:t.rasterFunction,rasterFunctionArguments:t.rasterFunctionArguments})),this._set("rasterFunction",t)}readRasterFunction(e,t){const r=t.rasterFunctionInfos;return t.renderingRule||r?.length&&"None"!==r[0].name?this._isRFTJson(t.renderingRule)?q.fromJSON({rasterFunctionDefinition:t.renderingRule}):q.fromJSON(t.renderingRule||{rasterFunctionInfos:t.rasterFunctionInfos}):null}readSpatialReference(e,t){const r=e||t.extent.spatialReference;return r?Re.fromJSON(r):null}readPixelType(e){return N.fromJSON(e)||e}writePixelType(e,t,r){null!=this.serviceRasterInfo&&this.pixelType===this.serviceRasterInfo.pixelType||(t[r]=N.toJSON(e))}readVersion(e,t){let r=t.currentVersion;return r||(r=t.hasOwnProperty("fields")||t.hasOwnProperty("timeInfo")?10:9.3),r}applyFilter(e){let t=e;return this.pixelFilter&&(t=this._clonePixelData(e),this.pixelFilter(t)),t}async applyRenderer(e,t){let r=e;const{renderer:i,symbolizer:s,pixelFilter:n,bandIds:o}=this;if(!this._isPicture()&&i&&s&&!n){const n=JSON.stringify(this._cachedRendererJson)!==JSON.stringify(i.toJSON()),a=this._rasterJobHandler.instance;if(a){n&&(s.bind(),await a.updateSymbolizer(s,t),this._cachedRendererJson=i.toJSON());const l=await a.symbolize({bandIds:o,...e},t);r={extent:e.extent,pixelBlock:l}}else r={extent:e.extent,pixelBlock:s.symbolize({bandIds:o,...e})}}return r}destroy(){this._shutdownJobHandler()}increaseRasterJobHandlerUsage(){this._rasterJobHandler.refCount++}decreaseRasterJobHandlerUsage(){this._rasterJobHandler.refCount--,this._rasterJobHandler.refCount<=0&&this._shutdownJobHandler()}async computeAngles(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsComputeAngles)throw new a("imagery-layer:compute-angles","this operation is not supported on the input image service");return e=g(Te,e).clone(),$(this.url,e,this._getRequestOptions(t))}async computePixelSpaceLocations(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsComputePixelLocation)throw new a("imagery-layer:compute-pixel-space-locations","this operation is not supported on the input image service");return e=g(Ae,e).clone(),X(this.url,e,this._getRequestOptions(t))}async computeHistograms(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsComputeHistograms)throw new a("imagery-layer:compute-histograms","this operation is not supported on the input image service");return e=g(Ne,e).clone(),this._applyMosaicAndRenderingRules(e),K(this.url,e,this._getRequestOptions(t))}async computeStatisticsHistograms(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsComputeStatisticsHistograms)throw new a("imagery-layer:compute-statistics-histograms","this operation is not supported on the input image service");return e=g(Ne,e).clone(),this._applyMosaicAndRenderingRules(e),Y(this.url,e,this._getRequestOptions(t))}async measureHeight(e,t){const r=await this._fetchCapabilities(t?.signal);if(!("base-and-top"===e.operationType?r.mensuration.supportsHeightFromBaseAndTop:"base-and-top-shadow"===e.operationType?r.mensuration.supportsHeightFromBaseAndTopShadow:r.mensuration.supportsHeightFromTopAndTopShadow))throw new a("imagery-layer:measure-height","this operation is not supported on the input image service");return e=g(Ce,e).clone(),this._applyMosaicAndRenderingRules(e),Z(this.url,e,this._getRequestOptions(t))}async measureAreaAndPerimeter(e,t){const r=await this._fetchCapabilities(t?.signal);if(!(r.mensuration.supportsAreaAndPerimeter&&(!e.is3D||r.mensuration.supports3D)))throw new a("imagery-layer:measure-area-and-perimeter","this operation is not supported on the input image service");return e=g(Pe,e).clone(),this._applyMosaicAndRenderingRules(e),ee(this.url,e,this._getRequestOptions(t))}async measureDistanceAndAngle(e,t){const r=await this._fetchCapabilities(t?.signal);if(!(r.mensuration.supportsDistanceAndAngle&&(!e.is3D||r.mensuration.supports3D)))throw new a("imagery-layer:measure-distance-and-angle","this operation is not supported on the input image service");return e=g(Oe,e).clone(),this._applyMosaicAndRenderingRules(e),te(this.url,e,this._getRequestOptions(t))}async measurePointOrCentroid(e,t){const r=await this._fetchCapabilities(t?.signal);if(!(r.mensuration.supportsPointOrCentroid&&(!e.is3D||r.mensuration.supports3D)))throw new a("imagery-layer:measure-point-or-centroid","this operation is not supported on the input image service");return e=g(Ee,e).clone(),this._applyMosaicAndRenderingRules(e),re(this.url,e,this._getRequestOptions(t))}async measureLengthFromImage(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsMeasureFromImage)throw new a("imagery-layer:measure-length-from-image","this operation is not supported on the input image service");if("polyline"!==e.geometry.type)throw new a("imagery-layer:measure-length-from-image","this input geometry must be a polyline");return e=g(Be,e).clone(),ie(this.url,e,this._getRequestOptions(t))}async measureAreaFromImage(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsMeasureFromImage)throw new a("imagery-layer:measure-area-from-image","this operation is not supported on the input image service");if("polygon"!==e.geometry.type)throw new a("imagery-layer:measure-area-from-image","this input geometry must be a polygon");return e=g(Be,e).clone(),se(this.url,e,this._getRequestOptions(t))}getField(e){const{fieldsIndex:t}=this;return null!=t?t.get(e):void 0}getFieldDomain(e,t){const r=this.getField(e);return r?r.domain:null}async fetchImage(e,t,r,i={}){if(null==e||null==t||null==r)throw new a("imagery-layer:fetch-image","Insufficient parameters for requesting an image. A valid extent, width and height values are required.");if(this.renderer||this.symbolizer){const e=await this._generateRasterInfo(this.rasterFunction,{signal:i.signal});e&&(this.rasterInfo=e)}const s=this.getExportImageServiceParameters(e,t,r,i.timeExtent);if(null==s){if(i.requestAsImageElement&&this._canRequestImageElement(this.format)){const e=document.createElement("canvas");if(e.width=t,e.height=r,i.returnImageBitmap){return{imageBitmap:await D(e,`${We(this.parsedUrl)}/exportImage`,i.signal)}}return{imageOrCanvasElement:e}}const{bandIds:s,rasterInfo:n}=this,o=(s?.length||n.bandCount)??0,a=t*r,l=n.pixelType,u=[];for(let e=0;e<o;e++)u.push(O.createEmptyBand(l,a));return{pixelData:{pixelBlock:new O({width:t,height:r,pixels:u,mask:new Uint8Array(a),pixelType:l}),extent:e}}}const n=!!i.requestAsImageElement&&!this.pixelFilter,o=n&&!!i.returnImageBitmap,l={imageServiceParameters:s,imageProps:{extent:e,width:t,height:r,format:this.format},requestAsImageElement:n,returnImageBitmap:o,signal:i.signal};return this._requestArrayBuffer(l)}fetchKeyProperties(e){return n(We(this.parsedUrl)+"/keyProperties",{query:this._getQueryParams({renderingRule:this.version>=10.3?e?.rasterFunction:null})}).then((e=>e.data))}fetchRasterAttributeTable(e){return this.version<10.1?Promise.reject(new a("#fetchRasterAttributeTable()","Failed to get rasterAttributeTable")):n(We(this.parsedUrl)+"/rasterAttributeTable",{query:this._getQueryParams({renderingRule:this.version>=10.3?e?.rasterFunction:null})}).then((e=>be.fromJSON(e.data)))}getCatalogItemRasterInfo(e,t){const r={...t,query:this._getQueryParams()};return Fe(We(this.parsedUrl),e,r)}async getCatalogItemICSInfo(e,t){const{data:r}=await n(We(this.parsedUrl)+"/"+e+"/info/ics",{query:this._getQueryParams(),...t}),i=r?.ics;if(!i)return;let s=null;try{s=(await n(We(this.parsedUrl)+"/"+e+"/info",{query:this._getQueryParams(),...t})).data.extent}catch{}if(!s||!s.spatialReference)return{ics:i,icsToPixelTransform:null,icsExtent:null,northDirection:null};const o=this.version>=10.7?n(We(this.parsedUrl)+"/"+e+"/info/icstopixel",{query:this._getQueryParams(),...t}).then((e=>e.data)).catch((()=>({}))):{},a=s.spatialReference,l={geometries:JSON.stringify({geometryType:"esriGeometryEnvelope",geometries:[s]}),inSR:I(a),outSR:"0:"+e},u=n(We(this.parsedUrl)+"/project",{query:this._getQueryParams(l),...t}).then((e=>e.data)).catch((()=>({}))),p=5,m=(s.xmin+s.xmax)/2,c=(s.ymax-s.ymin)/(p+1),d=s.ymin+c,h=[];for(let n=0;n<p;n++)h.push({x:m,y:d+c*n});const g={geometries:JSON.stringify({geometryType:"esriGeometryPoint",geometries:h}),inSR:I(a),outSR:"0:"+e},f=n(We(this.parsedUrl)+"/project",{query:this._getQueryParams(g),...t}).then((e=>e.data)).catch((()=>({}))),y=await Promise.all([o,u,f]);let R=y[0].ipxf;if(null==R){const e=i.geodataXform?.xf_0;"topup"===e?.name?.toLowerCase()&&6===e?.coefficients?.length&&(R={affine:{name:"ics [sensor: Frame] to pixel (column, row) transformation",coefficients:e.coefficients,cellsizeRatio:0,type:"GeometricXform"}})}const b=fe.fromJSON(y[1]?.geometries?.[0]);b&&(b.spatialReference=new Re({wkid:0,imageCoordinateSystem:i}));const w=y[2].geometries?y[2].geometries.filter((e=>null!=e?.x&&null!=e.y&&"NaN"!==e.x&&"NaN"!==e.y)):[],v=w.length;if(v<3)return{ics:i,icsToPixelTransform:R,icsExtent:b,northDirection:null};let S=0,x=0,_=0,F=0;for(let n=0;n<v;n++)S+=w[n].x,x+=w[n].y,_+=w[n].x*w[n].x,F+=w[n].x*w[n].y;const D=(v*F-S*x)/(v*_-S*S);let T=0;const P=w[p-1].x>w[0].x,j=w[p-1].y>w[0].y;return D===1/0?T=j?90:270:0===D?T=P?0:180:D>0?T=P?180*Math.atan(D)/Math.PI:180*Math.atan(D)/Math.PI+180:D<0&&(T=j?180+180*Math.atan(D)/Math.PI:360+180*Math.atan(D)/Math.PI),{ics:i,icsToPixelTransform:R,icsExtent:b,northDirection:T}}async generateRasterInfo(e,t){if(e=g(q,e),this.serviceRasterInfo&&(!e||"none"===e.functionName?.toLowerCase()||this._isVectorFieldResampleFunction(e)))return this.serviceRasterInfo;const r=ke(e);if(!r)throw new a("imagery-layer:generate-raster-info","the rendering rule is not supported");if(this._functionRasterInfos[r])return this._functionRasterInfos[r];const i={...t,query:this._getQueryParams()},s=Se(We(this.parsedUrl),e,i);this._functionRasterInfos[r]=s;try{return await s}catch(n){throw this._functionRasterInfos[r]=null,n}}getExportImageServiceParameters(e,t,r,i){e=e.clone().shiftCentralMeridian();const s=ne(e.spatialReference,We(this.parsedUrl));this.pixelType!==this.serviceRasterInfo.pixelType&&(this.exportImageServiceParameters.pixelType=this.pixelType);const n=this.exportImageServiceParameters.toJSON(),{bandIds:o,noData:a}=n;let{renderingRule:l}=n;const u=this.rasterFunction?.rasterFunctionDefinition,p=!this.renderer||"raster-stretch"===this.renderer.type;if(o?.length&&this._hasRasterFunction(this.rasterFunction)&&!u&&p){const e={rasterFunction:"ExtractBand",rasterFunctionArguments:{BandIds:o}};if("Stretch"===l.rasterFunction)e.rasterFunctionArguments.Raster=l.rasterFunctionArguments.Raster,l.rasterFunctionArguments.Raster=e;else if("Colormap"===l.rasterFunction){const t=l.rasterFunctionArguments.Raster;"Stretch"===t?.rasterFunction?(e.rasterFunctionArguments.Raster=t.rasterFunctionArguments.Raster,t.rasterFunctionArguments.Raster=e):(e.rasterFunctionArguments.Raster=t,l.rasterFunctionArguments.Raster=e)}else e.rasterFunctionArguments.Raster=l,l=e;n.bandIds=void 0}else n.bandIds=o?.join(",");a instanceof Array&&a.length>0&&(n.noData=a.join(","));const m=this._processMultidimensionalIntersection(null,i,this.exportImageServiceParameters.mosaicRule);if(m.isOutSide)return null;n.mosaicRule=null!=m.mosaicRule?JSON.stringify(m.mosaicRule):null,i=m.timeExtent,n.renderingRule=this._getRenderingRuleString(q.fromJSON(l));const c={};if(null!=i){const{start:e,end:t}=i.toJSON();e&&t&&e===t?c.time=""+e:null==e&&null==t||(c.time=`${e??"null"},${t??"null"}`)}return{bbox:e.xmin+","+e.ymin+","+e.xmax+","+e.ymax,bboxSR:s,imageSR:s,size:t+","+r,...n,...c}}async getSamples(e,t){const r=await this._fetchCapabilities(t?.signal);if(!r?.operations.supportsGetSamples)throw new a("imagery-layer:get-samples","getSamples operation is not supported on the input image service");e=g(Je,e).clone();const{raster:i}=this;return i&&null==e.raster&&(e.raster=i),oe(this.url,e,this._getRequestOptions(t))}async identify(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsIdentify)throw new a("imagery-layer:identify","identify operation is not supported on the input image service");e=g(qe,e).clone(),this.version<10.91&&"extent"===e.geometry?.type&&(e.geometry=ye.fromExtent(e.geometry));const r=this._processMultidimensionalIntersection(e.geometry,e.timeExtent,e.mosaicRule||this.mosaicRule);if(r.isOutSide)throw new a("imagery-layer:identify","the request cannot be fulfilled when falling outside of the multidimensional subset");e.timeExtent=r.timeExtent,e.mosaicRule=r.mosaicRule;const{raster:i,rasterFunction:s}=this;return s&&null==e.rasterFunction&&(e.rasterFunction=s),i&&null==e.raster&&(e.raster=i),ae(this.url,e,this._getRequestOptions(t))}async imageToMap(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsImageToMap)throw new a("imagery-layer:image-to-map","imageToMap operation is not supported on the input image service");return e=g(Qe,e),le(We(this.parsedUrl),e,this._getRequestOptions(t))}async imageToMapMultiray(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsImageToMapMultiray)throw new a("imagery-layer:image-to-map-multiray","imageToMapMultiray operation is not supported on the input image service");return e=g(Ve,e),ue(We(this.parsedUrl),e,this._getRequestOptions(t))}async mapToImage(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsMapToImage)throw new a("imagery-layer:map-to-image","mapToImage operation is not supported on the input image service");return e=g(Ue,e),pe(We(this.parsedUrl),e,this._getRequestOptions(t))}async findImages(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsFindImages)throw new a("imagery-layer:find-images","findImages operation is not supported on the input image service");return e=g(De,e),me(We(this.parsedUrl),e,this._getRequestOptions(t))}async getImageUrl(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsGetImageUrl)throw new a("imagery-layer:get-image-url","getImageUrl operation is not supported on the input image service");return e=g(He,e),ce(We(this.parsedUrl),e,this._getRequestOptions(t))}createQuery(){const e=new Ie;return e.outFields=["*"],e.returnGeometry=!0,e.where=this.definitionExpression||"1=1",e}async queryBoundary(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsQueryBoundary)throw new a("imagery-layer:query-boundary","queryBoundary operation is not supported on the input image service");return e=g(je,e??{outSpatialReference:this.spatialReference}).clone(),de(We(this.parsedUrl),e,this._getRequestOptions(t))}async queryRasters(e,t){return({query:e,requestOptions:t}=await this._prepareForQuery(e,t)),ge(this.url,e,t)}async queryObjectIds(e,t){return({query:e,requestOptions:t}=await this._prepareForQuery(e,t)),ve(this.url,e,t)}async queryGPSInfo(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsQueryGPSInfo)throw new a("imagery-layer:query-gps-info","queryGPSInfo operation is not supported on the input image service");return e=g(Me,e??{outSpatialReference:this.spatialReference}).clone(),he(We(this.parsedUrl),e,this._getRequestOptions(t))}async queryRasterCount(e,t){return({query:e,requestOptions:t}=await this._prepareForQuery(e,t)),we(this.url,e,t)}async queryVisibleRasters(e,t){if(!e)throw new a("imagery-layer: query-visible-rasters","missing query parameter");await this.load();const{pixelSize:r,returnDomainValues:i,returnTopmostRaster:s,showNoDataRecords:n}=t||{pixelSize:null,returnDomainValues:!1,returnTopmostRaster:!1,showNoDataRecords:!1};let o=!1,l=null,u=null;const p="raster.servicepixelvalue",m=this._rasterFunctionNamesIndex;if(null!=e.outFields&&(o=e.outFields.some((e=>!e.toLowerCase().includes(p))),this.version>=10.4)){const t=e.outFields.filter((e=>e.toLowerCase().includes(p)&&e.length>p.length)).map((e=>{const t=e.slice(p.length+1);return[this._updateRenderingRulesFunctionName(t,m),t]}));l=t.map((e=>new q({functionName:e[0]}))),u=t.map((e=>e[1]));const{rasterFunction:r}=this;0===l.length?r?.functionName?(l.push(r),u.push(r.functionName)):l=null:r?.functionName&&!l.some((e=>e.functionName===r.functionName))&&(l.push(r),u.push(r.functionName))}const c=null==e.outSpatialReference||e.outSpatialReference.equals(this.spatialReference),{multidimensionalSubset:d}=this;let h=e.timeExtent||this.timeExtent;if(d){const{isOutside:t,intersection:r}=J(d,{geometry:e.geometry,timeExtent:e.timeExtent,multidimensionalDefinition:this.exportImageServiceParameters.mosaicRule?.multidimensionalDefinition});if(t)throw new a("imagery-layer:query-visible-rasters","the request cannot be fulfilled when falling outside of the multidimensional subset");null!=r?.timeExtent&&(h=r.timeExtent)}const g=this._combineMosaicRuleWithTimeExtent(this.exportImageServiceParameters.mosaicRule,h);let f=e.geometry;this.version<10.91&&"extent"===f?.type&&(f=ye.fromExtent(f));const y=this._getQueryParams({geometry:f,timeExtent:h,mosaicRule:g,rasterFunction:this.version<10.4?this.rasterFunction:null,rasterFunctions:l,pixelSize:r,returnCatalogItems:o,returnGeometry:c,raster:this.raster,maxItemCount:s?1:null});delete y.f;const R=new qe(y);try{await this._generateRasterInfo(this.rasterFunction);const r=await ae(this.url,R,{signal:t?.signal,query:{...this.customParameters}}),s=e.outFields,a=null!=r.value&&r.value.toLowerCase().includes("nodata");if(!(o&&!c&&r?.catalogItems?.features.length&&(n||!a)))return this._processVisibleRastersResponse(r,{returnDomainValues:i,templateRRFunctionNames:u,showNoDataRecords:n,templateFields:s});const l=this.objectIdField||"ObjectId",p=r.catalogItems?.features??[],m=p.map((e=>e.attributes?.[l])),d=new Ie({objectIds:m,returnGeometry:!0,outSpatialReference:e.outSpatialReference,outFields:[l]}),h=await this.queryRasters(d);return h?.features?.length&&h.features.forEach((t=>{p.forEach((r=>{r.attributes[l]===t.attributes[l]&&(r.geometry=new ye(t.geometry),null!=e.outSpatialReference&&(r.geometry.spatialReference=e.outSpatialReference))}))})),this._processVisibleRastersResponse(r,{returnDomainValues:i,templateRRFunctionNames:u,showNoDataRecords:n,templateFields:s})}catch{throw new a("imagery-layer:query-visible-rasters","encountered error when querying visible rasters")}}async fetchVariableStatisticsHistograms(e,t){const r=n(We(this.parsedUrl)+"/statistics",{query:this._getQueryParams({variable:e}),signal:t}).then((e=>e.data?.statistics)),i=n(We(this.parsedUrl)+"/histograms",{query:this._getQueryParams({variable:e}),signal:t}).then((e=>e.data?.histograms)),s=await Promise.all([r,i]);return s[0]&&s[0].forEach((e=>{e.avg=e.mean,e.stddev=e.standardDeviation})),{statistics:s[0]||null,histograms:s[1]||null}}async createFlowMesh(e,t){const r=this._rasterJobHandler.instance;return r?r.createFlowMesh(e,t):Le(e.meshType,e.simulationSettings,e.flowData,null!=t.signal?t.signal:(new AbortController).signal)}getMultidimensionalSubsetVariables(e){const t=e??this.serviceRasterInfo.multidimensionalInfo;return V(this.multidimensionalSubset,t)}async _fetchService(e){await this._fetchServiceInfo(e),this.rasterInfo||(this.rasterInfo=this.serviceRasterInfo);const t=this.sourceJSON,r=null!=this.serviceRasterInfo?Promise.resolve(this.serviceRasterInfo):xe(We(this.parsedUrl),t,{signal:e,query:this._getQueryParams()}).then((e=>(this._set("serviceRasterInfo",e),this._set("multidimensionalInfo",e.multidimensionalInfo),_e(e,t),e))),i=this._hasRasterFunction(this.rasterFunction)?this._generateRasterInfo(this.rasterFunction,{signal:e}):null,s=this._getRasterFunctionInfos();return Promise.all([r,i,s]).then((e=>{e[1]?this._set("rasterInfo",e[1]):this._set("rasterInfo",e[0]),e[2]&&this._set("rasterFunctionInfos",e[2]),this.renderer&&!this._isSupportedRenderer(this.renderer)&&(this._set("renderer",null),u.getLogger(this).warn("ArcGISImageService","Switching to the default renderer. Renderer applied is not valid for this Imagery Layer")),this._set("renderer",this._configRenderer(this.renderer)),this.addHandles([p((()=>this.rasterFunction),(e=>{(this.renderer||this.symbolizer||this.popupEnabled&&this.popupTemplate)&&this._generateRasterInfo(e).then((e=>{e&&(this.rasterInfo=e)}))}))]);const{serviceRasterInfo:t}=this;null!=t.multidimensionalInfo&&this._updateMultidimensionalDefinition(t)}))}_combineMosaicRuleWithTimeExtent(e,t){const r=this.timeInfo,{multidimensionalInfo:i}=this.serviceRasterInfo;if(null==e||null==i||null==t||null==r?.startField)return e;const{startField:s}=r,n=i.variables.some((e=>e.dimensions.some((e=>e.name===s))))?s:"StdTime";if(e=e.clone(),"mosaic-dataset"===this.sourceType)return e.multidimensionalDefinition=e.multidimensionalDefinition?.filter((e=>e.dimensionName!==n)),this._cleanupMultidimensionalDefinition(e);e.multidimensionalDefinition=e.multidimensionalDefinition||[];const o=e.multidimensionalDefinition.filter((e=>e.dimensionName===n)),a=null!=t.start?t.start.getTime():null,l=null!=t.end?t.end.getTime():null,u=null==a||null==l||a===l,p=u?[a||l]:[[a,l]],m=this.version>=10.8;if(o.length)o.forEach((e=>{e.dimensionName===n&&(m?(e.dimensionName=null,e.isSlice=!1,e.values=[]):(e.isSlice=u,e.values=p))}));else if(!m){const t=e.multidimensionalDefinition.filter((e=>null!=e.variableName&&null==e.dimensionName));t.length?t.forEach((e=>{e.dimensionName=n,e.isSlice=u,e.values=p})):e.multidimensionalDefinition.push(new S({variableName:"",dimensionName:n,isSlice:u,values:p}))}return this._cleanupMultidimensionalDefinition(e)}_cleanupMultidimensionalDefinition(e){return null==e?null:(e.multidimensionalDefinition&&(e.multidimensionalDefinition=e.multidimensionalDefinition.filter((e=>!(!e.variableName&&!e.dimensionName))),0===e.multidimensionalDefinition.length&&(e.multidimensionalDefinition=null)),"mosaic-dataset"!==this.sourceType&&null==e.multidimensionalDefinition?null:e)}async _prepareForQuery(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsQuery)throw new a("imagery-layer:query-rasters","query operation is not supported on the input image service");return e=null!=e?g(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 E;this._rasterJobHandler.connectionPromise=e.initialize().then((()=>{this._rasterJobHandler.instance=e}),(()=>{})),await this._rasterJobHandler.connectionPromise}_shutdownJobHandler(){this._rasterJobHandler.instance&&this._rasterJobHandler.instance.destroy(),this._rasterJobHandler.instance=null,this._rasterJobHandler.connectionPromise=null,this._rasterJobHandler.refCount=0,this._cachedRendererJson=null}_isSupportedRenderer(e){const{rasterInfo:t,rasterFunction:r}=this;return"unique-value"===e.type&&this._hasRasterFunction(r)&&1===t?.bandCount&&["u8","s8"].includes(t.pixelType)||null!=t&&null!=e&&L(t).includes(e.type)}async _fetchCapabilities(e){return this.capabilities||await this._fetchServiceInfo(e),this.capabilities}async _fetchServiceInfo(e){let t=this.sourceJSON;if(!t){const{data:r,ssl:i}=await n(We(this.parsedUrl),{query:this._getQueryParams(),signal:e});t=r,this.sourceJSON=t,i&&(this.url=this.url.replace(/^http:/i,"https:"))}if(t.capabilities?.toLowerCase().split(",").map((e=>e.trim())).indexOf("tilesonly")>-1)throw new a("imagery-layer:fetch-service-info","use ImageryTileLayer to open tiles-only image services");this.read(t,{origin:"service",url:this.parsedUrl})}_isMosaicDataset(e){return e.serviceSourceType?"esriImageServiceSourceTypeMosaicDataset"===e.serviceSourceType:e.fields?.length>0}_isMosaicRuleSupported(e){if(!e)return!1;const t=this._isMosaicDataset(e),r=e.currentVersion>=10.71&&e.hasMultidimensions&&!(e.fields?.length>1);return t||r}_isVectorFieldResampleFunction(e){if(null==e)return!1;const{functionName:t,functionArguments:r}=e,i="resample"===t?.toLowerCase(),s=r?.ResampleType||r?.resampleType;return i&&(7===s||10===s)}_isPicture(){return!this.format||this.format.includes("jpg")||this.format.includes("png")}_configRenderer(e){const t=this._isPicture(),{rasterInfo:r}=this;if(!t&&!this.pixelFilter||this._isVectorDataSet()){if(!this.bandIds&&r.bandCount>=3){const e=z(r);!e||3===r.bandCount&&0===e[0]&&1===e[1]&&2===e[2]||(this.bandIds=e)}e||(e=G(r,{bandIds:this.bandIds,variableName:this.rasterFunction?null:this.mosaicRule?.multidimensionalDefinition?.[0].variableName}));const t=k(e.toJSON());this.symbolizer?(this.symbolizer.rendererJSON=t,this.symbolizer.rasterInfo=r):this.symbolizer=new W({rendererJSON:t,rasterInfo:r}),this.symbolizer.bind().success||(this.symbolizer=null)}return e}_clonePixelData(e){return null==e?e:{extent:e.extent&&e.extent.clone(),pixelBlock:null!=e.pixelBlock?e.pixelBlock.clone():null}}_getQueryParams(e){null!=e?.renderingRule&&"string"!=typeof e.renderingRule&&(e.renderingRule=this._getRenderingRuleString(e.renderingRule));const{raster:t,viewId:r}=this;return{raster:t,viewId:r,f:"json",...e,...this.customParameters}}_getRequestOptions(e){return{...e,query:{...e?.query,...this.customParameters}}}_decodePixelBlock(e,t,r){return this._rasterJobHandler.instance?this._rasterJobHandler.instance.decode({data:e,options:t}):H(e,t,r)}async _getRasterFunctionInfos(e){const t=this.sourceJSON.rasterFunctionInfos;if(this.loaded)return t;if(t&&this.version>=10.3){if(1===t.length&&"none"===t[0].name.toLowerCase())return t;const r=await n(We(this.parsedUrl)+"/rasterFunctionInfos",{query:this._getQueryParams(),signal:e});return r.data?.rasterFunctionInfos}return null}_canRequestImageElement(e){return!this.pixelFilter&&(!e||e.includes("png"))}async _requestArrayBuffer(e){const{imageProps:t,requestAsImageElement:r,returnImageBitmap:i,signal:s}=e;if(r&&this._canRequestImageElement(t.format)){const r=`${We(this.parsedUrl)}/exportImage`,{data:o}=await n(r,{responseType:i?"blob":"image",query:this._getQueryParams({f:"image",...this.refreshParameters,...e.imageServiceParameters}),signal:s});if(o instanceof Blob){return{imageBitmap:await D(o,r,s),params:t}}return{imageOrCanvasElement:o,params:t}}const o=this._initJobHandler(),l=n(We(this.parsedUrl)+"/exportImage",{responseType:"array-buffer",query:this._getQueryParams({f:"image",...e.imageServiceParameters}),signal:s}),u=(await Promise.all([l,o]))[0].data,p=t.format||"jpgpng";let m=p;if("bsq"!==m&&"bip"!==m&&(m=U(u)),!m)throw new a("imagery-layer:fetch-image","unsupported format signature "+String.fromCharCode.apply(null,new Uint8Array(u)));const c={signal:s},d="gif"===p||"bmp"===p||p.includes("png")&&("png"===m||"jpg"===m)?H(u,{useCanvas:!0,...t},c):this._decodePixelBlock(u,{width:t.width,height:t.height,planes:null,pixelType:null,noDataValue:null,format:p},c);return{pixelData:{pixelBlock:await d,extent:t.extent},params:t}}_generateRasterInfo(e,t){return this.generateRasterInfo(e,t).catch((()=>null))}_isValidCustomizedMosaicRule(e){return e&&JSON.stringify(e.toJSON())!==JSON.stringify(this.defaultMosaicRule?.toJSON())}_updateMultidimensionalDefinition(e){if(this._isValidCustomizedMosaicRule(this.mosaicRule))return;let t=Q(e,{multidimensionalSubset:this.multidimensionalSubset});if(null!=t&&t.length>0){this.mosaicRule=this.mosaicRule||new P;const e=this.mosaicRule.multidimensionalDefinition;!this.sourceJSON.defaultVariableName&&this.rasterFunction&&"none"!==this.rasterFunction.functionName?.toLowerCase()&&t.forEach((e=>e.variableName="")),t=t.filter((({variableName:e,dimensionName:t})=>e&&"*"!==e||t)),!e?.length&&t.length&&(this.mosaicRule.multidimensionalDefinition=t)}}_processVisibleRastersResponse(e,r){r=r||{};const i=e.value,{templateRRFunctionNames:s,showNoDataRecords:n,returnDomainValues:o,templateFields:a}=r,l=e.processedValues;let u=e.catalogItems?.features,p=e.properties?.Values?.map((e=>e.replaceAll(/ /gi,", ")))||[];const m=this.objectIdField||"ObjectId",c="string"==typeof i&&i.toLowerCase().includes("nodata"),d=[];if(i&&!u&&!c){const e={};e[m]=0;p=[i],u=[new t(this.fullExtent,null,e)]}if(!u)return[];let h,g,f;this._updateResponseFieldNames(u,a),c&&!n&&(u=[]);for(let t=0;t<u.length;t++){if(h=u[t],null!=i){if(g=p[t],f=this.rasterFunction&&l&&l.length>0&&s&&s.length>0&&s.includes(this.rasterFunction.functionName)?l[s.indexOf(this.rasterFunction.functionName)]:i,"nodata"===g.toLowerCase()&&!n)continue;const e="Raster.ItemPixelValue",r="Raster.ServicePixelValue";h.attributes[e]=g,h.attributes[r]=f,this._updateFeatureWithMagDirValues(h,g);const o=this.fields&&this.fields.length>0;let a=this.rasterFunction&&null!=this.serviceRasterInfo.attributeTable?o?g:i:f;this.rasterFunction||(a=o?g:i),this._updateFeatureWithRasterAttributeTableValues(h,a)}if(h.sourceLayer=h.layer=this,o&&this._updateFeatureWithDomainValues(h),s&&l&&s.length===l.length)for(let e=0;e<s.length;e++){const t="Raster.ServicePixelValue."+s[e];h.attributes[t]=l[e]}d.push(u[t])}return d}_processMultidimensionalIntersection(e,t,r){const{multidimensionalSubset:i}=this;if(!i)return{isOutSide:!1,timeExtent:t,mosaicRule:r=this._combineMosaicRuleWithTimeExtent(r,t)};if(i){const{isOutside:r,intersection:s}=J(i,{geometry:e,timeExtent:t});if(r)return{isOutSide:!0,timeExtent:null,mosaicRule:null};null!=s?.timeExtent&&(t=s.timeExtent)}if(r=this._combineMosaicRuleWithTimeExtent(r,t),r?.multidimensionalDefinition){const{isOutside:e}=J(i,{multidimensionalDefinition:r.multidimensionalDefinition});if(e)return{isOutSide:!0,timeExtent:null,mosaicRule:null}}return{isOutSide:!1,timeExtent:t,mosaicRule:r}}_updateFeatureWithRasterAttributeTableValues(e,t){const r=this.rasterInfo.attributeTable||this.serviceRasterInfo.attributeTable;if(null==r)return;const{features:i,fields:s}=r,n=s.map((e=>e.name)).find((e=>"value"===e.toLowerCase()));if(!n)return;const o=i.filter((e=>e.attributes[n]===(null!=t?parseInt(t,10):null)));o&&o[0]&&s.forEach((t=>{const r=this._rasterAttributeTableFieldPrefix+t.name;e.attributes[r]=o[0].attributes[t.name]}))}_updateFeatureWithMagDirValues(e,t){if(!this._isVectorDataSet())return;const r=t.split(/,\s*/).map((e=>parseFloat(e))),i=r.map((e=>[e])),s=r.map((e=>({minValue:e,maxValue:e,noDataValue:null}))),n=new O({height:1,width:1,pixelType:"f32",pixels:i,statistics:s});null!=this.pixelFilter&&this.pixelFilter({pixelBlock:n,extent:new fe(0,0,0,0,this.spatialReference)});const o="esriImageServiceDataTypeVector-MagDir"===this.serviceDataType?[n.pixels[0][0],n.pixels[1][0]]:B([n.pixels[0][0],n.pixels[1][0]]);e.attributes["Raster.Magnitude"]=o[0],e.attributes["Raster.Direction"]=o[1]}_updateFeatureWithDomainValues(e){const t=this.fields&&this.fields.filter((e=>e.domain&&"coded-value"===e.domain.type));null!=t&&t.forEach((t=>{const r=e.attributes[t.name];if(null!=r){const i=t.domain.codedValues.find((e=>e.code===r));i&&(e.attributes[t.name]=i.name)}}))}_updateResponseFieldNames(e,t){if(!t||t.length<1)return;const r=this.fieldsIndex;null!=r&&e.forEach((e=>{if(e?.attributes)for(const i of t){const t=r.get(i)?.name;t&&t!==i&&(e.attributes[i]=e.attributes[t],delete e.attributes[t])}}))}_getRenderingRuleString(e){if(e){let t=e.toJSON();return t=t.rasterFunctionDefinition??t,(t.thumbnail||t.thumbnailEx)&&(t.thumbnail=t.thumbnailEx=null),JSON.stringify(t)}return null}_hasRasterFunction(e){return null!=e?.functionName&&"none"!==e.functionName.toLowerCase()}_updateRenderingRulesFunctionName(e,t){if(!e||e.length<1)return;if("Raw"===e)return e.replace("Raw","None");const r=e.toLowerCase().replaceAll(/ /gi,"_");return t.has(r)?t.get(r):e}_isRFTJson(e){return e?.name&&e.arguments&&e.function&&e.hasOwnProperty("functionType")}_isVectorDataSet(){return"esriImageServiceDataTypeVector-UV"===this.serviceDataType||"esriImageServiceDataTypeVector-MagDir"===this.serviceDataType}_applyMosaicAndRenderingRules(e){const{raster:t,mosaicRule:r,rasterFunction:i}=this;i&&e instanceof Ne&&null==e.rasterFunction&&(e.rasterFunction=i),r&&null==e.mosaicRule&&(e.mosaicRule=r),t&&null==e.raster&&(e.raster=t)}_readCapabilities(e){const t=e.capabilities?e.capabilities.toLowerCase().split(",").map((e=>e.trim())):["image","catalog"],{currentVersion:r,advancedQueryCapabilities:i,maxRecordCount:s}=e,n=t.includes("image"),o="esriImageServiceDataTypeElevation"===e.serviceDataType,a=!(!e.spatialReference&&!e.extent?.spatialReference),l=t.includes("edit"),u=t.includes("mensuration")&&a,p=null==e.mensurationCapabilities?[]:e.mensurationCapabilities.toLowerCase().split(",").map((e=>e.trim())),m=u&&p.includes("basic"),c=this._isMosaicDataset(e)&&t.includes("catalog"),d=t.includes("download");return{data:{supportsAttachment:!1},operations:{supportsComputeHistograms:n,supportsExportImage:n,supportsIdentify:n,supportsImageToMap:r>=11.2&&c,supportsImageToMapMultiray:r>=11.2&&c,supportsMapToImage:r>=11.2&&c,supportsFindImages:r>=11.2&&c,supportsGetImageUrl:r>=11.2&&d,supportsMeasure:u,supportsMeasureFromImage:r>=11.2,supportsDownload:d,supportsQuery:c&&e.fields&&e.fields.length>0,supportsGetSamples:r>=10.2&&n,supportsProject:r>=10.3&&n,supportsComputeStatisticsHistograms:r>=10.4&&n,supportsQueryBoundary:r>=10.6&&n,supportsCalculateVolume:r>=10.7&&o,supportsComputePixelLocation:r>=10.7&&c,supportsComputeAngles:r>=10.91,supportsQueryGPSInfo:r>=11.2&&c,supportsAdd:l,supportsDelete:l,supportsEditing:l,supportsUpdate:l,supportsCalculate:!1,supportsTruncate:!1,supportsValidateSql:!1,supportsChangeTracking:!1,supportsQueryAttachments:!1,supportsResizeAttachments:!1,supportsSync:!1,supportsExceedsLimitStatistics:!1,supportsQueryAnalytics:!1,supportsQueryTopFeatures:!1,supportsAsyncConvert3D:!1},query:{maxRecordCount:s,maxRecordCountFactor:void 0,supportsStatistics:!!i?.supportsStatistics,supportsOrderBy:!!i?.supportsOrderBy,supportsDistinct:!!i?.supportsDistinct,supportsPagination:!!i?.supportsPagination,supportsStandardizedQueriesOnly:!!i?.useStandardizedQueries,supportsPercentileStatistics:!!i?.supportsPercentileStatistics,supportsCentroid:!!i?.supportsReturningGeometryCentroid,supportsDistance:!!i?.supportsQueryWithDistance,supportsExtent:!!i?.supportsReturningQueryExtent,supportsGeometryProperties:!!i?.supportsReturningGeometryProperties,supportsHavingClause:!!i?.supportsHavingClause,supportsQuantization:!1,supportsQuantizationEditMode:!1,supportsQueryGeometry:!1,supportsResultType:!1,supportsMaxRecordCountFactor:!1,supportsSqlExpression:!1,supportsTopFeaturesQuery:!1,supportsQueryByAnonymous:!1,supportsQueryByOthers:!1,supportsHistoricMoment:!1,supportsFormatPBF:!1,supportsDisjointSpatialRelationship:!1,supportsCacheHint:!1,supportsSpatialAggregationStatistics:!1,supportedSpatialAggregationStatistics:{envelope:!1,centroid:!1,convexHull:!1},supportsDefaultSpatialReference:!!i?.supportsDefaultSR,supportsFullTextSearch:!1,supportsCompactGeometry:!1,standardMaxRecordCount:void 0,tileMaxRecordCount:void 0},mensuration:{supportsDistanceAndAngle:m,supportsAreaAndPerimeter:m,supportsPointOrCentroid:m,supportsHeightFromBaseAndTop:u&&p.includes("base-top height"),supportsHeightFromBaseAndTopShadow:u&&p.includes("base-top shadow height"),supportsHeightFromTopAndTopShadow:u&&p.includes("top-top shadow height"),supports3D:u&&p.includes("3d")}}}};function We(e){return e?.path??""}return e([c({clonable:!1})],f.prototype,"_functionRasterInfos",void 0),e([c({clonable:!1})],f.prototype,"_rasterJobHandler",void 0),e([c({clonable:!1})],f.prototype,"_cachedRendererJson",void 0),e([c({readOnly:!0})],f.prototype,"_serviceSupportsMosaicRule",void 0),e([y("_serviceSupportsMosaicRule",["currentVersion","fields"])],f.prototype,"readServiceSupportsMosaicRule",null),e([c({readOnly:!0})],f.prototype,"_rasterAttributeTableFieldPrefix",void 0),e([c({readOnly:!0})],f.prototype,"_rasterFunctionNamesIndex",null),e([c()],f.prototype,"adjustAspectRatio",void 0),e([c({type:[h],json:{write:!0}})],f.prototype,"bandIds",void 0),e([y("bandIds")],f.prototype,"readBandIds",null),e([c({readOnly:!0,json:{read:!1}})],f.prototype,"capabilities",void 0),e([y("service","capabilities",["capabilities","currentVersion","serviceDataType"])],f.prototype,"readCapabilities",null),e([c({type:Number})],f.prototype,"compressionQuality",void 0),e([b("compressionQuality")],f.prototype,"writeCompressionQuality",null),e([c({type:Number})],f.prototype,"compressionTolerance",void 0),e([b("compressionTolerance")],f.prototype,"writeCompressionTolerance",null),e([c({json:{read:{source:"copyrightText"}}})],f.prototype,"copyright",void 0),e([c({readOnly:!0,dependsOn:["_serviceSupportsMosaicRule"]})],f.prototype,"defaultMosaicRule",void 0),e([y("defaultMosaicRule",["defaultMosaicMethod"])],f.prototype,"readDefaultMosaicRule",null),e([c({type:String,json:{name:"layerDefinition.definitionExpression",write:{enabled:!0,allowNull:!0}}})],f.prototype,"definitionExpression",void 0),e([c({readOnly:!0,constructOnly:!0})],f.prototype,"exportImageServiceParameters",void 0),e([c()],f.prototype,"rasterInfo",void 0),e([c({readOnly:!0,type:[_]})],f.prototype,"fields",void 0),e([c({readOnly:!0})],f.prototype,"fieldsIndex",null),e([c({type:["png","png8","png24","png32","jpg","bmp","gif","jpgpng","lerc","tiff"],json:{write:!0}})],f.prototype,"format",null),e([y("service","format",["serviceDataType"])],f.prototype,"readFormat",null),e([c({type:fe})],f.prototype,"fullExtent",void 0),e([c({readOnly:!0})],f.prototype,"hasMultidimensions",void 0),e([c({json:{read:{source:"maxImageHeight"}}})],f.prototype,"imageMaxHeight",void 0),e([c({json:{read:{source:"maxImageWidth"}}})],f.prototype,"imageMaxWidth",void 0),e([c({type:String,json:{type:M.jsonValues,read:M.read,write:M.write}})],f.prototype,"interpolation",void 0),e([c()],f.prototype,"minScale",void 0),e([y("service","minScale")],f.prototype,"readMinScale",null),e([c()],f.prototype,"maxScale",void 0),e([y("service","maxScale")],f.prototype,"readMaxScale",null),e([c({type:P})],f.prototype,"mosaicRule",null),e([y("mosaicRule",["mosaicRule","defaultMosaicMethod"])],f.prototype,"readMosaicRule",null),e([b("mosaicRule")],f.prototype,"writeMosaicRule",null),e([c()],f.prototype,"multidimensionalInfo",void 0),e([c({type:j,json:{write:!0}})],f.prototype,"multidimensionalSubset",void 0),e([c({json:{type:h}})],f.prototype,"noData",void 0),e([b("noData")],f.prototype,"writeNoData",null),e([c({type:String,json:{type:C.jsonValues,read:C.read,write:C.write}})],f.prototype,"noDataInterpretation",void 0),e([c({type:String,readOnly:!0,json:{read:{source:["fields"]}}})],f.prototype,"objectIdField",void 0),e([y("objectIdField")],f.prototype,"readObjectIdField",null),e([c({readOnly:!0})],f.prototype,"geometryType",void 0),e([c({})],f.prototype,"typeIdField",void 0),e([c({})],f.prototype,"types",void 0),e([c({readOnly:!0})],f.prototype,"parsedUrl",null),e([c({type:Function})],f.prototype,"pixelFilter",void 0),e([c()],f.prototype,"raster",void 0),e([c({readOnly:!0})],f.prototype,"sourceType",void 0),e([y("sourceType",["serviceSourceType","fields"])],f.prototype,"readSourceType",null),e([c()],f.prototype,"viewId",void 0),e([c({types:r,json:{name:"layerDefinition.drawingInfo.renderer",origins:{"web-scene":{types:i,name:"layerDefinition.drawingInfo.renderer",write:{overridePolicy:e=>({enabled:e&&"vector-field"!==e.type&&"flow"!==e.type})}}}}})],f.prototype,"renderer",null),e([y("renderer")],f.prototype,"readRenderer",null),e([b("renderer")],f.prototype,"writeRenderer",null),e([c({clonable:!1})],f.prototype,"symbolizer",void 0),e([c(w)],f.prototype,"opacity",void 0),e([c({readOnly:!0})],f.prototype,"rasterFields",null),e([c({constructOnly:!0})],f.prototype,"rasterFunctionInfos",void 0),e([c({type:q})],f.prototype,"renderingRule",null),e([c({type:q,json:{name:"renderingRule"}})],f.prototype,"rasterFunction",null),e([y("rasterFunction",["renderingRule","rasterFunctionInfos"])],f.prototype,"readRasterFunction",null),e([c({readOnly:!0})],f.prototype,"serviceDataType",void 0),e([c({readOnly:!0,type:Re})],f.prototype,"spatialReference",void 0),e([y("spatialReference",["spatialReference","extent"])],f.prototype,"readSpatialReference",null),e([c({json:{type:N.jsonValues}})],f.prototype,"pixelType",void 0),e([y("pixelType")],f.prototype,"readPixelType",null),e([b("pixelType")],f.prototype,"writePixelType",null),e([c({constructOnly:!0,type:A})],f.prototype,"serviceRasterInfo",void 0),e([c()],f.prototype,"sourceJSON",void 0),e([c(v)],f.prototype,"url",void 0),e([c({readOnly:!0})],f.prototype,"version",void 0),e([y("version",["currentVersion","fields","timeInfo"])],f.prototype,"readVersion",null),f=e([R("esri.layers.mixins.ArcGISImageService")],f),f};export{We as ArcGISImageService};
|
|
5
|
+
import{_ as e}from"../../chunks/tslib.es6.js";import"../../geometry.js";import t from"../../Graphic.js";import{rasterRendererTypes as r,websceneRasterRendererTypes as i,read as s}from"../../rasterRenderers.js";import n from"../../request.js";import{deprecatedProperty as o}from"../../core/deprecate.js";import a from"../../core/Error.js";import{clone as l}from"../../core/lang.js";import u from"../../core/Logger.js";import{watch as p}from"../../core/reactiveUtils.js";import{urlToObject as m}from"../../core/urlUtils.js";import{property as c,ensureRange as d}from"../../core/accessorSupport/decorators/property.js";import{Integer as h,ensureClass as g,ensureNumber as f}from"../../core/accessorSupport/ensureType.js";import{reader as y}from"../../core/accessorSupport/decorators/reader.js";import{subclass as R}from"../../core/accessorSupport/decorators/subclass.js";import{writer as b}from"../../core/accessorSupport/decorators/writer.js";import{srToRESTValue as I}from"../../geometry/support/spatialReferenceUtils.js";import{opacity as w,url as v}from"../support/commonProperties.js";import S from"../support/DimensionalDefinition.js";import{ExportImageServiceParameters as x}from"../support/ExportImageServiceParameters.js";import _ from"../support/Field.js";import F from"../support/FieldsIndex.js";import{createBitmap as D}from"../support/imageBitmapUtils.js";import{isSupportedRendererType as T}from"../support/imageryRendererUtils.js";import P from"../support/MosaicRule.js";import j from"../support/MultidimensionalSubset.js";import O from"../support/PixelBlock.js";import{interpolationKebab as M,noDataInterpretationKebab as C,pixelTypeKebabDict as N}from"../support/rasterEnums.js";import q from"../support/RasterFunction.js";import A from"../support/RasterInfo.js";import E from"../support/RasterJobHandler.js";import{intersectMultimensionalSubset as J,getSubsetVariablesFromMdInfo as V,getDefaultMultidimensionalDefinition as Q}from"../support/rasterDatasets/multidimensionalUtils.js";import{decode as H,getFormat as U}from"../support/rasterFormats/RasterCodec.js";import{uvComponentToVector as B}from"../support/rasterFunctions/vectorFieldUtils.js";import{getSupportedRendererTypes as L,getDefaultBandCombination as z,createDefaultRenderer as G,normalizeRendererJSON as k}from"../../renderers/support/rasterRendererHelper.js";import W from"../../renderers/support/RasterSymbolizer.js";import{computeAngles as $,computePixelSpaceLocations as X,computeHistograms as K,computeStatisticsHistograms as Y,measureHeight as Z,measureAreaAndPerimeter as ee,measureDistanceAndAngle as te,measurePointOrCentroid as re,measureLengthFromImage as ie,measureAreaFromImage as se,getImageSpatialReferenceQueryParameter as ne,getSamples as oe,identify as ae,imageToMap as le,imageToMapMultiray as ue,mapToImage as pe,findImages as me,getImageUrl as ce,queryBoundary as de,queryGPSInfo as he}from"../../rest/imageService.js";import"../../core/has.js";import"../support/source/DataLayerSource.js";import{executeQueryJSON as ge}from"../../rest/query/executeQueryJSON.js";import"../../config.js";import"../../kernel.js";import"../../core/unitUtils.js";import"../../geometry/ellipsoidUtils.js";import"../../geometry/support/aaBoundingBox.js";import"../../core/mathUtils.js";import fe from"../../geometry/Extent.js";import"../../geometry/Geometry.js";import"../../geometry/Multipoint.js";import"../../geometry/Point.js";import ye from"../../geometry/Polygon.js";import"../../geometry/Polyline.js";import"../../geometry/support/normalizeUtilsCommon.js";import Re from"../../geometry/SpatialReference.js";import"../../geometry/support/Ellipsoid.js";import"../../core/pbf.js";import be from"../../rest/support/FeatureSet.js";import Ie from"../../rest/support/Query.js";import"../../rest/query/support/AttachmentInfo.js";import"../../rest/support/AttachmentQuery.js";import{executeForCount as we}from"../../rest/query/executeForCount.js";import{executeForIds as ve}from"../../rest/query/executeForIds.js";import"../../rest/support/RelationshipQuery.js";import"../../rest/support/TopFeaturesQuery.js";import{generateRasterInfo as Se,fetchServiceRasterInfo as xe,patchServiceInfo as _e}from"../../rest/imageService/fetchRasterInfo.js";import{getCatalogItemRasterInfo as Fe}from"../../rest/imageService/getCatalogItemRasterInfo.js";import De from"../../rest/support/FindImagesParameters.js";import Te from"../../rest/support/ImageAngleParameters.js";import Pe from"../../rest/support/ImageAreaParameters.js";import je from"../../rest/support/ImageBoundaryParameters.js";import Oe from"../../rest/support/ImageDistanceParameters.js";import Me from"../../rest/support/ImageGPSInfoParameters.js";import Ce from"../../rest/support/ImageHeightParameters.js";import Ne from"../../rest/support/ImageHistogramParameters.js";import qe from"../../rest/support/ImageIdentifyParameters.js";import Ae from"../../rest/support/ImagePixelLocationParameters.js";import Ee from"../../rest/support/ImagePointParameters.js";import Je from"../../rest/support/ImageSampleParameters.js";import Ve from"../../rest/support/ImageToMapMultirayParameters.js";import Qe from"../../rest/support/ImageToMapParameters.js";import He from"../../rest/support/ImageUrlParameters.js";import Ue from"../../rest/support/MapToImageParameters.js";import Be from"../../rest/support/MeasureFromImageParameters.js";import{createFlowMesh as Le}from"../../views/2d/engine/flow/dataUtils.js";const ze=new Set(["png","png8","png24","png32","jpg","bmp","gif","jpgpng","lerc","tiff"]),Ge=d(f,{min:0,max:255});function ke(e){if(!e)return null;const t=JSON.stringify(e).match(/"rasterFunction":"(.*?")/gi),r=t?.map((e=>e.replace('"rasterFunction":"',"").replace('"',"")));return r?r.join("/"):null}const We=d=>{let f=class extends d{constructor(){super(...arguments),this._functionRasterInfos={},this._rasterJobHandler={instance:null,refCount:0,connectionPromise:null},this._cachedRendererJson=null,this._serviceSupportsMosaicRule=null,this._rasterAttributeTableFieldPrefix="Raster.",this.adjustAspectRatio=null,this.bandIds=void 0,this.capabilities=null,this.compressionQuality=void 0,this.compressionTolerance=.01,this.copyright=null,this.defaultMosaicRule=null,this.definitionExpression=null,this.exportImageServiceParameters=null,this.rasterInfo=null,this.fields=null,this.fullExtent=null,this.hasMultidimensions=!1,this.imageMaxHeight=4100,this.imageMaxWidth=4100,this.interpolation=void 0,this.minScale=0,this.maxScale=0,this.multidimensionalInfo=null,this.multidimensionalSubset=null,this.noData=null,this.noDataInterpretation=void 0,this.objectIdField=null,this.geometryType="polygon",this.typeIdField=null,this.types=[],this.pixelFilter=null,this.raster=void 0,this.sourceType=null,this.viewId=void 0,this.symbolizer=null,this.rasterFunctionInfos=null,this.serviceDataType=null,this.spatialReference=null,this.pixelType=null,this.serviceRasterInfo=null,this.sourceJSON=null,this.url=null,this.version=void 0}initialize(){this._set("exportImageServiceParameters",new x({layer:this}))}readServiceSupportsMosaicRule(e,t){return this._isMosaicRuleSupported(t)}get _rasterFunctionNamesIndex(){const e=new Map;return!this.rasterFunctionInfos||null!=this.rasterFunctionInfos&&this.rasterFunctionInfos.length<1||null!=this.rasterFunctionInfos&&this.rasterFunctionInfos.forEach((t=>{e.set(t.name.toLowerCase().replaceAll(/ /gi,"_"),t.name)})),e}readBandIds(e,t){if(Array.isArray(e)&&e.length>0&&e.every((e=>"number"==typeof e)))return e}readCapabilities(e,t){return this._readCapabilities(t)}writeCompressionQuality(e,t,r){null!=e&&"lerc"!==this.format&&(t[r]=e)}writeCompressionTolerance(e,t,r){"lerc"===this.format&&null!=e&&(t[r]=e)}readDefaultMosaicRule(e,t){return this._serviceSupportsMosaicRule?P.fromJSON(t):null}get fieldsIndex(){return this.fields?new F(this.fields):null}set format(e){e&&ze.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?.mosaicMethod&&(t=P.fromJSON({...t.toJSON(),mosaicMethod:t.mosaicMethod,mosaicOperation:t.mosaicOperation})),this._set("mosaicRule",t)}readMosaicRule(e,t){const r=e||t.mosaicRule;return r?P.fromJSON(r):this._isMosaicRuleSupported(t)?P.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 P({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.find((e=>"esriFieldTypeOID"===e.type||"oid"===e.type));e=r?.name}return e}get parsedUrl(){return m(this.url)}readSourceType(e,t){return this._isMosaicDataset(t)?"mosaic-dataset":"raster-dataset"}set renderer(e){this.loaded&&(e=this._configRenderer(e)),this._set("renderer",e)}readRenderer(e,t,r){const i=t?.layerDefinition?.drawingInfo?.renderer,n=s(i,r);return null==n?null:("vector-field"===n.type&&t.symbolTileSize&&!i.symbolTileSize&&(n.symbolTileSize=t.symbolTileSize),T(n)||u.getLogger(this).warn("ArcGISImageService","Imagery layer doesn't support given renderer type."),n)}writeRenderer(e,t,r){t.layerDefinition=t.layerDefinition||{},t.layerDefinition.drawingInfo=t.layerDefinition.drawingInfo||{},t.layerDefinition.drawingInfo.renderer=e.toJSON(),"vector-field"===e.type&&(t.symbolTileSize=e.symbolTileSize)}get rasterFields(){const e=this._rasterAttributeTableFieldPrefix,t=new _({name:"Raster.ItemPixelValue",alias:"Item Pixel Value",domain:null,editable:!1,length:50,type:"string"}),r=new _({name:"Raster.ServicePixelValue",alias:"Service Pixel Value",domain:null,editable:!1,length:50,type:"string"}),i=new _({name:"Raster.ServicePixelValue.Raw",alias:"Raw Service Pixel Value",domain:null,editable:!1,length:50,type:"string"});let s=this.fields?l(this.fields):[];s.push(r),this.capabilities?.operations.supportsQuery&&this.fields&&this.fields.length>0&&s.push(t),this.version>=10.4&&null!=this.rasterFunctionInfos&&this.rasterFunctionInfos.some((e=>"none"===e.name.toLowerCase()))&&s.push(i),null!=this.rasterFunctionInfos&&this.rasterFunctionInfos.filter((e=>"none"!==e.name.toLowerCase())).forEach((e=>{s.push(new _({name:"Raster.ServicePixelValue."+e.name,alias:e.name,domain:null,editable:!1,length:50,type:"string"}))})),this._isVectorDataSet()&&(s.push(new _({name:"Raster.Magnitude",alias:"Magnitude",domain:null,editable:!1,type:"double"})),s.push(new _({name:"Raster.Direction",alias:"Direction",domain:null,editable:!1,type:"double"})));const{attributeTable:n}=this.rasterInfo??{};if(null!=n){const t=n.fields.filter((e=>"esriFieldTypeOID"!==e.type&&"value"!==e.name.toLowerCase())).map((t=>{const r=l(t);return r.name=e+t.name,r}));s=s.concat(t)}return s}get renderingRule(){return o(u.getLogger(this),"renderingRule",{replacement:"rasterFunction",version:"4.27",warnOnce:!0}),this.rasterFunction}set renderingRule(e){o(u.getLogger(this),"renderingRule",{replacement:"rasterFunction",version:"4.27",warnOnce:!0}),this._set("rasterFunction",e)}set rasterFunction(e){let t=e;t?.rasterFunction&&(t=q.fromJSON({...t.toJSON(),rasterFunction:t.rasterFunction,rasterFunctionArguments:t.rasterFunctionArguments})),this._set("rasterFunction",t)}readRasterFunction(e,t){const r=t.rasterFunctionInfos;return t.renderingRule||r?.length&&"None"!==r[0].name?this._isRFTJson(t.renderingRule)?q.fromJSON({rasterFunctionDefinition:t.renderingRule}):q.fromJSON(t.renderingRule||{rasterFunctionInfos:t.rasterFunctionInfos}):null}readSpatialReference(e,t){const r=e||t.extent.spatialReference;return r?Re.fromJSON(r):null}readPixelType(e){return N.fromJSON(e)||e}writePixelType(e,t,r){null!=this.serviceRasterInfo&&this.pixelType===this.serviceRasterInfo.pixelType||(t[r]=N.toJSON(e))}readVersion(e,t){let r=t.currentVersion;return r||(r=t.hasOwnProperty("fields")||t.hasOwnProperty("timeInfo")?10:9.3),r}applyFilter(e){let t=e;return this.pixelFilter&&(t=this._clonePixelData(e),this.pixelFilter(t)),t}async applyRenderer(e,t){let r=e;const{renderer:i,symbolizer:s,pixelFilter:n,bandIds:o}=this;if(!this._isPicture()&&i&&s&&!n){const n=JSON.stringify(this._cachedRendererJson)!==JSON.stringify(i.toJSON()),a=this._rasterJobHandler.instance;if(a){n&&(s.bind(),await a.updateSymbolizer(s,t),this._cachedRendererJson=i.toJSON());const l=await a.symbolize({bandIds:o,...e},t);r={extent:e.extent,pixelBlock:l}}else r={extent:e.extent,pixelBlock:s.symbolize({bandIds:o,...e})}}return r}destroy(){this._shutdownJobHandler()}increaseRasterJobHandlerUsage(){this._rasterJobHandler.refCount++}decreaseRasterJobHandlerUsage(){this._rasterJobHandler.refCount--,this._rasterJobHandler.refCount<=0&&this._shutdownJobHandler()}async computeAngles(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsComputeAngles)throw new a("imagery-layer:compute-angles","this operation is not supported on the input image service");return e=g(Te,e).clone(),$(this.url,e,this._getRequestOptions(t))}async computePixelSpaceLocations(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsComputePixelLocation)throw new a("imagery-layer:compute-pixel-space-locations","this operation is not supported on the input image service");return e=g(Ae,e).clone(),X(this.url,e,this._getRequestOptions(t))}async computeHistograms(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsComputeHistograms)throw new a("imagery-layer:compute-histograms","this operation is not supported on the input image service");return e=g(Ne,e).clone(),this._applyMosaicAndRenderingRules(e),K(this.url,e,this._getRequestOptions(t))}async computeStatisticsHistograms(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsComputeStatisticsHistograms)throw new a("imagery-layer:compute-statistics-histograms","this operation is not supported on the input image service");return e=g(Ne,e).clone(),this._applyMosaicAndRenderingRules(e),Y(this.url,e,this._getRequestOptions(t))}async measureHeight(e,t){const r=await this._fetchCapabilities(t?.signal);if(!("base-and-top"===e.operationType?r.mensuration.supportsHeightFromBaseAndTop:"base-and-top-shadow"===e.operationType?r.mensuration.supportsHeightFromBaseAndTopShadow:r.mensuration.supportsHeightFromTopAndTopShadow))throw new a("imagery-layer:measure-height","this operation is not supported on the input image service");return e=g(Ce,e).clone(),this._applyMosaicAndRenderingRules(e),Z(this.url,e,this._getRequestOptions(t))}async measureAreaAndPerimeter(e,t){const r=await this._fetchCapabilities(t?.signal);if(!(r.mensuration.supportsAreaAndPerimeter&&(!e.is3D||r.mensuration.supports3D)))throw new a("imagery-layer:measure-area-and-perimeter","this operation is not supported on the input image service");return e=g(Pe,e).clone(),this._applyMosaicAndRenderingRules(e),ee(this.url,e,this._getRequestOptions(t))}async measureDistanceAndAngle(e,t){const r=await this._fetchCapabilities(t?.signal);if(!(r.mensuration.supportsDistanceAndAngle&&(!e.is3D||r.mensuration.supports3D)))throw new a("imagery-layer:measure-distance-and-angle","this operation is not supported on the input image service");return e=g(Oe,e).clone(),this._applyMosaicAndRenderingRules(e),te(this.url,e,this._getRequestOptions(t))}async measurePointOrCentroid(e,t){const r=await this._fetchCapabilities(t?.signal);if(!(r.mensuration.supportsPointOrCentroid&&(!e.is3D||r.mensuration.supports3D)))throw new a("imagery-layer:measure-point-or-centroid","this operation is not supported on the input image service");return e=g(Ee,e).clone(),this._applyMosaicAndRenderingRules(e),re(this.url,e,this._getRequestOptions(t))}async measureLengthFromImage(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsMeasureFromImage)throw new a("imagery-layer:measure-length-from-image","this operation is not supported on the input image service");if("polyline"!==e.geometry.type)throw new a("imagery-layer:measure-length-from-image","this input geometry must be a polyline");return e=g(Be,e).clone(),ie(this.url,e,this._getRequestOptions(t))}async measureAreaFromImage(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsMeasureFromImage)throw new a("imagery-layer:measure-area-from-image","this operation is not supported on the input image service");if("polygon"!==e.geometry.type)throw new a("imagery-layer:measure-area-from-image","this input geometry must be a polygon");return e=g(Be,e).clone(),se(this.url,e,this._getRequestOptions(t))}getField(e){const{fieldsIndex:t}=this;return null!=t?t.get(e):void 0}getFieldDomain(e,t){const r=this.getField(e);return r?r.domain:null}async fetchImage(e,t,r,i={}){if(null==e||null==t||null==r)throw new a("imagery-layer:fetch-image","Insufficient parameters for requesting an image. A valid extent, width and height values are required.");if(this.renderer||this.symbolizer){const e=await this._generateRasterInfo(this.rasterFunction,{signal:i.signal});e&&(this.rasterInfo=e)}const s=this.getExportImageServiceParameters(e,t,r,i.timeExtent);if(null==s){if(i.requestAsImageElement&&this._canRequestImageElement(this.format)){const e=document.createElement("canvas");if(e.width=t,e.height=r,i.returnImageBitmap){return{imageBitmap:await D(e,`${We(this.parsedUrl)}/exportImage`,i.signal)}}return{imageOrCanvasElement:e}}const{bandIds:s,rasterInfo:n}=this,o=(s?.length||n.bandCount)??0,a=t*r,l=n.pixelType,u=[];for(let e=0;e<o;e++)u.push(O.createEmptyBand(l,a));return{pixelData:{pixelBlock:new O({width:t,height:r,pixels:u,mask:new Uint8Array(a),pixelType:l}),extent:e}}}const n=!!i.requestAsImageElement&&!this.pixelFilter,o=n&&!!i.returnImageBitmap,l={imageServiceParameters:s,imageProps:{extent:e,width:t,height:r,format:this.format},requestAsImageElement:n,returnImageBitmap:o,signal:i.signal};return this._requestArrayBuffer(l)}fetchKeyProperties(e){return n(We(this.parsedUrl)+"/keyProperties",{query:this._getQueryParams({renderingRule:this.version>=10.3?e?.rasterFunction:null})}).then((e=>e.data))}fetchRasterAttributeTable(e){return this.version<10.1?Promise.reject(new a("#fetchRasterAttributeTable()","Failed to get rasterAttributeTable")):n(We(this.parsedUrl)+"/rasterAttributeTable",{query:this._getQueryParams({renderingRule:this.version>=10.3?e?.rasterFunction:null})}).then((e=>be.fromJSON(e.data)))}getCatalogItemRasterInfo(e,t){const r={...t,query:this._getQueryParams()};return Fe(We(this.parsedUrl),e,r)}async getCatalogItemICSInfo(e,t){const{data:r}=await n(We(this.parsedUrl)+"/"+e+"/info/ics",{query:this._getQueryParams(),...t}),i=r?.ics;if(!i)return;let s=null;try{s=(await n(We(this.parsedUrl)+"/"+e+"/info",{query:this._getQueryParams(),...t})).data.extent}catch{}if(!s||!s.spatialReference)return{ics:i,icsToPixelTransform:null,icsExtent:null,northDirection:null};const o=this.version>=10.7?n(We(this.parsedUrl)+"/"+e+"/info/icstopixel",{query:this._getQueryParams(),...t}).then((e=>e.data)).catch((()=>({}))):{},a=s.spatialReference,l={geometries:JSON.stringify({geometryType:"esriGeometryEnvelope",geometries:[s]}),inSR:I(a),outSR:"0:"+e},u=n(We(this.parsedUrl)+"/project",{query:this._getQueryParams(l),...t}).then((e=>e.data)).catch((()=>({}))),p=5,m=(s.xmin+s.xmax)/2,c=(s.ymax-s.ymin)/(p+1),d=s.ymin+c,h=[];for(let n=0;n<p;n++)h.push({x:m,y:d+c*n});const g={geometries:JSON.stringify({geometryType:"esriGeometryPoint",geometries:h}),inSR:I(a),outSR:"0:"+e},f=n(We(this.parsedUrl)+"/project",{query:this._getQueryParams(g),...t}).then((e=>e.data)).catch((()=>({}))),y=await Promise.all([o,u,f]);let R=y[0].ipxf;if(null==R){const e=i.geodataXform?.xf_0;"topup"===e?.name?.toLowerCase()&&6===e?.coefficients?.length&&(R={affine:{name:"ics [sensor: Frame] to pixel (column, row) transformation",coefficients:e.coefficients,cellsizeRatio:0,type:"GeometricXform"}})}const b=fe.fromJSON(y[1]?.geometries?.[0]);b&&(b.spatialReference=new Re({wkid:0,imageCoordinateSystem:i}));const w=y[2].geometries?y[2].geometries.filter((e=>null!=e?.x&&null!=e.y&&"NaN"!==e.x&&"NaN"!==e.y)):[],v=w.length;if(v<3)return{ics:i,icsToPixelTransform:R,icsExtent:b,northDirection:null};let S=0,x=0,_=0,F=0;for(let n=0;n<v;n++)S+=w[n].x,x+=w[n].y,_+=w[n].x*w[n].x,F+=w[n].x*w[n].y;const D=(v*F-S*x)/(v*_-S*S);let T=0;const P=w[p-1].x>w[0].x,j=w[p-1].y>w[0].y;return D===1/0?T=j?90:270:0===D?T=P?0:180:D>0?T=P?180*Math.atan(D)/Math.PI:180*Math.atan(D)/Math.PI+180:D<0&&(T=j?180+180*Math.atan(D)/Math.PI:360+180*Math.atan(D)/Math.PI),{ics:i,icsToPixelTransform:R,icsExtent:b,northDirection:T}}async generateRasterInfo(e,t){if(e=g(q,e),this.serviceRasterInfo&&(!e||"none"===e.functionName?.toLowerCase()||this._isVectorFieldResampleFunction(e)))return this.serviceRasterInfo;const r=ke(e);if(!r)throw new a("imagery-layer:generate-raster-info","the rendering rule is not supported");if(this._functionRasterInfos[r])return this._functionRasterInfos[r];const i={...t,query:this._getQueryParams()},s=Se(We(this.parsedUrl),e,i);this._functionRasterInfos[r]=s;try{return await s}catch(n){throw this._functionRasterInfos[r]=null,n}}getExportImageServiceParameters(e,t,r,i){e=e.clone().shiftCentralMeridian();const s=ne(e.spatialReference,We(this.parsedUrl));this.pixelType!==this.serviceRasterInfo.pixelType&&(this.exportImageServiceParameters.pixelType=this.pixelType);const n=this.exportImageServiceParameters.toJSON(),{bandIds:o,noData:a}=n;let{renderingRule:l}=n;const u=this.rasterFunction?.rasterFunctionDefinition,p=!this.renderer||"raster-stretch"===this.renderer.type;if(o?.length&&this._hasRasterFunction(this.rasterFunction)&&!u&&p){const e={rasterFunction:"ExtractBand",rasterFunctionArguments:{BandIds:o}};if("Stretch"===l.rasterFunction)e.rasterFunctionArguments.Raster=l.rasterFunctionArguments.Raster,l.rasterFunctionArguments.Raster=e;else if("Colormap"===l.rasterFunction){const t=l.rasterFunctionArguments.Raster;"Stretch"===t?.rasterFunction?(e.rasterFunctionArguments.Raster=t.rasterFunctionArguments.Raster,t.rasterFunctionArguments.Raster=e):(e.rasterFunctionArguments.Raster=t,l.rasterFunctionArguments.Raster=e)}else e.rasterFunctionArguments.Raster=l,l=e;n.bandIds=void 0}else n.bandIds=o?.join(",");a instanceof Array&&a.length>0&&(n.noData=a.join(","));const m=this._processMultidimensionalIntersection(null,i,this.exportImageServiceParameters.mosaicRule);if(m.isOutSide)return null;n.mosaicRule=null!=m.mosaicRule?JSON.stringify(m.mosaicRule):null,i=m.timeExtent,n.renderingRule=this._getRenderingRuleString(q.fromJSON(l));const c={};if(null!=i){const{start:e,end:t}=i.toJSON();e&&t&&e===t?c.time=""+e:null==e&&null==t||(c.time=`${e??"null"},${t??"null"}`)}return{bbox:e.xmin+","+e.ymin+","+e.xmax+","+e.ymax,bboxSR:s,imageSR:s,size:t+","+r,...n,...c}}async getSamples(e,t){const r=await this._fetchCapabilities(t?.signal);if(!r?.operations.supportsGetSamples)throw new a("imagery-layer:get-samples","getSamples operation is not supported on the input image service");e=g(Je,e).clone();const{raster:i}=this;return i&&null==e.raster&&(e.raster=i),oe(this.url,e,this._getRequestOptions(t))}async identify(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsIdentify)throw new a("imagery-layer:identify","identify operation is not supported on the input image service");e=g(qe,e).clone(),this.version<10.91&&"extent"===e.geometry?.type&&(e.geometry=ye.fromExtent(e.geometry));const r=this._processMultidimensionalIntersection(e.geometry,e.timeExtent,e.mosaicRule||this.mosaicRule);if(r.isOutSide)throw new a("imagery-layer:identify","the request cannot be fulfilled when falling outside of the multidimensional subset");e.timeExtent=r.timeExtent,e.mosaicRule=r.mosaicRule;const{raster:i,rasterFunction:s}=this;return s&&null==e.rasterFunction&&(e.rasterFunction=s),i&&null==e.raster&&(e.raster=i),ae(this.url,e,this._getRequestOptions(t))}async imageToMap(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsImageToMap)throw new a("imagery-layer:image-to-map","imageToMap operation is not supported on the input image service");return e=g(Qe,e),le(We(this.parsedUrl),e,this._getRequestOptions(t))}async imageToMapMultiray(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsImageToMapMultiray)throw new a("imagery-layer:image-to-map-multiray","imageToMapMultiray operation is not supported on the input image service");return e=g(Ve,e),ue(We(this.parsedUrl),e,this._getRequestOptions(t))}async mapToImage(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsMapToImage)throw new a("imagery-layer:map-to-image","mapToImage operation is not supported on the input image service");return e=g(Ue,e),pe(We(this.parsedUrl),e,this._getRequestOptions(t))}async findImages(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsFindImages)throw new a("imagery-layer:find-images","findImages operation is not supported on the input image service");return e=g(De,e),me(We(this.parsedUrl),e,this._getRequestOptions(t))}async getImageUrl(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsGetImageUrl)throw new a("imagery-layer:get-image-url","getImageUrl operation is not supported on the input image service");return e=g(He,e),ce(We(this.parsedUrl),e,this._getRequestOptions(t))}createQuery(){return new Ie({outFields:["*"],returnGeometry:!0,where:this.definitionExpression||"1=1"})}async queryBoundary(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsQueryBoundary)throw new a("imagery-layer:query-boundary","queryBoundary operation is not supported on the input image service");return e=g(je,e??{outSpatialReference:this.spatialReference}).clone(),de(We(this.parsedUrl),e,this._getRequestOptions(t))}async queryRasters(e,t){return({query:e,requestOptions:t}=await this._prepareForQuery(e,t)),ge(this.url,e,t)}async queryObjectIds(e,t){return({query:e,requestOptions:t}=await this._prepareForQuery(e,t)),ve(this.url,e,t)}async queryGPSInfo(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsQueryGPSInfo)throw new a("imagery-layer:query-gps-info","queryGPSInfo operation is not supported on the input image service");return e=g(Me,e??{outSpatialReference:this.spatialReference}).clone(),he(We(this.parsedUrl),e,this._getRequestOptions(t))}async queryRasterCount(e,t){return({query:e,requestOptions:t}=await this._prepareForQuery(e,t)),we(this.url,e,t)}async queryVisibleRasters(e,t){if(!e)throw new a("imagery-layer: query-visible-rasters","missing query parameter");await this.load();const{pixelSize:r,returnDomainValues:i,returnTopmostRaster:s,showNoDataRecords:n}=t||{pixelSize:null,returnDomainValues:!1,returnTopmostRaster:!1,showNoDataRecords:!1};let o=!1,l=null,u=null;const p="raster.servicepixelvalue",m=this._rasterFunctionNamesIndex;if(null!=e.outFields&&(o=e.outFields.some((e=>!e.toLowerCase().includes(p))),this.version>=10.4)){const t=e.outFields.filter((e=>e.toLowerCase().includes(p)&&e.length>p.length)).map((e=>{const t=e.slice(p.length+1);return[this._updateRenderingRulesFunctionName(t,m),t]}));l=t.map((e=>new q({functionName:e[0]}))),u=t.map((e=>e[1]));const{rasterFunction:r}=this;0===l.length?r?.functionName?(l.push(r),u.push(r.functionName)):l=null:r?.functionName&&!l.some((e=>e.functionName===r.functionName))&&(l.push(r),u.push(r.functionName))}const c=null==e.outSpatialReference||e.outSpatialReference.equals(this.spatialReference),{multidimensionalSubset:d}=this;let h=e.timeExtent||this.timeExtent;if(d){const{isOutside:t,intersection:r}=J(d,{geometry:e.geometry,timeExtent:e.timeExtent,multidimensionalDefinition:this.exportImageServiceParameters.mosaicRule?.multidimensionalDefinition});if(t)throw new a("imagery-layer:query-visible-rasters","the request cannot be fulfilled when falling outside of the multidimensional subset");null!=r?.timeExtent&&(h=r.timeExtent)}const g=this._combineMosaicRuleWithTimeExtent(this.exportImageServiceParameters.mosaicRule,h);let f=e.geometry;this.version<10.91&&"extent"===f?.type&&(f=ye.fromExtent(f));const y=this._getQueryParams({geometry:f,timeExtent:h,mosaicRule:g,rasterFunction:this.version<10.4?this.rasterFunction:null,rasterFunctions:l,pixelSize:r,returnCatalogItems:o,returnGeometry:c,raster:this.raster,maxItemCount:s?1:null});delete y.f;const R=new qe(y);try{await this._generateRasterInfo(this.rasterFunction);const r=await ae(this.url,R,{signal:t?.signal,query:{...this.customParameters}}),s=e.outFields,a=null!=r.value&&r.value.toLowerCase().includes("nodata");if(!(o&&!c&&r?.catalogItems?.features.length&&(n||!a)))return this._processVisibleRastersResponse(r,{returnDomainValues:i,templateRRFunctionNames:u,showNoDataRecords:n,templateFields:s});const l=this.objectIdField||"ObjectId",p=r.catalogItems?.features??[],m=p.map((e=>e.attributes?.[l])),d=new Ie({objectIds:m,returnGeometry:!0,outSpatialReference:e.outSpatialReference,outFields:[l]}),h=await this.queryRasters(d);return h?.features?.length&&h.features.forEach((t=>{p.forEach((r=>{r.attributes[l]===t.attributes[l]&&(r.geometry=new ye(t.geometry),null!=e.outSpatialReference&&(r.geometry.spatialReference=e.outSpatialReference))}))})),this._processVisibleRastersResponse(r,{returnDomainValues:i,templateRRFunctionNames:u,showNoDataRecords:n,templateFields:s})}catch{throw new a("imagery-layer:query-visible-rasters","encountered error when querying visible rasters")}}async fetchVariableStatisticsHistograms(e,t){const r=n(We(this.parsedUrl)+"/statistics",{query:this._getQueryParams({variable:e}),signal:t}).then((e=>e.data?.statistics)),i=n(We(this.parsedUrl)+"/histograms",{query:this._getQueryParams({variable:e}),signal:t}).then((e=>e.data?.histograms)),s=await Promise.all([r,i]);return s[0]&&s[0].forEach((e=>{e.avg=e.mean,e.stddev=e.standardDeviation})),{statistics:s[0]||null,histograms:s[1]||null}}async createFlowMesh(e,t){const r=this._rasterJobHandler.instance;return r?r.createFlowMesh(e,t):Le(e.meshType,e.simulationSettings,e.flowData,null!=t.signal?t.signal:(new AbortController).signal)}getMultidimensionalSubsetVariables(e){const t=e??this.serviceRasterInfo.multidimensionalInfo;return V(this.multidimensionalSubset,t)}async _fetchService(e){await this._fetchServiceInfo(e),this.rasterInfo||(this.rasterInfo=this.serviceRasterInfo);const t=this.sourceJSON,r=null!=this.serviceRasterInfo?Promise.resolve(this.serviceRasterInfo):xe(We(this.parsedUrl),t,{signal:e,query:this._getQueryParams()}).then((e=>(this._set("serviceRasterInfo",e),this._set("multidimensionalInfo",e.multidimensionalInfo),_e(e,t),e))),i=this._hasRasterFunction(this.rasterFunction)?this._generateRasterInfo(this.rasterFunction,{signal:e}):null,s=this._getRasterFunctionInfos();return Promise.all([r,i,s]).then((e=>{e[1]?this._set("rasterInfo",e[1]):this._set("rasterInfo",e[0]),e[2]&&this._set("rasterFunctionInfos",e[2]),this.renderer&&!this._isSupportedRenderer(this.renderer)&&(this._set("renderer",null),u.getLogger(this).warn("ArcGISImageService","Switching to the default renderer. Renderer applied is not valid for this Imagery Layer")),this._set("renderer",this._configRenderer(this.renderer)),this.addHandles([p((()=>this.rasterFunction),(e=>{(this.renderer||this.symbolizer||this.popupEnabled&&this.popupTemplate)&&this._generateRasterInfo(e).then((e=>{e&&(this.rasterInfo=e)}))}))]);const{serviceRasterInfo:t}=this;null!=t.multidimensionalInfo&&this._updateMultidimensionalDefinition(t)}))}_combineMosaicRuleWithTimeExtent(e,t){const r=this.timeInfo,{multidimensionalInfo:i}=this.serviceRasterInfo;if(null==e||null==i||null==t||null==r?.startField)return e;const{startField:s}=r,n=i.variables.some((e=>e.dimensions.some((e=>e.name===s))))?s:"StdTime";if(e=e.clone(),"mosaic-dataset"===this.sourceType)return e.multidimensionalDefinition=e.multidimensionalDefinition?.filter((e=>e.dimensionName!==n)),this._cleanupMultidimensionalDefinition(e);e.multidimensionalDefinition=e.multidimensionalDefinition||[];const o=e.multidimensionalDefinition.filter((e=>e.dimensionName===n)),a=null!=t.start?t.start.getTime():null,l=null!=t.end?t.end.getTime():null,u=null==a||null==l||a===l,p=u?[a||l]:[[a,l]],m=this.version>=10.8;if(o.length)o.forEach((e=>{e.dimensionName===n&&(m?(e.dimensionName=null,e.isSlice=!1,e.values=[]):(e.isSlice=u,e.values=p))}));else if(!m){const t=e.multidimensionalDefinition.filter((e=>null!=e.variableName&&null==e.dimensionName));t.length?t.forEach((e=>{e.dimensionName=n,e.isSlice=u,e.values=p})):e.multidimensionalDefinition.push(new S({variableName:"",dimensionName:n,isSlice:u,values:p}))}return this._cleanupMultidimensionalDefinition(e)}_cleanupMultidimensionalDefinition(e){return null==e?null:(e.multidimensionalDefinition&&(e.multidimensionalDefinition=e.multidimensionalDefinition.filter((e=>!(!e.variableName&&!e.dimensionName))),0===e.multidimensionalDefinition.length&&(e.multidimensionalDefinition=null)),"mosaic-dataset"!==this.sourceType&&null==e.multidimensionalDefinition?null:e)}async _prepareForQuery(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsQuery)throw new a("imagery-layer:query-rasters","query operation is not supported on the input image service");return e=null!=e?g(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 E;this._rasterJobHandler.connectionPromise=e.initialize().then((()=>{this._rasterJobHandler.instance=e}),(()=>{})),await this._rasterJobHandler.connectionPromise}_shutdownJobHandler(){this._rasterJobHandler.instance&&this._rasterJobHandler.instance.destroy(),this._rasterJobHandler.instance=null,this._rasterJobHandler.connectionPromise=null,this._rasterJobHandler.refCount=0,this._cachedRendererJson=null}_isSupportedRenderer(e){const{rasterInfo:t,rasterFunction:r}=this;return"unique-value"===e.type&&this._hasRasterFunction(r)&&1===t?.bandCount&&["u8","s8"].includes(t.pixelType)||null!=t&&null!=e&&L(t).includes(e.type)}async _fetchCapabilities(e){return this.capabilities||await this._fetchServiceInfo(e),this.capabilities}async _fetchServiceInfo(e){let t=this.sourceJSON;if(!t){const{data:r,ssl:i}=await n(We(this.parsedUrl),{query:this._getQueryParams(),signal:e});t=r,this.sourceJSON=t,i&&(this.url=this.url.replace(/^http:/i,"https:"))}if(t.capabilities?.toLowerCase().split(",").map((e=>e.trim())).indexOf("tilesonly")>-1)throw new a("imagery-layer:fetch-service-info","use ImageryTileLayer to open tiles-only image services");this.read(t,{origin:"service",url:this.parsedUrl})}_isMosaicDataset(e){return e.serviceSourceType?"esriImageServiceSourceTypeMosaicDataset"===e.serviceSourceType:e.fields?.length>0}_isMosaicRuleSupported(e){if(!e)return!1;const t=this._isMosaicDataset(e),r=e.currentVersion>=10.71&&e.hasMultidimensions&&!(e.fields?.length>1);return t||r}_isVectorFieldResampleFunction(e){if(null==e)return!1;const{functionName:t,functionArguments:r}=e,i="resample"===t?.toLowerCase(),s=r?.ResampleType||r?.resampleType;return i&&(7===s||10===s)}_isPicture(){return!this.format||this.format.includes("jpg")||this.format.includes("png")}_configRenderer(e){const t=this._isPicture(),{rasterInfo:r}=this;if(!t&&!this.pixelFilter||this._isVectorDataSet()){if(!this.bandIds&&r.bandCount>=3){const e=z(r);!e||3===r.bandCount&&0===e[0]&&1===e[1]&&2===e[2]||(this.bandIds=e)}e||(e=G(r,{bandIds:this.bandIds,variableName:this.rasterFunction?null:this.mosaicRule?.multidimensionalDefinition?.[0].variableName}));const t=k(e.toJSON());this.symbolizer?(this.symbolizer.rendererJSON=t,this.symbolizer.rasterInfo=r):this.symbolizer=new W({rendererJSON:t,rasterInfo:r}),this.symbolizer.bind().success||(this.symbolizer=null)}return e}_clonePixelData(e){return null==e?e:{extent:e.extent&&e.extent.clone(),pixelBlock:null!=e.pixelBlock?e.pixelBlock.clone():null}}_getQueryParams(e){null!=e?.renderingRule&&"string"!=typeof e.renderingRule&&(e.renderingRule=this._getRenderingRuleString(e.renderingRule));const{raster:t,viewId:r}=this;return{raster:t,viewId:r,f:"json",...e,...this.customParameters}}_getRequestOptions(e){return{...e,query:{...e?.query,...this.customParameters}}}_decodePixelBlock(e,t,r){return this._rasterJobHandler.instance?this._rasterJobHandler.instance.decode({data:e,options:t}):H(e,t,r)}async _getRasterFunctionInfos(e){const t=this.sourceJSON.rasterFunctionInfos;if(this.loaded)return t;if(t&&this.version>=10.3){if(1===t.length&&"none"===t[0].name.toLowerCase())return t;const r=await n(We(this.parsedUrl)+"/rasterFunctionInfos",{query:this._getQueryParams(),signal:e});return r.data?.rasterFunctionInfos}return null}_canRequestImageElement(e){return!this.pixelFilter&&(!e||e.includes("png"))}async _requestArrayBuffer(e){const{imageProps:t,requestAsImageElement:r,returnImageBitmap:i,signal:s}=e;if(r&&this._canRequestImageElement(t.format)){const r=`${We(this.parsedUrl)}/exportImage`,{data:o}=await n(r,{responseType:i?"blob":"image",query:this._getQueryParams({f:"image",...this.refreshParameters,...e.imageServiceParameters}),signal:s});if(o instanceof Blob){return{imageBitmap:await D(o,r,s),params:t}}return{imageOrCanvasElement:o,params:t}}const o=this._initJobHandler(),l=n(We(this.parsedUrl)+"/exportImage",{responseType:"array-buffer",query:this._getQueryParams({f:"image",...e.imageServiceParameters}),signal:s}),u=(await Promise.all([l,o]))[0].data,p=t.format||"jpgpng";let m=p;if("bsq"!==m&&"bip"!==m&&(m=U(u)),!m)throw new a("imagery-layer:fetch-image","unsupported format signature "+String.fromCharCode.apply(null,new Uint8Array(u)));const c={signal:s},d="gif"===p||"bmp"===p||p.includes("png")&&("png"===m||"jpg"===m)?H(u,{useCanvas:!0,...t},c):this._decodePixelBlock(u,{width:t.width,height:t.height,planes:null,pixelType:null,noDataValue:null,format:p},c);return{pixelData:{pixelBlock:await d,extent:t.extent},params:t}}_generateRasterInfo(e,t){return this.generateRasterInfo(e,t).catch((()=>null))}_isValidCustomizedMosaicRule(e){return e&&JSON.stringify(e.toJSON())!==JSON.stringify(this.defaultMosaicRule?.toJSON())}_updateMultidimensionalDefinition(e){if(this._isValidCustomizedMosaicRule(this.mosaicRule))return;let t=Q(e,{multidimensionalSubset:this.multidimensionalSubset});if(null!=t&&t.length>0){this.mosaicRule=this.mosaicRule||new P;const e=this.mosaicRule.multidimensionalDefinition;!this.sourceJSON.defaultVariableName&&this.rasterFunction&&"none"!==this.rasterFunction.functionName?.toLowerCase()&&t.forEach((e=>e.variableName="")),t=t.filter((({variableName:e,dimensionName:t})=>e&&"*"!==e||t)),!e?.length&&t.length&&(this.mosaicRule.multidimensionalDefinition=t)}}_processVisibleRastersResponse(e,r){r=r||{};const i=e.value,{templateRRFunctionNames:s,showNoDataRecords:n,returnDomainValues:o,templateFields:a}=r,l=e.processedValues;let u=e.catalogItems?.features,p=e.properties?.Values?.map((e=>e.replaceAll(/ /gi,", ")))||[];const m=this.objectIdField||"ObjectId",c="string"==typeof i&&i.toLowerCase().includes("nodata"),d=[];if(i&&!u&&!c){const e={};e[m]=0;p=[i],u=[new t(this.fullExtent,null,e)]}if(!u)return[];let h,g,f;this._updateResponseFieldNames(u,a),c&&!n&&(u=[]);for(let t=0;t<u.length;t++){if(h=u[t],null!=i){if(g=p[t],f=this.rasterFunction&&l&&l.length>0&&s&&s.length>0&&s.includes(this.rasterFunction.functionName)?l[s.indexOf(this.rasterFunction.functionName)]:i,"nodata"===g.toLowerCase()&&!n)continue;const e="Raster.ItemPixelValue",r="Raster.ServicePixelValue";h.attributes[e]=g,h.attributes[r]=f,this._updateFeatureWithMagDirValues(h,g);const o=this.fields&&this.fields.length>0;let a=this.rasterFunction&&null!=this.serviceRasterInfo.attributeTable?o?g:i:f;this.rasterFunction||(a=o?g:i),this._updateFeatureWithRasterAttributeTableValues(h,a)}if(h.sourceLayer=h.layer=this,o&&this._updateFeatureWithDomainValues(h),s&&l&&s.length===l.length)for(let e=0;e<s.length;e++){const t="Raster.ServicePixelValue."+s[e];h.attributes[t]=l[e]}d.push(u[t])}return d}_processMultidimensionalIntersection(e,t,r){const{multidimensionalSubset:i}=this;if(!i)return{isOutSide:!1,timeExtent:t,mosaicRule:r=this._combineMosaicRuleWithTimeExtent(r,t)};if(i){const{isOutside:r,intersection:s}=J(i,{geometry:e,timeExtent:t});if(r)return{isOutSide:!0,timeExtent:null,mosaicRule:null};null!=s?.timeExtent&&(t=s.timeExtent)}if(r=this._combineMosaicRuleWithTimeExtent(r,t),r?.multidimensionalDefinition){const{isOutside:e}=J(i,{multidimensionalDefinition:r.multidimensionalDefinition});if(e)return{isOutSide:!0,timeExtent:null,mosaicRule:null}}return{isOutSide:!1,timeExtent:t,mosaicRule:r}}_updateFeatureWithRasterAttributeTableValues(e,t){const r=this.rasterInfo.attributeTable||this.serviceRasterInfo.attributeTable;if(null==r)return;const{features:i,fields:s}=r,n=s.map((e=>e.name)).find((e=>"value"===e.toLowerCase()));if(!n)return;const o=i.filter((e=>e.attributes[n]===(null!=t?parseInt(t,10):null)));o&&o[0]&&s.forEach((t=>{const r=this._rasterAttributeTableFieldPrefix+t.name;e.attributes[r]=o[0].attributes[t.name]}))}_updateFeatureWithMagDirValues(e,t){if(!this._isVectorDataSet())return;const r=t.split(/,\s*/).map((e=>parseFloat(e))),i=r.map((e=>[e])),s=r.map((e=>({minValue:e,maxValue:e,noDataValue:null}))),n=new O({height:1,width:1,pixelType:"f32",pixels:i,statistics:s});null!=this.pixelFilter&&this.pixelFilter({pixelBlock:n,extent:new fe(0,0,0,0,this.spatialReference)});const o="esriImageServiceDataTypeVector-MagDir"===this.serviceDataType?[n.pixels[0][0],n.pixels[1][0]]:B([n.pixels[0][0],n.pixels[1][0]]);e.attributes["Raster.Magnitude"]=o[0],e.attributes["Raster.Direction"]=o[1]}_updateFeatureWithDomainValues(e){const t=this.fields&&this.fields.filter((e=>e.domain&&"coded-value"===e.domain.type));null!=t&&t.forEach((t=>{const r=e.attributes[t.name];if(null!=r){const i=t.domain.codedValues.find((e=>e.code===r));i&&(e.attributes[t.name]=i.name)}}))}_updateResponseFieldNames(e,t){if(!t||t.length<1)return;const r=this.fieldsIndex;null!=r&&e.forEach((e=>{if(e?.attributes)for(const i of t){const t=r.get(i)?.name;t&&t!==i&&(e.attributes[i]=e.attributes[t],delete e.attributes[t])}}))}_getRenderingRuleString(e){if(e){let t=e.toJSON();return t=t.rasterFunctionDefinition??t,(t.thumbnail||t.thumbnailEx)&&(t.thumbnail=t.thumbnailEx=null),JSON.stringify(t)}return null}_hasRasterFunction(e){return null!=e?.functionName&&"none"!==e.functionName.toLowerCase()}_updateRenderingRulesFunctionName(e,t){if(!e||e.length<1)return;if("Raw"===e)return e.replace("Raw","None");const r=e.toLowerCase().replaceAll(/ /gi,"_");return t.has(r)?t.get(r):e}_isRFTJson(e){return e?.name&&e.arguments&&e.function&&e.hasOwnProperty("functionType")}_isVectorDataSet(){return"esriImageServiceDataTypeVector-UV"===this.serviceDataType||"esriImageServiceDataTypeVector-MagDir"===this.serviceDataType}_applyMosaicAndRenderingRules(e){const{raster:t,mosaicRule:r,rasterFunction:i}=this;i&&e instanceof Ne&&null==e.rasterFunction&&(e.rasterFunction=i),r&&null==e.mosaicRule&&(e.mosaicRule=r),t&&null==e.raster&&(e.raster=t)}_readCapabilities(e){const t=e.capabilities?e.capabilities.toLowerCase().split(",").map((e=>e.trim())):["image","catalog"],{currentVersion:r,advancedQueryCapabilities:i,maxRecordCount:s}=e,n=t.includes("image"),o="esriImageServiceDataTypeElevation"===e.serviceDataType,a=!(!e.spatialReference&&!e.extent?.spatialReference),l=t.includes("edit"),u=t.includes("mensuration")&&a,p=null==e.mensurationCapabilities?[]:e.mensurationCapabilities.toLowerCase().split(",").map((e=>e.trim())),m=u&&p.includes("basic"),c=this._isMosaicDataset(e)&&t.includes("catalog"),d=t.includes("download");return{data:{supportsAttachment:!1},operations:{supportsComputeHistograms:n,supportsExportImage:n,supportsIdentify:n,supportsImageToMap:r>=11.2&&c,supportsImageToMapMultiray:r>=11.2&&c,supportsMapToImage:r>=11.2&&c,supportsFindImages:r>=11.2&&c,supportsGetImageUrl:r>=11.2&&d,supportsMeasure:u,supportsMeasureFromImage:r>=11.2,supportsDownload:d,supportsQuery:c&&e.fields&&e.fields.length>0,supportsGetSamples:r>=10.2&&n,supportsProject:r>=10.3&&n,supportsComputeStatisticsHistograms:r>=10.4&&n,supportsQueryBoundary:r>=10.6&&n,supportsCalculateVolume:r>=10.7&&o,supportsComputePixelLocation:r>=10.7&&c,supportsComputeAngles:r>=10.91,supportsQueryGPSInfo:r>=11.2&&c,supportsAdd:l,supportsDelete:l,supportsEditing:l,supportsUpdate:l,supportsCalculate:!1,supportsTruncate:!1,supportsValidateSql:!1,supportsChangeTracking:!1,supportsQueryAttachments:!1,supportsResizeAttachments:!1,supportsSync:!1,supportsExceedsLimitStatistics:!1,supportsQueryAnalytics:!1,supportsQueryTopFeatures:!1,supportsAsyncConvert3D:!1},query:{maxRecordCount:s,maxRecordCountFactor:void 0,supportsStatistics:!!i?.supportsStatistics,supportsOrderBy:!!i?.supportsOrderBy,supportsDistinct:!!i?.supportsDistinct,supportsPagination:!!i?.supportsPagination,supportsStandardizedQueriesOnly:!!i?.useStandardizedQueries,supportsPercentileStatistics:!!i?.supportsPercentileStatistics,supportsCentroid:!!i?.supportsReturningGeometryCentroid,supportsDistance:!!i?.supportsQueryWithDistance,supportsExtent:!!i?.supportsReturningQueryExtent,supportsGeometryProperties:!!i?.supportsReturningGeometryProperties,supportsHavingClause:!!i?.supportsHavingClause,supportsQuantization:!1,supportsQuantizationEditMode:!1,supportsQueryGeometry:!1,supportsResultType:!1,supportsMaxRecordCountFactor:!1,supportsSqlExpression:!1,supportsTopFeaturesQuery:!1,supportsQueryByAnonymous:!1,supportsQueryByOthers:!1,supportsHistoricMoment:!1,supportsFormatPBF:!1,supportsDisjointSpatialRelationship:!1,supportsCacheHint:!1,supportsSpatialAggregationStatistics:!1,supportedSpatialAggregationStatistics:{envelope:!1,centroid:!1,convexHull:!1},supportsDefaultSpatialReference:!!i?.supportsDefaultSR,supportsFullTextSearch:!1,supportsCompactGeometry:!1,standardMaxRecordCount:void 0,tileMaxRecordCount:void 0},mensuration:{supportsDistanceAndAngle:m,supportsAreaAndPerimeter:m,supportsPointOrCentroid:m,supportsHeightFromBaseAndTop:u&&p.includes("base-top height"),supportsHeightFromBaseAndTopShadow:u&&p.includes("base-top shadow height"),supportsHeightFromTopAndTopShadow:u&&p.includes("top-top shadow height"),supports3D:u&&p.includes("3d")}}}};function We(e){return e?.path??""}return e([c({clonable:!1})],f.prototype,"_functionRasterInfos",void 0),e([c({clonable:!1})],f.prototype,"_rasterJobHandler",void 0),e([c({clonable:!1})],f.prototype,"_cachedRendererJson",void 0),e([c({readOnly:!0})],f.prototype,"_serviceSupportsMosaicRule",void 0),e([y("_serviceSupportsMosaicRule",["currentVersion","fields"])],f.prototype,"readServiceSupportsMosaicRule",null),e([c({readOnly:!0})],f.prototype,"_rasterAttributeTableFieldPrefix",void 0),e([c({readOnly:!0})],f.prototype,"_rasterFunctionNamesIndex",null),e([c()],f.prototype,"adjustAspectRatio",void 0),e([c({type:[h],json:{write:!0}})],f.prototype,"bandIds",void 0),e([y("bandIds")],f.prototype,"readBandIds",null),e([c({readOnly:!0,json:{read:!1}})],f.prototype,"capabilities",void 0),e([y("service","capabilities",["capabilities","currentVersion","serviceDataType"])],f.prototype,"readCapabilities",null),e([c({type:Number})],f.prototype,"compressionQuality",void 0),e([b("compressionQuality")],f.prototype,"writeCompressionQuality",null),e([c({type:Number})],f.prototype,"compressionTolerance",void 0),e([b("compressionTolerance")],f.prototype,"writeCompressionTolerance",null),e([c({json:{read:{source:"copyrightText"}}})],f.prototype,"copyright",void 0),e([c({readOnly:!0,dependsOn:["_serviceSupportsMosaicRule"]})],f.prototype,"defaultMosaicRule",void 0),e([y("defaultMosaicRule",["defaultMosaicMethod"])],f.prototype,"readDefaultMosaicRule",null),e([c({type:String,json:{name:"layerDefinition.definitionExpression",write:{enabled:!0,allowNull:!0}}})],f.prototype,"definitionExpression",void 0),e([c({readOnly:!0,constructOnly:!0})],f.prototype,"exportImageServiceParameters",void 0),e([c()],f.prototype,"rasterInfo",void 0),e([c({readOnly:!0,type:[_]})],f.prototype,"fields",void 0),e([c({readOnly:!0})],f.prototype,"fieldsIndex",null),e([c({type:["png","png8","png24","png32","jpg","bmp","gif","jpgpng","lerc","tiff"],json:{write:!0}})],f.prototype,"format",null),e([y("service","format",["serviceDataType"])],f.prototype,"readFormat",null),e([c({type:fe})],f.prototype,"fullExtent",void 0),e([c({readOnly:!0})],f.prototype,"hasMultidimensions",void 0),e([c({json:{read:{source:"maxImageHeight"}}})],f.prototype,"imageMaxHeight",void 0),e([c({json:{read:{source:"maxImageWidth"}}})],f.prototype,"imageMaxWidth",void 0),e([c({type:String,json:{type:M.jsonValues,read:M.read,write:M.write}})],f.prototype,"interpolation",void 0),e([c()],f.prototype,"minScale",void 0),e([y("service","minScale")],f.prototype,"readMinScale",null),e([c()],f.prototype,"maxScale",void 0),e([y("service","maxScale")],f.prototype,"readMaxScale",null),e([c({type:P})],f.prototype,"mosaicRule",null),e([y("mosaicRule",["mosaicRule","defaultMosaicMethod"])],f.prototype,"readMosaicRule",null),e([b("mosaicRule")],f.prototype,"writeMosaicRule",null),e([c()],f.prototype,"multidimensionalInfo",void 0),e([c({type:j,json:{write:!0}})],f.prototype,"multidimensionalSubset",void 0),e([c({json:{type:h}})],f.prototype,"noData",void 0),e([b("noData")],f.prototype,"writeNoData",null),e([c({type:String,json:{type:C.jsonValues,read:C.read,write:C.write}})],f.prototype,"noDataInterpretation",void 0),e([c({type:String,readOnly:!0,json:{read:{source:["fields"]}}})],f.prototype,"objectIdField",void 0),e([y("objectIdField")],f.prototype,"readObjectIdField",null),e([c({readOnly:!0})],f.prototype,"geometryType",void 0),e([c({})],f.prototype,"typeIdField",void 0),e([c({})],f.prototype,"types",void 0),e([c({readOnly:!0})],f.prototype,"parsedUrl",null),e([c({type:Function})],f.prototype,"pixelFilter",void 0),e([c()],f.prototype,"raster",void 0),e([c({readOnly:!0})],f.prototype,"sourceType",void 0),e([y("sourceType",["serviceSourceType","fields"])],f.prototype,"readSourceType",null),e([c()],f.prototype,"viewId",void 0),e([c({types:r,json:{name:"layerDefinition.drawingInfo.renderer",origins:{"web-scene":{types:i,name:"layerDefinition.drawingInfo.renderer",write:{overridePolicy:e=>({enabled:e&&"vector-field"!==e.type&&"flow"!==e.type})}}}}})],f.prototype,"renderer",null),e([y("renderer")],f.prototype,"readRenderer",null),e([b("renderer")],f.prototype,"writeRenderer",null),e([c({clonable:!1})],f.prototype,"symbolizer",void 0),e([c(w)],f.prototype,"opacity",void 0),e([c({readOnly:!0})],f.prototype,"rasterFields",null),e([c({constructOnly:!0})],f.prototype,"rasterFunctionInfos",void 0),e([c({type:q})],f.prototype,"renderingRule",null),e([c({type:q,json:{name:"renderingRule"}})],f.prototype,"rasterFunction",null),e([y("rasterFunction",["renderingRule","rasterFunctionInfos"])],f.prototype,"readRasterFunction",null),e([c({readOnly:!0})],f.prototype,"serviceDataType",void 0),e([c({readOnly:!0,type:Re})],f.prototype,"spatialReference",void 0),e([y("spatialReference",["spatialReference","extent"])],f.prototype,"readSpatialReference",null),e([c({json:{type:N.jsonValues}})],f.prototype,"pixelType",void 0),e([y("pixelType")],f.prototype,"readPixelType",null),e([b("pixelType")],f.prototype,"writePixelType",null),e([c({constructOnly:!0,type:A})],f.prototype,"serviceRasterInfo",void 0),e([c()],f.prototype,"sourceJSON",void 0),e([c(v)],f.prototype,"url",void 0),e([c({readOnly:!0})],f.prototype,"version",void 0),e([y("version",["currentVersion","fields","timeInfo"])],f.prototype,"readVersion",null),f=e([R("esri.layers.mixins.ArcGISImageService")],f),f};export{We as ArcGISImageService};
|
package/package.json
CHANGED
package/portal/Portal.js
CHANGED
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.30/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../chunks/tslib.es6.js";import t from"../config.js";import{id as r}from"../kernel.js";import o from"../request.js";import s from"../core/Error.js";import{JSONSupportMixin as i}from"../core/JSONSupport.js";import a from"../core/Loadable.js";import{destroyMaybe as l,removeMaybe as u}from"../core/maybe.js";import{throwIfAborted as n,isAborted as p,createAbortError as d,throwIfAbortError as h}from"../core/promiseUtils.js";import{property as y}from"../core/accessorSupport/decorators/property.js";import{ensureType as c}from"../core/accessorSupport/ensureType.js";import"../core/RandomLCG.js";import"../core/has.js";import{reader as m}from"../core/accessorSupport/decorators/reader.js";import{subclass as f}from"../core/accessorSupport/decorators/subclass.js";import v from"../geometry/Extent.js";import{getLocale as S}from"../intl/locale.js";import{ensureDefaultPortalInstance as P}from"./portalDefault.js";import g from"./PortalGroup.js";import O from"./PortalQueryParams.js";import G from"./PortalQueryResult.js";import B from"./PortalUser.js";import{supportsApiKey as D}from"../support/apiKeyUtils.js";var _;let M;const U={PortalGroup:()=>Promise.resolve({default:g}),PortalItem:()=>import("./PortalItem.js"),PortalUser:()=>Promise.resolve({default:B})};let C=_=class extends(i(a)){constructor(e){super(e),this._esriIdCredentialCreateHandle=null,this.access=null,this.allSSL=!1,this.authMode="auto",this.authorizedCrossOriginDomains=null,this.basemapGalleryGroupQuery=null,this.basemapGalleryGroupQuery3D=null,this.bingKey=null,this.canListApps=!1,this.canListData=!1,this.canListPreProvisionedItems=!1,this.canProvisionDirectPurchase=!1,this.canSearchPublic=!0,this.canShareBingPublic=!1,this.canSharePublic=!1,this.canSignInArcGIS=!1,this.canSignInIDP=!1,this.colorSetsGroupQuery=null,this.commentsEnabled=!1,this.created=null,this.culture=null,this.customBaseUrl=null,this.defaultBasemap=null,this.defaultDevBasemap=null,this.defaultExtent=null,this.defaultVectorBasemap=null,this.description=null,this.devBasemapGalleryGroupQuery=null,this.eueiEnabled=null,this.featuredGroups=null,this.featuredItemsGroupQuery=null,this.galleryTemplatesGroupQuery=null,this.layoutGroupQuery=null,this.livingAtlasGroupQuery=null,this.hasCategorySchema=!1,this.helperServices=null,this.homePageFeaturedContent=null,this.homePageFeaturedContentCount=null,this.httpPort=null,this.httpsPort=null,this.id=null,this.ipCntryCode=null,this.isPortal=!1,this.isReadOnly=!1,this.layerTemplatesGroupQuery=null,this.maxTokenExpirationMinutes=null,this.modified=null,this.name=null,this.portalHostname=null,this.portalMode=null,this.portalProperties=null,this.region=null,this.rotatorPanels=null,this.showHomePageDescription=!1,this.sourceJSON=null,this.supportsHostedServices=!1,this.symbolSetsGroupQuery=null,this.templatesGroupQuery=null,this.units=null,this.url=t.portalUrl,this.urlKey=null,this.user=null,this.use3dBasemaps=!0,this.useStandardizedQuery=!1,this.useVectorBasemaps=!1,this.vectorBasemapGalleryGroupQuery=null}normalizeCtorArgs(e){return"string"==typeof e?{url:e}:e}destroy(){b.unregister(this),this.defaultBasemap=l(this.defaultBasemap),this.defaultDevBasemap=l(this.defaultDevBasemap),this.defaultVectorBasemap=l(this.defaultVectorBasemap),this._esriIdCredentialCreateHandle=u(this._esriIdCredentialCreateHandle)}readAuthorizedCrossOriginDomains(e){if(e)for(const r of e)t.request.trustedServers.includes(r)||t.request.trustedServers.push(r);return e}readDefaultBasemap(e){return this._readBasemap(e)}readDefaultDevBasemap(e){return this._readBasemap(e)}readDefaultVectorBasemap(e){return this._readBasemap(e)}get extraQuery(){const e=this.user?.orgId,t=!e||this.canSearchPublic;return this.id&&!t?` AND orgid:${this.id}`:null}get isOrganization(){return!!this.access}get itemPageUrl(){return this.url?`${this.url}/home/item.html`:null}get restUrl(){let e=this.url;if(e){const t=e.indexOf("/sharing");e=t>0?e.substring(0,t):this.url.replace(/\/+$/,""),e+="/sharing/rest"}return e}get thumbnailUrl(){const e=this.restUrl,t=this.thumbnail;return e&&t?this._normalizeSSL(e+"/portals/self/resources/"+t):null}readUrlKey(e){return e?e.toLowerCase():e}readUser(e){let t=null;return e&&(t=B.fromJSON(e),t.portal=this),t}load(e){const t=import("../Basemap.js").then((({default:t})=>{n(e),M=t})).then((()=>this.sourceJSON?this.sourceJSON:this.fetchSelf(this.authMode,!1,e))).then((e=>{if(r){const e=r;this.credential=e.findCredential(this.restUrl),this.credential||this.authMode!==_.AUTH_MODE_AUTO&&this.authMode!==_.AUTH_MODE_NO_PROMPT||(this._esriIdCredentialCreateHandle?.remove(),this._esriIdCredentialCreateHandle=e.on("credential-create",w(new WeakRef(this))),b.register(this,this._esriIdCredentialCreateHandle,this))}this.sourceJSON=e,this.read(e)}));return this.addResolvingPromise(t),Promise.resolve(this)}async createElevationLayers(){await this.load();const e=this._getHelperService("defaultElevationLayers"),t=(await import("../layers/ElevationLayer.js")).default;return e?e.map((e=>new t({id:e.id,url:e.url}))):[]}async fetchBasemaps(e,t){const r=await this._fetchBasemaps(e,t);if(!0===t?.include3d&&!1!==this.use3dBasemaps){const o=await this._fetchBasemaps3D(e,t);r.unshift(...o)}return r}fetchCategorySchema(e){return this.hasCategorySchema?this.request(this.restUrl+"/portals/self/categorySchema",e).then((e=>e.categorySchema)):p(e)?Promise.reject(d()):Promise.resolve([])}fetchFeaturedGroups(e){const t=this.featuredGroups,r=new O;if(r.num=100,r.sortField="title",t&&t.length){const o=[];for(const e of t)o.push(`(title:"${e.title}" AND owner:${e.owner})`);return r.query=o.join(" OR "),this.queryGroups(r,e).then((e=>e.results))}return p(e)?Promise.reject(d()):Promise.resolve([])}fetchRegions(e){const t=this.user?.culture||this.culture||S();return this.request(this.restUrl+"/portals/regions",{...e,query:{culture:t}})}fetchSettings(e){const t=this.user?.culture||this.culture||S();return this.request(this.restUrl+"/portals/self/settings",{...e,query:{culture:t}})}static getDefault(){return P((()=>new _))}queryGroups(e,t){return this.queryPortal("/community/groups",e,"PortalGroup",t)}queryItems(e,t){return this.queryPortal("/search",e,"PortalItem",t)}queryUsers(e,t){return e.sortField||(e.sortField="username"),this.queryPortal("/community/users",e,"PortalUser",t)}fetchSelf(e=this.authMode,t=!1,r){const o=this.restUrl+"/portals/self",s={authMode:e,query:{culture:S().toLowerCase()},withCredentials:!0,...r};return"auto"===s.authMode&&(s.authMode="no-prompt"),t&&(s.query.default=!0),this.request(o,s)}queryPortal(e,t,r,o){const s=c(O,t),i=t=>this.request(this.restUrl+e,{...s.toRequestOptions(this),...o}).then((e=>{const r=s.clone();return r.start=e.nextStart,new G({nextQueryParams:r,queryParams:s,total:e.total,results:_._resultsToTypedArray(t,{portal:this},e,o)})})).then((e=>Promise.all(e.results.map((t=>"function"==typeof t.when?t.when():e))).then((()=>e),(t=>(h(t),e)))));return r&&U[r]?U[r]().then((({default:e})=>(n(o),i(e)))):i()}signIn(){if(this.authMode===_.AUTH_MODE_ANONYMOUS||this.authMode===_.AUTH_MODE_NO_PROMPT&&!r)return Promise.reject(new s("portal:invalid-auth-mode",`Current "authMode"' is "${this.authMode}"`));if("failed"===this.loadStatus)return Promise.reject(this.loadError);const e=e=>Promise.resolve().then((()=>"not-loaded"===this.loadStatus?(e||(this.authMode="immediate"),this.load().then((()=>null))):"loading"===this.loadStatus?this.load().then((()=>this.credential?null:(this.credential=e,this.fetchSelf("immediate")))):this.user&&this.credential===e?null:(this.credential=e,this.fetchSelf("immediate")))).then((e=>{e&&(this.sourceJSON=e,this.read(e))}));return r?r.getCredential(this.restUrl,{prompt:this.authMode!==_.AUTH_MODE_NO_PROMPT}).then((t=>e(t))):e(this.credential)}normalizeUrl(e){const t=this.credential?.token;return this._normalizeSSL(t?e+(e.includes("?")?"&":"?")+"token="+t:e)}requestToTypedArray(e,t,r){return this.request(e,t).then((e=>{const t=_._resultsToTypedArray(r,{portal:this},e);return Promise.all(t.map((t=>"function"==typeof t.when?t.when():e))).then((()=>t),(()=>t))}))}request(e,t={}){const r={f:"json",...t.query},{authMode:s=(this.authMode===_.AUTH_MODE_ANONYMOUS||this.authMode===_.AUTH_MODE_NO_PROMPT?this.authMode:"auto"),body:i=null,cacheBust:a=!1,method:l="auto",responseType:u="json",signal:n}=t,p={authMode:s,body:i,cacheBust:a,method:l,query:r,responseType:u,timeout:0,signal:n};return t.withCredentials&&(p.withCredentials=!0),o(this._normalizeSSL(e),p).then((e=>e.data))}toJSON(){throw new s("internal:not-yet-implemented","Portal.toJSON is not yet implemented")}static fromJSON(e){if(!e)return null;if(e.declaredClass)throw new Error("JSON object is already hydrated");return new _({sourceJSON:e})}_getHelperService(e){const t=this.helperServices&&this.helperServices[e];if(!t)throw new s("portal:service-not-found",`The \`helperServices\` do not include an entry named "${e}"`);return t}async _fetchBasemaps(e,r){const o=new O;o.query=e||(t.apiKey&&D(this.url)?this.devBasemapGalleryGroupQuery:this.useVectorBasemaps?this.vectorBasemapGalleryGroupQuery:this.basemapGalleryGroupQuery),o.disableExtraQuery=!0;const s=await this.queryGroups(o,r);if(!s.total)return[];const i=s.results[0];o.num=100,o.query='type:"Web Map" -type:"Web Application"',o.sortField=i.sortField||"name",o.sortOrder=i.sortOrder||"desc";const a=await i.queryItems(o,r);if(!a.total)return[];return a.results.filter((e=>"Web Map"===e.type)).map((e=>new M({portalItem:e})))}async _fetchBasemaps3D(e,t){const r=e||this.basemapGalleryGroupQuery3D;if(!r)return[];const o=new O({query:r,disableExtraQuery:!0}),s=await this.queryGroups(o,t);if(!s.total)return[];const i=s.results[0];o.num=100,o.query='type:"Web Scene"',o.sortField=i.sortField||"name",o.sortOrder=i.sortOrder||"desc";const a=await i.queryItems(o,t);if(!a.total)return[];return a.results.filter((e=>"Web Scene"===e.type)).map((e=>new M({portalItem:e})))}_normalizeSSL(e){return e.replace(/^http:/i,"https:").replace(":7080",":7443")}_readBasemap(e){if(e){const t=M.fromJSON(e);return t.portalItem={portal:this},t}return null}static _resultsToTypedArray(e,t,r,o){let s=[];if(r){const i=null!=o?o.signal:null;s=r.listings||r.notifications||r.userInvitations||r.tags||r.items||r.groups||r.comments||r.provisions||r.results||r.relatedItems||r,(e||t)&&(s=s.map((r=>{const o=Object.assign(e?e.fromJSON(r):r,t);return"function"==typeof o.load&&o.load(i),o})))}else s=[];return s}};C.AUTH_MODE_ANONYMOUS="anonymous",C.AUTH_MODE_AUTO="auto",C.AUTH_MODE_IMMEDIATE="immediate",C.AUTH_MODE_NO_PROMPT="no-prompt",e([y()],C.prototype,"access",void 0),e([y()],C.prototype,"allSSL",void 0),e([y()],C.prototype,"authMode",void 0),e([y()],C.prototype,"authorizedCrossOriginDomains",void 0),e([m("authorizedCrossOriginDomains")],C.prototype,"readAuthorizedCrossOriginDomains",null),e([y()],C.prototype,"basemapGalleryGroupQuery",void 0),e([y({json:{name:"3DBasemapGalleryGroupQuery"}})],C.prototype,"basemapGalleryGroupQuery3D",void 0),e([y()],C.prototype,"bingKey",void 0),e([y()],C.prototype,"canListApps",void 0),e([y()],C.prototype,"canListData",void 0),e([y()],C.prototype,"canListPreProvisionedItems",void 0),e([y()],C.prototype,"canProvisionDirectPurchase",void 0),e([y()],C.prototype,"canSearchPublic",void 0),e([y()],C.prototype,"canShareBingPublic",void 0),e([y()],C.prototype,"canSharePublic",void 0),e([y()],C.prototype,"canSignInArcGIS",void 0),e([y()],C.prototype,"canSignInIDP",void 0),e([y()],C.prototype,"colorSetsGroupQuery",void 0),e([y()],C.prototype,"commentsEnabled",void 0),e([y({type:Date})],C.prototype,"created",void 0),e([y()],C.prototype,"credential",void 0),e([y()],C.prototype,"culture",void 0),e([y()],C.prototype,"currentVersion",void 0),e([y()],C.prototype,"customBaseUrl",void 0),e([y()],C.prototype,"defaultBasemap",void 0),e([m("defaultBasemap")],C.prototype,"readDefaultBasemap",null),e([y()],C.prototype,"defaultDevBasemap",void 0),e([m("defaultDevBasemap")],C.prototype,"readDefaultDevBasemap",null),e([y({type:v})],C.prototype,"defaultExtent",void 0),e([y()],C.prototype,"defaultVectorBasemap",void 0),e([m("defaultVectorBasemap")],C.prototype,"readDefaultVectorBasemap",null),e([y()],C.prototype,"description",void 0),e([y()],C.prototype,"devBasemapGalleryGroupQuery",void 0),e([y()],C.prototype,"eueiEnabled",void 0),e([y({readOnly:!0})],C.prototype,"extraQuery",null),e([y()],C.prototype,"featuredGroups",void 0),e([y()],C.prototype,"featuredItemsGroupQuery",void 0),e([y()],C.prototype,"galleryTemplatesGroupQuery",void 0),e([y()],C.prototype,"layoutGroupQuery",void 0),e([y()],C.prototype,"livingAtlasGroupQuery",void 0),e([y()],C.prototype,"hasCategorySchema",void 0),e([y()],C.prototype,"helpBase",void 0),e([y()],C.prototype,"helperServices",void 0),e([y()],C.prototype,"helpMap",void 0),e([y()],C.prototype,"homePageFeaturedContent",void 0),e([y()],C.prototype,"homePageFeaturedContentCount",void 0),e([y()],C.prototype,"httpPort",void 0),e([y()],C.prototype,"httpsPort",void 0),e([y()],C.prototype,"id",void 0),e([y()],C.prototype,"ipCntryCode",void 0),e([y({readOnly:!0})],C.prototype,"isOrganization",null),e([y()],C.prototype,"isPortal",void 0),e([y()],C.prototype,"isReadOnly",void 0),e([y({readOnly:!0})],C.prototype,"itemPageUrl",null),e([y()],C.prototype,"layerTemplatesGroupQuery",void 0),e([y()],C.prototype,"maxTokenExpirationMinutes",void 0),e([y({type:Date})],C.prototype,"modified",void 0),e([y()],C.prototype,"name",void 0),e([y()],C.prototype,"portalHostname",void 0),e([y()],C.prototype,"portalMode",void 0),e([y()],C.prototype,"portalProperties",void 0),e([y()],C.prototype,"region",void 0),e([y({readOnly:!0})],C.prototype,"restUrl",null),e([y()],C.prototype,"rotatorPanels",void 0),e([y()],C.prototype,"showHomePageDescription",void 0),e([y()],C.prototype,"sourceJSON",void 0),e([y()],C.prototype,"staticImagesUrl",void 0),e([y({json:{name:"2DStylesGroupQuery"}})],C.prototype,"stylesGroupQuery2d",void 0),e([y({json:{name:"stylesGroupQuery"}})],C.prototype,"stylesGroupQuery3d",void 0),e([y()],C.prototype,"supportsHostedServices",void 0),e([y()],C.prototype,"symbolSetsGroupQuery",void 0),e([y()],C.prototype,"templatesGroupQuery",void 0),e([y()],C.prototype,"thumbnail",void 0),e([y({readOnly:!0})],C.prototype,"thumbnailUrl",null),e([y()],C.prototype,"units",void 0),e([y()],C.prototype,"url",void 0),e([y()],C.prototype,"urlKey",void 0),e([m("urlKey")],C.prototype,"readUrlKey",null),e([y()],C.prototype,"user",void 0),e([m("user")],C.prototype,"readUser",null),e([y()],C.prototype,"use3dBasemaps",void 0),e([y()],C.prototype,"useStandardizedQuery",void 0),e([y()],C.prototype,"useVectorBasemaps",void 0),e([y()],C.prototype,"vectorBasemapGalleryGroupQuery",void 0),C=_=e([f("esri.portal.Portal")],C);const Q=C,b=new FinalizationRegistry((e=>{e.remove()}));function w(e){const t=r;return()=>{const r=e.deref();r&&t.findCredential(r.restUrl)&&r.signIn().catch((()=>{}))}}export{Q as default};
|
|
5
|
+
import{_ as e}from"../chunks/tslib.es6.js";import t from"../config.js";import{id as r}from"../kernel.js";import o from"../request.js";import s from"../core/Error.js";import{JSONSupportMixin as i}from"../core/JSONSupport.js";import a from"../core/Loadable.js";import{destroyMaybe as l,removeMaybe as u}from"../core/maybe.js";import{throwIfAborted as n,isAborted as p,createAbortError as d,throwIfAbortError as h}from"../core/promiseUtils.js";import{property as y}from"../core/accessorSupport/decorators/property.js";import{ensureType as c}from"../core/accessorSupport/ensureType.js";import"../core/RandomLCG.js";import"../core/has.js";import{reader as m}from"../core/accessorSupport/decorators/reader.js";import{subclass as f}from"../core/accessorSupport/decorators/subclass.js";import v from"../geometry/Extent.js";import{getLocale as S}from"../intl/locale.js";import{ensureDefaultPortalInstance as P}from"./portalDefault.js";import g from"./PortalGroup.js";import O from"./PortalQueryParams.js";import G from"./PortalQueryResult.js";import B from"./PortalUser.js";import{supportsApiKey as D}from"../support/apiKeyUtils.js";var _;let M;const U={PortalGroup:()=>Promise.resolve({default:g}),PortalItem:()=>import("./PortalItem.js"),PortalUser:()=>Promise.resolve({default:B})};let C=_=class extends(i(a)){constructor(e){super(e),this._esriIdCredentialCreateHandle=null,this.access=null,this.allSSL=!1,this.authMode="auto",this.authorizedCrossOriginDomains=null,this.basemapGalleryGroupQuery=null,this.basemapGalleryGroupQuery3D=null,this.bingKey=null,this.canListApps=!1,this.canListData=!1,this.canListPreProvisionedItems=!1,this.canProvisionDirectPurchase=!1,this.canSearchPublic=!0,this.canShareBingPublic=!1,this.canSharePublic=!1,this.canSignInArcGIS=!1,this.canSignInIDP=!1,this.colorSetsGroupQuery=null,this.commentsEnabled=!1,this.created=null,this.culture=null,this.customBaseUrl=null,this.defaultBasemap=null,this.defaultDevBasemap=null,this.defaultExtent=null,this.defaultVectorBasemap=null,this.description=null,this.devBasemapGalleryGroupQuery=null,this.eueiEnabled=null,this.featuredGroups=null,this.featuredItemsGroupQuery=null,this.galleryTemplatesGroupQuery=null,this.layoutGroupQuery=null,this.livingAtlasGroupQuery=null,this.hasCategorySchema=!1,this.helperServices=null,this.homePageFeaturedContent=null,this.homePageFeaturedContentCount=null,this.httpPort=null,this.httpsPort=null,this.id=null,this.ipCntryCode=null,this.isPortal=!1,this.isReadOnly=!1,this.layerTemplatesGroupQuery=null,this.maxTokenExpirationMinutes=null,this.modified=null,this.name=null,this.portalHostname=null,this.portalMode=null,this.portalProperties=null,this.region=null,this.rotatorPanels=null,this.showHomePageDescription=!1,this.sourceJSON=null,this.supportsHostedServices=!1,this.symbolSetsGroupQuery=null,this.templatesGroupQuery=null,this.units=null,this.url=t.portalUrl,this.urlKey=null,this.user=null,this.use3dBasemaps=!0,this.useStandardizedQuery=!1,this.useVectorBasemaps=!1,this.vectorBasemapGalleryGroupQuery=null}normalizeCtorArgs(e){return"string"==typeof e?{url:e}:e}destroy(){b.unregister(this),this.defaultBasemap=l(this.defaultBasemap),this.defaultDevBasemap=l(this.defaultDevBasemap),this.defaultVectorBasemap=l(this.defaultVectorBasemap),this._esriIdCredentialCreateHandle=u(this._esriIdCredentialCreateHandle)}readAuthorizedCrossOriginDomains(e){if(e)for(const r of e)t.request.trustedServers.includes(r)||t.request.trustedServers.push(r);return e}readDefaultBasemap(e){return this._readBasemap(e)}readDefaultDevBasemap(e){return this._readBasemap(e)}readDefaultVectorBasemap(e){return this._readBasemap(e)}get extraQuery(){const e=this.user?.orgId,t=!e||this.canSearchPublic;return this.id&&!t?` AND orgid:${this.id}`:null}get isOrganization(){return!!this.access}get itemPageUrl(){return this.url?`${this.url}/home/item.html`:null}get restUrl(){let e=this.url;if(e){const t=e.indexOf("/sharing");e=t>0?e.substring(0,t):this.url.replace(/\/+$/,""),e+="/sharing/rest"}return e}get thumbnailUrl(){const e=this.restUrl,t=this.thumbnail;return e&&t?this._normalizeSSL(e+"/portals/self/resources/"+t):null}readUrlKey(e){return e?e.toLowerCase():e}readUser(e){let t=null;return e&&(t=B.fromJSON(e),t.portal=this),t}load(e){const t=import("../Basemap.js").then((({default:t})=>{n(e),M=t})).then((()=>this.sourceJSON?this.sourceJSON:this.fetchSelf(this.authMode,!1,e))).then((e=>{if(r){const e=r;this.credential=e.findCredential(this.restUrl),this.credential||this.authMode!==_.AUTH_MODE_AUTO&&this.authMode!==_.AUTH_MODE_NO_PROMPT||(this._esriIdCredentialCreateHandle?.remove(),this._esriIdCredentialCreateHandle=e.on("credential-create",w(new WeakRef(this))),b.register(this,this._esriIdCredentialCreateHandle,this))}this.sourceJSON=e,this.read(e)}));return this.addResolvingPromise(t),Promise.resolve(this)}async createElevationLayers(){await this.load();const e=this._getHelperService("defaultElevationLayers"),t=(await import("../layers/ElevationLayer.js")).default;return e?e.map((e=>new t({id:e.id,url:e.url}))):[]}async fetchBasemaps(e,t){const r=await this._fetchBasemaps(e,t);if(!0===t?.include3d&&!1!==this.use3dBasemaps){const o=await this._fetchBasemaps3D(e,t);r.unshift(...o)}return r}fetchCategorySchema(e){return this.hasCategorySchema?this.request(this.restUrl+"/portals/self/categorySchema",e).then((e=>e.categorySchema)):p(e)?Promise.reject(d()):Promise.resolve([])}fetchFeaturedGroups(e){const t=this.featuredGroups,r=new O({num:100,sortField:"title"});if(t&&t.length){const o=[];for(const e of t)o.push(`(title:"${e.title}" AND owner:${e.owner})`);return r.query=o.join(" OR "),this.queryGroups(r,e).then((e=>e.results))}return p(e)?Promise.reject(d()):Promise.resolve([])}fetchRegions(e){const t=this.user?.culture||this.culture||S();return this.request(this.restUrl+"/portals/regions",{...e,query:{culture:t}})}fetchSettings(e){const t=this.user?.culture||this.culture||S();return this.request(this.restUrl+"/portals/self/settings",{...e,query:{culture:t}})}static getDefault(){return P((()=>new _))}queryGroups(e,t){return this.queryPortal("/community/groups",e,"PortalGroup",t)}queryItems(e,t){return this.queryPortal("/search",e,"PortalItem",t)}queryUsers(e,t){return e.sortField||(e.sortField="username"),this.queryPortal("/community/users",e,"PortalUser",t)}fetchSelf(e=this.authMode,t=!1,r){const o=this.restUrl+"/portals/self",s={authMode:e,query:{culture:S().toLowerCase()},withCredentials:!0,...r};return"auto"===s.authMode&&(s.authMode="no-prompt"),t&&(s.query.default=!0),this.request(o,s)}queryPortal(e,t,r,o){const s=c(O,t),i=t=>this.request(this.restUrl+e,{...s.toRequestOptions(this),...o}).then((e=>{const r=s.clone();return r.start=e.nextStart,new G({nextQueryParams:r,queryParams:s,total:e.total,results:_._resultsToTypedArray(t,{portal:this},e,o)})})).then((e=>Promise.all(e.results.map((t=>"function"==typeof t.when?t.when():e))).then((()=>e),(t=>(h(t),e)))));return r&&U[r]?U[r]().then((({default:e})=>(n(o),i(e)))):i()}signIn(){if(this.authMode===_.AUTH_MODE_ANONYMOUS||this.authMode===_.AUTH_MODE_NO_PROMPT&&!r)return Promise.reject(new s("portal:invalid-auth-mode",`Current "authMode"' is "${this.authMode}"`));if("failed"===this.loadStatus)return Promise.reject(this.loadError);const e=e=>Promise.resolve().then((()=>"not-loaded"===this.loadStatus?(e||(this.authMode="immediate"),this.load().then((()=>null))):"loading"===this.loadStatus?this.load().then((()=>this.credential?null:(this.credential=e,this.fetchSelf("immediate")))):this.user&&this.credential===e?null:(this.credential=e,this.fetchSelf("immediate")))).then((e=>{e&&(this.sourceJSON=e,this.read(e))}));return r?r.getCredential(this.restUrl,{prompt:this.authMode!==_.AUTH_MODE_NO_PROMPT}).then((t=>e(t))):e(this.credential)}normalizeUrl(e){const t=this.credential?.token;return this._normalizeSSL(t?e+(e.includes("?")?"&":"?")+"token="+t:e)}requestToTypedArray(e,t,r){return this.request(e,t).then((e=>{const t=_._resultsToTypedArray(r,{portal:this},e);return Promise.all(t.map((t=>"function"==typeof t.when?t.when():e))).then((()=>t),(()=>t))}))}request(e,t={}){const r={f:"json",...t.query},{authMode:s=(this.authMode===_.AUTH_MODE_ANONYMOUS||this.authMode===_.AUTH_MODE_NO_PROMPT?this.authMode:"auto"),body:i=null,cacheBust:a=!1,method:l="auto",responseType:u="json",signal:n}=t,p={authMode:s,body:i,cacheBust:a,method:l,query:r,responseType:u,timeout:0,signal:n};return t.withCredentials&&(p.withCredentials=!0),o(this._normalizeSSL(e),p).then((e=>e.data))}toJSON(){throw new s("internal:not-yet-implemented","Portal.toJSON is not yet implemented")}static fromJSON(e){if(!e)return null;if(e.declaredClass)throw new Error("JSON object is already hydrated");return new _({sourceJSON:e})}_getHelperService(e){const t=this.helperServices&&this.helperServices[e];if(!t)throw new s("portal:service-not-found",`The \`helperServices\` do not include an entry named "${e}"`);return t}async _fetchBasemaps(e,r){const o=new O;o.query=e||(t.apiKey&&D(this.url)?this.devBasemapGalleryGroupQuery:this.useVectorBasemaps?this.vectorBasemapGalleryGroupQuery:this.basemapGalleryGroupQuery),o.disableExtraQuery=!0;const s=await this.queryGroups(o,r);if(!s.total)return[];const i=s.results[0];o.num=100,o.query='type:"Web Map" -type:"Web Application"',o.sortField=i.sortField||"name",o.sortOrder=i.sortOrder||"desc";const a=await i.queryItems(o,r);if(!a.total)return[];return a.results.filter((e=>"Web Map"===e.type)).map((e=>new M({portalItem:e})))}async _fetchBasemaps3D(e,t){const r=e||this.basemapGalleryGroupQuery3D;if(!r)return[];const o=new O({query:r,disableExtraQuery:!0}),s=await this.queryGroups(o,t);if(!s.total)return[];const i=s.results[0];o.num=100,o.query='type:"Web Scene"',o.sortField=i.sortField||"name",o.sortOrder=i.sortOrder||"desc";const a=await i.queryItems(o,t);if(!a.total)return[];return a.results.filter((e=>"Web Scene"===e.type)).map((e=>new M({portalItem:e})))}_normalizeSSL(e){return e.replace(/^http:/i,"https:").replace(":7080",":7443")}_readBasemap(e){if(e){const t=M.fromJSON(e);return t.portalItem={portal:this},t}return null}static _resultsToTypedArray(e,t,r,o){let s=[];if(r){const i=null!=o?o.signal:null;s=r.listings||r.notifications||r.userInvitations||r.tags||r.items||r.groups||r.comments||r.provisions||r.results||r.relatedItems||r,(e||t)&&(s=s.map((r=>{const o=Object.assign(e?e.fromJSON(r):r,t);return"function"==typeof o.load&&o.load(i),o})))}else s=[];return s}};C.AUTH_MODE_ANONYMOUS="anonymous",C.AUTH_MODE_AUTO="auto",C.AUTH_MODE_IMMEDIATE="immediate",C.AUTH_MODE_NO_PROMPT="no-prompt",e([y()],C.prototype,"access",void 0),e([y()],C.prototype,"allSSL",void 0),e([y()],C.prototype,"authMode",void 0),e([y()],C.prototype,"authorizedCrossOriginDomains",void 0),e([m("authorizedCrossOriginDomains")],C.prototype,"readAuthorizedCrossOriginDomains",null),e([y()],C.prototype,"basemapGalleryGroupQuery",void 0),e([y({json:{name:"3DBasemapGalleryGroupQuery"}})],C.prototype,"basemapGalleryGroupQuery3D",void 0),e([y()],C.prototype,"bingKey",void 0),e([y()],C.prototype,"canListApps",void 0),e([y()],C.prototype,"canListData",void 0),e([y()],C.prototype,"canListPreProvisionedItems",void 0),e([y()],C.prototype,"canProvisionDirectPurchase",void 0),e([y()],C.prototype,"canSearchPublic",void 0),e([y()],C.prototype,"canShareBingPublic",void 0),e([y()],C.prototype,"canSharePublic",void 0),e([y()],C.prototype,"canSignInArcGIS",void 0),e([y()],C.prototype,"canSignInIDP",void 0),e([y()],C.prototype,"colorSetsGroupQuery",void 0),e([y()],C.prototype,"commentsEnabled",void 0),e([y({type:Date})],C.prototype,"created",void 0),e([y()],C.prototype,"credential",void 0),e([y()],C.prototype,"culture",void 0),e([y()],C.prototype,"currentVersion",void 0),e([y()],C.prototype,"customBaseUrl",void 0),e([y()],C.prototype,"defaultBasemap",void 0),e([m("defaultBasemap")],C.prototype,"readDefaultBasemap",null),e([y()],C.prototype,"defaultDevBasemap",void 0),e([m("defaultDevBasemap")],C.prototype,"readDefaultDevBasemap",null),e([y({type:v})],C.prototype,"defaultExtent",void 0),e([y()],C.prototype,"defaultVectorBasemap",void 0),e([m("defaultVectorBasemap")],C.prototype,"readDefaultVectorBasemap",null),e([y()],C.prototype,"description",void 0),e([y()],C.prototype,"devBasemapGalleryGroupQuery",void 0),e([y()],C.prototype,"eueiEnabled",void 0),e([y({readOnly:!0})],C.prototype,"extraQuery",null),e([y()],C.prototype,"featuredGroups",void 0),e([y()],C.prototype,"featuredItemsGroupQuery",void 0),e([y()],C.prototype,"galleryTemplatesGroupQuery",void 0),e([y()],C.prototype,"layoutGroupQuery",void 0),e([y()],C.prototype,"livingAtlasGroupQuery",void 0),e([y()],C.prototype,"hasCategorySchema",void 0),e([y()],C.prototype,"helpBase",void 0),e([y()],C.prototype,"helperServices",void 0),e([y()],C.prototype,"helpMap",void 0),e([y()],C.prototype,"homePageFeaturedContent",void 0),e([y()],C.prototype,"homePageFeaturedContentCount",void 0),e([y()],C.prototype,"httpPort",void 0),e([y()],C.prototype,"httpsPort",void 0),e([y()],C.prototype,"id",void 0),e([y()],C.prototype,"ipCntryCode",void 0),e([y({readOnly:!0})],C.prototype,"isOrganization",null),e([y()],C.prototype,"isPortal",void 0),e([y()],C.prototype,"isReadOnly",void 0),e([y({readOnly:!0})],C.prototype,"itemPageUrl",null),e([y()],C.prototype,"layerTemplatesGroupQuery",void 0),e([y()],C.prototype,"maxTokenExpirationMinutes",void 0),e([y({type:Date})],C.prototype,"modified",void 0),e([y()],C.prototype,"name",void 0),e([y()],C.prototype,"portalHostname",void 0),e([y()],C.prototype,"portalMode",void 0),e([y()],C.prototype,"portalProperties",void 0),e([y()],C.prototype,"region",void 0),e([y({readOnly:!0})],C.prototype,"restUrl",null),e([y()],C.prototype,"rotatorPanels",void 0),e([y()],C.prototype,"showHomePageDescription",void 0),e([y()],C.prototype,"sourceJSON",void 0),e([y()],C.prototype,"staticImagesUrl",void 0),e([y({json:{name:"2DStylesGroupQuery"}})],C.prototype,"stylesGroupQuery2d",void 0),e([y({json:{name:"stylesGroupQuery"}})],C.prototype,"stylesGroupQuery3d",void 0),e([y()],C.prototype,"supportsHostedServices",void 0),e([y()],C.prototype,"symbolSetsGroupQuery",void 0),e([y()],C.prototype,"templatesGroupQuery",void 0),e([y()],C.prototype,"thumbnail",void 0),e([y({readOnly:!0})],C.prototype,"thumbnailUrl",null),e([y()],C.prototype,"units",void 0),e([y()],C.prototype,"url",void 0),e([y()],C.prototype,"urlKey",void 0),e([m("urlKey")],C.prototype,"readUrlKey",null),e([y()],C.prototype,"user",void 0),e([m("user")],C.prototype,"readUser",null),e([y()],C.prototype,"use3dBasemaps",void 0),e([y()],C.prototype,"useStandardizedQuery",void 0),e([y()],C.prototype,"useVectorBasemaps",void 0),e([y()],C.prototype,"vectorBasemapGalleryGroupQuery",void 0),C=_=e([f("esri.portal.Portal")],C);const Q=C,b=new FinalizationRegistry((e=>{e.remove()}));function w(e){const t=r;return()=>{const r=e.deref();r&&t.findCredential(r.restUrl)&&r.signIn().catch((()=>{}))}}export{Q as default};
|
package/portal/PortalGroup.js
CHANGED
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.30/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as t}from"../chunks/tslib.es6.js";import r from"../core/Error.js";import{JSONSupport as e}from"../core/JSONSupport.js";import{property as o}from"../core/accessorSupport/decorators/property.js";import{ensureType as s}from"../core/accessorSupport/ensureType.js";import"../core/RandomLCG.js";import"../core/has.js";import{subclass as n}from"../core/accessorSupport/decorators/subclass.js";import i from"./PortalQueryParams.js";var l;let u=l=class extends e{constructor(t){super(t),this.access=null,this.created=null,this.description=null,this.id=null,this.isInvitationOnly=!1,this.modified=null,this.owner=null,this.portal=null,this.snippet=null,this.sortField=null,this.sortOrder=null,this.sourceJSON=null,this.tags=null,this.title=null}get thumbnailUrl(){const t=this.url,r=this.thumbnail;return t&&r&&this.portal?this.portal?.normalizeUrl(`${t}/info/${r}?f=json`):null}get url(){const t=this.portal?.restUrl;return t?t+"/community/groups/"+this.id:null}fetchCategorySchema(t){return this.portal.request(this.url+"/categorySchema",t).then((r=>{const e=r.categorySchema||[];return e.some((t=>"contentCategorySetsGroupQuery.LivingAtlas"===t.source))?this._fetchCategorySchemaSet("LivingAtlas",t):e}))}fetchMembers(t){return this.portal.request(this.url+"/users",t)}getThumbnailUrl(t){let r=this.thumbnailUrl;return r&&t&&(r+=`&w=${t}`),r}toJSON(){throw new r("internal:not-yet-implemented","PortalGroup.toJSON is not yet implemented")}static fromJSON(t){if(!t)return null;if(t.declaredClass)throw new Error("JSON object is already hydrated");const r=new l;return r.
|
|
5
|
+
import{_ as t}from"../chunks/tslib.es6.js";import r from"../core/Error.js";import{JSONSupport as e}from"../core/JSONSupport.js";import{property as o}from"../core/accessorSupport/decorators/property.js";import{ensureType as s}from"../core/accessorSupport/ensureType.js";import"../core/RandomLCG.js";import"../core/has.js";import{subclass as n}from"../core/accessorSupport/decorators/subclass.js";import i from"./PortalQueryParams.js";var l;let u=l=class extends e{constructor(t){super(t),this.access=null,this.created=null,this.description=null,this.id=null,this.isInvitationOnly=!1,this.modified=null,this.owner=null,this.portal=null,this.snippet=null,this.sortField=null,this.sortOrder=null,this.sourceJSON=null,this.tags=null,this.title=null}get thumbnailUrl(){const t=this.url,r=this.thumbnail;return t&&r&&this.portal?this.portal?.normalizeUrl(`${t}/info/${r}?f=json`):null}get url(){const t=this.portal?.restUrl;return t?t+"/community/groups/"+this.id:null}fetchCategorySchema(t){return this.portal.request(this.url+"/categorySchema",t).then((r=>{const e=r.categorySchema||[];return e.some((t=>"contentCategorySetsGroupQuery.LivingAtlas"===t.source))?this._fetchCategorySchemaSet("LivingAtlas",t):e}))}fetchMembers(t){return this.portal.request(this.url+"/users",t)}getThumbnailUrl(t){let r=this.thumbnailUrl;return r&&t&&(r+=`&w=${t}`),r}toJSON(){throw new r("internal:not-yet-implemented","PortalGroup.toJSON is not yet implemented")}static fromJSON(t){if(!t)return null;if(t.declaredClass)throw new Error("JSON object is already hydrated");const r=new l({sourceJSON:t});return r.read(t),r}queryItems(t,r){let e=s(i,t);const o=this.portal;return parseFloat(o.currentVersion)>5?(e=e||new i,o.queryPortal(`/content/groups/${this.id}/search`,e,"PortalItem",r)):(e=e?e.clone():new i,e.query="group:"+this.id+(e.query?" "+e.query:""),o.queryItems(e,r))}_fetchCategorySchemaSet(t,e){const o=this.portal;return o.fetchSelf(o.authMode,!0,e).then((t=>{const s=t.contentCategorySetsGroupQuery;if(s){const t=new i({disableExtraQuery:!0,num:1,query:s});return o.queryGroups(t,e)}throw new r("portal-group:fetchCategorySchema","contentCategorySetsGroupQuery value not found")})).then((o=>{if(o.total){const r=o.results[0],s=new i({num:1,query:`typekeywords:"${t}"`});return r.queryItems(s,e)}throw new r("portal-group:fetchCategorySchema","contentCategorySetsGroupQuery group not found")})).then((t=>{if(t.total){return t.results[0].fetchData("json",e).then((t=>{const r=t?.categorySchema;return r?.length?r:[]}))}return[]}))}};t([o()],u.prototype,"access",void 0),t([o({type:Date})],u.prototype,"created",void 0),t([o()],u.prototype,"description",void 0),t([o()],u.prototype,"id",void 0),t([o()],u.prototype,"isInvitationOnly",void 0),t([o({type:Date})],u.prototype,"modified",void 0),t([o()],u.prototype,"owner",void 0),t([o()],u.prototype,"portal",void 0),t([o()],u.prototype,"snippet",void 0),t([o()],u.prototype,"sortField",void 0),t([o()],u.prototype,"sortOrder",void 0),t([o()],u.prototype,"sourceJSON",void 0),t([o()],u.prototype,"tags",void 0),t([o()],u.prototype,"thumbnail",void 0),t([o({readOnly:!0})],u.prototype,"thumbnailUrl",null),t([o()],u.prototype,"title",void 0),t([o({readOnly:!0})],u.prototype,"url",null),u=l=t([n("esri.portal.PortalGroup")],u);const p=u;export{p as default};
|
package/portal/PortalUser.js
CHANGED
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.30/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as t}from"../chunks/tslib.es6.js";import r from"../core/Error.js";import{JSONSupport as e}from"../core/JSONSupport.js";import{property as o}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/Logger.js";import"../core/RandomLCG.js";import{subclass as l}from"../core/accessorSupport/decorators/subclass.js";import s from"./PortalFolder.js";import n from"./PortalGroup.js";var i;let u=i=class extends e{constructor(t){super(t),this.access=null,this.created=null,this.culture=null,this.description=null,this.email=null,this.fullName=null,this.modified=null,this.orgId=null,this.portal=null,this.preferredView=null,this.privileges=null,this.region=null,this.role=null,this.roleId=null,this.sourceJSON=null,this.units=null,this.username=null,this.userType=null}get thumbnailUrl(){const t=this.url,r=this.thumbnail;return t&&r?this.portal.normalizeUrl(`${t}/info/${r}?f=json`):null}get userContentUrl(){const t=this.portal?.restUrl;return t?`${t}/content/users/${this.username}`:null}get url(){const t=this.portal?.restUrl;return t?`${t}/community/users/${this.username}`:null}addItem(t){const r=t&&t.item,e=t?.data,o=t?.folder,l={method:"post"};r&&(l.query=r.createPostQuery(),null!=e&&("string"==typeof e?l.query.text=e:"object"==typeof e&&(l.query.text=JSON.stringify(e))));let s=this.userContentUrl;return o&&(s+="/"+("string"==typeof o?o:o.id)),this.portal.request(s+"/addItem",l).then((t=>(r.id=t.id,r.portal=this.portal,r.loaded?r.reload():r.load())))}deleteItem(t){let r=this.userContentUrl;return t.ownerFolder&&(r+="/"+t.ownerFolder),this.portal.request(r+`/items/${t.id}/delete`,{method:"post"}).then((()=>{t.id=null,t.portal=null}))}deleteItems(t){const r=this.userContentUrl+"/deleteItems",e=t.map((t=>t.id));if(e.length){const o={method:"post",query:{items:e.join(",")}};return this.portal.request(r,o).then((()=>{t.forEach((t=>{t.id=null,t.portal=null}))}))}return Promise.resolve(void 0)}fetchFolders(){const t={query:{num:1}};return this.portal.request(this.userContentUrl??"",t).then((t=>{let r;return r=t&&t.folders?t.folders.map((t=>{const r=s.fromJSON(t);return r.portal=this.portal,r})):[],r}))}fetchGroups(){return this.portal.request(this.url??"").then((t=>{let r;return r=t&&t.groups?t.groups.map((t=>{const r=n.fromJSON(t);return r.portal=this.portal,r})):[],r}))}fetchItems(t){const r=t??{};let e,o=this.userContentUrl??"";return r.folder&&(o+="/"+r.folder.id),import("./PortalItem.js").then((({default:t})=>{e=t;const l={folders:!1,num:r.num||10,start:r.start||1,sortField:r.sortField||"created",sortOrder:r.sortOrder||"asc"};return this.portal.request(o,{query:l})})).then((t=>{let r;return t?.items?(r=t.items.map((t=>{const r=e.fromJSON(t);return r.portal=this.portal,r})),Promise.all(r.map((t=>t.load()))).catch((t=>t)).then((()=>({items:r,nextStart:t.nextStart,total:t.total})))):{items:[],nextStart:-1,total:0}}))}fetchTags(){return this.portal.request(this.url+"/tags").then((t=>t.tags))}getThumbnailUrl(t){let r=this.thumbnailUrl;return r&&t&&(r+=`&w=${t}`),r}queryFavorites(t){return this.favGroupId?(this._favGroup||(this._favGroup=new n({id:this.favGroupId,portal:this.portal})),this._favGroup.queryItems(t)):Promise.reject(new r("internal:unknown","Unknown internal error",{internalError:"Unknown favGroupId"}))}toJSON(){throw new r("internal:not-yet-implemented","PortalUser.toJSON is not yet implemented")}static fromJSON(t){if(!t)return null;if(t.declaredClass)throw new Error("JSON object is already hydrated");const r=new i;return r.
|
|
5
|
+
import{_ as t}from"../chunks/tslib.es6.js";import r from"../core/Error.js";import{JSONSupport as e}from"../core/JSONSupport.js";import{property as o}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/Logger.js";import"../core/RandomLCG.js";import{subclass as l}from"../core/accessorSupport/decorators/subclass.js";import s from"./PortalFolder.js";import n from"./PortalGroup.js";var i;let u=i=class extends e{constructor(t){super(t),this.access=null,this.created=null,this.culture=null,this.description=null,this.email=null,this.fullName=null,this.modified=null,this.orgId=null,this.portal=null,this.preferredView=null,this.privileges=null,this.region=null,this.role=null,this.roleId=null,this.sourceJSON=null,this.units=null,this.username=null,this.userType=null}get thumbnailUrl(){const t=this.url,r=this.thumbnail;return t&&r?this.portal.normalizeUrl(`${t}/info/${r}?f=json`):null}get userContentUrl(){const t=this.portal?.restUrl;return t?`${t}/content/users/${this.username}`:null}get url(){const t=this.portal?.restUrl;return t?`${t}/community/users/${this.username}`:null}addItem(t){const r=t&&t.item,e=t?.data,o=t?.folder,l={method:"post"};r&&(l.query=r.createPostQuery(),null!=e&&("string"==typeof e?l.query.text=e:"object"==typeof e&&(l.query.text=JSON.stringify(e))));let s=this.userContentUrl;return o&&(s+="/"+("string"==typeof o?o:o.id)),this.portal.request(s+"/addItem",l).then((t=>(r.id=t.id,r.portal=this.portal,r.loaded?r.reload():r.load())))}deleteItem(t){let r=this.userContentUrl;return t.ownerFolder&&(r+="/"+t.ownerFolder),this.portal.request(r+`/items/${t.id}/delete`,{method:"post"}).then((()=>{t.id=null,t.portal=null}))}deleteItems(t){const r=this.userContentUrl+"/deleteItems",e=t.map((t=>t.id));if(e.length){const o={method:"post",query:{items:e.join(",")}};return this.portal.request(r,o).then((()=>{t.forEach((t=>{t.id=null,t.portal=null}))}))}return Promise.resolve(void 0)}fetchFolders(){const t={query:{num:1}};return this.portal.request(this.userContentUrl??"",t).then((t=>{let r;return r=t&&t.folders?t.folders.map((t=>{const r=s.fromJSON(t);return r.portal=this.portal,r})):[],r}))}fetchGroups(){return this.portal.request(this.url??"").then((t=>{let r;return r=t&&t.groups?t.groups.map((t=>{const r=n.fromJSON(t);return r.portal=this.portal,r})):[],r}))}fetchItems(t){const r=t??{};let e,o=this.userContentUrl??"";return r.folder&&(o+="/"+r.folder.id),import("./PortalItem.js").then((({default:t})=>{e=t;const l={folders:!1,num:r.num||10,start:r.start||1,sortField:r.sortField||"created",sortOrder:r.sortOrder||"asc"};return this.portal.request(o,{query:l})})).then((t=>{let r;return t?.items?(r=t.items.map((t=>{const r=e.fromJSON(t);return r.portal=this.portal,r})),Promise.all(r.map((t=>t.load()))).catch((t=>t)).then((()=>({items:r,nextStart:t.nextStart,total:t.total})))):{items:[],nextStart:-1,total:0}}))}fetchTags(){return this.portal.request(this.url+"/tags").then((t=>t.tags))}getThumbnailUrl(t){let r=this.thumbnailUrl;return r&&t&&(r+=`&w=${t}`),r}queryFavorites(t){return this.favGroupId?(this._favGroup||(this._favGroup=new n({id:this.favGroupId,portal:this.portal})),this._favGroup.queryItems(t)):Promise.reject(new r("internal:unknown","Unknown internal error",{internalError:"Unknown favGroupId"}))}toJSON(){throw new r("internal:not-yet-implemented","PortalUser.toJSON is not yet implemented")}static fromJSON(t){if(!t)return null;if(t.declaredClass)throw new Error("JSON object is already hydrated");const r=new i({sourceJSON:t});return r.read(t),r}};t([o()],u.prototype,"access",void 0),t([o({type:Date})],u.prototype,"created",void 0),t([o()],u.prototype,"culture",void 0),t([o()],u.prototype,"description",void 0),t([o()],u.prototype,"email",void 0),t([o()],u.prototype,"favGroupId",void 0),t([o()],u.prototype,"fullName",void 0),t([o({type:Date})],u.prototype,"modified",void 0),t([o()],u.prototype,"orgId",void 0),t([o()],u.prototype,"portal",void 0),t([o()],u.prototype,"preferredView",void 0),t([o()],u.prototype,"privileges",void 0),t([o()],u.prototype,"region",void 0),t([o()],u.prototype,"role",void 0),t([o()],u.prototype,"roleId",void 0),t([o()],u.prototype,"sourceJSON",void 0),t([o()],u.prototype,"thumbnail",void 0),t([o({readOnly:!0})],u.prototype,"thumbnailUrl",null),t([o()],u.prototype,"units",void 0),t([o({readOnly:!0})],u.prototype,"userContentUrl",null),t([o({readOnly:!0})],u.prototype,"url",null),t([o()],u.prototype,"username",void 0),t([o()],u.prototype,"userType",void 0),u=i=t([l("esri.portal.PortalUser")],u);const p=u;export{p 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.30/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import r from"../../config.js";import e from"../../core/Error.js";import t from"../Portal.js";import{project as o}from"../../rest/geometryService/project.js";import i from"../../rest/support/ProjectParameters.js";async function n(o=null,i){if(r.geometryServiceUrl)return r.geometryServiceUrl;if(!o)throw new e("internal:geometry-service-url-not-configured");let n;n="portal"in o?o.portal||t.getDefault():o,await n.load({signal:i});const a=n.helperServices?.geometry?.url;if(!a)throw new e("internal:geometry-service-url-not-configured");return a}async function a(r,t,a=null,l){const c=await n(a,l),s=new i
|
|
5
|
+
import r from"../../config.js";import e from"../../core/Error.js";import t from"../Portal.js";import{project as o}from"../../rest/geometryService/project.js";import i from"../../rest/support/ProjectParameters.js";async function n(o=null,i){if(r.geometryServiceUrl)return r.geometryServiceUrl;if(!o)throw new e("internal:geometry-service-url-not-configured");let n;n="portal"in o?o.portal||t.getDefault():o,await n.load({signal:i});const a=n.helperServices?.geometry?.url;if(!a)throw new e("internal:geometry-service-url-not-configured");return a}async function a(r,t,a=null,l){const c=await n(a,l),s=new i({geometries:[r],outSpatialReference:t}),m=await o(c,s,{signal:l});if(m&&Array.isArray(m)&&1===m.length)return m[0];throw new e("internal:geometry-service-projection-failed")}export{n as getGeometryServiceURL,a as projectGeometry};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.30/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import r from"../GraphApplyEditsResult.js";function e(e){const o=
|
|
5
|
+
import r from"../GraphApplyEditsResult.js";function e(e){const o=e.has_error(),t=new r({hasError:o,error:o?{errorCode:e.error.error_code,errorMessage:e.error.error_message}:null}),s=e.get_edit_results_count();for(let r=0;r<s;r++){const o=e.get_edit_results_at(r),s=e.get_edit_results_type_name_at(r),_=[],d=[],u=[],a=o.get_add_results_count(),l=o.get_update_results_count(),g=o.get_delete_results_count();for(let r=0;r<a;r++){const e=o.get_add_result_at(r);_.push({id:e.id,error:{errorCode:e.error.error_code,errorMessage:e.error.error_message}})}for(let r=0;r<l;r++){const e=o.get_update_result_at(r);d.push({id:e.id,error:{errorCode:e.error.error_code,errorMessage:e.error.error_message}})}for(let r=0;r<g;r++){const e=o.get_delete_result_at(r);u.push({id:e.id,error:{errorCode:e.error.error_code,errorMessage:e.error.error_message}})}t.editResults.push({typeName:s,adds:_,updates:d,deletes:u})}return t}export{e as decoderToApplyEditsResponse};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.30/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as o}from"../../../chunks/tslib.es6.js";import"../../../geometry.js";import{JSONSupport as e}from"../../../core/JSONSupport.js";import{property as r}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{reader as t}from"../../../core/accessorSupport/decorators/reader.js";import{subclass as l}from"../../../core/accessorSupport/decorators/subclass.js";import{writer as s}from"../../../core/accessorSupport/decorators/writer.js";import{associationTypeKebabDict as n}from"../../../networks/support/typeUtils.js";import m from"./NetworkElement.js";import i from"../../../geometry/Polyline.js";let p=class extends e{constructor(o){super(o),this.globalId=null,this.associationType=null,this.fromNetworkElement=null,this.toNetworkElement=null,this.geometry=null,this.errorMessage=null,this.percentAlong=null,this.errorCode=null,this.isContentVisible=null,this.status=null}readFromNetworkElement(o,e){
|
|
5
|
+
import{_ as o}from"../../../chunks/tslib.es6.js";import"../../../geometry.js";import{JSONSupport as e}from"../../../core/JSONSupport.js";import{property as r}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{reader as t}from"../../../core/accessorSupport/decorators/reader.js";import{subclass as l}from"../../../core/accessorSupport/decorators/subclass.js";import{writer as s}from"../../../core/accessorSupport/decorators/writer.js";import{associationTypeKebabDict as n}from"../../../networks/support/typeUtils.js";import m from"./NetworkElement.js";import i from"../../../geometry/Polyline.js";let p=class extends e{constructor(o){super(o),this.globalId=null,this.associationType=null,this.fromNetworkElement=null,this.toNetworkElement=null,this.geometry=null,this.errorMessage=null,this.percentAlong=null,this.errorCode=null,this.isContentVisible=null,this.status=null}readFromNetworkElement(o,e){return new m({globalId:e.fromGlobalId,networkSourceId:e.fromNetworkSourceId,terminalId:e.fromTerminalId})}writeFromNetworkElement(o,e){o&&(e.fromGlobalId=o.globalId,e.fromNetworkSourceId=o.networkSourceId,e.fromTerminalId=o.terminalId)}readToNetworkElement(o,e){return new m({globalId:e.toGlobalId,networkSourceId:e.toNetworkSourceId,terminalId:e.toTerminalId})}writeToNetworkElement(o,e){o&&(e.toGlobalId=o.globalId,e.toNetworkSourceId=o.networkSourceId,e.toTerminalId=o.terminalId)}};o([r({type:String,json:{write:!0}})],p.prototype,"globalId",void 0),o([r({type:n.apiValues,json:{type:n.jsonValues,read:n.read,write:n.write}})],p.prototype,"associationType",void 0),o([r({type:m,json:{write:{target:{fromGlobalId:{type:String},fromNetworkSourceId:{type:Number},fromTerminalId:{type:Number}}},read:{source:["fromGlobalId","fromNetworkSourceId","fromTerminalId"]}}})],p.prototype,"fromNetworkElement",void 0),o([t("fromNetworkElement")],p.prototype,"readFromNetworkElement",null),o([s("fromNetworkElement")],p.prototype,"writeFromNetworkElement",null),o([r({type:m,json:{write:{target:{toGlobalId:{type:String},toNetworkSourceId:{type:Number},toTerminalId:{type:Number}}},read:{source:["toGlobalId","toNetworkSourceId","toTerminalId"]}}})],p.prototype,"toNetworkElement",void 0),o([t("toNetworkElement")],p.prototype,"readToNetworkElement",null),o([s("toNetworkElement")],p.prototype,"writeToNetworkElement",null),o([r({type:i,json:{write:!0}})],p.prototype,"geometry",void 0),o([r({type:String,json:{write:!0}})],p.prototype,"errorMessage",void 0),o([r({type:Number,json:{write:!0}})],p.prototype,"percentAlong",void 0),o([r({type:Number,json:{write:!0}})],p.prototype,"errorCode",void 0),o([r({type:Boolean,json:{write:!0}})],p.prototype,"isContentVisible",void 0),o([r({type:Number,json:{write:!0}})],p.prototype,"status",void 0),p=o([l("esri.rest.networks.support.Association")],p);const d=p;export{d as default};
|
package/rest/places.js
CHANGED
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.30/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import"../geometry.js";import e from"../request.js";import{ensureClass as
|
|
5
|
+
import"../geometry.js";import e from"../request.js";import{ensureClass as r}from"../core/accessorSupport/ensureType.js";import t from"../portal/Portal.js";import{asValidOptions as s,parseUrl as o}from"./utils.js";import a from"./support/FetchPlaceParameters.js";import i from"./support/PlacesQueryParameters.js";import n from"./support/PlacesQueryResult.js";import{projectWithEngineOrService as p}from"../views/support/projectionUtils.js";import u from"../geometry/SpatialReference.js";async function m(t,o){t=r(a,t);const i={requestedFields:t.requestedFields?.join(),token:t.apiKey},n=s(i,o),{data:p}=await e(`${t.url}/places/${t.placeId}`,n);return p}async function c(e,s){const o={radius:(e=r(i,e)).radius};let a=e.point;return a&&!a.spatialReference.isWGS84&&(a=await p(a,u.WGS84,t.getDefault(),s?.signal)),a&&(o.x=a.x,o.y=a.y),f(`${e.url}/places/near-point`,o,e,s)}async function l(e,s){const o={};let a=(e=r(i,e)).extent;return a&&!a.spatialReference.isWGS84&&(a=await p(a,u.WGS84,t.getDefault(),s?.signal)),a&&(o.xmin=a.xmin,o.ymin=a.ymin,o.xmax=a.xmax,o.ymax=a.ymax),f(`${e.url}/places/within-extent`,o,e,s)}async function f(r,t,a,i){t={...t,categoryIds:a.categoryIds?.join(),offset:a.offset,pageSize:a.pageSize,searchText:a.searchText,token:a.apiKey};const p=s(t,i),{data:u}=await e(r,p),m=new n({results:u.results}),{pagination:c,links:l}=u;if(c?.nextUrl||l?.next){m.nextQueryParams=a.clone();const e=o(c?.nextUrl||l?.next).query;m.nextQueryParams.offset=Number(e.offset)}if(c?.previousUrl||l?.previous){m.previousQueryParams=a.clone();const e=o(c?.previousUrl||l?.previous).query;m.previousQueryParams.offset=Number(e.offset)}return m}export{m as fetchPlace,c as queryPlacesNearPoint,l as queryPlacesWithinExtent};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.30/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{assertIsSome as e}from"../../../core/maybe.js";import{getGeometryZScaler as t}from"../../../geometry/support/zscale.js";import{unquantizeOptimizedGeometry as r,convertToGeometry as s}from"../../../layers/graphics/featureConversionUtils.js";function o(e,t){return t}function i(e,t,r,s){switch(r){case 0:return u(e,t+s,0);case 1:return"lowerLeft"===e.originPosition?u(e,t+s,1):l(e,t+s,1)}}function n(e,t,r,s){return 2===r?u(e,t,2):i(e,t,r,s)}function a(e,t,r,s){return 2===r?0===t?0:u(e,t,
|
|
5
|
+
import{assertIsSome as e}from"../../../core/maybe.js";import{getGeometryZScaler as t}from"../../../geometry/support/zscale.js";import{unquantizeOptimizedGeometry as r,convertToGeometry as s}from"../../../layers/graphics/featureConversionUtils.js";function o(e,t){return t}function i(e,t,r,s){switch(r){case 0:return u(e,t+s,0);case 1:return"lowerLeft"===e.originPosition?u(e,t+s,1):l(e,t+s,1)}}function n(e,t,r,s){return 2===r?u(e,t,2):i(e,t,r,s)}function a(e,t,r,s){return 2===r?0===t?0:u(e,t,3):i(e,t,r,s)}function h(e,t,r,s){return 3===r?0===t?0:u(e,t,3):n(e,t,r,s)}function u({translate:e,scale:t},r,s){return e[s]+r*t[s]}function l({translate:e,scale:t},r,s){return e[s]-r*t[s]}class d{constructor(e){this._options=e,this.geometryTypes=["esriGeometryPoint","esriGeometryMultipoint","esriGeometryPolyline","esriGeometryPolygon"],this._previousCoordinate=[0,0],this._transform=null,this._applyTransform=o,this._lengths=[],this._currentLengthIndex=0,this._toAddInCurrentPath=0,this._vertexDimension=0,this._mValueOffset=null,this._coordinateBuffer=null,this._coordinateBufferPtr=0,this._attributesConstructor=class{}}createFeatureResult(){return{fields:[],features:[]}}finishFeatureResult(e){if(this._options.applyTransform&&(e.transform=null),this._attributesConstructor=class{},this._coordinateBuffer=null,this._lengths.length=0,!e.hasZ)return;const r=t(e.geometryType,this._options.sourceSpatialReference,e.spatialReference);if(null!=r)for(const t of e.features)r(t.geometry)}createSpatialReference(){return{}}addField(t,r){const s=t.fields;e(s),s.push(r);const o=s.map((e=>e.name));this._attributesConstructor=function(){for(const e of o)this[e]=null}}addFeature(e,t){e.features.push(t)}prepareFeatures(e){switch(this._transform=e.transform,this._options.applyTransform&&e.transform&&(this._applyTransform=this._deriveApplyTransform(e)),this._mValueOffset=null,this._vertexDimension=2,e.hasZ&&this._vertexDimension++,e.hasM&&(this._mValueOffset=this._vertexDimension,this._vertexDimension++),e.geometryType){case"esriGeometryPoint":this.addCoordinate=(e,t,r)=>this.addCoordinatePoint(e,t,r),this.createGeometry=e=>this.createPointGeometry(e);break;case"esriGeometryPolygon":this.addCoordinate=(e,t,r)=>this._addCoordinatePolygon(e,t,r),this.createGeometry=e=>this._createPolygonGeometry(e);break;case"esriGeometryPolyline":this.addCoordinate=(e,t,r)=>this._addCoordinatePolyline(e,t,r),this.createGeometry=e=>this._createPolylineGeometry(e);break;case"esriGeometryMultipoint":this.addCoordinate=(e,t,r)=>this._addCoordinateMultipoint(e,t,r),this.createGeometry=e=>this._createMultipointGeometry(e)}}createFeature(){return this._lengths.length=0,this._currentLengthIndex=0,this._previousCoordinate[0]=0,this._previousCoordinate[1]=0,this._coordinateBuffer=null,this._coordinateBufferPtr=0,{attributes:new this._attributesConstructor}}allocateCoordinates(){}addLength(e,t,r){0===this._lengths.length&&(this._toAddInCurrentPath=t),this._lengths.push(t)}addQueryGeometry(e,t){const{queryGeometry:o,queryGeometryType:i}=t,n=r(o.clone(),o,!1,!1,this._transform),a=s(n,i,!1,!1);e.queryGeometryType=i,e.queryGeometry={...a}}createPointGeometry(e){const t={x:0,y:0,spatialReference:e.spatialReference};return e.hasZ&&(t.z=0),e.hasM&&(t.m=0),t}addCoordinatePoint(e,t,r){const s=this._transform;switch(t=this._applyTransform(s,t,r,0),r){case 0:e.x=t;break;case 1:e.y=t;break;case 2:"z"in e?e.z=t:e.m=t;break;case 3:e.m=t}}_transformPathLikeValue(e,t){let r=0;t<=1&&(r=this._previousCoordinate[t],this._previousCoordinate[t]+=e);const s=this._transform;return null===this._mValueOffset||0!==e||t%this._mValueOffset?this._applyTransform(s,e,t,r):0}_addCoordinatePolyline(e,t,r){this._dehydratedAddPointsCoordinate(e.paths,t,r)}_addCoordinatePolygon(e,t,r){this._dehydratedAddPointsCoordinate(e.rings,t,r)}_addCoordinateMultipoint(e,t,r){0===r&&e.points.push([]);const s=this._transformPathLikeValue(t,r);e.points[e.points.length-1].push(s)}_createPolygonGeometry(e){return{rings:[[]],spatialReference:e.spatialReference,hasZ:!!e.hasZ,hasM:!!e.hasM}}_createPolylineGeometry(e){return{paths:[[]],spatialReference:e.spatialReference,hasZ:!!e.hasZ,hasM:!!e.hasM}}_createMultipointGeometry(e){return{points:[],spatialReference:e.spatialReference,hasZ:!!e.hasZ,hasM:!!e.hasM}}_dehydratedAddPointsCoordinate(e,t,r){0===r&&0==this._toAddInCurrentPath--&&(e.push([]),this._toAddInCurrentPath=this._lengths[++this._currentLengthIndex]-1,this._previousCoordinate[0]=0,this._previousCoordinate[1]=0);const s=this._transformPathLikeValue(t,r),o=e[e.length-1];0===r&&(this._coordinateBufferPtr=0,this._coordinateBuffer=new Array(this._vertexDimension),o.push(this._coordinateBuffer)),this._coordinateBuffer[this._coordinateBufferPtr++]=s}_deriveApplyTransform(e){const{hasZ:t,hasM:r}=e;return t&&r?h:t?n:r?a:i}}export{d as JSONFeatureSetParserContext};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.30/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as t}from"../../chunks/tslib.es6.js";import{geometryTypes as e}from"../../geometry.js";import o from"../../TimeExtent.js";import{JSONSupport as r}from"../../core/JSONSupport.js";import{clone as s}from"../../core/lang.js";import{property as i}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/Logger.js";import{subclass as p}from"../../core/accessorSupport/decorators/subclass.js";import{writer as l}from"../../core/accessorSupport/decorators/writer.js";import{getJsonType as n,fromJSON as m}from"../../geometry/support/jsonUtils.js";import a from"../../layers/support/MosaicRule.js";import{interpolationKebab as u}from"../../layers/support/rasterEnums.js";import y from"../../geometry/Multipoint.js";import c from"../../geometry/Point.js";var d;let j=d=class extends r{constructor(){super(...arguments),this.geometry=null,this.interpolation="nearest",this.mosaicRule=null,this.outFields=null,this.pixelSize=null,this.returnFirstValueOnly=!0,this.sampleDistance=null,this.sampleCount=null,this.sliceId=null,this.timeExtent=null}writeGeometry(t,e,o){null!=t&&(e.geometryType=n(t),e[o]=t.toJSON())}set locations(t){if(t?.length){const e=new y({spatialReference:t[0].spatialReference
|
|
5
|
+
import{_ as t}from"../../chunks/tslib.es6.js";import{geometryTypes as e}from"../../geometry.js";import o from"../../TimeExtent.js";import{JSONSupport as r}from"../../core/JSONSupport.js";import{clone as s}from"../../core/lang.js";import{property as i}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/Logger.js";import{subclass as p}from"../../core/accessorSupport/decorators/subclass.js";import{writer as l}from"../../core/accessorSupport/decorators/writer.js";import{getJsonType as n,fromJSON as m}from"../../geometry/support/jsonUtils.js";import a from"../../layers/support/MosaicRule.js";import{interpolationKebab as u}from"../../layers/support/rasterEnums.js";import y from"../../geometry/Multipoint.js";import c from"../../geometry/Point.js";var d;let j=d=class extends r{constructor(){super(...arguments),this.geometry=null,this.interpolation="nearest",this.mosaicRule=null,this.outFields=null,this.pixelSize=null,this.returnFirstValueOnly=!0,this.sampleDistance=null,this.sampleCount=null,this.sliceId=null,this.timeExtent=null}writeGeometry(t,e,o){null!=t&&(e.geometryType=n(t),e[o]=t.toJSON())}set locations(t){if(t?.length){const e=new y({spatialReference:t[0].spatialReference,points:t.map((({x:t,y:e})=>[t,e]))});this._set("locations",t),this.geometry=e}}clone(){return new d(s({geometry:this.geometry,locations:this.locations,interpolation:this.interpolation,mosaicRule:this.mosaicRule,outFields:this.outFields,raster:this.raster,returnFirstValueOnly:this.returnFirstValueOnly,sampleDistance:this.sampleDistance,sampleCount:this.sampleCount,sliceId:this.sliceId,pixelSize:this.pixelSize,timeExtent:this.timeExtent}))}};t([i({types:e,json:{read:m}})],j.prototype,"geometry",void 0),t([l("geometry")],j.prototype,"writeGeometry",null),t([i()],j.prototype,"locations",null),t([i({type:String,json:{type:u.jsonValues,read:u.read,write:u.write}})],j.prototype,"interpolation",void 0),t([i({type:a,json:{write:!0}})],j.prototype,"mosaicRule",void 0),t([i({type:[String],json:{write:!0}})],j.prototype,"outFields",void 0),t([i({type:c,json:{write:!0}})],j.prototype,"pixelSize",void 0),t([i({type:String,json:{write:!0}})],j.prototype,"raster",void 0),t([i({type:Boolean,json:{write:!0}})],j.prototype,"returnFirstValueOnly",void 0),t([i({type:Number,json:{write:!0}})],j.prototype,"sampleDistance",void 0),t([i({type:Number,json:{write:!0}})],j.prototype,"sampleCount",void 0),t([i({type:Number,json:{write:!0}})],j.prototype,"sliceId",void 0),t([i({type:o,json:{read:{source:"time"},write:{target:"time"}}})],j.prototype,"timeExtent",void 0),j=d=t([p("esri.rest.support.ImageSampleParameters")],j);const h=j;export{h as default};
|