@arcgis/core 4.30.0-next.20240312 → 4.30.0-next.20240313

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (58) hide show
  1. package/assets/esri/core/workers/RemoteClient.js +1 -1
  2. package/assets/esri/core/workers/chunks/{182f94904b6eb611b886.js → 052005514ce006ce0027.js} +1 -1
  3. package/assets/esri/core/workers/chunks/129ea550bf7ad7ad24f9.js +1 -0
  4. package/assets/esri/core/workers/chunks/{c3d619f978136f740a42.js → 1f5b7880ccf47ef9229d.js} +5 -5
  5. package/assets/esri/core/workers/chunks/{523903a812624d0d6d06.js → 2427699e34e1895ed024.js} +1 -1
  6. package/assets/esri/core/workers/chunks/{86fe8077986a991f0462.js → 500f39a5f74fa289df25.js} +1 -1
  7. package/assets/esri/core/workers/chunks/67ab6af927ea04c01a40.js +1 -0
  8. package/assets/esri/core/workers/chunks/c76e155332aa0491de3d.js +1 -0
  9. package/assets/esri/core/workers/chunks/dd5a078b7919f749ba3e.js +1 -0
  10. package/assets/esri/core/workers/chunks/f7cfdba77cb614fd3725.js +1 -0
  11. package/assets/esri/core/workers/chunks/f9427ac73435d1726d6c.js +1 -0
  12. package/assets/esri/core/workers/chunks/ff4151d794ec73064fac.js +1 -0
  13. package/layers/graphics/data/QueryEngine.js +1 -1
  14. package/layers/mixins/SceneService.js +1 -1
  15. package/layers/support/ExportImageServiceParameters.js +1 -1
  16. package/layers/support/LayerContingentValuesCache.js +1 -1
  17. package/layers/support/PixelBlock.js +1 -1
  18. package/layers/support/Tilemap.js +1 -1
  19. package/layers/support/rasterDatasets/BaseRaster.js +1 -1
  20. package/layers/support/rasterDatasets/CloudRaster.js +1 -1
  21. package/layers/support/rasterDatasets/FunctionRaster.js +1 -1
  22. package/layers/support/rasterDatasets/ImageServerRaster.js +1 -1
  23. package/layers/support/rasterDatasets/MRFRaster.js +1 -1
  24. package/layers/support/rasterDatasets/TIFFRaster.js +1 -1
  25. package/layers/support/rasterDatasets/WCSRaster.js +1 -1
  26. package/layers/support/rasterFunctions/ExtractBandFunction.js +1 -1
  27. package/package.json +1 -1
  28. package/request.js +1 -1
  29. package/rest/symbolService.js +1 -1
  30. package/support/revision.js +1 -1
  31. package/views/3d/layers/MediaLayerView3D.js +1 -1
  32. package/views/3d/state/ConstraintsManager.js +1 -1
  33. package/views/3d/state/ViewState.js +1 -1
  34. package/views/3d/support/LaserlinePathData.js +1 -1
  35. package/views/3d/terrain/TileRenderer.js +1 -1
  36. package/views/3d/webgl-engine/lib/MagnifierHelper.js +1 -1
  37. package/views/3d/webgl-engine/lib/Object3DStateSet.js +1 -1
  38. package/views/3d/webgl-engine/lib/Octree.js +1 -1
  39. package/views/3d/webgl-engine/lib/RayIntersections.js +1 -1
  40. package/views/3d/webgl-engine/lib/ShadowMap.js +1 -1
  41. package/views/3d/webgl-engine/lib/TextRenderParameters.js +1 -1
  42. package/views/3d/webgl-engine/lib/depthRangeUtils.js +1 -1
  43. package/views/3d/webgl-engine/lib/edgeRendering/EdgeView.js +1 -1
  44. package/views/3d/webgl-engine/lib/edgeRendering/EdgeWorkerHandle.js +1 -1
  45. package/views/3d/webgl-engine/materials/HUDMaterial.js +1 -1
  46. package/views/3d/webgl-engine/materials/PathMaterial.js +1 -1
  47. package/views/3d/webgl-engine/materials/PatternMaterial.js +1 -1
  48. package/views/3d/webgl-engine/parts/RenderView.js +1 -1
  49. package/views/3d/webgl-engine/shaders/DefaultMaterialTechnique.js +1 -1
  50. package/widgets/UtilityNetworkTrace/UtilityNetworkTraceViewModel.js +1 -1
  51. package/widgets/UtilityNetworkTrace/support/ResultAreaHandler.js +1 -1
  52. package/assets/esri/core/workers/chunks/0272af5adbbd4482f50d.js +0 -1
  53. package/assets/esri/core/workers/chunks/16f1ede633a712a555a6.js +0 -1
  54. package/assets/esri/core/workers/chunks/52fa794d75ab8841e808.js +0 -1
  55. package/assets/esri/core/workers/chunks/771b95d28e1c9a14df64.js +0 -1
  56. package/assets/esri/core/workers/chunks/79f36c3a2026c2f35fb0.js +0 -1
  57. package/assets/esri/core/workers/chunks/899b4539e516f44c51af.js +0 -1
  58. package/assets/esri/core/workers/chunks/bbedc4ff3d0aadbde16a.js +0 -1
@@ -0,0 +1 @@
1
+ "use strict";(self.webpackChunkRemoteClient=self.webpackChunkRemoteClient||[]).push([[3522,6591],{3330:(e,t,i)=>{i.d(t,{GB:()=>s,Qo:()=>o,Y4:()=>n});var r=i(96285);class s{}function n(e){return e instanceof r.bo?e===s.instance:"unknown"===e?.toString().toLowerCase()}function o(e){return n(e)?s.instance:e}s.instance=new r.oh("Etc/UTC")},5159:(e,t,i)=>{i.r(t),i.d(t,{default:()=>ji});var r=i(90237),s=i(13874),n=i(69540),o=i(49186),a=i(92071),l=i(74887),u=i(10107),p=(i(44208),i(53966)),c=(i(87811),i(40608)),d=i(43937),m=i(4146),h=i(59456),y=i(52106),g=i(68729),f=i(78888),w=i(51447),v=i(4718),_=i(36708),R=i(84952),b=i(56507),S=i(36005),M=i(21325),F=i(55785),I=i(45617),x=i(25482),A=i(22796),j=i(16019);const Z={StretchFunction:{arguments:{ComputeGamma:{isDataset:!1,isPublic:!1,name:"ComputeGamma",type:"RasterFunctionVariable",value:!1},DRA:{isDataset:!1,isPublic:!1,name:"DRA",type:"RasterFunctionVariable",value:!1},EstimateStatsHistogram:{isDataset:!1,isPublic:!1,name:"EstimateStatsHistogram",type:"RasterFunctionVariable",value:!1},Gamma:{displayName:"Gamma",isDataset:!1,isPublic:!1,name:"Gamma",type:"RasterFunctionVariable"},Histograms:{isDataset:!1,isPublic:!1,name:"Histograms",type:"RasterFunctionVariable"},Max:{isDataset:!1,isPublic:!1,name:"Max",type:"RasterFunctionVariable",value:255},MaxPercent:{isDataset:!1,isPublic:!1,name:"MaxPercent",type:"RasterFunctionVariable",value:.5},Min:{isDataset:!1,isPublic:!1,name:"Min",type:"RasterFunctionVariable",value:0},MinPercent:{isDataset:!1,isPublic:!1,name:"MinPercent",type:"RasterFunctionVariable",value:.25},NumberOfStandardDeviations:{isDataset:!1,isPublic:!1,name:"NumberOfStandardDeviation",type:"RasterFunctionVariable",value:2},Raster:{isDataset:!0,isPublic:!1,name:"Raster",type:"RasterFunctionVariable"},SigmoidStrengthLevel:{isDataset:!1,isPublic:!1,name:"SigmoidStrengthLevel",type:"RasterFunctionVariable",value:2},Statistics:{isDataset:!1,isPublic:!1,name:"Statistics",type:"RasterFunctionVariable"},StretchType:{isDataset:!1,isPublic:!1,name:"StretchType",type:"RasterFunctionVariable",value:0},type:"StretchFunctionArguments",UseGamma:{isDataset:!1,isPublic:!1,name:"UseGamma",type:"RasterFunctionVariable",value:!1}},description:"Enhances an image by adjusting the range of values displayed. This does not alter the underlying pixel values. If a pixel has a value outside of the specified range, it will appear as either the minimum or maximum value.",function:{description:"Enhances an image by adjusting the range of values displayed. This does not alter the underlying pixel values. If a pixel has a value outside of the specified range, it will appear as either the minimum or maximum value.",name:"Stretch",pixelType:"UNKNOWN",type:"StretchFunction"},functionType:0,name:"Stretch",thumbnail:""},RemapFunction:{name:"Remap",description:"Changes pixel values by assigning new values to ranges of pixel values or using an external table.",function:{type:"RemapFunction",pixelType:"UNKNOWN",name:"Remap",description:"Changes pixel values by assigning new values to ranges of pixel values or using an external table."},arguments:{Raster:{name:"Raster",isPublic:!1,isDataset:!0,type:"RasterFunctionVariable"},UseTable:{name:"UseTable",isPublic:!1,isDataset:!1,value:!1,type:"RasterFunctionVariable"},InputRanges:{name:"InputRanges",isPublic:!1,isDataset:!1,type:"RasterFunctionVariable",displayName:"Input Ranges"},OutputValues:{name:"OutputValues",isPublic:!1,isDataset:!1,type:"RasterFunctionVariable",displayName:"Output Values"},NoDataRanges:{name:"NoDataRanges",isPublic:!1,isDataset:!1,type:"RasterFunctionVariable",displayName:"NoData Ranges"},Table:{name:"Table",isPublic:!1,isDataset:!1,type:"RasterFunctionVariable"},InputField:{name:"InputField",isPublic:!1,isDataset:!1,type:"RasterFunctionVariable"},OutputField:{name:"OutputField",isPublic:!1,isDataset:!1,type:"RasterFunctionVariable"},InputMaxField:{name:"InputMaxField",isPublic:!1,isDataset:!1,type:"RasterFunctionVariable"},RemapTableType:{name:"RemapTableType",isPublic:!1,isDataset:!1,value:1,type:"RasterFunctionVariable"},AllowUnmatched:{name:"AllowUnmatched",isPublic:!1,isDataset:!1,value:!0,type:"RasterFunctionVariable"},type:"RemapFunctionArguments"},functionType:0,thumbnail:""},ColormapFunction:{name:"Colormap",description:"Changes pixel values to display the raster data as either a grayscale or a red, green, blue (RGB) image, based on a colormap or a color ramp.",function:{type:"ColormapFunction",pixelType:"UNKNOWN",name:"Colormap",description:"Changes pixel values to display the raster data as either a grayscale or a red, green, blue (RGB) image, based on a colormap or a color ramp."},arguments:{Raster:{name:"Raster",isPublic:!1,isDataset:!0,type:"RasterFunctionVariable"},ColorSchemeType:{name:"ColorSchemeType",isPublic:!1,isDataset:!1,value:1,type:"RasterFunctionVariable"},Colormap:{name:"Colormap",isPublic:!1,isDataset:!1,type:"RasterFunctionVariable"},ColormapName:{name:"ColormapName",isPublic:!1,isDataset:!1,value:"Gray",type:"RasterFunctionVariable"},ColorRamp:{name:"ColorRamp",isPublic:!1,isDataset:!1,type:"RasterFunctionVariable"},type:"ColormapFunctionArguments"},functionType:0,thumbnail:""},ShadedReliefFunction:{name:"Shaded Relief",description:"Creates a multiband, color coded, 3D representation of the surface, with the sun's relative position taken into account for shading the image.",function:{type:"ShadedReliefFunction",pixelType:"UNKNOWN",name:"Shaded Relief",description:"Creates a multiband, color coded, 3D representation of the surface, with the sun's relative position taken into account for shading the image."},arguments:{Raster:{name:"Raster",isPublic:!1,isDataset:!0,type:"RasterFunctionVariable"},ColorSchemeType:{name:"ColorSchemeType",isPublic:!1,isDataset:!1,value:1,type:"RasterFunctionVariable"},ColorRamp:{name:"ColorRamp",isPublic:!1,isDataset:!1,type:"RasterFunctionVariable"},HillshadeType:{name:"HillshadeType",isPublic:!1,isDataset:!1,value:0,type:"RasterFunctionVariable"},Colormap:{name:"Colormap",isPublic:!1,isDataset:!1,type:"RasterFunctionVariable"},Azimuth:{name:"Azimuth",isPublic:!1,isDataset:!1,value:315,type:"RasterFunctionVariable"},Altitude:{name:"Altitude",isPublic:!1,isDataset:!1,value:45,type:"RasterFunctionVariable"},SlopeType:{name:"SlopeType",isPublic:!1,isDataset:!1,value:1,type:"RasterFunctionVariable"},ZFactor:{name:"ZFactor",isPublic:!1,isDataset:!1,value:1,type:"RasterFunctionVariable"},PSPower:{name:"PSPower",isPublic:!1,isDataset:!1,value:.664,type:"RasterFunctionVariable"},PSZFactor:{name:"PSZFactor",isPublic:!1,isDataset:!1,value:.024,type:"RasterFunctionVariable"},RemoveEdgeEffect:{name:"RemoveEdgeEffect",isPublic:!1,isDataset:!1,value:!1,type:"RasterFunctionVariable"},type:"ShadedReliefFunctionArguments"},functionType:0,thumbnail:""},HillshadeFunction:{name:"Hillshade",description:"Creates a 3D representation of the surface, with the sun's relative position taken into account for shading the image",function:{type:"HillshadeFunction",pixelType:"UNKNOWN",name:"Hillshade",description:"Creates a 3D representation of the surface, with the sun's relative position taken into account for shading the image"},arguments:{DEM:{name:"DEM",isPublic:!1,isDataset:!0,type:"RasterFunctionVariable"},HillshadeType:{name:"HillshadeType",isPublic:!1,isDataset:!1,value:0,type:"RasterFunctionVariable"},Azimuth:{name:"Azimuth",isPublic:!1,isDataset:!1,value:315,type:"RasterFunctionVariable"},Altitude:{name:"Altitude",isPublic:!1,isDataset:!1,value:45,type:"RasterFunctionVariable"},SlopeType:{name:"SlopeType",isPublic:!1,isDataset:!1,value:1,type:"RasterFunctionVariable"},ZFactor:{name:"ZFactor",isPublic:!1,isDataset:!1,value:1,type:"RasterFunctionVariable"},PSPower:{name:"PSPower",isPublic:!1,isDataset:!1,value:.664,type:"RasterFunctionVariable"},PSZFactor:{name:"PSZFactor",isPublic:!1,isDataset:!1,value:.024,type:"RasterFunctionVariable"},RemoveEdgeEffect:{name:"RemoveEdgeEffect",isPublic:!1,isDataset:!1,value:!1,type:"RasterFunctionVariable"},type:"HillshadeFunctionArguments"},functionType:0,thumbnail:""},ResampleFunction:{name:"Resample",description:"Changes the cell size of a raster.",function:{type:"ResampleFunction",pixelType:"UNKNOWN",name:"Resample",description:"Changes the cell size of a raster."},arguments:{Raster:{name:"Raster",isPublic:!1,isDataset:!0,type:"RasterFunctionVariable"},ResamplingType:{name:"ResamplingType",isPublic:!1,isDataset:!1,value:0,type:"RasterFunctionVariable"},InputCellSize:{name:"InputCellsize",isPublic:!1,isDataset:!1,value:{x:0,y:0},type:"RasterFunctionVariable"},OutputCellSize:{name:"OutputCellsize",isPublic:!1,isDataset:!1,value:{x:0,y:0},type:"RasterFunctionVariable"},type:"ResampleFunctionArguments"},functionType:0,thumbnail:""}};var D=i(67369),T=i(70274),P=i(496);const N=new Set(["u1","u2","u4","u8","s8","u16","s16"]),O={simple_scalar:"Simple Scalar",wind_barb:"Wind Barb",single_arrow:"Single Arrow",beaufort_kn:"Beaufort Wind (Knots)",beaufort_m:"Beaufort Wind (MetersPerSecond)",ocean_current_m:"Ocean Current (MetersPerSecond)",ocean_current_kn:"Ocean Current (Knots)"},C=new Set(["raster-stretch","unique-value","class-breaks","raster-shaded-relief","vector-field","raster-colormap"]);function V(e){return C.has(e.type)}function J(e,t){if(!e||!t)return(0,v.o8)(e||t);const i=(0,v.o8)(e);if(i.functionDefinition&&t.rasterFunctionDefinition){const e=t.rasterFunctionDefinition;(e.thumbnail||e.thumbnailEx)&&(e.thumbnail=e.thumbnailEx=void 0),E(i.functionDefinition.arguments,t),i.rasterFunctionDefinition=i.functionDefinition.toJSON()}else"none"!==t.functionName?.toLowerCase()&&(G(i.functionArguments).Raster=t);return i}function E(e,t){for(const i in e)"raster"===i.toLowerCase()&&("RasterFunctionVariable"===e[i].type?(e[i]=t.rasterFunctionDefinition,e[i].type="RasterFunctionTemplate"):"RasterFunctionTemplate"===e[i].type&&E(e[i].arguments,t))}function q(e){const t=(0,v.o8)(Z[e.functionName+"Function"]),i=e.functionArguments;for(const e in i)"raster"===e.toLowerCase()?(t.arguments[e]=q(i[e]),t.arguments[e].type="RasterFunctionTemplate"):"colormap"===e.toLowerCase()?(t.arguments[e].value=U(i[e]),t.arguments.ColorSchemeType.value=0):t.arguments[e].value=i[e];return t}function G(e){const t=e?.Raster??e?.raster;return t&&"esri.layers.support.RasterFunction"===t.declaredClass?G(t.functionArguments):e}const L={none:0,standardDeviation:3,histogramEqualization:4,minMax:5,percentClip:6,sigmoid:9};function z(e,t){const i=N.has(t)?(0,j.hP)(t):null;return i&&e.push([Math.floor(i[0]-1),0,0,0],[Math.ceil(i[1]+1),0,0,0]),e}function B(e){if(null==e)return;const{fields:t}=e,i=t?.find((e=>e?.name&&"value"===e.name.toLowerCase()));return i?.name}function $(e){const t=[];return e?.forEach((e=>{const i=e;if(Array.isArray(i))t.push(i);else{if(null==i.min||null==i.max)return;const e=[i.min,i.max,i.avg||0,i.stddev||0];t.push(e)}})),t}function U(e){const t=[],i=[];return e.forEach((e=>{t.push(e[0]),i.push((0,D.vL)([...e.slice(1),255]))})),{type:"RasterColormap",values:t,colors:i}}var H=i(85675),k=i(13868);let Q=class extends x.oY{constructor(){super(...arguments),this.layer=null,this.compression=void 0,this.pixelType=void 0,this.lercVersion=2}get adjustAspectRatio(){return this.layer.adjustAspectRatio}writeAdjustAspectRatio(e,t,i){this.layer.version<10.3||(t[i]=e)}get bandIds(){return this.layer.bandIds}get compressionQuality(){return this.layer.compressionQuality}writeCompressionQuality(e,t,i){this.format&&this.format.toLowerCase().includes("jpg")&&null!=e&&(t[i]=e)}get compressionTolerance(){return this.layer.compressionTolerance}writeCompressionTolerance(e,t,i){"lerc"===this.format&&null!=e&&(t[i]=e)}get format(){return"vector-field"===this.layer.renderer?.type?"lerc":this.layer.format}get interpolation(){return this.layer.interpolation}get noData(){return this.layer.noData}get noDataInterpretation(){return this.layer.noDataInterpretation}writeLercVersion(e,t,i){"lerc"===this.format&&this.layer.version>=10.5&&(t[i]=e)}get version(){const e=this.layer;return e.commitProperty("bandIds"),e.commitProperty("format"),e.commitProperty("compressionQuality"),e.commitProperty("compressionTolerance"),e.commitProperty("interpolation"),e.commitProperty("noData"),e.commitProperty("noDataInterpretation"),e.commitProperty("mosaicRule"),e.commitProperty("rasterFunction"),e.commitProperty("adjustAspectRatio"),e.commitProperty("pixelFilter"),e.commitProperty("definitionExpression"),e.commitProperty("multidimensionalSubset"),(this._get("version")||0)+1}set version(e){this._set("version",e)}get mosaicRule(){const e=this.layer;let t=e.mosaicRule;const i=e.definitionExpression;return t?i&&i!==t.where&&(t=t.clone(),t.where=i):i&&(t=new H.A({where:i})),t}get rasterFunction(){const e=this.layer;let{rasterFunction:t}=e;const i=e.pixelFilter,r=!e.format||e.format.includes("jpg")||e.format.includes("png");t=this._addResampleRasterFunction(t);const s=e.multidimensionalSubset?.areaOfInterest;return s&&(t=function(e,t){return J(new A.A({functionName:"Clip",functionArguments:{ClippingGeometry:t.toJSON(),ClippingType:1}}),e)}(t,s)),r&&!i&&"vector-field"!==e.renderer?.type&&(t=this.combineRendererWithRenderingRule(t)),t}combineRendererWithRenderingRule(e){const t=this.layer,{rasterInfo:i,renderer:r}=t;return e=e||t.rasterFunction,r&&V(r)?J(function(e,t){switch(t=t||{},e.type){case"raster-stretch":return function(e,t){const i=t.convertToRFT,r=new A.A;r.functionName="Stretch";const s=L[T.u.toJSON(e.stretchType)],n="u8",o={StretchType:s,Statistics:$(e.statistics??[]),DRA:e.dynamicRangeAdjustment,UseGamma:e.useGamma,Gamma:e.gamma,ComputeGamma:e.computeGamma};if(null!=e.outputMin&&(o.Min=e.outputMin),null!=e.outputMax&&(o.Max=e.outputMax),s===L.standardDeviation?(o.NumberOfStandardDeviations=e.numberOfStandardDeviations,r.outputPixelType=n):s===L.percentClip?(o.MinPercent=e.minPercent,o.MaxPercent=e.maxPercent,r.outputPixelType=n):s===L.minMax?r.outputPixelType=n:s===L.sigmoid&&(o.SigmoidStrengthLevel=e.sigmoidStrengthLevel),r.functionArguments=o,r.variableName="Raster",e.colorRamp){const s=e.colorRamp,n=new A.A;if(i)n.functionArguments={ColorRamp:(0,D.hf)(s)};else{const i=(0,D.hs)(s,!0);if(i)n.functionArguments={colorRampName:i};else if(!t.convertColorRampToColormap||"algorithmic"!==s.type&&"multipart"!==s.type){const t=e.colorRamp.toJSON();"algorithmic"===t.type?t.algorithm=t.algorithm||"esriCIELabAlgorithm":"multipart"===t.type&&t.colorRamps?.length&&t.colorRamps.forEach((e=>e.algorithm=e.algorithm||"esriCIELabAlgorithm")),n.functionArguments={colorRamp:t}}else n.functionArguments={Colormap:(0,D.R8)(s)}}return n.variableName="Raster",n.functionName="Colormap",n.functionArguments.Raster=r,i?new A.A({rasterFunctionDefinition:q(n)}):n}return i?new A.A({rasterFunctionDefinition:q(r)}):r}(e,t);case"class-breaks":return function(e,t){const i=[],r=[],s=[],n=[],o=1e-4,{pixelType:a,rasterAttributeTable:l}=t,u=null==l?null:l.features,p=B(l);if(p&&u&&Array.isArray(u)&&e.classBreakInfos){e.classBreakInfos.forEach(((t,i)=>{const r=t.symbol?.color;let s;r?.a&&null!=t.minValue&&null!=t.maxValue&&u.forEach((o=>{null!=t.minValue&&null!=t.maxValue&&(s=o.attributes[e.field],(s>=t.minValue&&s<t.maxValue||i===e.classBreakInfos.length-1&&s>=t.minValue)&&n.push([o.attributes[p],r.r,r.g,r.b]))}))}));const i=a?z(n,a):n,r=new A.A;return r.functionName="Colormap",r.functionArguments={},r.functionArguments.Colormap=i,r.variableName="Raster",t.convertToRFT?new A.A({rasterFunctionDefinition:q(r)}):r}e.classBreakInfos.forEach(((e,t)=>{if(null==e.minValue||null==e.maxValue)return;const a=e.symbol&&e.symbol.color;a?.a?(0===t?i.push(e.minValue,e.maxValue+o):i.push(e.minValue+o,e.maxValue+o),r.push(t),n.push([t,a.r,a.g,a.b])):s.push(e.minValue,e.maxValue)}));const c=a?z(n,a):n,d=new A.A;d.functionName="Remap",d.functionArguments={InputRanges:i,OutputValues:r,NoDataRanges:s},d.variableName="Raster";const m=new A.A;return m.functionName="Colormap",m.functionArguments={Colormap:c,Raster:d},t.convertToRFT?new A.A({rasterFunctionDefinition:q(m)}):m}(e,t);case"unique-value":return function(e,t){const i=[],{pixelType:r,rasterAttributeTable:s}=t,n=null==s?null:s.features,o=B(s),a=e.defaultSymbol?.color?.toRgb(),l=e.uniqueValueInfos;if(l)if(n){if(o){const t=new Map;l.forEach((e=>{const i=e.value,r=e.symbol?.color;null!=i&&r?.a&&t.set(String(i),r.toRgb())}));const r=e.field;n.forEach((({attributes:e})=>{const s=String(e[r]),n=e[o],l=t.get(s);l?i.push([n,...l]):a&&i.push([n,...a])}))}}else for(let e=0;e<l.length;e++){const t=l[e],r=t.symbol?.color,s=+t.value;if(r?.a){if(isNaN(s))return null;i.push([s,r.r,r.g,r.b])}}const u=r?z(i,r):i,p=new A.A;return p.functionName="Colormap",p.functionArguments={},p.functionArguments.Colormap=u,p.variableName="Raster",t.convertToRFT?new A.A({rasterFunctionDefinition:q(p)}):p}(e,t);case"raster-colormap":return function(e,t){const i=e.extractColormap();if(!i||0===i.length)return null;const{pixelType:r}=t,s=r?z(i,r):i,n=new A.A;return n.functionName="Colormap",n.functionArguments={},n.functionArguments.Colormap=s,t.convertToRFT?new A.A({rasterFunctionDefinition:q(n)}):n}(e,t);case"vector-field":return function(e,t){const i=new A.A;i.functionName="VectorFieldRenderer";const{dataType:r,bandNames:s}=t,n="vector-uv"===r;let o,a;if(s&&2===s.length){const e=s.map((e=>e.toLowerCase()));o=e.indexOf("magnitude"),a=e.indexOf("direction")}-1!==o&&null!==o||(o=0,a=1);const l="arithmetic"===e.rotationType?1:2,u="flow-from"===e.flowRepresentation?0:1,p=e.visualVariables?e.visualVariables.find((e=>"Magnitude"===e.field)):new P.A,c={magnitudeBandID:o,directionBandID:a,isUVComponents:n,referenceSystem:l,massFlowAngleRepresentation:u,symbolTileSize:50,symbolTileSizeUnits:100,calculationMethod:"Vector Average",symbologyName:O[e.style.toLowerCase().replace("-","_")],minimumMagnitude:p.minDataValue,maximumMagnitude:p.maxDataValue,minimumSymbolSize:p.minSize,maximumSymbolSize:p.maxSize};i.functionArguments=c;const d=q(i);return t.convertToRFT?A.A.fromJSON({rasterFunctionDefinition:d}):i}(e,t);case"raster-shaded-relief":return function(e,t){const i=t.convertToRFT;if("elevation"!==t.dataType&&("generic"!==t.dataType||1!==t.bandCount||"s16"!==t.pixelType&&"s32"!==t.pixelType&&"f32"!==t.pixelType&&"f64"!==t.pixelType))return new A.A;const r=new A.A;r.functionName="Hillshade";const s="traditional"===e.hillshadeType?0:1,n="none"===e.scalingType?1:3,o={HillshadeType:s,SlopeType:n,ZFactor:e.zFactor};return 0===s&&(o.Azimuth=e.azimuth,o.Altitude=e.altitude),3===n&&(o.PSPower=e.pixelSizePower,o.PSZFactor=e.pixelSizeFactor),r.functionArguments=o,r.variableName="Raster",e.colorRamp&&(r.functionName="ShadedRelief",i?o.ColorRamp=(0,D.hf)(e.colorRamp):o.Colormap=(0,D.R8)(e.colorRamp)),i?new A.A({rasterFunctionDefinition:q(r)}):r}(e,t);case"flow":throw new Error("Unsupported rendering rule.")}}(r,{rasterAttributeTable:i.attributeTable,pixelType:i.pixelType,dataType:i.dataType,bandNames:i.bandInfos.map((({name:e})=>e)),convertColorRampToColormap:t.version<10.6,convertToRFT:!!e?.rasterFunctionDefinition,bandCount:i.bandCount}),e):e}_addResampleRasterFunction(e){if("vector-field"!==this.layer.renderer?.type||"Resample"===e?.functionName)return e;const t="esriImageServiceDataTypeVector-UV"===this.layer.serviceDataType?7:10,i=this.layer.serviceRasterInfo.pixelSize;let r=new A.A({functionName:"Resample",functionArguments:{ResamplingType:t,InputCellSize:i}});return r=e?.rasterFunctionDefinition?new A.A({rasterFunctionDefinition:q(r)}):r,J(r,e)}};(0,r._)([(0,u.MZ)()],Q.prototype,"layer",void 0),(0,r._)([(0,u.MZ)({json:{write:!0}})],Q.prototype,"adjustAspectRatio",null),(0,r._)([(0,d.K)("adjustAspectRatio")],Q.prototype,"writeAdjustAspectRatio",null),(0,r._)([(0,u.MZ)({json:{write:!0}})],Q.prototype,"bandIds",null),(0,r._)([(0,u.MZ)({json:{write:!0}})],Q.prototype,"compression",void 0),(0,r._)([(0,u.MZ)({json:{write:!0}})],Q.prototype,"compressionQuality",null),(0,r._)([(0,d.K)("compressionQuality")],Q.prototype,"writeCompressionQuality",null),(0,r._)([(0,u.MZ)({json:{write:!0}})],Q.prototype,"compressionTolerance",null),(0,r._)([(0,d.K)("compressionTolerance")],Q.prototype,"writeCompressionTolerance",null),(0,r._)([(0,u.MZ)({json:{write:!0}})],Q.prototype,"format",null),(0,r._)([(0,u.MZ)({type:String,json:{read:{reader:k.SZ.read},write:{writer:k.SZ.write}}})],Q.prototype,"interpolation",null),(0,r._)([(0,u.MZ)({json:{write:!0}})],Q.prototype,"noData",null),(0,r._)([(0,u.MZ)({type:String,json:{read:{reader:k.hm.read},write:{writer:k.hm.write}}})],Q.prototype,"noDataInterpretation",null),(0,r._)([(0,u.MZ)({json:{write:!0}})],Q.prototype,"pixelType",void 0),(0,r._)([(0,u.MZ)({json:{write:!0}})],Q.prototype,"lercVersion",void 0),(0,r._)([(0,d.K)("lercVersion")],Q.prototype,"writeLercVersion",null),(0,r._)([(0,u.MZ)({type:Number})],Q.prototype,"version",null),(0,r._)([(0,u.MZ)({json:{write:!0}})],Q.prototype,"mosaicRule",null),(0,r._)([(0,u.MZ)({json:{write:!0,name:"renderingRule"}})],Q.prototype,"rasterFunction",null),Q=(0,r._)([(0,c.$)("esri.layers.support.ExportImageServiceParameters")],Q);var K=i(20437),Y=i(95466),W=i(33446),X=i(43577),ee=i(14140),te=i(87186),ie=i(69409),re=i(77301),se=i(51244),ne=i(14636),oe=i(12711),ae=i(85676),le=i(17136),ue=i(2272),pe=i(86738);const ce=e=>{let t=class extends e{constructor(){super(...arguments),this.make=null,this.model=null,this.focalLength=null,this.pixelSize=null,this.rows=null,this.cols=null}};return(0,r._)([(0,u.MZ)({json:{write:!0}})],t.prototype,"make",void 0),(0,r._)([(0,u.MZ)({json:{write:!0}})],t.prototype,"model",void 0),(0,r._)([(0,u.MZ)({json:{write:!0}})],t.prototype,"focalLength",void 0),(0,r._)([(0,u.MZ)({json:{write:!0}})],t.prototype,"pixelSize",void 0),(0,r._)([(0,u.MZ)({json:{write:!0}})],t.prototype,"rows",void 0),(0,r._)([(0,u.MZ)({json:{write:!0}})],t.prototype,"cols",void 0),t=(0,r._)([(0,c.$)("esri.rest.support.CameraInfoMixin")],t),t};let de=class extends(ce(x.oY)){constructor(){super(...arguments),this.id=null,this.referenceUri=null,this.acquisitionDate=null,this.cameraID=null,this.center=null,this.perspectiveCenter=null,this.orientation=null}writeAcquisitionDate(e,t){t.acquisitionDate=e?.getTime()}};(0,r._)([(0,u.MZ)({json:{write:!0}})],de.prototype,"id",void 0),(0,r._)([(0,u.MZ)({json:{name:"uri",write:!0}})],de.prototype,"referenceUri",void 0),(0,r._)([(0,u.MZ)({type:Date,json:{write:!0}})],de.prototype,"acquisitionDate",void 0),(0,r._)([(0,d.K)("acquisitionDate")],de.prototype,"writeAcquisitionDate",null),(0,r._)([(0,u.MZ)({json:{write:!0}})],de.prototype,"cameraID",void 0),(0,r._)([(0,u.MZ)({type:pe.A,json:{write:!0}})],de.prototype,"center",void 0),(0,r._)([(0,u.MZ)({type:pe.A,json:{write:!0}})],de.prototype,"perspectiveCenter",void 0),(0,r._)([(0,u.MZ)({json:{write:!0}})],de.prototype,"orientation",void 0),de=(0,r._)([(0,c.$)("esri.rest.support.ImageInspectionInfo")],de);const me=de;let he=class extends x.oY{constructor(){super(...arguments),this.images=null}};(0,r._)([(0,u.MZ)({type:[me],json:{write:!0}})],he.prototype,"images",void 0),he=(0,r._)([(0,c.$)("esri.rest.support.FindImagesResult")],he);const ye=he;var ge=i(16930);let fe=class extends x.oY{constructor(e){super(e),this.north=null,this.up=null,this.spatialReference=null}};(0,r._)([(0,u.MZ)({type:Number,json:{write:!0}})],fe.prototype,"north",void 0),(0,r._)([(0,u.MZ)({type:Number,json:{write:!0}})],fe.prototype,"up",void 0),(0,r._)([(0,u.MZ)({type:ge.A,json:{write:!0}})],fe.prototype,"spatialReference",void 0),fe=(0,r._)([(0,c.$)("esri.rest.support.ImageAngleResult")],fe);const we=fe;var ve=i(83047);let _e=class extends x.oY{constructor(){super(...arguments),this.value=null,this.displayValue=null,this.uncertainty=null}};(0,r._)([(0,u.MZ)({type:Number,json:{read:!0,write:!0}})],_e.prototype,"value",void 0),(0,r._)([(0,u.MZ)({type:String,json:{read:!0,write:!0}})],_e.prototype,"displayValue",void 0),(0,r._)([(0,u.MZ)({type:Number,json:{read:!0,write:!0}})],_e.prototype,"uncertainty",void 0),_e=(0,r._)([(0,c.$)("esri.rest.support.BaseImageMeasureResult.BaseImageMeasureResultValue")],_e);let Re=class extends _e{constructor(){super(...arguments),this.unit=null}};(0,r._)([(0,u.MZ)({type:String,json:{read:ve.Sk.read,write:ve.Sk.write}})],Re.prototype,"unit",void 0),Re=(0,r._)([(0,c.$)("esri.rest.support.BaseImageMeasureResult.ImageMeasureResultLengthValue")],Re);let be=class extends _e{constructor(){super(...arguments),this.unit=null}};(0,r._)([(0,u.MZ)({type:String,json:{read:ve.dk.read,write:ve.dk.write}})],be.prototype,"unit",void 0),be=(0,r._)([(0,c.$)("esri.rest.support.BaseImageMeasureResult.ImageMeasureResultAreaValue")],be);let Se=class extends _e{constructor(){super(...arguments),this.unit=null}};(0,r._)([(0,u.MZ)({type:String,json:{read:ve.b$.read,write:ve.b$.write}})],Se.prototype,"unit",void 0),Se=(0,r._)([(0,c.$)("esri.rest.support.BaseImageMeasureResult.ImageMeasureResultAngleValue")],Se);let Me=class extends x.oY{constructor(){super(...arguments),this.name=null,this.sensorName=null}};(0,r._)([(0,u.MZ)({type:String,json:{read:!0,write:!0}})],Me.prototype,"name",void 0),(0,r._)([(0,u.MZ)({type:String,json:{read:!0,write:!0}})],Me.prototype,"sensorName",void 0),Me=(0,r._)([(0,c.$)("esri.rest.support.BaseImageMeasureResult")],Me);let Fe=class extends Me{constructor(){super(...arguments),this.area=null,this.perimeter=null}};(0,r._)([(0,u.MZ)({type:be,json:{read:!0,write:!0}})],Fe.prototype,"area",void 0),(0,r._)([(0,u.MZ)({type:Re,json:{read:!0,write:!0}})],Fe.prototype,"perimeter",void 0),Fe=(0,r._)([(0,c.$)("esri.rest.support.ImageAreaResult")],Fe);const Ie=Fe;var xe=i(5443),Ae=i(39829);let je=class extends x.oY{constructor(){super(...arguments),this.area=null,this.geometry=null}readGeometry(e,t){return null==e?null:e.rings?Ae.A.fromJSON(e):xe.A.fromJSON(e)}};(0,r._)([(0,u.MZ)({type:Number,json:{write:!0}})],je.prototype,"area",void 0),(0,r._)([(0,u.MZ)({json:{name:"shape",write:!0}})],je.prototype,"geometry",void 0),(0,r._)([(0,S.w)("geometry")],je.prototype,"readGeometry",null),je=(0,r._)([(0,c.$)("esri.rest.support.ImageBoundaryResult")],je);const Ze=je;let De=class extends Me{constructor(){super(...arguments),this.distance=null,this.azimuthAngle=null,this.elevationAngle=null}};(0,r._)([(0,u.MZ)({type:Re,json:{read:!0,write:!0}})],De.prototype,"distance",void 0),(0,r._)([(0,u.MZ)({type:Se,json:{read:!0,write:!0}})],De.prototype,"azimuthAngle",void 0),(0,r._)([(0,u.MZ)({type:Se,json:{read:!0,write:!0}})],De.prototype,"elevationAngle",void 0),De=(0,r._)([(0,c.$)("esri.rest.support.ImageDistanceResult")],De);const Te=De;let Pe=class extends(ce(x.oY)){constructor(){super(...arguments),this.id=null}};(0,r._)([(0,u.MZ)({json:{write:!0}})],Pe.prototype,"id",void 0),Pe=(0,r._)([(0,c.$)("esri.rest.support.CameraInfo")],Pe);const Ne=Pe;let Oe=class extends x.oY{constructor(){super(...arguments),this.id=null,this.name=null,this.acquisitionDate=null,this.cameraID=null,this.center=null,this.gps=null,this.orientation=null}writeAcquisitionDate(e,t){t.acquisitionDate=e?.getTime()}};(0,r._)([(0,u.MZ)({json:{write:!0}})],Oe.prototype,"id",void 0),(0,r._)([(0,u.MZ)({json:{write:!0}})],Oe.prototype,"name",void 0),(0,r._)([(0,u.MZ)({type:Date,json:{write:!0}})],Oe.prototype,"acquisitionDate",void 0),(0,r._)([(0,d.K)("acquisitionDate")],Oe.prototype,"writeAcquisitionDate",null),(0,r._)([(0,u.MZ)({json:{write:!0}})],Oe.prototype,"cameraID",void 0),(0,r._)([(0,u.MZ)({type:pe.A,json:{write:!0}})],Oe.prototype,"center",void 0),(0,r._)([(0,u.MZ)({json:{write:!0}})],Oe.prototype,"gps",void 0),(0,r._)([(0,u.MZ)({json:{write:!0}})],Oe.prototype,"orientation",void 0),Oe=(0,r._)([(0,c.$)("esri.rest.support.ImageGPSInfo")],Oe);const Ce=Oe;let Ve=class extends x.oY{constructor(){super(...arguments),this.images=null,this.cameras=null}};(0,r._)([(0,u.MZ)({type:[Ce],json:{write:!0}})],Ve.prototype,"images",void 0),(0,r._)([(0,u.MZ)({type:[Ne],json:{write:!0}})],Ve.prototype,"cameras",void 0),Ve=(0,r._)([(0,c.$)("esri.rest.support.ImageGPSInfoResult")],Ve);const Je=Ve;let Ee=class extends Me{constructor(){super(...arguments),this.height=null}};(0,r._)([(0,u.MZ)({type:Re,json:{read:!0,write:!0}})],Ee.prototype,"height",void 0),Ee=(0,r._)([(0,c.$)("esri.rest.support.ImageHeightResult")],Ee);const qe=Ee;var Ge=i(22671);let Le=class extends x.oY{constructor(){super(...arguments),this.catalogItemVisibilities=null,this.catalogItems=null,this.location=null,this.name=null,this.objectId=null,this.processedValues=null,this.properties=null,this.value=null}};(0,r._)([(0,u.MZ)({json:{write:!0}})],Le.prototype,"catalogItemVisibilities",void 0),(0,r._)([(0,u.MZ)({type:Ge.A,json:{write:!0}})],Le.prototype,"catalogItems",void 0),(0,r._)([(0,u.MZ)({type:pe.A,json:{write:!0}})],Le.prototype,"location",void 0),(0,r._)([(0,u.MZ)({json:{write:!0}})],Le.prototype,"name",void 0),(0,r._)([(0,u.MZ)({json:{write:!0}})],Le.prototype,"objectId",void 0),(0,r._)([(0,u.MZ)({json:{write:!0}})],Le.prototype,"processedValues",void 0),(0,r._)([(0,u.MZ)({json:{write:!0}})],Le.prototype,"properties",void 0),(0,r._)([(0,u.MZ)({json:{write:!0}})],Le.prototype,"value",void 0),Le=(0,r._)([(0,c.$)("esri.rest.support.ImageIdentifyResult")],Le);const ze=Le;let Be=class extends x.oY{constructor(){super(...arguments),this.geometries=null}};(0,r._)([(0,u.MZ)({json:{write:!0}})],Be.prototype,"geometries",void 0),Be=(0,r._)([(0,c.$)("esri.rest.support.ImagePixelLocationResult")],Be);const $e=Be;let Ue=class extends Me{constructor(){super(...arguments),this.point=null}};(0,r._)([(0,u.MZ)({type:pe.A,json:{name:"point.value",read:!0,write:!0}})],Ue.prototype,"point",void 0),Ue=(0,r._)([(0,c.$)("esri.rest.support.ImagePointResult")],Ue);const He=Ue;let ke=class extends x.oY{constructor(){super(...arguments),this.attributes=null,this.location=null,this.locationId=null,this.rasterId=null,this.resolution=null,this.pixelValue=null}};(0,r._)([(0,u.MZ)({json:{write:!0}})],ke.prototype,"attributes",void 0),(0,r._)([(0,u.MZ)({type:pe.A,json:{write:!0}})],ke.prototype,"location",void 0),(0,r._)([(0,u.MZ)({json:{write:!0}})],ke.prototype,"locationId",void 0),(0,r._)([(0,u.MZ)({json:{write:!0}})],ke.prototype,"rasterId",void 0),(0,r._)([(0,u.MZ)({json:{write:!0}})],ke.prototype,"resolution",void 0),(0,r._)([(0,u.MZ)({json:{write:!0}})],ke.prototype,"pixelValue",void 0),ke=(0,r._)([(0,c.$)("esri.rest.support.ImageSample")],ke);const Qe=ke;let Ke=class extends x.oY{constructor(){super(...arguments),this.samples=null}};(0,r._)([(0,u.MZ)({type:[Qe],json:{write:!0}})],Ke.prototype,"samples",void 0),Ke=(0,r._)([(0,c.$)("esri.rest.support.ImageSampleResult")],Ke);const Ye=Ke;let We=class extends x.oY{constructor(){super(...arguments),this.url=null}};(0,r._)([(0,u.MZ)({json:{name:"imageURL",write:!0}})],We.prototype,"url",void 0),We=(0,r._)([(0,c.$)("esri.rest.support.ImageUrlResult")],We);const Xe=We;var et=i(65864);let tt=class extends x.oY{constructor(){super(...arguments),this.geometry=null,this.length=null,this.area=null,this.center=null}readCenter(e,t){return e.spatialReference||(e={...e,spatialReference:t.Shape.spatialReference}),pe.A.fromJSON(e)}};(0,r._)([(0,u.MZ)({types:h.yR,json:{name:"Shape",read:et.rS,write:!0}})],tt.prototype,"geometry",void 0),(0,r._)([(0,u.MZ)({json:{name:"Length",write:!0}})],tt.prototype,"length",void 0),(0,r._)([(0,u.MZ)({json:{name:"Area",write:!0}})],tt.prototype,"area",void 0),(0,r._)([(0,u.MZ)({json:{name:"Center",write:!0}})],tt.prototype,"center",void 0),(0,r._)([(0,S.w)("center")],tt.prototype,"readCenter",null),tt=(0,r._)([(0,c.$)("esri.rest.support.MeasureAreaFromImageResult")],tt);const it=tt;let rt=class extends x.oY{constructor(){super(...arguments),this.geometry=null,this.length=null}};(0,r._)([(0,u.MZ)({types:h.yR,json:{name:"Shape",read:et.rS,write:!0}})],rt.prototype,"geometry",void 0),(0,r._)([(0,u.MZ)({json:{name:"Length",write:!0}})],rt.prototype,"length",void 0),rt=(0,r._)([(0,c.$)("esri.rest.support.MeasureLengthFromImageResult")],rt);const st=rt;function nt(e){const t=e?.time;if(t&&(null!=t.start||null!=t.end)){const i=[];null!=t.start&&i.push(t.start),null==t.end||i.includes(t.end)||i.push(t.end),e.time=i.join(",")}}async function ot(e,t,i){const r=(0,ue.Dl)(e),s=t.geometry?[t.geometry]:[],n=await(0,le.el)(s),o=t.toJSON();nt(o);const a=n?.[0];null!=a&&(o.geometry=pt(a));const l=(0,ue.lF)({...r.query,f:"json",...o});return(0,ue.jV)(l,i)}async function at(e,t,i){const r=(0,ue.Dl)(e),s=t.geometry?[t.geometry]:[];return(0,le.el)(s).then((e=>{const s=t.toJSON(),n=e?.[0];null!=n&&(s.geometry=JSON.stringify(pt(n)));const o=(0,ue.lF)({...r.query,f:"json",...s}),a=(0,ue.jV)(o,i);return(0,f.A)(r.path+"/identify",a)})).then((e=>ze.fromJSON(e.data)))}async function lt(e,t,i,r){const s=(0,ue.Dl)(e),n=await(0,le.el)(i),o=t.toJSON();null!=n[0]&&(o.fromGeometry=JSON.stringify(pt(n[0]))),null!=n[1]&&(o.toGeometry=JSON.stringify(pt(n[1])));const a=(0,ue.lF)({...s.query,f:"json",...o}),l=(0,ue.jV)(a,r),{data:u}=await(0,f.A)(s.path+"/measure",l);return u}async function ut(e,t,i){const r=(0,ue.Dl)(e),s=t.toJSON(),n=(0,ue.lF)({...r.query,f:"json",...s}),o=(0,ue.jV)(n,i),{data:a}=await(0,f.A)(r.path+"/measureFromImage",o);return a}function pt(e){const t=e.toJSON();return e.spatialReference?.imageCoordinateSystem&&(t.spatialReference=ct(e.spatialReference)),t}function ct(e){const{imageCoordinateSystem:t}=e;if(t){const{id:e,referenceServiceName:i}=t;return null!=e?i?{icsid:e,icsns:i}:{icsid:e}:{ics:t}}return e.toJSON()}function dt(e,t){if(!e.imageCoordinateSystem)return(0,M.YX)(e);const i=ct(e),{icsid:r,icsns:s}=i;return null==r||null!=s&&!t?.toLowerCase().includes("/"+s.toLowerCase()+"/")?JSON.stringify(i):`0:${r}`}i(27733);var mt=i(99199),ht=(i(92602),i(70333),i(73941),i(70328),i(34727),i(91075),i(48526)),yt=(i(82799),i(80754),i(79258),i(51624),i(61956)),gt=(i(77073),i(54546),i(20615)),ft=i(78286),wt=(i(26591),i(57561),i(82371)),vt=i(20223);let _t=class extends((0,n.O)(x.oY)){constructor(){super(...arguments),this.fromGeometry=null,this.toGeometry=null,this.objectIds=null,this.where=null,this.maxCount=null}};(0,r._)([(0,u.MZ)({type:pe.A,json:{read:!0}})],_t.prototype,"fromGeometry",void 0),(0,r._)([(0,u.MZ)({type:pe.A,json:{read:!0,write:!0}})],_t.prototype,"toGeometry",void 0),(0,r._)([(0,u.MZ)({json:{write:!0}})],_t.prototype,"objectIds",void 0),(0,r._)([(0,u.MZ)({type:String,json:{write:!0}})],_t.prototype,"where",void 0),(0,r._)([(0,u.MZ)({type:Number,json:{write:!0}})],_t.prototype,"maxCount",void 0),_t=(0,r._)([(0,c.$)("esri.rest.support.FindImagesParameters")],_t);const Rt=_t;var bt;let St=bt=class extends x.oY{constructor(e){super(e),this.angleNames=null,this.point=null,this.spatialReference=null,this.rasterId=null}clone(){return new bt((0,v.o8)({angleNames:this.angleNames,point:this.point,spatialReference:this.spatialReference,rasterId:this.rasterId}))}};(0,r._)([(0,u.MZ)({type:[String],json:{name:"angleName",write:!0}})],St.prototype,"angleNames",void 0),(0,r._)([(0,u.MZ)({type:pe.A,json:{write:!0}})],St.prototype,"point",void 0),(0,r._)([(0,u.MZ)({type:ge.A,json:{write:!0}})],St.prototype,"spatialReference",void 0),(0,r._)([(0,u.MZ)({type:b.jz,json:{write:!0}})],St.prototype,"rasterId",void 0),St=bt=(0,r._)([(0,c.$)("esri.rest.support.ImageAngleParameters")],St);const Mt=St,Ft=new(i(66552).J)({esriMensurationPoint:"point",esriMensurationCentroid:"centroid",esriMensurationDistanceAndAngle:"distance-and-angle",esriMensurationAreaAndPerimeter:"area-and-perimeter",esriMensurationHeightFromBaseAndTop:"base-and-top",esriMensurationHeightFromBaseAndTopShadow:"base-and-top-shadow",esriMensurationHeightFromTopAndTopShadow:"top-and-top-shadow",esriMensurationPoint3D:"point-3D",esriMensurationCentroid3D:"centroid-3D",esriMensurationDistanceAndAngle3D:"distance-and-angle-3D",esriMensurationAreaAndPerimeter3D:"area-and-perimeter-3D"});let It=class extends x.oY{constructor(){super(...arguments),this.type=null,this.measureOperation=null,this.mosaicRule=null,this.pixelSize=null,this.raster=void 0}};var xt;(0,r._)([(0,u.MZ)()],It.prototype,"type",void 0),(0,r._)([(0,u.MZ)({type:Ft.apiValues,json:{read:Ft.read,write:Ft.write}})],It.prototype,"measureOperation",void 0),(0,r._)([(0,u.MZ)({type:H.A,json:{write:!0}})],It.prototype,"mosaicRule",void 0),(0,r._)([(0,u.MZ)({type:pe.A,json:{write:!0}})],It.prototype,"pixelSize",void 0),(0,r._)([(0,u.MZ)({json:{write:!0}})],It.prototype,"raster",void 0),It=(0,r._)([(0,c.$)("esri.rest.support.BaseImageMeasureParameters")],It);let At=xt=class extends It{constructor(){super(...arguments),this.type="area-perimeter",this.geometry=null,this.is3D=!1,this.linearUnit="meters",this.areaUnit="square-meters"}writeGeometry(e,t,i){null!=e&&(t.geometryType=(0,et.$B)(e),t[i]=e.toJSON())}get measureOperation(){return this.is3D?"area-and-perimeter-3D":"area-and-perimeter"}clone(){return new xt((0,v.o8)({geometry:this.geometry,is3D:this.is3D,linearUnit:this.linearUnit,areaUnit:this.areaUnit,mosaicRule:this.mosaicRule,pixelSize:this.pixelSize,raster:this.raster}))}};(0,r._)([(0,u.MZ)({types:h.yR,json:{name:"fromGeometry",read:!0,write:!0}})],At.prototype,"geometry",void 0),(0,r._)([(0,d.K)("geometry")],At.prototype,"writeGeometry",null),(0,r._)([(0,u.MZ)({type:Ft.apiValues,json:{write:Ft.write}})],At.prototype,"measureOperation",null),(0,r._)([(0,u.MZ)({json:{read:!0}})],At.prototype,"is3D",void 0),(0,r._)([(0,u.MZ)({type:String,json:{read:ve.Sk.read,write:ve.Sk.write}})],At.prototype,"linearUnit",void 0),(0,r._)([(0,u.MZ)({type:String,json:{read:ve.dk.read,write:ve.dk.write}})],At.prototype,"areaUnit",void 0),At=xt=(0,r._)([(0,c.$)("esri.rest.support.ImageAreaParameters")],At);const jt=At;let Zt=class extends((0,n.O)(x.oY)){constructor(){super(...arguments),this.outSpatialReference=null}};(0,r._)([(0,u.MZ)({type:ge.A,json:{name:"outSR",write:!0}})],Zt.prototype,"outSpatialReference",void 0),Zt=(0,r._)([(0,c.$)("esri.rest.support.ImageBoundaryParameters")],Zt);const Dt=Zt;var Tt;let Pt=Tt=class extends It{constructor(){super(...arguments),this.type="distance-angle",this.fromGeometry=null,this.toGeometry=null,this.is3D=!1,this.linearUnit="meters",this.angularUnit="degrees"}writeFromGeometry(e,t,i){null!=e&&(t.geometryType=(0,et.$B)(e),t[i]=e.toJSON())}get measureOperation(){return this.is3D?"distance-and-angle-3D":"distance-and-angle"}clone(){return new Tt((0,v.o8)({fromGeometry:this.fromGeometry,toGeometry:this.toGeometry,is3D:this.is3D,linearUnit:this.linearUnit,angularUnit:this.angularUnit,mosaicRule:this.mosaicRule,pixelSize:this.pixelSize,raster:this.raster}))}};(0,r._)([(0,u.MZ)({type:pe.A,json:{read:!0,write:!0}})],Pt.prototype,"fromGeometry",void 0),(0,r._)([(0,d.K)("fromGeometry")],Pt.prototype,"writeFromGeometry",null),(0,r._)([(0,u.MZ)({type:pe.A,json:{read:!0,write:!0}})],Pt.prototype,"toGeometry",void 0),(0,r._)([(0,u.MZ)({type:Ft.apiValues,json:{write:Ft.write}})],Pt.prototype,"measureOperation",null),(0,r._)([(0,u.MZ)({json:{read:!0}})],Pt.prototype,"is3D",void 0),(0,r._)([(0,u.MZ)({type:String,json:{read:ve.Sk.read,write:ve.Sk.write}})],Pt.prototype,"linearUnit",void 0),(0,r._)([(0,u.MZ)({type:String,json:{read:ve.b$.read,write:ve.b$.write}})],Pt.prototype,"angularUnit",void 0),Pt=Tt=(0,r._)([(0,c.$)("esri.rest.support.ImageDistanceParameters")],Pt);const Nt=Pt;var Ot=i(60945),Ct=i(93223),Vt=i(58174);let Jt=class extends((0,n.O)(x.oY)){constructor(){super(...arguments),this.geometry=null,this.objectIds=null,this.spatialRelationship="intersects",this.timeExtent=null,this.where=null}writeGeometry(e,t,i){null!=e&&(t.geometryType=(0,et.$B)(e),t[i]=JSON.stringify(e.toJSON()))}};(0,r._)([(0,u.MZ)({types:h.yR,json:{read:et.rS,write:!0}})],Jt.prototype,"geometry",void 0),(0,r._)([(0,d.K)("geometry")],Jt.prototype,"writeGeometry",null),(0,r._)([(0,u.MZ)({json:{write:!0}})],Jt.prototype,"objectIds",void 0),(0,r._)([(0,Ct.e)(Vt.x,{ignoreUnknown:!1,name:"spatialRel"})],Jt.prototype,"spatialRelationship",void 0),(0,r._)([(0,u.MZ)({type:Ot.A,json:{name:"time",write:!0}})],Jt.prototype,"timeExtent",void 0),(0,r._)([(0,u.MZ)({type:String,json:{write:!0}})],Jt.prototype,"where",void 0),Jt=(0,r._)([(0,c.$)("esri.rest.support.ImageGPSInfoParameters")],Jt);const Et=Jt;var qt;let Gt=qt=class extends It{constructor(){super(...arguments),this.type="height",this.fromGeometry=null,this.toGeometry=null,this.operationType="base-and-top",this.linearUnit="meters"}writeFromGeometry(e,t,i){null!=e&&(t.geometryType=(0,et.$B)(e),t[i]=e.toJSON())}get measureOperation(){return this.operationType}clone(){return new qt((0,v.o8)({fromGeometry:this.fromGeometry,toGeometry:this.toGeometry,operationType:this.operationType,linearUnit:this.linearUnit,mosaicRule:this.mosaicRule,pixelSize:this.pixelSize,raster:this.raster}))}};(0,r._)([(0,u.MZ)({type:pe.A,json:{read:!0}})],Gt.prototype,"fromGeometry",void 0),(0,r._)([(0,d.K)("fromGeometry")],Gt.prototype,"writeFromGeometry",null),(0,r._)([(0,u.MZ)({type:pe.A,json:{read:!0,write:!0}})],Gt.prototype,"toGeometry",void 0),(0,r._)([(0,u.MZ)({type:Ft.apiValues,json:{write:Ft.write}})],Gt.prototype,"measureOperation",null),(0,r._)([(0,u.MZ)({json:{read:!0}})],Gt.prototype,"operationType",void 0),(0,r._)([(0,u.MZ)({type:String,json:{read:ve.Sk.read,write:ve.Sk.write}})],Gt.prototype,"linearUnit",void 0),Gt=qt=(0,r._)([(0,c.$)("esri.rest.support.ImageHeightParameters")],Gt);const Lt=Gt;var zt,Bt=i(22048);let $t=zt=class extends x.oY{constructor(){super(...arguments),this.geometry=null,this.rasterFunctions=null,this.pixelSize=null,this.returnGeometry=!0,this.returnCatalogItems=!0,this.returnPixelValues=!0,this.maxItemCount=null,this.timeExtent=null,this.raster=void 0,this.viewId=void 0,this.processAsMultidimensional=!1}writeGeometry(e,t,i){null!=e&&(t.geometryType=(0,et.$B)(e),t[i]=JSON.stringify(e.toJSON()))}set mosaicRule(e){let t=e;t?.mosaicMethod&&(t=H.A.fromJSON({...t.toJSON(),mosaicMethod:t.mosaicMethod,mosaicOperation:t.mosaicOperation})),this._set("mosaicRule",t)}writeMosaicRule(e,t,i){null!=e&&(t[i]=JSON.stringify(e.toJSON()))}get renderingRule(){return(0,w.Lx)(p.A.getLogger(this),"renderingRule",{replacement:"rasterFunction",version:"4.27",warnOnce:!0}),this._get("rasterFunction")}set renderingRule(e){(0,w.Lx)(p.A.getLogger(this),"renderingRule",{replacement:"rasterFunction",version:"4.27",warnOnce:!0}),this._set("rasterFunction",e)}get renderingRules(){return(0,w.Lx)(p.A.getLogger(this),"renderingRules",{replacement:"rasterFunctions",version:"4.27",warnOnce:!0}),this._get("rasterFunctions")}set renderingRules(e){(0,w.Lx)(p.A.getLogger(this),"renderingRules",{replacement:"rasterFunctions",version:"4.27",warnOnce:!0}),this._set("rasterFunctions",e)}set rasterFunction(e){let t=e;t?.rasterFunction&&(t=A.A.fromJSON({...t.toJSON(),rasterFunction:t.rasterFunction,rasterFunctionArguments:t.rasterFunctionArguments})),this._set("rasterFunction",t)}writeRasterFunction(e,t,i){null!=e&&(t[i]=JSON.stringify(e.toJSON())),e.rasterFunctionDefinition&&(t[i]=JSON.stringify(e.rasterFunctionDefinition))}writeRasterFunctions(e,t,i){null!=e&&(t[i]=JSON.stringify(e.map((e=>e.rasterFunctionDefinition||e.toJSON()))))}writePixelSize(e,t,i){null!=e&&(t[i]=JSON.stringify(e))}writeTimeExtent(e,t,i){if(null!=e){const r=null!=e.start?e.start.getTime():null,s=null!=e.end?e.end.getTime():null;t[i]=null!=r?null!=s?`${r},${s}`:`${r}`:null}}clone(){return new zt((0,v.o8)({geometry:this.geometry,mosaicRule:this.mosaicRule,rasterFunction:this.rasterFunction,rasterFunctions:this.rasterFunctions,pixelSize:this.pixelSize,returnGeometry:this.returnGeometry,returnCatalogItems:this.returnCatalogItems,returnPixelValues:this.returnPixelValues,maxItemCount:this.maxItemCount,processAsMultidimensional:this.processAsMultidimensional,raster:this.raster,viewId:this.viewId,timeExtent:this.timeExtent}))}};(0,r._)([(0,u.MZ)({json:{write:!0}})],$t.prototype,"geometry",void 0),(0,r._)([(0,d.K)("geometry")],$t.prototype,"writeGeometry",null),(0,r._)([(0,u.MZ)({type:H.A,json:{write:!0}})],$t.prototype,"mosaicRule",null),(0,r._)([(0,d.K)("mosaicRule")],$t.prototype,"writeMosaicRule",null),(0,r._)([(0,u.MZ)({type:A.A})],$t.prototype,"renderingRule",null),(0,r._)([(0,u.MZ)({type:[A.A]})],$t.prototype,"renderingRules",null),(0,r._)([(0,u.MZ)({type:A.A,json:{write:!0,name:"renderingRule"}})],$t.prototype,"rasterFunction",null),(0,r._)([(0,d.K)("rasterFunction")],$t.prototype,"writeRasterFunction",null),(0,r._)([(0,u.MZ)({type:[A.A],json:{write:!0,name:"renderingRules"}})],$t.prototype,"rasterFunctions",void 0),(0,r._)([(0,d.K)("rasterFunctions")],$t.prototype,"writeRasterFunctions",null),(0,r._)([(0,u.MZ)({type:pe.A,json:{write:!0}})],$t.prototype,"pixelSize",void 0),(0,r._)([(0,d.K)("pixelSize")],$t.prototype,"writePixelSize",null),(0,r._)([(0,u.MZ)({type:Boolean,json:{write:!0}})],$t.prototype,"returnGeometry",void 0),(0,r._)([(0,u.MZ)({type:Boolean,json:{write:!0}})],$t.prototype,"returnCatalogItems",void 0),(0,r._)([(0,u.MZ)({type:Boolean,json:{write:!0}})],$t.prototype,"returnPixelValues",void 0),(0,r._)([(0,u.MZ)({type:Number,json:{write:!0}})],$t.prototype,"maxItemCount",void 0),(0,r._)([(0,u.MZ)({type:Ot.A,json:{write:{target:"time"}}})],$t.prototype,"timeExtent",void 0),(0,r._)([(0,d.K)("timeExtent")],$t.prototype,"writeTimeExtent",null),(0,r._)([(0,u.MZ)({json:{write:!0}})],$t.prototype,"raster",void 0),(0,r._)([(0,u.MZ)({json:{write:!0}})],$t.prototype,"viewId",void 0),(0,r._)([(0,u.MZ)({type:Boolean,json:{write:!0}})],$t.prototype,"processAsMultidimensional",void 0),$t=zt=(0,r._)([(0,c.$)("esri.rest.support.ImageIdentifyParameters")],$t);const Ut=$t;var Ht;let kt=Ht=class extends x.oY{constructor(){super(...arguments),this.geometries=null,this.rasterId=null}writeGeometry(e,t,i){t.geometries={geometryType:"esriGeometryPoint",geometries:e.map((e=>e.toJSON()))}}clone(){return new Ht({geometries:this.geometries?.map((e=>e.clone()))??[],rasterId:this.rasterId})}};(0,r._)([(0,u.MZ)({type:[pe.A],json:{write:!0}})],kt.prototype,"geometries",void 0),(0,r._)([(0,d.K)("geometries")],kt.prototype,"writeGeometry",null),(0,r._)([(0,u.MZ)({type:b.jz,json:{write:!0}})],kt.prototype,"rasterId",void 0),kt=Ht=(0,r._)([(0,c.$)("esri.rest.support.ImagePixelLocationParameters")],kt);const Qt=kt;var Kt;let Yt=Kt=class extends It{constructor(){super(...arguments),this.type="point",this.geometry=null,this.is3D=!1}writeGeometry(e,t,i){null!=e&&(t.geometryType=(0,et.$B)(e),t[i]=e.toJSON())}get measureOperation(){const{is3D:e,geometry:t}=this;return"point"===t.type?e?"point-3D":"point":e?"centroid-3D":"centroid"}clone(){return new Kt((0,v.o8)({geometry:this.geometry,is3D:this.is3D,mosaicRule:this.mosaicRule,pixelSize:this.pixelSize,raster:this.raster}))}};(0,r._)([(0,u.MZ)({types:h.yR,json:{name:"fromGeometry",read:et.rS}})],Yt.prototype,"geometry",void 0),(0,r._)([(0,d.K)("geometry")],Yt.prototype,"writeGeometry",null),(0,r._)([(0,u.MZ)({type:Ft.apiValues,json:{read:Ft.read,write:Ft.write}})],Yt.prototype,"measureOperation",null),(0,r._)([(0,u.MZ)({json:{read:!0}})],Yt.prototype,"is3D",void 0),Yt=Kt=(0,r._)([(0,c.$)("esri.rest.support.ImagePointParameters")],Yt);const Wt=Yt;var Xt;let ei=Xt=class extends x.oY{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(e,t,i){null!=e&&(t.geometryType=(0,et.$B)(e),t[i]=e.toJSON())}set locations(e){if(e?.length){const t=new ht.A({spatialReference:e[0].spatialReference,points:e.map((({x:e,y:t})=>[e,t]))});this._set("locations",e),this.geometry=t}}clone(){return new Xt((0,v.o8)({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}))}};(0,r._)([(0,u.MZ)({types:h.yR,json:{read:et.rS}})],ei.prototype,"geometry",void 0),(0,r._)([(0,d.K)("geometry")],ei.prototype,"writeGeometry",null),(0,r._)([(0,u.MZ)()],ei.prototype,"locations",null),(0,r._)([(0,u.MZ)({type:String,json:{type:k.SZ.jsonValues,read:k.SZ.read,write:k.SZ.write}})],ei.prototype,"interpolation",void 0),(0,r._)([(0,u.MZ)({type:H.A,json:{write:!0}})],ei.prototype,"mosaicRule",void 0),(0,r._)([(0,u.MZ)({type:[String],json:{write:!0}})],ei.prototype,"outFields",void 0),(0,r._)([(0,u.MZ)({type:pe.A,json:{write:!0}})],ei.prototype,"pixelSize",void 0),(0,r._)([(0,u.MZ)({type:String,json:{write:!0}})],ei.prototype,"raster",void 0),(0,r._)([(0,u.MZ)({type:Boolean,json:{write:!0}})],ei.prototype,"returnFirstValueOnly",void 0),(0,r._)([(0,u.MZ)({type:Number,json:{write:!0}})],ei.prototype,"sampleDistance",void 0),(0,r._)([(0,u.MZ)({type:Number,json:{write:!0}})],ei.prototype,"sampleCount",void 0),(0,r._)([(0,u.MZ)({type:Number,json:{write:!0}})],ei.prototype,"sliceId",void 0),(0,r._)([(0,u.MZ)({type:Ot.A,json:{read:{source:"time"},write:{target:"time"}}})],ei.prototype,"timeExtent",void 0),ei=Xt=(0,r._)([(0,c.$)("esri.rest.support.ImageSampleParameters")],ei);const ti=ei;let ii=class extends((0,n.O)(x.oY)){constructor(){super(...arguments),this.geometries=[],this.rasterIds=null,this.outSpatialReference=null}writeGeometries(e,t,i){t.geometries=e?.length?{geometryType:(0,et.$B)(e[0]),geometries:e.map((e=>({...e.toJSON(),spatialReference:void 0})))}:null}};(0,r._)([(0,u.MZ)({types:[h.yR]})],ii.prototype,"geometries",void 0),(0,r._)([(0,d.K)("geometries")],ii.prototype,"writeGeometries",null),(0,r._)([(0,u.MZ)({type:[b.jz],json:{write:!0}})],ii.prototype,"rasterIds",void 0),(0,r._)([(0,u.MZ)({type:ge.A,json:{name:"outSR",write:!0}})],ii.prototype,"outSpatialReference",void 0),ii=(0,r._)([(0,c.$)("esri.rest.support.ImageToMapMultirayParameters")],ii);const ri=ii;let si=class extends((0,n.O)(x.oY)){constructor(){super(...arguments),this.geometry=null,this.rasterId=null,this.outSpatialReference=null,this.depthOffset=0,this.adjust=!1}writeGeometry(e,t,i){null!=e&&(t.geometryType=(0,et.$B)(e),t[i]={...e.toJSON(),spatialReference:void 0})}};(0,r._)([(0,u.MZ)({types:h.yR,json:{read:et.rS,write:!0}})],si.prototype,"geometry",void 0),(0,r._)([(0,d.K)("geometry")],si.prototype,"writeGeometry",null),(0,r._)([(0,u.MZ)({json:{write:!0}})],si.prototype,"rasterId",void 0),(0,r._)([(0,u.MZ)({type:ge.A,json:{name:"outSR",write:!0}})],si.prototype,"outSpatialReference",void 0),(0,r._)([(0,u.MZ)({json:{name:"options.DOff",write:!0}})],si.prototype,"depthOffset",void 0),(0,r._)([(0,u.MZ)({json:{name:"options.Adjust",write:!0}})],si.prototype,"adjust",void 0),si=(0,r._)([(0,c.$)("esri.rest.support.ImageToMapParameters")],si);const ni=si;let oi=class extends((0,n.O)(x.oY)){constructor(){super(...arguments),this.referenceUri=null}};(0,r._)([(0,u.MZ)({type:String,json:{name:"uri",write:!0}})],oi.prototype,"referenceUri",void 0),oi=(0,r._)([(0,c.$)("esri.rest.support.ImageUrlParameters")],oi);const ai=oi;let li=class extends((0,n.O)(x.oY)){constructor(){super(...arguments),this.geometry=null,this.rasterId=null,this.visibleOnly=!1}writeGeometry(e,t,i){null!=e&&(t.geometryType=(0,et.$B)(e),t[i]=JSON.stringify(e))}};(0,r._)([(0,u.MZ)({types:h.yR,json:{read:et.rS,write:!0}})],li.prototype,"geometry",void 0),(0,r._)([(0,d.K)("geometry")],li.prototype,"writeGeometry",null),(0,r._)([(0,u.MZ)({json:{write:!0}})],li.prototype,"rasterId",void 0),(0,r._)([(0,u.MZ)({json:{name:"options.VisibleOnly",write:!0}})],li.prototype,"visibleOnly",void 0),li=(0,r._)([(0,c.$)("esri.rest.support.MapToImageParameters")],li);const ui=li;var pi;let ci=pi=class extends x.oY{constructor(){super(...arguments),this.geometry=null,this.rasterId=void 0}writeGeometry(e,t,i){null!=e&&(t.geometryType=(0,et.$B)(e),t[i]={...e.toJSON(),spatialReference:void 0})}clone(){const e=(0,v.o8)({geometry:this.geometry,rasterId:this.rasterId});return new pi(e)}};(0,r._)([(0,u.MZ)({types:h.yR,json:{name:"fromGeometry",read:et.rS,write:!0}})],ci.prototype,"geometry",void 0),(0,r._)([(0,d.K)("geometry")],ci.prototype,"writeGeometry",null),(0,r._)([(0,u.MZ)({json:{write:!0}})],ci.prototype,"rasterId",void 0),ci=pi=(0,r._)([(0,c.$)("esri.rest.support.MeasureFromImageParameters")],ci);const di=ci;var mi=i(4095);const hi=new Set(["png","png8","png24","png32","jpg","bmp","gif","jpgpng","lerc","tiff"]),yi=(0,u.Qp)(b.GB,{min:0,max:255}),gi=e=>{let t=class extends e{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 Q({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,i){null!=e&&"lerc"!==this.format&&(t[i]=e)}writeCompressionTolerance(e,t,i){"lerc"===this.format&&null!=e&&(t[i]=e)}readDefaultMosaicRule(e,t){return this._serviceSupportsMosaicRule?H.A.fromJSON(t):null}get fieldsIndex(){return this.fields?new Y.A(this.fields):null}set format(e){e&&hi.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=H.A.fromJSON({...t.toJSON(),mosaicMethod:t.mosaicMethod,mosaicOperation:t.mosaicOperation})),this._set("mosaicRule",t)}readMosaicRule(e,t){const i=e||t.mosaicRule;return i?H.A.fromJSON(i):this._isMosaicRuleSupported(t)?H.A.fromJSON(t):null}writeMosaicRule(e,t,i){let r=this.mosaicRule;const s=this.definitionExpression;r?s&&s!==r.where&&(r=r.clone(),r.where=s):s&&(r=new H.A({where:s})),this._isValidCustomizedMosaicRule(r)&&(t[i]=r.toJSON())}writeNoData(e,t,i){null!=e&&"number"==typeof e&&(t[i]=yi(e))}readObjectIdField(e,t){if(!e){const i=t.fields.find((e=>"esriFieldTypeOID"===e.type||"oid"===e.type));e=i?.name}return e}get parsedUrl(){return(0,R.An)(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,i){const r=t?.layerDefinition?.drawingInfo?.renderer,s=(0,g.LF)(r,i);return null==s?null:("vector-field"===s.type&&t.symbolTileSize&&!r.symbolTileSize&&(s.symbolTileSize=t.symbolTileSize),V(s)||p.A.getLogger(this).warn("ArcGISImageService","Imagery layer doesn't support given renderer type."),s)}writeRenderer(e,t,i){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 K.A({name:"Raster.ItemPixelValue",alias:"Item Pixel Value",domain:null,editable:!1,length:50,type:"string"}),i=new K.A({name:"Raster.ServicePixelValue",alias:"Service Pixel Value",domain:null,editable:!1,length:50,type:"string"}),r=new K.A({name:"Raster.ServicePixelValue.Raw",alias:"Raw Service Pixel Value",domain:null,editable:!1,length:50,type:"string"});let s=this.fields?(0,v.o8)(this.fields):[];s.push(i),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(r),null!=this.rasterFunctionInfos&&this.rasterFunctionInfos.filter((e=>"none"!==e.name.toLowerCase())).forEach((e=>{s.push(new K.A({name:"Raster.ServicePixelValue."+e.name,alias:e.name,domain:null,editable:!1,length:50,type:"string"}))})),this._isVectorDataSet()&&(s.push(new K.A({name:"Raster.Magnitude",alias:"Magnitude",domain:null,editable:!1,type:"double"})),s.push(new K.A({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 i=(0,v.o8)(t);return i.name=e+t.name,i}));s=s.concat(t)}return s}get renderingRule(){return(0,w.Lx)(p.A.getLogger(this),"renderingRule",{replacement:"rasterFunction",version:"4.27",warnOnce:!0}),this.rasterFunction}set renderingRule(e){(0,w.Lx)(p.A.getLogger(this),"renderingRule",{replacement:"rasterFunction",version:"4.27",warnOnce:!0}),this._set("rasterFunction",e)}set rasterFunction(e){let t=e;t?.rasterFunction&&(t=A.A.fromJSON({...t.toJSON(),rasterFunction:t.rasterFunction,rasterFunctionArguments:t.rasterFunctionArguments})),this._set("rasterFunction",t)}readRasterFunction(e,t){const i=t.rasterFunctionInfos;return t.renderingRule||i?.length&&"None"!==i[0].name?this._isRFTJson(t.renderingRule)?A.A.fromJSON({rasterFunctionDefinition:t.renderingRule}):A.A.fromJSON(t.renderingRule||{rasterFunctionInfos:t.rasterFunctionInfos}):null}readSpatialReference(e,t){const i=e||t.extent.spatialReference;return i?ge.A.fromJSON(i):null}readPixelType(e){return k.e8.fromJSON(e)||e}writePixelType(e,t,i){null!=this.serviceRasterInfo&&this.pixelType===this.serviceRasterInfo.pixelType||(t[i]=k.e8.toJSON(e))}readVersion(e,t){let i=t.currentVersion;return i||(i=t.hasOwnProperty("fields")||t.hasOwnProperty("timeInfo")?10:9.3),i}applyFilter(e){let t=e;return this.pixelFilter&&(t=this._clonePixelData(e),this.pixelFilter(t)),t}async applyRenderer(e,t){let i=e;const{renderer:r,symbolizer:s,pixelFilter:n,bandIds:o}=this;if(!this._isPicture()&&r&&s&&!n){const n=JSON.stringify(this._cachedRendererJson)!==JSON.stringify(r.toJSON()),a=this._rasterJobHandler.instance;if(a){n&&(s.bind(),await a.updateSymbolizer(s,t),this._cachedRendererJson=r.toJSON());const l=await a.symbolize({bandIds:o,...e},t);i={extent:e.extent,pixelBlock:l}}else i={extent:e.extent,pixelBlock:s.symbolize({bandIds:o,...e})}}return i}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 o.A("imagery-layer:compute-angles","this operation is not supported on the input image service");return e=(0,b.PZ)(Mt,e).clone(),async function(e,t,i){const r=t.toJSON();null!=r.angleName&&(r.angleName=r.angleName.join(",")),t?.point?.spatialReference?.imageCoordinateSystem&&(r.point.spatialReference=ct(t.point.spatialReference)),t?.spatialReference?.imageCoordinateSystem&&(r.spatialReference=dt(t.spatialReference));const s=(0,ue.Dl)(e),n=(0,ue.lF)({...s.query,f:"json",...r}),o=(0,ue.jV)(n,i),{data:a}=await(0,f.A)(`${s.path}/computeAngles`,o);return a.spatialReference=a.spatialReference?null!=a.spatialReference.geodataXform?new ge.A({wkid:0,imageCoordinateSystem:a.spatialReference}):ge.A.fromJSON(a.spatialReference):null,"NaN"===a.north&&(a.north=null),"NaN"===a.up&&(a.up=null),new we(a)}(this.url,e,this._getRequestOptions(t))}async computePixelSpaceLocations(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsComputePixelLocation)throw new o.A("imagery-layer:compute-pixel-space-locations","this operation is not supported on the input image service");return e=(0,b.PZ)(Qt,e).clone(),async function(e,t,i){const r=t.toJSON(),{geometries:s}=t;if(s)for(let e=0;e<s.length;e++)s[e].spatialReference?.imageCoordinateSystem&&(r.geometries.geometries[e].spatialReference=ct(s[e].spatialReference));const n=(0,ue.Dl)(e),o=(0,ue.lF)({...n.query,f:"json",...r}),a=(0,ue.jV)(o,i),{data:l}=await(0,f.A)(`${n.path}/computePixelLocation`,a);return $e.fromJSON(l)}(this.url,e,this._getRequestOptions(t))}async computeHistograms(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsComputeHistograms)throw new o.A("imagery-layer:compute-histograms","this operation is not supported on the input image service");return e=(0,b.PZ)(Bt.A,e).clone(),this._applyMosaicAndRenderingRules(e),async function(e,t,i){const r=await ot(e,t,i),s=(0,ue.Dl)(e),{data:n}=await(0,f.A)(`${s.path}/computeHistograms`,r);return{histograms:n.histograms}}(this.url,e,this._getRequestOptions(t))}async computeStatisticsHistograms(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsComputeStatisticsHistograms)throw new o.A("imagery-layer:compute-statistics-histograms","this operation is not supported on the input image service");return e=(0,b.PZ)(Bt.A,e).clone(),this._applyMosaicAndRenderingRules(e),async function(e,t,i){const r=await ot(e,t,i),s=(0,ue.Dl)(e),{data:n}=await(0,f.A)(`${s.path}/computeStatisticsHistograms`,r),{statistics:o}=n;return o?.length&&o.forEach((e=>{e.avg=e.mean,e.stddev=e.standardDeviation})),{statistics:o,histograms:n.histograms}}(this.url,e,this._getRequestOptions(t))}async measureHeight(e,t){const i=await this._fetchCapabilities(t?.signal);if(!("base-and-top"===e.operationType?i.mensuration.supportsHeightFromBaseAndTop:"base-and-top-shadow"===e.operationType?i.mensuration.supportsHeightFromBaseAndTopShadow:i.mensuration.supportsHeightFromTopAndTopShadow))throw new o.A("imagery-layer:measure-height","this operation is not supported on the input image service");return e=(0,b.PZ)(Lt,e).clone(),this._applyMosaicAndRenderingRules(e),async function(e,t,i){const r=await lt(e,t,[t.fromGeometry,t.toGeometry],i);return qe.fromJSON(r)}(this.url,e,this._getRequestOptions(t))}async measureAreaAndPerimeter(e,t){const i=await this._fetchCapabilities(t?.signal);if(!i.mensuration.supportsAreaAndPerimeter||e.is3D&&!i.mensuration.supports3D)throw new o.A("imagery-layer:measure-area-and-perimeter","this operation is not supported on the input image service");return e=(0,b.PZ)(jt,e).clone(),this._applyMosaicAndRenderingRules(e),async function(e,t,i){const r=await lt(e,t,[t.geometry],i);return Ie.fromJSON(r)}(this.url,e,this._getRequestOptions(t))}async measureDistanceAndAngle(e,t){const i=await this._fetchCapabilities(t?.signal);if(!i.mensuration.supportsDistanceAndAngle||e.is3D&&!i.mensuration.supports3D)throw new o.A("imagery-layer:measure-distance-and-angle","this operation is not supported on the input image service");return e=(0,b.PZ)(Nt,e).clone(),this._applyMosaicAndRenderingRules(e),async function(e,t,i){const r=await lt(e,t,[t.fromGeometry,t.toGeometry],i);return Te.fromJSON(r)}(this.url,e,this._getRequestOptions(t))}async measurePointOrCentroid(e,t){const i=await this._fetchCapabilities(t?.signal);if(!i.mensuration.supportsPointOrCentroid||e.is3D&&!i.mensuration.supports3D)throw new o.A("imagery-layer:measure-point-or-centroid","this operation is not supported on the input image service");return e=(0,b.PZ)(Wt,e).clone(),this._applyMosaicAndRenderingRules(e),async function(e,t,i){const r=await lt(e,t,[t.geometry],i);return He.fromJSON(r)}(this.url,e,this._getRequestOptions(t))}async measureLengthFromImage(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsMeasureFromImage)throw new o.A("imagery-layer:measure-length-from-image","this operation is not supported on the input image service");if("polyline"!==e.geometry.type)throw new o.A("imagery-layer:measure-length-from-image","this input geometry must be a polyline");return e=(0,b.PZ)(di,e).clone(),async function(e,t,i){const r=await ut(e,t,i);return st.fromJSON(r)}(this.url,e,this._getRequestOptions(t))}async measureAreaFromImage(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsMeasureFromImage)throw new o.A("imagery-layer:measure-area-from-image","this operation is not supported on the input image service");if("polygon"!==e.geometry.type)throw new o.A("imagery-layer:measure-area-from-image","this input geometry must be a polygon");return e=(0,b.PZ)(di,e).clone(),async function(e,t,i){const r=await ut(e,t,i);return it.fromJSON(r)}(this.url,e,this._getRequestOptions(t))}getField(e){const{fieldsIndex:t}=this;return null!=t?t.get(e):void 0}getFieldDomain(e,t){const i=this.getField(e);return i?i.domain:null}async fetchImage(e,t,r,s={}){if(null==e||null==t||null==r)throw new o.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:s.signal});e&&(this.rasterInfo=e)}const n=this.getExportImageServiceParameters(e,t,r,s.timeExtent);if(null==n){if(s.requestAsImageElement&&this._canRequestImageElement(this.format)){const e=document.createElement("canvas");return e.width=t,e.height=r,s.returnImageBitmap?{imageBitmap:await(0,W.m)(e,`${i(this.parsedUrl)}/exportImage`,s.signal)}:{imageOrCanvasElement:e}}const{bandIds:n,rasterInfo:o}=this,a=(n?.length||o.bandCount)??0,l=t*r,u=o.pixelType,p=[];for(let e=0;e<a;e++)p.push(ee.A.createEmptyBand(u,l));return{pixelData:{pixelBlock:new ee.A({width:t,height:r,pixels:p,mask:new Uint8Array(l),pixelType:u}),extent:e}}}const a=!!s.requestAsImageElement&&!this.pixelFilter,l=a&&!!s.returnImageBitmap,u={imageServiceParameters:n,imageProps:{extent:e,width:t,height:r,format:this.format},requestAsImageElement:a,returnImageBitmap:l,signal:s.signal};return this._requestArrayBuffer(u)}fetchKeyProperties(e){return(0,f.A)(i(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 o.A("#fetchRasterAttributeTable()","Failed to get rasterAttributeTable")):(0,f.A)(i(this.parsedUrl)+"/rasterAttributeTable",{query:this._getQueryParams({renderingRule:this.version>=10.3?e?.rasterFunction:null})}).then((e=>Ge.A.fromJSON(e.data)))}getCatalogItemRasterInfo(e,t){const r={...t,query:this._getQueryParams()};return async function(e,t,i){const r=(0,ue.Dl)(e),s=(0,ue.lF)({...r?.query,f:"json"}),n=(0,ue.jV)(s,i),o=`${r?.path}/${t}/info`,a=(0,f.A)(`${o}`,n),l=(0,f.A)(`${o}/keyProperties`,n),u=await Promise.allSettled([a,l]),p="fulfilled"===u[0].status?u[0].value.data:null,c="fulfilled"===u[1].status?u[1].value.data:null;let d=null;p.statistics?.length&&(d=p.statistics.map((e=>({min:e[0],max:e[1],avg:e[2],stddev:e[3]}))));const m=xe.A.fromJSON(p.extent),h=Math.ceil(m.width/p.pixelSizeX-.1),y=Math.ceil(m.height/p.pixelSizeY-.1),g=m.spatialReference,w=new pe.A({x:p.pixelSizeX,y:p.pixelSizeY,spatialReference:g}),v=p.histograms?.length?p.histograms:null,_=new vt.A({origin:p.origin,blockWidth:p.blockWidth,blockHeight:p.blockHeight,firstPyramidLevel:p.firstPyramidLevel,maximumPyramidLevel:p.maxPyramidLevel});return new te.A({width:h,height:y,bandCount:p.bandCount,extent:m,spatialReference:g,pixelSize:w,pixelType:p.pixelType.toLowerCase(),statistics:d,histograms:v,keyProperties:c,storageInfo:_})}(i(this.parsedUrl),e,r)}async getCatalogItemICSInfo(e,t){const{data:r}=await(0,f.A)(i(this.parsedUrl)+"/"+e+"/info/ics",{query:this._getQueryParams(),...t}),s=r?.ics;if(!s)return;let n=null;try{n=(await(0,f.A)(i(this.parsedUrl)+"/"+e+"/info",{query:this._getQueryParams(),...t})).data.extent}catch{}if(!n||!n.spatialReference)return{ics:s,icsToPixelTransform:null,icsExtent:null,northDirection:null};const o=this.version>=10.7?(0,f.A)(i(this.parsedUrl)+"/"+e+"/info/icstopixel",{query:this._getQueryParams(),...t}).then((e=>e.data)).catch((()=>({}))):{},a=n.spatialReference,l={geometries:JSON.stringify({geometryType:"esriGeometryEnvelope",geometries:[n]}),inSR:(0,M.YX)(a),outSR:"0:"+e},u=(0,f.A)(i(this.parsedUrl)+"/project",{query:this._getQueryParams(l),...t}).then((e=>e.data)).catch((()=>({}))),p=(n.xmin+n.xmax)/2,c=(n.ymax-n.ymin)/6,d=n.ymin+c,m=[];for(let e=0;e<5;e++)m.push({x:p,y:d+c*e});const h={geometries:JSON.stringify({geometryType:"esriGeometryPoint",geometries:m}),inSR:(0,M.YX)(a),outSR:"0:"+e},y=(0,f.A)(i(this.parsedUrl)+"/project",{query:this._getQueryParams(h),...t}).then((e=>e.data)).catch((()=>({}))),g=await Promise.all([o,u,y]);let w=g[0].ipxf;if(null==w){const e=s.geodataXform?.xf_0;"topup"===e?.name?.toLowerCase()&&6===e?.coefficients?.length&&(w={affine:{name:"ics [sensor: Frame] to pixel (column, row) transformation",coefficients:e.coefficients,cellsizeRatio:0,type:"GeometricXform"}})}const v=xe.A.fromJSON(g[1]?.geometries?.[0]);v&&(v.spatialReference=new ge.A({wkid:0,imageCoordinateSystem:s}));const _=g[2].geometries?g[2].geometries.filter((e=>null!=e?.x&&null!=e.y&&"NaN"!==e.x&&"NaN"!==e.y)):[],R=_.length;if(R<3)return{ics:s,icsToPixelTransform:w,icsExtent:v,northDirection:null};let b=0,S=0,F=0,I=0;for(let e=0;e<R;e++)b+=_[e].x,S+=_[e].y,F+=_[e].x*_[e].x,I+=_[e].x*_[e].y;const x=(R*I-b*S)/(R*F-b*b);let A=0;const j=_[4].x>_[0].x,Z=_[4].y>_[0].y;return x===1/0?A=Z?90:270:0===x?A=j?0:180:x>0?A=j?180*Math.atan(x)/Math.PI:180*Math.atan(x)/Math.PI+180:x<0&&(A=Z?180+180*Math.atan(x)/Math.PI:360+180*Math.atan(x)/Math.PI),{ics:s,icsToPixelTransform:w,icsExtent:v,northDirection:A}}async generateRasterInfo(e,t){if(e=(0,b.PZ)(A.A,e),this.serviceRasterInfo&&(!e||"none"===e.functionName?.toLowerCase()||this._isVectorFieldResampleFunction(e)))return this.serviceRasterInfo;const r=function(e){if(!e)return null;const t=JSON.stringify(e).match(/"rasterFunction":"(.*?")/gi),i=t?.map((e=>e.replace('"rasterFunction":"',"").replace('"',"")));return i?i.join("/"):null}(e);if(!r)throw new o.A("imagery-layer:generate-raster-info","the rendering rule is not supported");if(this._functionRasterInfos[r])return this._functionRasterInfos[r];const s={...t,query:this._getQueryParams()},n=(0,wt.X6)(i(this.parsedUrl),e,s);this._functionRasterInfos[r]=n;try{return await n}catch(e){throw this._functionRasterInfos[r]=null,e}}getExportImageServiceParameters(e,t,r,s){const n=dt((e=e.clone().shiftCentralMeridian()).spatialReference,i(this.parsedUrl));this.pixelType!==this.serviceRasterInfo.pixelType&&(this.exportImageServiceParameters.pixelType=this.pixelType);const o=this.exportImageServiceParameters.toJSON(),{bandIds:a,noData:l}=o;let{renderingRule:u}=o;const p=this.rasterFunction?.rasterFunctionDefinition,c=!this.renderer||"raster-stretch"===this.renderer.type;if(a?.length&&this._hasRasterFunction(this.rasterFunction)&&!p&&c){const e={rasterFunction:"ExtractBand",rasterFunctionArguments:{BandIds:a}};if("Stretch"===u.rasterFunction)e.rasterFunctionArguments.Raster=u.rasterFunctionArguments.Raster,u.rasterFunctionArguments.Raster=e;else if("Colormap"===u.rasterFunction){const t=u.rasterFunctionArguments.Raster;"Stretch"===t?.rasterFunction?(e.rasterFunctionArguments.Raster=t.rasterFunctionArguments.Raster,t.rasterFunctionArguments.Raster=e):(e.rasterFunctionArguments.Raster=t,u.rasterFunctionArguments.Raster=e)}else e.rasterFunctionArguments.Raster=u,u=e;o.bandIds=void 0}else o.bandIds=a?.join(",");l instanceof Array&&l.length>0&&(o.noData=l.join(","));const d=this._processMultidimensionalIntersection(null,s,this.exportImageServiceParameters.mosaicRule);if(d.isOutSide)return null;o.mosaicRule=null!=d.mosaicRule?JSON.stringify(d.mosaicRule):null,s=d.timeExtent,o.renderingRule=this._getRenderingRuleString(A.A.fromJSON(u));const m={};if(null!=s){const{start:e,end:t}=s.toJSON();e&&t&&e===t?m.time=""+e:null==e&&null==t||(m.time=`${e??"null"},${t??"null"}`)}return{bbox:e.xmin+","+e.ymin+","+e.xmax+","+e.ymax,bboxSR:n,imageSR:n,size:t+","+r,...o,...m}}async getSamples(e,t){const i=await this._fetchCapabilities(t?.signal);if(!i?.operations.supportsGetSamples)throw new o.A("imagery-layer:get-samples","getSamples operation is not supported on the input image service");e=(0,b.PZ)(ti,e).clone();const{raster:r}=this;return r&&null==e.raster&&(e.raster=r),async function(e,t,i){const r=t.toJSON();nt(r),r.outFields?.length&&(r.outFields=r.outFields.join(","));const s=await(0,le.el)(t.geometry),n=s?.[0];null!=n&&(r.geometry=pt(n));const o=(0,ue.Dl)(e),a=(0,ue.lF)({...o.query,f:"json",...r}),l=(0,ue.jV)(a,i),{data:u}=await(0,f.A)(`${o.path}/getSamples`,l),p=u?.samples?.map((e=>{const t="NaN"===e.value||""===e.value?null:e.value.split(" ").map((e=>Number(e)));return{...e,pixelValue:t}}));return Ye.fromJSON({samples:p})}(this.url,e,this._getRequestOptions(t))}async identify(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsIdentify)throw new o.A("imagery-layer:identify","identify operation is not supported on the input image service");e=(0,b.PZ)(Ut,e).clone(),this.version<10.91&&"extent"===e.geometry?.type&&(e.geometry=Ae.A.fromExtent(e.geometry));const i=this._processMultidimensionalIntersection(e.geometry,e.timeExtent,e.mosaicRule||this.mosaicRule);if(i.isOutSide)throw new o.A("imagery-layer:identify","the request cannot be fulfilled when falling outside of the multidimensional subset");e.timeExtent=i.timeExtent,e.mosaicRule=i.mosaicRule;const{raster:r,rasterFunction:s}=this;return s&&null==e.rasterFunction&&(e.rasterFunction=s),r&&null==e.raster&&(e.raster=r),at(this.url,e,this._getRequestOptions(t))}async imageToMap(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsImageToMap)throw new o.A("imagery-layer:image-to-map","imageToMap operation is not supported on the input image service");return e=(0,b.PZ)(ni,e),async function(e,t,i){const r=t.toJSON();t.geometry.spatialReference.imageCoordinateSystem&&(r.geometry=pt(t.geometry)),t.depthOffset&&t.adjust||delete r.options;const s=(0,ue.Dl)(e),n=(0,ue.lF)({...s.query,f:"json",...r}),o=(0,ue.jV)(n,i),{data:a}=await(0,f.A)(`${s.path}/imageToMap`,o);return(0,et.rS)(a)}(i(this.parsedUrl),e,this._getRequestOptions(t))}async imageToMapMultiray(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsImageToMapMultiray)throw new o.A("imagery-layer:image-to-map-multiray","imageToMapMultiray operation is not supported on the input image service");return e=(0,b.PZ)(ri,e),async function(e,t,i){const r=t.toJSON();t.rasterIds?.length&&(r.rasterIds=t.rasterIds.join(","));const s=(0,ue.Dl)(e),n=(0,ue.lF)({...s.query,f:"json",...r}),o=(0,ue.jV)(n,i),{data:a}=await(0,f.A)(`${s.path}/imageToMapMultiray`,o);return(0,et.rS)(a)}(i(this.parsedUrl),e,this._getRequestOptions(t))}async mapToImage(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsMapToImage)throw new o.A("imagery-layer:map-to-image","mapToImage operation is not supported on the input image service");return e=(0,b.PZ)(ui,e),async function(e,t,i){const r=t.toJSON(),s=await(0,le.el)(t.geometry),n=s?.[0];null!=n&&(r.geometry=pt(n)),t.visibleOnly||delete r.options;const o=n?.spatialReference??t.geometry?.spatialReference;o&&(r.inSR=dt(o));const a=(0,ue.Dl)(e),l=(0,ue.lF)({...a.query,f:"json",...r}),u=(0,ue.jV)(l,i),{data:p}=await(0,f.A)(`${a.path}/mapToImage`,u);return(0,et.rS)(p)}(i(this.parsedUrl),e,this._getRequestOptions(t))}async findImages(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsFindImages)throw new o.A("imagery-layer:find-images","findImages operation is not supported on the input image service");return e=(0,b.PZ)(Rt,e),async function(e,t,i){const r=t.toJSON(),s=await(0,le.el)([t.fromGeometry,t.toGeometry]);null!=s[0]&&(r.fromGeometry=pt(s[0]),s[0].spatialReference&&(r.inSR=dt(s[0].spatialReference))),null!=s[1]&&(r.toGeometry=pt(s[1])),t.objectIds?.length&&(r.objectIds=r.objectIds.join(","));const n=(0,ue.Dl)(e),o=(0,ue.lF)({...n.query,f:"json",...r}),a=(0,ue.jV)(o,i),{data:l}=await(0,f.A)(`${n.path}/find`,a);return ye.fromJSON(l)}(i(this.parsedUrl),e,this._getRequestOptions(t))}async getImageUrl(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsGetImageUrl)throw new o.A("imagery-layer:get-image-url","getImageUrl operation is not supported on the input image service");return e=(0,b.PZ)(ai,e),async function(e,t,i){const r=t.toJSON(),s=(0,ue.Dl)(e),n=(0,ue.lF)({...s.query,f:"json",...r}),o=(0,ue.jV)(n,i),{data:a}=await(0,f.A)(`${s.path}/getImageUrl`,o);return Xe.fromJSON(a)}(i(this.parsedUrl),e,this._getRequestOptions(t))}createQuery(){return new yt.A({outFields:["*"],returnGeometry:!0,where:this.definitionExpression||"1=1"})}async queryBoundary(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsQueryBoundary)throw new o.A("imagery-layer:query-boundary","queryBoundary operation is not supported on the input image service");return e=(0,b.PZ)(Dt,e??{outSpatialReference:this.spatialReference}).clone(),async function(e,t,i){const r=(0,ue.Dl)(e),s=t.toJSON();t.outSpatialReference&&(s.outSR=dt(t.outSpatialReference));const n=(0,ue.lF)({...r.query,f:"json",...s}),o=(0,ue.jV)(n,i),{data:a}=await(0,f.A)(r.path+"/queryBoundary",o);return Ze.fromJSON(a)}(i(this.parsedUrl),e,this._getRequestOptions(t))}async queryRasters(e,t){return({query:e,requestOptions:t}=await this._prepareForQuery(e,t)),(0,mt.s)(this.url,e,t)}async queryObjectIds(e,t){return({query:e,requestOptions:t}=await this._prepareForQuery(e,t)),(0,ft.V)(this.url,e,t)}async queryGPSInfo(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsQueryGPSInfo)throw new o.A("imagery-layer:query-gps-info","queryGPSInfo operation is not supported on the input image service");return e=(0,b.PZ)(Et,e??{outSpatialReference:this.spatialReference}).clone(),async function(e,t,i){const r=t.toJSON();nt(r),r.objectIds?.length&&(r.objectIds=r.objectIds.join(",")),r.geometry||r.objectIds||r.time||r.where||(r.where="1=1");const s=await(0,le.el)(t.geometry),n=s?.[0];null!=n&&(r.geometry=pt(n));const o=n?.spatialReference??t.geometry?.spatialReference;o&&(r.inSR=dt(o));const a=(0,ue.Dl)(e),l=(0,ue.lF)({...a.query,f:"json",...r}),u=(0,ue.jV)(l,i),{data:p}=await(0,f.A)(`${a.path}/queryGPSInfo`,u);return Je.fromJSON(p)}(i(this.parsedUrl),e,this._getRequestOptions(t))}async queryRasterCount(e,t){return({query:e,requestOptions:t}=await this._prepareForQuery(e,t)),(0,gt.I)(this.url,e,t)}async queryVisibleRasters(e,t){if(!e)throw new o.A("imagery-layer: query-visible-rasters","missing query parameter");await this.load();const{pixelSize:i,returnDomainValues:r,returnTopmostRaster:s,showNoDataRecords:n}=t||{pixelSize:null,returnDomainValues:!1,returnTopmostRaster:!1,showNoDataRecords:!1};let a=!1,l=null,u=null;const p="raster.servicepixelvalue",c=this._rasterFunctionNamesIndex;if(null!=e.outFields&&(a=e.outFields.some((e=>!e.toLowerCase().includes(p))),this.version>=10.4)){const t=e.outFields.filter((e=>e.toLowerCase().includes(p)&&e.length>24)).map((e=>{const t=e.slice(25);return[this._updateRenderingRulesFunctionName(t,c),t]}));l=t.map((e=>new A.A({functionName:e[0]}))),u=t.map((e=>e[1]));const{rasterFunction:i}=this;0===l.length?i?.functionName?(l.push(i),u.push(i.functionName)):l=null:i?.functionName&&!l.some((e=>e.functionName===i.functionName))&&(l.push(i),u.push(i.functionName))}const d=null==e.outSpatialReference||e.outSpatialReference.equals(this.spatialReference),{multidimensionalSubset:m}=this;let h=e.timeExtent||this.timeExtent;if(m){const{isOutside:t,intersection:i}=(0,re.Rp)(m,{geometry:e.geometry,timeExtent:e.timeExtent,multidimensionalDefinition:this.exportImageServiceParameters.mosaicRule?.multidimensionalDefinition});if(t)throw new o.A("imagery-layer:query-visible-rasters","the request cannot be fulfilled when falling outside of the multidimensional subset");null!=i?.timeExtent&&(h=i.timeExtent)}const y=this._combineMosaicRuleWithTimeExtent(this.exportImageServiceParameters.mosaicRule,h);let g=e.geometry;this.version<10.91&&"extent"===g?.type&&(g=Ae.A.fromExtent(g));const f=this._getQueryParams({geometry:g,timeExtent:h,mosaicRule:y,rasterFunction:this.version<10.4?this.rasterFunction:null,rasterFunctions:l,pixelSize:i,returnCatalogItems:a,returnGeometry:d,raster:this.raster,maxItemCount:s?1:null});delete f.f;const w=new Ut(f);try{await this._generateRasterInfo(this.rasterFunction);const i=await at(this.url,w,{signal:t?.signal,query:{...this.customParameters}}),s=e.outFields,o=null!=i.value&&i.value.toLowerCase().includes("nodata");if(!a||d||!i?.catalogItems?.features.length||!n&&o)return this._processVisibleRastersResponse(i,{returnDomainValues:r,templateRRFunctionNames:u,showNoDataRecords:n,templateFields:s});const l=this.objectIdField||"ObjectId",p=i.catalogItems?.features??[],c=p.map((e=>e.attributes?.[l])),m=new yt.A({objectIds:c,returnGeometry:!0,outSpatialReference:e.outSpatialReference,outFields:[l]}),h=await this.queryRasters(m);return h?.features?.length&&h.features.forEach((t=>{p.forEach((i=>{i.attributes[l]===t.attributes[l]&&(i.geometry=new Ae.A(t.geometry),null!=e.outSpatialReference&&(i.geometry.spatialReference=e.outSpatialReference))}))})),this._processVisibleRastersResponse(i,{returnDomainValues:r,templateRRFunctionNames:u,showNoDataRecords:n,templateFields:s})}catch{throw new o.A("imagery-layer:query-visible-rasters","encountered error when querying visible rasters")}}async fetchVariableStatisticsHistograms(e,t){const r=(0,f.A)(i(this.parsedUrl)+"/statistics",{query:this._getQueryParams({variable:e}),signal:t}).then((e=>e.data?.statistics)),s=(0,f.A)(i(this.parsedUrl)+"/histograms",{query:this._getQueryParams({variable:e}),signal:t}).then((e=>e.data?.histograms)),n=await Promise.all([r,s]);return n[0]&&n[0].forEach((e=>{e.avg=e.mean,e.stddev=e.standardDeviation})),{statistics:n[0]||null,histograms:n[1]||null}}async createFlowMesh(e,t){const i=this._rasterJobHandler.instance;return i?i.createFlowMesh(e,t):(0,mi.CW)(e.meshType,e.simulationSettings,e.flowData,null!=t.signal?t.signal:(new AbortController).signal)}getMultidimensionalSubsetVariables(e){const t=e??this.serviceRasterInfo.multidimensionalInfo;return(0,re.z2)(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):(0,wt.Tw)(i(this.parsedUrl),t,{signal:e,query:this._getQueryParams()}).then((e=>(this._set("serviceRasterInfo",e),this._set("multidimensionalInfo",e.multidimensionalInfo),(0,wt.E9)(e,t),e))),s=this._hasRasterFunction(this.rasterFunction)?this._generateRasterInfo(this.rasterFunction,{signal:e}):null,n=this._getRasterFunctionInfos();return Promise.all([r,s,n]).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),p.A.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([(0,_.wB)((()=>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 i=this.timeInfo,{multidimensionalInfo:r}=this.serviceRasterInfo;if(null==e||null==r||null==t||null==i?.startField)return e;const{startField:s}=i,n=r.variables.some((e=>e.dimensions.some((e=>e.name===s))))?s:"StdTime";if(e=e.clone(),"mosaic-dataset"===this.sourceType)return e.multidimensionalDefinition=e.multidimensionalDefinition?.filter((e=>e.dimensionName!==n)),this._cleanupMultidimensionalDefinition(e);e.multidimensionalDefinition=e.multidimensionalDefinition||[];const o=e.multidimensionalDefinition.filter((e=>e.dimensionName===n)),a=null!=t.start?t.start.getTime():null,l=null!=t.end?t.end.getTime():null,u=null==a||null==l||a===l,p=u?[a||l]:[[a,l]],c=this.version>=10.8;if(o.length)o.forEach((e=>{e.dimensionName===n&&(c?(e.dimensionName=null,e.isSlice=!1,e.values=[]):(e.isSlice=u,e.values=p))}));else if(!c){const t=e.multidimensionalDefinition.filter((e=>null!=e.variableName&&null==e.dimensionName));t.length?t.forEach((e=>{e.dimensionName=n,e.isSlice=u,e.values=p})):e.multidimensionalDefinition.push(new I.A({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 o.A("imagery-layer:query-rasters","query operation is not supported on the input image service");return e=null!=e?(0,b.PZ)(yt.A,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 ie.A;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:i}=this;return"unique-value"===e.type&&this._hasRasterFunction(i)&&1===t?.bandCount&&["u8","s8"].includes(t.pixelType)||null!=t&&null!=e&&(0,oe.fp)(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:s}=await(0,f.A)(i(this.parsedUrl),{query:this._getQueryParams(),signal:e});t=r,this.sourceJSON=t,s&&(this.url=this.url.replace(/^http:/i,"https:"))}if(t.capabilities?.toLowerCase().split(",").map((e=>e.trim())).indexOf("tilesonly")>-1)throw new o.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),i=e.currentVersion>=10.71&&e.hasMultidimensions&&!(e.fields?.length>1);return t||i}_isVectorFieldResampleFunction(e){if(null==e)return!1;const{functionName:t,functionArguments:i}=e,r="resample"===t?.toLowerCase(),s=i?.ResampleType||i?.resampleType;return r&&(7===s||10===s)}_isPicture(){return!this.format||this.format.includes("jpg")||this.format.includes("png")}_configRenderer(e){const t=this._isPicture(),{rasterInfo:i}=this;if(!t&&!this.pixelFilter||this._isVectorDataSet()){if(!this.bandIds&&i.bandCount>=3){const e=(0,oe.ci)(i);!e||3===i.bandCount&&0===e[0]&&1===e[1]&&2===e[2]||(this.bandIds=e)}e||(e=(0,oe.PD)(i,{bandIds:this.bandIds,variableName:this.rasterFunction?null:this.mosaicRule?.multidimensionalDefinition?.[0].variableName}));const t=(0,oe.$P)(e.toJSON());this.symbolizer?(this.symbolizer.rendererJSON=t,this.symbolizer.rasterInfo=i):this.symbolizer=new ae.A({rendererJSON:t,rasterInfo:i}),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:i}=this;return{raster:t,viewId:i,f:"json",...e,...this.customParameters}}_getRequestOptions(e){return{...e,query:{...e?.query,...this.customParameters}}}_decodePixelBlock(e,t,i){return this._rasterJobHandler.instance?this._rasterJobHandler.instance.decode({data:e,options:t}):(0,se.D)(e,t,i)}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(0,f.A)(i(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:s,signal:n}=e;if(r&&this._canRequestImageElement(t.format)){const r=`${i(this.parsedUrl)}/exportImage`,{data:o}=await(0,f.A)(r,{responseType:s?"blob":"image",query:this._getQueryParams({f:"image",...this.refreshParameters,...e.imageServiceParameters}),signal:n});return o instanceof Blob?{imageBitmap:await(0,W.m)(o,r,n),params:t}:{imageOrCanvasElement:o,params:t}}const a=this._initJobHandler(),l=(0,f.A)(i(this.parsedUrl)+"/exportImage",{responseType:"array-buffer",query:this._getQueryParams({f:"image",...e.imageServiceParameters}),signal:n}),u=(await Promise.all([l,a]))[0].data,p=t.format||"jpgpng";let c=p;if("bsq"!==c&&"bip"!==c&&(c=(0,se.g)(u)),!c)throw new o.A("imagery-layer:fetch-image","unsupported format signature "+String.fromCharCode.apply(null,new Uint8Array(u)));const d={signal:n},m="gif"===p||"bmp"===p||p.includes("png")&&("png"===c||"jpg"===c)?(0,se.D)(u,{useCanvas:!0,...t},d):this._decodePixelBlock(u,{width:t.width,height:t.height,planes:null,pixelType:null,noDataValue:null,format:p},d);return{pixelData:{pixelBlock:await m,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=(0,re.fy)(e,{multidimensionalSubset:this.multidimensionalSubset});if(null!=t&&t.length>0){this.mosaicRule=this.mosaicRule||new H.A;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,t){t=t||{};const i=e.value,{templateRRFunctionNames:r,showNoDataRecords:s,returnDomainValues:n,templateFields:o}=t,a=e.processedValues;let l=e.catalogItems?.features,u=e.properties?.Values?.map((e=>e.replaceAll(/ /gi,", ")))||[];const p=this.objectIdField||"ObjectId",c="string"==typeof i&&i.toLowerCase().includes("nodata"),d=[];if(i&&!l&&!c){const e={};e[p]=0,u=[i],l=[new y.A(this.fullExtent,null,e)]}if(!l)return[];let m,h,g;this._updateResponseFieldNames(l,o),c&&!s&&(l=[]);for(let e=0;e<l.length;e++){if(m=l[e],null!=i){if(h=u[e],g=this.rasterFunction&&a&&a.length>0&&r&&r.length>0&&r.includes(this.rasterFunction.functionName)?a[r.indexOf(this.rasterFunction.functionName)]:i,"nodata"===h.toLowerCase()&&!s)continue;const t="Raster.ItemPixelValue",n="Raster.ServicePixelValue";m.attributes[t]=h,m.attributes[n]=g,this._updateFeatureWithMagDirValues(m,h);const o=this.fields&&this.fields.length>0;let l=this.rasterFunction&&null!=this.serviceRasterInfo.attributeTable?o?h:i:g;this.rasterFunction||(l=o?h:i),this._updateFeatureWithRasterAttributeTableValues(m,l)}if(m.sourceLayer=m.layer=this,n&&this._updateFeatureWithDomainValues(m),r&&a&&r.length===a.length)for(let e=0;e<r.length;e++){const t="Raster.ServicePixelValue."+r[e];m.attributes[t]=a[e]}d.push(l[e])}return d}_processMultidimensionalIntersection(e,t,i){const{multidimensionalSubset:r}=this;if(!r)return{isOutSide:!1,timeExtent:t,mosaicRule:i=this._combineMosaicRuleWithTimeExtent(i,t)};if(r){const{isOutside:i,intersection:s}=(0,re.Rp)(r,{geometry:e,timeExtent:t});if(i)return{isOutSide:!0,timeExtent:null,mosaicRule:null};null!=s?.timeExtent&&(t=s.timeExtent)}if(i=this._combineMosaicRuleWithTimeExtent(i,t),i?.multidimensionalDefinition){const{isOutside:e}=(0,re.Rp)(r,{multidimensionalDefinition:i.multidimensionalDefinition});if(e)return{isOutSide:!0,timeExtent:null,mosaicRule:null}}return{isOutSide:!1,timeExtent:t,mosaicRule:i}}_updateFeatureWithRasterAttributeTableValues(e,t){const i=this.rasterInfo.attributeTable||this.serviceRasterInfo.attributeTable;if(null==i)return;const{features:r,fields:s}=i,n=s.map((e=>e.name)).find((e=>"value"===e.toLowerCase()));if(!n)return;const o=r.filter((e=>e.attributes[n]===(null!=t?parseInt(t,10):null)));o&&o[0]&&s.forEach((t=>{const i=this._rasterAttributeTableFieldPrefix+t.name;e.attributes[i]=o[0].attributes[t.name]}))}_updateFeatureWithMagDirValues(e,t){if(!this._isVectorDataSet())return;const i=t.split(/,\s*/).map((e=>parseFloat(e))),r=i.map((e=>[e])),s=i.map((e=>({minValue:e,maxValue:e,noDataValue:null}))),n=new ee.A({height:1,width:1,pixelType:"f32",pixels:r,statistics:s});null!=this.pixelFilter&&this.pixelFilter({pixelBlock:n,extent:new xe.A(0,0,0,0,this.spatialReference)});const o="esriImageServiceDataTypeVector-MagDir"===this.serviceDataType?[n.pixels[0][0],n.pixels[1][0]]:(0,ne.Lu)([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 i=e.attributes[t.name];if(null!=i){const r=t.domain.codedValues.find((e=>e.code===i));r&&(e.attributes[t.name]=r.name)}}))}_updateResponseFieldNames(e,t){if(!t||t.length<1)return;const i=this.fieldsIndex;null!=i&&e.forEach((e=>{if(e?.attributes)for(const r of t){const t=i.get(r)?.name;t&&t!==r&&(e.attributes[r]=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 i=e.toLowerCase().replaceAll(/ /gi,"_");return t.has(i)?t.get(i):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:i,rasterFunction:r}=this;r&&e instanceof Bt.A&&null==e.rasterFunction&&(e.rasterFunction=r),i&&null==e.mosaicRule&&(e.mosaicRule=i),t&&null==e.raster&&(e.raster=t)}_readCapabilities(e){const t=e.capabilities?e.capabilities.toLowerCase().split(",").map((e=>e.trim())):["image","catalog"],{currentVersion:i,advancedQueryCapabilities:r,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())),c=u&&p.includes("basic"),d=this._isMosaicDataset(e)&&t.includes("catalog"),m=t.includes("download");return{data:{supportsAttachment:!1},operations:{supportsComputeHistograms:n,supportsExportImage:n,supportsIdentify:n,supportsImageToMap:i>=11.2&&d,supportsImageToMapMultiray:i>=11.2&&d,supportsMapToImage:i>=11.2&&d,supportsFindImages:i>=11.2&&d,supportsGetImageUrl:i>=11.2&&m,supportsMeasure:u,supportsMeasureFromImage:i>=11.2,supportsDownload:m,supportsQuery:d&&e.fields&&e.fields.length>0,supportsGetSamples:i>=10.2&&n,supportsProject:i>=10.3&&n,supportsComputeStatisticsHistograms:i>=10.4&&n,supportsQueryBoundary:i>=10.6&&n,supportsCalculateVolume:i>=10.7&&o,supportsComputePixelLocation:i>=10.7&&d,supportsComputeAngles:i>=10.91,supportsQueryGPSInfo:i>=11.2&&d,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:!!r?.supportsStatistics,supportsOrderBy:!!r?.supportsOrderBy,supportsDistinct:!!r?.supportsDistinct,supportsPagination:!!r?.supportsPagination,supportsStandardizedQueriesOnly:!!r?.useStandardizedQueries,supportsPercentileStatistics:!!r?.supportsPercentileStatistics,supportsCentroid:!!r?.supportsReturningGeometryCentroid,supportsDistance:!!r?.supportsQueryWithDistance,supportsExtent:!!r?.supportsReturningQueryExtent,supportsGeometryProperties:!!r?.supportsReturningGeometryProperties,supportsHavingClause:!!r?.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:!!r?.supportsDefaultSR,supportsFullTextSearch:!1,supportsCompactGeometry:!1,standardMaxRecordCount:void 0,tileMaxRecordCount:void 0},mensuration:{supportsDistanceAndAngle:c,supportsAreaAndPerimeter:c,supportsPointOrCentroid:c,supportsHeightFromBaseAndTop:u&&p.includes("base-top height"),supportsHeightFromBaseAndTopShadow:u&&p.includes("base-top shadow height"),supportsHeightFromTopAndTopShadow:u&&p.includes("top-top shadow height"),supports3D:u&&p.includes("3d")}}}};function i(e){return e?.path??""}return(0,r._)([(0,u.MZ)({clonable:!1})],t.prototype,"_functionRasterInfos",void 0),(0,r._)([(0,u.MZ)({clonable:!1})],t.prototype,"_rasterJobHandler",void 0),(0,r._)([(0,u.MZ)({clonable:!1})],t.prototype,"_cachedRendererJson",void 0),(0,r._)([(0,u.MZ)({readOnly:!0})],t.prototype,"_serviceSupportsMosaicRule",void 0),(0,r._)([(0,S.w)("_serviceSupportsMosaicRule",["currentVersion","fields"])],t.prototype,"readServiceSupportsMosaicRule",null),(0,r._)([(0,u.MZ)({readOnly:!0})],t.prototype,"_rasterAttributeTableFieldPrefix",void 0),(0,r._)([(0,u.MZ)({readOnly:!0})],t.prototype,"_rasterFunctionNamesIndex",null),(0,r._)([(0,u.MZ)()],t.prototype,"adjustAspectRatio",void 0),(0,r._)([(0,u.MZ)({type:[b.jz],json:{write:!0}})],t.prototype,"bandIds",void 0),(0,r._)([(0,S.w)("bandIds")],t.prototype,"readBandIds",null),(0,r._)([(0,u.MZ)({readOnly:!0,json:{read:!1}})],t.prototype,"capabilities",void 0),(0,r._)([(0,S.w)("service","capabilities",["capabilities","currentVersion","serviceDataType"])],t.prototype,"readCapabilities",null),(0,r._)([(0,u.MZ)({type:Number})],t.prototype,"compressionQuality",void 0),(0,r._)([(0,d.K)("compressionQuality")],t.prototype,"writeCompressionQuality",null),(0,r._)([(0,u.MZ)({type:Number})],t.prototype,"compressionTolerance",void 0),(0,r._)([(0,d.K)("compressionTolerance")],t.prototype,"writeCompressionTolerance",null),(0,r._)([(0,u.MZ)({json:{read:{source:"copyrightText"}}})],t.prototype,"copyright",void 0),(0,r._)([(0,u.MZ)({readOnly:!0,dependsOn:["_serviceSupportsMosaicRule"]})],t.prototype,"defaultMosaicRule",void 0),(0,r._)([(0,S.w)("defaultMosaicRule",["defaultMosaicMethod"])],t.prototype,"readDefaultMosaicRule",null),(0,r._)([(0,u.MZ)({type:String,json:{name:"layerDefinition.definitionExpression",write:{enabled:!0,allowNull:!0}}})],t.prototype,"definitionExpression",void 0),(0,r._)([(0,u.MZ)({readOnly:!0,constructOnly:!0})],t.prototype,"exportImageServiceParameters",void 0),(0,r._)([(0,u.MZ)()],t.prototype,"rasterInfo",void 0),(0,r._)([(0,u.MZ)({readOnly:!0,type:[K.A]})],t.prototype,"fields",void 0),(0,r._)([(0,u.MZ)({readOnly:!0})],t.prototype,"fieldsIndex",null),(0,r._)([(0,u.MZ)({type:["png","png8","png24","png32","jpg","bmp","gif","jpgpng","lerc","tiff"],json:{write:!0}})],t.prototype,"format",null),(0,r._)([(0,S.w)("service","format",["serviceDataType"])],t.prototype,"readFormat",null),(0,r._)([(0,u.MZ)({type:xe.A})],t.prototype,"fullExtent",void 0),(0,r._)([(0,u.MZ)({readOnly:!0})],t.prototype,"hasMultidimensions",void 0),(0,r._)([(0,u.MZ)({json:{read:{source:"maxImageHeight"}}})],t.prototype,"imageMaxHeight",void 0),(0,r._)([(0,u.MZ)({json:{read:{source:"maxImageWidth"}}})],t.prototype,"imageMaxWidth",void 0),(0,r._)([(0,u.MZ)({type:String,json:{type:k.SZ.jsonValues,read:k.SZ.read,write:k.SZ.write}})],t.prototype,"interpolation",void 0),(0,r._)([(0,u.MZ)()],t.prototype,"minScale",void 0),(0,r._)([(0,S.w)("service","minScale")],t.prototype,"readMinScale",null),(0,r._)([(0,u.MZ)()],t.prototype,"maxScale",void 0),(0,r._)([(0,S.w)("service","maxScale")],t.prototype,"readMaxScale",null),(0,r._)([(0,u.MZ)({type:H.A})],t.prototype,"mosaicRule",null),(0,r._)([(0,S.w)("mosaicRule",["mosaicRule","defaultMosaicMethod"])],t.prototype,"readMosaicRule",null),(0,r._)([(0,d.K)("mosaicRule")],t.prototype,"writeMosaicRule",null),(0,r._)([(0,u.MZ)()],t.prototype,"multidimensionalInfo",void 0),(0,r._)([(0,u.MZ)({type:X.A,json:{write:!0}})],t.prototype,"multidimensionalSubset",void 0),(0,r._)([(0,u.MZ)({json:{type:b.jz}})],t.prototype,"noData",void 0),(0,r._)([(0,d.K)("noData")],t.prototype,"writeNoData",null),(0,r._)([(0,u.MZ)({type:String,json:{type:k.hm.jsonValues,read:k.hm.read,write:k.hm.write}})],t.prototype,"noDataInterpretation",void 0),(0,r._)([(0,u.MZ)({type:String,readOnly:!0,json:{read:{source:["fields"]}}})],t.prototype,"objectIdField",void 0),(0,r._)([(0,S.w)("objectIdField")],t.prototype,"readObjectIdField",null),(0,r._)([(0,u.MZ)({readOnly:!0})],t.prototype,"geometryType",void 0),(0,r._)([(0,u.MZ)({})],t.prototype,"typeIdField",void 0),(0,r._)([(0,u.MZ)({})],t.prototype,"types",void 0),(0,r._)([(0,u.MZ)({readOnly:!0})],t.prototype,"parsedUrl",null),(0,r._)([(0,u.MZ)({type:Function})],t.prototype,"pixelFilter",void 0),(0,r._)([(0,u.MZ)()],t.prototype,"raster",void 0),(0,r._)([(0,u.MZ)({readOnly:!0})],t.prototype,"sourceType",void 0),(0,r._)([(0,S.w)("sourceType",["serviceSourceType","fields"])],t.prototype,"readSourceType",null),(0,r._)([(0,u.MZ)()],t.prototype,"viewId",void 0),(0,r._)([(0,u.MZ)({types:g.uy,json:{name:"layerDefinition.drawingInfo.renderer",origins:{"web-scene":{types:g.Gj,name:"layerDefinition.drawingInfo.renderer",write:{overridePolicy:e=>({enabled:e&&"vector-field"!==e.type&&"flow"!==e.type})}}}}})],t.prototype,"renderer",null),(0,r._)([(0,S.w)("renderer")],t.prototype,"readRenderer",null),(0,r._)([(0,d.K)("renderer")],t.prototype,"writeRenderer",null),(0,r._)([(0,u.MZ)({clonable:!1})],t.prototype,"symbolizer",void 0),(0,r._)([(0,u.MZ)(F.ke)],t.prototype,"opacity",void 0),(0,r._)([(0,u.MZ)({readOnly:!0})],t.prototype,"rasterFields",null),(0,r._)([(0,u.MZ)({constructOnly:!0})],t.prototype,"rasterFunctionInfos",void 0),(0,r._)([(0,u.MZ)({type:A.A})],t.prototype,"renderingRule",null),(0,r._)([(0,u.MZ)({type:A.A,json:{name:"renderingRule"}})],t.prototype,"rasterFunction",null),(0,r._)([(0,S.w)("rasterFunction",["renderingRule","rasterFunctionInfos"])],t.prototype,"readRasterFunction",null),(0,r._)([(0,u.MZ)({readOnly:!0})],t.prototype,"serviceDataType",void 0),(0,r._)([(0,u.MZ)({readOnly:!0,type:ge.A})],t.prototype,"spatialReference",void 0),(0,r._)([(0,S.w)("spatialReference",["spatialReference","extent"])],t.prototype,"readSpatialReference",null),(0,r._)([(0,u.MZ)({json:{type:k.e8.jsonValues}})],t.prototype,"pixelType",void 0),(0,r._)([(0,S.w)("pixelType")],t.prototype,"readPixelType",null),(0,r._)([(0,d.K)("pixelType")],t.prototype,"writePixelType",null),(0,r._)([(0,u.MZ)({constructOnly:!0,type:te.A})],t.prototype,"serviceRasterInfo",void 0),(0,r._)([(0,u.MZ)()],t.prototype,"sourceJSON",void 0),(0,r._)([(0,u.MZ)(F.OZ)],t.prototype,"url",void 0),(0,r._)([(0,u.MZ)({readOnly:!0})],t.prototype,"version",void 0),(0,r._)([(0,S.w)("version",["currentVersion","fields","timeInfo"])],t.prototype,"readVersion",null),t=(0,r._)([(0,c.$)("esri.layers.mixins.ArcGISImageService")],t),t};var fi=i(18768),wi=i(63074),vi=i(69208),_i=i(16131),Ri=i(8303),bi=i(54310),Si=i(25036),Mi=i(82935),Fi=i(91908),Ii=i(30291),xi=i(92935);let Ai=class extends((0,wi.d)((0,Mi.e)((0,Si.j)((0,_i.q)((0,Ri.A)(gi((0,bi.J)((0,vi.d)((0,fi.b)((0,a.P)((0,n.O)(m.A)))))))))))){constructor(...e){super(...e),this.isReference=null,this.operationalLayerType="ArcGISImageServiceLayer",this.popupEnabled=!0,this.popupTemplate=null,this.type="imagery",this._debouncedSaveOperations=(0,l.sg)((async(e,t,r)=>{const{save:s,saveAs:n}=await i.e(9838).then(i.bind(i,59838));switch(e){case xi.X.SAVE:return s(this,t);case xi.X.SAVE_AS:return n(this,r,t)}}))}normalizeCtorArgs(e,t){return"string"==typeof e?{url:e,...t}:e}load(e){const t=null!=e?e.signal:null;return this.addResolvingPromise(this.loadFromPortal({supportedTypes:["Image Service"]},e).catch(l.QP).then((()=>this._fetchService(t)))),Promise.resolve(this)}get legendEnabled(){return!this._isPreviewLayer&&(this._get("legendEnabled")??!0)}set legendEnabled(e){this._set("legendEnabled",e)}get listMode(){return this._isPreviewLayer?"hide":this._get("listMode")}set listMode(e){this._set("listMode",e)}writeOperationalLayerType(e,t,i){const r="vector-field"===this.renderer?.type;t[i]=r?"ArcGISImageServiceVectorLayer":"ArcGISImageServiceLayer"}get defaultPopupTemplate(){return this.createPopupTemplate()}get _isPreviewLayer(){return!(!this.raster||!this.url?.toLowerCase().includes("/rasterrendering/imageserver"))}createPopupTemplate(e){const t=this.rasterFields,i=this.title,r=new Set;let s=!1,n=!1;this.capabilities&&(s=this.capabilities.operations.supportsQuery&&this.fields&&this.fields.length>0,n="esriImageServiceDataTypeVector-UV"===this.serviceDataType||"esriImageServiceDataTypeVector-MagDir"===this.serviceDataType);const o=new Set;s&&o.add("raster.itempixelvalue");for(const e of t){const t=e.name.toLowerCase();o.has(t)||t.includes("raster.servicepixelvalue.")||r.add(e.name)}n&&r.add("raster.magnitude").add("raster.direction");const a=(0,Ii.tn)({fields:t,title:i},{...e,visibleFieldNames:r});return a?.fieldInfos&&this.rasterInfo?.pixelType.startsWith("f")&&a.fieldInfos.forEach((({format:e,fieldName:t})=>{e&&/^raster\.(item|service)pixelvalue/i.test(t)&&(e.places=2)})),a}queryFeatures(e,t){return this.queryRasters(e,t).then((e=>{if(e?.features)for(const t of e.features)t.layer=t.sourceLayer=this;return e}))}queryFeatureCount(e,t){return this.queryRasterCount(e,t)}redraw(){this.emit("redraw")}async save(e){return this._debouncedSaveOperations(xi.X.SAVE,e)}async saveAs(e,t){return this._debouncedSaveOperations(xi.X.SAVE_AS,t,e)}serviceSupportsSpatialReference(e){return(0,Fi.D)(this,e)}write(e,t){if(!this._isPreviewLayer)return super.write(e,t);if(t?.messages){const e=`${t.origin}/${t.layerContainerType||"operational-layers"}`;t.messages.push(new o.A("layer:unsupported",`Imagery preview layer (${this.title}, ${this.id}) of type '${this.declaredClass}' are not supported in the context of '${e}'`,{layer:this}))}return null}};(0,r._)([(0,u.MZ)(F.fV)],Ai.prototype,"legendEnabled",null),(0,r._)([(0,u.MZ)({type:["show","hide"]})],Ai.prototype,"listMode",null),(0,r._)([(0,u.MZ)({type:Boolean,json:{read:!1,write:{enabled:!0,overridePolicy:()=>({enabled:!1})}}})],Ai.prototype,"isReference",void 0),(0,r._)([(0,u.MZ)({type:["ArcGISImageServiceLayer"],json:{origins:{"web-map":{type:["ArcGISImageServiceLayer","ArcGISImageServiceVectorLayer"],read:!1,write:{target:"layerType",ignoreOrigin:!0}}}}})],Ai.prototype,"operationalLayerType",void 0),(0,r._)([(0,d.K)("web-map","operationalLayerType")],Ai.prototype,"writeOperationalLayerType",null),(0,r._)([(0,u.MZ)(F.M6)],Ai.prototype,"popupEnabled",void 0),(0,r._)([(0,u.MZ)({type:s.A,json:{read:{source:"popupInfo"},write:{target:"popupInfo"}}})],Ai.prototype,"popupTemplate",void 0),(0,r._)([(0,u.MZ)({readOnly:!0})],Ai.prototype,"defaultPopupTemplate",null),(0,r._)([(0,u.MZ)({readOnly:!0,json:{read:!1}})],Ai.prototype,"type",void 0),(0,r._)([(0,u.MZ)({readOnly:!0})],Ai.prototype,"_isPreviewLayer",null),Ai=(0,r._)([(0,c.$)("esri.layers.ImageryLayer")],Ai);const ji=Ai},43334:(e,t,i)=>{i.d(t,{N3:()=>s,Om:()=>r});class r{constructor(e=null,t={},i,r){this.geometry=e,this.attributes=t,this.centroid=i,this.objectId=r,this.displayId=0,this.geohashX=0,this.geohashY=0}weakClone(){const e=new r(this.geometry,this.attributes,this.centroid,this.objectId);return e.displayId=this.displayId,e.geohashX=this.geohashX,e.geohashY=this.geohashY,e}clone(){const e=this.geometry?.clone(),t=new r(e,{...this.attributes},this.centroid?.clone(),this.objectId);return t.displayId=this.displayId,t.geohashX=this.geohashX,t.geohashY=this.geohashY,t}}function s(e){return!!e.geometry?.coords?.length}},58512:(e,t,i)=>{i.d(t,{A:()=>r});class r{constructor(){this.objectIdFieldName=null,this.globalIdFieldName=null,this.geohashFieldName=null,this.geometryProperties=null,this.geometryType=null,this.spatialReference=null,this.hasZ=!1,this.hasM=!1,this.features=[],this.fields=[],this.transform=null,this.exceededTransferLimit=!1,this.uniqueIdField=null,this.queryGeometryType=null,this.queryGeometry=null}weakClone(){const e=new r;return e.objectIdFieldName=this.objectIdFieldName,e.globalIdFieldName=this.globalIdFieldName,e.geohashFieldName=this.geohashFieldName,e.geometryProperties=this.geometryProperties,e.geometryType=this.geometryType,e.spatialReference=this.spatialReference,e.hasZ=this.hasZ,e.hasM=this.hasM,e.features=this.features,e.fields=this.fields,e.transform=this.transform,e.exceededTransferLimit=this.exceededTransferLimit,e.uniqueIdField=this.uniqueIdField,e.queryGeometry=this.queryGeometry,e.queryGeometryType=this.queryGeometryType,e}}},92722:(e,t,i)=>{i.d(t,{A:()=>r});class r{constructor(e=[],t=[],i=!1){this.lengths=e??[],this.coords=t??[],this.hasIndeterminateRingOrder=i}static fromRect(e){const[t,i,s,n]=e,o=s-t,a=n-i;return new r([5],[t,i,o,0,0,a,-o,0,0,-a])}get isPoint(){return 0===this.lengths.length}get maxLength(){return Math.max(...this.lengths)}get size(){return this.lengths.reduce(((e,t)=>e+t))}forEachVertex(e){let t=0;this.lengths.length||e(this.coords[0],this.coords[1]);for(let i=0;i<this.lengths.length;i++){const r=this.lengths[i];for(let i=0;i<r;i++)e(this.coords[2*(i+t)],this.coords[2*(i+t)+1]);t+=r}}deltaDecode(){const e=this.clone(),{coords:t,lengths:i}=e;let r=0;for(const e of i){for(let i=1;i<e;i++)t[2*(r+i)]+=t[2*(r+i)-2],t[2*(r+i)+1]+=t[2*(r+i)-1];r+=e}return e}clone(e){if(0===this.lengths.length)return new r([],[this.coords[0],this.coords[1]]);const t=2*(0===this.lengths.length?1:this.lengths.reduce(((e,t)=>e+t))),i=this.coords.slice(0,t);return e?(e.set(i),new r(this.lengths,e,this.hasIndeterminateRingOrder)):new r(Array.from(this.lengths),Array.from(i),this.hasIndeterminateRingOrder)}}},95466:(e,t,i)=>{i.d(t,{A:()=>d});var r=i(49186),s=i(25482),n=i(53966),o=i(91869),a=i(3330),l=i(30524),u=i(56400),p=i(96285);const c=new Map;class d{static fromJSON(e){return new d(e.fields,e.timeZoneByFieldName)}static fromLayer(e){return new d(e.fields??[],g(e))}static fromLayerJSON(e){return new d(e.fields??[],g(e))}constructor(e=[],t){this._fieldsMap=new Map,this._normalizedFieldsMap=new Map,this._dateFieldsSet=new Set,this._numericFieldsSet=new Set,this._requiredFields=null,this.dateFields=[],this.numericFields=[],this.fields=e||[],this._timeZoneByFieldName=t?new Map(t):null;const i=[];for(const e of this.fields){const t=e?.name,r=h(t);if(t&&r){const s=m(t);this._fieldsMap.set(t,e),this._fieldsMap.set(s,e),this._normalizedFieldsMap.set(r,e),i.push(`${s}:${e.type}:${this._timeZoneByFieldName?.get(t)}`),(0,l.vE)(e)?(this.dateFields.push(e),this._dateFieldsSet.add(e)):(0,l.WA)(e)&&(this._numericFieldsSet.add(e),this.numericFields.push(e)),(0,l.te)(e)||(0,l.Xz)(e)||(e.editable=null==e.editable||!!e.editable,e.nullable=null==e.nullable||!!e.nullable)}}i.sort(),this.uid=i.join()}get requiredFields(){if(!this._requiredFields){this._requiredFields=[];for(const e of this.fields)(0,l.te)(e)||(0,l.Xz)(e)||e.nullable||void 0!==(0,l.lD)(e)||this._requiredFields.push(e)}return this._requiredFields}equals(e){return this.uid===e?.uid}has(e){return null!=this.get(e)}get(e){if(!e)return;let t=this._fieldsMap.get(e);return t||(t=this._fieldsMap.get(m(e))??this._normalizedFieldsMap.get(h(e)),t&&this._fieldsMap.set(e,t),t)}getTimeZone(e){const t=this.get(e&&"string"!=typeof e?e.name:e);return t?this._timeZoneByFieldName?this._timeZoneByFieldName.get(t.name):"date"===t.type||"esriFieldTypeDate"===t.type?(n.A.getLogger("esri.layers.support.FieldsIndex").error(new r.A("getTimeZone:no-timezone-information",`no time zone information for field '${t.name}'`)),u.n$):y.has(t.type)?u.L5:null:null}getLuxonTimeZone(e){const t=this.getTimeZone(e);return t?t===u.L5?a.GB.instance:t===u.n$?p.mQ.utcInstance:(0,o.tE)(c,t,(()=>p.oh.create(t))):null}isDateField(e){return this._dateFieldsSet.has(this.get(e))}isTimeOnlyField(e){return(0,l.OH)(this.get(e))}isNumericField(e){return this._numericFieldsSet.has(this.get(e))}normalizeFieldName(e){return this.get(e)?.name??void 0}toJSON(){return{fields:this.fields.map((e=>(0,s.Wj)(e)?e.toJSON():e)),timeZoneByFieldName:this._timeZoneByFieldName?Array.from(this._timeZoneByFieldName.entries()):null}}}function m(e){return e.trim().toLowerCase()}function h(e){return(0,l.rS)(e)?.toLowerCase()??""}const y=new Set(["time-only","date-only","timestamp-offset","esriFieldTypeDateOnly","esriFieldTypeTimeOnly","esriFieldTypeTimestampOffset"]);function g(e){const t=new Map;if(!e.fields)return t;const i=!0===e.datesInUnknownTimezone,{timeInfo:r,editFieldsInfo:s}=e,n=(r?"startField"in r?r.startField:r.startTimeField:"")??"",o=(r?"endField"in r?r.endField:r.endTimeField:"")??"",a=function(e){return"dateFieldsTimeZone"in e}(e)?e.dateFieldsTimeZone??null:e.dateFieldsTimeReference?(0,u.ZS)(e.dateFieldsTimeReference):null,l=s?function(e){return"timeZone"in e}(s)?s.timeZone??a:s.dateFieldsTimeReference?(0,u.ZS)(s.dateFieldsTimeReference):a??u.n$:null,p=r?function(e){return"timeZone"in e}(r)?r.timeZone??a:r.timeReference?(0,u.ZS)(r.timeReference):a:null,c=new Map([[m(s?.creationDateField??""),l],[m(s?.editDateField??""),l],[m(n),p],[m(o),p]]);for(const{name:r,type:s}of e.fields)if(y.has(s))t.set(r,u.L5);else if("date"!==s&&"esriFieldTypeDate"!==s)t.set(r,null);else if(i)t.set(r,u.L5);else{const e=c.get(m(r??""))??a;t.set(r,e)}return t}},33446:(e,t,i)=>{i.d(t,{C:()=>o,m:()=>n});var r=i(49186),s=i(74887);async function n(e,t,i){let n;try{n=await createImageBitmap(e)}catch(e){throw new r.A("request:server",`Unable to load ${t}`,{url:t,error:e})}return(0,s.Te)(i),n}async function o(e,t,i,n,o){let a;try{a=await createImageBitmap(e)}catch(e){throw new r.A("request:server",`Unable to load tile ${t}/${i}/${n}`,{error:e,level:t,row:i,col:n})}return(0,s.Te)(o),a}},91908:(e,t,i)=>{i.d(t,{D:()=>n});var r=i(60694);const s=[];function n(e,t){if((0,r.Wo)(e.url??""))return!0;const{wkid:i}=t;for(const t of s){if((e.version??0)>=t[0])return!0;if("function"==typeof t[1]&&(t[1]=t[1]()),t[1].has(i))return!1}return!0}s.push([10.91,()=>{const e=new Set([9709,9716,9741,9761,9766]);for(let t=9712;t<=9713;t++)e.add(t);for(let t=9748;t<=9749;t++)e.add(t);for(let t=20904;t<=20932;t++)e.add(t);for(let t=21004;t<=21032;t++)e.add(t);for(let t=21207;t<=21264;t++)e.add(t);for(let t=21307;t<=21364;t++)e.add(t);for(let t=23301;t<=23333;t++)e.add(t);for(let t=102759;t<=102760;t++)e.add(t);for(let t=102934;t<=102955;t++)e.add(t);return e}]),s.push([10.9,()=>{const e=new Set([9300,9354,9364,9367,9373,9377,9387,9456,9473,9498,9678,9680,29874,103599,103872,104028]);for(let t=9356;t<=9360;t++)e.add(t);for(let t=9404;t<=9407;t++)e.add(t);for(let t=9476;t<=9482;t++)e.add(t);for(let t=9487;t<=9494;t++)e.add(t);for(let t=9697;t<=9699;t++)e.add(t);return e}]),s.push([10.81,()=>{const e=new Set([9265,9333,103598,103699]);for(let t=9248;t<=9254;t++)e.add(t);for(let t=9271;t<=9273;t++)e.add(t);for(let t=9284;t<=9285;t++)e.add(t);for(let t=21453;t<=21463;t++)e.add(t);return e}]),s.push([10.8,()=>{const e=new Set([8088,8395,8428,8433,8531,8687,8692,8694,8699,8900,9003,9006,9009,9012,9017,9191]);for(let t=8035;t<=8036;t++)e.add(t);for(let t=8455;t<=8456;t++)e.add(t);for(let t=8518;t<=8529;t++)e.add(t);for(let t=8533;t<=8536;t++)e.add(t);for(let t=8538;t<=8540;t++)e.add(t);for(let t=8677;t<=8679;t++)e.add(t);for(let t=8902;t<=8903;t++)e.add(t);for(let t=8907;t<=8910;t++)e.add(t);for(let t=8949;t<=8951;t++)e.add(t);for(let t=8972;t<=8987;t++)e.add(t);for(let t=9039;t<=9040;t++)e.add(t);for(let t=9068;t<=9069;t++)e.add(t);for(let t=9140;t<=9141;t++)e.add(t);for(let t=9148;t<=9150;t++)e.add(t);for(let t=9153;t<=9159;t++)e.add(t);for(let t=9205;t<=9218;t++)e.add(t);for(let t=9221;t<=9222;t++)e.add(t);for(let t=54098;t<=54101;t++)e.add(t);return e}]),s.push([10.71,()=>{const e=new Set([6316]);for(let t=8351;t<=8353;t++)e.add(t);for(let t=9294;t<=9297;t++)e.add(t);for(let t=22619;t<=22621;t++)e.add(t);for(let t=103586;t<=103594;t++)e.add(t);return e}]),s.push([10.7,()=>{const e=new Set([8387,8391,8427,8545,8682,8685,8818,31370,104022,104024,104975]);for(let t=8065;t<=8068;t++)e.add(t);for(let t=8082;t<=8083;t++)e.add(t);for(let t=8379;t<=8385;t++)e.add(t);for(let t=8836;t<=8840;t++)e.add(t);for(let t=8857;t<=8860;t++)e.add(t);for(let t=53035;t<=53037;t++)e.add(t);for(let t=54090;t<=54091;t++)e.add(t);for(let t=102498;t<=102499;t++)e.add(t);return e}]),s.push([10.61,()=>new Set([102497])]),s.push([10.6,()=>{const e=new Set([7803,7805,7887,8086,8232,8237,8240,8246,8249,8252,8255,9019,9391]);for(let t=7755;t<=7787;t++)e.add(t);for(let t=7791;t<=7795;t++)e.add(t);for(let t=7799;t<=7801;t++)e.add(t);for(let t=7825;t<=7831;t++)e.add(t);for(let t=7877;t<=7878;t++)e.add(t);for(let t=7882;t<=7883;t++)e.add(t);for(let t=7991;t<=7992;t++)e.add(t);for(let t=8042;t<=8043;t++)e.add(t);for(let t=8058;t<=8059;t++)e.add(t);for(let t=8311;t<=8348;t++)e.add(t);for(let t=9060;t<=9067;t++)e.add(t);for(let t=102562;t<=102568;t++)e.add(t);for(let t=102799;t<=102900;t++)e.add(t);return e}])},20615:(e,t,i)=>{i.d(t,{I:()=>o});var r=i(2272),s=i(80893),n=i(61956);async function o(e,t,i){const o=(0,r.Dl)(e);return(0,s.gW)(o,n.A.from(t),{...i}).then((e=>e.data.count))}},78286:(e,t,i)=>{i.d(t,{V:()=>o});var r=i(2272),s=i(80893),n=i(61956);async function o(e,t,i){const o=(0,r.Dl)(e);return(0,s.Pk)(o,n.A.from(t),{...i}).then((e=>e.data.objectIds))}},99199:(e,t,i)=>{i.d(t,{e:()=>l,s:()=>a});var r=i(2272),s=i(80893),n=i(22671),o=i(61956);async function a(e,t,i){const r=await l(e,t,i);return n.A.fromJSON(r)}async function l(e,t,i){const n=(0,r.Dl)(e),a={...i},l=o.A.from(t),{data:u}=await(0,s.eW)(n,l,l.sourceSpatialReference,a);return u}},58501:(e,t,i)=>{i.d(t,{q:()=>s});var r=i(62815);function s(e,t,i){if(!i?.features||!i.hasZ)return;const s=(0,r.N)(i.geometryType,t,e.outSpatialReference);if(null!=s)for(const e of i.features)s(e.geometry)}},77073:(e,t,i)=>{i.d(t,{A:()=>c});var r,s=i(90237),n=i(25482),o=i(10107),a=i(56507),l=(i(87811),i(44208),i(40608));const u={1:{id:1,rotation:0,mirrored:!1},2:{id:2,rotation:0,mirrored:!0},3:{id:3,rotation:180,mirrored:!1},4:{id:4,rotation:180,mirrored:!0},5:{id:5,rotation:-90,mirrored:!0},6:{id:6,rotation:90,mirrored:!1},7:{id:7,rotation:90,mirrored:!0},8:{id:8,rotation:-90,mirrored:!1}};let p=r=class extends n.oY{constructor(e){super(e),this.contentType=null,this.exifInfo=null,this.id=null,this.globalId=null,this.keywords=null,this.name=null,this.parentGlobalId=null,this.parentObjectId=null,this.size=null,this.url=null}get orientationInfo(){const{exifInfo:e}=this,t=function(e){const{exifInfo:t,exifName:i,tagName:r}=e;if(!t||!i||!r)return null;const s=t.find((e=>e.name===i));return s?function(e){const{tagName:t,tags:i}=e;if(!i||!t)return null;const r=i.find((e=>e.name===t));return r?.value||null}({tagName:r,tags:s.tags}):null}({exifName:"Exif IFD0",tagName:"Orientation",exifInfo:e});return u[t]||null}clone(){return new r({contentType:this.contentType,exifInfo:this.exifInfo,id:this.id,globalId:this.globalId,keywords:this.keywords,name:this.name,parentGlobalId:this.parentGlobalId,parentObjectId:this.parentObjectId,size:this.size,url:this.url})}};(0,s._)([(0,o.MZ)({type:String})],p.prototype,"contentType",void 0),(0,s._)([(0,o.MZ)()],p.prototype,"exifInfo",void 0),(0,s._)([(0,o.MZ)({readOnly:!0})],p.prototype,"orientationInfo",null),(0,s._)([(0,o.MZ)({type:a.jz})],p.prototype,"id",void 0),(0,s._)([(0,o.MZ)({type:String})],p.prototype,"globalId",void 0),(0,s._)([(0,o.MZ)({type:String})],p.prototype,"keywords",void 0),(0,s._)([(0,o.MZ)({type:String})],p.prototype,"name",void 0),(0,s._)([(0,o.MZ)({json:{read:!1}})],p.prototype,"parentGlobalId",void 0),(0,s._)([(0,o.MZ)({json:{read:!1}})],p.prototype,"parentObjectId",void 0),(0,s._)([(0,o.MZ)({type:a.jz})],p.prototype,"size",void 0),(0,s._)([(0,o.MZ)({json:{read:!1}})],p.prototype,"url",void 0),p=r=(0,s._)([(0,l.$)("esri.rest.query.support.AttachmentInfo")],p);const c=p},54546:(e,t,i)=>{i.d(t,{A:()=>d});var r,s=i(90237),n=i(25482),o=i(4718),a=i(10107),l=i(56507),u=i(40608),p=i(43937);let c=r=class extends n.oY{constructor(e){super(e),this.attachmentTypes=null,this.attachmentsWhere=null,this.cacheHint=void 0,this.keywords=null,this.globalIds=null,this.name=null,this.num=null,this.objectIds=null,this.returnMetadata=!1,this.size=null,this.start=null,this.where=null}writeStart(e,t){t.resultOffset=this.start,t.resultRecordCount=this.num||10}clone(){return new r((0,o.o8)({attachmentTypes:this.attachmentTypes,attachmentsWhere:this.attachmentsWhere,cacheHint:this.cacheHint,keywords:this.keywords,where:this.where,globalIds:this.globalIds,name:this.name,num:this.num,objectIds:this.objectIds,returnMetadata:this.returnMetadata,size:this.size,start:this.start}))}};(0,s._)([(0,a.MZ)({type:[String],json:{write:!0}})],c.prototype,"attachmentTypes",void 0),(0,s._)([(0,a.MZ)({type:String,json:{read:{source:"attachmentsDefinitionExpression"},write:{target:"attachmentsDefinitionExpression"}}})],c.prototype,"attachmentsWhere",void 0),(0,s._)([(0,a.MZ)({type:Boolean,json:{write:!0}})],c.prototype,"cacheHint",void 0),(0,s._)([(0,a.MZ)({type:[String],json:{write:!0}})],c.prototype,"keywords",void 0),(0,s._)([(0,a.MZ)({type:[Number],json:{write:!0}})],c.prototype,"globalIds",void 0),(0,s._)([(0,a.MZ)({json:{write:!0}})],c.prototype,"name",void 0),(0,s._)([(0,a.MZ)({type:Number,json:{read:{source:"resultRecordCount"}}})],c.prototype,"num",void 0),(0,s._)([(0,a.MZ)({type:[Number],json:{write:!0}})],c.prototype,"objectIds",void 0),(0,s._)([(0,a.MZ)({type:Boolean,json:{default:!1,write:!0}})],c.prototype,"returnMetadata",void 0),(0,s._)([(0,a.MZ)({type:[Number],json:{write:!0}})],c.prototype,"size",void 0),(0,s._)([(0,a.MZ)({type:Number,json:{read:{source:"resultOffset"}}})],c.prototype,"start",void 0),(0,s._)([(0,p.K)("start"),(0,p.K)("num")],c.prototype,"writeStart",null),(0,s._)([(0,a.MZ)({type:String,json:{read:{source:"definitionExpression"},write:{target:"definitionExpression"}}})],c.prototype,"where",void 0),c=r=(0,s._)([(0,u.$)("esri.rest.support.AttachmentQuery")],c),c.from=(0,l.dp)(c);const d=c},26591:(e,t,i)=>{i.r(t),i.d(t,{default:()=>h});var r,s=i(90237),n=(i(59456),i(25482)),o=i(4718),a=i(10107),l=i(56507),u=i(40608),p=i(43937),c=i(27733),d=i(16930);let m=r=class extends n.oY{constructor(e){super(e),this.cacheHint=void 0,this.dynamicDataSource=void 0,this.gdbVersion=null,this.geometryPrecision=void 0,this.historicMoment=null,this.maxAllowableOffset=void 0,this.objectIds=null,this.orderByFields=null,this.outFields=null,this.outSpatialReference=null,this.relationshipId=void 0,this.start=void 0,this.num=void 0,this.returnGeometry=!1,this.returnM=void 0,this.returnZ=void 0,this.where=null}_writeHistoricMoment(e,t){t.historicMoment=e&&e.getTime()}writeStart(e,t){t.resultOffset=this.start,t.resultRecordCount=this.num||10,this.start>0&&null==this.where&&(t.definitionExpression="1=1")}clone(){return new r((0,o.o8)({cacheHint:this.cacheHint,dynamicDataSource:this.dynamicDataSource,gdbVersion:this.gdbVersion,geometryPrecision:this.geometryPrecision,historicMoment:this.historicMoment&&new Date(this.historicMoment.getTime()),maxAllowableOffset:this.maxAllowableOffset,objectIds:this.objectIds,orderByFields:this.orderByFields,outFields:this.outFields,outSpatialReference:this.outSpatialReference,relationshipId:this.relationshipId,start:this.start,num:this.num,returnGeometry:this.returnGeometry,where:this.where,returnZ:this.returnZ,returnM:this.returnM}))}};(0,s._)([(0,a.MZ)({type:Boolean,json:{write:!0}})],m.prototype,"cacheHint",void 0),(0,s._)([(0,a.MZ)({type:c.L,json:{write:!0}})],m.prototype,"dynamicDataSource",void 0),(0,s._)([(0,a.MZ)({type:String,json:{write:!0}})],m.prototype,"gdbVersion",void 0),(0,s._)([(0,a.MZ)({type:Number,json:{write:!0}})],m.prototype,"geometryPrecision",void 0),(0,s._)([(0,a.MZ)({type:Date})],m.prototype,"historicMoment",void 0),(0,s._)([(0,p.K)("historicMoment")],m.prototype,"_writeHistoricMoment",null),(0,s._)([(0,a.MZ)({type:Number,json:{write:!0}})],m.prototype,"maxAllowableOffset",void 0),(0,s._)([(0,a.MZ)({type:[Number],json:{write:!0}})],m.prototype,"objectIds",void 0),(0,s._)([(0,a.MZ)({type:[String],json:{write:!0}})],m.prototype,"orderByFields",void 0),(0,s._)([(0,a.MZ)({type:[String],json:{write:!0}})],m.prototype,"outFields",void 0),(0,s._)([(0,a.MZ)({type:d.A,json:{read:{source:"outSR"},write:{target:"outSR"}}})],m.prototype,"outSpatialReference",void 0),(0,s._)([(0,a.MZ)({json:{write:!0}})],m.prototype,"relationshipId",void 0),(0,s._)([(0,a.MZ)({type:Number,json:{read:{source:"resultOffset"}}})],m.prototype,"start",void 0),(0,s._)([(0,p.K)("start"),(0,p.K)("num")],m.prototype,"writeStart",null),(0,s._)([(0,a.MZ)({type:Number,json:{read:{source:"resultRecordCount"}}})],m.prototype,"num",void 0),(0,s._)([(0,a.MZ)({json:{write:!0}})],m.prototype,"returnGeometry",void 0),(0,s._)([(0,a.MZ)({type:Boolean,json:{write:{overridePolicy:e=>({enabled:e})}}})],m.prototype,"returnM",void 0),(0,s._)([(0,a.MZ)({type:Boolean,json:{write:{overridePolicy:e=>({enabled:e})}}})],m.prototype,"returnZ",void 0),(0,s._)([(0,a.MZ)({type:String,json:{read:{source:"definitionExpression"},write:{target:"definitionExpression"}}})],m.prototype,"where",void 0),m=r=(0,s._)([(0,u.$)("esri.rest.support.RelationshipQuery")],m),m.from=(0,l.dp)(m);const h=m},57561:(e,t,i)=>{i.d(t,{A:()=>b});var r,s=i(90237),n=i(59456),o=i(60945),a=i(66552),l=i(25482),u=i(4718),p=i(10107),c=i(56507),d=i(40608),m=i(43937),h=i(65864);i(44208),i(53966),i(87811);let y=r=class extends l.oY{constructor(e){super(e),this.groupByFields=void 0,this.topCount=void 0,this.orderByFields=void 0}clone(){return new r({groupByFields:this.groupByFields,topCount:this.topCount,orderByFields:this.orderByFields})}};(0,s._)([(0,p.MZ)({type:[String],json:{write:!0}})],y.prototype,"groupByFields",void 0),(0,s._)([(0,p.MZ)({type:Number,json:{write:!0}})],y.prototype,"topCount",void 0),(0,s._)([(0,p.MZ)({type:[String],json:{write:!0}})],y.prototype,"orderByFields",void 0),y=r=(0,s._)([(0,d.$)("esri.rest.support.TopFilter")],y);const g=y;var f,w=i(16930);const v=new a.J({esriSpatialRelIntersects:"intersects",esriSpatialRelContains:"contains",esriSpatialRelCrosses:"crosses",esriSpatialRelDisjoint:"disjoint",esriSpatialRelEnvelopeIntersects:"envelope-intersects",esriSpatialRelIndexIntersects:"index-intersects",esriSpatialRelOverlaps:"overlaps",esriSpatialRelTouches:"touches",esriSpatialRelWithin:"within",esriSpatialRelRelation:"relation"}),_=new a.J({esriSRUnit_Meter:"meters",esriSRUnit_Kilometer:"kilometers",esriSRUnit_Foot:"feet",esriSRUnit_StatuteMile:"miles",esriSRUnit_NauticalMile:"nautical-miles",esriSRUnit_USNauticalMile:"us-nautical-miles"});let R=f=class extends l.oY{constructor(e){super(e),this.cacheHint=void 0,this.distance=void 0,this.geometry=null,this.geometryPrecision=void 0,this.maxAllowableOffset=void 0,this.num=void 0,this.objectIds=null,this.orderByFields=null,this.outFields=null,this.outSpatialReference=null,this.resultType=null,this.returnGeometry=!1,this.returnM=void 0,this.returnZ=void 0,this.start=void 0,this.spatialRelationship="intersects",this.timeExtent=null,this.topFilter=void 0,this.units=null,this.where="1=1"}writeStart(e,t){t.resultOffset=this.start,t.resultRecordCount=this.num||10}clone(){return new f((0,u.o8)({cacheHint:this.cacheHint,distance:this.distance,geometry:this.geometry,geometryPrecision:this.geometryPrecision,maxAllowableOffset:this.maxAllowableOffset,num:this.num,objectIds:this.objectIds,orderByFields:this.orderByFields,outFields:this.outFields,outSpatialReference:this.outSpatialReference,resultType:this.resultType,returnGeometry:this.returnGeometry,returnZ:this.returnZ,returnM:this.returnM,start:this.start,spatialRelationship:this.spatialRelationship,timeExtent:this.timeExtent,topFilter:this.topFilter,units:this.units,where:this.where}))}};(0,s._)([(0,p.MZ)({type:Boolean,json:{write:!0}})],R.prototype,"cacheHint",void 0),(0,s._)([(0,p.MZ)({type:Number,json:{write:{overridePolicy:e=>({enabled:e>0})}}})],R.prototype,"distance",void 0),(0,s._)([(0,p.MZ)({types:n.yR,json:{read:h.rS,write:!0}})],R.prototype,"geometry",void 0),(0,s._)([(0,p.MZ)({type:Number,json:{write:!0}})],R.prototype,"geometryPrecision",void 0),(0,s._)([(0,p.MZ)({type:Number,json:{write:!0}})],R.prototype,"maxAllowableOffset",void 0),(0,s._)([(0,p.MZ)({type:Number,json:{read:{source:"resultRecordCount"}}})],R.prototype,"num",void 0),(0,s._)([(0,p.MZ)({json:{write:!0}})],R.prototype,"objectIds",void 0),(0,s._)([(0,p.MZ)({type:[String],json:{write:!0}})],R.prototype,"orderByFields",void 0),(0,s._)([(0,p.MZ)({type:[String],json:{write:!0}})],R.prototype,"outFields",void 0),(0,s._)([(0,p.MZ)({type:w.A,json:{read:{source:"outSR"},write:{target:"outSR"}}})],R.prototype,"outSpatialReference",void 0),(0,s._)([(0,p.MZ)({type:String,json:{write:!0}})],R.prototype,"resultType",void 0),(0,s._)([(0,p.MZ)({json:{write:!0}})],R.prototype,"returnGeometry",void 0),(0,s._)([(0,p.MZ)({type:Boolean,json:{write:{overridePolicy:e=>({enabled:e})}}})],R.prototype,"returnM",void 0),(0,s._)([(0,p.MZ)({type:Boolean,json:{write:{overridePolicy:e=>({enabled:e})}}})],R.prototype,"returnZ",void 0),(0,s._)([(0,p.MZ)({type:Number,json:{read:{source:"resultOffset"}}})],R.prototype,"start",void 0),(0,s._)([(0,m.K)("start"),(0,m.K)("num")],R.prototype,"writeStart",null),(0,s._)([(0,p.MZ)({type:String,json:{read:{source:"spatialRel",reader:v.read},write:{target:"spatialRel",writer:v.write}}})],R.prototype,"spatialRelationship",void 0),(0,s._)([(0,p.MZ)({type:o.A,json:{write:!0}})],R.prototype,"timeExtent",void 0),(0,s._)([(0,p.MZ)({type:g,json:{write:!0}})],R.prototype,"topFilter",void 0),(0,s._)([(0,p.MZ)({type:String,json:{read:_.read,write:{writer:_.write,overridePolicy(e){return{enabled:null!=e&&null!=this.distance&&this.distance>0}}}}})],R.prototype,"units",void 0),(0,s._)([(0,p.MZ)({type:String,json:{write:!0}})],R.prototype,"where",void 0),R=f=(0,s._)([(0,d.$)("esri.rest.support.TopFeaturesQuery")],R),R.from=(0,c.dp)(R);const b=R}}]);
@@ -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{indexOf as e,PositionHint as t}from"../../../core/arrayUtils.js";import i from"../../../core/Error.js";import{isSerializable as s}from"../../../core/JSONSupport.js";import{clone as r}from"../../../core/lang.js";import{removeMaybe as a,destroyMaybe as n}from"../../../core/maybe.js";import{MemCacheStorage as l,MemCache as u}from"../../../core/MemCache.js";import{signalFromSignalOrOptions as o,throwIfAborted as h}from"../../../core/promiseUtils.js";import{getMetersPerUnitForSR as c}from"../../../core/unitUtils.js";import{getTransformation as m}from"../../../geometry/projection.js";import{set as y,negativeInfinity as f,create as p,expandWithAABB as d}from"../../../geometry/support/aaBoundingBox.js";import{fromValues as g,create as x}from"../../../geometry/support/aaBoundingRect.js";import{getBoundsXY as _}from"../../../geometry/support/boundsUtils.js";import{fromJSON as w,isExtent as F,isPolygon as S}from"../../../geometry/support/jsonUtils.js";import{normalizeCentralMeridian as R}from"../../../geometry/support/normalizeUtils.js";import{equals as Q,isValid as I}from"../../../geometry/support/spatialReferenceUtils.js";import{convertFromGeometry as j}from"../featureConversionUtils.js";import{getWhereClause as E}from"./attributeSupport.js";import{cleanFromGeometryEngine as b,getGeometry as A}from"./geometryUtils.js";import{checkProjectionSupport as T,project as v,projectMany as C}from"./projectionSupport.js";import{queryCapabilities as M}from"./QueryEngineCapabilities.js";import{QueryEngineResult as G}from"./QueryEngineResult.js";import{queryEngineEmptyResult as O,normalizeQueryLike as P,normalizeQuery as z}from"./queryUtils.js";import{validateQuery as B,validateStatisticsQuery as q}from"./queryValidationUtils.js";import{getSpatialQueryOperator as k,canQueryWithRBush as U}from"./spatialQuerySupport.js";import{getTimeExtent as Z,getTimeOperator as H}from"./timeSupport.js";import J from"../../support/FieldsIndex.js";import{noBudget as N}from"../../../views/support/Scheduler.js";const L="unsupported-query";class V{constructor(e,t=null,i,s,r){this.attributes=e,this.geometry=i,this.centroid=s,this.filterFlags=r,this.groupId=-1,this.displayId=t}}const D=new l(2e6);let W=0;class ${constructor(e){this._geometryQueryCache=null,this._changeHandle=null,this.capabilities={query:M},this.geometryType=e.geometryType,this.hasM=!!e.hasM,this.hasZ=!!e.hasZ,this.objectIdField=e.objectIdField,this.spatialReference=e.spatialReference,this.definitionExpression=e.definitionExpression,this.featureStore=e.featureStore,this.aggregateAdapter=e.aggregateAdapter,this._changeHandle=this.featureStore.events.on("changed",(()=>this.clearCache())),this.timeInfo=e.timeInfo,e.cacheSpatialQueries&&(this._geometryQueryCache=new u(W+++"$$",D)),this.fieldsIndex=s(e.fieldsIndex)?e.fieldsIndex:J.fromJSON(e.fieldsIndex),!e.availableFields||1===e.availableFields.length&&"*"===e.availableFields[0]?this.availableFields=new Set(this.fieldsIndex.fields.map((e=>e.name))):this.availableFields=new Set(e.availableFields.map((e=>this.fieldsIndex.get(e)?.name)).filter((e=>null!=e))),e.scheduler&&e.priority&&(this._frameTask=e.scheduler.registerTask(e.priority))}destroy(){this._frameTask=a(this._frameTask),this.clearCache(),n(this._geometryQueryCache),this._changeHandle=a(this._changeHandle)}get featureAdapter(){return this.featureStore.featureAdapter}clearCache(){this._geometryQueryCache?.clear(),this._allFeaturesPromise=null,this._timeExtentPromise=null,this._fullExtentPromise=null}async executeQuery(e,t){const i=o(t);try{return(await this._executeQuery(e,{},i)).createQueryResponse()}catch(s){if(s!==O)throw s;return new G([],e,this).createQueryResponse()}}async executeQueryForCount(e={},t){const i=o(t);try{return(await this._executeQuery(e,{returnGeometry:!1,returnCentroid:!1,outSR:null},i)).createQueryResponseForCount()}catch(s){if(s!==O)throw s;return 0}}async executeQueryForExtent(e,t){const i=o(t),s=e.outSR;try{const t=await this._executeQuery(e,{returnGeometry:!0,returnCentroid:!1,outSR:null},i),r=t.size;if(!r)return{count:0,extent:null};return{count:r,extent:await this._getBounds(t.items,t.spatialReference,s||this.spatialReference)}}catch(r){if(r===O)return{count:0,extent:null};throw r}}async executeQueryForIds(e,t){return this.executeQueryForIdSet(e,t).then((e=>Array.from(e)))}async executeQueryForIdSet(e,t){const i=o(t);try{const t=await this._executeQuery(e,{returnGeometry:!0,returnCentroid:!1,outSR:null},i),s=t.items,r=new Set;return await this._reschedule((()=>{for(const e of s)r.add(t.featureAdapter.getObjectId(e))}),i),r}catch(s){if(s===O)return new Set;throw s}}async executeQueryForSnapping(e,t){const i=o(t),{point:s,distance:a,returnEdge:n,vertexMode:l}=e;if(!n&&"none"===l)return{candidates:[]};let u=r(e.query);u=await this._schedule((()=>P(u,this.definitionExpression,this.spatialReference)),i),u=await this._reschedule((()=>B(u,{availableFields:this.availableFields,fieldsIndex:this.fieldsIndex,geometryType:this.geometryType,spatialReference:this.spatialReference})),i);const h=!Q(s.spatialReference,this.spatialReference);h&&await T(s.spatialReference,this.spatialReference);const c="number"==typeof a?a:a.x,m="number"==typeof a?a:a.y,y={xmin:s.x-c,xmax:s.x+c,ymin:s.y-m,ymax:s.y+m,spatialReference:s.spatialReference},f=h?v(y,this.spatialReference):y;if(!f)return{candidates:[]};const p=(await R(w(s),null,{signal:i}))[0],d=(await R(w(f),null,{signal:i}))[0];if(null==p||null==d)return{candidates:[]};const g=new G(await this._reschedule((()=>this._searchFeatures(this._getQueryBBoxes(d.toJSON()))),i),u,this);await this._reschedule((()=>this._executeObjectIdsQuery(g)),i),await this._reschedule((()=>this._executeTimeQuery(g)),i),await this._reschedule((()=>this._executeAttributesQuery(g)),i),await this._reschedule((()=>this._executeGeometryQueryForSnapping(g,i)),i);const x=p.toJSON(),_=h?v(x,this.spatialReference):x,F=h?Math.max(f.xmax-f.xmin,f.ymax-f.ymin)/2:a;return g.createSnappingResponse({...e,point:_,distance:F},s.spatialReference)}async executeQueryForLatestObservations(e,t){const s=o(t);if(!this.timeInfo?.trackIdField)throw new i(L,"Missing timeInfo or timeInfo.trackIdField",{query:e,timeInfo:this.timeInfo});try{const t=await this._executeQuery(e,{},s);return await this._reschedule((()=>this._filterLatest(t)),s),t.createQueryResponse()}catch(r){if(r!==O)throw r;return new G([],e,this).createQueryResponse()}}async executeQueryForSummaryStatistics(e={},t,i){const s=o(i),{field:r,normalizationField:a,valueExpression:n}=t;return(await this._executeQueryForStatistics(e,{field:r,normalizationField:a,valueExpression:n},s)).createSummaryStatisticsResponse(t)}async executeQueryForUniqueValues(e={},t,i){const s=o(i),{field:r,field2:a,field3:n,valueExpression:l}=t;return(await this._executeQueryForStatistics(e,{field:r,field2:a,field3:n,valueExpression:l},s)).createUniqueValuesResponse(t)}async executeQueryForClassBreaks(e={},t,i){const s=o(i),{field:r,normalizationField:a,valueExpression:n}=t;return(await this._executeQueryForStatistics(e,{field:r,normalizationField:a,valueExpression:n},s)).createClassBreaksResponse(t)}async executeQueryForHistogram(e={},t,i){const s=o(i),{field:r,normalizationField:a,valueExpression:n}=t;return(await this._executeQueryForStatistics(e,{field:r,normalizationField:a,valueExpression:n},s)).createHistogramResponse(t)}async fetchRecomputedExtents(e){const t=o(e);this._timeExtentPromise||=Z(this.timeInfo,this.featureStore);const[i,s]=await Promise.all([this._getFullExtent(),this._timeExtentPromise]);return h(t),{fullExtent:i,timeExtent:s}}async _getBounds(e,t,i){const s=y(p(),f);await this.featureStore.forEachBounds(e,(e=>d(s,e)));const r={xmin:s[0],ymin:s[1],xmax:s[3],ymax:s[4],spatialReference:b(this.spatialReference)};this.hasZ&&isFinite(s[2])&&isFinite(s[5])&&(r.zmin=s[2],r.zmax=s[5]);const a=v(r,t,i);if(a.spatialReference=b(i),a.xmax-a.xmin==0){const e=c(a.spatialReference);a.xmin-=e,a.xmax+=e}if(a.ymax-a.ymin==0){const e=c(a.spatialReference);a.ymin-=e,a.ymax+=e}if(this.hasZ&&null!=a.zmin&&null!=a.zmax&&a.zmax-a.zmin==0){const e=c(a.spatialReference);a.zmin-=e,a.zmax+=e}return a}_getFullExtent(){return this._fullExtentPromise||="getFullExtent"in this.featureStore&&this.featureStore.getFullExtent?Promise.resolve(this.featureStore.getFullExtent(this.spatialReference)):this._getAllFeatures().then((e=>this._getBounds(e,this.spatialReference,this.spatialReference))),this._fullExtentPromise}async _schedule(e,t){return null!=this._frameTask?this._frameTask.schedule(e,t):e(N)}async _reschedule(e,t){return null!=this._frameTask?this._frameTask.reschedule(e,t):e(N)}async _getAllFeaturesQueryEngineResult(e){return new G(await this._getAllFeatures(),e,this)}async _getAllFeatures(){if(null==this._allFeaturesPromise){const e=[];this._allFeaturesPromise=(async()=>{await this.featureStore.forEach((t=>e.push(t)))})().then((()=>e))}const e=this._allFeaturesPromise,t=await e;return e===this._allFeaturesPromise?t.slice():this._getAllFeatures()}async _executeQuery(e,t,i){e=r(e),e=await this._schedule((()=>z(e,this.definitionExpression,this.spatialReference)),i),e=await this._reschedule((()=>B(e,{availableFields:this.availableFields,fieldsIndex:this.fieldsIndex,geometryType:this.geometryType,spatialReference:this.spatialReference})),i),e={...e,...t};const s=await this._reschedule((()=>this._executeSceneFilterQuery(e,i)),i),a=await this._reschedule((()=>this._executeGeometryQuery(e,s,i)),i);return await this._reschedule((()=>this._executeAggregateIdsQuery(a)),i),await this._reschedule((()=>this._executeObjectIdsQuery(a)),i),await this._reschedule((()=>this._executeTimeQuery(a)),i),await this._reschedule((()=>this._executeAttributesQuery(a)),i),a}async _executeSceneFilterQuery(e,t){if(null==e.sceneFilter)return null;const{outSR:i,returnGeometry:s,returnCentroid:r}=e,a=this.featureStore.featureSpatialReference,n=e.sceneFilter.geometry,l=null==a||Q(a,n.spatialReference)?n:v(n,a);if(!l)return null;const u=s||r,o=I(i)&&!Q(this.spatialReference,i)&&u?async e=>this._project(e,i):e=>e,h=this.featureAdapter,c=await this._reschedule((()=>this._searchFeatures(this._getQueryBBoxes(l))),t);if("disjoint"===e.sceneFilter.spatialRelationship){if(!c.length)return null;const i=new Set;for(const e of c)i.add(h.getObjectId(e));const s=await this._reschedule((()=>this._getAllFeatures()),t),r=await this._reschedule((async()=>{const r=await k("esriSpatialRelDisjoint",l,this.geometryType,this.hasZ,this.hasM),a=e=>!i.has(h.getObjectId(e))||r(h.getGeometry(e)),n=await this._runSpatialFilter(s,a,t);return new G(n,e,this)}),t);return o(r)}if(!c.length)return new G([],e,this);if(this._canExecuteSinglePass(l,e))return o(new G(c,e,this));const m=await k("esriSpatialRelContains",l,this.geometryType,this.hasZ,this.hasM),y=await this._runSpatialFilter(c,(e=>m(h.getGeometry(e))),t);return o(new G(y,e,this))}async _executeGeometryQuery(i,s,r){if(null!=s&&0===s.items.length)return s;i=null!=s?s.query:i;const{geometry:a,outSR:n,spatialRel:l,returnGeometry:u,returnCentroid:o}=i,h=this.featureStore.featureSpatialReference,c=!a||null==h||Q(h,a.spatialReference)?a:v(a,h),m=u||o,y=I(n)&&!Q(this.spatialReference,n),f=this._geometryQueryCache&&null==s?y&&m?JSON.stringify({originalFilterGeometry:a,spatialRelationship:l,outSpatialReference:n}):JSON.stringify({originalFilterGeometry:a,spatialRelationship:l}):null,p=f?this._geometryQueryCache.get(f):null;if(null!=p)return new G(p,i,this);const d=async e=>(y&&m&&await this._project(e,n),f&&this._geometryQueryCache.put(f,e.items,e.items.length+1),e);if(!c)return d(null!=s?s:await this._getAllFeaturesQueryEngineResult(i));const g=this.featureAdapter;let x=await this._reschedule((()=>this._searchFeatures(this._getQueryBBoxes(a))),r);if("esriSpatialRelDisjoint"===l){if(!x.length)return d(null!=s?s:await this._getAllFeaturesQueryEngineResult(i));const e=new Set;for(const i of x)e.add(g.getObjectId(i));const t=null!=s?s.items:await this._reschedule((()=>this._getAllFeatures()),r),a=await this._reschedule((async()=>{const s=await k(l,c,this.geometryType,this.hasZ,this.hasM),a=t=>!e.has(g.getObjectId(t))||s(g.getGeometry(t)),n=await this._runSpatialFilter(t,a,r);return new G(n,i,this)}),r);return d(a)}if(null!=s){const i=new t;x=x.filter((t=>e(s.items,t,s.items.length,i)>=0))}if(!x.length){const e=new G([],i,this);return f&&this._geometryQueryCache.put(f,e.items,1),e}if(this._canExecuteSinglePass(c,i))return d(new G(x,i,this));const _=await k(l,c,this.geometryType,this.hasZ,this.hasM),w=await this._runSpatialFilter(x,(e=>_(g.getGeometry(e))),r);return d(new G(w,i,this))}async _executeGeometryQueryForSnapping(e,t){const{query:i}=e,{spatialRel:s}=i;if(!e?.items?.length||!i.geometry||!s)return;const r=await k(s,i.geometry,this.geometryType,this.hasZ,this.hasM),a=await this._runSpatialFilter(e.items,(e=>r(e.geometry)),t);e.items=a}_executeAggregateIdsQuery(e){if(0===e.items.length||!e.query.aggregateIds?.length||null==this.aggregateAdapter)return;const t=new Set;for(const s of e.query.aggregateIds){this.aggregateAdapter.getFeatureObjectIds(s).forEach((e=>t.add(e)))}const i=this.featureAdapter.getObjectId;e.items=e.items.filter((e=>t.has(i(e))))}_executeObjectIdsQuery(e){if(0===e.items.length||!e.query.objectIds?.length)return;const t=new Set(e.query.objectIds),i=this.featureAdapter.getObjectId;e.items=e.items.filter((e=>t.has(i(e))))}_executeTimeQuery(e){if(0===e.items.length)return;const t=H(this.timeInfo,e.query.timeExtent,this.featureAdapter);null!=t&&(e.items=e.items.filter(t))}_executeAttributesQuery(e){if(0===e.items.length)return;const t=E(e.query.where,this.fieldsIndex);if(t){if(!t.isStandardized)throw new TypeError("Where clause is not standardized");e.items=e.items.filter((e=>t.testFeature(e,this.featureAdapter)))}}async _runSpatialFilter(e,t,i){if(!t)return e;if(null==this._frameTask)return e.filter((e=>t(e)));let s=0;const r=new Array,a=async n=>{for(;s<e.length;){const l=e[s++];t(l)&&(r.push(l),n.madeProgress()),n.done&&await this._reschedule((e=>a(e)),i)}};return this._reschedule((e=>a(e)),i).then((()=>r))}_filterLatest(e){const{trackIdField:t,startTimeField:i,endTimeField:s}=this.timeInfo,r=s||i,a=new Map,n=this.featureAdapter.getAttribute;for(const l of e.items){const e=n(l,t),i=n(l,r),s=a.get(e);(!s||i>n(s,r))&&a.set(e,l)}e.items=Array.from(a.values())}_canExecuteSinglePass(e,t){const{spatialRel:i}=t;return U(e)&&("esriSpatialRelEnvelopeIntersects"===i||"esriGeometryPoint"===this.geometryType&&("esriSpatialRelIntersects"===i||"esriSpatialRelContains"===i))}async _project(e,t){if(!t||Q(this.spatialReference,t))return e;const i=this.featureAdapter;let s;try{const e=await this._getFullExtent();s=m(this.spatialReference,t,e)}catch{}const r=await C(e.items.map((e=>A(this.geometryType,this.hasZ,this.hasM,i.getGeometry(e)))),this.spatialReference,t,s);return e.items=r.map(((t,s)=>i.cloneWithGeometry(e.items[s],j(t,this.hasZ,this.hasM)))),e}_getQueryBBoxes(e){if(U(e)){if(F(e))return[g(Math.min(e.xmin,e.xmax),Math.min(e.ymin,e.ymax),Math.max(e.xmin,e.xmax),Math.max(e.ymin,e.ymax))];if(S(e))return e.rings.map((e=>g(Math.min(e[0][0],e[2][0]),Math.min(e[0][1],e[2][1]),Math.max(e[0][0],e[2][0]),Math.max(e[0][1],e[2][1]))))}return[_(x(),e)]}async _searchFeatures(e){const t=new Set;await Promise.all(e.map((e=>this.featureStore.forEachInBounds(e,(e=>t.add(e))))));const i=Array.from(t.values());return t.clear(),i}async _executeQueryForStatistics(e,t,i){e=r(e);try{e=await this._schedule((()=>z(e,this.definitionExpression,this.spatialReference)),i),e=await this._reschedule((()=>q(e,t,{availableFields:this.availableFields,fieldsIndex:this.fieldsIndex,geometryType:this.geometryType,spatialReference:this.spatialReference})),i);const s=await this._reschedule((()=>this._executeSceneFilterQuery(e,i)),i),r=await this._reschedule((()=>this._executeGeometryQuery(e,s,i)),i);return await this._reschedule((()=>this._executeAggregateIdsQuery(r)),i),await this._reschedule((()=>this._executeObjectIdsQuery(r)),i),await this._reschedule((()=>this._executeTimeQuery(r)),i),await this._reschedule((()=>this._executeAttributesQuery(r)),i),r}catch(s){if(s!==O)throw s;return new G([],e,this)}}}export{V as Feature,$ as QueryEngine};
5
+ import{indexOf as e,PositionHint as t}from"../../../core/arrayUtils.js";import i from"../../../core/Error.js";import{isSerializable as s}from"../../../core/JSONSupport.js";import{clone as r}from"../../../core/lang.js";import{removeMaybe as a,destroyMaybe as n}from"../../../core/maybe.js";import{MemCacheStorage as l,MemCache as u}from"../../../core/MemCache.js";import{signalFromSignalOrOptions as o,throwIfAborted as h}from"../../../core/promiseUtils.js";import{getMetersPerUnitForSR as c}from"../../../core/unitUtils.js";import{getTransformation as m}from"../../../geometry/projection.js";import{set as f,negativeInfinity as y,create as p,expandWithAABB as d}from"../../../geometry/support/aaBoundingBox.js";import{fromValues as g,create as x}from"../../../geometry/support/aaBoundingRect.js";import{getBoundsXY as _}from"../../../geometry/support/boundsUtils.js";import{fromJSON as w,isExtent as F,isPolygon as S}from"../../../geometry/support/jsonUtils.js";import{normalizeCentralMeridian as R}from"../../../geometry/support/normalizeUtils.js";import{equals as Q,isValid as I}from"../../../geometry/support/spatialReferenceUtils.js";import{convertFromGeometry as j}from"../featureConversionUtils.js";import{getWhereClause as E}from"./attributeSupport.js";import{cleanFromGeometryEngine as b,getGeometry as A}from"./geometryUtils.js";import{checkProjectionSupport as T,project as v,projectMany as C}from"./projectionSupport.js";import{queryCapabilities as M}from"./QueryEngineCapabilities.js";import{QueryEngineResult as G}from"./QueryEngineResult.js";import{queryEngineEmptyResult as O,normalizeQueryLike as P,normalizeQuery as z}from"./queryUtils.js";import{validateQuery as q,validateStatisticsQuery as k}from"./queryValidationUtils.js";import{getSpatialQueryOperator as U,canQueryWithRBush as Z}from"./spatialQuerySupport.js";import{getTimeExtent as B,getTimeOperator as H}from"./timeSupport.js";import J from"../../support/FieldsIndex.js";import{noBudget as N}from"../../../views/support/Scheduler.js";const L="unsupported-query";class V{constructor(e,t=null,i,s,r){this.attributes=e,this.geometry=i,this.centroid=s,this.filterFlags=r,this.groupId=-1,this.displayId=t}}const D=new l(2e6);let W=0;class ${constructor(e){this._geometryQueryCache=null,this._changeHandle=null,this.capabilities={query:M},this.geometryType=e.geometryType,this.hasM=!!e.hasM,this.hasZ=!!e.hasZ,this.objectIdField=e.objectIdField,this.spatialReference=e.spatialReference,this.definitionExpression=e.definitionExpression,this.featureStore=e.featureStore,this.aggregateAdapter=e.aggregateAdapter,this._changeHandle=this.featureStore.events.on("changed",(()=>this.clearCache())),this.timeInfo=e.timeInfo,e.cacheSpatialQueries&&(this._geometryQueryCache=new u(W+++"$$",D)),this.fieldsIndex=s(e.fieldsIndex)?e.fieldsIndex:J.fromJSON(e.fieldsIndex),!e.availableFields||1===e.availableFields.length&&"*"===e.availableFields[0]?this.availableFields=new Set(this.fieldsIndex.fields.map((e=>e.name))):this.availableFields=new Set(e.availableFields.map((e=>this.fieldsIndex.get(e)?.name)).filter((e=>null!=e))),e.scheduler&&e.priority&&(this._frameTask=e.scheduler.registerTask(e.priority))}destroy(){this._frameTask=a(this._frameTask),this.clearCache(),n(this._geometryQueryCache),this._changeHandle=a(this._changeHandle)}get featureAdapter(){return this.featureStore.featureAdapter}clearCache(){this._geometryQueryCache?.clear(),this._allFeaturesPromise=null,this._timeExtentPromise=null,this._fullExtentPromise=null}async executeQuery(e,t){const i=o(t);try{return(await this._executeQuery(e,{},i)).createQueryResponse()}catch(s){if(s!==O)throw s;return new G([],e,this).createQueryResponse()}}async executeQueryForCount(e={},t){const i=o(t);try{return(await this._executeQuery(e,{returnGeometry:!1,returnCentroid:!1,outSR:null},i)).createQueryResponseForCount()}catch(s){if(s!==O)throw s;return 0}}async executeQueryForExtent(e,t){const i=o(t),s=e.outSR;try{const t=await this._executeQuery(e,{returnGeometry:!0,returnCentroid:!1,outSR:null},i),r=t.size;if(!r)return{count:0,extent:null};return{count:r,extent:await this._getBounds(t.items,t.spatialReference,s||this.spatialReference)}}catch(r){if(r===O)return{count:0,extent:null};throw r}}async executeQueryForIds(e,t){return this.executeQueryForIdSet(e,t).then((e=>Array.from(e)))}async executeQueryForIdSet(e,t){const i=o(t);try{const t=await this._executeQuery(e,{returnGeometry:!0,returnCentroid:!1,outSR:null},i),s=t.items,r=new Set;return await this._reschedule((()=>{for(const e of s)r.add(t.featureAdapter.getObjectId(e))}),i),r}catch(s){if(s===O)return new Set;throw s}}async executeQueryForSnapping(e,t){const i=o(t),{point:s,distance:a,returnEdge:n,vertexMode:l}=e;if(!n&&"none"===l)return{candidates:[]};let u=r(e.query);u=await this._schedule((()=>P(u,this.definitionExpression,this.spatialReference)),i),u=await this._reschedule((()=>q(u,{availableFields:this.availableFields,fieldsIndex:this.fieldsIndex,geometryType:this.geometryType,spatialReference:this.spatialReference})),i);const h=!Q(s.spatialReference,this.spatialReference);h&&await T(s.spatialReference,this.spatialReference);const c="number"==typeof a?a:a.x,m="number"==typeof a?a:a.y,f={xmin:s.x-c,xmax:s.x+c,ymin:s.y-m,ymax:s.y+m,spatialReference:s.spatialReference},y=h?v(f,this.spatialReference):f;if(!y)return{candidates:[]};const p=(await R(w(s),null,{signal:i}))[0],d=(await R(w(y),null,{signal:i}))[0];if(null==p||null==d)return{candidates:[]};const g=new G(await this._reschedule((()=>this._searchFeatures(K(d.toJSON()))),i),u,this);await this._reschedule((()=>this._executeObjectIdsQuery(g)),i),await this._reschedule((()=>this._executeTimeQuery(g)),i),await this._reschedule((()=>this._executeAttributesQuery(g)),i),await this._reschedule((()=>this._executeGeometryQueryForSnapping(g,i)),i);const x=p.toJSON(),_=h?v(x,this.spatialReference):x,F=h?Math.max(y.xmax-y.xmin,y.ymax-y.ymin)/2:a;return g.createSnappingResponse({...e,point:_,distance:F},s.spatialReference)}async executeQueryForLatestObservations(e,t){const s=o(t);if(!this.timeInfo?.trackIdField)throw new i(L,"Missing timeInfo or timeInfo.trackIdField",{query:e,timeInfo:this.timeInfo});try{const t=await this._executeQuery(e,{},s);return await this._reschedule((()=>this._filterLatest(t)),s),t.createQueryResponse()}catch(r){if(r!==O)throw r;return new G([],e,this).createQueryResponse()}}async executeQueryForSummaryStatistics(e={},t,i){const s=o(i),{field:r,normalizationField:a,valueExpression:n}=t;return(await this._executeQueryForStatistics(e,{field:r,normalizationField:a,valueExpression:n},s)).createSummaryStatisticsResponse(t)}async executeQueryForUniqueValues(e={},t,i){const s=o(i),{field:r,field2:a,field3:n,valueExpression:l}=t;return(await this._executeQueryForStatistics(e,{field:r,field2:a,field3:n,valueExpression:l},s)).createUniqueValuesResponse(t)}async executeQueryForClassBreaks(e={},t,i){const s=o(i),{field:r,normalizationField:a,valueExpression:n}=t;return(await this._executeQueryForStatistics(e,{field:r,normalizationField:a,valueExpression:n},s)).createClassBreaksResponse(t)}async executeQueryForHistogram(e={},t,i){const s=o(i),{field:r,normalizationField:a,valueExpression:n}=t;return(await this._executeQueryForStatistics(e,{field:r,normalizationField:a,valueExpression:n},s)).createHistogramResponse(t)}async fetchRecomputedExtents(e){const t=o(e);this._timeExtentPromise||=B(this.timeInfo,this.featureStore);const[i,s]=await Promise.all([this._getFullExtent(),this._timeExtentPromise]);return h(t),{fullExtent:i,timeExtent:s}}async _getBounds(e,t,i){const s=f(p(),y);await this.featureStore.forEachBounds(e,(e=>d(s,e)));const r={xmin:s[0],ymin:s[1],xmax:s[3],ymax:s[4],spatialReference:b(this.spatialReference)};this.hasZ&&isFinite(s[2])&&isFinite(s[5])&&(r.zmin=s[2],r.zmax=s[5]);const a=v(r,t,i);if(a.spatialReference=b(i),a.xmax-a.xmin==0){const e=c(a.spatialReference);a.xmin-=e,a.xmax+=e}if(a.ymax-a.ymin==0){const e=c(a.spatialReference);a.ymin-=e,a.ymax+=e}if(this.hasZ&&null!=a.zmin&&null!=a.zmax&&a.zmax-a.zmin==0){const e=c(a.spatialReference);a.zmin-=e,a.zmax+=e}return a}_getFullExtent(){return this._fullExtentPromise||="getFullExtent"in this.featureStore&&this.featureStore.getFullExtent?Promise.resolve(this.featureStore.getFullExtent(this.spatialReference)):this._getAllFeatures().then((e=>this._getBounds(e,this.spatialReference,this.spatialReference))),this._fullExtentPromise}async _schedule(e,t){return null!=this._frameTask?this._frameTask.schedule(e,t):e(N)}async _reschedule(e,t){return null!=this._frameTask?this._frameTask.reschedule(e,t):e(N)}async _getAllFeaturesQueryEngineResult(e){return new G(await this._getAllFeatures(),e,this)}async _getAllFeatures(){if(null==this._allFeaturesPromise){const e=[];this._allFeaturesPromise=(async()=>{await this.featureStore.forEach((t=>e.push(t)))})().then((()=>e))}const e=this._allFeaturesPromise,t=await e;return e===this._allFeaturesPromise?t.slice():this._getAllFeatures()}async _executeQuery(e,t,i){e=r(e),e=await this._schedule((()=>z(e,this.definitionExpression,this.spatialReference)),i),e=await this._reschedule((()=>q(e,{availableFields:this.availableFields,fieldsIndex:this.fieldsIndex,geometryType:this.geometryType,spatialReference:this.spatialReference})),i),e={...e,...t};const s=await this._reschedule((()=>this._executeSceneFilterQuery(e,i)),i),a=await this._reschedule((()=>this._executeGeometryQuery(e,s,i)),i);return await this._reschedule((()=>this._executeAggregateIdsQuery(a)),i),await this._reschedule((()=>this._executeObjectIdsQuery(a)),i),await this._reschedule((()=>this._executeTimeQuery(a)),i),await this._reschedule((()=>this._executeAttributesQuery(a)),i),a}async _executeSceneFilterQuery(e,t){if(null==e.sceneFilter)return null;const{outSR:i,returnGeometry:s,returnCentroid:r}=e,a=this.featureStore.featureSpatialReference,n=e.sceneFilter.geometry,l=null==a||Q(a,n.spatialReference)?n:v(n,a);if(!l)return null;const u=s||r,o=I(i)&&!Q(this.spatialReference,i)&&u?async e=>this._project(e,i):e=>e,h=this.featureAdapter,c=await this._reschedule((()=>this._searchFeatures(K(l))),t);if("disjoint"===e.sceneFilter.spatialRelationship){if(!c.length)return null;const i=new Set;for(const e of c)i.add(h.getObjectId(e));const s=await this._reschedule((()=>this._getAllFeatures()),t),r=await this._reschedule((async()=>{const r=await U("esriSpatialRelDisjoint",l,this.geometryType,this.hasZ,this.hasM),a=e=>!i.has(h.getObjectId(e))||r(h.getGeometry(e)),n=await this._runSpatialFilter(s,a,t);return new G(n,e,this)}),t);return o(r)}if(!c.length)return new G([],e,this);if(this._canExecuteSinglePass(l,e))return o(new G(c,e,this));const m=await U("esriSpatialRelContains",l,this.geometryType,this.hasZ,this.hasM),f=await this._runSpatialFilter(c,(e=>m(h.getGeometry(e))),t);return o(new G(f,e,this))}async _executeGeometryQuery(i,s,r){if(null!=s&&0===s.items.length)return s;i=null!=s?s.query:i;const{geometry:a,outSR:n,spatialRel:l,returnGeometry:u,returnCentroid:o}=i,h=this.featureStore.featureSpatialReference,c=!a||null==h||Q(h,a.spatialReference)?a:v(a,h),m=u||o,f=I(n)&&!Q(this.spatialReference,n),y=this._geometryQueryCache&&null==s?f&&m?JSON.stringify({originalFilterGeometry:a,spatialRelationship:l,outSpatialReference:n}):JSON.stringify({originalFilterGeometry:a,spatialRelationship:l}):null,p=y?this._geometryQueryCache.get(y):null;if(null!=p)return new G(p,i,this);const d=async e=>(f&&m&&await this._project(e,n),y&&this._geometryQueryCache.put(y,e.items,e.items.length+1),e);if(!c)return d(null!=s?s:await this._getAllFeaturesQueryEngineResult(i));const g=this.featureAdapter;let x=await this._reschedule((()=>this._searchFeatures(K(a))),r);if("esriSpatialRelDisjoint"===l){if(!x.length)return d(null!=s?s:await this._getAllFeaturesQueryEngineResult(i));const e=new Set;for(const i of x)e.add(g.getObjectId(i));const t=null!=s?s.items:await this._reschedule((()=>this._getAllFeatures()),r),a=await this._reschedule((async()=>{const s=await U(l,c,this.geometryType,this.hasZ,this.hasM),a=t=>!e.has(g.getObjectId(t))||s(g.getGeometry(t)),n=await this._runSpatialFilter(t,a,r);return new G(n,i,this)}),r);return d(a)}if(null!=s){const i=new t;x=x.filter((t=>e(s.items,t,s.items.length,i)>=0))}if(!x.length){const e=new G([],i,this);return y&&this._geometryQueryCache.put(y,e.items,1),e}if(this._canExecuteSinglePass(c,i))return d(new G(x,i,this));const _=await U(l,c,this.geometryType,this.hasZ,this.hasM),w=await this._runSpatialFilter(x,(e=>_(g.getGeometry(e))),r);return d(new G(w,i,this))}async _executeGeometryQueryForSnapping(e,t){const{query:i}=e,{spatialRel:s}=i;if(!e?.items?.length||!i.geometry||!s)return;const r=await U(s,i.geometry,this.geometryType,this.hasZ,this.hasM),a=await this._runSpatialFilter(e.items,(e=>r(e.geometry)),t);e.items=a}_executeAggregateIdsQuery(e){if(0===e.items.length||!e.query.aggregateIds?.length||null==this.aggregateAdapter)return;const t=new Set;for(const s of e.query.aggregateIds){this.aggregateAdapter.getFeatureObjectIds(s).forEach((e=>t.add(e)))}const i=this.featureAdapter.getObjectId;e.items=e.items.filter((e=>t.has(i(e))))}_executeObjectIdsQuery(e){if(0===e.items.length||!e.query.objectIds?.length)return;const t=new Set(e.query.objectIds),i=this.featureAdapter.getObjectId;e.items=e.items.filter((e=>t.has(i(e))))}_executeTimeQuery(e){if(0===e.items.length)return;const t=H(this.timeInfo,e.query.timeExtent,this.featureAdapter);null!=t&&(e.items=e.items.filter(t))}_executeAttributesQuery(e){if(0===e.items.length)return;const t=E(e.query.where,this.fieldsIndex);if(t){if(!t.isStandardized)throw new TypeError("Where clause is not standardized");e.items=e.items.filter((e=>t.testFeature(e,this.featureAdapter)))}}async _runSpatialFilter(e,t,i){if(!t)return e;if(null==this._frameTask)return e.filter((e=>t(e)));let s=0;const r=new Array,a=async n=>{for(;s<e.length;){const l=e[s++];t(l)&&(r.push(l),n.madeProgress()),n.done&&await this._reschedule((e=>a(e)),i)}};return this._reschedule((e=>a(e)),i).then((()=>r))}_filterLatest(e){const{trackIdField:t,startTimeField:i,endTimeField:s}=this.timeInfo,r=s||i,a=new Map,n=this.featureAdapter.getAttribute;for(const l of e.items){const e=n(l,t),i=n(l,r),s=a.get(e);(!s||i>n(s,r))&&a.set(e,l)}e.items=Array.from(a.values())}_canExecuteSinglePass(e,t){const{spatialRel:i}=t;return Z(e)&&("esriSpatialRelEnvelopeIntersects"===i||"esriGeometryPoint"===this.geometryType&&("esriSpatialRelIntersects"===i||"esriSpatialRelContains"===i))}async _project(e,t){if(!t||Q(this.spatialReference,t))return e;const i=this.featureAdapter;let s;try{const e=await this._getFullExtent();s=m(this.spatialReference,t,e)}catch{}const r=await C(e.items.map((e=>A(this.geometryType,this.hasZ,this.hasM,i.getGeometry(e)))),this.spatialReference,t,s);return e.items=r.map(((t,s)=>i.cloneWithGeometry(e.items[s],j(t,this.hasZ,this.hasM)))),e}async _searchFeatures(e){const t=new Set;await Promise.all(e.map((e=>this.featureStore.forEachInBounds(e,(e=>t.add(e))))));const i=Array.from(t.values());return t.clear(),i}async _executeQueryForStatistics(e,t,i){e=r(e);try{e=await this._schedule((()=>z(e,this.definitionExpression,this.spatialReference)),i),e=await this._reschedule((()=>k(e,t,{availableFields:this.availableFields,fieldsIndex:this.fieldsIndex,geometryType:this.geometryType,spatialReference:this.spatialReference})),i);const s=await this._reschedule((()=>this._executeSceneFilterQuery(e,i)),i),r=await this._reschedule((()=>this._executeGeometryQuery(e,s,i)),i);return await this._reschedule((()=>this._executeAggregateIdsQuery(r)),i),await this._reschedule((()=>this._executeObjectIdsQuery(r)),i),await this._reschedule((()=>this._executeTimeQuery(r)),i),await this._reschedule((()=>this._executeAttributesQuery(r)),i),r}catch(s){if(s!==O)throw s;return new G([],e,this)}}}function K(e){if(Z(e)){if(F(e))return[g(Math.min(e.xmin,e.xmax),Math.min(e.ymin,e.ymax),Math.max(e.xmin,e.xmax),Math.max(e.ymin,e.ymax))];if(S(e))return e.rings.map((e=>g(Math.min(e[0][0],e[2][0]),Math.min(e[0][1],e[2][1]),Math.max(e[0][0],e[2][0]),Math.max(e[0][1],e[2][1]))))}return[_(x(),e)]}export{V as Feature,$ as QueryEngine};
@@ -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"../../request.js";import r from"../../core/Error.js";import o from"../../core/Logger.js";import{debounce as i}from"../../core/promiseUtils.js";import{urlToObject as s}from"../../core/urlUtils.js";import{property as a}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/RandomLCG.js";import{reader as n}from"../../core/accessorSupport/decorators/reader.js";import{subclass as l}from"../../core/accessorSupport/decorators/subclass.js";import{writer as p}from"../../core/accessorSupport/decorators/writer.js";import{updateOrigins as c}from"../../core/accessorSupport/originUtils.js";import d from"../../geometry/Extent.js";import u from"../../geometry/HeightModelInfo.js";import m from"../../geometry/SpatialReference.js";import{titleFromUrlAndName as h,parse as y,cleanTitle as f,sanitizeUrlWithLayerId as v,writeUrlWithLayerId as S}from"../support/arcgisLayerUrl.js";import{id as g,url as w}from"../support/commonProperties.js";import{fetchIndexInfo as x}from"../support/I3SIndexInfo.js";import{getLoader as I}from"../support/schemaValidatorLoader.js";import j from"../../portal/Portal.js";import _ from"../../portal/PortalItem.js";import{createForItemWrite as b}from"../../portal/support/jsonContext.js";import{saveResources as R,updateItemWithResources as E}from"../../webdoc/support/resourceUtils.js";import{validateSaveAPIKey as N}from"../../webdoc/support/saveAPIKeyUtils.js";import{evaluateWriteErrors as A}from"../../webdoc/support/saveUtils.js";const L=L=>{let V=class extends L{constructor(){super(...arguments),this.spatialReference=null,this.fullExtent=null,this.heightModelInfo=null,this.minScale=0,this.maxScale=0,this.version={major:Number.NaN,minor:Number.NaN,versionString:""},this.copyright=null,this.sublayerTitleMode="item-title",this.title=null,this.layerId=null,this.indexInfo=null,this._debouncedSaveOperations=i((async(e,t,r)=>{switch(e){case P.SAVE:return this._save(t);case P.SAVE_AS:return this._saveAs(r,t)}}))}readSpatialReference(e,t){return this._readSpatialReference(t)}_readSpatialReference(e){if(null!=e.spatialReference)return m.fromJSON(e.spatialReference);const t=e.store,r=t.indexCRS||t.geographicCRS,o=r&&parseInt(r.substring(r.lastIndexOf("/")+1,r.length),10);return null!=o?new m(o):null}readFullExtent(e,t,r){if(null!=e&&"object"==typeof e){const o=null==e.spatialReference?{...e,spatialReference:this._readSpatialReference(t)}:e;return d.fromJSON(o,r)}const o=t.store,i=this._readSpatialReference(t);return null==i||null==o?.extent||!Array.isArray(o.extent)||o.extent.some((e=>e<T))?null:new d({xmin:o.extent[0],ymin:o.extent[1],xmax:o.extent[2],ymax:o.extent[3],spatialReference:i})}parseVersionString(e){const t={major:Number.NaN,minor:Number.NaN,versionString:e},r=e.split(".");return r.length>=2&&(t.major=parseInt(r[0],10),t.minor=parseInt(r[1],10)),t}readVersion(e,t){const r=t.store,o=null!=r.version?r.version.toString():"";return this.parseVersionString(o)}readTitlePortalItem(e){return"item-title"!==this.sublayerTitleMode?void 0:e}readTitleService(e,t){const r=this.portalItem?.title;if("item-title"===this.sublayerTitleMode)return h(this.url,t.name);let o=t.name;if(!o&&this.url){const e=y(this.url);null!=e&&(o=e.title)}return"item-title-and-service-name"===this.sublayerTitleMode&&r&&(o=r+" - "+o),f(o)}set url(e){const t=v({layer:this,url:e,nonStandardUrlAllowed:!1,logger:o.getLogger(this)});this._set("url",t.url),null!=t.layerId&&this._set("layerId",t.layerId)}writeUrl(e,t,r,o){S(this,e,"layers",t,o)}get parsedUrl(){const e=this._get("url"),t=s(e);return null!=this.layerId&&(t.path=`${t.path}/layers/${this.layerId}`),t}async _fetchIndexAndUpdateExtent(e,t){this.indexInfo=x(this.parsedUrl.path,this.rootNode,e,this.customParameters,this.apiKey,o.getLogger(this),t),null==this.fullExtent||this.fullExtent.hasZ||this._updateExtent(await this.indexInfo)}_updateExtent(e){if("page"===e?.type){const t=e.rootIndex%e.pageSize,o=e.rootPage?.nodes?.[t];if(null==o?.obb?.center||null==o.obb.halfSize)throw new r("sceneservice:invalid-node-page","Invalid node page.");if(o.obb.center[0]<T||null==this.fullExtent||this.fullExtent.hasZ)return;const i=o.obb.halfSize,s=o.obb.center[2],a=Math.sqrt(i[0]*i[0]+i[1]*i[1]+i[2]*i[2]);this.fullExtent.zmin=s-a,this.fullExtent.zmax=s+a}else if("node"===e?.type){const t=e.rootNode?.mbs;if(!Array.isArray(t)||4!==t.length||t[0]<T)return;const r=t[2],o=t[3],{fullExtent:i}=this;i&&(i.zmin=r-o,i.zmax=r+o)}}async _fetchService(e){if(null==this.url)throw new r("sceneservice:url-not-set","Scene service can not be loaded without valid portal item or url");if(null==this.layerId&&/SceneServer\/*$/i.test(this.url)){const t=await this._fetchFirstLayerId(e);null!=t&&(this.layerId=t)}return this._fetchServiceLayer(e)}async _fetchFirstLayerId(e){const r=await t(this.url,{query:{f:"json",...this.customParameters,token:this.apiKey},responseType:"json",signal:e});if(r.data&&Array.isArray(r.data.layers)&&r.data.layers.length>0)return r.data.layers[0].id}async _fetchServiceLayer(e){const r=await t(this.parsedUrl?.path??"",{query:{f:"json",...this.customParameters,token:this.apiKey},responseType:"json",signal:e});r.ssl&&(this.url=this.url.replace(/^http:/i,"https:"));let o=!1;if(r.data.layerType&&"Voxel"===r.data.layerType&&(o=!0),o)return this._fetchVoxelServiceLayer();const i=r.data;this.read(i,this._getServiceContext()),this.validateLayer(i)}async _fetchVoxelServiceLayer(e){const r=(await t(this.parsedUrl?.path+"/layer",{query:{f:"json",...this.customParameters,token:this.apiKey},responseType:"json",signal:e})).data;this.read(r,this._getServiceContext()),this.validateLayer(r)}_getServiceContext(){return{origin:"service",portalItem:this.portalItem,portal:this.portalItem?.portal,url:this.parsedUrl}}async _ensureLoadBeforeSave(){await this.load(),"beforeSave"in this&&"function"==typeof this.beforeSave&&await this.beforeSave()}validateLayer(e){}_updateTypeKeywords(e,t,r){e.typeKeywords||(e.typeKeywords=[]);const o=t.getTypeKeywords();for(const i of o)e.typeKeywords.push(i);e.typeKeywords&&(e.typeKeywords=e.typeKeywords.filter(((e,t,r)=>r.indexOf(e)===t)),r===U.newItem&&(e.typeKeywords=e.typeKeywords.filter((e=>"Hosted Service"!==e))))}async _saveAs(e,t){const o={...O,...t};let i=_.from(e);if(!i)throw new r("sceneservice:portal-item-required","_saveAs() requires a portal item to save to");N(i),i.id&&(i=i.clone(),i.id=null);const s=i.portal||j.getDefault();await this._ensureLoadBeforeSave(),i.type=K,i.portal=s;const a=b(i,"portal-item",!0),n={layers:[this.write({},a)]};return await Promise.all(a.resources.pendingOperations??[]),await this._validateAgainstJSONSchema(n,a,o),i.url=this.url,i.title||(i.title=this.title),this._updateTypeKeywords(i,o,U.newItem),await s.signIn(),await(s.user?.addItem({item:i,folder:o?.folder,data:n})),await R(this.resourceReferences,a),this.portalItem=i,c(a),a.portalItem=i,i}async _save(e){const t={...O,...e};if(!this.portalItem)throw new r("sceneservice:portal-item-not-set","Portal item to save to has not been set on this SceneService");if(N(this.portalItem),this.portalItem.type!==K)throw new r("sceneservice:portal-item-wrong-type",`Portal item needs to have type "${K}"`);await this._ensureLoadBeforeSave();const o=b(this.portalItem,"portal-item",!0),i={layers:[this.write({},o)]};return await Promise.all(o.resources.pendingOperations??[]),await this._validateAgainstJSONSchema(i,o,t),this.portalItem.url=this.url,this.portalItem.title||(this.portalItem.title=this.title),this._updateTypeKeywords(this.portalItem,t,U.existingItem),await E(this.portalItem,i,this.resourceReferences,o),c(o),this.portalItem}async _validateAgainstJSONSchema(e,t,i){const s=i?.validationOptions;A(t,{errorName:"sceneservice:save"},{ignoreUnsupported:s?.ignoreUnsupported,supplementalUnsupportedErrors:["scenemodification:unsupported"]});const a=s?.enabled,n=I();if(a&&n){const t=(await n()).validate(e,i.portalItemLayerType);if(!t.length)return;const a=`Layer item did not validate:\n${t.join("\n")}`;if(o.getLogger(this).error(`_validateAgainstJSONSchema(): ${a}`),"throw"===s.failPolicy){const e=t.map((e=>new r("sceneservice:schema-validation",e)));throw new r("sceneservice-validate:error","Failed to save layer item due to schema validation, see `details.errors`.",{validationErrors:e})}}}};return e([a(g)],V.prototype,"id",void 0),e([a({type:m})],V.prototype,"spatialReference",void 0),e([n("spatialReference",["spatialReference","store.indexCRS","store.geographicCRS"])],V.prototype,"readSpatialReference",null),e([a({type:d})],V.prototype,"fullExtent",void 0),e([n("fullExtent",["fullExtent","store.extent","spatialReference","store.indexCRS","store.geographicCRS"])],V.prototype,"readFullExtent",null),e([a({readOnly:!0,type:u})],V.prototype,"heightModelInfo",void 0),e([a({type:Number,json:{name:"layerDefinition.minScale",write:!0,origins:{service:{read:{source:"minScale"},write:!1}}}})],V.prototype,"minScale",void 0),e([a({type:Number,json:{name:"layerDefinition.maxScale",write:!0,origins:{service:{read:{source:"maxScale"},write:!1}}}})],V.prototype,"maxScale",void 0),e([a({readOnly:!0})],V.prototype,"version",void 0),e([n("version",["store.version"])],V.prototype,"readVersion",null),e([a({type:String,json:{read:{source:"copyrightText"}}})],V.prototype,"copyright",void 0),e([a({type:String,json:{read:!1}})],V.prototype,"sublayerTitleMode",void 0),e([a({type:String})],V.prototype,"title",void 0),e([n("portal-item","title")],V.prototype,"readTitlePortalItem",null),e([n("service","title",["name"])],V.prototype,"readTitleService",null),e([a({type:Number,json:{origins:{service:{read:{source:"id"}},"portal-item":{write:{target:"id",isRequired:!0,ignoreOrigin:!0},read:!1}}}})],V.prototype,"layerId",void 0),e([a(w)],V.prototype,"url",null),e([p("url")],V.prototype,"writeUrl",null),e([a()],V.prototype,"parsedUrl",null),e([a({readOnly:!0})],V.prototype,"store",void 0),e([a({type:String,readOnly:!0,json:{read:{source:"store.rootNode"}}})],V.prototype,"rootNode",void 0),V=e([l("esri.layers.mixins.SceneService")],V),V},T=-1e38;var U;!function(e){e[e.existingItem=0]="existingItem",e[e.newItem=1]="newItem"}(U||(U={}));const K="Scene Service",O={getTypeKeywords:()=>[],portalItemLayerType:"unknown",validationOptions:{enabled:!0,ignoreUnsupported:!1,failPolicy:"throw"}};var P;!function(e){e[e.SAVE=0]="SAVE",e[e.SAVE_AS=1]="SAVE_AS"}(P||(P={}));export{P as SaveOperationType,L as SceneService,K as sceneServiceItemType};
5
+ import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../request.js";import r from"../../core/Error.js";import o from"../../core/Logger.js";import{debounce as i}from"../../core/promiseUtils.js";import{urlToObject as s}from"../../core/urlUtils.js";import{property as a}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/RandomLCG.js";import{reader as n}from"../../core/accessorSupport/decorators/reader.js";import{subclass as l}from"../../core/accessorSupport/decorators/subclass.js";import{writer as p}from"../../core/accessorSupport/decorators/writer.js";import{updateOrigins as c}from"../../core/accessorSupport/originUtils.js";import d from"../../geometry/Extent.js";import u from"../../geometry/HeightModelInfo.js";import m from"../../geometry/SpatialReference.js";import{titleFromUrlAndName as h,parse as y,cleanTitle as f,sanitizeUrlWithLayerId as v,writeUrlWithLayerId as g}from"../support/arcgisLayerUrl.js";import{id as S,url as w}from"../support/commonProperties.js";import{fetchIndexInfo as x}from"../support/I3SIndexInfo.js";import{getLoader as I}from"../support/schemaValidatorLoader.js";import j from"../../portal/Portal.js";import b from"../../portal/PortalItem.js";import{createForItemWrite as _}from"../../portal/support/jsonContext.js";import{saveResources as E,updateItemWithResources as N}from"../../webdoc/support/resourceUtils.js";import{validateSaveAPIKey as A}from"../../webdoc/support/saveAPIKeyUtils.js";import{evaluateWriteErrors as R}from"../../webdoc/support/saveUtils.js";const L=L=>{let M=class extends L{constructor(){super(...arguments),this.spatialReference=null,this.fullExtent=null,this.heightModelInfo=null,this.minScale=0,this.maxScale=0,this.version={major:Number.NaN,minor:Number.NaN,versionString:""},this.copyright=null,this.sublayerTitleMode="item-title",this.title=null,this.layerId=null,this.indexInfo=null,this._debouncedSaveOperations=i((async(e,t,r)=>{switch(e){case C.SAVE:return this._save(t);case C.SAVE_AS:return this._saveAs(r,t)}}))}readSpatialReference(e,t){return T(t)}readFullExtent(e,t,r){if(null!=e&&"object"==typeof e){const o=null==e.spatialReference?{...e,spatialReference:T(t)}:e;return d.fromJSON(o,r)}const o=t.store,i=T(t);return null==i||null==o?.extent||!Array.isArray(o.extent)||o.extent.some((e=>e<U))?null:new d({xmin:o.extent[0],ymin:o.extent[1],xmax:o.extent[2],ymax:o.extent[3],spatialReference:i})}parseVersionString(e){const t={major:Number.NaN,minor:Number.NaN,versionString:e},r=e.split(".");return r.length>=2&&(t.major=parseInt(r[0],10),t.minor=parseInt(r[1],10)),t}readVersion(e,t){const r=t.store,o=null!=r.version?r.version.toString():"";return this.parseVersionString(o)}readTitlePortalItem(e){return"item-title"!==this.sublayerTitleMode?void 0:e}readTitleService(e,t){const r=this.portalItem?.title;if("item-title"===this.sublayerTitleMode)return h(this.url,t.name);let o=t.name;if(!o&&this.url){const e=y(this.url);null!=e&&(o=e.title)}return"item-title-and-service-name"===this.sublayerTitleMode&&r&&(o=r+" - "+o),f(o)}set url(e){const t=v({layer:this,url:e,nonStandardUrlAllowed:!1,logger:o.getLogger(this)});this._set("url",t.url),null!=t.layerId&&this._set("layerId",t.layerId)}writeUrl(e,t,r,o){g(this,e,"layers",t,o)}get parsedUrl(){const e=this._get("url"),t=s(e);return null!=this.layerId&&(t.path=`${t.path}/layers/${this.layerId}`),t}async _fetchIndexAndUpdateExtent(e,t){this.indexInfo=x(this.parsedUrl.path,this.rootNode,e,this.customParameters,this.apiKey,o.getLogger(this),t),null==this.fullExtent||this.fullExtent.hasZ||this._updateExtent(await this.indexInfo)}_updateExtent(e){if("page"===e?.type){const t=e.rootIndex%e.pageSize,o=e.rootPage?.nodes?.[t];if(null==o?.obb?.center||null==o.obb.halfSize)throw new r("sceneservice:invalid-node-page","Invalid node page.");if(o.obb.center[0]<U||null==this.fullExtent||this.fullExtent.hasZ)return;const i=o.obb.halfSize,s=o.obb.center[2],a=Math.sqrt(i[0]*i[0]+i[1]*i[1]+i[2]*i[2]);this.fullExtent.zmin=s-a,this.fullExtent.zmax=s+a}else if("node"===e?.type){const t=e.rootNode?.mbs;if(!Array.isArray(t)||4!==t.length||t[0]<U)return;const r=t[2],o=t[3],{fullExtent:i}=this;i&&(i.zmin=r-o,i.zmax=r+o)}}async _fetchService(e){if(null==this.url)throw new r("sceneservice:url-not-set","Scene service can not be loaded without valid portal item or url");if(null==this.layerId&&/SceneServer\/*$/i.test(this.url)){const t=await this._fetchFirstLayerId(e);null!=t&&(this.layerId=t)}return this._fetchServiceLayer(e)}async _fetchFirstLayerId(e){const r=await t(this.url,{query:{f:"json",...this.customParameters,token:this.apiKey},responseType:"json",signal:e});if(r.data&&Array.isArray(r.data.layers)&&r.data.layers.length>0)return r.data.layers[0].id}async _fetchServiceLayer(e){const r=await t(this.parsedUrl?.path??"",{query:{f:"json",...this.customParameters,token:this.apiKey},responseType:"json",signal:e});r.ssl&&(this.url=this.url.replace(/^http:/i,"https:"));let o=!1;if(r.data.layerType&&"Voxel"===r.data.layerType&&(o=!0),o)return this._fetchVoxelServiceLayer();const i=r.data;this.read(i,this._getServiceContext()),this.validateLayer(i)}async _fetchVoxelServiceLayer(e){const r=(await t(this.parsedUrl?.path+"/layer",{query:{f:"json",...this.customParameters,token:this.apiKey},responseType:"json",signal:e})).data;this.read(r,this._getServiceContext()),this.validateLayer(r)}_getServiceContext(){return{origin:"service",portalItem:this.portalItem,portal:this.portalItem?.portal,url:this.parsedUrl}}async _ensureLoadBeforeSave(){await this.load(),"beforeSave"in this&&"function"==typeof this.beforeSave&&await this.beforeSave()}validateLayer(e){}async _saveAs(e,t){const o={...V,...t};let i=b.from(e);if(!i)throw new r("sceneservice:portal-item-required","_saveAs() requires a portal item to save to");A(i),i.id&&(i=i.clone(),i.id=null);const s=i.portal||j.getDefault();await this._ensureLoadBeforeSave(),i.type=K,i.portal=s;const a=_(i,"portal-item",!0),n={layers:[this.write({},a)]};return await Promise.all(a.resources.pendingOperations??[]),await this._validateAgainstJSONSchema(n,a,o),i.url=this.url,i.title||(i.title=this.title),O(i,o,P.newItem),await s.signIn(),await(s.user?.addItem({item:i,folder:o?.folder,data:n})),await E(this.resourceReferences,a),this.portalItem=i,c(a),a.portalItem=i,i}async _save(e){const t={...V,...e};if(!this.portalItem)throw new r("sceneservice:portal-item-not-set","Portal item to save to has not been set on this SceneService");if(A(this.portalItem),this.portalItem.type!==K)throw new r("sceneservice:portal-item-wrong-type",`Portal item needs to have type "${K}"`);await this._ensureLoadBeforeSave();const o=_(this.portalItem,"portal-item",!0),i={layers:[this.write({},o)]};return await Promise.all(o.resources.pendingOperations??[]),await this._validateAgainstJSONSchema(i,o,t),this.portalItem.url=this.url,this.portalItem.title||(this.portalItem.title=this.title),O(this.portalItem,t,P.existingItem),await N(this.portalItem,i,this.resourceReferences,o),c(o),this.portalItem}async _validateAgainstJSONSchema(e,t,i){const s=i?.validationOptions;R(t,{errorName:"sceneservice:save"},{ignoreUnsupported:s?.ignoreUnsupported,supplementalUnsupportedErrors:["scenemodification:unsupported"]});const a=s?.enabled,n=I();if(a&&n){const t=(await n()).validate(e,i.portalItemLayerType);if(!t.length)return;const a=`Layer item did not validate:\n${t.join("\n")}`;if(o.getLogger(this).error(`_validateAgainstJSONSchema(): ${a}`),"throw"===s.failPolicy){const e=t.map((e=>new r("sceneservice:schema-validation",e)));throw new r("sceneservice-validate:error","Failed to save layer item due to schema validation, see `details.errors`.",{validationErrors:e})}}}};return e([a(S)],M.prototype,"id",void 0),e([a({type:m})],M.prototype,"spatialReference",void 0),e([n("spatialReference",["spatialReference","store.indexCRS","store.geographicCRS"])],M.prototype,"readSpatialReference",null),e([a({type:d})],M.prototype,"fullExtent",void 0),e([n("fullExtent",["fullExtent","store.extent","spatialReference","store.indexCRS","store.geographicCRS"])],M.prototype,"readFullExtent",null),e([a({readOnly:!0,type:u})],M.prototype,"heightModelInfo",void 0),e([a({type:Number,json:{name:"layerDefinition.minScale",write:!0,origins:{service:{read:{source:"minScale"},write:!1}}}})],M.prototype,"minScale",void 0),e([a({type:Number,json:{name:"layerDefinition.maxScale",write:!0,origins:{service:{read:{source:"maxScale"},write:!1}}}})],M.prototype,"maxScale",void 0),e([a({readOnly:!0})],M.prototype,"version",void 0),e([n("version",["store.version"])],M.prototype,"readVersion",null),e([a({type:String,json:{read:{source:"copyrightText"}}})],M.prototype,"copyright",void 0),e([a({type:String,json:{read:!1}})],M.prototype,"sublayerTitleMode",void 0),e([a({type:String})],M.prototype,"title",void 0),e([n("portal-item","title")],M.prototype,"readTitlePortalItem",null),e([n("service","title",["name"])],M.prototype,"readTitleService",null),e([a({type:Number,json:{origins:{service:{read:{source:"id"}},"portal-item":{write:{target:"id",isRequired:!0,ignoreOrigin:!0},read:!1}}}})],M.prototype,"layerId",void 0),e([a(w)],M.prototype,"url",null),e([p("url")],M.prototype,"writeUrl",null),e([a()],M.prototype,"parsedUrl",null),e([a({readOnly:!0})],M.prototype,"store",void 0),e([a({type:String,readOnly:!0,json:{read:{source:"store.rootNode"}}})],M.prototype,"rootNode",void 0),M=e([l("esri.layers.mixins.SceneService")],M),M},U=-1e38;function T(e){if(null!=e.spatialReference)return m.fromJSON(e.spatialReference);const t=e.store,r=t.indexCRS||t.geographicCRS,o=r&&parseInt(r.substring(r.lastIndexOf("/")+1,r.length),10);return null!=o?new m(o):null}function O(e,t,r){e.typeKeywords||(e.typeKeywords=[]);const o=t.getTypeKeywords();for(const i of o)e.typeKeywords.push(i);e.typeKeywords&&(e.typeKeywords=e.typeKeywords.filter(((e,t,r)=>r.indexOf(e)===t)),r===P.newItem&&(e.typeKeywords=e.typeKeywords.filter((e=>"Hosted Service"!==e))))}var P;!function(e){e[e.existingItem=0]="existingItem",e[e.newItem=1]="newItem"}(P||(P={}));const K="Scene Service",V={getTypeKeywords:()=>[],portalItemLayerType:"unknown",validationOptions:{enabled:!0,ignoreUnsupported:!1,failPolicy:"throw"}};var C;!function(e){e[e.SAVE=0]="SAVE",e[e.SAVE_AS=1]="SAVE_AS"}(C||(C={}));export{C as SaveOperationType,L as SceneService,K as sceneServiceItemType};
@@ -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{JSONSupport as t}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{subclass as o}from"../../core/accessorSupport/decorators/subclass.js";import{writer as i}from"../../core/accessorSupport/decorators/writer.js";import{isSupportedRendererType as n,combineRenderingRules as s,convertRendererToRenderingRule as a,convertRenderingRuleToRFT as p}from"./imageryRendererUtils.js";import l from"./MosaicRule.js";import{interpolationKebab as c,noDataInterpretationKebab as m}from"./rasterEnums.js";import u from"./RasterFunction.js";let y=class extends t{constructor(){super(...arguments),this.layer=null,this.compression=void 0,this.pixelType=void 0,this.lercVersion=2}get adjustAspectRatio(){return this.layer.adjustAspectRatio}writeAdjustAspectRatio(e,t,r){this.layer.version<10.3||(t[r]=e)}get bandIds(){return this.layer.bandIds}get compressionQuality(){return this.layer.compressionQuality}writeCompressionQuality(e,t,r){this.format&&this.format.toLowerCase().includes("jpg")&&null!=e&&(t[r]=e)}get compressionTolerance(){return this.layer.compressionTolerance}writeCompressionTolerance(e,t,r){"lerc"===this.format&&null!=e&&(t[r]=e)}get format(){return"vector-field"===this.layer.renderer?.type?"lerc":this.layer.format}get interpolation(){return this.layer.interpolation}get noData(){return this.layer.noData}get noDataInterpretation(){return this.layer.noDataInterpretation}writeLercVersion(e,t,r){"lerc"===this.format&&this.layer.version>=10.5&&(t[r]=e)}get version(){const e=this.layer;return e.commitProperty("bandIds"),e.commitProperty("format"),e.commitProperty("compressionQuality"),e.commitProperty("compressionTolerance"),e.commitProperty("interpolation"),e.commitProperty("noData"),e.commitProperty("noDataInterpretation"),e.commitProperty("mosaicRule"),e.commitProperty("rasterFunction"),e.commitProperty("adjustAspectRatio"),e.commitProperty("pixelFilter"),e.commitProperty("definitionExpression"),e.commitProperty("multidimensionalSubset"),(this._get("version")||0)+1}set version(e){this._set("version",e)}get mosaicRule(){const e=this.layer;let t=e.mosaicRule;const r=e.definitionExpression;return t?r&&r!==t.where&&(t=t.clone(),t.where=r):r&&(t=new l({where:r})),t}get rasterFunction(){const e=this.layer;let{rasterFunction:t}=e;const r=e.pixelFilter,o=!e.format||e.format.includes("jpg")||e.format.includes("png");t=this._addResampleRasterFunction(t);const i=e.multidimensionalSubset?.areaOfInterest;return i&&(t=this._addClipFunction(t,i)),o&&!r&&"vector-field"!==e.renderer?.type&&(t=this.combineRendererWithRenderingRule(t)),t}combineRendererWithRenderingRule(e){const t=this.layer,{rasterInfo:r,renderer:o}=t;if(e=e||t.rasterFunction,!o||!n(o))return e;return s(a(o,{rasterAttributeTable:r.attributeTable,pixelType:r.pixelType,dataType:r.dataType,bandNames:r.bandInfos.map((({name:e})=>e)),convertColorRampToColormap:t.version<10.6,convertToRFT:!!e?.rasterFunctionDefinition,bandCount:r.bandCount}),e)}_addResampleRasterFunction(e){if(!("vector-field"===this.layer.renderer?.type)||"Resample"===e?.functionName)return e;const t="esriImageServiceDataTypeVector-UV"===this.layer.serviceDataType?7:10,r=this.layer.serviceRasterInfo.pixelSize;let o=new u({functionName:"Resample",functionArguments:{ResamplingType:t,InputCellSize:r}});return o=e?.rasterFunctionDefinition?new u({rasterFunctionDefinition:p(o)}):o,s(o,e)}_addClipFunction(e,t){const r=new u({functionName:"Clip",functionArguments:{ClippingGeometry:t.toJSON(),ClippingType:1}});return s(r,e)}};e([r()],y.prototype,"layer",void 0),e([r({json:{write:!0}})],y.prototype,"adjustAspectRatio",null),e([i("adjustAspectRatio")],y.prototype,"writeAdjustAspectRatio",null),e([r({json:{write:!0}})],y.prototype,"bandIds",null),e([r({json:{write:!0}})],y.prototype,"compression",void 0),e([r({json:{write:!0}})],y.prototype,"compressionQuality",null),e([i("compressionQuality")],y.prototype,"writeCompressionQuality",null),e([r({json:{write:!0}})],y.prototype,"compressionTolerance",null),e([i("compressionTolerance")],y.prototype,"writeCompressionTolerance",null),e([r({json:{write:!0}})],y.prototype,"format",null),e([r({type:String,json:{read:{reader:c.read},write:{writer:c.write}}})],y.prototype,"interpolation",null),e([r({json:{write:!0}})],y.prototype,"noData",null),e([r({type:String,json:{read:{reader:m.read},write:{writer:m.write}}})],y.prototype,"noDataInterpretation",null),e([r({json:{write:!0}})],y.prototype,"pixelType",void 0),e([r({json:{write:!0}})],y.prototype,"lercVersion",void 0),e([i("lercVersion")],y.prototype,"writeLercVersion",null),e([r({type:Number})],y.prototype,"version",null),e([r({json:{write:!0}})],y.prototype,"mosaicRule",null),e([r({json:{write:!0,name:"renderingRule"}})],y.prototype,"rasterFunction",null),y=e([o("esri.layers.support.ExportImageServiceParameters")],y);export{y as ExportImageServiceParameters};
5
+ import{_ as e}from"../../chunks/tslib.es6.js";import{JSONSupport as t}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{subclass as o}from"../../core/accessorSupport/decorators/subclass.js";import{writer as i}from"../../core/accessorSupport/decorators/writer.js";import{isSupportedRendererType as n,combineRenderingRules as s,convertRendererToRenderingRule as a,convertRenderingRuleToRFT as p}from"./imageryRendererUtils.js";import l from"./MosaicRule.js";import{interpolationKebab as c,noDataInterpretationKebab as m}from"./rasterEnums.js";import u from"./RasterFunction.js";let y=class extends t{constructor(){super(...arguments),this.layer=null,this.compression=void 0,this.pixelType=void 0,this.lercVersion=2}get adjustAspectRatio(){return this.layer.adjustAspectRatio}writeAdjustAspectRatio(e,t,r){this.layer.version<10.3||(t[r]=e)}get bandIds(){return this.layer.bandIds}get compressionQuality(){return this.layer.compressionQuality}writeCompressionQuality(e,t,r){this.format&&this.format.toLowerCase().includes("jpg")&&null!=e&&(t[r]=e)}get compressionTolerance(){return this.layer.compressionTolerance}writeCompressionTolerance(e,t,r){"lerc"===this.format&&null!=e&&(t[r]=e)}get format(){return"vector-field"===this.layer.renderer?.type?"lerc":this.layer.format}get interpolation(){return this.layer.interpolation}get noData(){return this.layer.noData}get noDataInterpretation(){return this.layer.noDataInterpretation}writeLercVersion(e,t,r){"lerc"===this.format&&this.layer.version>=10.5&&(t[r]=e)}get version(){const e=this.layer;return e.commitProperty("bandIds"),e.commitProperty("format"),e.commitProperty("compressionQuality"),e.commitProperty("compressionTolerance"),e.commitProperty("interpolation"),e.commitProperty("noData"),e.commitProperty("noDataInterpretation"),e.commitProperty("mosaicRule"),e.commitProperty("rasterFunction"),e.commitProperty("adjustAspectRatio"),e.commitProperty("pixelFilter"),e.commitProperty("definitionExpression"),e.commitProperty("multidimensionalSubset"),(this._get("version")||0)+1}set version(e){this._set("version",e)}get mosaicRule(){const e=this.layer;let t=e.mosaicRule;const r=e.definitionExpression;return t?r&&r!==t.where&&(t=t.clone(),t.where=r):r&&(t=new l({where:r})),t}get rasterFunction(){const e=this.layer;let{rasterFunction:t}=e;const r=e.pixelFilter,o=!e.format||e.format.includes("jpg")||e.format.includes("png");t=this._addResampleRasterFunction(t);const i=e.multidimensionalSubset?.areaOfInterest;return i&&(t=d(t,i)),o&&!r&&"vector-field"!==e.renderer?.type&&(t=this.combineRendererWithRenderingRule(t)),t}combineRendererWithRenderingRule(e){const t=this.layer,{rasterInfo:r,renderer:o}=t;if(e=e||t.rasterFunction,!o||!n(o))return e;return s(a(o,{rasterAttributeTable:r.attributeTable,pixelType:r.pixelType,dataType:r.dataType,bandNames:r.bandInfos.map((({name:e})=>e)),convertColorRampToColormap:t.version<10.6,convertToRFT:!!e?.rasterFunctionDefinition,bandCount:r.bandCount}),e)}_addResampleRasterFunction(e){if(!("vector-field"===this.layer.renderer?.type)||"Resample"===e?.functionName)return e;const t="esriImageServiceDataTypeVector-UV"===this.layer.serviceDataType?7:10,r=this.layer.serviceRasterInfo.pixelSize;let o=new u({functionName:"Resample",functionArguments:{ResamplingType:t,InputCellSize:r}});return o=e?.rasterFunctionDefinition?new u({rasterFunctionDefinition:p(o)}):o,s(o,e)}};function d(e,t){const r=new u({functionName:"Clip",functionArguments:{ClippingGeometry:t.toJSON(),ClippingType:1}});return s(r,e)}e([r()],y.prototype,"layer",void 0),e([r({json:{write:!0}})],y.prototype,"adjustAspectRatio",null),e([i("adjustAspectRatio")],y.prototype,"writeAdjustAspectRatio",null),e([r({json:{write:!0}})],y.prototype,"bandIds",null),e([r({json:{write:!0}})],y.prototype,"compression",void 0),e([r({json:{write:!0}})],y.prototype,"compressionQuality",null),e([i("compressionQuality")],y.prototype,"writeCompressionQuality",null),e([r({json:{write:!0}})],y.prototype,"compressionTolerance",null),e([i("compressionTolerance")],y.prototype,"writeCompressionTolerance",null),e([r({json:{write:!0}})],y.prototype,"format",null),e([r({type:String,json:{read:{reader:c.read},write:{writer:c.write}}})],y.prototype,"interpolation",null),e([r({json:{write:!0}})],y.prototype,"noData",null),e([r({type:String,json:{read:{reader:m.read},write:{writer:m.write}}})],y.prototype,"noDataInterpretation",null),e([r({json:{write:!0}})],y.prototype,"pixelType",void 0),e([r({json:{write:!0}})],y.prototype,"lercVersion",void 0),e([i("lercVersion")],y.prototype,"writeLercVersion",null),e([r({type:Number})],y.prototype,"version",null),e([r({json:{write:!0}})],y.prototype,"mosaicRule",null),e([r({json:{write:!0,name:"renderingRule"}})],y.prototype,"rasterFunction",null),y=e([o("esri.layers.support.ExportImageServiceParameters")],y);export{y as ExportImageServiceParameters};
@@ -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"../../request.js";import{isSome as n}from"../../core/arrayUtils.js";import{JSONSupportMixin as i}from"../../core/JSONSupport.js";import s from"../../core/Loadable.js";import{property as r}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/Logger.js";import{subclass as o}from"../../core/accessorSupport/decorators/subclass.js";import{parse as a}from"./arcgisLayerUrl.js";import l from"./Contingency.js";import u from"./ContingencyConstraintViolation.js";import c from"./ContingentValue.js";import p from"./ContingentValuesResult.js";import d from"./FieldGroup.js";import{isStringField as f,isDateField as y}from"./fieldUtils.js";import m from"./Subtype.js";var h;let g=h=class extends(i(s)){constructor(e){super(e),this.request=t,this.fieldGroups=null,this.fieldGroupDefinitions=null}initialize(){}get subtypeFieldName(){const{layer:e}=this;return"subtype-group"===e.type?e.subtypeField:e.typeIdField}static async createLoadedLayerContingentValuesCache(e){await e.load();const t=e.sourceJSON;if(void 0===e.layerId)return null;const n=t.hasContingentValuesDefinition;if(n)return new h({layer:e}).load();if(void 0===n){const t=a(e.url);if(null==t)return null;const n=t.url.path;if((await h._staticFetchEnterpriseFeatureRoot(n)).supportsQueryDataElements){const t=e.layerId.toString(),i=await h._staticFetchEnterpriseFieldGroup(n,t);if(i){const t=i.map((t=>({name:t.name,isEditingRestrictive:t.isEditingRestrictive,fields:t.fieldNames.names.map((t=>e.fieldsIndex.normalizeFieldName(t)))})));return new h({layer:e,fieldGroupDefinitions:t}).load()}}}return null}async load(e){const t=this.layer.load(e).then((()=>this._initializeContingentValues(this.fieldGroupDefinitions,e)));return this.addResolvingPromise(t),this}validateContingencyConstraints(e,t){const n=Object.keys(e),i=[],s=[];for(const r of this.fieldGroups){const o=r.isEditingRestrictive?"error":"warning";if(t&&!r.fields.some((e=>t.includes(e))))continue;if(!r.fields.every((e=>n.includes(e)))){s.push(new u({fieldGroup:r,type:o}));continue}let a=!1;const l=e[this.subtypeFieldName],c=r.contingencies.filter((e=>!(!e.isRetired&&e.subtype)||e.subtype.code===l));for(const t of c){let n=!0;for(const i in t.values){const s=t.values[i];if("any"!==s.objectType)if("null"===s.objectType){if(null!=e[i]){n=!1;break}}else if("code"===s.objectType){if(e[i]!==s.codedValue.code){n=!1;break}}else if("range"===s.objectType){const t=e[i];if(t<s.minValue||t>s.maxValue){n=!1;break}}}if(n){a=!0;break}}a||i.push(new u({fieldGroup:r,type:o}))}return{invalid:i,incomplete:s}}getContingentValues(e,t,n=!1){const i=e[this.subtypeFieldName],s=null!=i,r={};let o=[];const a=this.fieldGroups.filter((e=>e.fields.includes(t)));o.push(new c({objectType:"any"}));for(const l of a){let a=[];const u=l.contingencies.filter((e=>!(e.isRetired||e.subtype&&s&&e.subtype.code!==i)));let c=!1;const p={};for(const n of u){let i,s=!0;for(const r in n.values){const o=n.values[r];if(t!==r){if(void 0!==e[r]&&"any"!==o.objectType)if("null"===o.objectType)null!==e[r]&&(s=!1);else if("code"===o.objectType)e[r]!==o.codedValue.code&&(s=!1);else if("range"===o.objectType){const t=e[r];(t<o.minValue||t>o.maxValue)&&(s=!1)}}else i=o,c=c||"range"===o.objectType}if(i&&s){if("any"===i.objectType){a.length=0,a.push(i);break}const e=this._generateKey(i);p[e]||a.push(i),p[e]=!0}}c&&(a=this._joinRange(a)),r[l.name]=a,o=n?this._filterIntersection(o,a):[]}return 1===a.length&&n&&(o=[]),new p({contingentValuesAllGroups:o,contingentValuesByFieldGroup:r})}_generateKey(e){switch(e.objectType){case"any":return"@any@";case"null":return"@null@";case"code":return e.codedValue.name+e.codedValue.code.toString();case"range":return e.minValue.toString()+"-"+e.maxValue.toString()}}_joinRange(e){let t,n;e.sort(((e,t)=>"null"===e.objectType?-1:"null"===t.objectType?1:e.minValue-t.minValue));const i=[];for(const s of e)"null"!==s.objectType?null!=t&&null!=n?n<s.minValue?(i.push(new c({objectType:"range",minValue:t,maxValue:n})),t=s.minValue,n=s.maxValue):n<s.maxValue&&(n=s.maxValue):(t=s.minValue,n=s.maxValue):i.push(s);return i.push(new c({objectType:"range",minValue:t,maxValue:n})),i}_filterIntersection(e,t){if(0===e.length||0===t.length)return[];if("any"===e[0].objectType)return t;if("any"===t[0].objectType)return e;const n="range"===e[0].objectType||"range"===e[1]?.objectType,i="range"===t[0].objectType||"range"===t[1]?.objectType;return n||i?this._intersectRanges(e,t):this._intersectValues(e,t)}_intersectRanges(e,t){const n=[];let i,s=0;for(const r of e)for(;s<t.length;s++){const e=t[s];if("null"===r.objectType&&"null"===e.objectType)n.push(new c({objectType:"null"}));else{if("null"===r.objectType)break;if("null"===e.objectType)continue}if(r.maxValue<e.minValue)break;if(r.maxValue===e.minValue){n.push(new c({objectType:"range",minValue:r.maxValue,maxValue:e.minValue}));break}if(!(r.minValue>e.maxValue))if(r.minValue!==e.maxValue){if(i=r.minValue>e.minValue?r.minValue:e.minValue,r.maxValue<e.maxValue){n.push(new c({objectType:"range",minValue:i,maxValue:r.maxValue}));break}n.push(new c({objectType:"range",minValue:i,maxValue:e.maxValue}))}else n.push(new c({objectType:"range",minValue:r.minValue,maxValue:e.maxValue}))}return n}_intersectValues(e,t){const n=[];for(const i of e)t.some((e=>{if(i.objectType===e.objectType)switch(i.objectType){case"any":case"null":return!0;case"code":return i.codedValue.code===e.codedValue.code&&i.codedValue.name===e.codedValue.name}return!1}))&&n.push(i);return n}static async _staticFetchEnterpriseFeatureRoot(e,n){return t(e,{responseType:"json",query:{f:"json"},...n}).then((e=>e.data))}static async _staticFetchEnterpriseFieldGroup(e,n,i){return t(`${e}/queryDataElements`,{responseType:"json",query:{layers:JSON.stringify([n]),f:"json"},...i}).then((e=>e.data.layerDataElements?.[0].dataElement.fieldGroups??[]))}async _initializeContingentValues(e,t){const n=e??await this._fetchFieldGroupDefs(t);if(0===n.length)return void(this.fieldGroups=[]);const i=await this._fetchContingentValues(n,t);this.fieldGroups=i}async _fetchFieldGroupDefs(e){if(void 0===this.layer.layerId)return[];const t=this.layer.sourceJSON,n=this.layer.layerId.toString(),i=a(this.layer.url).url.path;if(t.hasContingentValuesDefinition){return(await this._fetchAGOLFieldGroup(i,n,e)).map((e=>({name:e.name,isEditingRestrictive:e.restrictive,fields:e.fields.map((e=>this.layer.fieldsIndex.normalizeFieldName(e)))})))}return void 0!==t.hasContingentValuesDefinition?[]:this._fetchEnterpriseFeatureRoot(i,e).then((async t=>{if(t.supportsQueryDataElements){return(await this._fetchEnterpriseFieldGroup(i,n,e)).map((e=>({name:e.name,isEditingRestrictive:e.isEditingRestrictive,fields:e.fieldNames.names.map((e=>this.layer.fieldsIndex.normalizeFieldName(e)))})))}return[]}))}async _fetchAGOLFieldGroup(e,n,i){return t(`${e}/${n}/fieldgroups`,{responseType:"json",query:{f:"json"},...i}).then((e=>e.data.fieldGroups??[]))}async _fetchEnterpriseFieldGroup(e,t,n){return h._staticFetchEnterpriseFieldGroup(e,t,n)}async _fetchEnterpriseFeatureRoot(e,t){return h._staticFetchEnterpriseFeatureRoot(e,t)}async _fetchContingentValues(e,t){if(void 0===this.layer.layerId)return[];const n=this.layer.sourceJSON,i=this.layer.layerId.toString(),s=a(this.layer.url).url.path;if(n.hasContingentValuesDefinition){const n=await this._fetchAGOLContingentValues(s,i,t);return this._constructFieldGroupsAGOL(e,n)}const r=await this._fetchEnterpriseContingentValues(s,i,t);return this._constructFieldGroupsEnterprise(e,r)}_constructFieldGroupsAGOL(e,t){return e.map((e=>{const n=t.contingentValuesDefinition.fieldGroups.find((t=>t.name===e.name));if(n){let i=[];return i=t.contingentValuesDefinition.hasSubType?this._parseAGOLFieldGroupSubtype(e,t,n.subTypes):this._parseAGOLFieldGroup(e,t,n.contingentValues),new d({name:e.name,isEditingRestrictive:e.isEditingRestrictive,fields:e.fields,contingencies:i})}return null})).filter(n)}_parseAGOLFieldGroupSubtype(e,t,n){let i=[];return n?.forEach((n=>{const s=this._getSubtypeAGOL(n.name);i=i.concat(this._parseAGOLFieldGroup(e,t,n.contingentValues,s))})),i}_parseAGOLFieldGroup(e,t,n,i=null){const s=[];for(const r of n??[]){const n=this._parseAGOLContingency(r,e,t,i);s.push(n)}return s}_parseAGOLContingency(e,t,n,i){const s=e.id,r=!!e.retired&&1===e.retired,o={};for(let a=0,l=0;a<t.fields.length;a++){const s=t.fields[a],r=n.typeCodes[e.types[a]];if("Code"===r){let t=e.values[l];l++;const r=this._getDomain(i,s),a=this.layer.getField(s);if("string"===a?.type){const e=n.stringDicts.find((e=>e.domain===r?.name));e&&(t=e.entries[t])}const u=r?.codedValues.find((e=>e.code===t)),p=new c({codedValue:u,objectType:"code"});o[s]=p}else if("Range"===r){const t=e.values[l];l++;const n=t.range[0],i=t.range[1],r=new c({minValue:n,maxValue:i,objectType:"range"});o[s]=r}else if("Any"===r){const e=new c({objectType:"any"});o[s]=e}else{const e=new c({objectType:"null"});o[s]=e}}return new l({id:s,isRetired:r,subtype:i,values:o})}_constructFieldGroupsEnterprise(e,t){const i=t.fieldGroups;return e.map((e=>{const n=i.find((t=>t.name===e.name));if(n){const i=n.contingencies.map((n=>{const i=n.id,s=n.isRetired||!1,r=this._getSubtypeEnterprise(n.subtypeCode),o={};for(let a=0;a<e.fields.length;a++){const i=e.fields[a];let s=n.values[a];if("number"==typeof s||"string"==typeof s){const e=this._getDomain(r,i),n=this.layer.getField(i);if(f(n))s=t.stringDictionary[s];else if(y(n)){const e=new Date(`${s}+00:00`);s=e.getTime()}const a=e?.codedValues.find((e=>e.code===s)),l=new c({codedValue:a,objectType:"code"});o[i]=l}else if("object"==typeof s){const e=s.minValue,t=s.maxValue,n=new c({minValue:e,maxValue:t,objectType:"range"});o[i]=n}else if(s){const e=new c({objectType:"any"});o[i]=e}else{const e=new c({objectType:"null"});o[i]=e}}return new l({id:i,isRetired:s,subtype:r,values:o})}));return new d({name:e.name,isEditingRestrictive:e.isEditingRestrictive,fields:e.fields,contingencies:i})}return null})).filter(n)}async _fetchEnterpriseContingentValues(e,n,i){return t(`${e}/queryContingentValues`,{responseType:"json",query:{layers:JSON.stringify([n]),f:"json"},...i}).then((e=>e.data.contingentValueSets?.[0]))}async _fetchAGOLContingentValues(e,n,i){return t(`${e}/${n}/contingentValues`,{responseType:"json",query:{f:"json"},...i}).then((e=>e.data))}_getSubtypeEnterprise(e){const t=this.layer.sourceJSON;let n;if(t.subtypes){const i=t.subtypes.find((t=>t.code===e));n=m.fromJSON(i)}return n||null}_getSubtypeAGOL(e){const t=this.layer.sourceJSON;let n;if(t.subtypes){const i=t.subtypes.find((t=>t.name===e));n=m.fromJSON(i)}return n||null}_findDomainByFieldName(e,t){const n=e.domains;if(n){const[e,i]=Object.entries(n).find((([e])=>e.trim().toLowerCase()===t.trim().toLowerCase()))||[];return i||null}return null}_getDomain(e,t){const n=e?this._findDomainByFieldName(e,t):this.layer.getFieldDomain(t);return"inherited"===n?.type?this.layer.getFieldDomain(t):n}};e([r({constructOnly:!0})],g.prototype,"layer",void 0),e([r({constructOnly:!0})],g.prototype,"request",void 0),e([r({type:[d]})],g.prototype,"fieldGroups",void 0),e([r({constructOnly:!0})],g.prototype,"fieldGroupDefinitions",void 0),e([r()],g.prototype,"subtypeFieldName",null),g=h=e([o("esri.layers.support.LayerContingentValuesCache")],g);const V=g;export{V as default};
5
+ import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../request.js";import{isSome as n}from"../../core/arrayUtils.js";import{JSONSupportMixin as i}from"../../core/JSONSupport.js";import s from"../../core/Loadable.js";import{property as o}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/Logger.js";import{subclass as r}from"../../core/accessorSupport/decorators/subclass.js";import{parse as a}from"./arcgisLayerUrl.js";import l from"./Contingency.js";import u from"./ContingencyConstraintViolation.js";import c from"./ContingentValue.js";import p from"./ContingentValuesResult.js";import d from"./FieldGroup.js";import{isStringField as f,isDateField as y}from"./fieldUtils.js";import m from"./Subtype.js";var g;let h=g=class extends(i(s)){constructor(e){super(e),this.request=t,this.fieldGroups=null,this.fieldGroupDefinitions=null}initialize(){}get subtypeFieldName(){const{layer:e}=this;return"subtype-group"===e.type?e.subtypeField:e.typeIdField}static async createLoadedLayerContingentValuesCache(e){await e.load();const t=e.sourceJSON;if(void 0===e.layerId)return null;const n=t.hasContingentValuesDefinition;if(n)return new g({layer:e}).load();if(void 0===n){const t=a(e.url);if(null==t)return null;const n=t.url.path;if((await x(n)).supportsQueryDataElements){const t=e.layerId.toString(),i=await v(n,t);if(i){const t=i.map((t=>({name:t.name,isEditingRestrictive:t.isEditingRestrictive,fields:t.fieldNames.names.map((t=>e.fieldsIndex.normalizeFieldName(t)))})));return new g({layer:e,fieldGroupDefinitions:t}).load()}}}return null}async load(e){const t=this.layer.load(e).then((()=>this._initializeContingentValues(this.fieldGroupDefinitions,e)));return this.addResolvingPromise(t),this}validateContingencyConstraints(e,t){const n=Object.keys(e),i=[],s=[];for(const o of this.fieldGroups){const r=o.isEditingRestrictive?"error":"warning";if(t&&!o.fields.some((e=>t.includes(e))))continue;if(!o.fields.every((e=>n.includes(e)))){s.push(new u({fieldGroup:o,type:r}));continue}let a=!1;const l=e[this.subtypeFieldName],c=o.contingencies.filter((e=>!(!e.isRetired&&e.subtype)||e.subtype.code===l));for(const t of c){let n=!0;for(const i in t.values){const s=t.values[i];if("any"!==s.objectType)if("null"===s.objectType){if(null!=e[i]){n=!1;break}}else if("code"===s.objectType){if(e[i]!==s.codedValue.code){n=!1;break}}else if("range"===s.objectType){const t=e[i];if(t<s.minValue||t>s.maxValue){n=!1;break}}}if(n){a=!0;break}}a||i.push(new u({fieldGroup:o,type:r}))}return{invalid:i,incomplete:s}}getContingentValues(e,t,n=!1){const i=e[this.subtypeFieldName],s=null!=i,o={};let r=[];const a=this.fieldGroups.filter((e=>e.fields.includes(t)));r.push(new c({objectType:"any"}));for(const l of a){let a=[];const u=l.contingencies.filter((e=>!(e.isRetired||e.subtype&&s&&e.subtype.code!==i)));let c=!1;const p={};for(const n of u){let i,s=!0;for(const o in n.values){const r=n.values[o];if(t!==o){if(void 0!==e[o]&&"any"!==r.objectType)if("null"===r.objectType)null!==e[o]&&(s=!1);else if("code"===r.objectType)e[o]!==r.codedValue.code&&(s=!1);else if("range"===r.objectType){const t=e[o];(t<r.minValue||t>r.maxValue)&&(s=!1)}}else i=r,c=c||"range"===r.objectType}if(i&&s){if("any"===i.objectType){a.length=0,a.push(i);break}const e=V(i);p[e]||a.push(i),p[e]=!0}}c&&(a=b(a)),o[l.name]=a,r=n?G(r,a):[]}return 1===a.length&&n&&(r=[]),new p({contingentValuesAllGroups:r,contingentValuesByFieldGroup:o})}async _initializeContingentValues(e,t){const n=e??await this._fetchFieldGroupDefs(t);if(0===n.length)return void(this.fieldGroups=[]);const i=await this._fetchContingentValues(n,t);this.fieldGroups=i}async _fetchFieldGroupDefs(e){if(void 0===this.layer.layerId)return[];const t=this.layer.sourceJSON,n=this.layer.layerId.toString(),i=a(this.layer.url).url.path;if(t.hasContingentValuesDefinition){return(await w(i,n,e)).map((e=>({name:e.name,isEditingRestrictive:e.restrictive,fields:e.fields.map((e=>this.layer.fieldsIndex.normalizeFieldName(e)))})))}return void 0!==t.hasContingentValuesDefinition?[]:x(i,e).then((async t=>{if(t.supportsQueryDataElements){return(await v(i,n,e)).map((e=>({name:e.name,isEditingRestrictive:e.isEditingRestrictive,fields:e.fieldNames.names.map((e=>this.layer.fieldsIndex.normalizeFieldName(e)))})))}return[]}))}async _fetchContingentValues(e,t){if(void 0===this.layer.layerId)return[];const n=this.layer.sourceJSON,i=this.layer.layerId.toString(),s=a(this.layer.url).url.path;if(n.hasContingentValuesDefinition){const n=await S(s,i,t);return this._constructFieldGroupsAGOL(e,n)}const o=await C(s,i,t);return this._constructFieldGroupsEnterprise(e,o)}_constructFieldGroupsAGOL(e,t){return e.map((e=>{const n=t.contingentValuesDefinition.fieldGroups.find((t=>t.name===e.name));if(n){let i=[];return i=t.contingentValuesDefinition.hasSubType?this._parseAGOLFieldGroupSubtype(e,t,n.subTypes):this._parseAGOLFieldGroup(e,t,n.contingentValues),new d({name:e.name,isEditingRestrictive:e.isEditingRestrictive,fields:e.fields,contingencies:i})}return null})).filter(n)}_parseAGOLFieldGroupSubtype(e,t,n){let i=[];return n?.forEach((n=>{const s=this._getSubtypeAGOL(n.name);i=i.concat(this._parseAGOLFieldGroup(e,t,n.contingentValues,s))})),i}_parseAGOLFieldGroup(e,t,n,i=null){const s=[];for(const o of n??[]){const n=this._parseAGOLContingency(o,e,t,i);s.push(n)}return s}_parseAGOLContingency(e,t,n,i){const s=e.id,o=!!e.retired&&1===e.retired,r={};for(let a=0,l=0;a<t.fields.length;a++){const s=t.fields[a],o=n.typeCodes[e.types[a]];if("Code"===o){let t=e.values[l];l++;const o=this._getDomain(i,s),a=this.layer.getField(s);if("string"===a?.type){const e=n.stringDicts.find((e=>e.domain===o?.name));e&&(t=e.entries[t])}const u=o?.codedValues.find((e=>e.code===t)),p=new c({codedValue:u,objectType:"code"});r[s]=p}else if("Range"===o){const t=e.values[l];l++;const n=t.range[0],i=t.range[1],o=new c({minValue:n,maxValue:i,objectType:"range"});r[s]=o}else if("Any"===o){const e=new c({objectType:"any"});r[s]=e}else{const e=new c({objectType:"null"});r[s]=e}}return new l({id:s,isRetired:o,subtype:i,values:r})}_constructFieldGroupsEnterprise(e,t){const i=t.fieldGroups;return e.map((e=>{const n=i.find((t=>t.name===e.name));if(n){const i=n.contingencies.map((n=>{const i=n.id,s=n.isRetired||!1,o=this._getSubtypeEnterprise(n.subtypeCode),r={};for(let a=0;a<e.fields.length;a++){const i=e.fields[a];let s=n.values[a];if("number"==typeof s||"string"==typeof s){const e=this._getDomain(o,i),n=this.layer.getField(i);if(f(n))s=t.stringDictionary[s];else if(y(n)){const e=new Date(`${s}+00:00`);s=e.getTime()}const a=e?.codedValues.find((e=>e.code===s)),l=new c({codedValue:a,objectType:"code"});r[i]=l}else if("object"==typeof s){const e=s.minValue,t=s.maxValue,n=new c({minValue:e,maxValue:t,objectType:"range"});r[i]=n}else if(s){const e=new c({objectType:"any"});r[i]=e}else{const e=new c({objectType:"null"});r[i]=e}}return new l({id:i,isRetired:s,subtype:o,values:r})}));return new d({name:e.name,isEditingRestrictive:e.isEditingRestrictive,fields:e.fields,contingencies:i})}return null})).filter(n)}_getSubtypeEnterprise(e){const t=this.layer.sourceJSON;let n;if(t.subtypes){const i=t.subtypes.find((t=>t.code===e));n=m.fromJSON(i)}return n||null}_getSubtypeAGOL(e){const t=this.layer.sourceJSON;let n;if(t.subtypes){const i=t.subtypes.find((t=>t.name===e));n=m.fromJSON(i)}return n||null}_getDomain(e,t){const n=e?F(e,t):this.layer.getFieldDomain(t);return"inherited"===n?.type?this.layer.getFieldDomain(t):n}};function V(e){switch(e.objectType){case"any":return"@any@";case"null":return"@null@";case"code":return e.codedValue.name+e.codedValue.code.toString();case"range":return e.minValue.toString()+"-"+e.maxValue.toString()}}function b(e){let t,n;e.sort(((e,t)=>"null"===e.objectType?-1:"null"===t.objectType?1:e.minValue-t.minValue));const i=[];for(const s of e)"null"!==s.objectType?null!=t&&null!=n?n<s.minValue?(i.push(new c({objectType:"range",minValue:t,maxValue:n})),t=s.minValue,n=s.maxValue):n<s.maxValue&&(n=s.maxValue):(t=s.minValue,n=s.maxValue):i.push(s);return i.push(new c({objectType:"range",minValue:t,maxValue:n})),i}function j(e,t){const n=[];let i,s=0;for(const o of e)for(;s<t.length;s++){const e=t[s];if("null"===o.objectType&&"null"===e.objectType)n.push(new c({objectType:"null"}));else{if("null"===o.objectType)break;if("null"===e.objectType)continue}if(o.maxValue<e.minValue)break;if(o.maxValue===e.minValue){n.push(new c({objectType:"range",minValue:o.maxValue,maxValue:e.minValue}));break}if(!(o.minValue>e.maxValue))if(o.minValue!==e.maxValue){if(i=o.minValue>e.minValue?o.minValue:e.minValue,o.maxValue<e.maxValue){n.push(new c({objectType:"range",minValue:i,maxValue:o.maxValue}));break}n.push(new c({objectType:"range",minValue:i,maxValue:e.maxValue}))}else n.push(new c({objectType:"range",minValue:o.minValue,maxValue:e.maxValue}))}return n}function T(e,t){const n=[];for(const i of e)t.some((e=>{if(i.objectType===e.objectType)switch(i.objectType){case"any":case"null":return!0;case"code":return i.codedValue.code===e.codedValue.code&&i.codedValue.name===e.codedValue.name}return!1}))&&n.push(i);return n}function G(e,t){if(0===e.length||0===t.length)return[];if("any"===e[0].objectType)return t;if("any"===t[0].objectType)return e;const n="range"===e[0].objectType||"range"===e[1]?.objectType,i="range"===t[0].objectType||"range"===t[1]?.objectType;return n||i?j(e,t):T(e,t)}async function w(e,n,i){return t(`${e}/${n}/fieldgroups`,{responseType:"json",query:{f:"json"},...i}).then((e=>e.data.fieldGroups??[]))}async function v(e,n,i){return t(`${e}/queryDataElements`,{responseType:"json",query:{layers:JSON.stringify([n]),f:"json"},...i}).then((e=>e.data.layerDataElements?.[0].dataElement.fieldGroups??[]))}async function x(e,n){return t(e,{responseType:"json",query:{f:"json"},...n}).then((e=>e.data))}async function C(e,n,i){return t(`${e}/queryContingentValues`,{responseType:"json",query:{layers:JSON.stringify([n]),f:"json"},...i}).then((e=>e.data.contingentValueSets?.[0]))}async function S(e,n,i){return t(`${e}/${n}/contingentValues`,{responseType:"json",query:{f:"json"},...i}).then((e=>e.data))}function F(e,t){const n=e.domains;if(n){const[e,i]=Object.entries(n).find((([e])=>e.trim().toLowerCase()===t.trim().toLowerCase()))||[];return i||null}return null}e([o({constructOnly:!0})],h.prototype,"layer",void 0),e([o({constructOnly:!0})],h.prototype,"request",void 0),e([o({type:[d]})],h.prototype,"fieldGroups",void 0),e([o({constructOnly:!0})],h.prototype,"fieldGroupDefinitions",void 0),e([o()],h.prototype,"subtypeFieldName",null),h=g=e([r("esri.layers.support.LayerContingentValuesCache")],h);const O=h;export{O as default};