@arcgis/core 6.0.0-next.30 → 6.0.0-next.31
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/00d1c99779bd91b1d10e.js +1 -0
- package/assets/esri/core/workers/chunks/0694c7bcfe71692e2ccf.js +1 -0
- package/assets/esri/core/workers/chunks/{e2c6cd8dac01e129ccfe.js → 0e445ec3523de9f2dfa2.js} +1 -1
- package/assets/esri/core/workers/chunks/0f6c0d42100c21367e5c.js +1 -0
- package/assets/esri/core/workers/chunks/16cda273927ab0a39544.js +1 -0
- package/assets/esri/core/workers/chunks/1a3f71c4d97c36050030.js +1 -0
- package/assets/esri/core/workers/chunks/{0b4481b57a611b15f65c.js → 1eaf8bfdd3765a90ccc2.js} +1 -1
- package/assets/esri/core/workers/chunks/{8ca2bb3c0551bb1898b6.js → 3fdcc383bbd9cf0d274c.js} +1 -1
- package/assets/esri/core/workers/chunks/{fefdd10bdd5a4c8d8ed0.js → 4741fac6b6b4202a97c5.js} +1 -1
- package/assets/esri/core/workers/chunks/{ad21757d78e372fa2ed6.js → 4a979fce1c971b614a18.js} +1 -1
- package/assets/esri/core/workers/chunks/4d8833f48348cbbcc947.js +1 -0
- package/assets/esri/core/workers/chunks/{865cebc5c982c040ab6f.js → 55a9eaeb152a3abada67.js} +1 -1
- package/assets/esri/core/workers/chunks/572aec57593a08b8045b.js +1 -0
- package/assets/esri/core/workers/chunks/6029773458ab98600f67.js +1 -0
- package/assets/esri/core/workers/chunks/6b5c073dddd89d06ed80.js +1 -0
- package/assets/esri/core/workers/chunks/7cc9d7a88b64e25fce14.js +1 -0
- package/assets/esri/core/workers/chunks/7e211d8a8ad6c6a7cf3e.js +1 -0
- package/assets/esri/core/workers/chunks/{64b360625c68cb863a08.js → 84940d8e14caf5a27e04.js} +1 -1
- package/assets/esri/core/workers/chunks/{c90388932a7825d9d933.js → 85de980c5b296ec69323.js} +1 -1
- package/assets/esri/core/workers/chunks/89dc49e784f7ba3b93ea.js +1 -0
- package/assets/esri/core/workers/chunks/{9d40786c5ceface786ba.js → 8a485130781b49dbf608.js} +1 -1
- package/assets/esri/core/workers/chunks/8d13f11d0bcc8d3a4bdf.js +1 -0
- package/assets/esri/core/workers/chunks/8da2a10318f49d0dc73a.js +1 -0
- package/assets/esri/core/workers/chunks/8e6276ddd8d094c61f08.js +1 -0
- package/assets/esri/core/workers/chunks/{1dc6f093028530a492e6.js → 90ba0af9690dc32b2958.js} +1 -1
- package/assets/esri/core/workers/chunks/{71f792a20077aa739f87.js → a607541959169741a943.js} +1 -1
- package/assets/esri/core/workers/chunks/b2d6b1ac9fbb50c7c8ab.js +1 -0
- package/assets/esri/core/workers/chunks/b657363113f4a37e634b.js +1 -0
- package/assets/esri/core/workers/chunks/b9cb92858a576eb6aa06.js +1 -0
- package/assets/esri/core/workers/chunks/{4419732baf3459a80e6d.js → ceb2d5b0a23f0ab81f68.js} +1 -1
- package/assets/esri/core/workers/chunks/{7030a4d0714a35995a58.js → d09d8cd43e846d467827.js} +1 -1
- package/assets/esri/core/workers/chunks/{12b84262dedc6b393136.js → d9a240a3c6bf85124474.js} +1 -1
- package/assets/esri/core/workers/chunks/{8f008eedb11685ee2048.js → e096c1d9d53af74d3207.js} +1 -1
- package/assets/esri/core/workers/chunks/e30fdde253e5521473a2.js +1 -0
- package/assets/esri/core/workers/chunks/e4e2edfdc85dd14e66d4.js +1 -0
- package/assets/esri/core/workers/chunks/{ba4520ddcb6a49988da6.js → f21edbfdcab111d8a6cd.js} +1 -1
- package/assets/esri/core/workers/chunks/f4d91d470ca5fea0bd26.js +1 -0
- package/assets/esri/core/workers/chunks/f717005e14a7e9141df7.js +1 -0
- package/assets/esri/core/workers/chunks/f75eec2cbc541eec9712.js +1 -0
- package/assets/esri/core/workers/chunks/{b5eff28cf482d920b9ea.js → f7fb6cb7f08c16384443.js} +1 -1
- package/assets/esri/core/workers/chunks/fcc3902d6d9eda6f09f5.js +1 -0
- package/assets/esri/core/workers/chunks/{28a821de9dbf10324033.js → fd031150d3a7f896e6b3.js} +1 -1
- package/assets/esri/core/workers/chunks/{cc97e4fd0dacad970a23.js → ffaaa388773e60869df0.js} +1 -1
- package/config.js +1 -1
- package/core/scheduling.js +1 -1
- package/geometry/Mesh.d.ts +2 -125
- package/geometry/Mesh.js +1 -1
- package/geometry/support/meshErrors.js +1 -1
- package/geometry/support/plane.js +1 -1
- package/geometry/support/polygonUtils.js +1 -1
- package/interfaces.d.ts +0 -3
- package/kernel.js +1 -1
- package/layers/SceneLayer.js +1 -1
- package/layers/graphics/controllers/I3SOnDemandController.js +1 -1
- package/layers/knowledgeGraph/KnowledgeGraphLayerDataManager.js +1 -1
- package/layers/mixins/ArcGISImageService.js +1 -1
- package/layers/raster/functions/rasterProjectionHelper.js +1 -1
- package/layers/support/featureLayerUtils.js +1 -1
- package/package.json +2 -2
- package/support/arcadeUtils.js +1 -1
- package/views/2d/engine/webgl/SpriteMosaic.js +1 -1
- package/views/2d/layers/ImageryLayerView2D.js +1 -1
- package/views/3d/analysis/LineOfSight/LineOfSightConfiguration.js +1 -1
- package/views/3d/analysis/LineOfSight/LineOfSightEditTool.js +1 -1
- package/views/3d/analysis/LineOfSight/LineOfSightItemTool.js +1 -1
- package/views/3d/analysis/LineOfSight/LineOfSightManipulators.js +1 -1
- package/views/3d/environment/SunLighting.d.ts +10 -8
- package/views/3d/environment/VirtualLighting.d.ts +10 -8
- package/views/3d/layers/graphics/Graphics3DPathSymbolLayer.js +1 -1
- package/views/3d/support/renderInfoUtils/polygon.js +1 -1
- package/views/3d/terrain/PatchGeometryFactory.js +1 -1
- package/views/3d/terrain/PlanarPatch.js +1 -1
- package/views/3d/terrain/SphericalPatch.js +1 -1
- package/views/3d/webgl-engine/lib/Path.js +1 -1
- package/views/3d/webgl-engine/lib/PathBuilder.js +1 -1
- package/views/3d/webgl-engine/lib/PathExtruder.js +1 -1
- package/views/3d/webgl-engine/lib/PathGeometry.js +1 -1
- package/views/3d/webgl-engine/lib/pathGeometryUtils.js +1 -1
- package/views/interactive/snapping/FeatureSnappingEngine.js +1 -1
- package/views/support/TextureCompressionWorker.js +1 -1
- package/views/webgl/Texture.js +1 -1
- package/webscene/Environment.d.ts +1 -1
- package/widgets/BatchAttributeForm/BatchAttributeFormViewModel.js +1 -1
- package/widgets/BatchAttributeForm/expressions/ExpressionsManager.js +1 -1
- package/widgets/BatchAttributeForm/inputs/RelationshipElementInput.js +1 -1
- package/widgets/BatchAttributeForm/inputs/support/createBatchFormInputs.js +1 -1
- package/widgets/BatchAttributeForm.js +1 -1
- package/widgets/FeatureForm.js +1 -1
- package/assets/esri/core/workers/chunks/02335385b1476fe322eb.js +0 -1
- package/assets/esri/core/workers/chunks/07b726a46864501b90a0.js +0 -1
- package/assets/esri/core/workers/chunks/189321d88026bd7e6d3e.js +0 -1
- package/assets/esri/core/workers/chunks/18d47ab571b613fbe719.js +0 -1
- package/assets/esri/core/workers/chunks/1967b9c96045a5802d08.js +0 -1
- package/assets/esri/core/workers/chunks/199a7f97916679e0257c.js +0 -1
- package/assets/esri/core/workers/chunks/1d96fbad881a7d14a950.js +0 -1
- package/assets/esri/core/workers/chunks/2cd60fd062d954322c1f.js +0 -1
- package/assets/esri/core/workers/chunks/2d3e0e4442dbc6ec6def.js +0 -1
- package/assets/esri/core/workers/chunks/2f5d014d6a72108b0b3a.js +0 -1
- package/assets/esri/core/workers/chunks/3105336a05f38a95ebea.js +0 -1
- package/assets/esri/core/workers/chunks/4fb2fcc95f852bf8f86c.js +0 -1
- package/assets/esri/core/workers/chunks/59bc55880e6fd8ce20c0.js +0 -1
- package/assets/esri/core/workers/chunks/5f787809b74eed7b9a91.js +0 -1
- package/assets/esri/core/workers/chunks/6a7de221cea4426cb490.js +0 -1
- package/assets/esri/core/workers/chunks/7a0b4dc0cda190367a39.js +0 -1
- package/assets/esri/core/workers/chunks/7d3f7940815fa5dc244e.js +0 -1
- package/assets/esri/core/workers/chunks/999c23da883eb11cb29e.js +0 -1
- package/assets/esri/core/workers/chunks/9bc3afe7013ef4ae737b.js +0 -1
- package/assets/esri/core/workers/chunks/bab1d010970d98c25470.js +0 -1
- package/assets/esri/core/workers/chunks/c4f78a481f43cfae7b63.js +0 -1
- package/assets/esri/core/workers/chunks/dcf6024dc19428ff2b9d.js +0 -1
- package/assets/esri/core/workers/chunks/ee0dc906cc7979080329.js +0 -1
- package/assets/esri/core/workers/chunks/f0d0ed155275c2e6d3da.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";(self.webpackChunkRemoteClient=self.webpackChunkRemoteClient||[]).push([[9235],{99235(e,t,r){r.d(t,{vt:()=>Vs,UD:()=>Ds});var s=r(85334),n=r(49186),i=r(4718),o=r(32198),a=r(91429),l=r(94778),u=r(25482);let p=class extends u.o{constructor(){super(...arguments),this.raster=void 0}};(0,o.Cg)([(0,a.MZ)({json:{write:!0}})],p.prototype,"raster",void 0),p=(0,o.Cg)([(0,a.$K)("esri.layers.raster.functions.BaseFunctionArguments")],p);const c=p;var h;let m=h=class extends c{constructor(){super(...arguments),this.raster2=void 0}get rasters(){return[this.raster,this.raster2]}clone(){return new h({raster:this.raster,raster2:this.raster2,operation:this.operation})}};(0,o.Cg)([(0,a.MZ)({json:{write:!0}})],m.prototype,"operation",void 0),(0,o.Cg)([(0,a.MZ)({json:{write:!0}})],m.prototype,"raster2",void 0),(0,o.Cg)([(0,a.MZ)({readOnly:!0})],m.prototype,"rasters",null),m=h=(0,o.Cg)([(0,a.$K)("esri.layers.raster.functions.ArithmeticFunctionArguments")],m);const f=m;var g=r(14140),d=r(87186);const y=new Set(["slope","aspect","curvature","hillshade","shadedrelief","statistics"]);let x=class extends u.o{constructor(){super(...arguments),this.functionArguments=null,this.readingBufferSize=0,this.id=-1,this.isNoopProcess=!1,this.rawInputBandIds=[],this.rawSourceRasterInfos=null,this.isInputBandIdsSwizzled=!1,this.swizzledBandSelection=[],this.isBranch=!1,this.isRoot=!1,this._bindingResult=null}get supportsGPU(){return this._bindingResult.supportsGPU}get flatWebGLFunctionChain(){let e=this.getWebGLProcessorDefinition();if(!e)return null;let t=[e],{parameters:r}=e,s=r.rasters||r.raster&&[r.raster];for(;s?.length;){t.unshift(...s);let e=[];for(let t=0;t<s.length;t++){let{parameters:r}=s[t],n=r.rasters||r.raster&&[r.raster];n?.length&&e.push(...n)}s=e}for(let e=t.length-1;e>=0;e--)t[e].isNoopProcess&&t.splice(e,1);let n=!1;for(let e=0;e<t.length;e++){let r=t[e];r.id=t.length-e-1;let{rasters:s}=r.parameters;n||=null!=s&&s.length>1}let i=t.some(({name:e})=>y.has(e.toLowerCase())),{rawSourceRasterInfos:o}=this;return{functions:t,hasBranches:n,hasFocalFunction:i,isSourceSingleBand:1===o?.[0]?.bandCount}}get neighborhoodSize(){let{rows:e,cols:t}=this._getNeighborhoodSize(),r=this.getImmediateChildFunctions();for(let s of r){let r=s.neighborhoodSize;e=Math.max(e,r.rows),t=Math.max(t,r.cols)}return{rows:e,cols:t}}bind(e,t=!1,r=-1){this.id=r+1;let s=this._getRasterValues(),n=!0;for(let r=0;r<s.length;r++){let i=s[r];if(null!=i&&this._isRasterFunctionValue(i)){let s=i.bind(e,t,this.id+r);if(!s.success)return this._bindingResult=s,s;n&&=s.supportsGPU}}return!this.rasterInfo||t?(this.sourceRasterInfos=this._getSourceRasterInfos(e),this._bindingResult=this._bindSourceRasters(),n&&=this._bindingResult.supportsGPU,this._bindingResult.success&&(this._patchRasterInfo(),n&&this.isRoot&&(this.processInputBandIds(),this.swizzleInputBandIds(this.rawInputBandIds)||(n=this.rawInputBandIds.length<=3))),this._bindingResult.supportsGPU=n,this._bindingResult):(this._bindingResult={success:!0,supportsGPU:!0},this._bindingResult)}queryRasterFunction(e){let t=[this];for(;t.length;){let r=t.pop();if(e(r))return r;let s=r.getImmediateChildFunctions();t.push(...s)}}getImmediateChildFunctions(){return this._getRasterValues().filter(e=>e&&"object"==typeof e&&"bind"in e)}process(e,t){let r=this._getRasterValues(),s=0===r.length?e.pixelBlocks??e.primaryPixelBlocks:r.map(r=>this._readRasterValue(r,e,t));return this._processPixels({...e,pixelBlocks:s},t)}processInputBandIds(){let e=this._getRasterValues().filter(this._isRasterFunctionValue);if(e.length>1){let t=e.map(e=>e.processInputBandIds());return this.rawInputBandIds=[...new Set(t.flat())],this.rawInputBandIds}let t=e[0];if(t)return this.rawInputBandIds=t.processInputBandIds(),this.rawInputBandIds;let{bandCount:r}=this.sourceRasterInfos[0],s=Array.from({length:r},(e,t)=>t);return this.rawInputBandIds=this._getInputBandIds(s),this.rawInputBandIds}swizzleInputBandIds(e){let t=this._getRasterValues().filter(this._isRasterFunctionValue),r=!0;for(let s of t)r=s.swizzleInputBandIds(e)&&r;return!!r&&this._swizzleBandIds(e)}getPrimaryRasters(){let e=[],t=[];return this._getPrimaryRasters(this,e,t),{rasters:e,rasterIds:t}}getWebGLProcessorDefinition(){let e=this._getWebGLParameters(),{raster:t,rasters:r}=this.functionArguments;return r&&Array.isArray(r)&&r.length?(e.rasters=r.map(e=>this._isRasterFunctionValue(e)?e.getWebGLProcessorDefinition():"number"==typeof e?{name:"Constant",parameters:{value:e},pixelType:"f32",id:-1,isNoopProcess:!1}:{name:"Identity",parameters:{value:e},pixelType:"f32",id:-1,isNoopProcess:!1}),e.rasters.some(e=>null!=e)||(e.rasters=null)):this._isRasterFunctionValue(t)&&(e.raster=t.getWebGLProcessorDefinition()),{name:this.functionName,parameters:e,pixelType:this.outputPixelType,id:this.id,isNoopProcess:this.isNoopProcess}}getClippingGeometries(){let e=[];"Clip"===this.functionName&&e.push(this.functionArguments);let{raster:t,rasters:r}=this.functionArguments;if(r&&Array.isArray(r)&&r.length)r.forEach(t=>{if(this._isRasterFunctionValue(t)){let r=t.getClippingGeometries();e.push(...r)}});else if(this._isRasterFunctionValue(t)){let r=t.getClippingGeometries();e.push(...r)}return e}_getOutputPixelType(e){return"unknown"===this.outputPixelType?e:this.outputPixelType??e}_getWebGLParameters(){return{}}_getInputBandIds(e){return e}_swizzleBandIds(e){return!0}_isInputRasterPrimaryOrConstant(){return!this._getRasterValues().some(e=>e&&"object"==typeof e&&"rasterFunction"in e&&e.rasterFunction)}_getNeighborhoodSize(){return{rows:1,cols:1}}_removeStatsHistColormapVAT(e){e.statistics=null,e.histograms=null,e.colormap=null,e.attributeTable=null,e.multidimensionalInfo?.variables.forEach(e=>{e.statistics=void 0,e.histograms=void 0})}_getRasterValues(){let{rasterArgumentNames:e}=this;return"rasters"===e[0]?this.functionArguments.rasters??[]:e.flatMap(e=>this.functionArguments[e])}_getSourceRasterInfos(e){let t=this._getRasterValues(),{rasterInfos:r,rasterIds:s}=e;if(0===t.length)return r;let n=t.map(e=>e&&"object"==typeof e&&"bind"in e&&e.rasterInfo?e.rasterInfo:"string"==typeof e&&s.includes(e)?r[s.indexOf(e)]:"number"!=typeof e?r[0]:void 0),i=n.find(e=>e)??r[0];return n.forEach((e,t)=>{void 0===e&&(n[t]=i)}),n}_getPrimaryRasterId(e){return e?.rasterId}_getPrimaryRasters(e,t=[],r=[]){for(let s=0;s<e.sourceRasters.length;s++){let n=e.sourceRasters[s];if("number"!=typeof n)if("bind"in n)this._getPrimaryRasters(n,t,r);else{let e=n,s=this._getPrimaryRasterId(e);if(null==s)continue;r.includes(s)||(this.mainPrimaryRasterId===s?(t.unshift(e),r.unshift(s)):(t.push(e),r.push(s)))}}}_isRasterFunctionValue(e){return"object"==typeof e&&!!e&&"getWebGLProcessorDefinition"in e}_readRasterValue(e,t,r){let{primaryPixelBlocks:s}=t;if(null==e||"$$"===e){let e=s[0];return null==e?null:e.clone()}if("string"==typeof e){let r=t.primaryRasterIds.indexOf(e);return-1===r?null:s[r]}if("number"==typeof e){let t=s[0];if(null==t)return null;let{width:r,height:n,pixelType:i}=t,o=new Float32Array(r*n);o.fill(e);let a=this.sourceRasterInfos[0].bandCount,l=Array(a).fill(o);return new g.A({width:r,height:n,pixelType:i,pixels:l})}return e.process(t,r)}_patchRasterInfo(){let{rasterInfo:e}=this;if(!e?.keyProperties)return;let{bandCount:t,keyProperties:r,statistics:s,histograms:n}=e,i=r.BandProperties;i&&i.length!==t&&(e.keyProperties={...r,BandProperties:void 0}),s&&s.length!==t&&(e.statistics=s.length>t?s.slice(0,t):null),n&&n.length!==t&&(e.histograms=n.length>t?n.slice(0,t):null),r.BAND_COUNT&&Number(r.BAND_COUNT)!==t&&(e.keyProperties={...r,BAND_COUNT:"string"==typeof r.BAND_COUNT?String(t):t})}};(0,o.Cg)([(0,a.MZ)({json:{write:!0}})],x.prototype,"functionName",void 0),(0,o.Cg)([(0,a.MZ)({json:{write:!0}})],x.prototype,"functionArguments",void 0),(0,o.Cg)([(0,a.MZ)()],x.prototype,"rasterArgumentNames",void 0),(0,o.Cg)([(0,a.MZ)({json:{write:!0}}),(0,a.wg)(e=>e?.toLowerCase())],x.prototype,"outputPixelType",void 0),(0,o.Cg)([(0,a.MZ)({json:{write:!0}})],x.prototype,"mainPrimaryRasterId",void 0),(0,o.Cg)([(0,a.MZ)()],x.prototype,"sourceRasters",void 0),(0,o.Cg)([(0,a.MZ)({type:[d.A],json:{write:!0}})],x.prototype,"sourceRasterInfos",void 0),(0,o.Cg)([(0,a.MZ)({json:{write:!0}})],x.prototype,"rasterInfo",void 0),(0,o.Cg)([(0,a.MZ)({json:{write:!0}})],x.prototype,"readingBufferSize",void 0),(0,o.Cg)([(0,a.MZ)({json:{write:!0}})],x.prototype,"id",void 0),(0,o.Cg)([(0,a.MZ)()],x.prototype,"isNoopProcess",void 0),(0,o.Cg)([(0,a.MZ)()],x.prototype,"supportsGPU",null),(0,o.Cg)([(0,a.MZ)({json:{write:!0}})],x.prototype,"rawInputBandIds",void 0),(0,o.Cg)([(0,a.MZ)()],x.prototype,"rawSourceRasterInfos",void 0),(0,o.Cg)([(0,a.MZ)({json:{write:!0}})],x.prototype,"isInputBandIdsSwizzled",void 0),(0,o.Cg)([(0,a.MZ)({json:{write:!0}})],x.prototype,"swizzledBandSelection",void 0),(0,o.Cg)([(0,a.MZ)()],x.prototype,"isBranch",void 0),(0,o.Cg)([(0,a.MZ)()],x.prototype,"isRoot",void 0),(0,o.Cg)([(0,a.MZ)({readOnly:!0})],x.prototype,"flatWebGLFunctionChain",null),(0,o.Cg)([(0,a.MZ)({readOnly:!0})],x.prototype,"neighborhoodSize",null),(0,o.Cg)([(0,a.MZ)()],x.prototype,"_bindingResult",void 0),x=(0,o.Cg)([(0,a.$K)("esri.layers.raster.functions.BaseRasterFunction")],x);const w=x,A={userDefined:-1,lineDetectionHorizontal:0,lineDetectionVertical:1,lineDetectionLeftDiagonal:2,lineDetectionRightDiagonal:3,gradientNorth:4,gradientWest:5,gradientEast:6,gradientSouth:7,gradientNorthEast:8,gradientNorthWest:9,smoothArithmeticMean:10,smoothing3x3:11,smoothing5x5:12,sharpening3x3:13,sharpening5x5:14,laplacian3x3:15,laplacian5x5:16,sobelHorizontal:17,sobelVertical:18,sharpen:19,sharpen2:20,pointSpread:21,none:255},v={bitwiseAnd:11,bitwiseLeftShift:12,bitwiseNot:13,bitwiseOr:14,bitwiseRightShift:15,bitwiseXOr:16,booleanAnd:17,booleanNot:18,booleanOr:19,booleanXOr:20,equalTo:24,greaterThan:28,greaterThanEqual:29,lessThan:33,lessThanEqual:34,isNull:31,notEqual:46},b={acos:6,asin:7,atan:8,atanh:9,cos:21,cosh:22,sin:51,sinh:52,tan:56,tanh:57,acosh:59,asinh:60,atan2:61},C={setNull:50,conditional:78},M={plus:1,minus:2,times:3,sqrt:4,power:5,abs:10,divide:23,exp:25,exp10:26,exp2:27,int:30,float:32,ln:35,log10:36,log2:37,mod:44,negate:45,roundDown:48,roundUp:49,square:53,floatDivide:64,floorDivide:65,...v,...b,majority:38,max:39,mean:40,med:41,min:42,minority:43,range:47,stddev:54,sum:55,variety:58,majorityIgnoreNoData:66,maxIgnoreNoData:67,meanIgnoreNoData:68,medIgnoreNoData:69,minIgnoreNoData:70,minorityIgnoreNoData:71,rangeIgnoreNoData:72,stddevIgnoreNoData:73,sumIgnoreNoData:74,varietyIgnoreNoData:75,...C},P=new Map([[b.acos,{domain:[0,Math.PI],isInteger:!1}],[b.asin,{domain:[-Math.PI/2,Math.PI/2],isInteger:!1}],[b.atan,{domain:[-Math.PI/2,Math.PI/2],isInteger:!1}],[b.cos,{domain:[-1,1],isInteger:!1}],[b.sin,{domain:[-1,1],isInteger:!1}],[v.booleanAnd,{domain:[0,1],isInteger:!0}],[v.booleanNot,{domain:[0,1],isInteger:!0}],[v.booleanOr,{domain:[0,1],isInteger:!0}],[v.booleanXOr,{domain:[0,1],isInteger:!0}],[v.equalTo,{domain:[0,1],isInteger:!0}],[v.notEqual,{domain:[0,1],isInteger:!0}],[v.greaterThan,{domain:[0,1],isInteger:!0}],[v.greaterThanEqual,{domain:[0,1],isInteger:!0}],[v.lessThan,{domain:[0,1],isInteger:!0}],[v.lessThanEqual,{domain:[0,1],isInteger:!0}],[v.isNull,{domain:[0,1],isInteger:!0}]]);function T(e){return P.get(e)}const N=[0,2,2,2,1,2,1,1,1,1,1,2,2,1,2,2,2,2,1,2,2,1,1,2,2,1,1,1,2,2,1,1,1,2,2,1,1,1,999,999,999,999,999,999,2,1,2,999,1,1,2,1,1,1,999,999,1,1,999,1,1,2,999,999,2,2,999,999,999,999,999,999,999,999,999,999,3,999,3];function R(e,t,r){let[s,n]=e,i=s.length,o=g.A.createEmptyBand(r,i);for(let e=0;e<i;e++)(!t||t[e])&&(o[e]=s[e]+n[e]);return o}function I(e,t,r){let[s]=e,n=s.length,i=g.A.createEmptyBand("f32",n);return i.set(s),i}function k(e,t,r){let[s]=e,n=s.length,i=g.A.createEmptyBand(r,n);for(let e=0;e<n;e++)(!t||t[e])&&(i[e]=s[e]*s[e]);return i}function S(e,t,r){let[s,n]=e,i=s.length,o=g.A.createEmptyBand(r,i);for(let e=0;e<i;e++)(!t||t[e])&&(o[e]=s[e]-n[e]);return o}function _(e,t,r){let[s,n]=e,i=s.length,o=g.A.createEmptyBand(r,i);for(let e=0;e<i;e++)(!t||t[e])&&(o[e]=s[e]*n[e]);return o}function F(e,t,r){let[s]=e,n=s.length,i=g.A.createEmptyBand(r,n);for(let e=0;e<n;e++)(!t||t[e])&&(i[e]=Math.sign(s[e])*Math.floor(Math.abs(s[e])));return i}function B(e,t,r){let[s,n]=e,i=s.length,o=g.A.createEmptyBand(r,i);for(let e=0;e<i;e++)(!t||t[e])&&(o[e]=s[e]/n[e]);return o}function j(e,t,r){return B(e,t,"f32")}function Z(e,t,r){let[s,n]=e,i=s.length,o=g.A.createEmptyBand(r,i);for(let e=0;e<i;e++)(!t||t[e])&&(o[e]=Math.floor(s[e]/n[e]));return o}function G(e,t,r,s){let n=e[0],i=n.length,o=g.A.createEmptyBand(r,i);if(s===b.atanh){for(let e=0;e<i;e++)if(t[e]){let r=n[e];Math.abs(r)>=1?t[e]=0:o[e]=Math.atanh(r)}return o}let a=s===b.asin?Math.asin:Math.acos;for(let e=0;e<i;e++)if(t[e]){let r=n[e];Math.abs(r)>1?t[e]=0:o[e]=a(r)}return o}function z(e,t,r,s){let[n]=e,i=n.length,o=g.A.createEmptyBand(r,i);for(let e=0;e<i;e++)(!t||t[e])&&(o[e]=s(n[e]));return o}function O(e,t,r,s){let[n,i]=e,o=n.length,a=g.A.createEmptyBand(r,o);for(let e=0;e<o;e++)(!t||t[e])&&(a[e]=s(n[e],i[e]));return a}function E(e,t,r){let[s,n]=e,i=s.length,o=g.A.createEmptyBand(r,i);for(let e=0;e<i;e++)(!t||t[e])&&(o[e]=s[e]&n[e]);return o}function D(e,t,r){let[s,n]=e,i=s.length,o=g.A.createEmptyBand(r,i);for(let e=0;e<i;e++)(!t||t[e])&&(o[e]=s[e]<<n[e]);return o}function V(e,t,r){let[s]=e,n=s.length,i=g.A.createEmptyBand(r,n);for(let e=0;e<n;e++)(!t||t[e])&&(i[e]=~s[e]);return i}function U(e,t,r){let[s,n]=e,i=s.length,o=g.A.createEmptyBand(r,i);for(let e=0;e<i;e++)(!t||t[e])&&(o[e]=s[e]|n[e]);return o}function L(e,t,r){let[s,n]=e,i=s.length,o=g.A.createEmptyBand(r,i);for(let e=0;e<i;e++)(!t||t[e])&&(o[e]=s[e]>>n[e]);return o}function W(e,t,r){let[s,n]=e,i=s.length,o=g.A.createEmptyBand(r,i);for(let e=0;e<i;e++)(!t||t[e])&&(o[e]=s[e]^n[e]);return o}function K(e,t,r){let[s,n]=e,i=s.length,o=g.A.createEmptyBand(r,i);for(let e=0;e<i;e++)(!t||t[e])&&(o[e]=s[e]&&n[e]?1:0);return o}function $(e,t,r){let[s]=e,n=s.length,i=g.A.createEmptyBand(r,n);for(let e=0;e<n;e++)(!t||t[e])&&(i[e]=+!s[e]);return i}function H(e,t,r){let[s,n]=e,i=s.length,o=g.A.createEmptyBand(r,i);for(let e=0;e<i;e++)(!t||t[e])&&(o[e]=s[e]||n[e]?1:0);return o}function q(e,t,r){let[s,n]=e,i=s.length,o=g.A.createEmptyBand(r,i);for(let e=0;e<i;e++)(!t||t[e])&&(o[e]=+!!s[e]^!!n[e]);return o}function J(e,t,r){let[s,n]=e,i=s.length,o=g.A.createEmptyBand(r,i);for(let e=0;e<i;e++)(!t||t[e])&&(o[e]=+(s[e]===n[e]));return o}function X(e,t,r,s){let[n]=e,i=n.length,o=g.A.createEmptyBand(r,i),a=s===Math.E;for(let e=0;e<i;e++)(!t||t[e])&&(o[e]=a?Math.exp(n[e]):s**n[e]);return o}function Y(e,t,r){return X(e,t,r,10)}function Q(e,t,r){return X(e,t,r,2)}function ee(e,t,r){return X(e,t,r,Math.E)}function te(e,t,r,s){let[n]=e,i=n.length,o=g.A.createEmptyBand(r,i);for(let e=0;e<i;e++)(!t||t[e])&&(n[e]<=0?t[e]=0:o[e]=s(n[e]));return o}function re(e,t,r){return te(e,t,r,Math.log10)}function se(e,t,r){return te(e,t,r,Math.log2)}function ne(e,t,r){return te(e,t,r,Math.log)}function ie(e,t,r){let[s,n]=e,i=s.length,o=g.A.createEmptyBand(r,i);for(let e=0;e<i;e++)(!t||t[e])&&(o[e]=+(s[e]>n[e]));return o}function oe(e,t,r){let[s,n]=e,i=s.length,o=g.A.createEmptyBand(r,i);for(let e=0;e<i;e++)(!t||t[e])&&(o[e]=+(s[e]>=n[e]));return o}function ae(e,t,r){let[s,n]=e,i=s.length,o=g.A.createEmptyBand(r,i);for(let e=0;e<i;e++)(!t||t[e])&&(o[e]=+(s[e]<n[e]));return o}function le(e,t,r){let[s,n]=e,i=s.length,o=g.A.createEmptyBand(r,i);for(let e=0;e<i;e++)(!t||t[e])&&(o[e]=+(s[e]<=n[e]));return o}function ue(e,t,r){let[s]=e,n=s.length,i=g.A.createEmptyBand(r,n);if(!t)return i;for(let e=0;e<n;e++)i[e]=+!t[e];return i}function pe(e,t,r){let[s,n]=e,i=s.length,o=g.A.createEmptyBand(r,i);for(let e=0;e<i;e++)(!t||t[e])&&(o[e]=s[e]%n[e]);return o}function ce(e,t,r){let[s]=e,n=s.length,i=g.A.createEmptyBand(r,n);for(let e=0;e<n;e++)(!t||t[e])&&(i[e]=-s[e]);return i}function he(e,t,r){let[s,n]=e,i=s.length,o=g.A.createEmptyBand(r,i);for(let e=0;e<i;e++)(!t||t[e])&&(o[e]=s[e]===n[e]?0:1);return o}function me(e,t,r){let[s,n]=e,i=s.length,o=g.A.createEmptyBand(r,i),a=new Uint8Array(i);for(let e=0;e<i;e++)(null==t||t[e])&&0===s[e]&&(o[e]=n[e],a[e]=255);return{band:o,mask:a}}function fe(e,t,r){let[s,n,i]=e,o=s.length,a=g.A.createEmptyBand(r,o);for(let e=0;e<o;e++)(!t||t[e])&&(a[e]=s[e]?n[e]:i[e]);return a}function ge(e,t,r){let s=e.length;if(s<2)return e[0];let[n]=e,i=n.length,o=g.A.createEmptyBand(r,i);for(let r=0;r<i;r++)if(!t||t[r]){let t=n[r];for(let n=1;n<s;n++){let s=e[n][r];t<s&&(t=s)}o[r]=t}return o}function de(e,t,r){let s=e.length;if(s<2)return e[0];let[n]=e,i=n.length,o=g.A.createEmptyBand(r,i);for(let r=0;r<i;r++)if(!t||t[r]){let t=n[r];for(let n=1;n<s;n++){let s=e[n][r];t>s&&(t=s)}o[r]=t}return o}function ye(e,t,r){let s=e.length;if(s<2)return e[0];let[n]=e,i=n.length,o=g.A.createEmptyBand(r,i);for(let r=0;r<i;r++)if(!t||t[r]){let t=n[r],i=t;for(let n=1;n<s;n++){let s=e[n][r];i<s?i=s:t>s&&(t=s)}o[r]=i-t}return o}function xe(e,t,r){let s=e.length;if(s<2)return e[0];let[n]=e,i=n.length,o=g.A.createEmptyBand(r,i);for(let r=0;r<i;r++)if(!t||t[r]){let t=0;for(let n=0;n<s;n++)t+=e[n][r];o[r]=t/s}return o}function we(e,t,r){let s=e.length;if(s<2)return e[0];let[n]=e,i=n.length,o=g.A.createEmptyBand(r,i);for(let r=0;r<i;r++)if(!t||t[r])for(let t=0;t<s;t++){let s=e[t];o[r]+=s[r]}return o}function Ae(e,t,r){let s=e.length;if(s<2)return e[0];let[n]=e,i=n.length,o=g.A.createEmptyBand(r,i);for(let r=0;r<i;r++)if(!t||t[r]){let t=new Float32Array(s),n=0;for(let i=0;i<s;i++){let s=e[i];n+=s[r],t[i]=s[r]}n/=s;let i=0;for(let e=0;e<s;e++)i+=(t[e]-n)**2;o[r]=Math.sqrt(i/s)}return o}function ve(e,t,r){let s=e.length;if(s<2)return e[0];let n=Math.floor(s/2),[i]=e,o=i.length,a=g.A.createEmptyBand(r,o),l=new Float32Array(s),u=s%2==1;for(let r=0;r<o;r++)if(!t||t[r]){for(let t=0;t<s;t++)l[t]=e[t][r];l.sort(),a[r]=u?l[n]:(l[n]+l[n-1])/2}return a}function be(e,t,r){let[s,n]=e;if(null==n)return s;let i=s.length,o=g.A.createEmptyBand(r,i);for(let e=0;e<i;e++)(!t||t[e])&&(o[e]=s[e]<n[e]?s[e]:n[e]);return o}function Ce(e,t,r){let s=e.length;if(s<=2)return be(e,t,r);let n=e[0].length,i=g.A.createEmptyBand(r,n),o=new Map;for(let r=0;r<n;r++)if(!t||t[r]){o.clear();for(let t=0;t<s;t++){let s=e[t][r];o.set(s,o.has(s)?o.get(s)+1:1)}let t=0,n=0,a=[];for(let e of o.keys())t=o.get(e),t>n?(n=t,a.length=0,a.push(e)):t===n&&a.push(e);a.length>1&&a.sort((e,t)=>e-t),i[r]=a[0]}return i}function Me(e,t,r){let s=e.length;if(s<=2)return be(e,t,r);let n=e[0].length,i=g.A.createEmptyBand(r,n),o=new Map;for(let r=0;r<n;r++)if(!t||t[r]){o.clear();for(let t=0;t<s;t++){let s=e[t][r];o.set(s,o.has(s)?o.get(s)+1:1)}let t=0,n=e.length,a=[];for(let e of o.keys())t=o.get(e),t<n?(n=t,a.length=0,a.push(e)):t===n&&a.push(e);a.length>1&&a.sort((e,t)=>e-t),i[r]=a[0]}return i}function Pe(e,t,r){let s=e.length;if(s<2)return e[0];let[n]=e,i=n.length,o=g.A.createEmptyBand(r,i),a=new Set;for(let r=0;r<i;r++)if(!t||t[r]){let t;a.clear();for(let n=0;n<s;n++)t=e[n][r],a.add(t);o[r]=a.size}return o}const Te=new Map,Ne=new Map,Re=new Map,Ie=new Map;function ke(){Te.size||(Te.set(4,Math.sqrt),Te.set(6,Math.acos),Te.set(7,Math.asin),Te.set(8,Math.atan),Te.set(9,Math.atanh),Te.set(10,Math.abs),Te.set(21,Math.cos),Te.set(22,Math.cosh),Te.set(48,Math.floor),Te.set(49,Math.ceil),Te.set(51,Math.sin),Te.set(52,Math.sinh),Te.set(56,Math.tan),Te.set(57,Math.tanh),Te.set(59,Math.acosh),Te.set(60,Math.asinh),Te.set(65,Math.floor),Ne.set(5,Math.pow),Ne.set(61,Math.atan2),Re.set(1,R),Re.set(2,S),Re.set(3,_),Re.set(11,E),Re.set(12,D),Re.set(13,V),Re.set(14,U),Re.set(15,L),Re.set(16,W),Re.set(17,K),Re.set(18,$),Re.set(19,H),Re.set(20,q),Re.set(23,B),Re.set(24,J),Re.set(25,ee),Re.set(26,Y),Re.set(27,Q),Re.set(28,ie),Re.set(29,oe),Re.set(30,F),Re.set(31,ue),Re.set(32,I),Re.set(33,ae),Re.set(34,le),Re.set(35,ne),Re.set(36,re),Re.set(37,se),Re.set(44,pe),Re.set(45,ce),Re.set(46,he),Re.set(53,k),Re.set(64,j),Re.set(65,Z),Re.set(76,fe),Re.set(78,fe),Ie.set(38,Ce),Ie.set(39,ge),Ie.set(40,xe),Ie.set(41,ve),Ie.set(42,de),Ie.set(43,Me),Ie.set(47,ye),Ie.set(54,Ae),Ie.set(55,we),Ie.set(58,Pe),Ie.set(66,Ce),Ie.set(67,ge),Ie.set(68,xe),Ie.set(69,ve),Ie.set(70,de),Ie.set(71,Me),Ie.set(72,ye),Ie.set(73,Ae),Ie.set(74,we),Ie.set(75,Pe))}function Se(e,t,r={}){ke();let s=function(e,t=!1){let r=e.map(e=>e.mask),s=r.filter(e=>null!=e),n=e[0].pixels[0].length;if(0===s.length||t&&s.length!==r.length)return new Uint8Array(n).fill(255);let i=s[0],o=new Uint8Array(i);if(1===s.length)return o;if(!t){for(let e=1;e<s.length;e++){let t=s[e];for(let e=0;e<o.length;e++)o[e]&&(o[e]=t[e]?255:0)}return o}for(let e=1;e<s.length;e++){let t=s[e];for(let e=0;e<o.length;e++)0===o[e]&&(o[e]=t[e]?255:0)}return o}(e,t>=66&&t<=75),{outputPixelType:n="f32"}=r,i=!Ie.has(t)||r.processAsMultiband,o=i?e[0].pixels.length:1,a=[];for(let r=0;r<o;r++){let o,u=Ie.has(t)&&!i?e.flatMap(e=>e.pixels):e.map(e=>e.pixels[r]),p=!0;if(t===C.setNull){let e=me(u,s,n);o=e.band,s=e.mask,p=!1}else Re.has(t)?o=Re.get(t)(u,s,"f64"):Te.has(t)?o=t===b.asin||t===b.acos||t===b.atanh?G(u,s,"f64",t):z(u,s,"f64",Te.get(t)):Ne.has(t)?o=O(u,s,"f64",Ne.get(t)):Ie.has(t)?o=Ie.get(t)(u,s,"f64"):(o=u[0],p=!1);if(p&&t!==v.isNull&&!P.has(t)){let e=g.A.createEmptyBand(n,o.length);s||=new Uint8Array(o.length).fill(255),(0,l.$p)(o,s),(0,l.yM)(o,s,n,e),o=e}a.push(o)}let u=e[0];return new g.A({width:u.width,height:u.height,pixelType:n,mask:t===v.isNull?null:s,pixels:a})}let _e=class extends w{constructor(){super(...arguments),this.functionName="Arithmetic",this.functionArguments=null,this.rasterArgumentNames=["raster","raster2"]}_bindSourceRasters(){let{operation:e}=this.functionArguments;if(e<1||e>6)return{success:!1,supportsGPU:!1,error:"unsupported operation"};let t=this.sourceRasterInfos[0].clone();return this.outputPixelType=this._getOutputPixelType(t.pixelType),t.pixelType=this.outputPixelType,this._removeStatsHistColormapVAT(t),this.rasterInfo=t,{success:!0,supportsGPU:t.bandCount<=3}}_processPixels(e){let{pixelBlocks:t}=e;return null==t?.[0]||null==t?.[1]?null:function(e,t,r){return Se(e,t=[null,1,2,3,23,5,44][t]??1,{outputPixelType:r})}(t,this.functionArguments.operation,this.outputPixelType)}_getWebGLParameters(){let{operation:e}=this.functionArguments,t=["","plus","minus","times","divide","power","mod"][e],r=this.outputPixelType??"f32",[s,n]=(0,l.hP)(r),i=(0,l.zw)(r);return i&&(s-=1e-4,n+=1e-4),{imageCount:2,operationName:t,domainRange:[s,n],isOutputRounded:i}}};(0,o.Cg)([(0,a.MZ)({json:{write:!0,name:"rasterFunction"}})],_e.prototype,"functionName",void 0),(0,o.Cg)([(0,a.MZ)({type:f,json:{write:!0,name:"rasterFunctionArguments"}})],_e.prototype,"functionArguments",void 0),(0,o.Cg)([(0,a.MZ)()],_e.prototype,"rasterArgumentNames",void 0),_e=(0,o.Cg)([(0,a.$K)("esri.layers.raster.functions.ArithmeticFunction")],_e);const Fe=_e;var Be;let je=Be=class extends c{clone(){return new Be({raster:this.raster})}};je=Be=(0,o.Cg)([(0,a.$K)("esri.layers.raster.functions.AspectFunctionArguments")],je);const Ze=je;var Ge=r(51181);let ze=class extends w{constructor(){super(...arguments),this.functionName="Aspect",this.functionArguments=null,this.rasterArgumentNames=["raster"],this.isGCS=!1}_bindSourceRasters(){let e=this.sourceRasterInfos[0];this.isGCS=e.spatialReference?.isGeographic??!1,this.outputPixelType=this._getOutputPixelType("f32");let t=e.clone();return t.pixelType=this.outputPixelType,this._removeStatsHistColormapVAT(t),t.statistics=[{min:-1,max:360,avg:180,stddev:30}],t.bandCount=1,this.rasterInfo=t,{success:!0,supportsGPU:!0}}_processPixels(e){let t=e.pixelBlocks?.[0];if(null==t)return null;let{extent:r,primaryPixelSizes:s}=e,n=s?.[0]??(r?{x:r.width/t.width,y:r.height/t.height}:{x:1,y:1});return(0,Ge.di)(t,{resolution:n})}_getNeighborhoodSize(){return{rows:3,cols:3}}};(0,o.Cg)([(0,a.MZ)({json:{write:!0,name:"rasterFunction"}})],ze.prototype,"functionName",void 0),(0,o.Cg)([(0,a.MZ)({type:Ze,json:{write:!0,name:"rasterFunctionArguments"}})],ze.prototype,"functionArguments",void 0),(0,o.Cg)([(0,a.MZ)()],ze.prototype,"rasterArgumentNames",void 0),(0,o.Cg)([(0,a.MZ)({json:{write:!0}})],ze.prototype,"isGCS",void 0),ze=(0,o.Cg)([(0,a.$K)("esri.layers.raster.functions.AspectFunction")],ze);const Oe=ze;var Ee=r(66552);const De=new Set(["+","-","*","/","(",")"]);function Ve(e,t){return e.toLowerCase().startsWith("b")?t[parseInt(e.slice(1),10)-1]:parseFloat(e)}function Ue(e,t,r,s){if("number"==typeof r&&"number"==typeof s)return r+s;let n,i,o;"number"==typeof r?(o=s,n=o.length,i=new Float32Array(n),i.fill(r)):(n=r.length,i=r,s.constructor===Number?(o=new Float32Array(n),o.fill(s)):o=s);let a=new Float32Array(n);switch(t){case"+":for(let t=0;t<n;t++)(null==e||e[t])&&(a[t]=i[t]+o[t]);break;case"-":for(let t=0;t<n;t++)(null==e||e[t])&&(a[t]=i[t]-o[t]);break;case"*":for(let t=0;t<n;t++)(null==e||e[t])&&(a[t]=i[t]*o[t]);break;case"/":for(let t=0;t<n;t++)(null==e||e[t])&&o[t]&&(a[t]=i[t]/o[t]);break;case"(":case")":throw Error("encountered error with custom band index equation")}return a}function Le(e,t){e.splice(t,1);let r=0,s=0;do{r=0,s=0;for(let t=0;t<e.length;t++)if("("===e[t])r=t;else if(")"===e[t]){s=t;break}s===r+1&&e.splice(r,2)}while(s===r+1);return e}function We(e){if(1===e.length)return{opIndex:0,numIndex:0};let t=0,r=0;for(let s=0;s<e.length;s++)if("("===e[s])t=s;else if(")"===e[s]){r=s;break}let s=0===r?e:e.slice(t+1,r),n=-1;for(let e=0;e<s.length;e++)if("*"===s[e]||"/"===s[e]){n=e;break}if(n>-1)r>0&&(n+=t+1);else{for(let e=0;e<s.length;e++)if("+"===s[e]||"-"===s[e]){n=e;break}r>0&&(n+=t+1)}let i=0;for(let t=0;t<n;t++)"("===e[t]&&i++;return{opIndex:n,numIndex:n-i}}var Ke=r(47520);const $e=new Ee.J({0:"custom",1:"ndvi",2:"savi",3:"tsavi",4:"msavi",5:"gemi",6:"pvi",7:"gvitm",8:"sultan",9:"vari",10:"gndvi",11:"sr",12:"ndvi-re",13:"sr-re",14:"mtvi2",15:"rtvi-core",16:"ci-re",17:"ci-g",18:"ndwi",19:"evi",20:"iron-oxide",21:"ferrous-minerals",22:"clay-minerals",23:"wndwi",24:"bai",25:"nbr",26:"ndbi",27:"ndmi",28:"ndsi",29:"mndwi"},{useNumericKeys:!0});function He(e,t){if(!(0,Ke.AB)(e))return e;let r,{equation:s,method:n}=t,i=t.bandIndexes.map(e=>e-1),{pixels:o,mask:a}=e;switch(n){case"gndvi":case"nbr":case"ndbi":case"ndvi":case"ndvi-re":case"ndsi":case"ndmi":case"mndwi":r=Je(a,o[i[0]],o[i[1]]);break;case"ndwi":r=Je(a,o[i[1]],o[i[0]]);break;case"sr":case"sr-re":case"iron-oxide":case"ferrous-minerals":case"clay-minerals":r=function(e,t,r){let s=r.length,n=new Float32Array(s);for(let i=0;i<s;i++)if(null==e||e[i]){let e=t[i],s=r[i];s&&(n[i]=e/s)}return[n]}(a,o[i[0]],o[i[1]]);break;case"ci-g":case"ci-re":r=function(e,t,r){let s=t.length,n=new Float32Array(s);for(let i=0;i<s;i++)if(null==e||e[i]){let e=t[i],s=r[i];s&&(n[i]=e/s-1)}return[n]}(a,o[i[0]],o[i[1]]);break;case"savi":r=function(e,t,r,s){let n=r.length,i=new Float32Array(n);for(let o=0;o<n;o++)if(null==e||e[o]){let e=r[o],n=t[o],a=n+e+s;a&&(i[o]=(n-e)/a*(1+s))}return[i]}(a,o[i[0]],o[i[1]],i[2]+1);break;case"tsavi":r=function(e,t,r,s,n,i){let o=r.length,a=new Float32Array(o),l=-n*s+i*(1+s*s);for(let i=0;i<o;i++)if(null==e||e[i]){let e=r[i],o=t[i],u=n*o+e+l;u&&(a[i]=s*(o-s*e-n)/u)}return[a]}(a,o[i[0]],o[i[1]],i[2]+1,i[3]+1,i[4]+1);break;case"msavi":r=function(e,t,r){let s=r.length,n=new Float32Array(s);for(let i=0;i<s;i++)if(null==e||e[i]){let e=r[i],s=t[i],o=2*s+1;n[i]=.5*(o-Math.sqrt(o*o-8*(s-e)))}return[n]}(a,o[i[0]],o[i[1]]);break;case"gemi":r=function(e,t,r){let s=r.length,n=new Float32Array(s);for(let i=0;i<s;i++)if(null==e||e[i]){let e=r[i],s=t[i];if(1!==e&&s+e+.5!==0){let t=(2*(s*s-e*e)+1.5*s+.5*e)/(s+e+.5);n[i]=t*(1-.25*t)-(e-.125)/(1-e)}}return[n]}(a,o[i[0]],o[i[1]]);break;case"pvi":r=function(e,t,r,s,n){let i=r.length,o=new Float32Array(i),a=1/Math.sqrt(1+s*s);for(let l=0;l<i;l++)if(null==e||e[l]){let e=r[l],i=t[l];o[l]=(i-s*e-n)*a}return[o]}(a,o[i[0]],o[i[1]],i[2]+1,i[3]+1);break;case"gvitm":r=function(e,t){let[r,s,n,i,o,a]=t,l=r.length,u=new Float32Array(l);for(let t=0;t<l;t++)(null==e||e[t])&&(u[t]=-.2848*r[t]-.2435*s[t]-.5436*n[t]+.7243*i[t]+.084*o[t]-.18*a[t]);return[u]}(a,[o[i[0]],o[i[1]],o[i[2]],o[i[3]],o[i[4]],o[i[5]]]);break;case"sultan":r=function(e,t){let[r,s,n,i,o]=t,a=r.length,l=new Float32Array(a),u=new Float32Array(a),p=new Float32Array(a);for(let t=0;t<a;t++)(null==e||e[t])&&(l[t]=o[t]?i[t]/o[t]*100:0,u[t]=r[t]?i[t]/r[t]*100:0,p[t]=n[t]?s[t]/n[t]*(i[t]/n[t])*100:0);return[l,u,p]}(a,[o[i[0]],o[i[1]],o[i[2]],o[i[3]],o[i[4]]]);break;case"vari":r=function(e,t){let[r,s,n]=t,i=r.length,o=new Float32Array(i);for(let t=0;t<i;t++)if(null==e||e[t])for(t=0;t<i;t++){let e=r[t],i=s[t],a=i+e-n[t];a&&(o[t]=(i-e)/a)}return[o]}(a,[o[i[0]],o[i[1]],o[i[2]]]);break;case"mtvi2":r=function(e,t){let[r,s,n]=t,i=r.length,o=new Float32Array(i);for(let t=0;t<i;t++)if(null==e||e[t])for(t=0;t<i;t++){let e=r[t],i=s[t],a=n[t],l=Math.sqrt((2*e+1)**2-(6*e-5*Math.sqrt(i))-.5);if(l){let r=1.5*(1.2*(e-a)-2.5*(i-a));o[t]=r/l}}return[o]}(a,[o[i[0]],o[i[1]],o[i[2]]]);break;case"rtvi-core":r=function(e,t){let[r,s,n]=t,i=r.length,o=new Float32Array(i);for(let t=0;t<i;t++)if(null==e||e[t])for(t=0;t<i;t++){let e=r[t],i=s[t],a=n[t];o[t]=100*(e-i)-10*(e-a)}return[o]}(a,[o[i[0]],o[i[1]],o[i[2]]]);break;case"evi":r=function(e,t){let[r,s,n]=t,i=r.length,o=new Float32Array(i);for(let t=0;t<i;t++)if(null==e||e[t])for(t=0;t<i;t++){let e=r[t],i=s[t],a=e+6*i-7.5*n[t]+1;a&&(o[t]=2.5*(e-i)/a)}return[o]}(a,[o[i[0]],o[i[1]],o[i[2]]]);break;case"wndwi":r=function(e,t,r=.5){let[s,n,i]=t,o=n.length,a=new Float32Array(o);for(let t=0;t<o;t++)if(null==e||e[t])for(t=0;t<o;t++){let e=s[t],o=n[t],l=i[t],u=e+r*o+(1-r)*l;u&&(a[t]=(e-r*o-(1-r)*l)/u)}return[a]}(a,[o[i[0]],o[i[1]],o[i[2]]],i[3]?i[3]+1:.5);break;case"bai":r=function(e,t,r){let s=r.length,n=new Float32Array(s);for(let i=0;i<s;i++)if(null==e||e[i])for(i=0;i<s;i++){let e=(.1-t[i])**2+(.06-r[i])**2;e&&(n[i]=1/e)}return[n]}(a,o[i[0]],o[i[1]]);break;case"custom":r=function(e,t,r){let s,{ops:n,nums:i}=function(e,t){(e=e.replaceAll(" ","")).startsWith("-")&&(e="0"+e),e.startsWith("+")&&(e=e.slice(1));let r=e.split(""),s=[],n=[],i="";for(let e=0;e<r.length;e++){let o=r[e];De.has(o)?(i.length&&n.push(Ve(i,t)),s.push(o),i=""):i=i.concat(o)}return i.length&&n.push(Ve(i,t)),{ops:s,nums:n}}(r,t);if(0===n.length){let e=1===i.length?i[0]:t[0];if(e instanceof Float32Array)return[e];let r=new Float32Array(t[0].length);return"number"==typeof e?r.fill(e):r.set(e),[r]}for(;n.length>0;){let{numIndex:t,opIndex:r}=We(n);if(s=Ue(e,n[r],i[t],i[t+1]),1===n.length)break;n=Le(n,r),i.splice(t,2,s)}return[s]}(a,o,s);break;default:return e}let u,{outputPixelType:p="f32"}=t,c=null!=p&&(0,l.zw)(p);a?(u=new Uint8Array(e.width*e.height),u.set(a)):c&&(u=new Uint8Array(e.width*e.height).fill(255)),c&&(r=r.map(e=>{let t=g.A.createEmptyBand(p,e.length);return(0,l.yM)(e,u,p,t),t}));let h=new g.A({width:e.width,height:e.height,pixelType:p,pixels:r,mask:u});return h.updateStatistics(),h}function qe(e){let t=new Float32Array(9);return t[3*e[0]]=1,t[3*e[1]+1]=1,t[3*e[2]+2]=1,t}function Je(e,t,r){let s=r.length,n=new Float32Array(s);for(let i=0;i<s;i++)if(null==e||e[i]){let e=t[i],s=r[i],o=e+s;o&&(n[i]=(e-s)/o)}return[n]}var Xe,Ye=r(93223);let Qe=Xe=class extends c{constructor(){super(...arguments),this.method="custom"}clone(){return new Xe({method:this.method,bandIndexes:this.bandIndexes,raster:(0,i.o8)(this.raster)})}};(0,o.Cg)([(0,a.MZ)({json:{type:String,write:!0}})],Qe.prototype,"bandIndexes",void 0),(0,o.Cg)([(0,Ye.e)($e)],Qe.prototype,"method",void 0),Qe=Xe=(0,o.Cg)([(0,a.$K)("esri.layers.raster.functions.BandArithmeticFunctionArguments")],Qe);const et=Qe,tt=new Set(["vari","mtvi2","rtvi-core","evi"]);let rt=class extends w{constructor(){super(...arguments),this.functionName="BandArithmetic",this.functionArguments=null,this.rasterArgumentNames=["raster"]}_bindSourceRasters(){this.outputPixelType=this._getOutputPixelType("f32");let e=this.sourceRasterInfos[0];if(e.bandCount<2)return{success:!1,supportsGPU:!1,error:"band-arithmetic-function: source raster has insufficient amount of raster bands"};let t=e.clone();return t.pixelType=this.outputPixelType,t.bandCount="sultan"===this.functionArguments.method?3:1,this._removeStatsHistColormapVAT(t),t.keyProperties={...t.keyProperties,BandProperties:void 0},this.rasterInfo=t,{success:!0,supportsGPU:!["custom","gvitm","sultan"].includes(this.functionArguments.method)}}_processPixels(e){let t=e.pixelBlocks?.[0];if(null==t)return t;let{method:r,bandIndexes:s}=this.functionArguments,n=s.split(" ").map(e=>parseFloat(e));if(this.rasterInfo.storageInfo.isBsqTile){let{rawInputBandIds:e}=this,t=tt.has(this.functionArguments.method)?3:2,r=n.slice(0,t).map(t=>e.indexOf(t-1));n.splice(0,t,...r)}return He(t,{method:r,bandIndexes:n,equation:s,outputPixelType:this.outputPixelType})}_getWebGLParameters(){let e=this.functionArguments.bandIndexes.split(" ").map(e=>parseFloat(e)-1);2===e.length&&e.push(0);let t,r,s=this.isInputBandIdsSwizzled?[0,1,2]:e,n=new Float32Array(3),{method:i}=this.functionArguments;switch(i){case"gndvi":case"nbr":case"ndbi":case"ndvi":case"ndvi-re":case"ndsi":case"ndmi":case"mndwi":t=qe([s[0],s[1],0]),r="ndxi";break;case"ndwi":t=qe([s[1],s[0],0]),r="ndxi";break;case"sr":case"sr-re":case"iron-oxide":case"ferrous-minerals":case"clay-minerals":t=qe([s[0],s[1],0]),r="sr";break;case"ci-g":case"ci-re":t=qe([s[0],s[1],0]),r="ci";break;case"savi":t=qe([s[0],s[1],0]),r="savi",n[0]=e[2]+1;break;case"tsavi":t=qe([s[0],s[1],0]),r="tsavi",n[0]=e[2]+1,n[1]=e[3]+1,n[2]=e[4]+1;break;case"msavi":t=qe([s[0],s[1],0]),r="msavi";break;case"gemi":t=qe([s[0],s[1],0]),r="gemi";break;case"pvi":t=qe([s[0],s[1],0]),r="tsavi",n[0]=e[2]+1,n[1]=e[3]+1;break;case"vari":t=qe([s[0],s[1],s[2]]),r="vari";break;case"mtvi2":t=qe([s[0],s[1],s[2]]),r="mtvi";break;case"rtvi-core":t=qe([s[0],s[1],s[2]]),r="rtvicore";break;case"evi":t=qe([s[0],s[1],s[2]]),r="evi";break;case"wndwi":t=qe([s[0],s[1],0]),r="wndwi",n[0]=e[3]?e[3]+1:.5;break;case"bai":t=qe([s[1],s[0],0]),r="bai";break;default:t=qe([0,1,2]),r="custom"}return{bandIndexMat3:t,indexType:r,adjustments:n,isOutputRounded:(0,l.zw)(this.outputPixelType)}}_getInputBandIds(e){if("custom"===this.functionArguments.method)return e;let t=this.functionArguments.bandIndexes.split(" ").map(e=>parseFloat(e)-1),r=e.length,s=t.map(e=>e>=r?r-1:e),n=tt.has(this.functionArguments.method)?3:2,i=s.slice(0,n).map(t=>e[t]);return 2===i.length&&i.push(0),i}_swizzleBandIds(e){let t=this.functionArguments.bandIndexes.split(" ").map(e=>parseFloat(e)-1);2===t.length&&t.push(0);let{method:r}=this.functionArguments,s=(["vari","mtvi2","rtvi-core","evi"].includes(r)?t.slice(0,3):"bai"===r||"ndwi"===r?[t[1],t[0]]:t.slice(0,2)).map(t=>e.indexOf(t));return s[2]??=s[1],this.isInputBandIdsSwizzled=!0,this.swizzledBandSelection=s,!1}};(0,o.Cg)([(0,a.MZ)({json:{write:!0,name:"rasterFunction"}})],rt.prototype,"functionName",void 0),(0,o.Cg)([(0,a.MZ)({type:et,json:{write:!0,name:"rasterFunctionArguments"}})],rt.prototype,"functionArguments",void 0),(0,o.Cg)([(0,a.MZ)()],rt.prototype,"rasterArgumentNames",void 0),rt=(0,o.Cg)([(0,a.$K)("esri.layers.raster.functions.BandArithmeticFunction")],rt);const st=rt;var nt,it=r(65864),ot=r(50498);const at=new Ee.J({1:"outside",2:"inside"},{useNumericKeys:!0});let lt=nt=class extends c{constructor(){super(...arguments),this.clippingType="outside"}clone(){return new nt({clippingGeometry:this.clippingGeometry.clone(),clippingType:this.clippingType})}};(0,o.Cg)([(0,a.MZ)({types:ot.yR,json:{read:it.rS,write:!0}})],lt.prototype,"clippingGeometry",void 0),(0,o.Cg)([(0,a.MZ)({json:{read:at.read,write:at.write}})],lt.prototype,"clippingType",void 0),lt=nt=(0,o.Cg)([(0,a.$K)("esri.layers.raster.functions.ClipFunctionArguments")],lt);const ut=lt;var pt=r(34930),ct=r(37373);let ht=class extends w{constructor(){super(...arguments),this.functionName="Clip",this.functionArguments=null,this.rasterArgumentNames=["raster"],this.isNoopProcess=!0}_bindSourceRasters(){let e=this.sourceRasterInfos[0].clone();this.outputPixelType=this._getOutputPixelType(e.pixelType),e.pixelType=this.outputPixelType,this.rasterInfo=e;let{functionArguments:t}=this,{clippingGeometry:r,clippingType:s}=t;if(!r)return{success:!1,supportsGPU:!1,error:"missing clipping geometry"};if("outside"===s)try{let{spatialReference:t}=e,s="extent"===r.type?(0,ct._l)(r,t):(0,ct.uk)(r,t).extent;s&&(0,pt.Sd)(e,s)}catch{}return{success:!0,supportsGPU:!0}}_processPixels(e){return e.pixelBlocks?.[0]}_getWebGLParameters(){let{clippingGeometry:e,clippingType:t}=this.functionArguments;return{clippingGeometry:e.toJSON(),clippingType:t}}};(0,o.Cg)([(0,a.MZ)({json:{write:!0,name:"rasterFunction"}})],ht.prototype,"functionName",void 0),(0,o.Cg)([(0,a.MZ)({type:ut,json:{write:!0,name:"rasterFunctionArguments"}})],ht.prototype,"functionArguments",void 0),(0,o.Cg)([(0,a.MZ)()],ht.prototype,"rasterArgumentNames",void 0),(0,o.Cg)([(0,a.MZ)()],ht.prototype,"isNoopProcess",void 0),ht=(0,o.Cg)([(0,a.$K)("esri.layers.raster.functions.ClipFunction")],ht);const mt=ht;var ft,gt=r(67369),dt=r(95349),yt=r(36005);let xt=ft=class extends c{castColormapName(e){if(!e)return null;let t=e.toLowerCase();return gt.L7.includes(t)?t:null}readColorRamp(e){return(0,dt.r)(e)}readColorRampName(e,t){if(!e)return null;let r=gt.kH.jsonValues.find(t=>t.toLowerCase()===e.toLowerCase());return r?gt.kH.fromJSON(r):null}clone(){return new ft({colormap:(0,i.o8)(this.colormap),colormapName:this.colormapName,colorRamp:this.colorRamp?.clone(),colorRampName:this.colorRampName})}};(0,o.Cg)([(0,a.MZ)({type:[[Number]],json:{write:!0}})],xt.prototype,"colormap",void 0),(0,o.Cg)([(0,a.MZ)({type:String,json:{write:!0}})],xt.prototype,"colormapName",void 0),(0,o.Cg)([(0,a.wg)("colormapName")],xt.prototype,"castColormapName",null),(0,o.Cg)([(0,a.MZ)({types:dt.g,json:{write:!0}})],xt.prototype,"colorRamp",void 0),(0,o.Cg)([(0,yt.w)("colorRamp")],xt.prototype,"readColorRamp",null),(0,o.Cg)([(0,a.MZ)({type:gt.kH.apiValues,json:{type:gt.kH.jsonValues,write:gt.kH.write}})],xt.prototype,"colorRampName",void 0),(0,o.Cg)([(0,yt.w)("colorRampName")],xt.prototype,"readColorRampName",null),xt=ft=(0,o.Cg)([(0,a.$K)("esri.layers.raster.functions.ColormapFunctionArguments")],xt);const wt=xt,At=[[36,0,255],[36,0,255],[36,0,255],[36,0,255],[112,75,3],[113,76,3],[114,77,3],[115,77,3],[116,78,3],[117,79,3],[118,79,3],[119,80,3],[121,81,4],[122,82,4],[123,82,4],[124,83,4],[125,84,4],[126,84,4],[127,85,4],[128,86,4],[129,86,4],[130,87,4],[131,88,4],[132,89,4],[133,89,4],[134,90,4],[135,91,4],[136,91,4],[137,92,4],[138,93,4],[139,94,4],[140,94,4],[142,95,5],[143,96,5],[144,96,5],[145,97,5],[146,98,5],[147,99,5],[148,99,5],[149,100,5],[150,101,5],[151,101,5],[152,102,5],[153,103,5],[154,104,5],[155,104,5],[156,105,5],[157,106,5],[158,106,5],[159,107,5],[160,108,5],[161,108,5],[162,109,5],[164,110,6],[165,111,6],[166,111,6],[167,112,6],[168,113,6],[169,113,6],[170,114,6],[171,115,6],[172,116,6],[173,116,6],[174,117,6],[245,0,0],[245,5,0],[245,10,0],[246,15,0],[246,20,0],[246,25,0],[246,30,0],[247,35,0],[247,40,0],[247,45,0],[247,50,0],[247,55,0],[248,60,0],[248,65,0],[248,70,0],[248,75,0],[249,81,0],[249,86,0],[249,91,0],[249,96,0],[250,101,0],[250,106,0],[250,111,0],[250,116,0],[250,121,0],[251,126,0],[251,131,0],[251,136,0],[251,141,0],[252,146,0],[252,151,0],[252,156,0],[252,156,0],[251,159,0],[250,162,0],[249,165,0],[248,168,0],[247,171,0],[246,174,0],[245,177,0],[245,179,0],[244,182,0],[243,185,0],[242,188,0],[241,191,0],[240,194,0],[239,197,0],[238,200,0],[237,203,0],[236,206,0],[235,209,0],[234,212,0],[233,215,0],[232,218,0],[231,221,0],[230,224,0],[230,226,0],[229,229,0],[228,232,0],[227,235,0],[226,238,0],[225,241,0],[224,244,0],[223,247,0],[165,247,0],[163,244,0],[161,240,0],[158,237,0],[156,233,1],[154,230,1],[152,227,1],[149,223,1],[147,220,1],[145,216,1],[143,213,1],[140,210,2],[138,206,2],[136,203,2],[134,200,2],[132,196,2],[129,193,2],[127,189,2],[125,186,3],[123,183,3],[120,179,3],[118,176,3],[116,172,3],[114,169,3],[111,166,3],[109,162,4],[107,159,4],[105,155,4],[103,152,4],[100,149,4],[98,145,4],[96,142,4],[94,138,5],[91,135,5],[89,132,5],[87,128,5],[85,125,5],[82,121,5],[80,118,5],[78,115,6],[76,111,6],[73,108,6],[71,105,6],[69,101,6],[67,98,6],[65,94,6],[62,91,7],[60,88,7],[58,84,7],[56,81,7],[53,77,7],[51,74,7],[49,71,7],[47,67,8],[44,64,8],[42,60,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8]],vt=[[36,0,255],[36,0,255],[36,0,255],[36,0,255],[245,20,0],[245,24,0],[245,29,0],[245,31,0],[247,33,0],[247,33,0],[247,37,0],[247,41,0],[247,41,0],[247,41,0],[247,45,0],[247,45,0],[247,47,0],[247,49,0],[247,49,0],[247,54,0],[247,54,0],[247,56,0],[247,58,0],[247,58,0],[250,62,0],[250,62,0],[250,62,0],[250,67,0],[250,67,0],[250,67,0],[250,69,0],[250,71,0],[250,71,0],[250,75,0],[250,75,0],[250,78,0],[250,79,0],[250,79,0],[250,79,0],[250,81,0],[250,83,0],[250,83,0],[250,87,0],[250,87,0],[250,90,0],[250,92,0],[252,93,0],[252,93,0],[252,97,0],[252,97,0],[252,97,0],[252,97,0],[252,101,0],[252,101,0],[252,101,0],[252,101,0],[252,105,0],[252,105,0],[252,107,0],[252,109,0],[252,109,0],[252,113,13],[255,118,20],[255,119,23],[255,121,25],[255,126,33],[255,132,38],[255,133,40],[255,135,43],[255,141,48],[255,144,54],[255,150,59],[255,152,61],[255,153,64],[255,159,69],[255,163,77],[255,165,79],[255,168,82],[255,174,87],[255,176,92],[255,181,97],[255,183,99],[255,186,102],[255,191,107],[255,197,115],[255,201,120],[255,203,123],[255,205,125],[255,209,130],[255,214,138],[255,216,141],[255,218,143],[255,224,150],[255,228,156],[255,234,163],[255,236,165],[255,238,168],[255,243,173],[255,248,181],[255,252,186],[253,252,186],[250,252,187],[244,250,180],[238,247,176],[234,246,173],[231,245,169],[223,240,163],[217,237,157],[211,235,150],[205,233,146],[200,230,142],[195,227,136],[189,224,132],[184,222,126],[180,220,123],[174,217,119],[169,214,114],[163,212,108],[160,210,105],[154,207,101],[148,204,96],[143,201,93],[138,199,88],[134,197,84],[130,194,81],[126,191,77],[117,189,70],[115,186,68],[112,184,64],[106,181,60],[100,179,55],[94,176,49],[92,174,47],[90,173,45],[81,168,37],[75,166,33],[71,163,28],[66,160,24],[62,158,21],[56,156,14],[51,153,0],[51,153,0],[51,153,0],[50,150,0],[50,150,0],[50,150,0],[50,150,0],[49,148,0],[49,148,0],[49,148,0],[48,145,0],[48,145,0],[48,145,0],[48,145,0],[48,143,0],[48,143,0],[48,143,0],[48,143,0],[47,140,0],[47,140,0],[47,140,0],[47,140,0],[46,138,0],[46,138,0],[46,138,0],[46,138,0],[45,135,0],[45,135,0],[45,135,0],[45,135,0],[44,133,0],[44,133,0],[44,133,0],[43,130,0],[43,130,0],[43,130,0],[43,130,0],[43,130,0],[43,130,0],[42,128,0],[42,128,0],[42,128,0],[42,125,0],[42,125,0],[42,125,0],[42,125,0],[41,122,0],[41,122,0],[41,122,0],[41,122,0],[40,120,0],[40,120,0],[40,120,0],[40,120,0],[40,120,0],[39,117,0],[39,117,0],[39,117,0],[39,117,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0]];function bt(e,t){let r=[],s=[];for(let t=0;t<e.length-1;t++)r.push({type:"algorithmic",algorithm:"esriHSVAlgorithm",fromColor:e[t].slice(1),toColor:e[t+1].slice(1)}),s.push(e[t+1][0]-e[t][0]);let n=e[e.length-1][0];return t??=s,(0,gt.iv)({type:"multipart",colorRamps:r},{numColors:n,weights:t})}let Ct=class extends w{constructor(){super(...arguments),this.functionName="Colormap",this.functionArguments=null,this.rasterArgumentNames=["raster"],this.isNoopProcess=!0}_bindSourceRasters(){let e=this.sourceRasterInfos[0];if(e.bandCount>1)return{success:!1,supportsGPU:!1,error:"colormap-function: source data must be single band"};let{colormap:t,colormapName:r,colorRamp:s,colorRampName:n}=this.functionArguments;if(!t?.length)if(s)this.colorRamp=s,t=(0,gt.R8)(s,{interpolateAlpha:!0});else if(n){let e=(0,gt.M5)(n);e&&(t=(0,gt.R8)(e),this.colorRamp=(0,dt.r)(e))}else r&&(t=function(e){let t;switch(e){case"elevation":t=bt([[0,0,191,191],[51,0,0,255],[102,255,0,255],[153,255,0,127],[204,191,63,127],[256,20,20,20]]);break;case"gray":t=(0,gt.iv)({type:"algorithmic",algorithm:"esriHSVAlgorithm",fromColor:[0,0,0],toColor:[255,255,255]});break;case"hillshade":t=bt([[0,38,41,54],[69,79,82,90],[131,156,156,156],[256,253,253,241]],[.268,.238,.495]);break;case"ndvi":t=At;break;case"ndvi2":t=function(){let e=bt([[0,255,255,255],[70,0,255,0],[80,205,173,193],[100,150,150,150],[110,120,51,100],[130,120,100,200],[140,28,3,144],[160,6,0,55],[180,10,25,30],[201,6,7,27]]);for(let t=e.length;t<256;t++)e.push([6,27,7]);return e}();break;case"ndvi3":t=vt;break;case"random":t=function(){let e=[];for(let t=0;t<256;t++){let t=[];for(let e=0;e<3;e++)t.push(Math.round(255*Math.random()));e.push(t)}return e}()}return t?(t=t.map((e,t)=>[t,...e]),t):null}(r));if(!t?.length)return{success:!1,supportsGPU:!1,error:"colormap-function: missing colormap argument"};let i=this._getOutputPixelType(e.pixelType);this.outputPixelType=i.startsWith("f")?"s32":i;let o=e.clone();return o.pixelType=this.outputPixelType,o.colormap=t,o.bandCount=1,this.rasterInfo=o,{success:!0,supportsGPU:!0}}_processPixels(e){let t=e.pixelBlocks?.[0];return!t||(0,l.zw)(t.pixelType)||(t=t.clone(),t.clamp(this.outputPixelType)),t}};(0,o.Cg)([(0,a.MZ)({json:{write:!0,name:"rasterFunction"}})],Ct.prototype,"functionName",void 0),(0,o.Cg)([(0,a.MZ)({type:wt,json:{write:!0,name:"rasterFunctionArguments"}})],Ct.prototype,"functionArguments",void 0),(0,o.Cg)([(0,a.MZ)()],Ct.prototype,"rasterArgumentNames",void 0),(0,o.Cg)([(0,a.MZ)()],Ct.prototype,"isNoopProcess",void 0),(0,o.Cg)([(0,a.MZ)({json:{write:!0}})],Ct.prototype,"indexedColormap",void 0),(0,o.Cg)([(0,a.MZ)()],Ct.prototype,"colorRamp",void 0),Ct=(0,o.Cg)([(0,a.$K)("esri.layers.raster.functions.ColormapFunction")],Ct);const Mt=Ct;var Pt;let Tt=Pt=class extends c{clone(){return new Pt({raster:this.raster})}};Tt=Pt=(0,o.Cg)([(0,a.$K)("esri.layers.raster.functions.ColormapToRGBFunctionArguments")],Tt);const Nt=Tt;var Rt=r(4151),It=r(88178);let kt=class extends w{constructor(){super(...arguments),this.functionName="ColormapToRGB",this.functionArguments=null,this.rasterArgumentNames=["raster"]}_bindSourceRasters(){let e=this.sourceRasterInfos[0];if(e.bandCount>1||!e.colormap?.length)return{success:!1,supportsGPU:!1,error:"colormap-to-rgb-function: source data must be single band with a colormap"};let t=e.clone();t.pixelType=this.outputPixelType=this._getOutputPixelType("u8"),this._removeStatsHistColormapVAT(t),t.bandCount=3,t.statistics=[{min:0,max:255,avg:100,stddev:20},{min:0,max:255,avg:100,stddev:20},{min:0,max:255,avg:100,stddev:20}],this.rasterInfo=t;let r=[...e.colormap].sort((e,t)=>e[0]-t[0]),{indexedColormap:s,offset:n}=(0,Ke.zg)({colormap:r});return s?(this.lookup={indexedColormap:s,offset:n},{success:!0,supportsGPU:(0,It.WN)(s)}):{success:!1,supportsGPU:!1,error:"colormap-to-rgb-function: the colormap is not supported"}}_processPixels(e){let t=e.pixelBlocks?.[0];if(!t||!this.lookup)return t;t=t.clone();let r=t.pixels[0],s=t.mask??new Uint8Array(r.length).fill(255),n=new Uint8Array(r.length),i=new Uint8Array(r.length),o=new Uint8Array(r.length),{indexedColormap:a,offset:l}=this.lookup,u=a.length;for(let e=0;e<r.length;e++)if(s[e]){let t=4*(r[e]-l);t<0||t>u-4?s[e]=0:(n[e]=a[t++],i[e]=a[t++],o[e]=a[t++])}return t.pixels=[n,i,o],t.statistics=[new Rt.A(0,255),new Rt.A(0,255),new Rt.A(0,255)],t.pixelType=this.outputPixelType,t}_getWebGLParameters(){return this.lookup}};(0,o.Cg)([(0,a.MZ)({json:{write:!0,name:"rasterFunction"}})],kt.prototype,"functionName",void 0),(0,o.Cg)([(0,a.MZ)({type:Nt,json:{write:!0,name:"rasterFunctionArguments"}})],kt.prototype,"functionArguments",void 0),(0,o.Cg)([(0,a.MZ)()],kt.prototype,"rasterArgumentNames",void 0),(0,o.Cg)([(0,a.MZ)({json:{write:!0}})],kt.prototype,"lookup",void 0),kt=(0,o.Cg)([(0,a.$K)("esri.layers.raster.functions.ColormapToRGBFunction")],kt);const St=kt;var _t,Ft=r(43937);let Bt=_t=class extends c{constructor(){super(...arguments),this.rasters=[]}writeRasters(e,t){t.rasters=e.map(e=>"number"==typeof e||"string"==typeof e?e:e.toJSON())}clone(){return new _t({rasters:(0,i.o8)(this.rasters)})}};(0,o.Cg)([(0,a.MZ)({json:{write:!0}})],Bt.prototype,"rasters",void 0),(0,o.Cg)([(0,Ft.K)("rasters")],Bt.prototype,"writeRasters",null),Bt=_t=(0,o.Cg)([(0,a.$K)("esri.layers.raster.functions.CompositeBandFunctionArguments")],Bt);const jt=Bt;let Zt=class extends w{constructor(){super(...arguments),this.functionName="CompositeBand",this.functionArguments=null,this.rasterArgumentNames=["rasters"]}_bindSourceRasters(){let{sourceRasterInfos:e}=this,t=e[0];this.outputPixelType=this._getOutputPixelType(t.pixelType);let r=t.clone();if(r.attributeTable=null,r.colormap=null,r.pixelType=this.outputPixelType,r.bandCount=e.map(({bandCount:e})=>e).reduce((e,t)=>e+t),e.every(({statistics:e})=>null!=e&&e.length)){let t=[];e.forEach(({statistics:e})=>null!=e&&t.push(...e)),r.statistics=t}if(e.every(({histograms:e})=>null!=e&&e.length)){let t=[];e.forEach(({histograms:e})=>null!=e&&t.push(...e)),r.histograms=t}r.multidimensionalInfo&&r.multidimensionalInfo.variables.forEach(t=>{let r=e.map(e=>e.multidimensionalInfo?.variables.find(({name:e})=>e===t.name)),s=r.map(e=>e?.statistics?.length?e.statistics:null),n=r.map(e=>e?.histograms?.length?e.histograms:null);t.statistics=s.every(e=>null!=e)?s.flat():null,t.histograms=n.every(e=>null!=e)?n.flat():null}),r.bandCount>1&&(r.colormap=null,r.attributeTable=null);let s=e.every(e=>e.keyProperties.BandProperties?.length)?e.flatMap(e=>e.keyProperties.BandProperties):void 0;return r.keyProperties={...r.keyProperties,BandProperties:s},this.rasterInfo=r,{success:!0,supportsGPU:r.bandCount<=3}}_processPixels(e){let{pixelBlocks:t}=e;return t&&null!=t?.[0]?(0,Ke.Wy)(t):null}_getWebGLParameters(){return{bandCount:this.rasterInfo.bandCount}}};(0,o.Cg)([(0,a.MZ)({json:{write:!0,name:"rasterFunction"}})],Zt.prototype,"functionName",void 0),(0,o.Cg)([(0,a.MZ)({type:jt,json:{write:!0,name:"rasterFunctionArguments"}})],Zt.prototype,"functionArguments",void 0),(0,o.Cg)([(0,a.MZ)()],Zt.prototype,"rasterArgumentNames",void 0),Zt=(0,o.Cg)([(0,a.$K)("esri.layers.raster.functions.CompositeBandFunction")],Zt);const Gt=Zt,zt=new Ee.J({0:"difference",1:"relative-difference",2:"categorical",3:"euclidean-distance",4:"angle-difference",5:"band-with-most-change"},{useNumericKeys:!0}),Ot=new Ee.J({0:"all",1:"changed",2:"unchanged"},{useNumericKeys:!0});var Et;let Dt=Et=class extends c{constructor(){super(...arguments),this.method="difference",this.keepMethod="all",this.raster2=void 0}get rasters(){return[this.raster,this.raster2]}clone(){return new Et({raster:this.raster,raster2:this.raster2,method:this.method,keepMethod:this.keepMethod})}};(0,o.Cg)([(0,Ye.e)(zt)],Dt.prototype,"method",void 0),(0,o.Cg)([(0,Ye.e)(Ot)],Dt.prototype,"keepMethod",void 0),(0,o.Cg)([(0,a.MZ)({json:{write:!0}})],Dt.prototype,"raster2",void 0),(0,o.Cg)([(0,a.MZ)({readOnly:!0})],Dt.prototype,"rasters",null),Dt=Et=(0,o.Cg)([(0,a.$K)("esri.layers.raster.functions.ComputeChangeFunctionArguments")],Dt);const Vt=Dt;var Ut=r(20437);let Lt=class extends w{constructor(){super(...arguments),this.functionName="ComputeChange",this.functionArguments=null,this.rasterArgumentNames=["raster","raster2"]}_bindSourceRasters(){let{method:e}=this.functionArguments,t=this.sourceRasterInfos[0].clone();if(this.outputPixelType=this._getOutputPixelType(t.pixelType),t.pixelType=this.outputPixelType,this._removeStatsHistColormapVAT(t),"categorical"===e){let e=this.sourceRasterInfos.map(e=>e.attributeTable),r=this._getFieldNames(e,"value"),s=e.map(e=>this._getClassFieldName(e));if(null==r[0]||null==r[1]||null==s[0]||null==s[1])return{success:!1,supportsGPU:!1,error:"both inputs must have proper attribute table with value and class fields"};this._updateAttributeTable(t,r,s)}return t.bandCount=1,this.rasterInfo=t,{success:!0,supportsGPU:"difference"===e||"relative-difference"===e}}_processPixels(e){let{pixelBlocks:t}=e;if(null==t?.[0]||null==t?.[1])return null;let{method:r}=this.functionArguments;return function(e,t,r,s){let[n,i]=e,o=(0,l.zw)(r)&&!(0,l.zw)(n.pixelType)&&!(0,l.zw)(i.pixelType),a=[n.mask,i.mask].filter(e=>e),u=g.A.combineBandMasks(a),p=e.map(e=>e.pixels[0]),{width:c,height:h}=n,m=g.A.createEmptyBand(r,c*h);switch(t){case"difference":case"relative-difference":!function(e){let{bands:[t,r],mask:s,isRelative:n,isRoundingNeeded:i,outBand:o}=e,a=t.length;for(let e=0;e<a;e++)if(!s||s[e]){let s=t[e]-r[e];if(n){let n=Math.max(Math.abs(t[e]),Math.abs(r[e]));s=0===n?0:s/n}o[e]=i?Math.round(s):s}}({bands:p,mask:u,outBand:m,isRoundingNeeded:o,isRelative:"relative-difference"===t});break;case"categorical":!function(e){let{bands:[t,r],categoryIndexLookups:[s,n],classNames:[i,o],mask:a,keepMethod:l,outBand:u}=e,p=t.length,c=i.length,h=o.length,m=c*h,f=m+1,g=m+2;for(let e=0;e<p;e++)if(!a||a[e]){let a=t[e],p=r[e],c=s[a],d=n[p],y=i[c],x=o[d];u[e]=null==c||null==d?m:"changed"===l&&y===x?f:"unchanged"===l&&y!==x?g:c*h+d}}({bands:p,mask:u,outBand:m,...s});break;case"euclidean-distance":!function(e){let{pixels:[t,r],mask:s,outBand:n}=e,i=t[0].length,o=t.length;for(let e=0;e<i;e++)if(!s||s[e]){let s=0;for(let n=0;n<o;n++){let i=t[n][e]-r[n][e];s+=i*i}n[e]=Math.sqrt(s)}}({pixels:e.map(e=>e.pixels),mask:u,outBand:m});break;case"angle-difference":!function(e){let{pixels:[t,r],mask:s,outBand:n}=e,i=t[0].length,o=t.length;for(let e=0;e<i;e++)if(!s||s[e]){let s=0,i=0,a=0;for(let n=0;n<o;n++){let o=t[n][e],l=r[n][e];s+=o*l,i+=o*o,a+=l*l}let l=Math.sqrt(i*a);n[e]=l?Math.acos(s/l):1.5707963267948966}}({pixels:e.map(e=>e.pixels),mask:u,outBand:m});break;case"band-with-most-change":!function(e){let{pixels:[t,r],mask:s,outBand:n}=e,i=t[0].length,o=t.length;for(let e=0;e<i;e++)if(!s||s[e]){let s=0,i=0;for(let n=0;n<o;n++){let o=Math.abs(t[n][e]-r[n][e]);o>s&&(s=o,i=n)}n[e]=i}}({pixels:e.map(e=>e.pixels),mask:u,outBand:m})}let f=new g.A({width:c,height:h,pixels:[m],pixelType:r,mask:u});return f.updateStatistics(),f}(t,r,this.outputPixelType,this._categoryConfig)}_getWebGLParameters(){let e=this.outputPixelType??"f32",[t,r]=(0,l.hP)(e),s=(0,l.zw)(e);return s&&(t-=1e-4,r+=1e-4),{method:this.functionArguments.method,domainRange:[t,r],isOutputRounded:s}}_updateAttributeTable(e,t,r){let s=this.sourceRasterInfos.map(e=>e.attributeTable),n=s.map((e,r)=>e.features.map(e=>e.attributes[t[r]])),i=s.map((e,t)=>e.features.map(e=>e.attributes[r[t]])),o=n.map(e=>{let t=[];return e.forEach((e,r)=>t[e]=r),t}),{keepMethod:a}=this.functionArguments;this._categoryConfig={categoryIndexLookups:o,classNames:i,keepMethod:a};let l=s[0].clone();l.fields=[new Ut.A({name:"OID",type:"oid"}),new Ut.A({name:"Value",type:"integer"}),new Ut.A({name:"ClassName",type:"string"}),new Ut.A({name:"Class_From",type:"string"}),new Ut.A({name:"Class_To",type:"string"})];let u=this._getFieldNames(s,"red"),p=this._getFieldNames(s,"green"),c=this._getFieldNames(s,"blue"),h=[],m=2===u.length&&2===p.length&&2===c.length;m&&(h.push(...s.map((e,t)=>e.features.map(e=>[e.attributes[u[t]],e.attributes[p[t]],e.attributes[c[t]]]))),l.fields.push(new Ut.A({name:"Red",type:"integer"}),new Ut.A({name:"Green",type:"integer"}),new Ut.A({name:"Blue",type:"integer"})));let f=l.features[0].clone();f.geometry=null;let g=[],[d,y]=n.map(e=>e.length),x=1;for(let e=0;e<d;e++){let t=i[0][e];for(let r=0;r<y;r++){let s=i[1][r];if("changed"===a&&t===s||"unchanged"===a&&t!==s)continue;let n=f.clone();n.attributes={OID:x++,Value:e*y+r,ClassName:t===s?t:`${t} -> ${s}`,Class_From:t,Class_To:s},m&&(n.attributes.Red=h[0][e][0]+h[1][r][0]>>1,n.attributes.Green=h[0][e][1]+h[1][r][1]>>1,n.attributes.Blue=h[0][e][2]+h[1][r][2]>>1),g.push(n)}}if("changed"===a){let e=f.clone();e.attributes={OID:x++,Value:d*y+1,ClassName:"No Change",Class_From:"Same",Class_To:"Same"},g.push(e)}else if("unchanged"===a){let e=f.clone();e.attributes={OID:x++,Value:d*y+2,ClassName:"Changed",Class_From:"Any",Class_To:"Any"},g.push(e)}l.features=g,e.attributeTable=l}_getFieldNames(e,t){return e.map(({fields:e})=>e.find(e=>e.name.toLowerCase()===t)?.name).filter(e=>e)}_getClassFieldName(e){return(e.fields.find(e=>"string"===e.type&&e.name.toLowerCase().startsWith("class"))??e.fields.find(e=>"string"===e.type&&e.name.toLowerCase().includes("class")||e.name.toLowerCase().includes("type")||e.name.toLowerCase().includes("name"))??e.fields.find(e=>"string"===e.type))?.name}};(0,o.Cg)([(0,a.MZ)({json:{write:!0,name:"rasterFunction"}})],Lt.prototype,"functionName",void 0),(0,o.Cg)([(0,a.MZ)({type:Vt,json:{write:!0,name:"rasterFunctionArguments"}})],Lt.prototype,"functionArguments",void 0),(0,o.Cg)([(0,a.MZ)()],Lt.prototype,"rasterArgumentNames",void 0),(0,o.Cg)([(0,a.MZ)({json:{write:!0}})],Lt.prototype,"_categoryConfig",void 0),Lt=(0,o.Cg)([(0,a.$K)("esri.layers.raster.functions.ComputeChangeFunction")],Lt);const Wt=Lt;var Kt;let $t=Kt=class extends c{constructor(){super(...arguments),this.contrastOffset=0,this.brightnessOffset=0}clone(){return new Kt({contrastOffset:this.contrastOffset,brightnessOffset:this.brightnessOffset,raster:this.raster})}};(0,o.Cg)([(0,a.MZ)({json:{write:!0}})],$t.prototype,"contrastOffset",void 0),(0,o.Cg)([(0,a.MZ)({json:{write:!0}})],$t.prototype,"brightnessOffset",void 0),$t=Kt=(0,o.Cg)([(0,a.$K)("esri.layers.raster.functions.ContrastBrightnessFunctionArguments")],$t);const Ht=$t;var qt=r(51927);let Jt=class extends w{constructor(){super(...arguments),this.functionName="ContrastBrightness",this.functionArguments=null,this.rasterArgumentNames=["raster"],this.lookup=null}_bindSourceRasters(){let{sourceRasterInfos:e}=this,t=e[0];if("u8"!==t.pixelType)return{success:!1,supportsGPU:!1,error:"Only unsigned 8 bit raster is supported by ContrastBrightness function."};this.outputPixelType=this._getOutputPixelType("u8");let r=t.clone();this._removeStatsHistColormapVAT(r),this.rasterInfo=r;let{contrastOffset:s,brightnessOffset:n}=this.functionArguments;return this.lookup=(0,qt.zj)(s,n),{success:!0,supportsGPU:!0}}_processPixels(e){let t=e.pixelBlocks?.[0];return null==t?null:(0,Ke.eH)(t,{lut:t.pixels.map(()=>this.lookup),offset:0,outputPixelType:"u8"})}_getWebGLParameters(){let{contrastOffset:e,brightnessOffset:t}=this.functionArguments;return{contrastOffset:e,brightnessOffset:t}}};(0,o.Cg)([(0,a.MZ)({json:{write:!0,name:"rasterFunction"}})],Jt.prototype,"functionName",void 0),(0,o.Cg)([(0,a.MZ)({type:Ht,json:{write:!0,name:"rasterFunctionArguments"}})],Jt.prototype,"functionArguments",void 0),(0,o.Cg)([(0,a.MZ)()],Jt.prototype,"rasterArgumentNames",void 0),(0,o.Cg)([(0,a.MZ)({json:{write:!0}})],Jt.prototype,"lookup",void 0),Jt=(0,o.Cg)([(0,a.$K)("esri.layers.raster.functions.ContrastBrightnessFunction")],Jt);const Xt=Jt;function Yt(e,t,r,s,n){let i=Math.floor(s/2);for(let s=0;s<i;s++)for(let i=0;i<t;i++)e[s*t+i]=e[(n-1-s)*t+i],e[(r-1-s)*t+i]=e[(r-n+s)*t+i];let o=Math.floor(n/2);for(let s=0;s<r;s++){let r=s*t;for(let s=0;s<o;s++)e[r+s]=e[r+n-1-s],e[r+t-s-1]=e[r+t+s-n]}}const Qt=new Map;function er(e,t,r,s,n,i,o){let a=new Float32Array(t*r),l=i.length,u=o?0:s,p=o?s:0,c=o?1:t;for(let o=u;o<r-u;o++){let r=o*t;for(let o=p;o<t-p;o++){if(n&&!n[r+o])continue;let t=0;for(let n=0;n<l;n++)t+=e[r+o+(n-s)*c]*i[n];a[r+o]=t}}return a}function tr(e,t,r,s,n,i,o){let a=new Float32Array(t*r),l=Math.floor(s/2),u=Math.floor(n/2);for(let p=l;p<r-l;p++){let r=p*t;for(let p=u;p<t-u;p++){if(i&&!i[r+p])continue;let c=0;for(let i=0;i<s;i++)for(let s=0;s<n;s++)c+=e[r+p+(i-l)*t+s-u]*o[i*n+s];a[r+p]=c}}return a}var rr;Qt.set(A.none,[0,0,0,0,1,0,0,0,0]),Qt.set(A.lineDetectionHorizontal,[-1,-1,-1,2,2,2,-1,-1,-1]),Qt.set(A.lineDetectionVertical,[-1,2,-1,-1,2,-1,-1,2,-1]),Qt.set(A.lineDetectionLeftDiagonal,[2,-1,-1,-1,2,-1,-1,-1,2]),Qt.set(A.lineDetectionRightDiagonal,[-1,-1,2,-1,2,-1,2,-1,-1]),Qt.set(A.gradientNorth,[-1,-2,-1,0,0,0,1,2,1]),Qt.set(A.gradientWest,[-1,0,1,-2,0,2,-1,0,1]),Qt.set(A.gradientEast,[1,0,-1,2,0,-2,1,0,-1]),Qt.set(A.gradientSouth,[1,2,1,0,0,0,-1,-2,-1]),Qt.set(A.gradientNorthEast,[0,-1,-2,1,0,-1,2,1,0]),Qt.set(A.gradientNorthWest,[-2,-1,0,-1,0,1,0,1,2]),Qt.set(A.smoothArithmeticMean,[.111111111111,.111111111111,.111111111111,.111111111111,.111111111111,.111111111111,.111111111111,.111111111111,.111111111111]),Qt.set(A.smoothing3x3,[.0625,.125,.0625,.125,.25,.125,.0625,.125,.0625]),Qt.set(A.smoothing5x5,[1,1,1,1,1,1,4,4,4,1,1,4,12,4,1,1,4,4,4,1,1,1,1,1,1]),Qt.set(A.sharpening3x3,[-1,-1,-1,-1,9,-1,-1,-1,-1]),Qt.set(A.sharpening5x5,[-1,-3,-4,-3,-1,-3,0,6,0,-3,-4,6,21,6,-4,-3,0,6,0,-3,-1,-3,-4,-3,-1]),Qt.set(A.laplacian3x3,[0,-1,0,-1,4,-1,0,-1,0]),Qt.set(A.laplacian5x5,[0,0,-1,0,0,0,-1,-2,-1,0,-1,-2,17,-2,-1,0,-1,-2,-1,0,0,0,-1,0,0]),Qt.set(A.sobelHorizontal,[-1,-2,-1,0,0,0,1,2,1]),Qt.set(A.sobelVertical,[-1,0,1,-2,0,2,-1,0,1]),Qt.set(A.sharpen,[0,-.25,0,-.25,2,-.25,0,-.25,0]),Qt.set(A.sharpen2,[-.25,-.25,-.25,-.25,3,-.25,-.25,-.25,-.25]),Qt.set(A.pointSpread,[-.627,.352,-.627,.352,2.923,.352,-.627,.352,-.627]);let sr=rr=class extends c{constructor(){super(...arguments),this.rows=3,this.cols=3,this.kernel=[0,0,0,0,1,0,0,0,0]}set convolutionType(e){this._set("convolutionType",e);let t=Qt.get(e);if(!t||e===A.userDefined||e===A.none)return;let r=Math.round(Math.sqrt(t.length));this._set("kernel",t),this._set("cols",r),this._set("rows",r)}clone(){return new rr({cols:this.cols,rows:this.rows,kernel:[...this.kernel],convolutionType:this.convolutionType,raster:(0,i.o8)(this.raster)})}};(0,o.Cg)([(0,a.MZ)({json:{type:Number,write:!0}})],sr.prototype,"rows",void 0),(0,o.Cg)([(0,a.MZ)({json:{type:Number,write:!0,name:"columns"}})],sr.prototype,"cols",void 0),(0,o.Cg)([(0,a.MZ)({json:{name:"type",type:Number,write:!0}})],sr.prototype,"convolutionType",null),(0,o.Cg)([(0,a.MZ)({json:{type:[Number],write:!0}})],sr.prototype,"kernel",void 0),sr=rr=(0,o.Cg)([(0,a.$K)("esri.layers.raster.functions.ConvolutionFunctionArguments")],sr);const nr=sr;let ir=class extends w{constructor(){super(...arguments),this.functionName="Convolution",this.rasterArgumentNames=["raster"]}get _normalizedKernel(){let{kernel:e,convolutionType:t}=this.functionArguments,r=e.reduce((e,t)=>e+t);return-1===t||0===r||1===r?e:e.map(e=>e/r)}_bindSourceRasters(){let{convolutionType:e,rows:t,cols:r,kernel:s}=this.functionArguments;if(!Object.values(A).includes(e))return{success:!1,supportsGPU:!1,error:`convolution-function: the specified kernel type is not supported ${e}`};if(e!==A.none&&t*r!==s.length)return{success:!1,supportsGPU:!1,error:"convolution-function: the specified rows and cols do not match the length of the kernel"};let n=this.sourceRasterInfos[0];this.outputPixelType=this._getOutputPixelType(n.pixelType);let i=n.clone();i.pixelType=this.outputPixelType;let o=[A.none,A.sharpen,A.sharpen2,A.sharpening3x3,A.sharpening5x5];return(-1===e||"u8"!==this.outputPixelType&&!o.includes(e))&&(i.statistics=null,i.histograms=null),i.colormap=null,i.attributeTable=null,this.rasterInfo=i,{success:!0,supportsGPU:s.length<=25}}_processPixels(e){let t=e.pixelBlocks?.[0];if(null==t||this.functionArguments.convolutionType===A.none)return t;let{rows:r,cols:s}=this.functionArguments,{_normalizedKernel:n}=this;return function(e,t){let r=function(e){let t=Math.sqrt(e.length),r=e.slice(0,t),s=[1];for(let r=1;r<t;r++){let n=null;for(let s=0;s<t;s++){let i=e[s+r*t],o=e[s];if(null==n)if(0===o){if(i)return{separable:!1,row:null,col:null}}else n=i/o;else if(i/o!==n)return{separable:!1,row:null,col:null}}if(null==n)return{separable:!1,row:null,col:null};s.push(n)}return{separable:!0,row:r,col:s}}(t.kernel),s=!1!==t.mirrorEdges,n=r.separable?function(e,t,r,s=!0){let{pixels:n,width:i,height:o,pixelType:a,mask:l}=e,u=n.length,p=[],c=t.length,h=r.length,m=Math.floor(c/2),f=Math.floor(h/2);for(let e=0;e<u;e++){let a=er(n[e],i,o,m,l,t,!0);a=er(a,i,o,f,l,r,!1),s&&Yt(a,i,o,c,h),p.push(a)}return new g.A({width:i,height:o,pixelType:a,pixels:p,mask:l})}(e,r.row,r.col,s):function(e,t,r=!0){let{pixels:s,width:n,height:i,pixelType:o,mask:a}=e,l=s.length,u=[],{kernel:p,rows:c,cols:h}=t;for(let e=0;e<l;e++){let t=tr(s[e],n,i,c,h,a,p);r&&Yt(t,n,i,c,h),u.push(t)}return new g.A({width:n,height:i,pixelType:o,pixels:u,mask:a})}(e,t,s),{outputPixelType:i}=t;return i&&n.clamp(i),n}(t,{kernel:n,rows:r,cols:s,outputPixelType:this.outputPixelType})}_getWebGLParameters(){let e=new Float32Array(25),{rows:t,cols:r}=this.functionArguments,{_normalizedKernel:s}=this;for(let n=0;n<t;n++)for(let t=0;t<r;t++)e[5*n+t]=s[n*r+t];return{kernelRows:t,kernelCols:r,kernel:e,clampRange:(0,l.hP)(this.outputPixelType)}}_getNeighborhoodSize(){let{rows:e,cols:t}=this.functionArguments;return{rows:e,cols:t}}};(0,o.Cg)([(0,a.MZ)({json:{write:!0,name:"rasterFunction"}})],ir.prototype,"functionName",void 0),(0,o.Cg)([(0,a.MZ)({type:nr,json:{write:!0,name:"rasterFunctionArguments"}})],ir.prototype,"functionArguments",void 0),(0,o.Cg)([(0,a.MZ)()],ir.prototype,"rasterArgumentNames",void 0),(0,o.Cg)([(0,a.MZ)()],ir.prototype,"_normalizedKernel",null),ir=(0,o.Cg)([(0,a.$K)("esri.layers.raster.functions.ConvolutionFunction")],ir);const or=ir;var ar;const lr=new Ee.J({0:"standard",1:"planform",2:"profile"},{useNumericKeys:!0});let ur=ar=class extends c{constructor(){super(...arguments),this.curvatureType="standard",this.zFactor=1}readCurvatureType(e,t){return lr.fromJSON(t.type??t.curvatureType??0)}clone(){return new ar({curvatureType:this.curvatureType,zFactor:this.zFactor,raster:this.raster})}};(0,o.Cg)([(0,a.MZ)({json:{write:{target:"type"}}}),(0,Ye.e)(lr)],ur.prototype,"curvatureType",void 0),(0,o.Cg)([(0,yt.w)("curvatureType",["type","curvatureType"])],ur.prototype,"readCurvatureType",null),(0,o.Cg)([(0,a.MZ)({type:Number,json:{write:!0}})],ur.prototype,"zFactor",void 0),ur=ar=(0,o.Cg)([(0,a.$K)("esri.layers.raster.functions.CurvatureFunctionArguments")],ur);const pr=ur;let cr=class extends w{constructor(){super(...arguments),this.functionName="Curvature",this.functionArguments=null,this.rasterArgumentNames=["raster"],this.isGCS=!1}_bindSourceRasters(){this.outputPixelType=this._getOutputPixelType("f32");let e=this.sourceRasterInfos[0].clone();return e.pixelType=this.outputPixelType,e.bandCount=1,this._removeStatsHistColormapVAT(e),this.rasterInfo=e,this.isGCS=e.spatialReference?.isGeographic??!1,{success:!0,supportsGPU:!0}}_processPixels(e){let t=e.pixelBlocks?.[0];if(null==t)return null;let{zFactor:r,curvatureType:s}=this.functionArguments,{extent:n,primaryPixelSizes:i}=e,o=i?.[0]??(n?{x:n.width/t.width,y:n.height/t.height}:{x:1,y:1}),a=this.isGCS&&r>=1?r*Ge.rk:r;return(0,Ge.E0)(t,{zFactor:a,curvatureType:s,resolution:o})}_getWebGLParameters(){let{zFactor:e,curvatureType:t}=this.functionArguments;return{curvatureType:t,zFactor:this.isGCS&&e>=1?e*Ge.rk:e}}_getNeighborhoodSize(){return{rows:3,cols:3}}};(0,o.Cg)([(0,a.MZ)({json:{write:!0,name:"rasterFunction"}})],cr.prototype,"functionName",void 0),(0,o.Cg)([(0,a.MZ)({type:pr,json:{write:!0,name:"rasterFunctionArguments"}})],cr.prototype,"functionArguments",void 0),(0,o.Cg)([(0,a.MZ)()],cr.prototype,"rasterArgumentNames",void 0),(0,o.Cg)([(0,a.MZ)({json:{write:!0}})],cr.prototype,"isGCS",void 0),cr=(0,o.Cg)([(0,a.$K)("esri.layers.raster.functions.CurvatureFunction")],cr);const hr=cr;var mr;let fr=mr=class extends c{constructor(){super(...arguments),this.bandIds=[],this.bandNames=[],this.bandWavelengths=[],this.missingBandAction=0}clone(){return new mr({bandIds:this.bandIds?.slice(),bandNames:this.bandNames?.slice(),bandWavelengths:this.bandWavelengths?.slice(),missingBandAction:this.missingBandAction,method:this.method,wavelengthMatchTolerance:this.wavelengthMatchTolerance})}};(0,o.Cg)([(0,a.MZ)({json:{write:!0}})],fr.prototype,"bandIds",void 0),(0,o.Cg)([(0,a.MZ)({json:{write:!0}})],fr.prototype,"bandNames",void 0),(0,o.Cg)([(0,a.MZ)({json:{write:!0}})],fr.prototype,"bandWavelengths",void 0),(0,o.Cg)([(0,Ye.e)({0:"name",1:"wavelength",2:"id"})],fr.prototype,"method",void 0),(0,o.Cg)([(0,a.MZ)({json:{write:!0}})],fr.prototype,"missingBandAction",void 0),(0,o.Cg)([(0,a.MZ)({json:{write:!0}})],fr.prototype,"wavelengthMatchTolerance",void 0),fr=mr=(0,o.Cg)([(0,a.$K)("esri.layers.raster.functions.ExtractBandFunctionArguments")],fr);const gr=fr;let dr=class extends w{constructor(){super(...arguments),this.functionName="ExtractBand",this.functionArguments=null,this.rasterArgumentNames=["raster"]}_bindSourceRasters(){let{functionArguments:e,sourceRasterInfos:t}=this,r=t[0],{method:s,bandNames:n,bandWavelengths:i,bandIds:o,missingBandAction:a}=e,l=n?.length&&("name"===s||"id"!==s&&!o?.length),u=i?.length&&("wavelength"===s||"id"!==s&&!o?.length),p=1===a,c=l?function(e,t){let r=e.bandInfos.map(({name:e})=>e.toLowerCase()),s=[];for(let e=0;e<t.length;e++){let n=t[e].toLowerCase(),i=r.indexOf(n);if(-1===i&&"nearinfrared"===n&&(i=r.findIndex(e=>e.startsWith("nearinfrared_1")),-1===i&&(i=r.findIndex(e=>e.startsWith("nearinfrared")))),-1===i)return null;s.push(i)}return s}(r,n):u?function(e,t,{wavelengthMatchTolerance:r},s){let{bandInfos:n}=e,i=[];for(let e=0;e<n.length;e++){let{minWavelength:t,maxWavelength:r}=n[e];if(!t||!r)return null;i.push({minWavelength:t,maxWavelength:r})}let o=[];for(let e=0;e<t.length;e++){let n=t[e],a=!1,l=-1,u=Number.MAX_VALUE;for(let e=0;e<i.length;e++){let t=i[e],r=n>=t.minWavelength&&n<=t.maxWavelength,s=Math.abs(n-(t.minWavelength+t.maxWavelength)/2);r?s<u&&(a=!0,l=e,u=s):!a&&s<u&&(l=e,u=s)}if(!a&&r&&u<r&&(a=!0),!a&&s)return null;o.push(l)}return o}(r,i,this.functionArguments,p):function(e,t,r){let{bandCount:s}=e;return!t?.length||r&&t.some(e=>e<0||e>=s)?null:t}(r,o,p);if(null==c)return{success:!1,supportsGPU:!1,error:`extract-band-function: Invalid ${l?"band names":u?"band wavelengths":"band ids"} for the imagery data source`};this.functionArguments.bandIds=c,this.functionArguments.method="id",this.outputPixelType=this._getOutputPixelType(r.pixelType);let h=r.clone();h.pixelType=this.outputPixelType,h.bandCount=c.length;let{statistics:m,histograms:f}=h;null!=m&&m.length&&(h.statistics=c.map(e=>m[e]||m[m.length-1])),null!=f&&f.length&&(h.histograms=c.map(e=>f[e]||f[f.length-1])),h.multidimensionalInfo&&h.multidimensionalInfo.variables.forEach(e=>{let{statistics:t,histograms:r}=e;null!=t&&t.length&&(e.statistics=c.map(e=>t[e]||t[t.length-1])),null!=r&&r.length&&(e.histograms=c.map(e=>r[e]||r[r.length-1]))});let g=h.keyProperties?.BandProperties;return g?.length&&(g=c.map(e=>e>=g.length?g[g.length-1]:g[e]),h.keyProperties={...h.keyProperties,BandProperties:g}),this.rasterInfo=h,{success:!0,supportsGPU:h.bandCount<=3}}_processPixels(e){let t=e.pixelBlocks?.[0];if(null==t)return null;let{bandIds:r}=this.functionArguments;if(this.rasterInfo.storageInfo.isBsqTile){let{rawInputBandIds:e}=this;r=r.map(t=>e.indexOf(t))}else{let e=t.pixels.length;r=r.map(t=>t>=e?e-1:t)}return t.extractBands(r)}_getWebGLParameters(){let e;if(this.isInputBandIdsSwizzled)e=this.swizzledBandSelection.length?this.swizzledBandSelection:[0,1,2];else{e=[...this.functionArguments.bandIds],0===e.length?e=[0,1,2]:e.length<3&&(e[1]=e[1]??e[0],e[2]=e[2]??e[1]);for(let t=0;t<3;t++)e[t]=Math.min(e[t],2)}return{bandIndexMat3:qe(e)}}_getInputBandIds(e){let t=e.length;return this.functionArguments.bandIds.map(e=>e>=t?t-1:e).map(t=>e[t])}_swizzleBandIds(e){let t=this.functionArguments.bandIds.map(t=>e.indexOf(t));return this.isInputBandIdsSwizzled=!0,t[1]??=t[0],t[2]??=t[1],this.swizzledBandSelection=t,!1}};(0,o.Cg)([(0,a.MZ)({json:{write:!0,name:"rasterFunction"}})],dr.prototype,"functionName",void 0),(0,o.Cg)([(0,a.MZ)({type:gr,json:{write:!0,name:"rasterFunctionArguments"}})],dr.prototype,"functionArguments",void 0),(0,o.Cg)([(0,a.MZ)()],dr.prototype,"rasterArgumentNames",void 0),dr=(0,o.Cg)([(0,a.$K)("esri.layers.raster.functions.ExtractBandFunction")],dr);const yr=dr;function xr(e,t,r,s){let{pixels:n,width:i,height:o}=e,a=n.length,u=r.startsWith("f"),p=!u,[c,h]=(0,l.hP)(r),m=i*o,f=g.A.createEmptyBand(r,m);for(let e=0;e<o;e++){let r=e*i;for(let e=0;e<i;e++,r++)if(!s||s[r]){let e=0;for(let s=0;s<a;s++)e+=t[s]*n[s][r];u||(e=Math.round(e),p&&(e=e>h?h:e<c?c:e)),f[r]=e}}return f}var wr;let Ar=wr=class extends c{clone(){return new wr({conversionParameters:[...this.conversionParameters],raster:this.raster})}};(0,o.Cg)([(0,a.MZ)({type:[Number],json:{write:!0}})],Ar.prototype,"conversionParameters",void 0),Ar=wr=(0,o.Cg)([(0,a.$K)("esri.layers.raster.functions.GrayscaleFunctionArguments")],Ar);const vr=Ar;let br=class extends w{constructor(){super(...arguments),this.functionName="Grayscale",this.functionArguments=null,this.rasterArgumentNames=["raster"]}get _normalizedWeights(){let{conversionParameters:e}=this.functionArguments,t=e.reduce((e,t)=>e+t);return e.map(e=>e/t)}_bindSourceRasters(){let{conversionParameters:e}=this.functionArguments;if(!e?.length)return{success:!1,supportsGPU:!1,error:"missing valid conversion parameters."};let t=this.sourceRasterInfos[0].clone();this.outputPixelType=this._getOutputPixelType(t.pixelType),t.pixelType=this.outputPixelType;let r=3===e.length||3===t.bandCount&&e.length>3;return t.bandCount=1,this._removeStatsHistColormapVAT(t),this.rasterInfo=t,{success:!0,supportsGPU:r}}_processPixels(e){let t=e.pixelBlocks?.[0];return null==t?null:function(e,t,r){let{width:s,height:n,mask:i,bandMasks:o}=e,a=o?.length?g.A.combineBandMasks(o):i,l=xr(e,t,r,a),u=new g.A({width:s,height:n,pixels:[l],pixelType:r,mask:a});return u.updateStatistics(),u}(t,this._normalizedWeights,this.outputPixelType)}_getWebGLParameters(){return{weights:this._normalizedWeights}}};(0,o.Cg)([(0,a.MZ)({json:{write:!0,name:"rasterFunction"}})],br.prototype,"functionName",void 0),(0,o.Cg)([(0,a.MZ)({type:vr,json:{write:!0,name:"rasterFunctionArguments"}})],br.prototype,"functionArguments",void 0),(0,o.Cg)([(0,a.MZ)()],br.prototype,"rasterArgumentNames",void 0),(0,o.Cg)([(0,a.MZ)()],br.prototype,"_normalizedWeights",null),br=(0,o.Cg)([(0,a.$K)("esri.layers.raster.functions.GrayscaleFunction")],br);const Cr=br;var Mr;const Pr=new Ee.J({0:"traditional",1:"multi-directional"},{useNumericKeys:!0}),Tr=new Ee.J({1:"degree",2:"percent-rise",3:"scaled"},{useNumericKeys:!0});let Nr=Mr=class extends c{constructor(){super(...arguments),this.altitude=45,this.azimuth=315,this.hillshadeType="traditional",this.pixelSizePower=.664,this.pixelSizeFactor=.024,this.slopeType="degree",this.zFactor=1,this.removeEdgeEffect=!1}clone(){return new Mr({hillshadeType:this.hillshadeType,altitude:this.altitude,azimuth:this.azimuth,zFactor:this.zFactor,slopeType:this.slopeType,pixelSizeFactor:this.pixelSizeFactor,pixelSizePower:this.pixelSizePower,removeEdgeEffect:this.removeEdgeEffect,raster:this.raster})}};(0,o.Cg)([(0,a.MZ)({type:Number,json:{write:!0}})],Nr.prototype,"altitude",void 0),(0,o.Cg)([(0,a.MZ)({type:Number,json:{write:!0}})],Nr.prototype,"azimuth",void 0),(0,o.Cg)([(0,a.MZ)(),(0,Ye.e)(Pr)],Nr.prototype,"hillshadeType",void 0),(0,o.Cg)([(0,a.MZ)({type:Number,json:{write:!0,name:"psPower"}})],Nr.prototype,"pixelSizePower",void 0),(0,o.Cg)([(0,a.MZ)({type:Number,json:{write:!0,name:"psZFactor"}})],Nr.prototype,"pixelSizeFactor",void 0),(0,o.Cg)([(0,a.MZ)(),(0,Ye.e)(Tr)],Nr.prototype,"slopeType",void 0),(0,o.Cg)([(0,a.MZ)({type:Number,json:{write:!0}})],Nr.prototype,"zFactor",void 0),(0,o.Cg)([(0,a.MZ)({type:Boolean,json:{write:!0}})],Nr.prototype,"removeEdgeEffect",void 0),Nr=Mr=(0,o.Cg)([(0,a.$K)("esri.layers.raster.functions.HillshadeFunctionArguments")],Nr);const Rr=Nr;let Ir=class extends w{constructor(){super(...arguments),this.functionName="Hillshade",this.functionArguments=null,this.rasterArgumentNames=["raster"],this.isGCS=!1}_bindSourceRasters(){let e=this.sourceRasterInfos[0];if(e.bandCount>1)return{success:!1,supportsGPU:!1,error:"hillshade-function: source data must be single band"};this.outputPixelType=this._getOutputPixelType("u8");let t=e.clone();return this._removeStatsHistColormapVAT(t),t.pixelType=this.outputPixelType,t.bandCount=1,t.statistics=[{min:0,max:255,avg:60,stddev:10}],this.rasterInfo=t,this.isGCS=t.spatialReference?.isGeographic??!1,{success:!0,supportsGPU:!0}}_processPixels(e){let t=e.pixelBlocks?.[0];if(!t)return null;let{extent:r,primaryPixelSizes:s}=e,n=s?.[0]??(r?{x:r.width/t.width,y:r.height/t.height}:{x:1,y:1}),i=(0,Ge.PP)(this.functionArguments,n,this.isGCS),o=(0,Ge.fw)(t,i);return o.pixelType=this.outputPixelType,o}_getWebGLParameters(){let e=(0,Ge.PP)(this.functionArguments,{x:1,y:1},this.isGCS),t=(0,Ge.ng)(e),{slopeType:r,zFactor:s,pixelSizeFactor:n,pixelSizePower:i}=this.functionArguments,o="scaled"===r,a=(0,l.zw)(this.outputPixelType);return{...t,zFactor:s,gcsFactor:this.isGCS?Ge.rk:1,pixelSizeFactor:o?n:0,pixelSizePower:o?i:0,isOutputRounded:a}}_getNeighborhoodSize(){return{rows:3,cols:3}}};(0,o.Cg)([(0,a.MZ)({json:{write:!0,name:"rasterFunction"}})],Ir.prototype,"functionName",void 0),(0,o.Cg)([(0,a.MZ)({type:Rr,json:{write:!0,name:"rasterFunctionArguments"}})],Ir.prototype,"functionArguments",void 0),(0,o.Cg)([(0,a.MZ)()],Ir.prototype,"rasterArgumentNames",void 0),(0,o.Cg)([(0,a.MZ)({json:{write:!0}})],Ir.prototype,"isGCS",void 0),Ir=(0,o.Cg)([(0,a.$K)("esri.layers.raster.functions.HillshadeFunction")],Ir);const kr=Ir;var Sr;let _r=Sr=class extends c{constructor(){super(...arguments),this.rasters=[],this.processAsMultiband=!0}writeRasters(e,t){t.rasters=e.map(e=>"number"==typeof e||"string"==typeof e?e:e.toJSON())}clone(){return new Sr({operation:this.operation,processAsMultiband:this.processAsMultiband,rasters:(0,i.o8)(this.rasters)})}};(0,o.Cg)([(0,a.MZ)({json:{write:!0}})],_r.prototype,"operation",void 0),(0,o.Cg)([(0,a.MZ)({json:{write:!0}})],_r.prototype,"rasters",void 0),(0,o.Cg)([(0,Ft.K)("rasters")],_r.prototype,"writeRasters",null),(0,o.Cg)([(0,a.MZ)({json:{write:!0}})],_r.prototype,"processAsMultiband",void 0),_r=Sr=(0,o.Cg)([(0,a.$K)("esri.layers.raster.functions.LocalFunctionArguments")],_r);const Fr=_r;let Br=class extends w{constructor(){super(...arguments),this.functionName="Local",this.functionArguments=null,this.rasterArgumentNames=["rasters"]}_bindSourceRasters(){let{sourceRasterInfos:e}=this,t=e[0],{bandCount:r}=t,{processAsMultiband:s}=this.functionArguments;if(e.some(e=>e.bandCount!==r))return{success:!1,supportsGPU:!1,error:"local-function: input rasters do not have same band count"};let{operation:n,rasters:i}=this.functionArguments,o=N[n];if(!(999===o||i.length===o||i.length<=1&&1===o))return{success:!1,supportsGPU:!1,error:`local-function: the length of functionArguments.rasters does not match operation's requirement: ${o}`};let a=t.clone();return a.bandCount=999!==o||s?r:1,this._removeStatsHistColormapVAT(a),this._updateStatistics(a),this._updatePixelType(a),this.rasterInfo=a,{success:!0,supportsGPU:1===a.bandCount&&o<=3}}_processPixels(e){let{pixelBlocks:t}=e;return null==t||t.some(e=>null==e)?null:Se(t,this.functionArguments.operation,{processAsMultiband:this.functionArguments.processAsMultiband,outputPixelType:this.outputPixelType??void 0})}_getWebGLParameters(){let{operation:e}=this.functionArguments,t=N[e],r=Object.keys(M).find(t=>M[t]===e)?.toLowerCase()??"undefined",s=this.outputPixelType??"f32",[n,i]=(0,l.hP)(s),o=(0,l.zw)(s);return o&&(n-=1e-4,i+=1e-4),{imageCount:t,operationName:r,domainRange:[n,i],isOutputRounded:o}}_updateStatistics(e){let t=this.sourceRasterInfos[0],{operation:r}=this.functionArguments,s=T(r)?.domain;if(s){e.statistics=[];for(let t=0;t<e.bandCount;t++)e.statistics[t]={min:s[0],max:s[1],avg:(s[0]+s[1])/2,stddev:(s[0]+s[1])/10}}else 45===r&&t.statistics?.length&&(e.statistics=t.statistics.map(e=>({min:-e.max,max:-e.min,avg:null==e.avg?void 0:-e.avg,stddev:null==e.stddev?void 0:-e.stddev})))}_updatePixelType(e){let{statistics:t,pixelType:r}=this.sourceRasterInfos[0],{operation:s}=this.functionArguments,{domain:n,isInteger:i}=T(s)??{domain:null,isInteger:!1},o="f32";if(n&&i)o=(0,l.X1)(n[0],n[1]);else if(30===s){let e=t?.[0];o=e?(0,l.X1)(e.min,e.max):(0,l.zw)(r)?r:"s32"}else if(45===s&&(0,l.zw)(r)){let e=t?.map(({max:e})=>-e),s=t?.map(({min:e})=>-e),n=e?.length?Math.min(...e):null,i=s?.length?Math.min(...s):null;o=null!=n&&null!=i?(0,l.X1)(n,i):r.startsWith("s")?r.replace("s","u"):"u1"===r||"u2"===r||"u4"===r?"s8":"u8"===r?"s16":"s32"}e.pixelType=this.outputPixelType=this._getOutputPixelType(o)}};(0,o.Cg)([(0,a.MZ)({json:{write:!0,name:"rasterFunction"}})],Br.prototype,"functionName",void 0),(0,o.Cg)([(0,a.MZ)({type:Fr,json:{write:!0,name:"rasterFunctionArguments"}})],Br.prototype,"functionArguments",void 0),(0,o.Cg)([(0,a.MZ)()],Br.prototype,"rasterArgumentNames",void 0),Br=(0,o.Cg)([(0,a.$K)("esri.layers.raster.functions.LocalFunction")],Br);const jr=Br;var Zr,Gr=r(34727);let zr=Zr=class extends c{constructor(){super(...arguments),this.includedRanges=null,this.noDataValues=null,this.noDataInterpretation=0}get normalizedNoDataValues(){let{noDataValues:e}=this;if(!e?.length)return null;let t=!1,r=e.map(e=>{if("number"==typeof e)return t=!0,[e];if("string"==typeof e){let r=e.trim().split(" ").filter(e=>""!==e.trim()).map(e=>Number(e));return t||=r.length>0,0===r.length?null:r}return null});return t?r:null}clone(){return new Zr({includedRanges:this.includedRanges?.slice()??[],noDataValues:this.noDataValues?.slice()??[],noDataInterpretation:this.noDataInterpretation})}};(0,o.Cg)([(0,a.MZ)({json:{write:!0}})],zr.prototype,"includedRanges",void 0),(0,o.Cg)([(0,a.MZ)({json:{write:!0}})],zr.prototype,"noDataValues",void 0),(0,o.Cg)([(0,a.MZ)()],zr.prototype,"normalizedNoDataValues",null),(0,o.Cg)([(0,a.MZ)({json:{write:!0}})],zr.prototype,"noDataInterpretation",void 0),zr=Zr=(0,o.Cg)([(0,a.$K)("esri.layers.raster.functions.MaskFunctionArguments")],zr);const Or=zr;let Er=class extends w{constructor(){super(...arguments),this.functionName="Mask",this.functionArguments=null,this.rasterArgumentNames=["raster"]}_bindSourceRasters(){let e=this.sourceRasterInfos[0].clone(),{pixelType:t}=e;this.outputPixelType=this._getOutputPixelType(t),e.pixelType=this.outputPixelType,this.rasterInfo=e;let{includedRanges:r,normalizedNoDataValues:s}=this.functionArguments;if(!r?.length&&!s?.length)return{success:!1,supportsGPU:!1,error:"missing includedRanges or noDataValues argument"};let n=[];for(let i=0;i<e.bandCount;i++){let e=(0,Ke.Wt)(t,r?.slice(2*i,2*i+2),s?.[i]);if(null==e){n=null;break}n.push(e)}this.lookups=n;let i=null!=s&&s.every(e=>e?.length===s[0]?.length);return{success:!0,supportsGPU:(!r||r.length<=18)&&(!s||i&&s[0].length<=9)}}_processPixels(e){let t=e.pixelBlocks?.[0];if(null==t)return null;let{outputPixelType:r,lookups:s}=this,{includedRanges:n,noDataInterpretation:i,normalizedNoDataValues:o}=this.functionArguments;return(0,Ke.dK)(t,{includedRanges:n,noDataValues:o,outputPixelType:r,matchAll:1===i,lookups:s})}_getWebGLParameters(){let{includedRanges:e,normalizedNoDataValues:t}=this.functionArguments,r=new Float32Array(9);r.fill(Gr.pq),t?.[0]?.length&&r.set(t[0]);let s=new Float32Array(6);for(let t=0;t<s.length;t+=2)s[t]=e?.[t]??-Gr.pq,s[t+1]=e?.[t+1]??Gr.pq;return e?.length&&s.set(e),{bandCount:this.sourceRasterInfos[0].bandCount,noDataValues:r,includedRanges:s}}};(0,o.Cg)([(0,a.MZ)({json:{write:!0,name:"rasterFunction"}})],Er.prototype,"functionName",void 0),(0,o.Cg)([(0,a.MZ)({type:Or,json:{write:!0,name:"rasterFunctionArguments"}})],Er.prototype,"functionArguments",void 0),(0,o.Cg)([(0,a.MZ)()],Er.prototype,"rasterArgumentNames",void 0),(0,o.Cg)([(0,a.MZ)({json:{write:!0}})],Er.prototype,"lookups",void 0),Er=(0,o.Cg)([(0,a.$K)("esri.layers.raster.functions.MaskFunction")],Er);const Dr=Er;var Vr;let Ur=Vr=class extends c{constructor(){super(...arguments),this.visibleBandID=0,this.infraredBandID=1,this.scientificOutput=!1}clone(){let{visibleBandID:e,infraredBandID:t,scientificOutput:r}=this;return new Vr({visibleBandID:e,infraredBandID:t,scientificOutput:r})}};(0,o.Cg)([(0,a.MZ)({json:{write:!0}})],Ur.prototype,"visibleBandID",void 0),(0,o.Cg)([(0,a.MZ)({json:{write:!0}})],Ur.prototype,"infraredBandID",void 0),(0,o.Cg)([(0,a.MZ)({json:{write:!0}})],Ur.prototype,"scientificOutput",void 0),Ur=Vr=(0,o.Cg)([(0,a.$K)("esri.layers.raster.functions.NDVIFunctionArguments")],Ur);const Lr=Ur;let Wr=class extends w{constructor(){super(...arguments),this.functionName="NDVI",this.functionArguments=null,this.rasterArgumentNames=["raster"]}_bindSourceRasters(){let{scientificOutput:e,visibleBandID:t,infraredBandID:r}=this.functionArguments;this.outputPixelType=this._getOutputPixelType(e?"f32":"u8");let s=this.sourceRasterInfos[0],n=Math.max(t,r);if(s.bandCount<2||n>=s.bandCount)return{success:!1,supportsGPU:!1,error:"ndvi-function: source raster has insufficient amount of raster bands"};if(t<0||r<0)return{success:!1,supportsGPU:!1,error:"ndvi-function: invalid visible or infrared band id"};let i=s.clone();i.pixelType=this.outputPixelType,this._removeStatsHistColormapVAT(i),i.bandCount=1,i.keyProperties={...i.keyProperties,BandProperties:void 0};let[o,a,l,u]=e?[-1,1,0,.1]:[0,200,100,10];return i.statistics=[{min:o,max:a,avg:l,stddev:u}],this.rasterInfo=i,{success:!0,supportsGPU:!0}}_processPixels(e){let t=e.pixelBlocks?.[0];if(null==t)return null;let{visibleBandID:r,infraredBandID:s,scientificOutput:n}=this.functionArguments;if(this.rasterInfo.storageInfo.isBsqTile){let{rawInputBandIds:e}=this;s=e.indexOf(s),r=e.indexOf(r)}return function(e,t,r,s){let{mask:n,pixels:i,width:o,height:a}=e,l=i[r],u=i[t],p=u.length,c=s?new Uint8Array(p):new Float32Array(p),h=s?100:1,m=s?100.5:0;for(let e=0;e<p;e++)if(null==n||n[e]){let t=l[e],r=u[e],s=t+r;s&&(c[e]=(t-r)/s*h+m)}let f=new g.A({width:o,height:a,mask:n,pixelType:s?"u8":"f32",pixels:[c]});return f.updateStatistics(),f}(t,r,s,!n)}_getWebGLParameters(){let{visibleBandID:e,infraredBandID:t,scientificOutput:r}=this.functionArguments;return{bandIndexMat3:qe(this.isInputBandIdsSwizzled?[0,1,2]:[t,e,0]),scaled:!r}}_getInputBandIds(e){let{visibleBandID:t,infraredBandID:r}=this.functionArguments;return[r,t,0].map(t=>e[t])}_swizzleBandIds(e){let{visibleBandID:t,infraredBandID:r}=this.functionArguments,s=[t,r].map(t=>e.indexOf(t));return s[2]=s[1],this.isInputBandIdsSwizzled=!0,this.swizzledBandSelection=s,!1}};(0,o.Cg)([(0,a.MZ)({json:{write:!0,name:"rasterFunction"}})],Wr.prototype,"functionName",void 0),(0,o.Cg)([(0,a.MZ)({type:Lr,json:{write:!0,name:"rasterFunctionArguments"}})],Wr.prototype,"functionArguments",void 0),(0,o.Cg)([(0,a.MZ)()],Wr.prototype,"rasterArgumentNames",void 0),Wr=(0,o.Cg)([(0,a.$K)("esri.layers.raster.functions.NDVIFunction")],Wr);const Kr=Wr;var $r;let Hr=$r=class extends c{constructor(){super(...arguments),this.inputRanges=null,this.outputValues=null,this.noDataRanges=null,this.allowUnmatched=!1,this.isLastInputRangeInclusive=!1}clone(){return new $r({inputRanges:[...this.inputRanges],outputValues:[...this.outputValues],noDataRanges:[...this.noDataRanges],allowUnmatched:this.allowUnmatched,isLastInputRangeInclusive:this.isLastInputRangeInclusive})}};(0,o.Cg)([(0,a.MZ)({json:{write:!0}})],Hr.prototype,"inputRanges",void 0),(0,o.Cg)([(0,a.MZ)({json:{write:!0}})],Hr.prototype,"outputValues",void 0),(0,o.Cg)([(0,a.MZ)({json:{write:!0}})],Hr.prototype,"noDataRanges",void 0),(0,o.Cg)([(0,a.MZ)({json:{write:!0}})],Hr.prototype,"allowUnmatched",void 0),(0,o.Cg)([(0,a.MZ)({json:{write:!0}})],Hr.prototype,"replacementValue",void 0),(0,o.Cg)([(0,a.MZ)({json:{write:!0}})],Hr.prototype,"isLastInputRangeInclusive",void 0),Hr=$r=(0,o.Cg)([(0,a.$K)("esri.layers.raster.functions.RemapFunctionArguments")],Hr);const qr=Hr;let Jr=class extends w{constructor(){super(...arguments),this.functionName="Remap",this.functionArguments=null,this.rasterArgumentNames=["raster"],this.lookup=null}_bindSourceRasters(){let e=this.sourceRasterInfos[0].clone(),{pixelType:t}=e;e.bandCount=1;let{statistics:r}=e;this._removeStatsHistColormapVAT(e);let{allowUnmatched:s,replacementValue:n,outputValues:i,inputRanges:o,noDataRanges:a,isLastInputRangeInclusive:u}=this.functionArguments,p="unknown"===this.outputPixelType||null==this.outputPixelType;if(this.outputPixelType=this._getOutputPixelType(t),i?.length){let o=r?.[0];if(s&&null==n){let t=o?.min??i[0],r=o?.max??i[0];t=Math.min.apply(null,[...i,t]),r=Math.max.apply(null,[...i,r]),e.statistics=[{min:t,max:r,avg:o?.avg??0,stddev:o?.stddev??-1}]}else{let t=i[0],r=t;for(let e=0;e<i.length;e++)t=t>i[e]?i[e]:t,r=r>i[e]?r:i[e];s&&null!=n&&(t=Math.min(t,n),r=Math.max(r,n)),e.statistics=[{min:t,max:r,avg:o?.avg??0,stddev:o?.stddev??-1}]}if(p){let{min:r,max:o}=e.statistics[0],a=["u8","s8","u16","s16","u32","s32","f32"],u=a.find(e=>{let[t,s]=(0,l.hP)(e);return r>=t&&o<=s})??"f64";this.outputPixelType=i.some(e=>Math.floor(e)!==e)?"f64"===u?"f64":"f32":s&&null==n&&a.indexOf(t)>a.indexOf(u)?t:u}}return e.pixelType=this.outputPixelType,this.rasterInfo=e,this.lookup=s?null:(0,Ke.XU)({srcPixelType:t,inputRanges:o,outputValues:i,noDataRanges:a,allowUnmatched:s,isLastInputRangeInclusive:u,outputPixelType:this.outputPixelType}),{success:!0,supportsGPU:(!i||i.length<=9)&&(!a||a.length<=9)}}_processPixels(e){let t=e.pixelBlocks?.[0];if(null==t)return null;let{lookup:r,outputPixelType:s}=this;if(r){let e=(0,Ke.eH)(t,{lut:[r.lut],offset:r.offset,outputPixelType:s});return null!=e&&r.mask&&(e.mask=(0,Ke.UK)(t.pixels[0],t.mask,r.mask,r.offset,"u8")),e}let{inputRanges:n,outputValues:i,noDataRanges:o,allowUnmatched:a,isLastInputRangeInclusive:l,replacementValue:u}=this.functionArguments;return(0,Ke.Ew)(t,{inputRanges:n,outputValues:i,noDataRanges:o,outputPixelType:s,allowUnmatched:a,isLastInputRangeInclusive:l,replacementValue:u})}_getWebGLParameters(){let{allowUnmatched:e,noDataRanges:t,isLastInputRangeInclusive:r}=this.functionArguments,s=this.functionArguments.inputRanges??[],n=this.functionArguments.outputValues??[],i=(0,Ke.bL)(s,n,r),o=new Float32Array(18);return o.fill(Gr.pq),t?.length&&o.set(t),{allowUnmatched:e,rangeMaps:i,noDataRanges:o,clampRange:(0,l.hP)(this.outputPixelType),replacementValue:this.functionArguments.replacementValue}}};(0,o.Cg)([(0,a.MZ)({json:{write:!0,name:"rasterFunction"}})],Jr.prototype,"functionName",void 0),(0,o.Cg)([(0,a.MZ)({type:qr,json:{write:!0,name:"rasterFunctionArguments"}})],Jr.prototype,"functionArguments",void 0),(0,o.Cg)([(0,a.MZ)()],Jr.prototype,"rasterArgumentNames",void 0),(0,o.Cg)([(0,a.MZ)({json:{write:!0}})],Jr.prototype,"lookup",void 0),Jr=(0,o.Cg)([(0,a.$K)("esri.layers.raster.functions.RemapFunction")],Jr);const Xr=Jr;var Yr;let Qr=Yr=class extends Rr{readColorRamp(e){if("string"==typeof e){let t=gt.kH.jsonValues.find(t=>t.toLowerCase()===e.toLowerCase());return t?(0,gt.M5)(gt.kH.fromJSON(t)):null}return"toJSON"in e?e.toJSON():e}clone(){return new Yr({hillshadeType:this.hillshadeType,altitude:this.altitude,azimuth:this.azimuth,zFactor:this.zFactor,slopeType:this.slopeType,pixelSizeFactor:this.pixelSizeFactor,pixelSizePower:this.pixelSizePower,removeEdgeEffect:this.removeEdgeEffect,colorRamp:this.colorRamp,colormap:this.colormap,raster:this.raster})}};(0,o.Cg)([(0,a.MZ)({json:{write:!0}})],Qr.prototype,"colorRamp",void 0),(0,o.Cg)([(0,yt.w)("colorRamp")],Qr.prototype,"readColorRamp",null),(0,o.Cg)([(0,a.MZ)({type:[[Number]],json:{write:!0}})],Qr.prototype,"colormap",void 0),Qr=Yr=(0,o.Cg)([(0,a.$K)("esri.layers.raster.functions.ShadedReliefFunctionArguments")],Qr);const es=Qr;let ts=class extends w{constructor(){super(...arguments),this.functionName="ShadedRelief",this.functionArguments=null,this.rasterArgumentNames=["raster"],this.isGCS=!1}_bindSourceRasters(){let e=this.sourceRasterInfos[0];if(e.bandCount>1)return{success:!1,supportsGPU:!1,error:"shadedrelief-function: source data must be single band"};let{colorRamp:t,colormap:r}=this.functionArguments;if(!t&&!r?.length)return{success:!1,supportsGPU:!1,error:"shadedrelief-function: a color ramp argument must be specified"};this.outputPixelType=this._getOutputPixelType("u8");let s=e.clone();this._removeStatsHistColormapVAT(s),s.pixelType=this.outputPixelType,s.bandCount=3,s.statistics=[{min:0,max:255,avg:60,stddev:10},{min:0,max:255,avg:60,stddev:10},{min:0,max:255,avg:60,stddev:10}],this.rasterInfo=s,this.isGCS=s.spatialReference?.isGeographic??!1,r?.length||(r=(0,gt.R8)(t,{interpolateAlpha:!0}));let{indexedColormap:n,offset:i}=(0,Ke.zg)({colormap:r});if(!n?.length)return{success:!1,supportsGPU:!1,error:"shadedrelief-function: a valid colorramp is required"};let o=(0,gt.S2)(n);return this.lookup={indexedColormap:n,offset:i,hsvMap:o},{success:!0,supportsGPU:(0,It.WN)(n)}}_processPixels(e){let t=e.pixelBlocks?.[0];if(!t||!this.lookup)return null;let r=e.primaryPixelSizes?.[0];if(null==r){let{extent:s}=e;r=s?{x:s.width/t.width,y:s.height/t.height}:{x:1,y:1}}let s=(0,Ge.PP)(this.functionArguments,r,this.isGCS),n=(0,Ge.fw)(t,s),i=this.sourceRasterInfos[0].statistics?.[0]??{min:0,max:8e3};return(0,Ge.SC)(n,t,this.lookup.hsvMap,i),n.pixelType=this.outputPixelType,n}_getWebGLParameters(){let e=(0,Ge.PP)(this.functionArguments,{x:1,y:1},this.isGCS),t=(0,Ge.ng)(e),{slopeType:r,zFactor:s,pixelSizeFactor:n,pixelSizePower:i}=this.functionArguments,o="scaled"===r,{indexedColormap:a,offset:u}=this.lookup,p=this.sourceRasterInfos[0].statistics?.[0],c=(0,l.zw)(this.outputPixelType);return{...t,indexedColormap:a,offset:u,zFactor:s,gcsFactor:this.isGCS?Ge.rk:1,pixelSizeFactor:o?n:0,pixelSizePower:o?i:0,minValue:p?.min??0,maxValue:p?.max??8e3,isOutputRounded:c}}_getNeighborhoodSize(){return{rows:3,cols:3}}};(0,o.Cg)([(0,a.MZ)({json:{write:!0,name:"rasterFunction"}})],ts.prototype,"functionName",void 0),(0,o.Cg)([(0,a.MZ)({type:es,json:{write:!0,name:"rasterFunctionArguments"}})],ts.prototype,"functionArguments",void 0),(0,o.Cg)([(0,a.MZ)()],ts.prototype,"rasterArgumentNames",void 0),(0,o.Cg)([(0,a.MZ)({json:{write:!0}})],ts.prototype,"isGCS",void 0),(0,o.Cg)([(0,a.MZ)({json:{write:!0}})],ts.prototype,"lookup",void 0),ts=(0,o.Cg)([(0,a.$K)("esri.layers.raster.functions.ShadedReliefFunction")],ts);const rs=ts;var ss;const ns=new Ee.J({1:"degree",2:"percent-rise",3:"adjusted"},{useNumericKeys:!0});let is=ss=class extends c{constructor(){super(...arguments),this.slopeType="degree",this.zFactor=1,this.pixelSizePower=.664,this.pixelSizeFactor=.024,this.removeEdgeEffect=!1}clone(){return new ss({slopeType:this.slopeType,zFactor:this.zFactor,pixelSizePower:this.pixelSizePower,pixelSizeFactor:this.pixelSizeFactor,removeEdgeEffect:this.removeEdgeEffect,raster:this.raster})}};(0,o.Cg)([(0,Ye.e)(ns)],is.prototype,"slopeType",void 0),(0,o.Cg)([(0,a.MZ)({type:Number,json:{write:!0}})],is.prototype,"zFactor",void 0),(0,o.Cg)([(0,a.MZ)({type:Number,json:{name:"psPower",write:!0}})],is.prototype,"pixelSizePower",void 0),(0,o.Cg)([(0,a.MZ)({type:Number,json:{name:"psZFactor",write:!0}})],is.prototype,"pixelSizeFactor",void 0),(0,o.Cg)([(0,a.MZ)({type:Boolean,json:{write:!0}})],is.prototype,"removeEdgeEffect",void 0),is=ss=(0,o.Cg)([(0,a.$K)("esri.layers.raster.functions.SlopeFunctionArguments")],is);const os=is;let as=class extends w{constructor(){super(...arguments),this.functionName="Slope",this.functionArguments=null,this.rasterArgumentNames=["raster"],this.isGCS=!1}_bindSourceRasters(){this.outputPixelType=this._getOutputPixelType("f32");let e=this.sourceRasterInfos[0].clone();return e.pixelType=this.outputPixelType,this._removeStatsHistColormapVAT(e),e.statistics="percent-rise"===this.functionArguments.slopeType?null:[{min:0,max:90,avg:1,stddev:1}],e.bandCount=1,this.rasterInfo=e,this.isGCS=e.spatialReference?.isGeographic??!1,{success:!0,supportsGPU:!0}}_processPixels(e){let t=e.pixelBlocks?.[0];if(null==t)return null;let{zFactor:r,slopeType:s,pixelSizePower:n,pixelSizeFactor:i}=this.functionArguments,{isGCS:o}=this,{extent:a,primaryPixelSizes:l}=e,u=l?.[0]??(a?{x:a.width/t.width,y:a.height/t.height}:{x:1,y:1});return(0,Ge.yy)(t,{zFactor:r,slopeType:s,pixelSizePower:n,pixelSizeFactor:i,isGCS:o,resolution:u})}_getWebGLParameters(){let{zFactor:e,slopeType:t,pixelSizeFactor:r,pixelSizePower:s}=this.functionArguments;return{zFactor:this.isGCS&&e>=1?e*Ge.rk:e,slopeType:t,pixelSizeFactor:r??0,pixelSizePower:s??0,isOutputRounded:(0,l.zw)(this.outputPixelType)}}_getNeighborhoodSize(){return{rows:3,cols:3}}};(0,o.Cg)([(0,a.MZ)({json:{write:!0,name:"rasterFunction"}})],as.prototype,"functionName",void 0),(0,o.Cg)([(0,a.MZ)({type:os,json:{write:!0,name:"rasterFunctionArguments"}})],as.prototype,"functionArguments",void 0),(0,o.Cg)([(0,a.MZ)()],as.prototype,"rasterArgumentNames",void 0),(0,o.Cg)([(0,a.MZ)({json:{write:!0}})],as.prototype,"isGCS",void 0),as=(0,o.Cg)([(0,a.$K)("esri.layers.raster.functions.SlopeFunction")],as);const ls=as;var us;let ps=us=class extends c{clone(){return new us({conversionMatrix:[...this.conversionMatrix],raster:this.raster})}};(0,o.Cg)([(0,a.MZ)({type:[Number],json:{write:!0}})],ps.prototype,"conversionMatrix",void 0),ps=us=(0,o.Cg)([(0,a.$K)("esri.layers.raster.functions.SpectralConversionFunctionArguments")],ps);const cs=ps;let hs=class extends w{constructor(){super(...arguments),this.functionName="SpectralConversion",this.functionArguments=null,this.rasterArgumentNames=["raster"]}_bindSourceRasters(){let e=this.sourceRasterInfos[0].clone();return this.outputPixelType=this._getOutputPixelType(e.pixelType),e.pixelType=this.outputPixelType,this._removeStatsHistColormapVAT(e),this.rasterInfo=e,{success:!0,supportsGPU:3===e.bandCount&&9===this.functionArguments.conversionMatrix.length}}_processPixels(e){let t=e.pixelBlocks?.[0];return null==t?null:function(e,t,r){let{width:s,height:n,mask:i,bandMasks:o}=e,a=o?.length?g.A.combineBandMasks(o):i,l=[],u=e.pixels.length;for(let s=0;s<t.length/u;s++){let n=xr(e,t.slice(s*u,(s+1)*u),r,a);l.push(n)}let p=new g.A({width:s,height:n,pixels:l,pixelType:r,mask:a});return p.updateStatistics(),p}(t,this.functionArguments.conversionMatrix,this.outputPixelType)}_getWebGLParameters(){let e=(0,l.hP)(this.outputPixelType),[t,r,s,n,i,o,a,u,p]=this.functionArguments.conversionMatrix;return{weights:[t,n,a,r,i,u,s,o,p],clampRange:e}}};(0,o.Cg)([(0,a.MZ)({json:{write:!0,name:"rasterFunction"}})],hs.prototype,"functionName",void 0),(0,o.Cg)([(0,a.MZ)({type:cs,json:{write:!0,name:"rasterFunctionArguments"}})],hs.prototype,"functionArguments",void 0),(0,o.Cg)([(0,a.MZ)()],hs.prototype,"rasterArgumentNames",void 0),hs=(0,o.Cg)([(0,a.$K)("esri.layers.raster.functions.SpectralConversionFunction")],hs);const ms=hs,fs=new Ee.J({1:"min",2:"max",3:"mean",4:"stddev",5:"median",6:"majority",7:"minority"},{useNumericKeys:!0});function gs(e,t){let{fillNoDataOnly:r}=t,{band:s,width:n,height:i,mask:o,outBand:a}=e;if(r&&!o)return void a.set(s);let{statisticsType:l,kernelRows:u,kernelCols:p}=t,c="stddev"===l,h=n*i,m=new Float64Array(h),f=new Float64Array(h),g=new Uint32Array(h);for(let e=0;e<i;e++){let t=e*n,r=0,i=0,a=0;for(let e=0;e<p;e++)(!o||o[t+e])&&(r+=s[t+e],c&&(i+=s[t+e]**2),a++);m[t]=r,f[t]=i,g[t]=a;for(let e=1;e<=n-p;e++){let n=t+e-1,l=n+p;o?(o[n]&&(a--,r-=s[n],c&&(i-=s[n]**2)),o[l]&&(a++,r+=s[l],c&&(i+=s[l]**2))):(r-=s[n],r+=s[l],c&&(i-=s[n]**2,i+=s[l]**2)),m[t+e]=r,g[t+e]=a,c&&(f[t+e]=i)}}let d=new Float64Array(h),y=new Float64Array(h),x=new Uint32Array(h),w=u*n;for(let e=0;e<=n-p;e++){let t=0,r=0,s=0;for(let i=0;i<u;i++){let o=i*n+e;t+=m[o],s+=g[o],c&&(r+=f[o])}d[e]=t,y[e]=r,x[e]=s;for(let o=1;o<=i-u;o++){let i=(o-1)*n+e,a=i+w;t-=m[i],t+=m[a],s-=g[i],s+=g[a],c&&(r-=f[i],r+=f[a]),d[o*n+e]=t,y[o*n+e]=r,x[o*n+e]=s}}let A=Math.floor(u/2),v=Math.floor(p/2);for(let e=A;e<i-A;e++){let t=e*n;for(let s=v;s<n-v;s++){let i=(e-A)*n+s-v,l=x[i];if(0===l||r&&(!o||o[t+s]))continue;let u=d[i]/l,p=c?Math.sqrt((y[i]-d[i]*u)/l):u;a[t+s]=p,o&&(o[t+s]=255)}}}function ds(e,t){let{fillNoDataOnly:r}=t,{band:s,width:n,height:i,mask:o,outBand:a}=e;if(r&&!o)return void a.set(s);let{kernelRows:l,kernelCols:u,statisticsType:p}=t,c=Math.floor(l/2),h=Math.floor(u/2),m="min"===p,f=a.slice(),g=new Uint32Array(n*i);for(let e=c;e<i-c;e++){let t=e*n;for(let e=h;e<n-h;e++){let r=m?Number.MAX_VALUE:-Number.MAX_VALUE,i=0;for(let a=0;a<l;a++)for(let l=0;l<u;l++){let u=t+e+(a-c)*n+l-h;(!o||o[u])&&(r=m?Math.min(r,s[u]):Math.max(r,s[u]),i++)}o?(f[t+e]=0===i?0:r,g[t+e]=i):a[t+e]=0===i?0:r}}if(o)for(let e=c;e<i-c;e++){let t=e*n;for(let e=h;e<n-h;e++)if(g[t+e]){if(r&&o[t+e])continue;a[t+e]=f[t+e],o[t+e]=255}}}function ys(e,t){let{fillNoDataOnly:r}=t,{band:s,width:n,height:i,mask:o,outBand:a}=e;if(r&&!o)return void a.set(s);let{kernelRows:l,kernelCols:u}=t,p=Math.floor(l/2),c=Math.floor(u/2),h=a.slice(),m=new Uint32Array(n*i);for(let e=p;e<i-p;e++){let t=e*n;for(let e=c;e<n-c;e++){if(r&&o?.[t+e])continue;let i=[];for(let r=0;r<l;r++)for(let a=0;a<u;a++){let l=t+e+(r-p)*n+a-c;(!o||o[l])&&i.push(s[l])}i.length&&(i.sort((e,t)=>e-t),o?(h[t+e]=i[Math.floor((i.length-1)/2)],m[t+e]=i.length):a[t+e]=i[Math.floor((i.length-1)/2)])}}if(o)for(let e=p;e<i-p;e++){let t=e*n;for(let e=c;e<n-c;e++)if(m[t+e]){if(r&&o[t+e])continue;a[t+e]=h[t+e],o[t+e]=255}}}function xs(e,t){let{fillNoDataOnly:r}=t,{band:s,width:n,height:i,mask:o,outBand:a}=e;if(r&&!o)return void a.set(s);let{kernelRows:l,kernelCols:u}=t,p=Math.floor(l/2),c=Math.floor(u/2),h="majority"===t.statisticsType,m=l*u,f=a.slice(),g=new Uint32Array(n*i);for(let e=p;e<i-p;e++){let t=e*n;for(let e=c;e<n-c;e++){if(r&&o?.[t+e])continue;let i=new Map;for(let r=0;r<l;r++)for(let a=0;a<u;a++){let l=t+e+(r-p)*n+a-c;if(o&&!o[l])continue;let u=s[l];i.set(u,i.has(u)?i.get(u)+1:1)}if(0===i.size)continue;let d=0,y=0,x=h?0:m+1;for(let e of i.keys())y=i.get(e),h===y>x&&(x=y,d=e);o?(f[t+e]=d,g[t+e]=i.size):a[t+e]=d}}if(o)for(let e=p;e<i-p;e++){let t=e*n;for(let e=c;e<n-c;e++)if(g[t+e]){if(r&&o[t+e])continue;a[t+e]=f[t+e],o[t+e]=255}}}var ws;let As=ws=class extends c{constructor(){super(...arguments),this.rows=3,this.cols=3,this.fillNoDataOnly=!1,this.statisticsType="min"}clone(){return new ws({rows:this.rows,cols:this.cols,fillNoDataOnly:this.fillNoDataOnly,statisticsType:this.statisticsType,raster:(0,i.o8)(this.raster)})}};(0,o.Cg)([(0,a.MZ)({json:{write:!0,read:{source:["kernelRows","rows"],reader:(e,t)=>Number(e??t?.kernelRows??3)}}})],As.prototype,"rows",void 0),(0,o.Cg)([(0,a.MZ)({json:{write:!0,read:{source:["kernelCols","cols"],reader:(e,t)=>Number(e??t?.kernelCols??3)}}})],As.prototype,"cols",void 0),(0,o.Cg)([(0,a.MZ)({json:{write:!0}})],As.prototype,"fillNoDataOnly",void 0),(0,o.Cg)([(0,a.MZ)({json:{read:{source:["statisticsType","type"],reader:(e,t)=>fs.fromJSON(t?.statisticsType??t?.type)??"min"},write:{target:"type"}}}),(0,Ye.e)(fs)],As.prototype,"statisticsType",void 0),As=ws=(0,o.Cg)([(0,a.$K)("esri.layers.raster.functions.StatisticsFunctionArguments")],As);const vs=As;let bs=class extends w{constructor(){super(...arguments),this.functionName="Statistics",this.rasterArgumentNames=["raster"]}_bindSourceRasters(){let{type:e}=this.functionArguments.toJSON();if(e<1||e>7)return{success:!1,supportsGPU:!1,error:`statistics-function: the given statistics type is not supported ${e}`};let t=this.sourceRasterInfos[0];this.outputPixelType=this._getOutputPixelType(t.pixelType);let r=t.clone();r.pixelType=this.outputPixelType;let{statisticsType:s}=this.functionArguments;return"stddev"===s&&this._removeStatsHistColormapVAT(r),this.rasterInfo=r,{success:!0,supportsGPU:r.bandCount<=3&&e<5}}_processPixels(e){let t=e.pixelBlocks?.[0];if(null==t)return t;let{statisticsType:r,rows:s,cols:n,fillNoDataOnly:i}=this.functionArguments;return function(e,t){let{mask:r}=e,{fillNoDataOnly:s}=t;if(s&&!r)return e;let{pixels:n,width:i,height:o,bandMasks:a,pixelType:l}=e,u=n.length,p=i*o,c=[],{kernelRows:h,kernelCols:m,statisticsType:f,mirrorEdges:d}=t;if(s&&!r)return e;let y=t.outputPixelType??l,x=[];for(let e=0;e<u;e++){let l=n[e],u=g.A.createEmptyBand(y,p);s&&u.set(l);let w=(a?.[e]??r)?.slice()??null,A={band:l,width:i,height:o,mask:w,outBand:u};switch(f){case"min":case"max":ds(A,t);break;case"mean":case"stddev":gs(A,t);break;case"median":ys(A,t);break;case"majority":case"minority":xs(A,t)}d&&!s&&Yt(u,i,o,h,m),c.push(u),w&&x.push(w)}let w=x[0]??r;x.length!==u&&(x.length=0),u>1&&a?.length&&(w=g.A.combineBandMasks(a));let A=new g.A({pixelType:y,width:i,height:o,pixels:c,bandMasks:a&&x.length?x:null,mask:w});return A.updateStatistics(),A}(t,{kernelRows:s,kernelCols:n,fillNoDataOnly:i,outputPixelType:this.outputPixelType,statisticsType:r,mirrorEdges:!0})}_getWebGLParameters(){let{rows:e,cols:t,statisticsType:r,fillNoDataOnly:s}=this.functionArguments;return{fillNoDataOnly:s,kernelRows:e,kernelCols:t,statisticsType:r,clampRange:(0,l.hP)(this.outputPixelType)}}_getNeighborhoodSize(){let{rows:e,cols:t}=this.functionArguments;return{rows:e,cols:t}}};(0,o.Cg)([(0,a.MZ)({json:{write:!0,name:"rasterFunction"}})],bs.prototype,"functionName",void 0),(0,o.Cg)([(0,a.MZ)({type:vs,json:{write:!0,name:"rasterFunctionArguments"}})],bs.prototype,"functionArguments",void 0),(0,o.Cg)([(0,a.MZ)()],bs.prototype,"rasterArgumentNames",void 0),bs=(0,o.Cg)([(0,a.$K)("esri.layers.raster.functions.StatisticsFunction")],bs);const Cs=bs;var Ms;let Ps=Ms=class extends c{constructor(){super(...arguments),this.statistics=null,this.histograms=null}readStatistics(e,t){if(!e?.length)return null;let r=[];return e.forEach(e=>{let t={min:e.min,max:e.max,avg:e.avg??e.mean,stddev:e.stddev??e.standardDeviation};r.push(t)}),r}writeStatistics(e,t,r){if(!e?.length)return;let s=[];e.forEach(e=>{let t={...e,mean:e.avg,standardDeviation:e.stddev};delete t.avg,delete t.stddev,s.push(t)}),t[r]=s}clone(){return new Ms({statistics:(0,i.o8)(this.statistics),histograms:(0,i.o8)(this.histograms)})}};(0,o.Cg)([(0,a.MZ)({json:{write:!0}})],Ps.prototype,"statistics",void 0),(0,o.Cg)([(0,yt.w)("statistics")],Ps.prototype,"readStatistics",null),(0,o.Cg)([(0,Ft.K)("statistics")],Ps.prototype,"writeStatistics",null),(0,o.Cg)([(0,a.MZ)({json:{write:!0}})],Ps.prototype,"histograms",void 0),Ps=Ms=(0,o.Cg)([(0,a.$K)("esri.layers.raster.functions.StatisticsHistogramFunctionArguments")],Ps);const Ts=Ps;let Ns=class extends w{constructor(){super(...arguments),this.functionName="StatisticsHistogram",this.functionArguments=null,this.rasterArgumentNames=["raster"],this.isNoopProcess=!0}_bindSourceRasters(){let e=this.sourceRasterInfos[0];this.outputPixelType=this._getOutputPixelType("u8");let t=e.clone(),{statistics:r,histograms:s}=this.functionArguments;return s&&(t.histograms=s),r&&(t.statistics=r),this.rasterInfo=t,{success:!0,supportsGPU:!0}}_processPixels(e){return e.pixelBlocks?.[0]}};(0,o.Cg)([(0,a.MZ)({json:{write:!0,name:"rasterFunction"}})],Ns.prototype,"functionName",void 0),(0,o.Cg)([(0,a.MZ)({type:Ts,json:{write:!0,name:"rasterFunctionArguments"}})],Ns.prototype,"functionArguments",void 0),(0,o.Cg)([(0,a.MZ)()],Ns.prototype,"rasterArgumentNames",void 0),(0,o.Cg)([(0,a.MZ)({json:{write:!0}})],Ns.prototype,"indexedColormap",void 0),(0,o.Cg)([(0,a.MZ)()],Ns.prototype,"isNoopProcess",void 0),Ns=(0,o.Cg)([(0,a.$K)("esri.layers.raster.functions.StatisticsHistogramFunction")],Ns);const Rs=Ns;var Is;const ks=new Ee.J({0:"none",3:"standard-deviation",4:"histogram-equalization",5:"min-max",6:"percent-clip",9:"sigmoid"},{useNumericKeys:!0});let Ss=Is=class extends c{constructor(){super(...arguments),this.computeGamma=!1,this.dynamicRangeAdjustment=!1,this.gamma=[],this.histograms=null,this.statistics=null,this.stretchType="none",this.useGamma=!1}writeStatistics(e,t,r){e?.length&&(Array.isArray(e[0])||(e=e.map(e=>[e.min,e.max,e.avg,e.stddev])),t[r]=e)}clone(){return new Is({stretchType:this.stretchType,outputMin:this.outputMin,outputMax:this.outputMax,useGamma:this.useGamma,computeGamma:this.computeGamma,statistics:(0,i.o8)(this.statistics),gamma:(0,i.o8)(this.gamma),sigmoidStrengthLevel:this.sigmoidStrengthLevel,numberOfStandardDeviations:this.numberOfStandardDeviations,minPercent:this.minPercent,maxPercent:this.maxPercent,histograms:(0,i.o8)(this.histograms),dynamicRangeAdjustment:this.dynamicRangeAdjustment,raster:this.raster})}};(0,o.Cg)([(0,a.MZ)({type:Boolean,json:{write:!0}})],Ss.prototype,"computeGamma",void 0),(0,o.Cg)([(0,a.MZ)({type:Boolean,json:{name:"dra",write:!0}})],Ss.prototype,"dynamicRangeAdjustment",void 0),(0,o.Cg)([(0,a.MZ)({type:[Number],json:{write:!0}})],Ss.prototype,"gamma",void 0),(0,o.Cg)([(0,a.MZ)()],Ss.prototype,"histograms",void 0),(0,o.Cg)([(0,a.MZ)({type:Number,json:{write:!0}})],Ss.prototype,"maxPercent",void 0),(0,o.Cg)([(0,a.MZ)({type:Number,json:{write:!0}})],Ss.prototype,"minPercent",void 0),(0,o.Cg)([(0,a.MZ)({type:Number,json:{write:!0}})],Ss.prototype,"numberOfStandardDeviations",void 0),(0,o.Cg)([(0,a.MZ)({type:Number,json:{name:"max",write:!0}})],Ss.prototype,"outputMax",void 0),(0,o.Cg)([(0,a.MZ)({type:Number,json:{name:"min",write:!0}})],Ss.prototype,"outputMin",void 0),(0,o.Cg)([(0,a.MZ)({type:Number,json:{write:!0}})],Ss.prototype,"sigmoidStrengthLevel",void 0),(0,o.Cg)([(0,a.MZ)({json:{type:[[Number]],write:!0}})],Ss.prototype,"statistics",void 0),(0,o.Cg)([(0,Ft.K)("statistics")],Ss.prototype,"writeStatistics",null),(0,o.Cg)([(0,Ye.e)(ks)],Ss.prototype,"stretchType",void 0),(0,o.Cg)([(0,a.MZ)({type:Boolean,json:{write:!0}})],Ss.prototype,"useGamma",void 0),Ss=Is=(0,o.Cg)([(0,a.$K)("esri.layers.raster.functions.StretchFunctionArguments")],Ss);const _s=Ss;let Fs=class extends w{constructor(){super(...arguments),this.functionName="Stretch",this.functionArguments=null,this.rasterArgumentNames=["raster"],this.lookup=null,this.cutOffs=null}_bindSourceRasters(){this.lookup=null,this.cutOffs=null;let e=this.sourceRasterInfos[0],{pixelType:t}=e,{functionArguments:r}=this,{dynamicRangeAdjustment:s,gamma:n,useGamma:i}=r;if(!s&&["u8","u16","s8","s16"].includes(t)){let s=(0,qt.DP)(r.toJSON(),{rasterInfo:e}),o=(0,l.zw)(this.outputPixelType)?"round":"float";this.lookup=(0,qt.RP)({pixelType:t,...s,gamma:i?n:null,rounding:o}),this.cutOffs=s}else s||(this.cutOffs=(0,qt.DP)(r.toJSON(),{rasterInfo:e}));this.outputPixelType=this._getOutputPixelType(t);let o=e.clone();o.pixelType=this.outputPixelType,this._removeStatsHistColormapVAT(o),"u8"===this.outputPixelType&&(o.keyProperties.DataType="processed");let{outputMin:a=0,outputMax:u=255}=this.functionArguments;o.statistics=[];for(let e=0;e<o.bandCount;e++)o.statistics[e]={min:a,max:u};return this.rasterInfo=o,{success:!0,supportsGPU:!s}}_processPixels(e,t){let r=e.pixelBlocks?.[0];if(null==r)return r;let{lookup:s}=this;if(s)return(0,Ke.eH)(r,{...s,outputPixelType:this.rasterInfo.pixelType});let{functionArguments:n}=this,i=t?.stretchCutoff??this.cutOffs??(0,qt.DP)(n.toJSON(),{rasterInfo:this.sourceRasterInfos[0],pixelBlock:r}),o=n.useGamma?n.gamma:null;return(0,qt._N)(r,{...i,gamma:o,outputPixelType:this.outputPixelType})}_getWebGLParameters(){let{outputMin:e=0,outputMax:t=255,gamma:r,useGamma:s}=this.functionArguments,n=this.rasterInfo.bandCount>=2?3:1,i=s&&r?.length?(0,qt.Nh)(n,r):[1,1,1],{minCutOff:o,maxCutOff:a}=this.cutOffs??{minCutOff:[0,0,0],maxCutOff:[255,255,255]};1===o.length&&(o[1]=o[2]=o[0],a[1]=a[2]=a[0]);let u=a.map((r,s)=>(t-e)/(a[s]-o[s])),p=(0,l.zw)(this.outputPixelType);return{bandCount:n,minOutput:e,maxOutput:t,minCutOff:o,maxCutOff:a,factor:u,useGamma:s,gamma:s&&r?[r[0],r[1]??r[0],r[2]??r[0]]:[1,1,1],gammaCorrection:s?[i[0],i[1]??i[0],i[2]??i[0]]:[1,1,1],stretchType:this.functionArguments.stretchType,isOutputRounded:p,type:"stretch"}}};(0,o.Cg)([(0,a.MZ)({json:{write:!0,name:"rasterFunction"}})],Fs.prototype,"functionName",void 0),(0,o.Cg)([(0,a.MZ)({type:_s,json:{write:!0,name:"rasterFunctionArguments"}})],Fs.prototype,"functionArguments",void 0),(0,o.Cg)([(0,a.MZ)()],Fs.prototype,"rasterArgumentNames",void 0),(0,o.Cg)([(0,a.MZ)({json:{write:!0}})],Fs.prototype,"lookup",void 0),(0,o.Cg)([(0,a.MZ)({json:{write:!0}})],Fs.prototype,"cutOffs",void 0),Fs=(0,o.Cg)([(0,a.$K)("esri.layers.raster.functions.StretchFunction")],Fs);const Bs=Fs;var js;let Zs=js=class extends c{constructor(){super(...arguments),this.attributeTableAsRecordSet=null}clone(){return new js({attributeTableAsRecordSet:(0,i.o8)(this.attributeTableAsRecordSet)})}};(0,o.Cg)([(0,a.MZ)({json:{write:!0}})],Zs.prototype,"attributeTableAsRecordSet",void 0),Zs=js=(0,o.Cg)([(0,a.$K)("esri.layers.raster.functions.TableFunctionArguments")],Zs);const Gs=Zs;let zs=class extends w{constructor(){super(...arguments),this.functionName="Table",this.functionArguments=null,this.rasterArgumentNames=["raster"],this.isNoopProcess=!0}_bindSourceRasters(){let e=this.sourceRasterInfos[0];if(e.bandCount>1||e.pixelType.startsWith("f"))return{success:!1,supportsGPU:!1,error:"table-function: Source data must be single band and integer pixel type."};let{attributeTableAsRecordSet:t}=this.functionArguments;if(!t)return{success:!1,supportsGPU:!1,error:"table-function: Missing attributeTableAsRecordSet argument."};this.outputPixelType=this._getOutputPixelType(e.pixelType);let r=e.clone();return r.pixelType=this.outputPixelType,r.bandCount=1,"thematic"!==r.dataType&&(r.keyProperties=r.keyProperties?{...r.keyProperties,DataType:"thematic"}:{DataType:"thematic"}),this.rasterInfo=r,{success:!0,supportsGPU:!0}}_processPixels(e){return e.pixelBlocks?.[0]}};(0,o.Cg)([(0,a.MZ)({json:{write:!0,name:"rasterFunction"}})],zs.prototype,"functionName",void 0),(0,o.Cg)([(0,a.MZ)({type:Gs,json:{write:!0,name:"rasterFunctionArguments"}})],zs.prototype,"functionArguments",void 0),(0,o.Cg)([(0,a.MZ)()],zs.prototype,"rasterArgumentNames",void 0),(0,o.Cg)([(0,a.MZ)()],zs.prototype,"isNoopProcess",void 0),zs=(0,o.Cg)([(0,a.$K)("esri.layers.raster.functions.TableFunction")],zs);const Os=zs,Es=new Map;function Ds(e,t){let{rasterFunctionArguments:r}=e;r&&(r.rasters||[r.raster,r.raster2]).forEach(e=>{e&&"number"!=typeof e&&("string"==typeof e?e.startsWith("http")&&(t.includes(e)||t.push(e)):"rasterFunctionArguments"in e&&Ds(e,t))})}function Vs(e,t){t??={};try{if("function"in(e=(0,i.o8)(e))&&"arguments"in e&&e.arguments){let r=qs(e,new Map,t);if(Xs(r),!r.renderingRule)throw new n.A("raster-function-helper","Unsupported raster function json.");e=r.renderingRule}if("rasterFunction"in e){let r=Ws(e=Ls(e),t);return r.isRoot=!0,r}}catch{}throw new n.A("raster-function-helper","unsupported raster function json.")}function Us(e){return!!(e&&"object"==typeof e&&e.rasterFunction&&e.rasterFunctionArguments)}function Ls(e){let{rasterFunction:t,rasterFunctionArguments:r}=e,s={};for(let e in r){let t=r[e],n=e.toLowerCase();if("rasters"===n&&Array.isArray(t))s.rasters=t.map(e=>Us(e)?Ls(e):e);else switch(Us(t)&&(t=Ls(t)),n){case"dra":s.dra=t;break;case"pspower":s.psPower=t;break;case"pszfactor":s.psZFactor=t;break;case"bandids":s.bandIds=t;break;default:s[e[0].toLowerCase()+e.slice(1)]=t}}return"Local"===t&&!s.rasters?.length&&(s.rasters=["$$"]),{...e,rasterFunctionArguments:s}}function Ws(e,t){let{rasterFunction:r,rasterFunctionArguments:s}=e,i=e.outputPixelType?.toLowerCase();if(null==r||!Es.has(r))throw new n.A("raster-function-helper",`unsupported raster function: ${r}`);let o=Es.get(r),a=("function"==typeof o.ctor?o.ctor:o.ctor.default).fromJSON({...e,outputPixelType:i}),{rasterArgumentNames:l}=a,u=[],p=function(e,t){return"rasters"===t[0]&&Array.isArray(e.rasters)?e.rasters:t.map(t=>e[t])}(s,l),c="rasters"===l[0]||l.length>1,h=[];for(let e=0;e<p.length;e++){let r,s=p[e];null==s||"string"==typeof s&&s.startsWith("$")?u.push(t?.raster):"string"==typeof s?t[s]&&u.push(t[s]):"number"!=typeof s&&"rasterFunction"in s&&(r=Ws(s,t),c||(a.functionArguments[l[e]]=r),u.push(r)),c&&h.push(r??s)}if(c&&("rasters"===l[0]?a.functionArguments.rasters=h:l.forEach((e,t)=>{a.functionArguments[e]=h[t]})),t){a.sourceRasters=u;let e=t.raster?.url;e&&(a.mainPrimaryRasterId=e)}return a}function Ks(e,t){if(e&&t)for(let r in e){let s=e[r];s&&"object"==typeof s&&"type"in s&&("RasterFunctionTemplate"===s.type?Ks(s.arguments,t):"RasterFunctionVariable"===s.type&&null!=t[s.name]&&(s.value=t[s.name]))}}function $s(e,t){if(!e||"object"!=typeof e)return e;let{value:r}=e;if(!r||"object"!=typeof r)return e.isDataset?"$$":r;if(Array.isArray(r))return 0===r.length?[]:r.map(e=>e&&"object"==typeof e&&"RasterFunctionVariable"===e.type?$s(e,t):e);if("value"in r&&["number","string","boolean"].includes(typeof r.value))return r.value;if(e.isDataset&&"Scalar"!==r.type)return"$$";if(!("type"in r))return r;let s=r;switch(r.type){case"Scalar":s=r.value;break;case"AlgorithmicColorRamp":s=Hs(r);break;case"MultiPartColorRamp":s={type:"multipart",colorRamps:r.ArrayOfColorRamp.map(Hs)};break;case"ArgumentArray":if(r.elements?.length&&"RasterStatistics"!==r.elements[0].type){let e=[];for(let s=0;s<r.elements.length;s++){let i=r.elements[s],{type:o}=i;if(o)if("RasterFunctionTemplate"===o){let{renderingRule:r}=qs(i,t);e.push(r),null!=i._object_id&&t.set(i._object_id,r)}else{if("RasterFunctionVariable"!==o)throw new n.A("raster-function-helper","unsupported raster function json.");{let r=$s(i,t);e.push(r),null!=i._object_id&&t.set(i._object_id,r)}}else e.push(i)}s=e}else s=r.elements}return null!=r._object_id&&t.set(r._object_id,s),s}function Hs(e){let t=e.algorithm??"esriHSVAlgorithm",{FromColor:r,ToColor:n}=e;if(!Array.isArray(r)){let{r:e,g:t,b:n}=(0,s.$)({h:r.Hue,s:r.Saturation,v:r.Value});r=[e,t,n,r.AlphaValue]}if(!Array.isArray(n)){let{r:e,g:t,b:r}=(0,s.$)({h:n.Hue,s:n.Saturation,v:n.Value});n=[e,t,r,n.AlphaValue]}return{type:"algorithmic",algorithm:t,fromColor:r,toColor:n}}function qs(e,t,r){r&&Ks(e,r);let s={renderingRule:{},templates:t};return Js(e,s),s}function Js(e,t){if(!e||!t.renderingRule)return;let{renderingRule:r,templates:s}=t,{function:n,arguments:i,_object_id:o}=e;if(!n||!i)return;null!=o&&s.set(o,r),r.rasterFunction=n.type.replace("Function",""),r.outputPixelType=n.pixelType;let a={};r.rasterFunctionArguments=a;for(let e in i){if("type"===e||"object_id"===e||"_object_ref_id"===e)continue;let t=i[e];!t||"object"!=typeof t||!("type"in t)||"RasterFunctionTemplate"!==t.type&&"RasterFunctionVariable"!==t.type?a[e]=t:("RasterFunctionVariable"===t.type?a[e]=$s(t,s):(r.rasterFunctionArguments[e]={},Js(t,{renderingRule:r.rasterFunctionArguments[e],templates:s})),null!=t._object_id&&s.set(t._object_id,a[e]))}switch(a.DEM&&!a.Raster&&(a.Raster=a.DEM,delete a.DEM),r.rasterFunction){case"Stretch":!function(e){e.Statistics?.length&&"object"==typeof e.Statistics&&(e.Statistics=e.Statistics.map(e=>[e.min,e.max,e.mean,e.standardDeviation])),null!=e.NumberOfStandardDeviation&&(e.NumberOfStandardDeviations=e.NumberOfStandardDeviation,delete e.NumberOfStandardDeviation)}(a);break;case"Colormap":!function(e){"randomcolorramp"===e.ColorRamp?.type?.toLowerCase()&&(delete e.ColorRamp,e.ColormapName="Random"),0===e.ColorSchemeType&&delete e.ColorRamp}(a);break;case"Convolution":!function(e){null!=e.ConvolutionType&&(e.Type=e.ConvolutionType,delete e.ConvolutionType)}(a);break;case"Mask":!function(e){e.NoDataValues?.length&&"string"==typeof e.NoDataValues[0]&&(e.NoDataValues=e.NoDataValues.filter(e=>""!==e).map(e=>Number(e)))}(a)}}function Xs(e){let{renderingRule:t,templates:r}=e;if("object"!=typeof t||!t?.rasterFunctionArguments||!r.size)return;let{rasterFunctionArguments:s}=t;for(let e in s){let t=s[e],i="_object_ref_id"===e?t:t&&"object"==typeof t&&"_object_ref_id"in t?t._object_ref_id:null;if(null!=i){if(!r.has(i))throw new n.A("raster-function-helper",`unsupported raster function json. _object_ref_id: ${i} does not exist`);let t=r.get(i);"_object_ref_id"===e?t&&"object"==typeof t&&Object.assign(s,t):s[e]=t}else t&&"object"==typeof t&&(t.rasterFunctionArguments&&Xs({renderingRule:t,templates:r}),Array.isArray(t)&&t.forEach((e,s)=>{if(e&&"object"==typeof e)if(null!=e._object_ref_id){if(!r.has(e._object_ref_id))throw new n.A("raster-function-helper",`unsupported raster function json. _object_ref_id: ${t} does not exist`);let o=r.get(i);o&&"object"==typeof o?Object.assign(e,o):t[s]=o}else Xs({renderingRule:e,templates:r})}))}}Es.set("Arithmetic",{desc:"Arithmetic Function",ctor:Fe,rasterArgumentNames:["rasters"]}),Es.set("Aspect",{desc:"Aspect Function",ctor:Oe,rasterArgumentNames:["raster"]}),Es.set("BandArithmetic",{desc:"Band Arithmetic Function",ctor:st,rasterArgumentNames:["raster"]}),Es.set("Colormap",{desc:"Colormap Function",ctor:Mt,rasterArgumentNames:["raster"]}),Es.set("ColormapToRGB",{desc:"ColormapToRGB Function",ctor:St,rasterArgumentNames:["raster"]}),Es.set("CompositeBand",{desc:"CompositeBand Function",ctor:Gt,rasterArgumentNames:["rasters"]}),Es.set("ComputeChange",{desc:"ComputeChange Function",ctor:Wt,rasterArgumentNames:["rasters"]}),Es.set("Convolution",{desc:"Convolution Function",ctor:or,rasterArgumentNames:["raster"]}),Es.set("ContrastBrightness",{desc:"Contrast Brightness Function",ctor:Xt,rasterArgumentNames:["raster"]}),Es.set("ExtractBand",{desc:"ExtractBand Function",ctor:yr,rasterArgumentNames:["raster"]}),Es.set("Curvature",{desc:"Curvature Function",ctor:hr,rasterArgumentNames:["raster"]}),Es.set("Hillshade",{desc:"Hillshade Function",ctor:kr,rasterArgumentNames:["raster"]}),Es.set("ShadedRelief",{desc:"ShadedRelief Function",ctor:rs,rasterArgumentNames:["raster"]}),Es.set("Grayscale",{desc:"Grayscale Function",ctor:Cr,rasterArgumentNames:["raster"]}),Es.set("Clip",{desc:"Clip Function",ctor:mt,rasterArgumentNames:["raster"]}),Es.set("Local",{desc:"Local Function",ctor:jr,rasterArgumentNames:["rasters"]}),Es.set("Mask",{desc:"Mask Function",ctor:Dr,rasterArgumentNames:["raster"]}),Es.set("NDVI",{desc:"NDVI Function",ctor:Kr,rasterArgumentNames:["raster"]}),Es.set("Remap",{desc:"Remap Function",ctor:Xr,rasterArgumentNames:["raster"]}),Es.set("Slope",{desc:"Slope Function",ctor:ls,rasterArgumentNames:["raster"]}),Es.set("SpectralConversion",{desc:"Spectral Conversion",ctor:ms,rasterArgumentNames:["raster"]}),Es.set("Statistics",{desc:"Focal Statistics Function",ctor:Cs,rasterArgumentNames:["raster"]}),Es.set("StatisticsHistogram",{desc:"Statistics Histogram Function",ctor:Rs,rasterArgumentNames:["raster"]}),Es.set("Stretch",{desc:"Stretch Function",ctor:Bs,rasterArgumentNames:["raster"]}),Es.set("Table",{desc:"Attribute Table Function",ctor:Os,rasterArgumentNames:["raster"]})},37373(e,t,r){r.d(t,{DO:()=>z,FT:()=>B,Hh:()=>b,OM:()=>G,Ps:()=>V,Wo:()=>C,_I:()=>P,_l:()=>S,l0:()=>O,t$:()=>U,uk:()=>_});var s=r(4576),n=r(49186),i=r(86211),o=r(5443),a=r(83290),l=r(86738),u=r(39829),p=r(99917),c=r(16930),h=r(21325);function m(){if(!v)throw new n.A("rasterprojectionhelper-project","projection operator is not loaded")}const f=(e,t,r,s=0)=>{if(1===r[0])return[0,0];let n=1,i=-1,o=1,a=-1;for(let t=0;t<e.length;t+=2)isNaN(e[t])||(n=n>e[t]?e[t]:n,i=i>e[t]?i:e[t],o=o>e[t+1]?e[t+1]:o,a=a>e[t+1]?a:e[t+1]);let{cols:l,rows:u}=t,p=(i-n)/l/r[0],c=(a-o)/u/r[1],h=2*s,m=0,f=!1,g=[0,0];for(let t=0;t<l-3;t++){for(let r=0;r<u-3;r++){let s=t*u*2+2*r,n=(e[s]+e[s+4]+e[s+4*u]+e[s+4*u+4])/4,i=(e[s+1]+e[s+5]+e[s+4*u+1]+e[s+4*u+5])/4,o=Math.abs((n-e[s+2*u+2])/p),a=Math.abs((i-e[s+2*u+3])/c);if(o+a>m&&(m=o+a,g=[o,a]),h&&m>h){f=!0;break}}if(f)break}return g},g={3395:20037508.342789244,3410:17334193.943686873,3857:20037508.342788905,3975:17367530.445161372,4087:20037508.342789244,4088:20015108.787169147,6933:17367530.445161372,32662:20037508.342789244,53001:20015086.79602057,53002:10007543.39801029,53003:20015086.79602057,53004:20015086.79602057,53016:14152803.599503474,53017:17333573.624304302,53034:20015086.79602057,53079:20015114.352186374,53080:20015114.352186374,54001:20037508.342789244,54002:10018754.171394624,54003:20037508.342789244,54004:20037508.342789244,54016:14168658.027268292,54017:17367530.44516137,54034:20037508.342789244,54079:20037508.342789244,54080:20037508.342789244,54100:20037508.342789244,54101:20037508.342789244},d=new Map,y=new Map;let x,w,A,v=!1;async function b(){return x||(x=Promise.withResolvers(),w=await r.e(3276).then(()=>r(83276)),A=await r.e(2158).then(()=>r(12158)),w.projectIsLoaded()||await w.projectLoad(),A.isLoaded()||await A.load(),v=!0,x.resolve()),x.promise}function C(e,t,r,s){let n=e.spatialReference;if(!n||!t||n.equals(t))return e;m();let a=r.center,l=new o.A({xmin:a.x-e.x/2,xmax:a.x+e.x/2,ymin:a.y-e.y/2,ymax:a.y+e.y/2,spatialReference:n}),u=w.projectExecute(l,t,{geographicTransformation:s}),p=B(t);return null==u||null!=p&&u.width>=p?function(e,t,r){let s=(0,i.GA)(t)/(0,i.GA)(r);return{x:e.x*s,y:e.y*s}}(e,n,t):{x:u.width,y:u.height}}function M(e,t=.01){return(0,i.GA)(e)?t/(0,i.GA)(e):0}function P(e,t,r,s=!0){let n=e.spatialReference;if(n.equals(t))return e;m();let i=w.projectExecute(e,t,{geographicTransformation:r});return!s||!i||T([e],[i],n,t),i}function T(e,t,r,s){let n=j(r,!0),i=j(s,!0),o=M(r,500),a=M(s,500);if(o&&null!=n&&null!=i)for(let r=0;r<e.length;r++){let s=t[r];if(!s)continue;let{x:l}=e[r],{x:u}=s;u>=i[1]-a&&Math.abs(l-n[0])<o?s.x-=i[1]-i[0]:u<=i[0]+a&&Math.abs(l-n[1])<o&&(s.x+=i[1]-i[0])}}function N(e){let{inSR:t,outSR:r,preferPE:s}=e;if(t.equals(r)){let{points:t}=k(e,null);return t}return t.isWebMercator&&r.isWGS84||t.isWGS84&&r.isWebMercator?function(e){let{cols:t,rows:r,xres:s,yres:n,usePixelCenter:i,inSR:o,outSR:a}=e,{xmin:u,ymax:c}=e;i&&(u+=s/2,c-=n/2);let h=[],m=[],f=Math.max(t,r);for(let e=0;e<f;e++){let i=u+s*Math.min(t,e),f=c-n*Math.min(r,e),g=(0,p.projectWithoutEngine)(new l.A({x:i,y:f,spatialReference:o}),o,a);e<=t&&h.push(g.x),e<=r&&m.push(g.y)}let g=[];for(let e=0;e<t;e++)for(let t=0;t<r;t++)g.push([h[e],m[t]]);return g}(e):s&&(t.isGeographic||null!=R(t))?function(e){let{inSR:t,outSR:r,datumTransformation:s}=e,{points:n,mask:i}=k(e,R(t));if(!t.isGeographic){let e=t.wkid?a.P.coordsys(t.wkid):a.P.fromString(t.isGeographic?a.a.PE_TYPE_GEOGCS:a.a.PE_TYPE_PROJCS,t.wkt2||t.wkt);a.c.projToGeog(e,n.length,n)}if(null!=s&&s.steps.length){let e,t=179.9955;if(r.isGeographic&&(e=n.map(([e])=>e>t?1:e<-179.9955?-1:0)),s.steps.forEach(e=>{let t=e.wkid?a.P.geogtran(e.wkid):a.P.fromString(a.a.PE_TYPE_GEOGTRAN,e.wkt);a.d.geogToGeog(t,n.length,n,null,e.isInverse?a.a.PE_TRANSFORM_2_TO_1:a.a.PE_TRANSFORM_1_TO_2)}),e)for(let r=0;r<n.length;r++){let s=e[r],i=n[r][0],o=i>t?1:i<-179.9955?-1:0;s&&o&&s!==o&&(n[r][0]=s>0?i+360:i-360)}}if(!r.isGeographic){let e=R(r,!0);!function(e,t){let[r,s]=t;for(let t=0;t<e.length;t++){let n=e[t][1];(n<r||n>s)&&(e[t]=[NaN,NaN])}}(n,null!=e&&e.isEnvelope?[e.bbox[1],e.bbox[3]]:[-90,90]);let t=r.wkid?a.P.coordsys(r.wkid):a.P.fromString(r.isGeographic?a.a.PE_TYPE_GEOGCS:a.a.PE_TYPE_PROJCS,r.wkt2||r.wkt);a.c.geogToProj(t,n.length,n)}let o=n;if(i&&n.length!==i.length){o=[];for(let e=0,t=0;e<i.length;e++)i[e]?o.push(n[t++]):o.push([NaN,NaN])}return o}(e):function(e){let{points:t}=k(e,null),{inSR:r,outSR:s,datumTransformation:n}=e,i=t.map(e=>new l.A(e[0],e[1],r)),o=w.projectExecuteMany(i,s,{geographicTransformation:n});return n&&T(i,o,r,s),o.map(e=>e?[e.x,e.y]:[NaN,NaN])}(e)}function R(e,t=!1){let r=e.wkid||e.wkt2||e.wkt;if(!r||e.isGeographic)return null;if(r=String(r),d.has(r)){let e=d.get(r);return t?e?.gcs:e?.pcs}let s=e.wkid?a.P.coordsys(e.wkid):a.P.fromString(e.isGeographic?a.a.PE_TYPE_GEOGCS:a.a.PE_TYPE_PROJCS,e.wkt2||e.wkt),n=I(s,M(e,1e-4)),i=I(s,0,!0);return d.set(r,{pcs:n,gcs:i}),t?i:n}function I(e,t=0,r=!1){let s=a.b.generate(e),n=r?e.horizonGcsGenerate():e.horizonPcsGenerate();if(!s||!n?.length)return null;let i=!1,o=n.find(e=>1===e.getInclusive()&&1===e.getKind());if(!o){if(o=n.find(e=>1===e.getInclusive()&&0===e.getKind()),!o)return null;i=!0}let l=r?0:+(2===s.getNorthPoleLocation())|(2===s.getSouthPoleLocation()?2:0),u=s.isPannableRectangle(),p=o.getCoord();if(i)return{isEnvelope:i,isPannable:u,vertices:p,coef:null,bbox:[p[0][0]-t,p[0][1]-t,p[1][0]+t,p[1][1]+t],poleLocation:l};let c=0,h=[],[m,f]=p[0],[g,d]=p[0];for(let e=0,t=p.length;e<t;e++){c++,c===t&&(c=0);let[r,s]=p[e],[n,i]=p[c];if(i===s)h.push([r,n,s,i,2]);else{let e=(n-r)/(i-s||1e-4),t=r-e*s;s<i?h.push([e,t,s,i,0]):h.push([e,t,i,s,1])}m=m<r?m:r,f=f<s?f:s,g=g>r?g:r,d=d>s?d:s}return{isEnvelope:!1,isPannable:u,vertices:p,coef:h,bbox:[m,f,g,d],poleLocation:l}}function k(e,t){let r=[],{cols:s,rows:n,xres:i,yres:o,usePixelCenter:a}=e,{xmin:l,ymax:u}=e;if(a&&(l+=i/2,u-=o/2),null==t){for(let e=0;e<s;e++)for(let t=0;t<n;t++)r.push([l+i*e,u-o*t]);return{points:r}}let p=new Uint8Array(s*n);if(t.isEnvelope){let{isPannable:e,bbox:[a,c,h,m]}=t;for(let t=0,f=0;t<s;t++){let s=l+i*t,g=e||s>=a&&s<=h;for(let e=0;e<n;e++,f++){let t=u-o*e;g&&t>=c&&t<=m&&(r.push([s,t]),p[f]=1)}}return{points:r,mask:p}}let c=t.coef,h=[];for(let e=0;e<n;e++){let t=u-o*e,r=[],s=[];for(let e=0;e<c.length;e++){let[n,i,o,a,l]=c[e];if(t===o&&o===a)r.push(n),r.push(i),s.push(2),s.push(2);else if(t>=o&&t<=a){let e=n*t+i;r.push(e),s.push(l)}}let n=r;if(r.length>2){let e=2===s[0]?0:s[0],t=r[0];n=[];for(let i=1;i<s.length;i++)(2!==s[i]||i===s.length-1)&&(s[i]!==e&&(n.push(0===e?Math.min(t,r[i-1]):Math.max(t,r[i-1])),e=s[i],t=r[i]),i===s.length-1&&n.push(0===s[i]?Math.min(t,r[i]):Math.max(t,r[i])));n.sort((e,t)=>e-t)}else r[0]>r[1]&&(n=[r[1],r[0]]);h.push(n)}for(let e=0,t=0;e<s;e++){let s=l+i*e;for(let e=0;e<n;e++,t++){let n=u-o*e,i=h[e];if(2===i.length)s>=i[0]&&s<=i[1]&&(r.push([s,n]),p[t]=1);else if(i.length>2){let e=!1;for(let t=0;t<i.length;t+=2)if(s>=i[t]&&s<=i[t+1]){e=!0;break}e&&(r.push([s,n]),p[t]=1)}}}return{points:r,mask:p}}function S(e,t,r=null,n=!0){let i=e.spatialReference;if(i.equals(t)||!t)return e;let a=G(e),l=B(i,!0),p=B(t);if(0===a||null==l||null==p){let s=F(e,t,r,n);if(s&&null==l&&null!=p&&Math.abs(s.width-p)<M(t)&&w.projectIsLoaded()){let r=R(i);if(null!=r&&0===r.poleLocation&&e.width<(r.bbox[2]-r.bbox[0])/2)return function(e,t){let r=B(t);if(null==r)return null;let{xmin:s,ymin:n,xmax:i,ymax:a}=e,l=e.spatialReference,p=new u.A({spatialReference:l,rings:[[[s,n],[i,n],[i,a],[s,a],[s,n]]]}),c=w.projectExecute(p,t);if(2!==c.rings.length||!c.rings[0].length||!c.rings[1].length)return null;let{rings:h}=c,m=M(l),f=new o.A({spatialReference:t});for(let e=0;e<2;e++){s=i=h[e][0][0],n=a=h[e][0][1];for(let t=0;t<h[e].length;t++)s=s>h[e][t][0]?h[e][t][0]:s,i=i<h[e][t][0]?h[e][t][0]:i,n=n>h[e][t][1]?h[e][t][1]:n,a=a<h[e][t][1]?h[e][t][1]:a;if(0===e)f.ymin=n,f.ymax=a,f.xmin=s,f.xmax=i;else if(f.ymin=Math.min(f.ymin,n),f.ymax=Math.max(f.ymax,a),Math.abs(i-r/2)<m)f.xmin=s,f.xmax+=r;else{if(!(Math.abs(s+r/2)<m))return null;f.xmax=i+r}}return f}(e,t)||s}return s}let c=e.clone().normalize();if(1===c.length&&e.xmax<l&&e.xmax-l/2>M(i)){let{xmin:t,xmax:r}=e;for(let s=0;s<=a;s++){let n=0===s?t:-l/2,u=s===a?r-l*s:l/2;c[s]=new o.A({xmin:n,xmax:u,ymin:e.ymin,ymax:e.ymax,spatialReference:i})}}let h=c.map(e=>F(e,t,r,n)).filter(s.Ru);return 0===h.length?null:function(e,t){let r=B(e[0].spatialReference);if(e.length<2||null==r||(t??=M(e[0].spatialReference),1===(e=e.filter(e=>e.width>t)).length))return e[0];let{xmin:s,xmax:n,ymin:i,ymax:a}=e[0];for(let t=1;t<e.length;t++){let s=e[t];n=s.xmax+r*t,i=Math.min(i,s.ymin),a=Math.max(a,s.ymax)}return new o.A({xmin:s,xmax:n,ymin:i,ymax:a,spatialReference:e[0].spatialReference})}(h)}function _(e,t,r){if("extent"===e.type){let{xmin:t,ymin:r,xmax:s,ymax:n,spatialReference:i}=e;e=new u.A({rings:[[[t,n],[s,n],[s,r],[t,r],[t,n]]],spatialReference:i})}return e.spatialReference.equals(t)?e:(m(),w.projectExecute(e,t,{geographicTransformation:r}))}function F(e,t,r,s=!0,n=!0){let i=e.spatialReference;if(i.equals(t)||!t)return e;m();let o=w.projectExecute(e,t,{geographicTransformation:r});if(n&&t.isWebMercator&&o&&(o.ymax=Math.min(20037508.342787,o.ymax),o.ymin=Math.max(-20037508.342787,o.ymin),o.ymin>=o.ymax))return null;if(!s||!o)return o;let a=j(i,!0),u=j(t,!0);if(null==a||null==u)return o;let p=M(i,.001),c=M(i,500),h=M(t,.001);if(Math.abs(o.xmin-u[0])<h&&Math.abs(o.xmax-u[1])<h){let s=Math.abs(e.xmin-a[0]),n=Math.abs(a[1]-e.xmax);if(s<p&&n>c){o.xmin=u[0];let s=[];s.push(new l.A(e.xmax,e.ymin,i)),s.push(new l.A(e.xmax,(e.ymin+e.ymax)/2,i)),s.push(new l.A(e.xmax,e.ymax,i));let n=s.map(e=>P(e,t,r)).filter(e=>!isNaN(e?.x)).map(e=>e.x);o.xmax=Math.max.apply(null,n)}if(n<p&&s>c){o.xmax=u[1];let s=[];s.push(new l.A(e.xmin,e.ymin,i)),s.push(new l.A(e.xmin,(e.ymin+e.ymax)/2,i)),s.push(new l.A(e.xmin,e.ymax,i));let n=s.map(e=>P(e,t,r)).filter(e=>!isNaN(e?.x)).map(e=>e.x);o.xmin=Math.min.apply(null,n)}}else{let e=M(t,.001);Math.abs(o.xmin-u[0])<e&&(o.xmin=u[0]),Math.abs(o.xmax-u[1])<e&&(o.xmax=u[1])}return o}function B(e,t=!1){if(!e)return null;let r=t?20037508.342787:20037508.342788905;return e.isWebMercator?2*r:e.wkid&&e.isGeographic?360:2*g[e.wkid]||null}function j(e,t=!1){if(e.isGeographic)return[-180,180];let r=B(e,t);return r?[-r/2,r/2]:null}function Z(e,t,r,s){let n=(e-t)/r;return n-Math.floor(n)===0?s&&--n:n=Math.floor(n),n}function G(e,t=!1){let r=B(e.spatialReference);if(null==r)return 0;let s=t?0:-r/2,n=M(e.spatialReference),i=!t&&Math.abs(e.xmax-r/2)<n?r/2:e.xmax,o=!t&&Math.abs(e.xmin+r/2)<n?-r/2:e.xmin;return Z(i,s,r,!0)-Z(o,s,r,!1)}function z(e){let t=e.storageInfo.origin.x,r=B(e.spatialReference,!0);if(null==r)return{originX:t,halfWorldWidth:null,pyramidsInfo:null};let s=r/2,{nativePixelSize:n,storageInfo:i,extent:o}=e,{maximumPyramidLevel:a,blockWidth:l,pyramidScalingFactor:u}=i,p=n.x,c=[],h=null!=e.transform&&"gcs-shift"===e.transform.type,m=Math.max(0,t+(h?0:s));for(let e=0;e<=a;e++){let e=(o.xmax-t)/p/l,s=e-Math.floor(e)===0?e:Math.ceil(e),n=Math.round(m/p),i=Math.round(r/p)-n,a=Math.ceil(i/l),h=Math.floor(n/l),f=n%l,g=(l-i%l)%l;c.push({resolutionX:p,blockWidth:l,datasetColumnCount:s,worldColumnCountFromOrigin:a,leftMargin:f,rightPadding:g,originColumnOffset:h}),p*=u}return{originX:t,halfWorldWidth:s,pyramidsInfo:c,hasGCSSShiftTransform:h}}function O(e){let t=e.isAdaptive&&null==e.spacing,r=e.spacing||[32,32],s=E(e),n={cols:s.size[0]+1,rows:s.size[1]+1},i=s.outofBoundPointCount>0&&s.outofBoundPointCount<s.offsets.length/2,o=s.outofBoundPointCount===s.offsets.length/2||t&&i?[0,0]:f(s.offsets,n,r,4),l=(o[0]+o[1])/2,u=e.projectedExtent.spatialReference,p=e.srcBufferExtent.spatialReference;if(t&&(i||l>4)&&(u.isGeographic||R(u),r=[4,4],s=E({...e,spacing:r}),n={cols:s.size[0]+1,rows:s.size[1]+1},o=f(s.offsets,n,r,4)),s.error=o,r[0]>1&&(s.coefficients=D(s.offsets,n,i)),e.includeGCSGrid&&!u.isGeographic&&!u.isWebMercator)if(p.isGeographic)s.gcsGrid={offsets:s.offsets,coefficients:s.coefficients,spacing:r};else{let t=R(u);if(null!=t&&!t.isEnvelope){let t=function(e){if(!e||e.isGeographic)return e;let t,r=String(e.wkid||e.wkt2||e.wkt);return y.has(r)?t=y.get(r):(t=(e.wkid?a.P.coordsys(e.wkid):a.P.fromString(a.a.PE_TYPE_PROJCS,e.wkt2||e.wkt)).getGeogcs().getCode(),y.set(r,t)),new c.A({wkid:t})}(u),o=S(e.projectedExtent,t),{offsets:l}=E({...e,srcBufferExtent:o,spacing:r}),p=D(l,n,i);s.gcsGrid={offsets:l,coefficients:p,spacing:r}}}return s}function E(e){let{projectedExtent:t,srcBufferExtent:r,pixelSize:s,datumTransformation:n,rasterTransform:i}=e,o=t.spatialReference,a=r.spatialReference;m();let u,{xmin:p,ymin:c,xmax:h,ymax:f}=t,g=B(a),d=null!=g&&(e.hasWrapAround||"gcs-shift"===i?.type),y=e.spacing||[32,32],x=y[0]*s.x,w=y[1]*s.y,A=1===y[0],v=Math.ceil((h-p)/x-.1/y[0])+ +!A,b=Math.ceil((f-c)/w-.1/y[1])+ +!A,C=N({cols:v,rows:b,xmin:p,ymax:f,xres:x,yres:w,inSR:o,outSR:a,datumTransformation:n,preferPE:y[0]<=4,usePixelCenter:A}),P=[],T=0,I=A?-1:NaN,{xmin:k,xmax:S,ymax:_,width:F,height:j}=r,Z=M(a,500),G=null!=g&&k>0&&S>g/2,z=R(o),O=null!=z&&z.poleLocation>0;for(let e=0;e<v;e++){let t=[];for(let r=0;r<b;r++){let s=C[e*b+r];if(d&&s[0]>S&&s[0]>g/2-Z?s[0]-=g:d&&0===e&&s[0]<0&&G&&!i&&(s[0]+=g),!s||isNaN(s[0])||isNaN(s[1]))P.push(I),P.push(I),t.push(null),T++;else{if(i){let e=i.inverseTransform(new l.A({x:s[0],y:s[1],spatialReference:a}));s=[e.x,e.y]}t.push(s),e>0&&d&&u[r]&&s[0]<u[r][0]&&(s[0]+=g,O&&s[0]>S&&s[0]>g&&(s[0]-=g)),P.push((s[0]-k)/F),P.push((_-s[1])/j)}}u=t}return{offsets:P,error:null,coefficients:null,outofBoundPointCount:T,spacing:y,size:A?[v,b]:[v-1,b-1]}}function D(e,t,r){let{cols:s,rows:n}=t,i=new Float32Array((s-1)*(n-1)*2*6),o=new Float32Array([-0,-1,1,-1,1,-0,1,-0,-0]),a=new Float32Array([-1,1,0,0,-1,1,1,0,0]);for(let t=0;t<s-1;t++){for(let r=0;r<n-1;r++){let l=t*n*2+2*r,u=e[l],p=e[l+1],c=e[l+2],h=e[l+3];l+=2*n;let m=e[l],f=e[l+1],g=e[l+2],d=e[l+3],y=0,x=12*(r*(s-1)+t);for(let e=0;e<3;e++)i[x++]=o[y++]*u+o[y++]*c+o[y++]*g;y=0;for(let e=0;e<3;e++)i[x++]=o[y++]*p+o[y++]*h+o[y++]*d;y=0;for(let e=0;e<3;e++)i[x++]=a[y++]*u+a[y++]*m+a[y++]*g;y=0;for(let e=0;e<3;e++)i[x++]=a[y++]*p+a[y++]*f+a[y++]*d}if(r)for(let e=0;e<i.length;e++)isNaN(i[e])&&(i[e]=-1)}return i}function V(e){let{spatialReference:t}=e,r=(0,h.Vp)(t);if(!r)return e;let[s,n]=r.valid,i=n-s,a=0;if(e.xmin<s){let t=s-e.xmin;a=Math.ceil(t/i)}else if(e.xmin>n){let t=e.xmin-n;a=-Math.ceil(t/i)}return new o.A({spatialReference:e.spatialReference,xmin:e.xmin+a*i,ymin:e.ymin,xmax:e.xmax+a*i,ymax:e.ymax})}function U(e,t,r){let{storageInfo:s,pixelSize:n}=t,o=0,a=!1,{pyramidResolutions:u}=s,p="mixed"===s.tileInfo.format?.toLowerCase()?Math.max(1,Math.min(3,s.tileInfo.dpi/96)):1,c=(e.x+e.y)/2/p;if(null!=u&&u.length){let e=u[u.length-1],s=(e.x+e.y)/2,p=(n.x+n.y)/2;if(c<=p)o=0;else if(c>=s)o=u.length,a=c/s>8;else{let e,t=p;for(let s=1;s<=u.length;s++){if(e=(u[s-1].x+u[s-1].y)/2,c<=e){c===e?o=s:"down"===r?(o=s-1,a=c/t>8):o="up"===r||c-t>e-c||c/t>2?s:s-1;break}t=e}}let h=0===o?n:u[o-1];return a&&Math.min(h.x,h.y)*(0,i.GA)(t.spatialReference)>19567&&(a=!1),{pyramidLevel:o,pyramidResolution:new l.A({x:h.x,y:h.y,spatialReference:t.spatialReference}),excessiveReading:a}}let h=Math.log(e.x/n.x)/Math.LN2,m=Math.log(e.y/n.y)/Math.LN2,f=t.storageInfo.maximumPyramidLevel||0;o="down"===r?Math.floor(Math.min(h,m)):"up"===r?Math.ceil(Math.max(h,m)):Math.round((h+m)/2),o<0?o=0:o>f&&(a=o>f+3,o=f);let g=2**o;return{pyramidLevel:o,pyramidResolution:new l.A({x:g*t.nativePixelSize.x,y:g*t.nativePixelSize.y,spatialReference:t.spatialReference}),excessiveReading:a}}}}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";(self.webpackChunkRemoteClient=self.webpackChunkRemoteClient||[]).push([[1484],{66344(t,e,i){i.d(e,{q:()=>o});const s=!!(0,i(44208).A)("esri-tests-disable-gpu-memory-measurements");Symbol.iterator;class r{get size(){return this._size}constructor(t=10485760,e=.3){this._maxSize=t,this._maxClientSizeRatio=e,this._db=new Map,this._size=0,this._hit=0,this._miss=0,this._clients=new Map,this._sizeLimits=new Map}destroy(){this.clearAll(),this._sizeLimits.clear(),this._clients.clear(),this._db.clear()}register(t){this._clients.set(t.id.slice(0,-1),t)}deregister(t){this.clear(t),this._sizeLimits.delete(t),this._clients.delete(t.id.slice(0,-1))}get maxSize(){return this._maxSize}set maxSize(t){this._maxSize=Math.max(t,-1),this._checkSize()}get _maxClientSize(){return this._maxSize*this._maxClientSizeRatio}getSize(t,e){return this._db.get(t.id+e)?.size??0}put(t,e,i,r,a){e=t.id+e;let o=this._db.get(e);if(o&&(this._size-=o.size,t.size-=o.size,this._db.delete(e),o.entry!==i&&this._notifyRemove(e,o.entry,o.size,0)),r>this._maxSize)return void this._notifyRemove(e,i,r,0);if(void 0===i)return void console.warn("Refusing to cache undefined entry ");if(!r||r<0)return s||console.warn(`Refusing to cache entry with size ${r} for key ${e}`),void this._notifyRemove(e,i,0,0);let u=1+Math.max(a,-4)- -3;this._db.set(e,new n(i,r,u)),this._size+=r,t.size+=r,this._checkSize()}updateSize(t,e){e=t.id+e;let i=this._db.get(e);if(!i)return;this._size-=i.size,t.size-=i.size;let s=i.entry.usedMemory;for(;s>this._maxSize;){let t=this._notifyRemove(e,i.entry,s,1);if(!(null!=t&&t>0))return void this._db.delete(e);s=t}i.size=s,this._size+=s,t.size+=s,this._checkSize()}pop(t,e){e=t.id+e;let i=this._db.get(e);if(i)return this._size-=i.size,t.size-=i.size,this._db.delete(e),++this._hit,i.entry;++this._miss}get(t,e){e=t.id+e;let i=this._db.get(e);if(void 0!==i)return this._db.delete(e),i.lives=i.lifetime,this._db.set(e,i),++this._hit,i.entry;++this._miss}peek(t,e){let i=this._db.get(t.id+e);return i?++this._hit:++this._miss,i?.entry}get performanceInfo(){let t={Size:Math.round(this._size/1048576)+"/"+Math.round(this._maxSize/1048576)+"MB","Hit rate":Math.round(100*this._getHitRate())+"%",Entries:this._db.size.toString()},e={},i=[];this._db.forEach((t,s)=>{let r=t.lifetime;i[r]=(i[r]||0)+t.size,this._clients.forEach(i=>{let{id:r,name:n}=i;if(s.startsWith(r)){let i=e[n]||0;e[n]=i+t.size}})});let s={};this._clients.forEach(t=>{let i=t.name;if("hitRate"in t&&"number"==typeof t.hitRate&&!isNaN(t.hitRate)&&t.hitRate>0){let r=e[i]||0;e[i]=r,s[i]=Math.round(100*t.hitRate)+"%"}else s[i]="0%"});let r=Object.keys(e);r.sort((t,i)=>e[i]-e[t]),r.forEach(i=>t[i]=Math.round(e[i]/2**20)+"MB / "+s[i]);for(let e=i.length-1;e>=0;--e){let s=i[e];s&&(t["Priority "+(e+-3-1)]=Math.round(s/this._size*100)+"%")}return t}resetStats(){this._hit=this._miss=0,this._clients.forEach(t=>t.resetHitRate())}clear(t){let e=t.id;this._db.forEach((t,i)=>{i.startsWith(e)&&(this._size-=t.size,this._db.delete(i),this._notifyRemove(i,t.entry,t.size,0))}),t.size=0}clearAll(){this._db.forEach((t,e)=>this._notifyRemove(e,t.entry,t.size,0)),this._clients.forEach(t=>t.size=0),this._size=0,this._db.clear()}*values(t){for(let[e,i]of this._db)e.startsWith(t.id)&&(yield i.entry)}_getHitRate(){return this._hit/(this._hit+this._miss)}_notifyRemove(t,e,i,s){let r=this._clients.get(t.split(a)[0])?.removeFunc,n=r?.(e,s,i);return"number"==typeof n?n:null}_checkSize(){this._sizeLimits.forEach((t,e)=>this._checkSizeLimits(t,e)),this._clients.forEach(t=>this._checkSizeLimits(this._maxClientSize,t)),this._checkSizeLimits(this.maxSize)}setMaxClientSize(t,e){null==e||e<=0?this._sizeLimits.delete(t):this._sizeLimits.set(t,e)}_checkSizeLimits(t,e){let i=e??this;if(i.size<=t)return;let s=e?.id,r=!0;for(;r;){r=!1;for(let[n,o]of this._db)if(0===o.lifetime&&(!s||n.startsWith(s))){let s=e??this._clients.get(n.split(a)[0]);if(this._purgeItem(n,o,s),i.size<=.9*t)return;r||=this._db.has(n)}}for(let[r,n]of this._db)if(!s||r.startsWith(s)){let s=e??this._clients.get(r.split(a)[0]);if(this._purgeItem(r,n,s),i.size<=.9*t)return}}_purgeItem(t,e,i){if(this._db.delete(t),e.lives<=1){this._size-=e.size,i&&(i.size-=e.size);let s=this._notifyRemove(t,e.entry,e.size,1);null!=s&&s>0&&(this._size+=s,i&&(i.size+=s),e.lives=e.lifetime,e.size=s,this._db.set(t,e))}else--e.lives,this._db.set(t,e)}}new r(0);class n{constructor(t,e,i){this.entry=t,this.size=e,this.lifetime=i,this.lives=i}}const a=":";class o{constructor(t,e){this.removeFunc=e,this.id="",this.name="",this.size=0,this._storage=new r(t,1),this._storage.register(this)}destroy(){this._storage.deregister(this),this._storage.destroy()}put(t,e,i=1){this._storage.put(this,t,e,i,1)}pop(t){return this._storage.pop(this,t)}get(t){return this._storage.get(this,t)}clear(){this._storage.clearAll()}get maxSize(){return this._storage.maxSize}set maxSize(t){this._storage.maxSize=t}resetHitRate(){}}},9093(t,e,i){function s(){return[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]}function r(t){return[t[0],t[1],t[2],t[3],t[4],t[5],t[6],t[7],t[8],t[9],t[10],t[11],t[12],t[13],t[14],t[15]]}i.d(e,{o8:()=>r,vt:()=>s});const n=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];Object.freeze(Object.defineProperty({__proto__:null,IDENTITY:n,clone:r,create:s,fromValues:function(t,e,i,s,r,n,a,o,u,l,h,c,d,f,p,m){return[t,e,i,s,r,n,a,o,u,l,h,c,d,f,p,m]}},Symbol.toStringTag,{value:"Module"})),i.d(e,["zK",0,n])},35522(t,e,i){i.d(e,{$A:()=>P,Bw:()=>n,C:()=>a,Cc:()=>v,DI:()=>M,Io:()=>g,Ln:()=>y,Om:()=>S,Qr:()=>c,Re:()=>l,S8:()=>I,T9:()=>m,WQ:()=>u,Z0:()=>F,_S:()=>f,aI:()=>A,ei:()=>b,fw:()=>C,gL:()=>R,hG:()=>x,hZ:()=>o,hs:()=>_,jk:()=>p,lw:()=>h,m3:()=>w,oW:()=>E,t2:()=>O,tn:()=>d,ze:()=>z});var s=i(51850),r=i(34304);function n(t){let e=t[0],i=t[1],s=t[2];return Math.sqrt(e*e+i*i+s*s)}function a(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t}function o(t,e,i,s){return t[0]=e,t[1]=i,t[2]=s,t}function u(t,e,i){return t[0]=e[0]+i[0],t[1]=e[1]+i[1],t[2]=e[2]+i[2],t}function l(t,e,i){return t[0]=e[0]-i[0],t[1]=e[1]-i[1],t[2]=e[2]-i[2],t}function h(t,e,i){return t[0]=e[0]*i[0],t[1]=e[1]*i[1],t[2]=e[2]*i[2],t}function c(t,e,i){return t[0]=e[0]/i[0],t[1]=e[1]/i[1],t[2]=e[2]/i[2],t}function d(t,e){return t[0]=Math.abs(e[0]),t[1]=Math.abs(e[1]),t[2]=Math.abs(e[2]),t}function f(t,e){return t[0]=Math.sign(e[0]),t[1]=Math.sign(e[1]),t[2]=Math.sign(e[2]),t}function p(t,e,i){return t[0]=Math.min(e[0],i[0]),t[1]=Math.min(e[1],i[1]),t[2]=Math.min(e[2],i[2]),t}function m(t,e,i){return t[0]=Math.max(e[0],i[0]),t[1]=Math.max(e[1],i[1]),t[2]=Math.max(e[2],i[2]),t}function _(t,e,i){return t[0]=e[0]*i,t[1]=e[1]*i,t[2]=e[2]*i,t}function y(t,e,i,s){return t[0]=e[0]+i[0]*s,t[1]=e[1]+i[1]*s,t[2]=e[2]+i[2]*s,t}function g(t,e){let i=e[0]-t[0],s=e[1]-t[1],r=e[2]-t[2];return Math.sqrt(i*i+s*s+r*r)}function x(t,e){let i=e[0]-t[0],s=e[1]-t[1],r=e[2]-t[2];return i*i+s*s+r*r}function w(t){let e=t[0],i=t[1],s=t[2];return e*e+i*i+s*s}function z(t,e){return t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t}function M(t,e){return t[0]=1/e[0],t[1]=1/e[1],t[2]=1/e[2],t}function I(t,e=t){let i=e[0],s=e[1],r=e[2],n=i*i+s*s+r*r;return n>0&&(n=1/Math.sqrt(n),t[0]=e[0]*n,t[1]=e[1]*n,t[2]=e[2]*n),t}function S(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]}function P(t,e,i){let s=e[0],r=e[1],n=e[2],a=i[0],o=i[1],u=i[2];return t[0]=r*u-n*o,t[1]=n*a-s*u,t[2]=s*o-r*a,t}function v(t,e,i,s){let r=e[0],n=e[1],a=e[2];return t[0]=r+s*(i[0]-r),t[1]=n+s*(i[1]-n),t[2]=a+s*(i[2]-a),t}function F(t,e,i){let s=e[0],r=e[1],n=e[2];return t[0]=i[0]*s+i[4]*r+i[8]*n+i[12],t[1]=i[1]*s+i[5]*r+i[9]*n+i[13],t[2]=i[2]*s+i[6]*r+i[10]*n+i[14],t}function b(t,e,i){let s=e[0],r=e[1],n=e[2];return t[0]=s*i[0]+r*i[3]+n*i[6],t[1]=s*i[1]+r*i[4]+n*i[7],t[2]=s*i[2]+r*i[5]+n*i[8],t}function R(t,e,i){return C(t,e,i[0],i[1],i[2],i[3])}function C(t,e,i,s,r,n){let a=e[0],o=e[1],u=e[2],l=s*u-r*o,h=r*a-i*u,c=i*o-s*a,d=s*c-r*h,f=r*l-i*c,p=i*h-s*l,m=2*n;return t[0]=a+l*m+2*d,t[1]=o+h*m+2*f,t[2]=u+c*m+2*p,t}const N=(0,s.vt)(),q=(0,s.vt)();function O(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]}function A(t,e){if(t===e)return!0;let i=t[0],s=t[1],n=t[2],a=e[0],o=e[1],u=e[2],l=(0,r.FD)();return Math.abs(i-a)<=l*Math.max(1,Math.abs(i),Math.abs(a))&&Math.abs(s-o)<=l*Math.max(1,Math.abs(s),Math.abs(o))&&Math.abs(n-u)<=l*Math.max(1,Math.abs(n),Math.abs(u))}function E(t,e,i){let s=i[0]-e[0],r=i[1]-e[1],n=i[2]-e[2],a=s*s+r*r+n*n;return a>0?(a=1/Math.sqrt(a),t[0]=s*a,t[1]=r*a,t[2]=n*a,t):(t[0]=0,t[1]=0,t[2]=0,t)}const T=l,G=h,k=c,Q=g,D=x,Z=n,B=w;Object.freeze(Object.defineProperty({__proto__:null,abs:d,add:u,angle:function(t,e){I(N,t),I(q,e);let i=S(N,q);return i>1?0:i<-1?Math.PI:Math.acos(i)},bezier:function(t,e,i,s,r,n){let a=1-n,o=a*a,u=n*n,l=o*a,h=3*n*o,c=3*u*a,d=u*n;return t[0]=e[0]*l+i[0]*h+s[0]*c+r[0]*d,t[1]=e[1]*l+i[1]*h+s[1]*c+r[1]*d,t[2]=e[2]*l+i[2]*h+s[2]*c+r[2]*d,t},ceil:function(t,e){return t[0]=Math.ceil(e[0]),t[1]=Math.ceil(e[1]),t[2]=Math.ceil(e[2]),t},clamp:function(t,e=0,i=1){return t[0]=Math.min(Math.max(t[0],e),i),t[1]=Math.min(Math.max(t[1],e),i),t[2]=Math.min(Math.max(t[2],e),i),t},copy:a,cross:P,crossAndNormalize:function(t,e,i){let s=e[0],r=e[1],n=e[2],a=i[0],o=i[1],u=i[2],l=r*u-n*o,h=n*a-s*u,c=s*o-r*a,d=Math.sqrt(l*l+h*h+c*c);return t[0]=l/d,t[1]=h/d,t[2]=c/d,t},direction:E,dist:Q,distance:g,div:k,divide:c,dot:S,equals:A,exactEquals:O,floor:function(t,e){return t[0]=Math.floor(e[0]),t[1]=Math.floor(e[1]),t[2]=Math.floor(e[2]),t},hermite:function(t,e,i,s,r,n){let a=n*n,o=a*(2*n-3)+1,u=a*(n-2)+n,l=a*(n-1),h=a*(3-2*n);return t[0]=e[0]*o+i[0]*u+s[0]*l+r[0]*h,t[1]=e[1]*o+i[1]*u+s[1]*l+r[1]*h,t[2]=e[2]*o+i[2]*u+s[2]*l+r[2]*h,t},inverse:M,len:Z,length:n,lerp:v,max:m,min:p,mul:G,multiply:h,negate:z,normalize:I,random:function(t,e=1){let i=r.Ov,s=2*i()*Math.PI,n=2*i()-1,a=Math.sqrt(1-n*n)*e;return t[0]=Math.cos(s)*a,t[1]=Math.sin(s)*a,t[2]=n*e,t},rotateX:function(t,e,i,s){let r=[],n=[];return r[0]=e[0]-i[0],r[1]=e[1]-i[1],r[2]=e[2]-i[2],n[0]=r[0],n[1]=r[1]*Math.cos(s)-r[2]*Math.sin(s),n[2]=r[1]*Math.sin(s)+r[2]*Math.cos(s),t[0]=n[0]+i[0],t[1]=n[1]+i[1],t[2]=n[2]+i[2],t},rotateY:function(t,e,i,s){let r=[],n=[];return r[0]=e[0]-i[0],r[1]=e[1]-i[1],r[2]=e[2]-i[2],n[0]=r[2]*Math.sin(s)+r[0]*Math.cos(s),n[1]=r[1],n[2]=r[2]*Math.cos(s)-r[0]*Math.sin(s),t[0]=n[0]+i[0],t[1]=n[1]+i[1],t[2]=n[2]+i[2],t},rotateZ:function(t,e,i,s){let r=[],n=[];return r[0]=e[0]-i[0],r[1]=e[1]-i[1],r[2]=e[2]-i[2],n[0]=r[0]*Math.cos(s)-r[1]*Math.sin(s),n[1]=r[0]*Math.sin(s)+r[1]*Math.cos(s),n[2]=r[2],t[0]=n[0]+i[0],t[1]=n[1]+i[1],t[2]=n[2]+i[2],t},round:function(t,e){return t[0]=Math.round(e[0]),t[1]=Math.round(e[1]),t[2]=Math.round(e[2]),t},scale:_,scaleAndAdd:y,scaleTo:function(t,e){return _(t,t,e/Z(t))},set:o,sign:f,sqrDist:D,sqrLen:B,squaredDistance:x,squaredLength:w,str:function(t){return"vec3("+t[0]+", "+t[1]+", "+t[2]+")"},sub:T,subtract:l,transformMat3:b,transformMat4:F,transformMat4Z:function(t,e){return e[2]*t[0]+e[6]*t[1]+e[10]*t[2]+e[14]},transformQuat:R,transformQuatValues:C},Symbol.toStringTag,{value:"Module"})),i.d(e,["Il",0,Z,"jb",0,T,"lo",0,D,"uE",0,B])},69397(t,e,i){i.d(e,{Qf:()=>u,Qh:()=>a,lM:()=>n,ro:()=>l,rq:()=>h});var s=i(44208),r=i(34275);function n(t){if(!t)return 0;let e=c;for(let i in t)t.hasOwnProperty(i)&&(e+=o(t[i],!1));return e}function a(t){if(!t)return 0;if("number"==typeof t[0])return u(t);if(Array.isArray(t))return function(t){let e=t.length;if(0===e||"number"==typeof t[0])return h(t,8);let i=d;for(let s=0;s<e;s++)i+=o(t[s]);return i}(t);let e=c;for(let i in t)t.hasOwnProperty(i)&&(e+=o(t[i]));return e}function o(t,e=!0){switch(typeof t){case"object":return e?a(t):c;case"string":return function(t){return 32+t.length}(t);case"number":return 16;case"boolean":return 4;default:return 8}}function u(...t){return t.reduce((t,e)=>t+l(e),0)}function l(t,e=16){return t?(0,r.iu)(t)?t.byteLength+p:Array.isArray(t)?h(t,e):0:0}function h(t,e){return d+t.length*e}const c=32,d=16,f=(0,s.A)("ios")||!(0,s.A)("chrome")&&!(0,s.A)("opr")?8:4,p=145;i.d(e,["JY",0,f])},36745(t,e,i){i.d(e,{z:()=>o});var s=i(4718),r=i(51118),n=i(60408),a=i(92722);class o{static fromOptimized(t,e,i=1){return(new u).initialize(t,e,i)}static fromJSON(t){let[e,i]=h(t),s=(0,n.Pv)(t),r=(0,n.W0)(t);return(new c).initialize(e,i,s,r,1)}static fromOptimizedCIM(t,e,i=1){return(new d).initialize(t,e,i)}static fromJSONCIM(t,e=1){let[i,s]=h(t),r=(0,n.Pv)(t),a=(0,n.W0)(t);return(new f).initialize(i,s,r,a,e)}static fromFeatureSetReader(t){let e=t.readGeometryForDisplay(),i=t.geometryType;return e&&i?this.fromOptimized(e,i):null}static fromFeatureSetReaderCIM(t){let e=t.readGeometryForDisplay(),i=t.geometryType;return e&&i?this.fromOptimizedCIM(e,i):null}static createEmptyOptimized(t,e=!1,i=!1,s=1){return(new d).initialize(new a.A([],[],e,i),t,s)}static createEmptyJSON(t,e=!1,i=!1){return(new c).initialize([],t,e,i,1)}static createEmptyOptimizedCIM(t,e=!1,i=!1,s=1){return(new d).initialize(new a.A([],[],e,i),t,s)}static createEmptyJSONCIM(t,e=!1,i=!1,s=1){return(new f).initialize([],t,e,i,s)}asJSON(){let t=(0,r.x)(this),{hasZ:e,hasM:i}=this;return"esriGeometryEnvelope"===this.geometryType?{xmin:t[0][0][0],ymin:t[0][0][1],xmax:t[0][2][0],ymax:t[0][2][1]}:"esriGeometryMultipoint"===this.geometryType?{points:t.flat(),hasZ:e,hasM:i}:"esriGeometryPoint"===this.geometryType?{x:t[0][0][0],y:t[0][0][1],z:e?t[0][0][2]:void 0,m:i?t[0][0][e?3:2]:void 0}:"esriGeometryPolygon"===this.geometryType?{rings:t,hasZ:e,hasM:i}:{paths:t,hasZ:e,hasM:i}}getCurrentRingArea(){if(this.pathSize<3)return 0;let t,e,i=0;if(this.seekPathStart(),!this.nextPoint())return 0;t=this.x,e=this.y;let s=t,r=e;for(;this.nextPoint();)i+=(t-this.x)*(e+this.y),t=this.x,e=this.y;return i+=(t-s)*(e+r),-.5*i}invertY(){this.yFactor*=-1}}class u extends o{constructor(){super(...arguments),this._end=-1}get hasZ(){return this._geometry?.hasZ}get hasM(){return this._geometry?.hasM}initialize(t,e,i){return this.geometryType=e,this._stride=t.stride,this._geometry=t,this._pathIndex=-1,this._pathOffset=0,this._pointOffset=-this._stride,this._end=-1,this.yFactor=i,this}reset(){this.initialize(this._geometry,this.geometryType,this.yFactor)}seekPath(t){if(t>=0&&t<this.totalSize){if(this._pathIndex<t)for(;this._pathIndex<t&&this.nextPath(););else if(this._pathIndex>t)for(;this._pathIndex>t&&this.prevPath(););return!0}return!1}seekPathStart(){this._pointOffset=this._pathOffset-this._stride}seekPathEnd(){this._pointOffset=this._end}seekInPath(t){let e=this._pathOffset+t*this._stride;return e>=0&&e<this._end&&(this._pointOffset=e,!0)}nextPoint(){return(this._pointOffset+=this._stride)<this._end}prevPoint(){return(this._pointOffset-=this._stride)>=this._pathOffset}nextPath(){return!(this.pathIndex>=this.totalSize-1||(this._pathIndex>=0&&(this._pathOffset+=this._stride*this.pathSize),this._pathIndex++,this._pointOffset=this._pathOffset-this._stride,this._end=this._pointOffset+this._stride+this._stride*this.pathSize,0))}prevPath(){return!(this.pathIndex<=0||(this._pathIndex--,this._end=this._pathOffset,this._pathOffset-=this._stride*this.pathSize,this._pointOffset=this._pathOffset-this._stride,0))}getCurrentPath(){let t=this._end,e=this._geometry.coords,i=this._pathOffset;return(new u).initialize(new a.A([this.pathSize],e.slice(i,t),this.hasZ,this.hasM),this.geometryType,this.yFactor)}pathLength(){let t=this._end,e=this._stride,i=this._geometry.coords,s=0;for(let r=this._pathOffset+e;r<t;r+=e){let t=i[r-e],n=i[r-e+1],a=i[r]-t,o=i[r+1]-n;s+=Math.sqrt(a*a+o*o)}return s}startPath(){this._geometry.lengths.push(0)}pushPath(t){this.startPath(),this.pushPoints(t)}pushPoint(t){for(let e=0;e<this._stride;++e)this._geometry.coords.push(t[e]);this._geometry.lengths[this.totalSize-1]++}pushXY(t,e){this._geometry.coords.push(t,e),this._geometry.lengths[this.totalSize-1]++}pushPoints(t){for(let e of t)for(let t=0;t<this._stride;++t)this._geometry.coords.push(e[t]);this._geometry.lengths[this.totalSize-1]+=t.length}pushCursor(t){let e=t.asOptimized();this._geometry.coords.push(...e.coords),this._geometry.lengths.push(...e.lengths)}asOptimized(){let t=this._geometry.clone();if(1!==this.yFactor)for(let e=1;e<t.coords.length;e+=this._stride)t.coords[e]*=this.yFactor;return"esriGeometryPoint"===this.geometryType&&(t.lengths.length=0),t}isClosed(){let t=this._geometry.coords,e=this._pathOffset,i=this._end-this._stride;for(let s=0;s<this._stride;s++)if(t[e+s]!==t[i+s])return!1;return!0}clone(){return(new u).initialize(this._geometry.clone(),this.geometryType,this.yFactor)}get totalPoints(){return this._geometry.isPoint?1:this._geometry.lengths.reduce((t,e)=>t+e)}get pathSize(){let{lengths:t}=this._geometry;return this._geometry.isPoint?1:this._pathIndex<0||this._pathIndex>t.length-1?0:t[this._pathIndex]}get totalSize(){return this._geometry.isPoint?1:this._geometry.lengths.length}get x(){return this._geometry.coords[this._pointOffset]}set x(t){this._geometry.coords[this._pointOffset]=t}get y(){return this.yFactor*this._geometry.coords[this._pointOffset+1]}set y(t){this._geometry.coords[this._pointOffset+1]=this.yFactor*t}get z(){return this._geometry.coords[this._pointOffset+2]}set z(t){this._geometry.coords[this._pointOffset+2]=t}get m(){let t=this.hasZ?3:2;return this._geometry.coords[this._pointOffset+t]}set m(t){this._geometry.coords[this._pointOffset+3]=t}get pathIndex(){return this._pathIndex}get _coordIndex(){return this._pointOffset/this._stride}}function l(t){let e=[t.x,t.y];return t.z&&e.push(t.z),t.m&&e.push(t.m),e}function h(t){return(0,n.Bi)(t)?[t.rings,"esriGeometryPolygon"]:(0,n.Rg)(t)?[t.paths,"esriGeometryPolyline"]:(0,n.U9)(t)?[[t.points],"esriGeometryMultipoint"]:(0,n.ZC)(t)?[[[[t.xmin,t.ymin],[t.xmin,t.ymax],[t.xmax,t.ymax],[t.xmax,t.ymin],[t.xmin,t.ymin]]],"esriGeometryEnvelope"]:(0,n.fT)(t)?[[[l(t)]],"esriGeometryPoint"]:[[],"esriGeometryPolyline"]}class c extends o{initialize(t,e,i,s,r){return this._paths=t,this.geometryType=e,this.hasZ=i,this.hasM=s,this._pathIndex=this._pointIndex=-1,this.yFactor=r,this._mIndex=this.hasZ?3:2,this}reset(){this._pathIndex=this._pointIndex=-1}seekPath(t){return this._pathIndex=t,this._pointIndex=-1,t>=0&&t<this.totalSize&&(this._currentPath=this._paths[t],!0)}seekPathStart(){this._pointIndex=-1}seekPathEnd(){this._pointIndex=this._currentPath.length}seekInPath(t){return t>=0&&t<this._currentPath.length&&(this._pointIndex=t,this._currentPoint=this._currentPath[this._pointIndex],!0)}nextPoint(){return this._currentPoint=this._currentPath[++this._pointIndex],this._pointIndex<this._currentPath.length}prevPoint(){return this._currentPoint=this._currentPath[--this._pointIndex],this._pointIndex>=0}nextPath(){return this._pointIndex=-1,this._currentPath=this._paths[++this._pathIndex],this._pathIndex<this.totalSize}prevPath(){return this.pathIndex>0&&(this._pointIndex=-1,this._pathIndex--,this._currentPath=this._paths[this._pathIndex],!0)}pathLength(){let t=this._currentPath.length,e=this._currentPath,i=0;for(let s=1;s<t;s++){let t=e[s-1],r=e[s],n=t[0],a=t[1],o=r[0]-n,u=r[1]-a;i+=Math.sqrt(o*o+u*u)}return i}startPath(){this._paths.push([])}getCurrentPath(){return(new c).initialize([this._currentPath],this.geometryType,this.hasZ,this.hasM,this.yFactor)}pushPath(t){this._paths.push(t)}pushPoint(t){this._paths[this.totalSize-1].push(t)}pushXY(t,e){this._paths[this.totalSize-1].push([t,e])}pushPoints(t){this._paths[this.totalSize-1].push(...t)}pushCursor(t){let e=(0,r.x)(t);for(let t of e)this.pushPath(t)}asOptimized(){let{hasZ:t,hasM:e}=this,i=new a.A([],[],t,e),{coords:s,lengths:r}=i;if("esriGeometryPoint"===this.geometryType)s.push(...this._paths[0][0]),r.length=0;else for(let i of this._paths){for(let r of i)s.push(r[0]),s.push(r[1]*this.yFactor),t&&s.push(r[2]),e&&s.push(r[this._mIndex]);r.push(i.length)}return i}isClosed(){let t=this._currentPath[0],e=this._currentPath[this._currentPath.length-1];for(let i=0;i<t.length;i++)if(t[i]!==e[i])return!1;return!0}clone(){return(new c).initialize((0,s.o8)(this._paths),this.geometryType,this.hasZ,this.hasM,this.yFactor)}get totalPoints(){return this._paths.map(t=>t.length).reduce((t,e)=>t+e)}get pathSize(){return this._pathIndex<0||this._pathIndex>this.totalSize-1?-1:this._paths[this._pathIndex].length}get totalSize(){return this._paths.length}get x(){return this._currentPoint[0]}set x(t){this._currentPoint[0]=t}get y(){return this.yFactor*this._currentPoint[1]}set y(t){this._currentPoint[1]=this.yFactor*t}get z(){return this._currentPoint[2]}set z(t){this._currentPoint[2]=t}get m(){return this._currentPoint[this._mIndex]}set m(t){this._currentPoint[this._mIndex]=t}get pathIndex(){return this._pathIndex}}class d extends u{initialize(t,e,i){return super.initialize(t,e,i),this._controlPoints||=this._controlPoints=Array(this.totalSize).fill(void 0).map(t=>new Set),this}startPath(){super.startPath(),this._controlPoints.push(new Set)}clone(){let t=(new d).initialize(this._geometry.clone(),this.geometryType,this.yFactor);return t._controlPoints=this._controlPoints,t}setControlPoint(){this._controlPoints[this.pathIndex].add(this._coordIndex)}getControlPoint(){return this._controlPoints[this.pathIndex].has(this._coordIndex)}setControlPointAt(t){this._controlPoints[this.pathIndex].add(t)}getControlPointAt(t){return this._controlPoints[this.pathIndex].has(t)}}class f extends c{initialize(t,e,i,s,r){return super.initialize(t,e,i,s,r)}clone(){return(new f).initialize((0,s.o8)(this._paths),this.geometryType,this.hasZ,this.hasM,this.yFactor)}setControlPoint(){this._paths[this.pathIndex][this._pointIndex][4]=1}getControlPoint(){return 1===this._paths[this.pathIndex][this._pointIndex][4]}setControlPointAt(t){this._paths[this.pathIndex][t][4]=1}getControlPointAt(t){return 1===this._paths[this.pathIndex][t][4]}}},4197(t,e,i){i.d(e,{Vj:()=>a,cj:()=>n,jh:()=>r});var s=i(9093);function r(t){return t<=1024?Array(t).fill(0):new Float64Array(t)}function n(t){return[...t]}function a(t){let e=(0,s.vt)();for(let i=0;i<16;++i)e[i]=t[i];return e}},70328(t,e,i){i.d(e,{BI:()=>F,C:()=>a,DC:()=>d,Ej:()=>x,Ie:()=>P,Jt:()=>v,Lu:()=>z,Ne:()=>M,RF:()=>c,TF:()=>y,VL:()=>p,aI:()=>R,fA:()=>o,gE:()=>l,gX:()=>g,hZ:()=>S,iT:()=>f,is:()=>b,pg:()=>w,uJ:()=>_,vI:()=>I,vY:()=>u,vt:()=>n,w1:()=>h,yr:()=>m}),i(35522);var s=i(5443),r=(i(19419),i(4197));function n(t=N){return[t[0],t[1],t[2],t[3],t[4],t[5]]}function a(t,e){for(let i=0;i<6;i++)t[i]=e[i];return t}function o(t,e,i,s,r,a,o=n()){return o[0]=t,o[1]=e,o[2]=i,o[3]=s,o[4]=r,o[5]=a,o}function u(t,e=n()){return function(t,e,i,s=n()){return S(s,C),function(t,e,i=0,s=e.length/3){let r=t[0],n=t[1],a=t[2],o=t[3],u=t[4],l=t[5];for(let t=0;t<s;t++)r=Math.min(r,e[i+3*t]),n=Math.min(n,e[i+3*t+1]),a=Math.min(a,e[i+3*t+2]),o=Math.max(o,e[i+3*t]),u=Math.max(u,e[i+3*t+1]),l=Math.max(l,e[i+3*t+2]);t[0]=r,t[1]=n,t[2]=a,t[3]=o,t[4]=u,t[5]=l}(s,t,e,i),s}(t,0,t.length/3,e)}function l(t,e=(0,r.jh)(24)){let[i,s,n,a,o,u]=t;return e[0]=i,e[1]=s,e[2]=n,e[3]=i,e[4]=s,e[5]=u,e[6]=i,e[7]=o,e[8]=n,e[9]=i,e[10]=o,e[11]=u,e[12]=a,e[13]=s,e[14]=n,e[15]=a,e[16]=s,e[17]=u,e[18]=a,e[19]=o,e[20]=n,e[21]=a,e[22]=o,e[23]=u,e}function h(t,e){return isFinite(t[2])||isFinite(t[5])?new s.A({xmin:t[0],xmax:t[3],ymin:t[1],ymax:t[4],zmin:t[2],zmax:t[5],spatialReference:e}):new s.A({xmin:t[0],xmax:t[3],ymin:t[1],ymax:t[4],spatialReference:e})}function c(t,e,i=t){i[0]=Math.min(t[0],e[0]),i[1]=Math.min(t[1],e[1]),i[2]=Math.min(t[2],e[2]),i[3]=Math.max(t[3],e[3]),i[4]=Math.max(t[4],e[4]),i[5]=Math.max(t[5],e[5])}function d(t,e){t[0]=Math.min(t[0],e[0]),t[1]=Math.min(t[1],e[1]),t[3]=Math.max(t[3],e[2]),t[4]=Math.max(t[4],e[3])}function f(t,[e,i,s]){!function(t,e,i,s){t[0]=Math.min(t[0],e),t[1]=Math.min(t[1],i),t[2]=Math.min(t[2],s),t[3]=Math.max(t[3],e),t[4]=Math.max(t[4],i),t[5]=Math.max(t[5],s)}(t,e,i,s)}function p(t){return t[0]>=t[3]?0:t[3]-t[0]}function m(t){return t[1]>=t[4]?0:t[4]-t[1]}function _(t){return t[2]>=t[5]?0:t[5]-t[2]}function y(t){let e=p(t),i=_(t),s=m(t);return e*e+i*i+s*s}function g(t,e=[0,0,0]){return e[0]=t[0]+p(t)/2,e[1]=t[1]+m(t)/2,e[2]=t[2]+_(t)/2,e}function x(t,e=[0,0,0]){return e[0]=p(t),e[1]=m(t),e[2]=_(t),e}function w(t,e){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e}function z(t,e){return e[0]=t[3],e[1]=t[4],e[2]=t[5],e}function M(t,e,i=t){return i[0]=e[0],i[1]=e[1],i[2]=e[2],i!==t&&(i[3]=t[3],i[4]=t[4],i[5]=t[5]),i}function I(t,e,i=t){return i[3]=e[0],i[4]=e[1],i[5]=e[2],i!==t&&(i[0]=t[0],i[1]=t[1],i[2]=t[2]),t}function S(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t}function P(t){return t?S(t,C):n(C)}function v(t,e){return t[0]=e[0],t[1]=e[1],t[2]=-1/0,t[3]=e[2],t[4]=e[3],t[5]=1/0,t}function F(t,e,i,s,r){return t[0]=e,t[1]=i,t[2]=-1/0,t[3]=s,t[4]=r,t[5]=1/0,t}function b(t){return 6===t.length}function R(t,e,i){if(null==t||null==e)return t===e;if(!b(t)||!b(e))return!1;if(i){for(let s=0;s<t.length;s++)if(!i(t[s],e[s]))return!1}else for(let i=0;i<t.length;i++)if(t[i]!==e[i])return!1;return!0}const C=[1/0,1/0,1/0,-1/0,-1/0,-1/0],N=[0,0,0,0,0,0];n(),i.d(e,["qv",0,C,"v_",0,N])},78957(t,e,i){i.d(e,{d:()=>h,R:()=>z});class s{constructor(t=r){this._data=[],this._compare=t}get size(){return this._data.length}enqueue(t){if(null==t)return;let{_data:e,_compare:i}=this;e.push(t);let s=e.length-1>>>0,r=e[s];for(;s>0;){let t=s-1>>1,n=e[t];if(!(i(n,r)<=0))break;e[t]=r,e[s]=n,s=t}}dequeue(){let{_data:t,_compare:e}=this,i=t[0],s=t.pop();if(0===t.length)return i;t[0]=s;let r,n,a=0,o=t.length,u=t[0],l=null;for(;;){let i=2*a+1,s=2*a+2;if(l=null,i<o&&(r=t[i],e(r,u)>0&&(l=i)),s<o&&(n=t[s],(null===l&&e(n,u)<=0||null!==l&&e(n,r)<=0)&&(l=s)),null===l)break;t[a]=t[l],t[l]=u,a=l}return i}}const r=(t,e)=>t<e?-1:+(t>e);var n=i(19419),a=i(537),o=i(12359),u=i(95108),l=i(12176);function h(t){if(0===t.totalSize)return null;let e=(0,a.z8)(t);if(!e)return null;let i=4*(Math.abs(e[0])+Math.abs(e[2])+Math.abs(e[1])+Math.abs(e[3])+1)*222045e-19,s=0,r=0;t.reset();for(let e=0;t.nextPath();e++){let i=t.getCurrentRingArea();i>r&&(r=i,s=e)}if(t.seekPath(s),0===t.pathSize)return null;t.seekPathStart();let u=(0,a.B$)(t);if(Math.abs(r)<=2*i*i)return[(u[0]+u[2])/2,(u[1]+u[3])/2];t.seekPathStart();let l=(0,o.w2)(t,(0,n.vt)());if(null===l)return null;if(t.totalPoints<4)return l;let h=[[NaN,NaN],[NaN,NaN],[NaN,NaN],[NaN,NaN]],p=[NaN,NaN,NaN,NaN],m=[NaN,NaN,NaN,NaN],_=!1,w=d(l,t,!0);0===w.distance&&(_=!0,h[0][0]=l[0],h[0][1]=l[1],w=d(l,t,!1)),p[0]=w.distance,m[0]=0;let z=[NaN,NaN],M=!1,I=.25,S=-1,P=NaN;do{if(P=NaN,h[1]=f(t,y(u[0],u[2],I),0,e),!isNaN(h[1][0])&&!isNaN(h[1][1])&&(w=d(h[1],t,!1),P=w.distance),!isNaN(P)&&P>i&&c(h[1],t))M=!0,p[1]=P,m[1]=g(h[1],l);else if(!isNaN(P)&&P>S&&(S=P,z[0]=h[1][0],z[1]=h[1][1]),I-=.01,I<.1){if(!(S>=0))break;M=!0,p[1]=S,h[1][0]=z[0],h[1][1]=z[1],m[1]=g(h[1],l)}}while(!M);M=!1,I=.5,S=-1;let v=.01,F=1;do{if(P=NaN,h[2]=f(t,y(u[0],u[2],I),0,e),!isNaN(h[2][0])&&!isNaN(h[2][1])&&(w=d(h[2],t,!1),P=w.distance),!isNaN(P)&&P>i&&c(h[2],t))M=!0,p[2]=P,m[2]=g(h[2],l);else if(!isNaN(P)&&P>S)S=P,z[0]=h[2][0],z[1]=h[2][1];else if(P>S&&(S=P,z[0]=h[2][0],z[1]=h[2][1]),I=.5+v*F,v+=.01,F*=-1,I<.3||I>.7){if(!(S>=0))break;M=!0,p[2]=S,h[2][0]=z[0],h[2][1]=z[1],m[2]=g(h[2],l)}}while(!M);M=!1,I=.75,S=-1;do{if(P=NaN,h[3]=f(t,y(u[0],u[2],I),0,e),!isNaN(h[3][0])&&!isNaN(h[3][1])&&(w=d(h[3],t,!1),P=w.distance),!isNaN(P)&&P>i&&c(h[3],t))M=!0,p[3]=P,m[3]=g(h[3],l);else if(P>S&&(S=P,z[0]=h[3][0],z[1]=h[3][1]),I+=.01,I>.9){if(!(S>=0))break;M=!0,p[3]=S,h[3][0]=z[0],h[3][1]=z[1],m[3]=g(h[3],l)}}while(!M);let b,R=[0,1,2,3],C=+!_;for(let t=C;t<4;t++)for(let t=C;t<3;t++){let e=m[t],i=m[t+1];x(e,i)>0&&(b=R[t],R[t]=R[t+1],R[t+1]=b,m[t]=i,m[t+1]=e)}let N=C,q=0,O=0;for(let t=C;t<4;t++){switch(t){case 0:O=2*p[R[t]];break;case 1:O=1.66666666*p[R[t]];break;case 2:O=1.33333333*p[R[t]];break;case 3:O=p[R[t]]}O>q&&(q=O,N=R[t])}return h[N]}function c(t,e){let i,s,r,n,a=0;for(e.reset();e.nextPath()&&e.nextPoint();)for(i=e.x,s=e.y;e.nextPoint();i=r,s=n)r=e.x,n=e.y,s>t[1]!=n>t[1]&&((r-i)*(t[1]-s)-(n-s)*(t[0]-i)>0?a++:a--);return 0!==a}function d(t,e,i){if(i&&c(t,e))return{coord:t,distance:0};let s=1/0,r=0,n=0,a=[0,0],o=[0,0],l=[0,0];for(e.reset();e.nextPath()&&e.nextPoint();)if(!(e.pathSize<2))for(a[0]=e.x,a[1]=e.y;e.nextPoint();a=o){o=[e.x,e.y],(0,u.gR)(l,t,a,o);let i=g(t,l);i<s&&(s=i,r=l[0],n=l[1])}return{coord:[r,n],distance:Math.sqrt(s)}}function f(t,e,i,s){let r=[e,0],a=1/0,o=1/0,u=!1,h=!1,c=[[e,s[1]-1],[e,s[3]+1]],d=[0,0],f=[0,0],_=[0,0],y=[[0,0],[0,0]],g=(0,n.vt)();for(t.reset();t.nextPath()&&t.nextPoint();)if(!(t.pathSize<2))for(y[0][0]=t.x,y[0][1]=t.y;t.nextPoint();y[0][0]=y[1][0],y[0][1]=y[1][1]){if(y[1][0]=t.x,y[1][1]=t.y,null===p(g,y)||(f[0]=c[0][0],f[1]=c[0][1],_[0]=c[1][0],_[1]=c[1][1],0===m(g,f,_))||!(0,l.Ql)(c[0],c[1],y[0],y[1],d))continue;let e=d[1];a>o?e<a&&(a=e,u=!0):e<o&&(o=e,h=!0)}return u&&h?r[1]=(a+o)/2:r[0]=r[1]=NaN,r}function p(t,e){if(e.length<2)return null;t||=(0,n.vt)();let[i,s]=e[0],[r,a]=e[1];return t[0]=Math.min(i,r),t[1]=Math.min(s,a),t[2]=Math.max(i,r),t[3]=Math.max(s,a),t}function m(t,e,i){let s=_(e,t),r=_(i,t),n=t[0],a=t[1],o=t[2],u=t[3];if(s&r)return 0;if(!(s|r))return 4;let l=!!s|(r?2:0);do{let l=i[0]-e[0],h=i[1]-e[1];if(l>h)3&s?(1&s?(e[1]+=h*(n-e[0])/l,e[0]=n):(e[1]+=h*(o-e[0])/l,e[0]=o),s=_(e,t)):3&r?(1&r?(i[1]+=h*(n-i[0])/l,i[0]=n):(i[1]+=h*(o-i[0])/l,i[0]=o),r=_(i,t)):s?(4&s?(e[0]+=l*(a-e[1])/h,e[1]=a):(e[0]+=l*(u-e[1])/h,e[1]=u),s=_(e,t)):(4&r?(i[0]+=l*(a-i[1])/h,i[1]=a):(i[0]+=l*(u-i[1])/h,i[1]=u),r=_(i,t));else if(12&s?(4&s?(e[0]+=l*(a-e[1])/h,e[1]=a):(e[0]+=l*(u-e[1])/h,e[1]=u),s=_(e,t)):12&r?(4&r?(i[0]+=l*(a-i[1])/h,i[1]=a):(i[0]+=l*(u-i[1])/h,i[1]=u),r=_(i,t)):s?(1&s?(e[1]+=h*(n-e[0])/l,e[0]=n):(e[1]+=h*(o-e[0])/l,e[0]=o),s=_(e,t)):(1&r?(i[1]+=h*(n-i[0])/l,i[0]=n):(i[1]+=h*(o-i[0])/l,i[0]=o),r=_(i,t)),s&r)return 0}while(s|r);return l}function _(t,e){return+(t[0]<e[0])|(t[0]>e[2])<<1|(t[1]<e[1])<<2|(t[1]>e[3])<<3}function y(t,e,i){return t+(e-t)*i}function g(t,e){return(t[0]-e[0])*(t[0]-e[0])+(t[1]-e[1])*(t[1]-e[1])}function x(t,e){if(t<e)return-1;if(t>e)return 1;if(t===e)return 0;let i=isNaN(t),s=isNaN(e);return i<s?-1:+(i>s)}class w{constructor(t,e,i,s){this.x=t,this.y=e,this.cellSize=i,this.distancefromCellCenter=(0,u.Xf)(t,e,s),this.maxDistanceToPolygon=this.distancefromCellCenter+this.cellSize*Math.SQRT2}}function z(t){if(!t.nextPath()||!t.pathSize)return null;let e=(0,a.B$)(t),i=e[2]-e[0],r=e[3]-e[1];if(0===i||0===r)return[e[0]+i/2,e[1]+r/2];let n=Math.max(Math.min(i,r)/100,1),u=new s((t,e)=>e.maxDistanceToPolygon-t.maxDistanceToPolygon),l=Math.min(i,r),h=l/2,c=0,d=0;for(c=e[0];c<e[2];c+=l)for(d=e[1];d<e[3];d+=l)u.enqueue(new w(c+h,d+h,h,t));t.reset(),t.nextPath();let f=(0,o.IK)(t);if(null===f)return null;let p,m=new w(f[0],f[1],0,t);for(;u.size>0;)p=u.dequeue(),p.distancefromCellCenter>m.distancefromCellCenter&&(m=p),p.maxDistanceToPolygon-m.distancefromCellCenter<=n||(h=p.cellSize/2,u.enqueue(new w(p.x-h,p.y-h,h,t)),u.enqueue(new w(p.x+h,p.y-h,h,t)),u.enqueue(new w(p.x-h,p.y+h,h,t)),u.enqueue(new w(p.x+h,p.y+h,h,t)));return[m.x,m.y]}},62815(t,e,i){i.d(e,{N:()=>o,d:()=>u});var s=i(86211),r=i(73941),n=i(21325),a=i(52006);function o(t,e,i){let s=u(e,i);if(1!==s)switch(t){case"point":case"esriGeometryPoint":return t=>function(t,e){null!=t?.z&&(t.z*=e)}(t,s);case"polyline":case"esriGeometryPolyline":return t=>function(t,e){if(t){if(t.curvePaths)for(let i of t.curvePaths)for(let t of i){let i=(0,a.yP)(t);i.length>2&&(i[2]*=e)}if(t.paths)for(let i of t.paths)for(let t of i)t.length>2&&(t[2]*=e)}}(t,s);case"polygon":case"esriGeometryPolygon":return t=>function(t,e){if(t){if(t.curveRings)for(let i of t.curveRings)for(let t of i){let i=(0,a.yP)(t);i.length>2&&(i[2]*=e)}if(t.rings)for(let i of t.rings)for(let t of i)t.length>2&&(t[2]*=e)}}(t,s);case"multipoint":case"esriGeometryMultipoint":return t=>function(t,e){if(t)for(let i of t.points)i.length>2&&(i[2]*=e)}(t,s);case"extent":case"esriGeometryEnvelope":return t=>function(t,e){t&&null!=t.zmin&&null!=t.zmax&&(t.zmin*=e,t.zmax*=e)}(t,s);default:return}}function u(t,e){return null==t||null==e||(0,n.aI)(t,e)||(0,r.xP)(t)||(0,r.xP)(e)?1:(0,s.G9)(t)/(0,s.G9)(e)}},6557(t,e,i){i.r(e),i.d(e,{default:()=>j});var s=i(32198),r=i(21818),n=i(49186),a=i(71511),o=i(44208),u=i(53966),l=i(17676),h=i(563),c=i(39516),d=i(86211),f=i(16930),p=i(70328),m=i(19419),_=i(21325),y=i(53929),g=i(90708),x=i(29441),w=i(75752),z=i(99352),M=i(8384),I=i(58727),S=i(95031),P=i(24460),v=i(64714),F=i(17754),b=i(20437),R=i(95466),C=i(30524),N=i(50639),q=i(42760),O=i(76248),A=(i(98623),i(30661)),E=i(28923),T=i(44320),G=i(35258),k=i(16630);const Q=new A.Z,D="__OBJECTID",Z=8e3;class B{constructor(t,e){this._files=t,this._createFileStream=e,this._fileIndex=0,this._streamIndex=0,this._streams=[],this._pending=new Set,this._resolvedCount=0}async next(t){for(await this._fill(t);this._pending.size>0;){(0,l.Te)(t),await this._fill(t);let e=await W(this._pending);if(this._pending.delete(e.read),this._resolvedCount++,null!=e.chunk)return e.chunk}return null}async _fill(t){for(this._removeDone();this._pending.size<8;){let e=this._getOrCreateNextStream(t);if(null==e)return;this._pending.add(e.read(t))}}_getOrCreateNextStream(t){let e=this._resolvedCount>=8?8:2;if(this._fileIndex<this._files.length&&this._streams.length<e){let e=this._files[this._fileIndex++],i=new V(e.id,this._createFileStream(e,t));return this._streams.push(i),i}return this._getNextStream()}_getNextStream(){let t=this._streams.length;for(let e=0;e<t;e++){let i=(this._streamIndex+e)%t,s=this._streams[i];if(s.canRead)return this._streamIndex=(i+1)%t,s}return null}_removeDone(){let t=this._streamIndex;for(let e=this._streams.length-1;e>=0;e--)this._streams[e].done&&(this._streams.splice(e,1),e<t&&t--);this._streamIndex=this._streams.length>0?t%this._streams.length:0}}function W(t){return Promise.race(Array.from(t,async t=>({read:t,chunk:await t})))}class V{constructor(t,e){this._fileId=t,this._stream=e,this._readCount=0,this._reachedEnd=!1}get canRead(){return!this._reachedEnd}get done(){return this._reachedEnd&&0===this._readCount}async read(t){this._readCount++;try{let e=await(await this._stream).next(t);return null==e?(this._reachedEnd=!0,null):{fileId:this._fileId,chunk:e}}finally{this._readCount--}}}class j{constructor(){this._hasZ=!1,this._hasM=!1,this._queue=new h.QueueProcessor({concurrency:4,process:(t,e)=>this._executeQuery(t,e)}),this._streams=new Map,this._streamIdCounter=0,this._indexMap={},this._handles=new a.A}async load(t){let e=t.spatialReference?f.A.fromJSON(t.spatialReference):void 0;if(e&&!e.isWGS84&&!e.isWebMercator)throw new n.A("parquet:unsupported-projection","Only WGS84 and Web Mercator are supported");this._customParameters=t.customParameters,this._loadParameters=t,await this._updateProvider((0,S.M)(t.provider,null,()=>this._customParameters));let i,s=await this._provider.getMetadata(),r=await(0,q.nc)(s,{fields:t.fields?.map(t=>b.A.fromJSON(t)),geometryEncoding:t.geometryEncoding?(0,N.G)(t.geometryEncoding):null,geometryType:t.geometryType?(0,q.hG)(t.geometryType):null,displayOptimization:t.displayOptimization,spatialReference:e});if(this._hasZ=!!s?.hasZ,this._hasM=!!s?.hasM,!r.fields)throw new n.A("parquet:unsupported","Fields must be defined");if(r.spatialReference&&r.geometryType){if(!r.spatialReference)throw new n.A("parquet:unsupported","SpatialReference must be defined");if(!r.spatialReference.isGeographic&&!r.spatialReference.isWebMercator)throw new n.A("parquet:unsupported-projection","Only WGS84 and Web Mercator are supported");r.spatialReference.isGeographic&&!r.spatialReference.isWGS84&&(u.A.getLogger("parquet:unsupported-projection").warn("Found a geographic projection that is not WGS84. Handling as WGS84.",{spatialReference:r.spatialReference}),r.spatialReference=f.A.WGS84),i={geometry:r.geometryEncoding?{geometryType:(0,q.sA)(r.geometryType),spatialReference:r.spatialReference.toJSON(),encoding:r.geometryEncoding.toJSON()}:null,displayOptimization:r.displayOptimization}}this.setCustomParameters(t.customParameters),this._displayOptimization=r.displayOptimization,await this._provider.updateGeometryInfo(i),this._capabilities=st(await this._getFileStatistics(),this._hasZ,this._hasM);let a=await this._provider.getFiles();if(!a.length)return{layerDefinition:{},capabilities:st(null,this._hasZ,this._hasM)};let o=await a[0].file;r.file=o;let{fields:l}=r;if(null==l)throw new n.A("parquet-layer:missing-metadata","Unable to create parquet source: cannot infer fields",l);l.push(new b.A({name:D,type:"oid",alias:D}));for(let t of l){let e=o.getColumnId(t.name);null!=e&&(this._indexMap[t.name]=e)}let h=R.A.fromLayerJSON({fields:l.map(t=>t.toJSON()),dateFieldsTimeReference:{timeZoneIANA:"UTC"}});this._fieldsIndex=h;let c=(0,q.sA)(r.geometryType??"point");return this._metadata=G.i.createFeature({fieldsIndex:h.toJSON(),geometryType:c,hasZ:this._hasZ,hasM:this._hasM,featureIdInfo:{type:"object-id",fieldName:D},subtypes:null,subtypeField:null,types:null,typeIdField:null,globalIdField:null,spatialReference:r.spatialReference,outSpatialReference:null,attributeSpatialReference:null,timeInfo:null,timeReferenceUnknownClient:null,dateFieldsTimeZone:"UTC"}),this._queryEngineParams={fieldsIndex:this._metadata.fieldsIndex,geometryType:c,featureIdInfo:{type:"object-id",fieldName:D},hasM:this._hasM,hasZ:this._hasZ,spatialReference:r.spatialReference?.toJSON()??{wkid:4326},aggregateAdapter:null,timeInfo:null,definitionExpression:null},this._fullExtent=s?.extent?s.extent:await this._tryDeriveParquetFullExtent(r),{capabilities:this._capabilities,layerDefinition:{fields:r.fields?.map(t=>t.toJSON()),drawingInfo:(0,v.F0)(c),extent:this._fullExtent??void 0,geometryType:c,hasZ:this._hasZ,hasM:this._hasM,geometryEncoding:r.geometryEncoding?.toJSON(),displayOptimization:r.displayOptimization}}}destroy(){this._provider.destroy(),this._queue.destroy();for(let{handle:t}of this._streams.values())t.remove();this._streams.clear(),this._indexMap={},this._handles.removeAll()}async reload(t){this.destroy(),await this.load(t)}set remoteClient(t){this._source=t.createInvokeProxy("")}setCustomParameters(t){this._customParameters=t}getIndexMap(){return this._indexMap}async updateFileProvider(t){this._loadParameters={...this._loadParameters,provider:t};let e=(0,S.M)(t,this._provider.getGeometryInfo(),()=>this._customParameters);await this._updateProvider(e)}async getDiagnosticsSnapshot(){let t=await this._provider.getFiles();return{files:await Promise.all(t.map(t=>t.getDiagnosticsSnapshot()))}}async getColumnIndex(t){return(await this._getFileInfoById(t.fileId)).getColumnIndex(t.rowGroupIndex,t.columnIndex)}async getOffsetIndex(t){return(await this._getFileInfoById(t.fileId)).getOffsetIndex(t.rowGroupIndex,t.columnIndex)}async queryFeatures(t,e){let i=await(0,I.T2)(t,null,this._queryEngineParams.spatialReference);return this._validateQuery(i),function(t){return!!(t.objectIds?.length||t.outStatistics||t.orderByFields?.length||t.returnDistinctValues)}(i)||(i.resultRecordCount=i.resultRecordCount?Math.min(i.resultRecordCount,Z):Z,i.resultOffset=i.resultOffset??0),i.outStatistics?this._queryStatistics(i,e):(i.returnDistinctValues&&(i.returnGeometry=void 0),(await this._enqueueQuery(i,e)).createQueryResponse())}async queryFeatureCount(t,e){let i=await(0,I.T2)(t,null,this._queryEngineParams.spatialReference);return this._validateQuery(i),H(i)||i.returnDistinctValues||i.groupByFieldsForStatistics?.length||i.outStatistics?.length?(i.returnDistinctValues||(i.outFields=void 0),i.returnGeometry=void 0,(await this._enqueueQuery(i,e)).createQueryResponseForCount()):this._getFeatureCount()}async queryObjectIds(t,e){let i=await(0,I.T2)(t,null,this._queryEngineParams.spatialReference);return this._validateQuery(i),H(i)?(i.resultRecordCount=i.resultRecordCount?Math.min(i.resultRecordCount,8e3):8e3,i.resultOffset=i.resultOffset??0,i.returnGeometry=void 0,i.outFields=void 0,i.returnDistinctValues=void 0,(await this._enqueueQuery(i,e)).items.map(t=>t.getObjectId())):Array.from({length:await this._getFeatureCount()},(t,e)=>e)}async queryAttributeBins(t,e={}){throw new n.A("parquet:unsupported","queryAttributeBins not supported.")}async queryExtent(t,e){let i=await(0,I.T2)(t,null,this._queryEngineParams.spatialReference);if(this._validateQuery(i),this._fullExtent&&!H(i))return{count:await this._getFeatureCount(),extent:this._fullExtent};let s=(0,r.z)(this._metadata.spatialReference);i.returnGeometry=!0,i.outFields=void 0;let n=(0,p.hZ)((0,p.vt)(),p.qv),a=(0,p.vt)(),o=await this._enqueueQuery(i,e),u=0;for(let t of o.items)t.getBounds(a)&&((0,p.RF)(n,a),u+=1);return{count:u,extent:(0,w.Wc)(n,s,i.outSR?(0,r.z)(i.outSR):s.toJSON(),s,!1)}}async queryStream(t,e){if(!e.signal)throw Error("InternalError: AbortSignal must be passed");let i=await this._getCandidateFiles(t),s=new B(i,async(e,i)=>{let s=await e.file,r=await this._createParquetDisplayQuery(s,e.id,t);return s.executeQuery(r,Z,i)}),r=this._streamIdCounter++,n=(0,l.NY)(e.signal,t=>{let e=this._streams.get(r);null!=e&&(e.handle.remove(),this._streams.delete(r))});return this._streams.set(r,{stream:s,handle:n}),r}async getStreamNext(t,e){if(!e.signal)throw Error("InternalError: AbortSignal must be passed");let i=this._streams.get(t);if(!i)return{result:null};let s=await i.stream.next(e.signal);if(null==s)return i.handle.remove(),this._streams.delete(t),{result:null};let r=s.chunk.serialize().buffer,n={fileId:s.fileId,buffer:r};return r instanceof ArrayBuffer?{result:n,transferList:[r]}:{result:n}}async getStreamNextFeatures(t,e){let{result:i}=await this.getStreamNext(t,e);if(null==i)return null;let s=(await(0,O.N)()).ParquetChunk.deserialize(new Uint8Array(i.buffer)),r=new k.s(this._metadata,this._indexMap,s,i.fileId),n=[];for(;r.next();){let t=(0,g.zv)(r.readGeometryWorldSpace(),r.geometryType,r.hasZ,r.hasM),e=r.readAttributes();n.push({attributes:e,geometry:t})}return{features:n}}async createPatch(t,e,i,s,r){if(!r.signal)throw Error("InternalError: AbortSignal must be passed");return(await(await(await this._getFileInfoById(t)).file).createChunkPatch(e,i,s,r.signal)).serialize().buffer}async _updateProvider(t){let e=this._provider;this._handles.removeAll(),this._provider=t,this._handles.add([t.events.on("rangeRead",t=>{this._source.onRangeRead(t)}),t.events.on("sourceChanged",async()=>{await this.reload(this._loadParameters),await this._source.onSourceChange()})]),await(e?.destroy())}async _getCandidateFiles(t){let e=await this._provider.getFiles(),i=await this._getSpatialFilePruning(t);if(null==i)return e;let s=e.filter(t=>this._mayIncludeFileForSpatialPruning(t,i));return"xz"===i.type?function(t,e){return t.slice().sort((t,i)=>{let s=it(t,e),r=it(i,e);return s===r?0:s<r?-1:1})}(s,i):s}async _queryStatistics(t,e){let i=await(0,I.T2)({...t},null,this._queryEngineParams.spatialReference);if(i.returnGeometry=void 0,function(t,e){return!!t.outStatistics?.length&&!H(t)&&!t.groupByFieldsForStatistics?.length&&!t.orderByFields?.length&&!t.returnDistinctValues&&!t.returnAggIds&&t.outStatistics.every(t=>function(t,e){switch(t.statisticType){case"count":return"1"===t.onStatisticField||null!=e.get(t.onStatisticField);case"min":case"max":{let i=e.get(t.onStatisticField);return null!=i&&(0,C.WA)(i)}default:return!1}}(t,e))}(i,this._fieldsIndex)){let t=await this._getStatisticsFromFiles(i);if(t)return t}return(await this._enqueueQuery(i,e)).createQueryResponse()}async _getStatisticsFromFiles(t){let e=await this._provider.getFiles(),i={},s=[];for(let r of t.outStatistics??[]){let t=X(r,e);if(!t.available)return null;i[r.outStatisticFieldName]=t.value,s.push(Y(r,this._fieldsIndex))}return{fields:s,features:[{attributes:i}]}}async _getSpatialFilePruning(t){if("tile"!==t.type&&("arcade"!==t.type||null==t.extent))return null;let e=this._displayOptimization?.index;if(null==e)return null;let i=t.outSpatialReference.wkid;if(null==e.wkid||null==i)return null;let s=e.wkid,r=await(0,O.N)();switch(e.type){case"xz":return{type:"xz",fieldName:(0,y.FG)(e.code),intersects:(n,a)=>r.queryIntersectsXZStatistics(e.fullExtent,t.extent,i,s,e.maxLevel,n,a)};case"z":return{type:"xy",xFieldName:(0,y.FG)(e.xColumn),yFieldName:(0,y.FG)(e.yColumn),intersects:(e,n,a,o)=>r.queryIntersectsXYStatistics(t.extent,i,s,e,n,a,o)}}}_mayIncludeFileForSpatialPruning(t,e){switch(e.type){case"xz":{let i=et(t,e);return"null-only"!==i?.type&&("bounds"!==i?.type||e.intersects(i.minValue,i.maxValue))}case"xy":{let i=t.statistics.statistics.get(e.xFieldName),s=t.statistics.statistics.get(e.yFieldName);return"null-only"!==i?.type&&"null-only"!==s?.type&&("bounds"!==i?.type||"bounds"!==s?.type||e.intersects(i.minValue,i.maxValue,s.minValue,s.maxValue))}}}async _tryDeriveParquetFullExtent(t){if(!t.spatialReference)return null;if(null==this._fullExtent&&"location"===t.geometryEncoding?.type){let e=await this._provider.getFiles(),{xField:i,yField:r}=t.geometryEncoding,n=(0,p.hZ)((0,p.vt)(),p.qv),a=!1;for(let t of e){let e=await t.file;for(let t of e.rowGroups()){let e={stack:[],error:void 0,hasError:!1};try{let o=(0,s.mS)(e,t.columnDescriptorForAttribute(i),!1),u=(0,s.mS)(e,t.columnDescriptorForAttribute(r),!1),l=(0,P.Hk)(o),h=(0,P.Hk)(u);if("bounds"===l?.type&&"bounds"===h?.type){let t=[l.minValue,h.minValue,l.maxValue,h.maxValue];(0,p.DC)(n,t),a=!0}t.free()}catch(t){e.error=t,e.hasError=!0}finally{(0,s.hk)(e)}}}return a?{xmin:n[0],ymin:n[1],xmax:n[3],ymax:n[4],spatialReference:t.spatialReference?.toJSON()}:null}return null}async _getFileInfoById(t){let e=await this._provider.getFiles();for(let i of e)if(i.id===t)return i;throw Error(`InternalError: File ${t} does not exist`)}async _getFileStatistics(){return{featureCount:await this._getFeatureCount(),byteLength:await this._getByteLength()}}async _getFile(t){return(await this._getFileInfoById(t)).file}async _createParquetQuery(t,e,i,s,r){let n=(await(0,O.N)()).Query.new();null!=i&&n.setPreFilterStart(i),null!=s&&n.setPreFilterCount(s),null!=r&&n.setPostFilterCount(r);let a=await this._getRequiredFields(t);n.setOutFields(a),(t.geometry||t.returnGeometry)&&n.setReturnGeometry(!0),n.setReturnZ(!!t.returnZ),n.setReturnM(!!t.returnM);let o=this._tryGetGeneralizedGeometryResolution(t);null!=o&&n.setSourceResolution(o);let u=t.geometry?.spatialReference??this._queryEngineParams.spatialReference,l=u.wkid;if(t.geometry&&((0,_.K8)(u)||(0,_.oT)(u))){let e=(0,m.C)((0,m.vt)(),m.qv);for(let i of(0,w.qo)(t.geometry))(0,m.DC)(e,i);n.setOutSpatialReference(l),n.setExtent({xmin:e[0],ymin:e[1],xmax:e[2],ymax:e[3]})}if(t.where){let{id:i,file:s}=e;await this._setWhereClause(n,await s,i,t.where)}return n}async _createParquetDisplayQuery(t,e,i){let s=(await(0,O.N)()).Query.new();if("tile"===i.type){s.setExtent(i.extent),s.setQuantizationTransform(i.transform);let t=this._sourceResolution(i.resolution,i.outSpatialReference);null!=t&&s.setSourceResolution(t)}else"arcade"===i.type&&null!=i.extent&&s.setExtent(i.extent);return s.setOutFields(i.outFields.filter(t=>null!=this._indexMap[t])),s.setOutSpatialReference(i.outSpatialReference.wkid),s.setReturnGeometry(i.returnGeometry),s.setReturnZ(i.returnZ),s.setReturnM(i.returnM),i.where&&await this._setWhereClause(s,t,e,i.where),s}async _getFeatureCount(){return(await this._provider.getFiles()).map(t=>t.statistics.rowCount).reduce((t,e)=>t+e,0)}async _getByteLength(){return(await this._provider.getFiles()).map(t=>t.statistics.byteSize).reduce((t,e)=>t+e,0)}_validateQuery(t){if(!this._capabilities.query.supportsStatistics&&t.outStatistics)throw new n.A("parquet:unsupported","Statistics queries are not supported",{query:t});if(!this._capabilities.query.supportsOrderBy&&t.orderByFields?.length)throw new n.A("parquet:unsupported","Queries using orderBy are not supported",{query:t});if(!this._capabilities.query.supportsDistinct&&t.returnDistinctValues)throw new n.A("parquet:unsupported","Queries using returnDistinctValues are not supported",{query:t})}async _setWhereClause(t,e,i,s){let r=this._indexMap,a=this._fieldsIndex,o={getAttribute(t,s){let n=r[s];if(null==n){if("__OBJECTID"===a.get(s)?.name){let e=t.row+t.rowGroupStart;return(0,F.xb)(i,e)}return null}let o=a.get(s);return(0,y.LC)(e,t.rowGroup,t.row,n,o.type)}},u=await(0,c.GP)(s,this._fieldsIndex);if(!u.isStandardized)throw new n.A("sql-parse-error","expression is not standardized");let l=u.fieldNames.map(t=>a.get(t)).filter(t=>t&&null!=this._indexMap[t?.name]);t.setWhere(s),t.setWhereEvaluator((t,e,i)=>u.testFeatureCompiled({rowGroup:t,row:e,rowGroupStart:i},o,null)),t.setWhereFields(l.map(t=>t.name))}async*_streamFeatures(t,e,i,s,r){let n=await this._provider.getFiles(),a=0;for(let o of n){let n=a,u=a+o.statistics.rowCount;if(a+=o.statistics.rowCount,null!=e&&e>=u)continue;let l=null==e?null:Math.max(e-n,0),h=i;if(null!=i){let t=e??0,s=t+i;h=Math.max(Math.min(s,u)-Math.max(t,n),0)}if(0===h)continue;let c=await this._createParquetQuery(t,o,l,h,s),d=await(await o.file).executeQuery(c,Z),f=async()=>{let t=await d.next(r);if(!t)return null;let e=new k.s(this._metadata,this._indexMap,t,o.id);return tt([new E.j(e,null,0,!1)],this._queryEngineParams)},p=await f();for(;null!=p;)yield p,p=await f()}}async _queryFeaturesWithQueryEnginePagination(t,e){let i=[],s=this._streamFeatures(t,null,null,null,e),r=await s.next();for(;!r.done;){let n=await r.value.executeQueryForOpaqueFeatures({...t,where:void 0},e);for(let t of n)i.push(t);r=await s.next()}return i}async _queryFeaturesWithUpfrontPagination(t,e){let i,s,r,n=t.resultOffset??0,a=t.resultRecordCount??Z;!function(t){for(let e in t){let i=e;if(J(i)&&null!==t[i])return!0}return!1}(t)?(n&&=(i=n,0),s=t.resultRecordCount):function(t){for(let e in t){let i=e;if(U(i)&&null!==t[i])return!0}return!1}(t)||(r=n+a);let o=[],u=this._streamFeatures(t,i,s,r,e),l=await u.next();for(;!l.done&&a>0;){let i=await l.value.executeQueryForOpaqueFeatures({...t,where:void 0},e);for(let t of i)if(n>0)n--;else if(o.push(t),--a<=0)return o;l=await u.next()}return o}_enqueueQuery(t,e){return this._queue.push(t,e)}async _executeQuery(t,e){if(t.objectIds?.length){let i=new Map;for(let e of t.objectIds){let t=(0,F.wY)(e),s=(0,F.gE)(e),r=i.get(t);r||(r=[],i.set(t,r)),r.push(s)}let s=[];for(let[r,n]of i.entries()){let i=await this._executeFileIdQuery(t,r,n,e);for(let t of i)s.push(t)}return new M.G(s,t,{fieldsIndex:this._fieldsIndex,geometryType:this._metadata.geometryType,spatialReference:this._queryEngineParams.spatialReference,hasM:this._hasM,hasZ:this._hasZ,featureAdapter:Q,featureIdInfo:this._queryEngineParams.featureIdInfo})}if("1=1"===t.where&&(t.where=null),t.resultOffset??=0,t.resultRecordCount??=await this._getFeatureCount(),t.resultRecordCount>2e7&&(!this._displayOptimization||!t.geometry))throw new n.A("parquet:cannot-execute-query","Unable to execute query, dataset is too large.");let i=!!t.orderByFields?.length||!!t.outStatistics?.length||!!t.returnDistinctValues,s=i?await this._queryFeaturesWithQueryEnginePagination(t,e):await this._queryFeaturesWithUpfrontPagination(t,e);return i||(t.resultOffset=0),new M.G(s,t,{fieldsIndex:this._fieldsIndex,geometryType:this._metadata.geometryType,spatialReference:this._queryEngineParams.spatialReference,hasM:this._hasM,hasZ:this._hasZ,featureAdapter:Q,featureIdInfo:this._queryEngineParams.featureIdInfo})}async _executeFileIdQuery(t,e,i,s){let r=new Set(await this._getRequiredFields(t));if(t.where){let e=await(0,c.GP)(t.where,this._fieldsIndex);for(let t of e.fieldNames){let e=this._fieldsIndex.get(t);e&&null!=this._indexMap[e.name]&&r.add(e.name)}}let n=(await(0,O.N)()).Query.new();n.setOutFields(Array.from(r)),n.setReturnGeometry(!!t.returnGeometry),n.setReturnZ(!!t.returnZ),n.setReturnM(!!t.returnM),n.setIds(new Uint32Array(i));let a=await(await this._getFile(e)).executeQuery(n,Z,s),o=await a.next(s),u=0,l=[];for(;null!=o;){let t=new k.s(this._metadata,this._indexMap,o,e),i=new E.j(t,null,u++,!1);l.push(i),o=await a.next(s)}return tt(l,this._queryEngineParams).executeQueryForOpaqueFeatures(t,s)}async _getRequiredFields(t){let e=new Set;if(t.outStatistics)for(let i of(0,x.g9)(this._fieldsIndex,t.outStatistics,t.groupByFieldsForStatistics))e.add(i);else if(t.outFields)for(let i of t.outFields)e.add(i);return(e.has("*")?this._fieldsIndex.fields.map(t=>t.name):Array.from(e)).filter(t=>null!=this._indexMap[t])}_tryGetGeneralizedGeometryResolution(t){if(!this._displayOptimization)return null;let e=t.outSR??this._queryEngineParams.spatialReference;if(!(0,_.K8)(e)&&!(0,_.oT)(e))return null;let i=t.quantizationParameters?.tolerance??t.maxAllowableOffset;return i?this._sourceResolution(i,e):null}_sourceResolution(t,e){let i=this._queryEngineParams.spatialReference,s=(0,d.GA)(e)/(0,d.GA)(i)*t;return!Number.isFinite(s)||s<=0?null:s}}function L(t){switch(t){case"fullText":case"having":case"timeExtent":case"historicMoment":case"aggregateIds":case"uniqueIds":case"gdbVersion":case"objectIds":case"where":case"geometry":case"resultOffset":case"resultRecordCount":return!0;default:return!1}}function J(t){switch(t){case"fullText":case"having":case"timeExtent":case"historicMoment":case"aggregateIds":case"uniqueIds":case"gdbVersion":case"objectIds":case"where":case"geometry":return!0;default:return!1}}function U(t){switch(t){case"fullText":case"having":case"timeExtent":return!0;case"historicMoment":case"aggregateIds":case"uniqueIds":case"gdbVersion":case"objectIds":case"where":case"resultOffset":case"geometry":case"resultRecordCount":return!1}return!1}function H(t){for(let e in t){let i=e;if(L(i)&&null!==t[i])return!0}return!1}function Y(t,e){let i="exceedslimit"===t.statisticType?null:e.get(t.onStatisticField),s="min"!==t.statisticType&&"max"!==t.statisticType||"esriFieldTypeDate"!==i?.type?"esriFieldTypeDouble":i.type;return{name:t.outStatisticFieldName,alias:t.outStatisticFieldName,type:s}}function X(t,e){switch(t.statisticType){case"count":return function(t,e){if("count"!==t.statisticType)return{available:!1,value:null};if("1"===t.onStatisticField)return{available:!0,value:e.reduce((t,e)=>t+e.statistics.rowCount,0)};let i=0;for(let s of e){let e=s.statistics.statistics.get(t.onStatisticField);if(null==e||null==e.nullCount)return{available:!1,value:null};i+=s.statistics.rowCount-e.nullCount}return{available:!0,value:i}}(t,e);case"min":return $(t,e,Math.min);case"max":return $(t,e,Math.max);default:return{available:!1,value:null}}}function $(t,e,i){if("min"!==t.statisticType&&"max"!==t.statisticType)return{available:!1,value:null};let s=null,r="min"===t.statisticType?"minValue":"maxValue";for(let n of e){let e=n.statistics.statistics.get(t.onStatisticField);if(null==e)return{available:!1,value:null};switch(e.type){case"null-only":continue;case"unknown":return{available:!1,value:null};case"bounds":{let t=K(e[r]);if(null==t)return{available:!1,value:null};s=null==s?t:i(s,t);break}}}return{available:!0,value:s}}function K(t){return"number"==typeof t&&Number.isFinite(t)?t:null}function tt(t,e){let i=new T.I;for(let e of t)i.insert(e);return new w.do({...e,featureStore:i})}function et(t,e){return t.statistics.statistics.get(e.fieldName)??null}function it(t,e){let i=et(t,e);return"bounds"===i?.type?i.maxValue-i.minValue:1/0}function st(t,e,i){let s=t?.featureCount,r=!1;return null!=s&&s<(0,o.A)("parquetlayer-full-query-feature-count")&&(r=!0),{analytics:{supportsCacheHint:!1},attachment:null,data:{isVersioned:!1,isBranchVersioned:!1,supportedCurveTypes:[],supportsAttachment:!1,supportsM:i,supportsTrueCurve:!1,supportsZ:e},metadata:{supportsAdvancedFieldProperties:!1},operations:{supportsCalculate:!1,supportsTruncate:!1,supportsValidateSql:!1,supportsAdd:!1,supportsDelete:!1,supportsEditing:!1,supportsChangeTracking:!1,supportsQuery:!0,supportsQueryBins:!1,supportsQueryPivot:!1,supportsQueryAnalytics:!1,supportsQueryAttachments:!1,supportsQueryTopFeatures:!1,supportsResizeAttachments:!1,supportsSync:!1,supportsUpdate:!1,supportsExceedsLimitStatistics:!1,supportsAsyncConvert3D:!1},query:{...z.F,maxRecordCount:Z,supportsOrderBy:r,supportsDistinct:!0,supportsStatistics:!0,supportsSpatialAggregationStatistics:!1,supportedSpatialAggregationStatistics:{envelope:!1,centroid:!1,convexHull:!1}},queryAttributeBins:{supportsDate:!1,supportsFixedInterval:!1,supportsAutoInterval:!1,supportsFixedBoundaries:!1,supportsStackBy:!1,supportsSplitBy:!1,supportsSnapToData:!1,supportsReturnFullIntervalBin:!1,supportsFirstDayOfWeek:!1,supportsNormalization:!1},queryRelated:{supportsCount:!1,supportsOrderBy:!1,supportsPagination:!1,supportsCacheHint:!1},queryTopFeatures:{supportsCacheHint:!1},editing:{supportsDeleteByAnonymous:!1,supportsDeleteByOthers:!1,supportsGeometryUpdate:!1,supportsGlobalId:!1,supportsTrueCurveUpdate:!1,supportsTrueCurveUpdateByTrueCurveClientsOnly:!0,supportsReturnServiceEditsInSourceSpatialReference:!1,supportsRollbackOnFailure:!1,supportsUpdateByAnonymous:!1,supportsUpdateByOthers:!1,supportsUploadWithItemId:!1,supportsUpdateWithoutM:!1,supportsAsyncApplyEdits:!1,zDefault:void 0}}}}}]);
|