@arcgis/core 5.1.0-next.73 → 5.1.0-next.74

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (152) hide show
  1. package/Viewpoint.js +1 -1
  2. package/applications/Urban/editingSessionUtils.d.ts +95 -0
  3. package/applications/Urban/editingSessionUtils.js +2 -0
  4. package/arcade/featureset/sources/FeatureLayerDynamic.js +1 -1
  5. package/assets/esri/core/workers/RemoteClient.js +1 -1
  6. package/assets/esri/core/workers/chunks/{d17fcfc502f0e0fa6523.js → 003476e950bd27a2f884.js} +1 -1
  7. package/assets/esri/core/workers/chunks/{8a664451845a47048859.js → 0539b5d015157c1d34a0.js} +1 -1
  8. package/assets/esri/core/workers/chunks/{5a4d7ba6dc1d4b41d80d.js → 07eff82916681fcff069.js} +1 -1
  9. package/assets/esri/core/workers/chunks/{8a14e3db28c403b046cf.js → 0d2bc1be5802681666a4.js} +1 -1
  10. package/assets/esri/core/workers/chunks/0eed2b1b06355ab89013.js +1 -0
  11. package/assets/esri/core/workers/chunks/18f77ee3552d92962f15.js +1 -0
  12. package/assets/esri/core/workers/chunks/1a87e9bbd85ba29b1514.js +1 -0
  13. package/assets/esri/core/workers/chunks/{e1bc9ad767e08dc18bbc.js → 1db1656a033f3992f0d6.js} +1 -1
  14. package/assets/esri/core/workers/chunks/{b54b7cc6b23a70fed700.js → 1f8ccf96069ac3a40c3d.js} +1 -1
  15. package/assets/esri/core/workers/chunks/{cdf6ad970dc1893dac58.js → 24646a1176ce34039155.js} +1 -1
  16. package/assets/esri/core/workers/chunks/{93ceb74ac88ef460fe5f.js → 359d3acb3953e64e5a78.js} +1 -1
  17. package/assets/esri/core/workers/chunks/{80ace1c7203c5059525d.js → 37091cf498a16ccad7ff.js} +1 -1
  18. package/assets/esri/core/workers/chunks/{0839da55707f7c4cf780.js → 3b9100c59a8050f4834e.js} +1 -1
  19. package/assets/esri/core/workers/chunks/452c01cecbbd1e370098.js +1 -0
  20. package/assets/esri/core/workers/chunks/47656ec12401e53f4bd3.js +1 -0
  21. package/assets/esri/core/workers/chunks/{260d4571722cb1ff1366.js → 484d6c1b0fe1633515b7.js} +1 -1
  22. package/assets/esri/core/workers/chunks/{f207b3be0714cc50030a.js → 4bbe684050b3b04681d0.js} +1 -1
  23. package/assets/esri/core/workers/chunks/{29e76256e3e867e80520.js → 4c13869d260a902d3014.js} +1 -1
  24. package/assets/esri/core/workers/chunks/4c97cc922eece3a91b6b.js +1 -0
  25. package/assets/esri/core/workers/chunks/{656d6963e8f837fbf28f.js → 54023458195549f66215.js} +1 -1
  26. package/assets/esri/core/workers/chunks/{a78bc340a794fd332667.js → 5476c2f7b83f4ccd0335.js} +1 -1
  27. package/assets/esri/core/workers/chunks/5511e640e171c294f52a.js +2 -0
  28. package/assets/esri/core/workers/chunks/{faad127dc07e54e7f6d1.js → 5abe34bb0110694f7b42.js} +1 -1
  29. package/assets/esri/core/workers/chunks/{f5c57ff48ca505ed701d.js → 5b324e572737a308500d.js} +1 -1
  30. package/assets/esri/core/workers/chunks/6124141ac642e4ce1454.js +1 -0
  31. package/assets/esri/core/workers/chunks/{b6cadb8a579241adcb86.js → 6b66fc32451433129a88.js} +1 -1
  32. package/assets/esri/core/workers/chunks/{6ea8b0d68881d16a2432.js → 6d25230dd85a4ba54c4f.js} +1 -1
  33. package/assets/esri/core/workers/chunks/6f7aaba26773fe416ac2.js +1 -0
  34. package/assets/esri/core/workers/chunks/{9f4b97204def91567e3c.js → 7595ceba529ed01c7590.js} +1 -1
  35. package/assets/esri/core/workers/chunks/75d5ea0da181f9e7425f.js +1312 -0
  36. package/assets/esri/core/workers/chunks/{af75e91b88e747aa76ac.js → 7601278ebced0c0c31cf.js} +1 -1
  37. package/assets/esri/core/workers/chunks/{1661684357912726a72a.js → 77dd719516138afb1a2a.js} +1 -1
  38. package/assets/esri/core/workers/chunks/{ce2aa75e084ee56f5e29.js → 7f55eef696e9ed717bfc.js} +1 -1
  39. package/assets/esri/core/workers/chunks/85aac8539996372f1ee8.js +1 -0
  40. package/assets/esri/core/workers/chunks/{50d5d6654ada9f28345d.js → 85e65ced3312bf9cf162.js} +1 -1
  41. package/assets/esri/core/workers/chunks/{b9848bdbaf3d9ac93d54.js → 8f4cd30ce23e41c1a42c.js} +1 -1
  42. package/assets/esri/core/workers/chunks/983f6c8727fd9484718e.js +1 -0
  43. package/assets/esri/core/workers/chunks/{5a83ea967ecde01d5622.js → 9be9ccce6369f67202bc.js} +1 -1
  44. package/assets/esri/core/workers/chunks/{422824e407b550170c8c.js → a270960d80d8344dd75f.js} +1 -1
  45. package/assets/esri/core/workers/chunks/{bef27a25fbc4a6e19ec0.js → a36761e3122f70fbb3c9.js} +1 -1
  46. package/assets/esri/core/workers/chunks/{47f2113357b2aa4f4f37.js → a9d2c83bb10b5ade0ca0.js} +1 -1
  47. package/assets/esri/core/workers/chunks/{e25a684eb9f025bdcc01.js → ad064583f8a836005098.js} +1 -1
  48. package/assets/esri/core/workers/chunks/b858adff7043683fe41c.js +1 -0
  49. package/assets/esri/core/workers/chunks/{5c663d5f98bdfa29151b.js → b905e637a67fbb7af4ae.js} +1 -1
  50. package/assets/esri/core/workers/chunks/{03894992558d063d0d5e.js → bab23b905678e42815e5.js} +1 -1
  51. package/assets/esri/core/workers/chunks/{6ef3b8d67b498d655a99.js → bcb021a167580bb1619f.js} +1 -1
  52. package/assets/esri/core/workers/chunks/be0341567bb19e101a4f.js +1 -0
  53. package/assets/esri/core/workers/chunks/bec3ee5ea945e1e07a35.js +1 -0
  54. package/assets/esri/core/workers/chunks/c5f155fe114a2a05aaf2.js +2 -0
  55. package/assets/esri/core/workers/chunks/{84772b023d04e415f17f.js → c61002a117dc2218d6af.js} +1 -1
  56. package/assets/esri/core/workers/chunks/{0dad0bca8d58b2c63d22.js → c804a66ef7615aa8de89.js} +1 -1
  57. package/assets/esri/core/workers/chunks/{cfe246adb5e6cb6f0cfc.js → d00dafad202450e6ee2e.js} +1 -1
  58. package/assets/esri/core/workers/chunks/d1a7d13e1d48abcd7bf1.js +1 -0
  59. package/assets/esri/core/workers/chunks/{06df187a116709f69952.js → d35c475f004367e333eb.js} +1 -1
  60. package/assets/esri/core/workers/chunks/d82da31dc702b8fd6a07.js +1 -0
  61. package/assets/esri/core/workers/chunks/dd4f431511edd975a53b.js +1 -0
  62. package/assets/esri/core/workers/chunks/{99101789035f1787c630.js → e785f76c1a75cb1d1e1f.js} +1 -1
  63. package/assets/esri/core/workers/chunks/f590b60fca607d66001a.js +1 -0
  64. package/assets/esri/core/workers/chunks/{f6d047358d14328f3622.js → f60292d97bcdbf19165b.js} +1 -1
  65. package/assets/esri/core/workers/chunks/fb5a2205f05afc396119.js +1 -0
  66. package/assets/esri/widgets/Directions/t9n/Directions_ja.json +1 -1
  67. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_no.json +1 -1
  68. package/chunks/geometryEngineBase.js +1 -1
  69. package/config.js +1 -1
  70. package/core/has.js +1 -1
  71. package/form/elements/FieldElement.js +1 -1
  72. package/geometry/geometryEngine.js +1 -1
  73. package/geometry/geometryEngineJSON.js +1 -1
  74. package/geometry/operators/projectOperator.d.ts +5 -4
  75. package/geometry/support/curves/densifyCurvedGeometry.js +1 -1
  76. package/geometry/support/normalizeUtils.js +1 -1
  77. package/geometry/support/normalizeUtilsCommon.js +1 -1
  78. package/identity/IdentityManagerBase.js +1 -1
  79. package/kernel.js +1 -1
  80. package/layers/IntegratedMesh3DTilesLayer.js +1 -1
  81. package/layers/IntegratedMeshLayer.js +1 -1
  82. package/layers/orientedImagery/core/ExposurePoint.js +1 -1
  83. package/layers/support/SymbolLayerDrawing.d.ts +18 -4
  84. package/package.json +2 -2
  85. package/popup/Features.d.ts +9 -9
  86. package/popup/Features.js +1 -1
  87. package/popup/actionUtils.js +1 -1
  88. package/popup/actions.js +1 -1
  89. package/portal/Portal.js +1 -1
  90. package/portal/PortalQueryParams.js +1 -1
  91. package/rest/print.js +1 -1
  92. package/support/revision.js +1 -1
  93. package/views/2d/engine/webgl/shaders/sources/shaderRepository.js +1 -1
  94. package/views/3d/camera/intersectionUtils.js +1 -1
  95. package/views/3d/input/SceneInputManager.js +1 -1
  96. package/views/3d/input/handlers/PinchAndPanNavigation.js +1 -1
  97. package/views/3d/layers/IntegratedMesh3DTilesLayerView3D.js +1 -1
  98. package/views/3d/layers/graphics/Deconflictor.js +1 -1
  99. package/views/3d/layers/graphics/Graphics3DSymbolLayer.js +1 -1
  100. package/views/3d/state/GoToOperation.js +1 -1
  101. package/views/3d/state/controllers/PinchAndPanControllerGlobal.js +1 -1
  102. package/views/3d/state/controllers/PinchAndPanControllerLocal.js +1 -1
  103. package/views/3d/support/cameraScaleUtils.js +2 -0
  104. package/views/3d/support/cameraUtils.js +1 -1
  105. package/views/3d/support/pointsOfInterest/CameraOnSurface.js +1 -1
  106. package/views/3d/support/renderInfoUtils/line.js +1 -1
  107. package/views/3d/support/viewpointUtils.js +1 -1
  108. package/views/3d/webgl-engine/collections/Component/ComponentObject.js +1 -1
  109. package/views/3d/webgl-engine/collections/Component/Material/ComponentData.glsl.js +13 -12
  110. package/views/3d/webgl-engine/effects/globalIllumination/GlobalIllumination.js +1 -1
  111. package/views/3d/webgl.js +1 -1
  112. package/views/SceneView.d.ts +1 -0
  113. package/views/draw/support/editingSessionUtils.js +2 -0
  114. package/views/interactive/sketch/SketchTooltipOptions.d.ts +9 -1
  115. package/views/support/Scheduler.js +1 -1
  116. package/widgets/BatchAttributeForm/BatchAttributeFormViewModel.js +1 -1
  117. package/widgets/BatchAttributeForm/inputs/support/createBatchFormInputs.js +1 -1
  118. package/widgets/BatchAttributeForm/templates/support/createBatchFormTemplate.js +1 -1
  119. package/widgets/Editor/CreateFeaturesWorkflow.js +1 -1
  120. package/widgets/Editor/EditorViewModel.js +1 -1
  121. package/widgets/Editor/MergeFeaturesWorkflow.js +1 -1
  122. package/widgets/Editor/SplitFeatureWorkflow.js +1 -1
  123. package/widgets/Editor/UpdateFeatureWorkflow.js +1 -1
  124. package/widgets/Editor/UpdateFeaturesWorkflowData.js +1 -1
  125. package/widgets/Editor/support/SketchController.js +1 -1
  126. package/widgets/Editor/workflowUtils.js +1 -1
  127. package/assets/esri/core/workers/chunks/027c3ea756db68e51f0a.js +0 -1
  128. package/assets/esri/core/workers/chunks/0c00e5e4bd18467bcecd.js +0 -1
  129. package/assets/esri/core/workers/chunks/0ef93722524620023f69.js +0 -1
  130. package/assets/esri/core/workers/chunks/266ba61b72a278d93a26.js +0 -1
  131. package/assets/esri/core/workers/chunks/2abf124e2956e4f76688.js +0 -1
  132. package/assets/esri/core/workers/chunks/30f04dc001eaf838d64c.js +0 -1
  133. package/assets/esri/core/workers/chunks/43678e08a3d9d51c2a6d.js +0 -1
  134. package/assets/esri/core/workers/chunks/5b278b9980752ef495a2.js +0 -1
  135. package/assets/esri/core/workers/chunks/5e59ff96aecdf2adcb3b.js +0 -1
  136. package/assets/esri/core/workers/chunks/74be994d789c57031631.js +0 -1
  137. package/assets/esri/core/workers/chunks/770880ad43f252962017.js +0 -1
  138. package/assets/esri/core/workers/chunks/81750c5177d8d52a3e05.js +0 -1
  139. package/assets/esri/core/workers/chunks/9eb4ae556950e1d0124d.js +0 -2
  140. package/assets/esri/core/workers/chunks/a11f05ddd8314b648f76.js +0 -1
  141. package/assets/esri/core/workers/chunks/af5db0372d526e592fcc.js +0 -1
  142. package/assets/esri/core/workers/chunks/bc53ce9a643f82d516c2.js +0 -1
  143. package/assets/esri/core/workers/chunks/c3381b9a36299210ee47.js +0 -1
  144. package/assets/esri/core/workers/chunks/d65b1234867f7d773d50.js +0 -2
  145. package/assets/esri/core/workers/chunks/d8d7331600d93bbca2b4.js +0 -1
  146. package/assets/esri/core/workers/chunks/e272411e2c9378aa8496.js +0 -1312
  147. package/assets/esri/core/workers/chunks/fa160a2a5dc9f5a7c34b.js +0 -1
  148. package/geometry/support/triangulationUtilsDeprecated.js +0 -2
  149. package/views/3d/layers/graphics/extrudeUtilsDeprecated.js +0 -2
  150. package/views/3d/support/renderInfoUtils/polygonDeprecated.js +0 -2
  151. /package/assets/esri/core/workers/chunks/{9eb4ae556950e1d0124d.js.LICENSE.txt → 5511e640e171c294f52a.js.LICENSE.txt} +0 -0
  152. /package/assets/esri/core/workers/chunks/{d65b1234867f7d773d50.js.LICENSE.txt → c5f155fe114a2a05aaf2.js.LICENSE.txt} +0 -0
@@ -1 +1 @@
1
- "use strict";(self.webpackChunkRemoteClient=self.webpackChunkRemoteClient||[]).push([[9235],{34930(t,e,s){s.d(e,{$Q:()=>a,Sd:()=>u,b7:()=>l});var n=s(86211),r=s(5443),o=s(86738),i=s(14140);async function a(t,e,n){if("extent"===n.type)return function(t,e,s){const{width:n,height:r}=t,o=new Uint8Array(n*r),a=e.width/n,u=e.height/r;if(s.width/a<.5||s.height/u<.5)return new i.A({pixelType:t.pixelType,width:n,height:r,mask:o,pixels:[...t.pixels]});const{xmin:l,xmax:c,ymin:p,ymax:h}=e,{xmin:m,xmax:d,ymin:g,ymax:f}=s,y=Math.max(l,m),x=Math.min(c,d),w=Math.max(p,g),A=Math.min(h,f),v=.5*a,C=.5*u;if(x-y<v||A-w<C||x<l+v||y>c-v||w>h-C||A<p+C)return new i.A({pixelType:t.pixelType,width:n,height:r,mask:o,pixels:[...t.pixels]});const b=Math.max(0,(y-l)/a),M=Math.min(n,Math.max(0,(x-l)/a)),T=Math.max(0,(h-A)/u),P=Math.min(r,Math.max(0,(h-w)/u)),N=Math.round(b),I=Math.round(M)-1,R=Math.round(T),F=Math.round(P)-1;if(N===I&&b%1>.5&&M%1<.5||R===F&&T%1>.5&&P%1<.5)return new i.A({pixelType:t.pixelType,width:n,height:r,mask:o,pixels:[...t.pixels]});if(0===N&&0===R&&I===n&&F===r)return t;const k=t.mask;for(let t=R;t<=F;t++)for(let e=N;e<=I;e++){const s=t*n+e;o[s]=k?k[s]:255}return new i.A({pixelType:t.pixelType,width:n,height:r,mask:o,pixels:[...t.pixels]})}(t,e,n);const{width:r,height:o}=t,a=new Uint8Array(r*o);return(await Promise.all([s.e(3661),s.e(1878),s.e(8885),s.e(5756),s.e(3299),s.e(1132)]).then(s.bind(s,25275))).execute(e,n)?"polyline"===n.type?function(t,e,s){const{width:n,height:r}=t,o=new Uint8Array(n*r),a=e.width/n,u=e.height/r,{xmin:l,ymax:c}=e,{paths:p}=s,h=t.mask;for(let t=0;t<p.length;t++){const e=p[t];for(let t=0;t<e.length-1;t++){const[s,i]=e[t],[p,m]=e[t+1],d=Math.min(i,m),g=Math.max(i,m),f=Math.max(0,Math.floor((c-g)/u)),y=Math.min(r-1,Math.floor((c-d)/u));if(!(y<f))if(f===y){const t=Math.min(s,p),e=Math.max(s,p),r=Math.max(0,Math.floor((t-l)/a)),i=Math.min(n-1,Math.floor((e-l)/a));if(i<r)continue;const u=f*n;for(let t=u+r;t<=u+i;t++)o[t]=h?h[t]:255}else{const t=(s-l)/a,e=(p-s)/(m-i)/a,r=u*e;for(let s=f;s<=y;s++){const a=e*(c-s*u-i)+t,l=Math.max(0,Math.floor(r>0?a-r:a)),p=Math.min(n-1,Math.floor(r>0?a:a-r));if(p<l)continue;const m=s*n;for(let t=m+l;t<=m+p;t++)o[t]=h?h[t]:255}}}}return new i.A({pixelType:t.pixelType,width:n,height:r,mask:o,pixels:[...t.pixels]})}(t,e,n):(await Promise.all([s.e(3661),s.e(1878),s.e(8885),s.e(5756),s.e(3299),s.e(6671)]).then(s.bind(s,30912))).execute(n,e)?t:function(t,e,s){if(!t)return t;const{width:n,height:r}=t,o=function(t){const{geometry:e,size:s,srcExtent:n,srcMask:r}=t,[o,i]=s;let a;const u=n.width/o,l=n.height/i,{xmin:c,ymax:p}=n;if("extent"===e.type){const t=(e.xmin-c)/u,s=(e.xmax-c)/u,n=(p-e.ymax)/l,r=(p-e.ymin)/l;a=[[[t,n],[t,r],[s,r],[s,n],[t,n]]]}else a=e.rings.map(t=>t.map(([t,e])=>[(t-c)/u,(p-e)/l]));return function(t,e,s){const[n,r]=e,o=new OffscreenCanvas(n,r).getContext("2d");o.fillStyle="#f00",o.beginPath(),t.forEach(t=>{o.moveTo(t[0][0],t[0][1]);for(let e=0;e<t.length;e++)o.lineTo(t[e][0],t[e][1]);o.closePath()}),o.fill();const i=o.getImageData(0,0,n,r).data,a=n*r,u=new Uint8Array(a);let l=!1;for(let t=0;t<a;t++)s&&!s[t]||(i[4*t+3]>127?u[t]=255:l=!0);return l||s?u:void 0}(a,s,r)}({geometry:s,size:[n,r],srcExtent:e,srcMask:t.mask});return new i.A({pixelType:t.pixelType,width:n,height:r,mask:o,maskIsAlpha:!1,pixels:[...t.pixels]})}(t,e,n):new i.A({pixelType:t.pixelType,width:r,height:o,mask:a,maskIsAlpha:!1,pixels:[...t.pixels]})}function u(t,e){const{extent:s}=l(t,e,new o.A({x:t.pixelSize.x,y:t.pixelSize.y,spatialReference:t.spatialReference})),{extent:n}=t.extent;if(s.xmax=Math.min(s.xmax,n.xmax),s.ymax=Math.min(s.ymax,n.ymax),s.xmin<s.xmax&&s.ymin<s.ymax){const{x:e,y:n}=t.pixelSize,r=Math.round(s.width/e),o=Math.round(s.height/n);t.extent=s,t.width=r,t.height=o}}function l(t,e,s,o=!0){const{spatialReference:i}=t,{x:a,y:u}=function(t,e){if(t.spatialReference.equals(e))return t;const s=(0,n.GA)(t.spatialReference),r=(0,n.GA)(e);if(s===r)return t;const o=s/r;return{x:t.x*o,y:t.y*o}}(s,i);let l,c,p;const h="extent"===e.type?e:e.extent;let{xmin:m,xmax:d,ymax:g,ymin:f}=h;const{xmin:y,ymax:x}=t.extent;return o?(m=y+(m>y?a*Math.round((m-y)/a):0),g=x-(g<x?u*Math.round((x-g)/u):0),d=y+(d>y?a*Math.round((d-y)/a):0),f=x-(f<x?u*Math.round((x-f)/u):0),l=new r.A({xmin:m,ymax:g,xmax:d,ymin:f,spatialReference:i}),c=Math.round(l.width/a),p=Math.round(l.height/u)):(c=Math.floor((d-m)/a+.8),p=Math.floor((g-f)/u+.8),m=y+(m>y?a*Math.floor((m-y)/a+.1):0),g=x-(g<x?u*Math.floor((x-g)/u+.1):0),d=m+c*a,f=g-p*u,l=new r.A({xmin:m,ymax:g,xmax:d,ymin:f,spatialReference:i})),{extent:l,width:c,height:p}}},99235(t,e,s){s.d(e,{vt:()=>Un,UD:()=>Vn});var n=s(85334),r=s(49186),o=s(4718),i=s(5482),a=s(91429),u=s(94778),l=s(25482);let c=class extends l.o{constructor(){super(...arguments),this.raster=void 0}};(0,i.Cg)([(0,a.MZ)({json:{write:!0}})],c.prototype,"raster",void 0),c=(0,i.Cg)([(0,a.$K)("esri.layers.raster.functions.BaseFunctionArguments")],c);const p=c;var h;let m=h=class extends p{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,i.Cg)([(0,a.MZ)({json:{write:!0}})],m.prototype,"operation",void 0),(0,i.Cg)([(0,a.MZ)({json:{write:!0}})],m.prototype,"raster2",void 0),(0,i.Cg)([(0,a.MZ)({readOnly:!0})],m.prototype,"rasters",null),m=h=(0,i.Cg)([(0,a.$K)("esri.layers.raster.functions.ArithmeticFunctionArguments")],m);const d=m;var g=s(14140),f=s(87186);const y=new Set(["slope","aspect","curvature","hillshade","shadedrelief","statistics"]);let x=class extends l.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(){const t=this.getWebGLProcessorDefinition();if(!t)return null;const e=[t],{parameters:s}=t;let n=s.rasters||s.raster&&[s.raster];for(;n?.length;){e.unshift(...n);const t=[];for(let e=0;e<n.length;e++){const{parameters:s}=n[e],r=s.rasters||s.raster&&[s.raster];r?.length&&t.push(...r)}n=t}for(let t=e.length-1;t>=0;t--)e[t].isNoopProcess&&e.splice(t,1);let r=!1;for(let t=0;t<e.length;t++){const s=e[t];s.id=e.length-t-1;const{rasters:n}=s.parameters;r=r||null!=n&&n.length>1}const o=e.some(({name:t})=>y.has(t.toLowerCase())),{rawSourceRasterInfos:i}=this;return{functions:e,hasBranches:r,hasFocalFunction:o,isSourceSingleBand:1===i?.[0]?.bandCount}}get neighborhoodSize(){let{rows:t,cols:e}=this._getNeighborhoodSize();const s=this.getImmediateChildFunctions();for(const n of s){const s=n.neighborhoodSize;t=Math.max(t,s.rows),e=Math.max(e,s.cols)}return{rows:t,cols:e}}bind(t,e=!1,s=-1){this.id=s+1;const n=this._getRasterValues();let r=!0;for(let s=0;s<n.length;s++){const o=n[s];if(null!=o&&this._isRasterFunctionValue(o)){const n=o.bind(t,e,this.id+s);if(!n.success)return this._bindingResult=n,n;r=r&&n.supportsGPU}}return!this.rasterInfo||e?(this.sourceRasterInfos=this._getSourceRasterInfos(t),this._bindingResult=this._bindSourceRasters(),r&&=this._bindingResult.supportsGPU,this._bindingResult.success&&(this._patchRasterInfo(),r&&this.isRoot)&&(this.processInputBandIds(),this.swizzleInputBandIds(this.rawInputBandIds)||(r=this.rawInputBandIds.length<=3)),this._bindingResult.supportsGPU=r,this._bindingResult):(this._bindingResult={success:!0,supportsGPU:!0},this._bindingResult)}queryRasterFunction(t){const e=[this];for(;e.length;){const s=e.pop();if(t(s))return s;const n=s.getImmediateChildFunctions();e.push(...n)}}getImmediateChildFunctions(){return this._getRasterValues().filter(t=>t&&"object"==typeof t&&"bind"in t)}process(t,e){const s=this._getRasterValues(),n=0===s.length?t.pixelBlocks??t.primaryPixelBlocks:s.map(s=>this._readRasterValue(s,t,e));return this._processPixels({...t,pixelBlocks:n},e)}processInputBandIds(){const t=this._getRasterValues().filter(this._isRasterFunctionValue);if(t.length>1){const e=t.map(t=>t.processInputBandIds());return this.rawInputBandIds=[...new Set(e.flat())],this.rawInputBandIds}const e=t[0];if(e)return this.rawInputBandIds=e.processInputBandIds(),this.rawInputBandIds;const{bandCount:s}=this.sourceRasterInfos[0],n=Array.from({length:s},(t,e)=>e);return this.rawInputBandIds=this._getInputBandIds(n),this.rawInputBandIds}swizzleInputBandIds(t){const e=this._getRasterValues().filter(this._isRasterFunctionValue);let s=!0;for(const n of e)s=n.swizzleInputBandIds(t)&&s;return!!s&&this._swizzleBandIds(t)}getPrimaryRasters(){const t=[],e=[];return this._getPrimaryRasters(this,t,e),{rasters:t,rasterIds:e}}getWebGLProcessorDefinition(){const t=this._getWebGLParameters(),{raster:e,rasters:s}=this.functionArguments;return s&&Array.isArray(s)&&s.length?(t.rasters=s.map(t=>this._isRasterFunctionValue(t)?t.getWebGLProcessorDefinition():"number"==typeof t?{name:"Constant",parameters:{value:t},pixelType:"f32",id:-1,isNoopProcess:!1}:{name:"Identity",parameters:{value:t},pixelType:"f32",id:-1,isNoopProcess:!1}),t.rasters.some(t=>null!=t)||(t.rasters=null)):this._isRasterFunctionValue(e)&&(t.raster=e.getWebGLProcessorDefinition()),{name:this.functionName,parameters:t,pixelType:this.outputPixelType,id:this.id,isNoopProcess:this.isNoopProcess}}getClippingGeometries(){const t=[];"Clip"===this.functionName&&t.push(this.functionArguments);const{raster:e,rasters:s}=this.functionArguments;if(s&&Array.isArray(s)&&s.length)s.forEach(e=>{if(this._isRasterFunctionValue(e)){const s=e.getClippingGeometries();t.push(...s)}});else if(this._isRasterFunctionValue(e)){const s=e.getClippingGeometries();t.push(...s)}return t}_getOutputPixelType(t){return"unknown"===this.outputPixelType?t:this.outputPixelType??t}_getWebGLParameters(){return{}}_getInputBandIds(t){return t}_swizzleBandIds(t){return!0}_isInputRasterPrimaryOrConstant(){return!this._getRasterValues().some(t=>t&&"object"==typeof t&&"rasterFunction"in t&&t.rasterFunction)}_getNeighborhoodSize(){return{rows:1,cols:1}}_removeStatsHistColormapVAT(t){t.statistics=null,t.histograms=null,t.colormap=null,t.attributeTable=null,t.multidimensionalInfo?.variables.forEach(t=>{t.statistics=void 0,t.histograms=void 0})}_getRasterValues(){const{rasterArgumentNames:t}=this;return"rasters"===t[0]?this.functionArguments.rasters??[]:t.flatMap(t=>this.functionArguments[t])}_getSourceRasterInfos(t){const e=this._getRasterValues(),{rasterInfos:s,rasterIds:n}=t;if(0===e.length)return s;const r=e.map(t=>t&&"object"==typeof t&&"bind"in t&&t.rasterInfo?t.rasterInfo:"string"==typeof t&&n.includes(t)?s[n.indexOf(t)]:"number"!=typeof t?s[0]:void 0),o=r.find(t=>t)??s[0];return r.forEach((t,e)=>{void 0===t&&(r[e]=o)}),r}_getPrimaryRasterId(t){return t?.rasterId}_getPrimaryRasters(t,e=[],s=[]){for(let n=0;n<t.sourceRasters.length;n++){const r=t.sourceRasters[n];if("number"!=typeof r)if("bind"in r)this._getPrimaryRasters(r,e,s);else{const t=r,n=this._getPrimaryRasterId(t);if(null==n)continue;s.includes(n)||(this.mainPrimaryRasterId===n?(e.unshift(t),s.unshift(n)):(e.push(t),s.push(n)))}}}_isRasterFunctionValue(t){return null!=t&&"object"==typeof t&&"getWebGLProcessorDefinition"in t}_readRasterValue(t,e,s){const{primaryPixelBlocks:n}=e;if(null==t||"$$"===t){const t=n[0];return null==t?null:t.clone()}if("string"==typeof t){const s=e.primaryRasterIds.indexOf(t);return-1===s?null:n[s]}if("number"==typeof t){const e=n[0];if(null==e)return null;const{width:s,height:r,pixelType:o}=e,i=new Float32Array(s*r);i.fill(t);const a=this.sourceRasterInfos[0].bandCount,u=new Array(a).fill(i);return new g.A({width:s,height:r,pixelType:o,pixels:u})}return t.process(e,s)}_patchRasterInfo(){const{rasterInfo:t}=this;if(!t?.keyProperties)return;const{bandCount:e,keyProperties:s,statistics:n,histograms:r}=t,o=s.BandProperties;o&&o.length!==e&&(t.keyProperties={...s,BandProperties:void 0}),n&&n.length!==e&&(t.statistics=n.length>e?n.slice(0,e):null),r&&r.length!==e&&(t.histograms=r.length>e?r.slice(0,e):null),s.BAND_COUNT&&Number(s.BAND_COUNT)!==e&&(t.keyProperties={...s,BAND_COUNT:"string"==typeof s.BAND_COUNT?String(e):e})}};(0,i.Cg)([(0,a.MZ)({json:{write:!0}})],x.prototype,"functionName",void 0),(0,i.Cg)([(0,a.MZ)({json:{write:!0}})],x.prototype,"functionArguments",void 0),(0,i.Cg)([(0,a.MZ)()],x.prototype,"rasterArgumentNames",void 0),(0,i.Cg)([(0,a.MZ)({json:{write:!0}}),(0,a.wg)(t=>t?.toLowerCase())],x.prototype,"outputPixelType",void 0),(0,i.Cg)([(0,a.MZ)({json:{write:!0}})],x.prototype,"mainPrimaryRasterId",void 0),(0,i.Cg)([(0,a.MZ)()],x.prototype,"sourceRasters",void 0),(0,i.Cg)([(0,a.MZ)({type:[f.A],json:{write:!0}})],x.prototype,"sourceRasterInfos",void 0),(0,i.Cg)([(0,a.MZ)({json:{write:!0}})],x.prototype,"rasterInfo",void 0),(0,i.Cg)([(0,a.MZ)({json:{write:!0}})],x.prototype,"readingBufferSize",void 0),(0,i.Cg)([(0,a.MZ)({json:{write:!0}})],x.prototype,"id",void 0),(0,i.Cg)([(0,a.MZ)()],x.prototype,"isNoopProcess",void 0),(0,i.Cg)([(0,a.MZ)()],x.prototype,"supportsGPU",null),(0,i.Cg)([(0,a.MZ)({json:{write:!0}})],x.prototype,"rawInputBandIds",void 0),(0,i.Cg)([(0,a.MZ)()],x.prototype,"rawSourceRasterInfos",void 0),(0,i.Cg)([(0,a.MZ)({json:{write:!0}})],x.prototype,"isInputBandIdsSwizzled",void 0),(0,i.Cg)([(0,a.MZ)({json:{write:!0}})],x.prototype,"swizzledBandSelection",void 0),(0,i.Cg)([(0,a.MZ)()],x.prototype,"isBranch",void 0),(0,i.Cg)([(0,a.MZ)()],x.prototype,"isRoot",void 0),(0,i.Cg)([(0,a.MZ)({readOnly:!0})],x.prototype,"flatWebGLFunctionChain",null),(0,i.Cg)([(0,a.MZ)({readOnly:!0})],x.prototype,"neighborhoodSize",null),(0,i.Cg)([(0,a.MZ)()],x.prototype,"_bindingResult",void 0),x=(0,i.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},C={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},b={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,...C,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,...b},T=new Map([[C.acos,{domain:[0,Math.PI],isInteger:!1}],[C.asin,{domain:[-Math.PI/2,Math.PI/2],isInteger:!1}],[C.atan,{domain:[-Math.PI/2,Math.PI/2],isInteger:!1}],[C.cos,{domain:[-1,1],isInteger:!1}],[C.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 P(t){return T.get(t)}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 I(t,e,s){const[n,r]=t,o=n.length,i=g.A.createEmptyBand(s,o);for(let t=0;t<o;t++)e&&!e[t]||(i[t]=n[t]+r[t]);return i}function R(t,e,s){const[n]=t,r=n.length,o=g.A.createEmptyBand("f32",r);return o.set(n),o}function F(t,e,s){const[n]=t,r=n.length,o=g.A.createEmptyBand(s,r);for(let t=0;t<r;t++)e&&!e[t]||(o[t]=n[t]*n[t]);return o}function k(t,e,s){const[n,r]=t,o=n.length,i=g.A.createEmptyBand(s,o);for(let t=0;t<o;t++)e&&!e[t]||(i[t]=n[t]-r[t]);return i}function _(t,e,s){const[n,r]=t,o=n.length,i=g.A.createEmptyBand(s,o);for(let t=0;t<o;t++)e&&!e[t]||(i[t]=n[t]*r[t]);return i}function S(t,e,s){const[n]=t,r=n.length,o=g.A.createEmptyBand(s,r);for(let t=0;t<r;t++)e&&!e[t]||(o[t]=Math.sign(n[t])*Math.floor(Math.abs(n[t])));return o}function B(t,e,s){const[n,r]=t,o=n.length,i=g.A.createEmptyBand(s,o);for(let t=0;t<o;t++)e&&!e[t]||(i[t]=n[t]/r[t]);return i}function j(t,e,s){return B(t,e,"f32")}function Z(t,e,s){const[n,r]=t,o=n.length,i=g.A.createEmptyBand(s,o);for(let t=0;t<o;t++)e&&!e[t]||(i[t]=Math.floor(n[t]/r[t]));return i}function z(t,e,s,n){const r=t[0],o=r.length,i=g.A.createEmptyBand(s,o);if(n===C.atanh){for(let t=0;t<o;t++)if(e[t]){const s=r[t];Math.abs(s)>=1?e[t]=0:i[t]=Math.atanh(s)}return i}const a=n===C.asin?Math.asin:Math.acos;for(let t=0;t<o;t++)if(e[t]){const s=r[t];Math.abs(s)>1?e[t]=0:i[t]=a(s)}return i}function G(t,e,s,n){const[r]=t,o=r.length,i=g.A.createEmptyBand(s,o);for(let t=0;t<o;t++)e&&!e[t]||(i[t]=n(r[t]));return i}function O(t,e,s,n){const[r,o]=t,i=r.length,a=g.A.createEmptyBand(s,i);for(let t=0;t<i;t++)e&&!e[t]||(a[t]=n(r[t],o[t]));return a}function D(t,e,s){const[n,r]=t,o=n.length,i=g.A.createEmptyBand(s,o);for(let t=0;t<o;t++)e&&!e[t]||(i[t]=n[t]&r[t]);return i}function E(t,e,s){const[n,r]=t,o=n.length,i=g.A.createEmptyBand(s,o);for(let t=0;t<o;t++)e&&!e[t]||(i[t]=n[t]<<r[t]);return i}function V(t,e,s){const[n]=t,r=n.length,o=g.A.createEmptyBand(s,r);for(let t=0;t<r;t++)e&&!e[t]||(o[t]=~n[t]);return o}function U(t,e,s){const[n,r]=t,o=n.length,i=g.A.createEmptyBand(s,o);for(let t=0;t<o;t++)e&&!e[t]||(i[t]=n[t]|r[t]);return i}function L(t,e,s){const[n,r]=t,o=n.length,i=g.A.createEmptyBand(s,o);for(let t=0;t<o;t++)e&&!e[t]||(i[t]=n[t]>>r[t]);return i}function $(t,e,s){const[n,r]=t,o=n.length,i=g.A.createEmptyBand(s,o);for(let t=0;t<o;t++)e&&!e[t]||(i[t]=n[t]^r[t]);return i}function K(t,e,s){const[n,r]=t,o=n.length,i=g.A.createEmptyBand(s,o);for(let t=0;t<o;t++)e&&!e[t]||(i[t]=n[t]&&r[t]?1:0);return i}function W(t,e,s){const[n]=t,r=n.length,o=g.A.createEmptyBand(s,r);for(let t=0;t<r;t++)e&&!e[t]||(o[t]=n[t]?0:1);return o}function H(t,e,s){const[n,r]=t,o=n.length,i=g.A.createEmptyBand(s,o);for(let t=0;t<o;t++)e&&!e[t]||(i[t]=n[t]||r[t]?1:0);return i}function q(t,e,s){const[n,r]=t,o=n.length,i=g.A.createEmptyBand(s,o);for(let t=0;t<o;t++)e&&!e[t]||(i[t]=(n[t]?1:0)^(r[t]?1:0));return i}function J(t,e,s){const[n,r]=t,o=n.length,i=g.A.createEmptyBand(s,o);for(let t=0;t<o;t++)e&&!e[t]||(i[t]=n[t]===r[t]?1:0);return i}function X(t,e,s,n){const[r]=t,o=r.length,i=g.A.createEmptyBand(s,o),a=n===Math.E;for(let t=0;t<o;t++)e&&!e[t]||(i[t]=a?Math.exp(r[t]):n**r[t]);return i}function Q(t,e,s){return X(t,e,s,10)}function Y(t,e,s){return X(t,e,s,2)}function tt(t,e,s){return X(t,e,s,Math.E)}function et(t,e,s,n){const[r]=t,o=r.length,i=g.A.createEmptyBand(s,o);for(let t=0;t<o;t++)e&&!e[t]||(r[t]<=0?e[t]=0:i[t]=n(r[t]));return i}function st(t,e,s){return et(t,e,s,Math.log10)}function nt(t,e,s){return et(t,e,s,Math.log2)}function rt(t,e,s){return et(t,e,s,Math.log)}function ot(t,e,s){const[n,r]=t,o=n.length,i=g.A.createEmptyBand(s,o);for(let t=0;t<o;t++)e&&!e[t]||(i[t]=n[t]>r[t]?1:0);return i}function it(t,e,s){const[n,r]=t,o=n.length,i=g.A.createEmptyBand(s,o);for(let t=0;t<o;t++)e&&!e[t]||(i[t]=n[t]>=r[t]?1:0);return i}function at(t,e,s){const[n,r]=t,o=n.length,i=g.A.createEmptyBand(s,o);for(let t=0;t<o;t++)e&&!e[t]||(i[t]=n[t]<r[t]?1:0);return i}function ut(t,e,s){const[n,r]=t,o=n.length,i=g.A.createEmptyBand(s,o);for(let t=0;t<o;t++)e&&!e[t]||(i[t]=n[t]<=r[t]?1:0);return i}function lt(t,e,s){const[n]=t,r=n.length,o=g.A.createEmptyBand(s,r);if(!e)return o;for(let t=0;t<r;t++)o[t]=e[t]?0:1;return o}function ct(t,e,s){const[n,r]=t,o=n.length,i=g.A.createEmptyBand(s,o);for(let t=0;t<o;t++)e&&!e[t]||(i[t]=n[t]%r[t]);return i}function pt(t,e,s){const[n]=t,r=n.length,o=g.A.createEmptyBand(s,r);for(let t=0;t<r;t++)e&&!e[t]||(o[t]=-n[t]);return o}function ht(t,e,s){const[n,r]=t,o=n.length,i=g.A.createEmptyBand(s,o);for(let t=0;t<o;t++)e&&!e[t]||(i[t]=n[t]===r[t]?0:1);return i}function mt(t,e,s){const[n,r]=t,o=n.length,i=g.A.createEmptyBand(s,o),a=new Uint8Array(o);for(let t=0;t<o;t++)null!=e&&!e[t]||0!==n[t]||(i[t]=r[t],a[t]=255);return{band:i,mask:a}}function dt(t,e,s){const[n,r,o]=t,i=n.length,a=g.A.createEmptyBand(s,i);for(let t=0;t<i;t++)e&&!e[t]||(a[t]=n[t]?r[t]:o[t]);return a}function gt(t,e,s){const n=t.length;if(n<2)return t[0];const[r]=t,o=r.length,i=g.A.createEmptyBand(s,o);for(let s=0;s<o;s++)if(!e||e[s]){let e=r[s];for(let r=1;r<n;r++){const n=t[r][s];e<n&&(e=n)}i[s]=e}return i}function ft(t,e,s){const n=t.length;if(n<2)return t[0];const[r]=t,o=r.length,i=g.A.createEmptyBand(s,o);for(let s=0;s<o;s++)if(!e||e[s]){let e=r[s];for(let r=1;r<n;r++){const n=t[r][s];e>n&&(e=n)}i[s]=e}return i}function yt(t,e,s){const n=t.length;if(n<2)return t[0];const[r]=t,o=r.length,i=g.A.createEmptyBand(s,o);for(let s=0;s<o;s++)if(!e||e[s]){let e=r[s],o=e;for(let r=1;r<n;r++){const n=t[r][s];o<n?o=n:e>n&&(e=n)}i[s]=o-e}return i}function xt(t,e,s){const n=t.length;if(n<2)return t[0];const[r]=t,o=r.length,i=g.A.createEmptyBand(s,o);for(let s=0;s<o;s++)if(!e||e[s]){let e=0;for(let r=0;r<n;r++)e+=t[r][s];i[s]=e/n}return i}function wt(t,e,s){const n=t.length;if(n<2)return t[0];const[r]=t,o=r.length,i=g.A.createEmptyBand(s,o);for(let s=0;s<o;s++)if(!e||e[s])for(let e=0;e<n;e++){const n=t[e];i[s]+=n[s]}return i}function At(t,e,s){const n=t.length;if(n<2)return t[0];const[r]=t,o=r.length,i=g.A.createEmptyBand(s,o);for(let s=0;s<o;s++)if(!e||e[s]){const e=new Float32Array(n);let r=0;for(let o=0;o<n;o++){const n=t[o];r+=n[s],e[o]=n[s]}r/=n;let o=0;for(let t=0;t<n;t++)o+=(e[t]-r)**2;i[s]=Math.sqrt(o/n)}return i}function vt(t,e,s){const n=t.length;if(n<2)return t[0];const r=Math.floor(n/2),[o]=t,i=o.length,a=g.A.createEmptyBand(s,i),u=new Float32Array(n),l=n%2==1;for(let s=0;s<i;s++)if(!e||e[s]){for(let e=0;e<n;e++)u[e]=t[e][s];u.sort(),a[s]=l?u[r]:(u[r]+u[r-1])/2}return a}function Ct(t,e,s){const[n,r]=t;if(null==r)return n;const o=n.length,i=g.A.createEmptyBand(s,o);for(let t=0;t<o;t++)e&&!e[t]||(i[t]=n[t]<r[t]?n[t]:r[t]);return i}function bt(t,e,s){const n=t.length;if(n<=2)return Ct(t,e,s);const r=t[0].length,o=g.A.createEmptyBand(s,r),i=new Map;for(let s=0;s<r;s++)if(!e||e[s]){i.clear();for(let e=0;e<n;e++){const n=t[e][s];i.set(n,i.has(n)?i.get(n)+1:1)}let e=0,r=0;const a=[];for(const t of i.keys())e=i.get(t),e>r?(r=e,a.length=0,a.push(t)):e===r&&a.push(t);a.length>1&&a.sort((t,e)=>t-e),o[s]=a[0]}return o}function Mt(t,e,s){const n=t.length;if(n<=2)return Ct(t,e,s);const r=t[0].length,o=g.A.createEmptyBand(s,r),i=new Map;for(let s=0;s<r;s++)if(!e||e[s]){i.clear();for(let e=0;e<n;e++){const n=t[e][s];i.set(n,i.has(n)?i.get(n)+1:1)}let e=0,r=t.length;const a=[];for(const t of i.keys())e=i.get(t),e<r?(r=e,a.length=0,a.push(t)):e===r&&a.push(t);a.length>1&&a.sort((t,e)=>t-e),o[s]=a[0]}return o}function Tt(t,e,s){const n=t.length;if(n<2)return t[0];const[r]=t,o=r.length,i=g.A.createEmptyBand(s,o),a=new Set;for(let s=0;s<o;s++)if(!e||e[s]){let e;a.clear();for(let r=0;r<n;r++)e=t[r][s],a.add(e);i[s]=a.size}return i}const Pt=new Map,Nt=new Map,It=new Map,Rt=new Map;function Ft(){Pt.size||(Pt.set(4,Math.sqrt),Pt.set(6,Math.acos),Pt.set(7,Math.asin),Pt.set(8,Math.atan),Pt.set(9,Math.atanh),Pt.set(10,Math.abs),Pt.set(21,Math.cos),Pt.set(22,Math.cosh),Pt.set(48,Math.floor),Pt.set(49,Math.ceil),Pt.set(51,Math.sin),Pt.set(52,Math.sinh),Pt.set(56,Math.tan),Pt.set(57,Math.tanh),Pt.set(59,Math.acosh),Pt.set(60,Math.asinh),Pt.set(65,Math.floor),Nt.set(5,Math.pow),Nt.set(61,Math.atan2),It.set(1,I),It.set(2,k),It.set(3,_),It.set(11,D),It.set(12,E),It.set(13,V),It.set(14,U),It.set(15,L),It.set(16,$),It.set(17,K),It.set(18,W),It.set(19,H),It.set(20,q),It.set(23,B),It.set(24,J),It.set(25,tt),It.set(26,Q),It.set(27,Y),It.set(28,ot),It.set(29,it),It.set(30,S),It.set(31,lt),It.set(32,R),It.set(33,at),It.set(34,ut),It.set(35,rt),It.set(36,st),It.set(37,nt),It.set(44,ct),It.set(45,pt),It.set(46,ht),It.set(53,F),It.set(64,j),It.set(65,Z),It.set(76,dt),It.set(78,dt),Rt.set(38,bt),Rt.set(39,gt),Rt.set(40,xt),Rt.set(41,vt),Rt.set(42,ft),Rt.set(43,Mt),Rt.set(47,yt),Rt.set(54,At),Rt.set(55,wt),Rt.set(58,Tt),Rt.set(66,bt),Rt.set(67,gt),Rt.set(68,xt),Rt.set(69,vt),Rt.set(70,ft),Rt.set(71,Mt),Rt.set(72,yt),Rt.set(73,At),Rt.set(74,wt),Rt.set(75,Tt))}function kt(t,e,s={}){Ft();let n=function(t,e=!1){const s=t.map(t=>t.mask),n=s.filter(t=>null!=t),r=t[0].pixels[0].length;if(0===n.length||e&&n.length!==s.length)return new Uint8Array(r).fill(255);const o=n[0],i=new Uint8Array(o);if(1===n.length)return i;if(!e){for(let t=1;t<n.length;t++){const e=n[t];for(let t=0;t<i.length;t++)i[t]&&(i[t]=e[t]?255:0)}return i}for(let t=1;t<n.length;t++){const e=n[t];for(let t=0;t<i.length;t++)0===i[t]&&(i[t]=e[t]?255:0)}return i}(t,e>=66&&e<=75);const{outputPixelType:r="f32"}=s,o=!Rt.has(e)||s.processAsMultiband,i=o?t[0].pixels.length:1,a=[];for(let s=0;s<i;s++){const i=Rt.has(e)&&!o?t.flatMap(t=>t.pixels):t.map(t=>t.pixels[s]);let l,c=!0;if(e===b.setNull){const t=mt(i,n,r);l=t.band,n=t.mask,c=!1}else It.has(e)?l=It.get(e)(i,n,"f64"):Pt.has(e)?l=e===C.asin||e===C.acos||e===C.atanh?z(i,n,"f64",e):G(i,n,"f64",Pt.get(e)):Nt.has(e)?l=O(i,n,"f64",Nt.get(e)):Rt.has(e)?l=Rt.get(e)(i,n,"f64"):(l=i[0],c=!1);if(c&&e!==v.isNull&&!T.has(e)){const t=g.A.createEmptyBand(r,l.length);n||(n=new Uint8Array(l.length).fill(255)),(0,u.$p)(l,n),(0,u.yM)(l,n,r,t),l=t}a.push(l)}const l=t[0];return new g.A({width:l.width,height:l.height,pixelType:r,mask:e===v.isNull?null:n,pixels:a})}let _t=class extends w{constructor(){super(...arguments),this.functionName="Arithmetic",this.functionArguments=null,this.rasterArgumentNames=["raster","raster2"]}_bindSourceRasters(){const{operation:t}=this.functionArguments;if(t<1||t>6)return{success:!1,supportsGPU:!1,error:"unsupported operation"};const 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:e.bandCount<=3}}_processPixels(t){const{pixelBlocks:e}=t;return null==e?.[0]||null==e?.[1]?null:function(t,e,s){return kt(t,e=[null,1,2,3,23,5,44][e]??1,{outputPixelType:s})}(e,this.functionArguments.operation,this.outputPixelType)}_getWebGLParameters(){const{operation:t}=this.functionArguments,e=["","plus","minus","times","divide","power","mod"][t],s=this.outputPixelType??"f32";let[n,r]=(0,u.hP)(s);const o=(0,u.zw)(s);return o&&(n-=1e-4,r+=1e-4),{imageCount:2,operationName:e,domainRange:[n,r],isOutputRounded:o}}};(0,i.Cg)([(0,a.MZ)({json:{write:!0,name:"rasterFunction"}})],_t.prototype,"functionName",void 0),(0,i.Cg)([(0,a.MZ)({type:d,json:{write:!0,name:"rasterFunctionArguments"}})],_t.prototype,"functionArguments",void 0),(0,i.Cg)([(0,a.MZ)()],_t.prototype,"rasterArgumentNames",void 0),_t=(0,i.Cg)([(0,a.$K)("esri.layers.raster.functions.ArithmeticFunction")],_t);const St=_t;var Bt;let jt=Bt=class extends p{clone(){return new Bt({raster:this.raster})}};jt=Bt=(0,i.Cg)([(0,a.$K)("esri.layers.raster.functions.AspectFunctionArguments")],jt);const Zt=jt;var zt=s(51181);let Gt=class extends w{constructor(){super(...arguments),this.functionName="Aspect",this.functionArguments=null,this.rasterArgumentNames=["raster"],this.isGCS=!1}_bindSourceRasters(){const t=this.sourceRasterInfos[0];this.isGCS=t.spatialReference?.isGeographic??!1,this.outputPixelType=this._getOutputPixelType("f32");const e=t.clone();return e.pixelType=this.outputPixelType,this._removeStatsHistColormapVAT(e),e.statistics=[{min:-1,max:360,avg:180,stddev:30}],e.bandCount=1,this.rasterInfo=e,{success:!0,supportsGPU:!0}}_processPixels(t){const e=t.pixelBlocks?.[0];if(null==e)return null;const{extent:s,primaryPixelSizes:n}=t,r=n?.[0],o=r??(s?{x:s.width/e.width,y:s.height/e.height}:{x:1,y:1});return(0,zt.di)(e,{resolution:o})}_getNeighborhoodSize(){return{rows:3,cols:3}}};(0,i.Cg)([(0,a.MZ)({json:{write:!0,name:"rasterFunction"}})],Gt.prototype,"functionName",void 0),(0,i.Cg)([(0,a.MZ)({type:Zt,json:{write:!0,name:"rasterFunctionArguments"}})],Gt.prototype,"functionArguments",void 0),(0,i.Cg)([(0,a.MZ)()],Gt.prototype,"rasterArgumentNames",void 0),(0,i.Cg)([(0,a.MZ)({json:{write:!0}})],Gt.prototype,"isGCS",void 0),Gt=(0,i.Cg)([(0,a.$K)("esri.layers.raster.functions.AspectFunction")],Gt);const Ot=Gt;var Dt=s(66552);const Et=new Set(["+","-","*","/","(",")"]);function Vt(t,e){return t.toLowerCase().startsWith("b")?e[parseInt(t.slice(1),10)-1]:parseFloat(t)}function Ut(t,e,s,n){if("number"==typeof s&&"number"==typeof n)return s+n;let r,o,i;"number"==typeof s?(i=n,r=i.length,o=new Float32Array(r),o.fill(s)):(r=s.length,o=s,n.constructor===Number?(i=new Float32Array(r),i.fill(n)):i=n);const a=new Float32Array(r);switch(e){case"+":for(let e=0;e<r;e++)(null==t||t[e])&&(a[e]=o[e]+i[e]);break;case"-":for(let e=0;e<r;e++)(null==t||t[e])&&(a[e]=o[e]-i[e]);break;case"*":for(let e=0;e<r;e++)(null==t||t[e])&&(a[e]=o[e]*i[e]);break;case"/":for(let e=0;e<r;e++)(null==t||t[e])&&i[e]&&(a[e]=o[e]/i[e]);break;case"(":case")":throw new Error("encountered error with custom band index equation")}return a}function Lt(t,e){t.splice(e,1);let s=0,n=0;do{s=0,n=0;for(let e=0;e<t.length;e++)if("("===t[e])s=e;else if(")"===t[e]){n=e;break}n===s+1&&t.splice(s,2)}while(n===s+1);return t}function $t(t){if(1===t.length)return{opIndex:0,numIndex:0};let e=0,s=0;for(let n=0;n<t.length;n++)if("("===t[n])e=n;else if(")"===t[n]){s=n;break}const n=0===s?t:t.slice(e+1,s);let r=-1;for(let t=0;t<n.length;t++)if("*"===n[t]||"/"===n[t]){r=t;break}if(r>-1)s>0&&(r+=e+1);else{for(let t=0;t<n.length;t++)if("+"===n[t]||"-"===n[t]){r=t;break}s>0&&(r+=e+1)}let o=0;for(let e=0;e<r;e++)"("===t[e]&&o++;return{opIndex:r,numIndex:r-o}}var Kt=s(47520);const Wt=new Dt.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 Ht(t,e){if(!(0,Kt.AB)(t))return t;const{equation:s,method:n}=e,r=e.bandIndexes.map(t=>t-1),{pixels:o,mask:i}=t;let a;switch(n){case"gndvi":case"nbr":case"ndbi":case"ndvi":case"ndvi-re":case"ndsi":case"ndmi":case"mndwi":a=Jt(i,o[r[0]],o[r[1]]);break;case"ndwi":a=Jt(i,o[r[1]],o[r[0]]);break;case"sr":case"sr-re":case"iron-oxide":case"ferrous-minerals":case"clay-minerals":a=function(t,e,s){const n=s.length,r=new Float32Array(n);for(let o=0;o<n;o++)if(null==t||t[o]){const t=e[o],n=s[o];n&&(r[o]=t/n)}return[r]}(i,o[r[0]],o[r[1]]);break;case"ci-g":case"ci-re":a=function(t,e,s){const n=e.length,r=new Float32Array(n);for(let o=0;o<n;o++)if(null==t||t[o]){const t=e[o],n=s[o];n&&(r[o]=t/n-1)}return[r]}(i,o[r[0]],o[r[1]]);break;case"savi":a=function(t,e,s,n){const r=s.length,o=new Float32Array(r);for(let i=0;i<r;i++)if(null==t||t[i]){const t=s[i],r=e[i],a=r+t+n;a&&(o[i]=(r-t)/a*(1+n))}return[o]}(i,o[r[0]],o[r[1]],r[2]+1);break;case"tsavi":a=function(t,e,s,n,r,o){const i=s.length,a=new Float32Array(i),u=-r*n+o*(1+n*n);for(let o=0;o<i;o++)if(null==t||t[o]){const t=s[o],i=e[o],l=r*i+t+u;l&&(a[o]=n*(i-n*t-r)/l)}return[a]}(i,o[r[0]],o[r[1]],r[2]+1,r[3]+1,r[4]+1);break;case"msavi":a=function(t,e,s){const n=s.length,r=new Float32Array(n);for(let o=0;o<n;o++)if(null==t||t[o]){const t=s[o],n=e[o],i=2*n+1;r[o]=.5*(i-Math.sqrt(i*i-8*(n-t)))}return[r]}(i,o[r[0]],o[r[1]]);break;case"gemi":a=function(t,e,s){const n=s.length,r=new Float32Array(n);for(let o=0;o<n;o++)if(null==t||t[o]){const t=s[o],n=e[o];if(1!==t&&n+t+.5!==0){const e=(2*(n*n-t*t)+1.5*n+.5*t)/(n+t+.5);r[o]=e*(1-.25*e)-(t-.125)/(1-t)}}return[r]}(i,o[r[0]],o[r[1]]);break;case"pvi":a=function(t,e,s,n,r){const o=s.length,i=new Float32Array(o),a=1/Math.sqrt(1+n*n);for(let u=0;u<o;u++)if(null==t||t[u]){const t=s[u],o=e[u];i[u]=(o-n*t-r)*a}return[i]}(i,o[r[0]],o[r[1]],r[2]+1,r[3]+1);break;case"gvitm":a=function(t,e){const[s,n,r,o,i,a]=e,u=s.length,l=new Float32Array(u);for(let e=0;e<u;e++)(null==t||t[e])&&(l[e]=-.2848*s[e]-.2435*n[e]-.5436*r[e]+.7243*o[e]+.084*i[e]-.18*a[e]);return[l]}(i,[o[r[0]],o[r[1]],o[r[2]],o[r[3]],o[r[4]],o[r[5]]]);break;case"sultan":a=function(t,e){const[s,n,r,o,i]=e,a=s.length,u=new Float32Array(a),l=new Float32Array(a),c=new Float32Array(a);for(let e=0;e<a;e++)(null==t||t[e])&&(u[e]=i[e]?o[e]/i[e]*100:0,l[e]=s[e]?o[e]/s[e]*100:0,c[e]=r[e]?n[e]/r[e]*(o[e]/r[e])*100:0);return[u,l,c]}(i,[o[r[0]],o[r[1]],o[r[2]],o[r[3]],o[r[4]]]);break;case"vari":a=function(t,e){const[s,n,r]=e,o=s.length,i=new Float32Array(o);for(let e=0;e<o;e++)if(null==t||t[e])for(e=0;e<o;e++){const t=s[e],o=n[e],a=o+t-r[e];a&&(i[e]=(o-t)/a)}return[i]}(i,[o[r[0]],o[r[1]],o[r[2]]]);break;case"mtvi2":a=function(t,e){const[s,n,r]=e,o=s.length,i=new Float32Array(o);for(let e=0;e<o;e++)if(null==t||t[e])for(e=0;e<o;e++){const t=s[e],o=n[e],a=r[e],u=Math.sqrt((2*t+1)**2-(6*t-5*Math.sqrt(o))-.5);if(u){const s=1.5*(1.2*(t-a)-2.5*(o-a));i[e]=s/u}}return[i]}(i,[o[r[0]],o[r[1]],o[r[2]]]);break;case"rtvi-core":a=function(t,e){const[s,n,r]=e,o=s.length,i=new Float32Array(o);for(let e=0;e<o;e++)if(null==t||t[e])for(e=0;e<o;e++){const t=s[e],o=n[e],a=r[e];i[e]=100*(t-o)-10*(t-a)}return[i]}(i,[o[r[0]],o[r[1]],o[r[2]]]);break;case"evi":a=function(t,e){const[s,n,r]=e,o=s.length,i=new Float32Array(o);for(let e=0;e<o;e++)if(null==t||t[e])for(e=0;e<o;e++){const t=s[e],o=n[e],a=t+6*o-7.5*r[e]+1;a&&(i[e]=2.5*(t-o)/a)}return[i]}(i,[o[r[0]],o[r[1]],o[r[2]]]);break;case"wndwi":a=function(t,e,s=.5){const[n,r,o]=e,i=r.length,a=new Float32Array(i);for(let e=0;e<i;e++)if(null==t||t[e])for(e=0;e<i;e++){const t=n[e],i=r[e],u=o[e],l=t+s*i+(1-s)*u;l&&(a[e]=(t-s*i-(1-s)*u)/l)}return[a]}(i,[o[r[0]],o[r[1]],o[r[2]]],r[3]?r[3]+1:.5);break;case"bai":a=function(t,e,s){const n=s.length,r=new Float32Array(n);for(let o=0;o<n;o++)if(null==t||t[o])for(o=0;o<n;o++){const t=(.1-e[o])**2+(.06-s[o])**2;t&&(r[o]=1/t)}return[r]}(i,o[r[0]],o[r[1]]);break;case"custom":a=function(t,e,s){let n,{ops:r,nums:o}=function(t,e){(t=t.replaceAll(" ","")).startsWith("-")&&(t="0"+t),t.startsWith("+")&&(t=t.slice(1));const s=t.split(""),n=[],r=[];let o="";for(let t=0;t<s.length;t++){const i=s[t];Et.has(i)?(o.length&&r.push(Vt(o,e)),n.push(i),o=""):o=o.concat(i)}return o.length&&r.push(Vt(o,e)),{ops:n,nums:r}}(s,e);if(0===r.length){const t=1===o.length?o[0]:e[0];if(t instanceof Float32Array)return[t];const s=new Float32Array(e[0].length);return"number"==typeof t?s.fill(t):s.set(t),[s]}for(;r.length>0;){const{numIndex:e,opIndex:s}=$t(r);if(n=Ut(t,r[s],o[e],o[e+1]),1===r.length)break;r=Lt(r,s),o.splice(e,2,n)}return[n]}(i,o,s);break;default:return t}const{outputPixelType:l="f32"}=e,c=null!=l&&(0,u.zw)(l);let p;i?(p=new Uint8Array(t.width*t.height),p.set(i)):c&&(p=new Uint8Array(t.width*t.height).fill(255)),c&&(a=a.map(t=>{const e=g.A.createEmptyBand(l,t.length);return(0,u.yM)(t,p,l,e),e}));const h=new g.A({width:t.width,height:t.height,pixelType:l,pixels:a,mask:p});return h.updateStatistics(),h}function qt(t){const e=new Float32Array(9);return e[3*t[0]]=1,e[3*t[1]+1]=1,e[3*t[2]+2]=1,e}function Jt(t,e,s){const n=s.length,r=new Float32Array(n);for(let o=0;o<n;o++)if(null==t||t[o]){const t=e[o],n=s[o],i=t+n;i&&(r[o]=(t-n)/i)}return[r]}var Xt,Qt=s(93223);let Yt=Xt=class extends p{constructor(){super(...arguments),this.method="custom"}clone(){return new Xt({method:this.method,bandIndexes:this.bandIndexes,raster:(0,o.o8)(this.raster)})}};(0,i.Cg)([(0,a.MZ)({json:{type:String,write:!0}})],Yt.prototype,"bandIndexes",void 0),(0,i.Cg)([(0,Qt.e)(Wt)],Yt.prototype,"method",void 0),Yt=Xt=(0,i.Cg)([(0,a.$K)("esri.layers.raster.functions.BandArithmeticFunctionArguments")],Yt);const te=Yt,ee=new Set(["vari","mtvi2","rtvi-core","evi"]);let se=class extends w{constructor(){super(...arguments),this.functionName="BandArithmetic",this.functionArguments=null,this.rasterArgumentNames=["raster"]}_bindSourceRasters(){this.outputPixelType=this._getOutputPixelType("f32");const t=this.sourceRasterInfos[0];if(t.bandCount<2)return{success:!1,supportsGPU:!1,error:"band-arithmetic-function: source raster has insufficient amount of raster bands"};const e=t.clone();return e.pixelType=this.outputPixelType,e.bandCount="sultan"===this.functionArguments.method?3:1,this._removeStatsHistColormapVAT(e),e.keyProperties={...e.keyProperties,BandProperties:void 0},this.rasterInfo=e,{success:!0,supportsGPU:!["custom","gvitm","sultan"].includes(this.functionArguments.method)}}_processPixels(t){const e=t.pixelBlocks?.[0];if(null==e)return e;const{method:s,bandIndexes:n}=this.functionArguments,r=n.split(" ").map(t=>parseFloat(t));if(this.rasterInfo.storageInfo.isBsqTile){const{rawInputBandIds:t}=this,e=ee.has(this.functionArguments.method)?3:2,s=r.slice(0,e).map(e=>t.indexOf(e-1));r.splice(0,e,...s)}return Ht(e,{method:s,bandIndexes:r,equation:n,outputPixelType:this.outputPixelType})}_getWebGLParameters(){const t=this.functionArguments.bandIndexes.split(" ").map(t=>parseFloat(t)-1);2===t.length&&t.push(0);const e=this.isInputBandIdsSwizzled?[0,1,2]:t;let s,n;const r=new Float32Array(3),{method:o}=this.functionArguments;switch(o){case"gndvi":case"nbr":case"ndbi":case"ndvi":case"ndvi-re":case"ndsi":case"ndmi":case"mndwi":s=qt([e[0],e[1],0]),n="ndxi";break;case"ndwi":s=qt([e[1],e[0],0]),n="ndxi";break;case"sr":case"sr-re":case"iron-oxide":case"ferrous-minerals":case"clay-minerals":s=qt([e[0],e[1],0]),n="sr";break;case"ci-g":case"ci-re":s=qt([e[0],e[1],0]),n="ci";break;case"savi":s=qt([e[0],e[1],0]),n="savi",r[0]=t[2]+1;break;case"tsavi":s=qt([e[0],e[1],0]),n="tsavi",r[0]=t[2]+1,r[1]=t[3]+1,r[2]=t[4]+1;break;case"msavi":s=qt([e[0],e[1],0]),n="msavi";break;case"gemi":s=qt([e[0],e[1],0]),n="gemi";break;case"pvi":s=qt([e[0],e[1],0]),n="tsavi",r[0]=t[2]+1,r[1]=t[3]+1;break;case"vari":s=qt([e[0],e[1],e[2]]),n="vari";break;case"mtvi2":s=qt([e[0],e[1],e[2]]),n="mtvi";break;case"rtvi-core":s=qt([e[0],e[1],e[2]]),n="rtvicore";break;case"evi":s=qt([e[0],e[1],e[2]]),n="evi";break;case"wndwi":s=qt([e[0],e[1],0]),n="wndwi",r[0]=t[3]?t[3]+1:.5;break;case"bai":s=qt([e[1],e[0],0]),n="bai";break;default:s=qt([0,1,2]),n="custom"}return{bandIndexMat3:s,indexType:n,adjustments:r,isOutputRounded:(0,u.zw)(this.outputPixelType)}}_getInputBandIds(t){if("custom"===this.functionArguments.method)return t;const e=this.functionArguments.bandIndexes.split(" ").map(t=>parseFloat(t)-1),s=t.length,n=e.map(t=>t>=s?s-1:t),r=ee.has(this.functionArguments.method)?3:2,o=n.slice(0,r).map(e=>t[e]);return 2===o.length&&o.push(0),o}_swizzleBandIds(t){const e=this.functionArguments.bandIndexes.split(" ").map(t=>parseFloat(t)-1);2===e.length&&e.push(0);const{method:s}=this.functionArguments,n=(["vari","mtvi2","rtvi-core","evi"].includes(s)?e.slice(0,3):"bai"===s||"ndwi"===s?[e[1],e[0]]:e.slice(0,2)).map(e=>t.indexOf(e));return n[2]??=n[1],this.isInputBandIdsSwizzled=!0,this.swizzledBandSelection=n,!1}};(0,i.Cg)([(0,a.MZ)({json:{write:!0,name:"rasterFunction"}})],se.prototype,"functionName",void 0),(0,i.Cg)([(0,a.MZ)({type:te,json:{write:!0,name:"rasterFunctionArguments"}})],se.prototype,"functionArguments",void 0),(0,i.Cg)([(0,a.MZ)()],se.prototype,"rasterArgumentNames",void 0),se=(0,i.Cg)([(0,a.$K)("esri.layers.raster.functions.BandArithmeticFunction")],se);const ne=se;var re,oe=s(65864),ie=s(50498);const ae=new Dt.J({1:"outside",2:"inside"},{useNumericKeys:!0});let ue=re=class extends p{constructor(){super(...arguments),this.clippingType="outside"}clone(){return new re({clippingGeometry:this.clippingGeometry.clone(),clippingType:this.clippingType})}};(0,i.Cg)([(0,a.MZ)({types:ie.yR,json:{read:oe.rS,write:!0}})],ue.prototype,"clippingGeometry",void 0),(0,i.Cg)([(0,a.MZ)({json:{read:ae.read,write:ae.write}})],ue.prototype,"clippingType",void 0),ue=re=(0,i.Cg)([(0,a.$K)("esri.layers.raster.functions.ClipFunctionArguments")],ue);const le=ue;var ce=s(34930),pe=s(37373);let he=class extends w{constructor(){super(...arguments),this.functionName="Clip",this.functionArguments=null,this.rasterArgumentNames=["raster"],this.isNoopProcess=!0}_bindSourceRasters(){const t=this.sourceRasterInfos[0].clone();this.outputPixelType=this._getOutputPixelType(t.pixelType),t.pixelType=this.outputPixelType,this.rasterInfo=t;const{functionArguments:e}=this,{clippingGeometry:s,clippingType:n}=e;if(!s)return{success:!1,supportsGPU:!1,error:"missing clipping geometry"};if("outside"===n)try{const{spatialReference:e}=t,n="extent"===s.type?(0,pe._l)(s,e):(0,pe.uk)(s,e).extent;n&&(0,ce.Sd)(t,n)}catch{}return{success:!0,supportsGPU:!0}}_processPixels(t){return t.pixelBlocks?.[0]}_getWebGLParameters(){const{clippingGeometry:t,clippingType:e}=this.functionArguments;return{clippingGeometry:t.toJSON(),clippingType:e}}};(0,i.Cg)([(0,a.MZ)({json:{write:!0,name:"rasterFunction"}})],he.prototype,"functionName",void 0),(0,i.Cg)([(0,a.MZ)({type:le,json:{write:!0,name:"rasterFunctionArguments"}})],he.prototype,"functionArguments",void 0),(0,i.Cg)([(0,a.MZ)()],he.prototype,"rasterArgumentNames",void 0),(0,i.Cg)([(0,a.MZ)()],he.prototype,"isNoopProcess",void 0),he=(0,i.Cg)([(0,a.$K)("esri.layers.raster.functions.ClipFunction")],he);const me=he;var de,ge=s(67369),fe=s(95349),ye=s(36005);let xe=de=class extends p{castColormapName(t){if(!t)return null;const e=t.toLowerCase();return ge.L7.includes(e)?e:null}readColorRamp(t){return(0,fe.r)(t)}readColorRampName(t,e){if(!t)return null;const s=ge.kH.jsonValues.find(e=>e.toLowerCase()===t.toLowerCase());return s?ge.kH.fromJSON(s):null}clone(){return new de({colormap:(0,o.o8)(this.colormap),colormapName:this.colormapName,colorRamp:this.colorRamp?.clone(),colorRampName:this.colorRampName})}};(0,i.Cg)([(0,a.MZ)({type:[[Number]],json:{write:!0}})],xe.prototype,"colormap",void 0),(0,i.Cg)([(0,a.MZ)({type:String,json:{write:!0}})],xe.prototype,"colormapName",void 0),(0,i.Cg)([(0,a.wg)("colormapName")],xe.prototype,"castColormapName",null),(0,i.Cg)([(0,a.MZ)({types:fe.g,json:{write:!0}})],xe.prototype,"colorRamp",void 0),(0,i.Cg)([(0,ye.w)("colorRamp")],xe.prototype,"readColorRamp",null),(0,i.Cg)([(0,a.MZ)({type:ge.kH.apiValues,json:{type:ge.kH.jsonValues,write:ge.kH.write}})],xe.prototype,"colorRampName",void 0),(0,i.Cg)([(0,ye.w)("colorRampName")],xe.prototype,"readColorRampName",null),xe=de=(0,i.Cg)([(0,a.$K)("esri.layers.raster.functions.ColormapFunctionArguments")],xe);const we=xe,Ae=[[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]],ve=[[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 Ce(t,e){const s=[],n=[];for(let e=0;e<t.length-1;e++)s.push({type:"algorithmic",algorithm:"esriHSVAlgorithm",fromColor:t[e].slice(1),toColor:t[e+1].slice(1)}),n.push(t[e+1][0]-t[e][0]);const r=t[t.length-1][0];return(0,ge.iv)({type:"multipart",colorRamps:s},{numColors:r,weights:e=e??n})}let be=class extends w{constructor(){super(...arguments),this.functionName="Colormap",this.functionArguments=null,this.rasterArgumentNames=["raster"],this.isNoopProcess=!0}_bindSourceRasters(){const t=this.sourceRasterInfos[0];if(t.bandCount>1)return{success:!1,supportsGPU:!1,error:"colormap-function: source data must be single band"};let{colormap:e,colormapName:s,colorRamp:n,colorRampName:r}=this.functionArguments;if(!e?.length)if(n)this.colorRamp=n,e=(0,ge.R8)(n,{interpolateAlpha:!0});else if(r){const t=(0,ge.M5)(r);t&&(e=(0,ge.R8)(t),this.colorRamp=(0,fe.r)(t))}else s&&(e=function(t){let e;switch(t){case"elevation":e=Ce([[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":e=(0,ge.iv)({type:"algorithmic",algorithm:"esriHSVAlgorithm",fromColor:[0,0,0],toColor:[255,255,255]});break;case"hillshade":e=Ce([[0,38,41,54],[69,79,82,90],[131,156,156,156],[256,253,253,241]],[.268,.238,.495]);break;case"ndvi":e=Ae;break;case"ndvi2":e=function(){const t=Ce([[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 e=t.length;e<256;e++)t.push([6,27,7]);return t}();break;case"ndvi3":e=ve;break;case"random":e=function(){const t=[];for(let e=0;e<256;e++){const e=[];for(let t=0;t<3;t++)e.push(Math.round(255*Math.random()));t.push(e)}return t}()}return e?(e=e.map((t,e)=>[e,...t]),e):null}(s));if(!e?.length)return{success:!1,supportsGPU:!1,error:"colormap-function: missing colormap argument"};const o=this._getOutputPixelType(t.pixelType);this.outputPixelType=o.startsWith("f")?"s32":o;const i=t.clone();return i.pixelType=this.outputPixelType,i.colormap=e,i.bandCount=1,this.rasterInfo=i,{success:!0,supportsGPU:!0}}_processPixels(t){let e=t.pixelBlocks?.[0];return!e||(0,u.zw)(e.pixelType)||(e=e.clone(),e.clamp(this.outputPixelType)),e}};(0,i.Cg)([(0,a.MZ)({json:{write:!0,name:"rasterFunction"}})],be.prototype,"functionName",void 0),(0,i.Cg)([(0,a.MZ)({type:we,json:{write:!0,name:"rasterFunctionArguments"}})],be.prototype,"functionArguments",void 0),(0,i.Cg)([(0,a.MZ)()],be.prototype,"rasterArgumentNames",void 0),(0,i.Cg)([(0,a.MZ)()],be.prototype,"isNoopProcess",void 0),(0,i.Cg)([(0,a.MZ)({json:{write:!0}})],be.prototype,"indexedColormap",void 0),(0,i.Cg)([(0,a.MZ)()],be.prototype,"colorRamp",void 0),be=(0,i.Cg)([(0,a.$K)("esri.layers.raster.functions.ColormapFunction")],be);const Me=be;var Te;let Pe=Te=class extends p{clone(){return new Te({raster:this.raster})}};Pe=Te=(0,i.Cg)([(0,a.$K)("esri.layers.raster.functions.ColormapToRGBFunctionArguments")],Pe);const Ne=Pe;var Ie=s(4151),Re=s(88178);let Fe=class extends w{constructor(){super(...arguments),this.functionName="ColormapToRGB",this.functionArguments=null,this.rasterArgumentNames=["raster"]}_bindSourceRasters(){const t=this.sourceRasterInfos[0];if(t.bandCount>1||!t.colormap?.length)return{success:!1,supportsGPU:!1,error:"colormap-to-rgb-function: source data must be single band with a colormap"};const e=t.clone();e.pixelType=this.outputPixelType=this._getOutputPixelType("u8"),this._removeStatsHistColormapVAT(e),e.bandCount=3,e.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=e;const s=[...t.colormap].sort((t,e)=>t[0]-e[0]),{indexedColormap:n,offset:r}=(0,Kt.zg)({colormap:s});return n?(this.lookup={indexedColormap:n,offset:r},{success:!0,supportsGPU:(0,Re.WN)(n)}):{success:!1,supportsGPU:!1,error:"colormap-to-rgb-function: the colormap is not supported"}}_processPixels(t){let e=t.pixelBlocks?.[0];if(!e||!this.lookup)return e;e=e.clone();const s=e.pixels[0],n=e.mask??new Uint8Array(s.length).fill(255),r=new Uint8Array(s.length),o=new Uint8Array(s.length),i=new Uint8Array(s.length),{indexedColormap:a,offset:u}=this.lookup,l=a.length;for(let t=0;t<s.length;t++)if(n[t]){let e=4*(s[t]-u);e<0||e>l-4?n[t]=0:(r[t]=a[e++],o[t]=a[e++],i[t]=a[e++])}return e.pixels=[r,o,i],e.statistics=[new Ie.A(0,255),new Ie.A(0,255),new Ie.A(0,255)],e.pixelType=this.outputPixelType,e}_getWebGLParameters(){return this.lookup}};(0,i.Cg)([(0,a.MZ)({json:{write:!0,name:"rasterFunction"}})],Fe.prototype,"functionName",void 0),(0,i.Cg)([(0,a.MZ)({type:Ne,json:{write:!0,name:"rasterFunctionArguments"}})],Fe.prototype,"functionArguments",void 0),(0,i.Cg)([(0,a.MZ)()],Fe.prototype,"rasterArgumentNames",void 0),(0,i.Cg)([(0,a.MZ)({json:{write:!0}})],Fe.prototype,"lookup",void 0),Fe=(0,i.Cg)([(0,a.$K)("esri.layers.raster.functions.ColormapToRGBFunction")],Fe);const ke=Fe;var _e,Se=s(43937);let Be=_e=class extends p{constructor(){super(...arguments),this.rasters=[]}writeRasters(t,e){e.rasters=t.map(t=>"number"==typeof t||"string"==typeof t?t:t.toJSON())}clone(){return new _e({rasters:(0,o.o8)(this.rasters)})}};(0,i.Cg)([(0,a.MZ)({json:{write:!0}})],Be.prototype,"rasters",void 0),(0,i.Cg)([(0,Se.K)("rasters")],Be.prototype,"writeRasters",null),Be=_e=(0,i.Cg)([(0,a.$K)("esri.layers.raster.functions.CompositeBandFunctionArguments")],Be);const je=Be;let Ze=class extends w{constructor(){super(...arguments),this.functionName="CompositeBand",this.functionArguments=null,this.rasterArgumentNames=["rasters"]}_bindSourceRasters(){const{sourceRasterInfos:t}=this,e=t[0];this.outputPixelType=this._getOutputPixelType(e.pixelType);const s=e.clone();if(s.attributeTable=null,s.colormap=null,s.pixelType=this.outputPixelType,s.bandCount=t.map(({bandCount:t})=>t).reduce((t,e)=>t+e),t.every(({statistics:t})=>null!=t&&t.length)){const e=[];t.forEach(({statistics:t})=>null!=t&&e.push(...t)),s.statistics=e}if(t.every(({histograms:t})=>null!=t&&t.length)){const e=[];t.forEach(({histograms:t})=>null!=t&&e.push(...t)),s.histograms=e}s.multidimensionalInfo&&s.multidimensionalInfo.variables.forEach(e=>{const s=t.map(t=>t.multidimensionalInfo?.variables.find(({name:t})=>t===e.name)),n=s.map(t=>t?.statistics?.length?t.statistics:null),r=s.map(t=>t?.histograms?.length?t.histograms:null);e.statistics=n.every(t=>null!=t)?n.flat():null,e.histograms=r.every(t=>null!=t)?r.flat():null}),s.bandCount>1&&(s.colormap=null,s.attributeTable=null);const n=t.every(t=>t.keyProperties.BandProperties?.length)?t.flatMap(t=>t.keyProperties.BandProperties):void 0;return s.keyProperties={...s.keyProperties,BandProperties:n},this.rasterInfo=s,{success:!0,supportsGPU:s.bandCount<=3}}_processPixels(t){const{pixelBlocks:e}=t;if(!e)return null;const s=e?.[0];return null==s?null:(0,Kt.Wy)(e)}_getWebGLParameters(){return{bandCount:this.rasterInfo.bandCount}}};(0,i.Cg)([(0,a.MZ)({json:{write:!0,name:"rasterFunction"}})],Ze.prototype,"functionName",void 0),(0,i.Cg)([(0,a.MZ)({type:je,json:{write:!0,name:"rasterFunctionArguments"}})],Ze.prototype,"functionArguments",void 0),(0,i.Cg)([(0,a.MZ)()],Ze.prototype,"rasterArgumentNames",void 0),Ze=(0,i.Cg)([(0,a.$K)("esri.layers.raster.functions.CompositeBandFunction")],Ze);const ze=Ze,Ge=new Dt.J({0:"difference",1:"relative-difference",2:"categorical",3:"euclidean-distance",4:"angle-difference",5:"band-with-most-change"},{useNumericKeys:!0}),Oe=new Dt.J({0:"all",1:"changed",2:"unchanged"},{useNumericKeys:!0});var De;let Ee=De=class extends p{constructor(){super(...arguments),this.method="difference",this.keepMethod="all",this.raster2=void 0}get rasters(){return[this.raster,this.raster2]}clone(){return new De({raster:this.raster,raster2:this.raster2,method:this.method,keepMethod:this.keepMethod})}};(0,i.Cg)([(0,Qt.e)(Ge)],Ee.prototype,"method",void 0),(0,i.Cg)([(0,Qt.e)(Oe)],Ee.prototype,"keepMethod",void 0),(0,i.Cg)([(0,a.MZ)({json:{write:!0}})],Ee.prototype,"raster2",void 0),(0,i.Cg)([(0,a.MZ)({readOnly:!0})],Ee.prototype,"rasters",null),Ee=De=(0,i.Cg)([(0,a.$K)("esri.layers.raster.functions.ComputeChangeFunctionArguments")],Ee);const Ve=Ee;var Ue=s(20437);let Le=class extends w{constructor(){super(...arguments),this.functionName="ComputeChange",this.functionArguments=null,this.rasterArgumentNames=["raster","raster2"]}_bindSourceRasters(){const{method:t}=this.functionArguments,e=this.sourceRasterInfos[0].clone();if(this.outputPixelType=this._getOutputPixelType(e.pixelType),e.pixelType=this.outputPixelType,this._removeStatsHistColormapVAT(e),"categorical"===t){const t=this.sourceRasterInfos.map(t=>t.attributeTable),s=this._getFieldNames(t,"value"),n=t.map(t=>this._getClassFieldName(t));if(null==s[0]||null==s[1]||null==n[0]||null==n[1])return{success:!1,supportsGPU:!1,error:"both inputs must have proper attribute table with value and class fields"};this._updateAttributeTable(e,s,n)}return e.bandCount=1,this.rasterInfo=e,{success:!0,supportsGPU:"difference"===t||"relative-difference"===t}}_processPixels(t){const{pixelBlocks:e}=t;if(null==e?.[0]||null==e?.[1])return null;const{method:s}=this.functionArguments;return function(t,e,s,n){const[r,o]=t,i=(0,u.zw)(s)&&!(0,u.zw)(r.pixelType)&&!(0,u.zw)(o.pixelType),a=[r.mask,o.mask].filter(t=>t),l=g.A.combineBandMasks(a),c=t.map(t=>t.pixels[0]),{width:p,height:h}=r,m=g.A.createEmptyBand(s,p*h);switch(e){case"difference":case"relative-difference":!function(t){const{bands:[e,s],mask:n,isRelative:r,isRoundingNeeded:o,outBand:i}=t,a=e.length;for(let t=0;t<a;t++)if(!n||n[t]){let n=e[t]-s[t];if(r){const r=Math.max(Math.abs(e[t]),Math.abs(s[t]));n=0===r?0:n/r}i[t]=o?Math.round(n):n}}({bands:c,mask:l,outBand:m,isRoundingNeeded:i,isRelative:"relative-difference"===e});break;case"categorical":!function(t){const{bands:[e,s],categoryIndexLookups:[n,r],classNames:[o,i],mask:a,keepMethod:u,outBand:l}=t,c=e.length,p=o.length,h=i.length,m=p*h,d=m+1,g=m+2;for(let t=0;t<c;t++)if(!a||a[t]){const a=e[t],c=s[t],p=n[a],f=r[c],y=o[p],x=i[f];l[t]=null==p||null==f?m:"changed"===u&&y===x?d:"unchanged"===u&&y!==x?g:p*h+f}}({bands:c,mask:l,outBand:m,...n});break;case"euclidean-distance":!function(t){const{pixels:[e,s],mask:n,outBand:r}=t,o=e[0].length,i=e.length;for(let t=0;t<o;t++)if(!n||n[t]){let n=0;for(let r=0;r<i;r++){const o=e[r][t]-s[r][t];n+=o*o}r[t]=Math.sqrt(n)}}({pixels:t.map(t=>t.pixels),mask:l,outBand:m});break;case"angle-difference":!function(t){const{pixels:[e,s],mask:n,outBand:r}=t,o=e[0].length,i=e.length;for(let t=0;t<o;t++)if(!n||n[t]){let n=0,o=0,a=0;for(let r=0;r<i;r++){const i=e[r][t],u=s[r][t];n+=i*u,o+=i*i,a+=u*u}const u=Math.sqrt(o*a);r[t]=u?Math.acos(n/u):1.5707963267948966}}({pixels:t.map(t=>t.pixels),mask:l,outBand:m});break;case"band-with-most-change":!function(t){const{pixels:[e,s],mask:n,outBand:r}=t,o=e[0].length,i=e.length;for(let t=0;t<o;t++)if(!n||n[t]){let n=0,o=0;for(let r=0;r<i;r++){const i=Math.abs(e[r][t]-s[r][t]);i>n&&(n=i,o=r)}r[t]=o}}({pixels:t.map(t=>t.pixels),mask:l,outBand:m})}const d=new g.A({width:p,height:h,pixels:[m],pixelType:s,mask:l});return d.updateStatistics(),d}(e,s,this.outputPixelType,this._categoryConfig)}_getWebGLParameters(){const t=this.outputPixelType??"f32";let[e,s]=(0,u.hP)(t);const n=(0,u.zw)(t);return n&&(e-=1e-4,s+=1e-4),{method:this.functionArguments.method,domainRange:[e,s],isOutputRounded:n}}_updateAttributeTable(t,e,s){const n=this.sourceRasterInfos.map(t=>t.attributeTable),r=n.map((t,s)=>t.features.map(t=>t.attributes[e[s]])),o=n.map((t,e)=>t.features.map(t=>t.attributes[s[e]])),i=r.map(t=>{const e=[];return t.forEach((t,s)=>e[t]=s),e}),{keepMethod:a}=this.functionArguments;this._categoryConfig={categoryIndexLookups:i,classNames:o,keepMethod:a};const u=n[0].clone();u.fields=[new Ue.A({name:"OID",type:"oid"}),new Ue.A({name:"Value",type:"integer"}),new Ue.A({name:"ClassName",type:"string"}),new Ue.A({name:"Class_From",type:"string"}),new Ue.A({name:"Class_To",type:"string"})];const l=this._getFieldNames(n,"red"),c=this._getFieldNames(n,"green"),p=this._getFieldNames(n,"blue"),h=[],m=2===l.length&&2===c.length&&2===p.length;m&&(h.push(...n.map((t,e)=>t.features.map(t=>[t.attributes[l[e]],t.attributes[c[e]],t.attributes[p[e]]]))),u.fields.push(new Ue.A({name:"Red",type:"integer"}),new Ue.A({name:"Green",type:"integer"}),new Ue.A({name:"Blue",type:"integer"})));const d=u.features[0].clone();d.geometry=null;const g=[],[f,y]=r.map(t=>t.length);let x=1;for(let t=0;t<f;t++){const e=o[0][t];for(let s=0;s<y;s++){const n=o[1][s];if("changed"===a&&e===n||"unchanged"===a&&e!==n)continue;const r=d.clone();r.attributes={OID:x++,Value:t*y+s,ClassName:e===n?e:`${e} -> ${n}`,Class_From:e,Class_To:n},m&&(r.attributes.Red=h[0][t][0]+h[1][s][0]>>1,r.attributes.Green=h[0][t][1]+h[1][s][1]>>1,r.attributes.Blue=h[0][t][2]+h[1][s][2]>>1),g.push(r)}}if("changed"===a){const t=d.clone();t.attributes={OID:x++,Value:f*y+1,ClassName:"No Change",Class_From:"Same",Class_To:"Same"},g.push(t)}else if("unchanged"===a){const t=d.clone();t.attributes={OID:x++,Value:f*y+2,ClassName:"Changed",Class_From:"Any",Class_To:"Any"},g.push(t)}u.features=g,t.attributeTable=u}_getFieldNames(t,e){return t.map(({fields:t})=>t.find(t=>t.name.toLowerCase()===e)?.name).filter(t=>t)}_getClassFieldName(t){const e=t.fields.find(t=>"string"===t.type&&t.name.toLowerCase().startsWith("class"))??t.fields.find(t=>"string"===t.type&&t.name.toLowerCase().includes("class")||t.name.toLowerCase().includes("type")||t.name.toLowerCase().includes("name"))??t.fields.find(t=>"string"===t.type);return e?.name}};(0,i.Cg)([(0,a.MZ)({json:{write:!0,name:"rasterFunction"}})],Le.prototype,"functionName",void 0),(0,i.Cg)([(0,a.MZ)({type:Ve,json:{write:!0,name:"rasterFunctionArguments"}})],Le.prototype,"functionArguments",void 0),(0,i.Cg)([(0,a.MZ)()],Le.prototype,"rasterArgumentNames",void 0),(0,i.Cg)([(0,a.MZ)({json:{write:!0}})],Le.prototype,"_categoryConfig",void 0),Le=(0,i.Cg)([(0,a.$K)("esri.layers.raster.functions.ComputeChangeFunction")],Le);const $e=Le;var Ke;let We=Ke=class extends p{constructor(){super(...arguments),this.contrastOffset=0,this.brightnessOffset=0}clone(){return new Ke({contrastOffset:this.contrastOffset,brightnessOffset:this.brightnessOffset,raster:this.raster})}};(0,i.Cg)([(0,a.MZ)({json:{write:!0}})],We.prototype,"contrastOffset",void 0),(0,i.Cg)([(0,a.MZ)({json:{write:!0}})],We.prototype,"brightnessOffset",void 0),We=Ke=(0,i.Cg)([(0,a.$K)("esri.layers.raster.functions.ContrastBrightnessFunctionArguments")],We);const He=We;var qe=s(51927);let Je=class extends w{constructor(){super(...arguments),this.functionName="ContrastBrightness",this.functionArguments=null,this.rasterArgumentNames=["raster"],this.lookup=null}_bindSourceRasters(){const{sourceRasterInfos:t}=this,e=t[0];if("u8"!==e.pixelType)return{success:!1,supportsGPU:!1,error:"Only unsigned 8 bit raster is supported by ContrastBrightness function."};this.outputPixelType=this._getOutputPixelType("u8");const s=e.clone();this._removeStatsHistColormapVAT(s),this.rasterInfo=s;const{contrastOffset:n,brightnessOffset:r}=this.functionArguments;return this.lookup=(0,qe.zj)(n,r),{success:!0,supportsGPU:!0}}_processPixels(t){const e=t.pixelBlocks?.[0];return null==e?null:(0,Kt.eH)(e,{lut:e.pixels.map(()=>this.lookup),offset:0,outputPixelType:"u8"})}_getWebGLParameters(){const{contrastOffset:t,brightnessOffset:e}=this.functionArguments;return{contrastOffset:t,brightnessOffset:e}}};(0,i.Cg)([(0,a.MZ)({json:{write:!0,name:"rasterFunction"}})],Je.prototype,"functionName",void 0),(0,i.Cg)([(0,a.MZ)({type:He,json:{write:!0,name:"rasterFunctionArguments"}})],Je.prototype,"functionArguments",void 0),(0,i.Cg)([(0,a.MZ)()],Je.prototype,"rasterArgumentNames",void 0),(0,i.Cg)([(0,a.MZ)({json:{write:!0}})],Je.prototype,"lookup",void 0),Je=(0,i.Cg)([(0,a.$K)("esri.layers.raster.functions.ContrastBrightnessFunction")],Je);const Xe=Je;function Qe(t,e,s,n,r){const o=Math.floor(n/2);for(let n=0;n<o;n++)for(let o=0;o<e;o++)t[n*e+o]=t[(r-1-n)*e+o],t[(s-1-n)*e+o]=t[(s-r+n)*e+o];const i=Math.floor(r/2);for(let n=0;n<s;n++){const s=n*e;for(let n=0;n<i;n++)t[s+n]=t[s+r-1-n],t[s+e-n-1]=t[s+e+n-r]}}const Ye=new Map;function ts(t,e,s,n,r,o,i){const a=new Float32Array(e*s),u=o.length,l=i?0:n,c=i?n:0,p=i?1:e;for(let i=l;i<s-l;i++){const s=i*e;for(let i=c;i<e-c;i++){if(r&&!r[s+i])continue;let e=0;for(let r=0;r<u;r++)e+=t[s+i+(r-n)*p]*o[r];a[s+i]=e}}return a}function es(t,e,s,n,r,o,i){const a=new Float32Array(e*s),u=Math.floor(n/2),l=Math.floor(r/2);for(let c=u;c<s-u;c++){const s=c*e;for(let c=l;c<e-l;c++){if(o&&!o[s+c])continue;let p=0;for(let o=0;o<n;o++)for(let n=0;n<r;n++)p+=t[s+c+(o-u)*e+n-l]*i[o*r+n];a[s+c]=p}}return a}var ss;Ye.set(A.none,[0,0,0,0,1,0,0,0,0]),Ye.set(A.lineDetectionHorizontal,[-1,-1,-1,2,2,2,-1,-1,-1]),Ye.set(A.lineDetectionVertical,[-1,2,-1,-1,2,-1,-1,2,-1]),Ye.set(A.lineDetectionLeftDiagonal,[2,-1,-1,-1,2,-1,-1,-1,2]),Ye.set(A.lineDetectionRightDiagonal,[-1,-1,2,-1,2,-1,2,-1,-1]),Ye.set(A.gradientNorth,[-1,-2,-1,0,0,0,1,2,1]),Ye.set(A.gradientWest,[-1,0,1,-2,0,2,-1,0,1]),Ye.set(A.gradientEast,[1,0,-1,2,0,-2,1,0,-1]),Ye.set(A.gradientSouth,[1,2,1,0,0,0,-1,-2,-1]),Ye.set(A.gradientNorthEast,[0,-1,-2,1,0,-1,2,1,0]),Ye.set(A.gradientNorthWest,[-2,-1,0,-1,0,1,0,1,2]),Ye.set(A.smoothArithmeticMean,[.111111111111,.111111111111,.111111111111,.111111111111,.111111111111,.111111111111,.111111111111,.111111111111,.111111111111]),Ye.set(A.smoothing3x3,[.0625,.125,.0625,.125,.25,.125,.0625,.125,.0625]),Ye.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]),Ye.set(A.sharpening3x3,[-1,-1,-1,-1,9,-1,-1,-1,-1]),Ye.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]),Ye.set(A.laplacian3x3,[0,-1,0,-1,4,-1,0,-1,0]),Ye.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]),Ye.set(A.sobelHorizontal,[-1,-2,-1,0,0,0,1,2,1]),Ye.set(A.sobelVertical,[-1,0,1,-2,0,2,-1,0,1]),Ye.set(A.sharpen,[0,-.25,0,-.25,2,-.25,0,-.25,0]),Ye.set(A.sharpen2,[-.25,-.25,-.25,-.25,3,-.25,-.25,-.25,-.25]),Ye.set(A.pointSpread,[-.627,.352,-.627,.352,2.923,.352,-.627,.352,-.627]);let ns=ss=class extends p{constructor(){super(...arguments),this.rows=3,this.cols=3,this.kernel=[0,0,0,0,1,0,0,0,0]}set convolutionType(t){this._set("convolutionType",t);const e=Ye.get(t);if(!e||t===A.userDefined||t===A.none)return;const s=Math.round(Math.sqrt(e.length));this._set("kernel",e),this._set("cols",s),this._set("rows",s)}clone(){return new ss({cols:this.cols,rows:this.rows,kernel:[...this.kernel],convolutionType:this.convolutionType,raster:(0,o.o8)(this.raster)})}};(0,i.Cg)([(0,a.MZ)({json:{type:Number,write:!0}})],ns.prototype,"rows",void 0),(0,i.Cg)([(0,a.MZ)({json:{type:Number,write:!0,name:"columns"}})],ns.prototype,"cols",void 0),(0,i.Cg)([(0,a.MZ)({json:{name:"type",type:Number,write:!0}})],ns.prototype,"convolutionType",null),(0,i.Cg)([(0,a.MZ)({json:{type:[Number],write:!0}})],ns.prototype,"kernel",void 0),ns=ss=(0,i.Cg)([(0,a.$K)("esri.layers.raster.functions.ConvolutionFunctionArguments")],ns);const rs=ns;let os=class extends w{constructor(){super(...arguments),this.functionName="Convolution",this.rasterArgumentNames=["raster"]}get _normalizedKernel(){const{kernel:t,convolutionType:e}=this.functionArguments,s=t.reduce((t,e)=>t+e);return-1===e||0===s||1===s?t:t.map(t=>t/s)}_bindSourceRasters(){const{convolutionType:t,rows:e,cols:s,kernel:n}=this.functionArguments;if(!Object.values(A).includes(t))return{success:!1,supportsGPU:!1,error:`convolution-function: the specified kernel type is not supported ${t}`};if(t!==A.none&&e*s!==n.length)return{success:!1,supportsGPU:!1,error:"convolution-function: the specified rows and cols do not match the length of the kernel"};const r=this.sourceRasterInfos[0];this.outputPixelType=this._getOutputPixelType(r.pixelType);const o=r.clone();o.pixelType=this.outputPixelType;const i=[A.none,A.sharpen,A.sharpen2,A.sharpening3x3,A.sharpening5x5];return(-1===t||"u8"!==this.outputPixelType&&!i.includes(t))&&(o.statistics=null,o.histograms=null),o.colormap=null,o.attributeTable=null,this.rasterInfo=o,{success:!0,supportsGPU:n.length<=25}}_processPixels(t){const e=t.pixelBlocks?.[0];if(null==e||this.functionArguments.convolutionType===A.none)return e;const{rows:s,cols:n}=this.functionArguments,{_normalizedKernel:r}=this;return function(t,e){const s=function(t){const e=Math.sqrt(t.length),s=t.slice(0,e),n=[1];for(let s=1;s<e;s++){let r=null;for(let n=0;n<e;n++){const o=t[n+s*e],i=t[n];if(null==r)if(0===i){if(o)return{separable:!1,row:null,col:null}}else r=o/i;else if(o/i!==r)return{separable:!1,row:null,col:null}}if(null==r)return{separable:!1,row:null,col:null};n.push(r)}return{separable:!0,row:s,col:n}}(e.kernel),n=!1!==e.mirrorEdges,r=s.separable?function(t,e,s,n=!0){const{pixels:r,width:o,height:i,pixelType:a,mask:u}=t,l=r.length,c=[],p=e.length,h=s.length,m=Math.floor(p/2),d=Math.floor(h/2);for(let t=0;t<l;t++){let a=ts(r[t],o,i,m,u,e,!0);a=ts(a,o,i,d,u,s,!1),n&&Qe(a,o,i,p,h),c.push(a)}return new g.A({width:o,height:i,pixelType:a,pixels:c,mask:u})}(t,s.row,s.col,n):function(t,e,s=!0){const{pixels:n,width:r,height:o,pixelType:i,mask:a}=t,u=n.length,l=[],{kernel:c,rows:p,cols:h}=e;for(let t=0;t<u;t++){const e=es(n[t],r,o,p,h,a,c);s&&Qe(e,r,o,p,h),l.push(e)}return new g.A({width:r,height:o,pixelType:i,pixels:l,mask:a})}(t,e,n),{outputPixelType:o}=e;return o&&r.clamp(o),r}(e,{kernel:r,rows:s,cols:n,outputPixelType:this.outputPixelType})}_getWebGLParameters(){const t=new Float32Array(25),{rows:e,cols:s}=this.functionArguments,{_normalizedKernel:n}=this;for(let r=0;r<e;r++)for(let e=0;e<s;e++)t[5*r+e]=n[r*s+e];return{kernelRows:e,kernelCols:s,kernel:t,clampRange:(0,u.hP)(this.outputPixelType)}}_getNeighborhoodSize(){const{rows:t,cols:e}=this.functionArguments;return{rows:t,cols:e}}};(0,i.Cg)([(0,a.MZ)({json:{write:!0,name:"rasterFunction"}})],os.prototype,"functionName",void 0),(0,i.Cg)([(0,a.MZ)({type:rs,json:{write:!0,name:"rasterFunctionArguments"}})],os.prototype,"functionArguments",void 0),(0,i.Cg)([(0,a.MZ)()],os.prototype,"rasterArgumentNames",void 0),(0,i.Cg)([(0,a.MZ)()],os.prototype,"_normalizedKernel",null),os=(0,i.Cg)([(0,a.$K)("esri.layers.raster.functions.ConvolutionFunction")],os);const is=os;var as;const us=new Dt.J({0:"standard",1:"planform",2:"profile"},{useNumericKeys:!0});let ls=as=class extends p{constructor(){super(...arguments),this.curvatureType="standard",this.zFactor=1}readCurvatureType(t,e){return us.fromJSON(e.type??e.curvatureType??0)}clone(){return new as({curvatureType:this.curvatureType,zFactor:this.zFactor,raster:this.raster})}};(0,i.Cg)([(0,a.MZ)({json:{write:{target:"type"}}}),(0,Qt.e)(us)],ls.prototype,"curvatureType",void 0),(0,i.Cg)([(0,ye.w)("curvatureType",["type","curvatureType"])],ls.prototype,"readCurvatureType",null),(0,i.Cg)([(0,a.MZ)({type:Number,json:{write:!0}})],ls.prototype,"zFactor",void 0),ls=as=(0,i.Cg)([(0,a.$K)("esri.layers.raster.functions.CurvatureFunctionArguments")],ls);const cs=ls;let ps=class extends w{constructor(){super(...arguments),this.functionName="Curvature",this.functionArguments=null,this.rasterArgumentNames=["raster"],this.isGCS=!1}_bindSourceRasters(){this.outputPixelType=this._getOutputPixelType("f32");const t=this.sourceRasterInfos[0].clone();return t.pixelType=this.outputPixelType,t.bandCount=1,this._removeStatsHistColormapVAT(t),this.rasterInfo=t,this.isGCS=t.spatialReference?.isGeographic??!1,{success:!0,supportsGPU:!0}}_processPixels(t){const e=t.pixelBlocks?.[0];if(null==e)return null;const{zFactor:s,curvatureType:n}=this.functionArguments,{extent:r,primaryPixelSizes:o}=t,i=o?.[0],a=i??(r?{x:r.width/e.width,y:r.height/e.height}:{x:1,y:1}),u=this.isGCS&&s>=1?s*zt.rk:s;return(0,zt.E0)(e,{zFactor:u,curvatureType:n,resolution:a})}_getWebGLParameters(){const{zFactor:t,curvatureType:e}=this.functionArguments;return{curvatureType:e,zFactor:this.isGCS&&t>=1?t*zt.rk:t}}_getNeighborhoodSize(){return{rows:3,cols:3}}};(0,i.Cg)([(0,a.MZ)({json:{write:!0,name:"rasterFunction"}})],ps.prototype,"functionName",void 0),(0,i.Cg)([(0,a.MZ)({type:cs,json:{write:!0,name:"rasterFunctionArguments"}})],ps.prototype,"functionArguments",void 0),(0,i.Cg)([(0,a.MZ)()],ps.prototype,"rasterArgumentNames",void 0),(0,i.Cg)([(0,a.MZ)({json:{write:!0}})],ps.prototype,"isGCS",void 0),ps=(0,i.Cg)([(0,a.$K)("esri.layers.raster.functions.CurvatureFunction")],ps);const hs=ps;var ms;let ds=ms=class extends p{constructor(){super(...arguments),this.bandIds=[],this.bandNames=[],this.bandWavelengths=[],this.missingBandAction=0}clone(){return new ms({bandIds:this.bandIds?.slice(),bandNames:this.bandNames?.slice(),bandWavelengths:this.bandWavelengths?.slice(),missingBandAction:this.missingBandAction,method:this.method,wavelengthMatchTolerance:this.wavelengthMatchTolerance})}};(0,i.Cg)([(0,a.MZ)({json:{write:!0}})],ds.prototype,"bandIds",void 0),(0,i.Cg)([(0,a.MZ)({json:{write:!0}})],ds.prototype,"bandNames",void 0),(0,i.Cg)([(0,a.MZ)({json:{write:!0}})],ds.prototype,"bandWavelengths",void 0),(0,i.Cg)([(0,Qt.e)({0:"name",1:"wavelength",2:"id"})],ds.prototype,"method",void 0),(0,i.Cg)([(0,a.MZ)({json:{write:!0}})],ds.prototype,"missingBandAction",void 0),(0,i.Cg)([(0,a.MZ)({json:{write:!0}})],ds.prototype,"wavelengthMatchTolerance",void 0),ds=ms=(0,i.Cg)([(0,a.$K)("esri.layers.raster.functions.ExtractBandFunctionArguments")],ds);const gs=ds;let fs=class extends w{constructor(){super(...arguments),this.functionName="ExtractBand",this.functionArguments=null,this.rasterArgumentNames=["raster"]}_bindSourceRasters(){const{functionArguments:t,sourceRasterInfos:e}=this,s=e[0],{method:n,bandNames:r,bandWavelengths:o,bandIds:i,missingBandAction:a}=t,u=r?.length&&("name"===n||"id"!==n&&!i?.length),l=o?.length&&("wavelength"===n||"id"!==n&&!i?.length),c=1===a,p=u?function(t,e){const s=t.bandInfos.map(({name:t})=>t.toLowerCase()),n=[];for(let t=0;t<e.length;t++){const r=e[t].toLowerCase();let o=s.indexOf(r);if(-1===o&&"nearinfrared"===r&&(o=s.findIndex(t=>t.startsWith("nearinfrared_1")),-1===o&&(o=s.findIndex(t=>t.startsWith("nearinfrared")))),-1===o)return null;n.push(o)}return n}(s,r):l?function(t,e,{wavelengthMatchTolerance:s},n){const{bandInfos:r}=t,o=[];for(let t=0;t<r.length;t++){const{minWavelength:e,maxWavelength:s}=r[t];if(!e||!s)return null;o.push({minWavelength:e,maxWavelength:s})}const i=[];for(let t=0;t<e.length;t++){const r=e[t];let a=!1,u=-1,l=Number.MAX_VALUE;for(let t=0;t<o.length;t++){const e=o[t],s=r>=e.minWavelength&&r<=e.maxWavelength,n=Math.abs(r-(e.minWavelength+e.maxWavelength)/2);s?n<l&&(a=!0,u=t,l=n):!a&&n<l&&(u=t,l=n)}if(!a&&s&&l<s&&(a=!0),!a&&n)return null;i.push(u)}return i}(s,o,this.functionArguments,c):function(t,e,s){const{bandCount:n}=t;return!e?.length||s&&e.some(t=>t<0||t>=n)?null:e}(s,i,c);if(null==p)return{success:!1,supportsGPU:!1,error:`extract-band-function: Invalid ${u?"band names":l?"band wavelengths":"band ids"} for the imagery data source`};this.functionArguments.bandIds=p,this.functionArguments.method="id",this.outputPixelType=this._getOutputPixelType(s.pixelType);const h=s.clone();h.pixelType=this.outputPixelType,h.bandCount=p.length;const{statistics:m,histograms:d}=h;null!=m&&m.length&&(h.statistics=p.map(t=>m[t]||m[m.length-1])),null!=d&&d.length&&(h.histograms=p.map(t=>d[t]||d[d.length-1])),h.multidimensionalInfo&&h.multidimensionalInfo.variables.forEach(t=>{const{statistics:e,histograms:s}=t;null!=e&&e.length&&(t.statistics=p.map(t=>e[t]||e[e.length-1])),null!=s&&s.length&&(t.histograms=p.map(t=>s[t]||s[s.length-1]))});let g=h.keyProperties?.BandProperties;return g?.length&&(g=p.map(t=>t>=g.length?g[g.length-1]:g[t]),h.keyProperties={...h.keyProperties,BandProperties:g}),this.rasterInfo=h,{success:!0,supportsGPU:h.bandCount<=3}}_processPixels(t){const e=t.pixelBlocks?.[0];if(null==e)return null;let{bandIds:s}=this.functionArguments;if(this.rasterInfo.storageInfo.isBsqTile){const{rawInputBandIds:t}=this;s=s.map(e=>t.indexOf(e))}else{const t=e.pixels.length;s=s.map(e=>e>=t?t-1:e)}return e.extractBands(s)}_getWebGLParameters(){let t;if(this.isInputBandIdsSwizzled)t=this.swizzledBandSelection.length?this.swizzledBandSelection:[0,1,2];else{t=[...this.functionArguments.bandIds],0===t.length?t=[0,1,2]:t.length<3&&(t[1]=t[1]??t[0],t[2]=t[2]??t[1]);for(let e=0;e<3;e++)t[e]=Math.min(t[e],2)}return{bandIndexMat3:qt(t)}}_getInputBandIds(t){const e=t.length;return this.functionArguments.bandIds.map(t=>t>=e?e-1:t).map(e=>t[e])}_swizzleBandIds(t){const e=this.functionArguments.bandIds.map(e=>t.indexOf(e));return this.isInputBandIdsSwizzled=!0,e[1]??=e[0],e[2]??=e[1],this.swizzledBandSelection=e,!1}};(0,i.Cg)([(0,a.MZ)({json:{write:!0,name:"rasterFunction"}})],fs.prototype,"functionName",void 0),(0,i.Cg)([(0,a.MZ)({type:gs,json:{write:!0,name:"rasterFunctionArguments"}})],fs.prototype,"functionArguments",void 0),(0,i.Cg)([(0,a.MZ)()],fs.prototype,"rasterArgumentNames",void 0),fs=(0,i.Cg)([(0,a.$K)("esri.layers.raster.functions.ExtractBandFunction")],fs);const ys=fs;function xs(t,e,s,n){const{pixels:r,width:o,height:i}=t,a=r.length,l=s.startsWith("f"),c=!l,[p,h]=(0,u.hP)(s),m=o*i,d=g.A.createEmptyBand(s,m);for(let t=0;t<i;t++){let s=t*o;for(let t=0;t<o;t++,s++)if(!n||n[s]){let t=0;for(let n=0;n<a;n++)t+=e[n]*r[n][s];l||(t=Math.round(t),c&&(t=t>h?h:t<p?p:t)),d[s]=t}}return d}var ws;let As=ws=class extends p{clone(){return new ws({conversionParameters:[...this.conversionParameters],raster:this.raster})}};(0,i.Cg)([(0,a.MZ)({type:[Number],json:{write:!0}})],As.prototype,"conversionParameters",void 0),As=ws=(0,i.Cg)([(0,a.$K)("esri.layers.raster.functions.GrayscaleFunctionArguments")],As);const vs=As;let Cs=class extends w{constructor(){super(...arguments),this.functionName="Grayscale",this.functionArguments=null,this.rasterArgumentNames=["raster"]}get _normalizedWeights(){const{conversionParameters:t}=this.functionArguments,e=t.reduce((t,e)=>t+e);return t.map(t=>t/e)}_bindSourceRasters(){const{conversionParameters:t}=this.functionArguments;if(!t?.length)return{success:!1,supportsGPU:!1,error:"missing valid conversion parameters."};const e=this.sourceRasterInfos[0].clone();this.outputPixelType=this._getOutputPixelType(e.pixelType),e.pixelType=this.outputPixelType;const s=3===t.length||3===e.bandCount&&t.length>3;return e.bandCount=1,this._removeStatsHistColormapVAT(e),this.rasterInfo=e,{success:!0,supportsGPU:s}}_processPixels(t){const e=t.pixelBlocks?.[0];return null==e?null:function(t,e,s){const{width:n,height:r,mask:o,bandMasks:i}=t,a=i?.length?g.A.combineBandMasks(i):o,u=xs(t,e,s,a),l=new g.A({width:n,height:r,pixels:[u],pixelType:s,mask:a});return l.updateStatistics(),l}(e,this._normalizedWeights,this.outputPixelType)}_getWebGLParameters(){return{weights:this._normalizedWeights}}};(0,i.Cg)([(0,a.MZ)({json:{write:!0,name:"rasterFunction"}})],Cs.prototype,"functionName",void 0),(0,i.Cg)([(0,a.MZ)({type:vs,json:{write:!0,name:"rasterFunctionArguments"}})],Cs.prototype,"functionArguments",void 0),(0,i.Cg)([(0,a.MZ)()],Cs.prototype,"rasterArgumentNames",void 0),(0,i.Cg)([(0,a.MZ)()],Cs.prototype,"_normalizedWeights",null),Cs=(0,i.Cg)([(0,a.$K)("esri.layers.raster.functions.GrayscaleFunction")],Cs);const bs=Cs;var Ms;const Ts=new Dt.J({0:"traditional",1:"multi-directional"},{useNumericKeys:!0}),Ps=new Dt.J({1:"degree",2:"percent-rise",3:"scaled"},{useNumericKeys:!0});let Ns=Ms=class extends p{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 Ms({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,i.Cg)([(0,a.MZ)({type:Number,json:{write:!0}})],Ns.prototype,"altitude",void 0),(0,i.Cg)([(0,a.MZ)({type:Number,json:{write:!0}})],Ns.prototype,"azimuth",void 0),(0,i.Cg)([(0,a.MZ)(),(0,Qt.e)(Ts)],Ns.prototype,"hillshadeType",void 0),(0,i.Cg)([(0,a.MZ)({type:Number,json:{write:!0,name:"psPower"}})],Ns.prototype,"pixelSizePower",void 0),(0,i.Cg)([(0,a.MZ)({type:Number,json:{write:!0,name:"psZFactor"}})],Ns.prototype,"pixelSizeFactor",void 0),(0,i.Cg)([(0,a.MZ)(),(0,Qt.e)(Ps)],Ns.prototype,"slopeType",void 0),(0,i.Cg)([(0,a.MZ)({type:Number,json:{write:!0}})],Ns.prototype,"zFactor",void 0),(0,i.Cg)([(0,a.MZ)({type:Boolean,json:{write:!0}})],Ns.prototype,"removeEdgeEffect",void 0),Ns=Ms=(0,i.Cg)([(0,a.$K)("esri.layers.raster.functions.HillshadeFunctionArguments")],Ns);const Is=Ns;let Rs=class extends w{constructor(){super(...arguments),this.functionName="Hillshade",this.functionArguments=null,this.rasterArgumentNames=["raster"],this.isGCS=!1}_bindSourceRasters(){const t=this.sourceRasterInfos[0];if(t.bandCount>1)return{success:!1,supportsGPU:!1,error:"hillshade-function: source data must be single band"};this.outputPixelType=this._getOutputPixelType("u8");const e=t.clone();return this._removeStatsHistColormapVAT(e),e.pixelType=this.outputPixelType,e.bandCount=1,e.statistics=[{min:0,max:255,avg:60,stddev:10}],this.rasterInfo=e,this.isGCS=e.spatialReference?.isGeographic??!1,{success:!0,supportsGPU:!0}}_processPixels(t){const e=t.pixelBlocks?.[0];if(!e)return null;const{extent:s,primaryPixelSizes:n}=t,r=n?.[0],o=r??(s?{x:s.width/e.width,y:s.height/e.height}:{x:1,y:1}),i=(0,zt.PP)(this.functionArguments,o,this.isGCS),a=(0,zt.fw)(e,i);return a.pixelType=this.outputPixelType,a}_getWebGLParameters(){const t=(0,zt.PP)(this.functionArguments,{x:1,y:1},this.isGCS),e=(0,zt.ng)(t),{slopeType:s,zFactor:n,pixelSizeFactor:r,pixelSizePower:o}=this.functionArguments,i="scaled"===s,a=(0,u.zw)(this.outputPixelType);return{...e,zFactor:n,gcsFactor:this.isGCS?zt.rk:1,pixelSizeFactor:i?r:0,pixelSizePower:i?o:0,isOutputRounded:a}}_getNeighborhoodSize(){return{rows:3,cols:3}}};(0,i.Cg)([(0,a.MZ)({json:{write:!0,name:"rasterFunction"}})],Rs.prototype,"functionName",void 0),(0,i.Cg)([(0,a.MZ)({type:Is,json:{write:!0,name:"rasterFunctionArguments"}})],Rs.prototype,"functionArguments",void 0),(0,i.Cg)([(0,a.MZ)()],Rs.prototype,"rasterArgumentNames",void 0),(0,i.Cg)([(0,a.MZ)({json:{write:!0}})],Rs.prototype,"isGCS",void 0),Rs=(0,i.Cg)([(0,a.$K)("esri.layers.raster.functions.HillshadeFunction")],Rs);const Fs=Rs;var ks;let _s=ks=class extends p{constructor(){super(...arguments),this.rasters=[],this.processAsMultiband=!0}writeRasters(t,e){e.rasters=t.map(t=>"number"==typeof t||"string"==typeof t?t:t.toJSON())}clone(){return new ks({operation:this.operation,processAsMultiband:this.processAsMultiband,rasters:(0,o.o8)(this.rasters)})}};(0,i.Cg)([(0,a.MZ)({json:{write:!0}})],_s.prototype,"operation",void 0),(0,i.Cg)([(0,a.MZ)({json:{write:!0}})],_s.prototype,"rasters",void 0),(0,i.Cg)([(0,Se.K)("rasters")],_s.prototype,"writeRasters",null),(0,i.Cg)([(0,a.MZ)({json:{write:!0}})],_s.prototype,"processAsMultiband",void 0),_s=ks=(0,i.Cg)([(0,a.$K)("esri.layers.raster.functions.LocalFunctionArguments")],_s);const Ss=_s;let Bs=class extends w{constructor(){super(...arguments),this.functionName="Local",this.functionArguments=null,this.rasterArgumentNames=["rasters"]}_bindSourceRasters(){const{sourceRasterInfos:t}=this,e=t[0],{bandCount:s}=e,{processAsMultiband:n}=this.functionArguments;if(t.some(t=>t.bandCount!==s))return{success:!1,supportsGPU:!1,error:"local-function: input rasters do not have same band count"};const{operation:r,rasters:o}=this.functionArguments,i=N[r];if(!(999===i||o.length===i||o.length<=1&&1===i))return{success:!1,supportsGPU:!1,error:`local-function: the length of functionArguments.rasters does not match operation's requirement: ${i}`};const a=e.clone();return a.bandCount=999!==i||n?s:1,this._removeStatsHistColormapVAT(a),this._updateStatistics(a),this._updatePixelType(a),this.rasterInfo=a,{success:!0,supportsGPU:1===a.bandCount&&i<=3}}_processPixels(t){const{pixelBlocks:e}=t;return null==e||e.some(t=>null==t)?null:kt(e,this.functionArguments.operation,{processAsMultiband:this.functionArguments.processAsMultiband,outputPixelType:this.outputPixelType??void 0})}_getWebGLParameters(){const{operation:t}=this.functionArguments,e=N[t],s=Object.keys(M).find(e=>M[e]===t)?.toLowerCase()??"undefined",n=this.outputPixelType??"f32";let[r,o]=(0,u.hP)(n);const i=(0,u.zw)(n);return i&&(r-=1e-4,o+=1e-4),{imageCount:e,operationName:s,domainRange:[r,o],isOutputRounded:i}}_updateStatistics(t){const e=this.sourceRasterInfos[0],{operation:s}=this.functionArguments,n=P(s)?.domain;if(n){t.statistics=[];for(let e=0;e<t.bandCount;e++)t.statistics[e]={min:n[0],max:n[1],avg:(n[0]+n[1])/2,stddev:(n[0]+n[1])/10}}else 45===s&&e.statistics?.length&&(t.statistics=e.statistics.map(t=>({min:-t.max,max:-t.min,avg:null!=t.avg?-t.avg:void 0,stddev:null!=t.stddev?-t.stddev:void 0})))}_updatePixelType(t){const{statistics:e,pixelType:s}=this.sourceRasterInfos[0],{operation:n}=this.functionArguments,{domain:r,isInteger:o}=P(n)??{domain:null,isInteger:!1};let i="f32";if(r&&o)i=(0,u.X1)(r[0],r[1]);else if(30===n){const t=e?.[0];i=t?(0,u.X1)(t.min,t.max):(0,u.zw)(s)?s:"s32"}else if(45===n&&(0,u.zw)(s)){const t=e?.map(({max:t})=>-t),n=e?.map(({min:t})=>-t),r=t?.length?Math.min(...t):null,o=n?.length?Math.min(...n):null;i=null!=r&&null!=o?(0,u.X1)(r,o):s.startsWith("s")?s.replace("s","u"):"u1"===s||"u2"===s||"u4"===s?"s8":"u8"===s?"s16":"s32"}t.pixelType=this.outputPixelType=this._getOutputPixelType(i)}};(0,i.Cg)([(0,a.MZ)({json:{write:!0,name:"rasterFunction"}})],Bs.prototype,"functionName",void 0),(0,i.Cg)([(0,a.MZ)({type:Ss,json:{write:!0,name:"rasterFunctionArguments"}})],Bs.prototype,"functionArguments",void 0),(0,i.Cg)([(0,a.MZ)()],Bs.prototype,"rasterArgumentNames",void 0),Bs=(0,i.Cg)([(0,a.$K)("esri.layers.raster.functions.LocalFunction")],Bs);const js=Bs;var Zs,zs=s(34727);let Gs=Zs=class extends p{constructor(){super(...arguments),this.includedRanges=null,this.noDataValues=null,this.noDataInterpretation=0}get normalizedNoDataValues(){const{noDataValues:t}=this;if(!t?.length)return null;let e=!1;const s=t.map(t=>{if("number"==typeof t)return e=!0,[t];if("string"==typeof t){const s=t.trim().split(" ").filter(t=>""!==t.trim()).map(t=>Number(t));return e=e||s.length>0,0===s.length?null:s}return null});return e?s:null}clone(){return new Zs({includedRanges:this.includedRanges?.slice()??[],noDataValues:this.noDataValues?.slice()??[],noDataInterpretation:this.noDataInterpretation})}};(0,i.Cg)([(0,a.MZ)({json:{write:!0}})],Gs.prototype,"includedRanges",void 0),(0,i.Cg)([(0,a.MZ)({json:{write:!0}})],Gs.prototype,"noDataValues",void 0),(0,i.Cg)([(0,a.MZ)()],Gs.prototype,"normalizedNoDataValues",null),(0,i.Cg)([(0,a.MZ)({json:{write:!0}})],Gs.prototype,"noDataInterpretation",void 0),Gs=Zs=(0,i.Cg)([(0,a.$K)("esri.layers.raster.functions.MaskFunctionArguments")],Gs);const Os=Gs;let Ds=class extends w{constructor(){super(...arguments),this.functionName="Mask",this.functionArguments=null,this.rasterArgumentNames=["raster"]}_bindSourceRasters(){const t=this.sourceRasterInfos[0].clone(),{pixelType:e}=t;this.outputPixelType=this._getOutputPixelType(e),t.pixelType=this.outputPixelType,this.rasterInfo=t;const{includedRanges:s,normalizedNoDataValues:n}=this.functionArguments;if(!s?.length&&!n?.length)return{success:!1,supportsGPU:!1,error:"missing includedRanges or noDataValues argument"};let r=[];for(let o=0;o<t.bandCount;o++){const t=(0,Kt.Wt)(e,s?.slice(2*o,2*o+2),n?.[o]);if(null==t){r=null;break}r.push(t)}this.lookups=r;const o=null!=n&&n.every(t=>t?.length===n[0]?.length);return{success:!0,supportsGPU:(!s||s.length<=2*Kt.et)&&(!n||o&&n[0].length<=Kt.et)}}_processPixels(t){const e=t.pixelBlocks?.[0];if(null==e)return null;const{outputPixelType:s,lookups:n}=this,{includedRanges:r,noDataInterpretation:o,normalizedNoDataValues:i}=this.functionArguments;return(0,Kt.dK)(e,{includedRanges:r,noDataValues:i,outputPixelType:s,matchAll:1===o,lookups:n})}_getWebGLParameters(){const{includedRanges:t,normalizedNoDataValues:e}=this.functionArguments,s=new Float32Array(Kt.et);s.fill(zs.pq),e?.[0]?.length&&s.set(e[0]);const n=new Float32Array(6);for(let e=0;e<n.length;e+=2)n[e]=t?.[e]??-zs.pq,n[e+1]=t?.[e+1]??zs.pq;return t?.length&&n.set(t),{bandCount:this.sourceRasterInfos[0].bandCount,noDataValues:s,includedRanges:n}}};(0,i.Cg)([(0,a.MZ)({json:{write:!0,name:"rasterFunction"}})],Ds.prototype,"functionName",void 0),(0,i.Cg)([(0,a.MZ)({type:Os,json:{write:!0,name:"rasterFunctionArguments"}})],Ds.prototype,"functionArguments",void 0),(0,i.Cg)([(0,a.MZ)()],Ds.prototype,"rasterArgumentNames",void 0),(0,i.Cg)([(0,a.MZ)({json:{write:!0}})],Ds.prototype,"lookups",void 0),Ds=(0,i.Cg)([(0,a.$K)("esri.layers.raster.functions.MaskFunction")],Ds);const Es=Ds;var Vs;let Us=Vs=class extends p{constructor(){super(...arguments),this.visibleBandID=0,this.infraredBandID=1,this.scientificOutput=!1}clone(){const{visibleBandID:t,infraredBandID:e,scientificOutput:s}=this;return new Vs({visibleBandID:t,infraredBandID:e,scientificOutput:s})}};(0,i.Cg)([(0,a.MZ)({json:{write:!0}})],Us.prototype,"visibleBandID",void 0),(0,i.Cg)([(0,a.MZ)({json:{write:!0}})],Us.prototype,"infraredBandID",void 0),(0,i.Cg)([(0,a.MZ)({json:{write:!0}})],Us.prototype,"scientificOutput",void 0),Us=Vs=(0,i.Cg)([(0,a.$K)("esri.layers.raster.functions.NDVIFunctionArguments")],Us);const Ls=Us;let $s=class extends w{constructor(){super(...arguments),this.functionName="NDVI",this.functionArguments=null,this.rasterArgumentNames=["raster"]}_bindSourceRasters(){const{scientificOutput:t,visibleBandID:e,infraredBandID:s}=this.functionArguments;this.outputPixelType=this._getOutputPixelType(t?"f32":"u8");const n=this.sourceRasterInfos[0],r=Math.max(e,s);if(n.bandCount<2||r>=n.bandCount)return{success:!1,supportsGPU:!1,error:"ndvi-function: source raster has insufficient amount of raster bands"};if(e<0||s<0)return{success:!1,supportsGPU:!1,error:"ndvi-function: invalid visible or infrared band id"};const o=n.clone();o.pixelType=this.outputPixelType,this._removeStatsHistColormapVAT(o),o.bandCount=1,o.keyProperties={...o.keyProperties,BandProperties:void 0};const[i,a,u,l]=t?[-1,1,0,.1]:[0,200,100,10];return o.statistics=[{min:i,max:a,avg:u,stddev:l}],this.rasterInfo=o,{success:!0,supportsGPU:!0}}_processPixels(t){const e=t.pixelBlocks?.[0];if(null==e)return null;let{visibleBandID:s,infraredBandID:n,scientificOutput:r}=this.functionArguments;if(this.rasterInfo.storageInfo.isBsqTile){const{rawInputBandIds:t}=this;n=t.indexOf(n),s=t.indexOf(s)}return function(t,e,s,n){const{mask:r,pixels:o,width:i,height:a}=t,u=o[s],l=o[e],c=l.length,p=n?new Uint8Array(c):new Float32Array(c),h=n?100:1,m=n?100.5:0;for(let t=0;t<c;t++)if(null==r||r[t]){const e=u[t],s=l[t],n=e+s;n&&(p[t]=(e-s)/n*h+m)}const d=new g.A({width:i,height:a,mask:r,pixelType:n?"u8":"f32",pixels:[p]});return d.updateStatistics(),d}(e,s,n,!r)}_getWebGLParameters(){const{visibleBandID:t,infraredBandID:e,scientificOutput:s}=this.functionArguments;return{bandIndexMat3:qt(this.isInputBandIdsSwizzled?[0,1,2]:[e,t,0]),scaled:!s}}_getInputBandIds(t){const{visibleBandID:e,infraredBandID:s}=this.functionArguments;return[s,e,0].map(e=>t[e])}_swizzleBandIds(t){const{visibleBandID:e,infraredBandID:s}=this.functionArguments,n=[e,s].map(e=>t.indexOf(e));return n[2]=n[1],this.isInputBandIdsSwizzled=!0,this.swizzledBandSelection=n,!1}};(0,i.Cg)([(0,a.MZ)({json:{write:!0,name:"rasterFunction"}})],$s.prototype,"functionName",void 0),(0,i.Cg)([(0,a.MZ)({type:Ls,json:{write:!0,name:"rasterFunctionArguments"}})],$s.prototype,"functionArguments",void 0),(0,i.Cg)([(0,a.MZ)()],$s.prototype,"rasterArgumentNames",void 0),$s=(0,i.Cg)([(0,a.$K)("esri.layers.raster.functions.NDVIFunction")],$s);const Ks=$s;var Ws;let Hs=Ws=class extends p{constructor(){super(...arguments),this.inputRanges=null,this.outputValues=null,this.noDataRanges=null,this.allowUnmatched=!1,this.isLastInputRangeInclusive=!1}clone(){return new Ws({inputRanges:[...this.inputRanges],outputValues:[...this.outputValues],noDataRanges:[...this.noDataRanges],allowUnmatched:this.allowUnmatched,isLastInputRangeInclusive:this.isLastInputRangeInclusive})}};(0,i.Cg)([(0,a.MZ)({json:{write:!0}})],Hs.prototype,"inputRanges",void 0),(0,i.Cg)([(0,a.MZ)({json:{write:!0}})],Hs.prototype,"outputValues",void 0),(0,i.Cg)([(0,a.MZ)({json:{write:!0}})],Hs.prototype,"noDataRanges",void 0),(0,i.Cg)([(0,a.MZ)({json:{write:!0}})],Hs.prototype,"allowUnmatched",void 0),(0,i.Cg)([(0,a.MZ)({json:{write:!0}})],Hs.prototype,"replacementValue",void 0),(0,i.Cg)([(0,a.MZ)({json:{write:!0}})],Hs.prototype,"isLastInputRangeInclusive",void 0),Hs=Ws=(0,i.Cg)([(0,a.$K)("esri.layers.raster.functions.RemapFunctionArguments")],Hs);const qs=Hs;let Js=class extends w{constructor(){super(...arguments),this.functionName="Remap",this.functionArguments=null,this.rasterArgumentNames=["raster"],this.lookup=null}_bindSourceRasters(){const t=this.sourceRasterInfos[0].clone(),{pixelType:e}=t;t.bandCount=1;const{statistics:s}=t;this._removeStatsHistColormapVAT(t);const{allowUnmatched:n,replacementValue:r,outputValues:o,inputRanges:i,noDataRanges:a,isLastInputRangeInclusive:l}=this.functionArguments,c="unknown"===this.outputPixelType||null==this.outputPixelType;if(this.outputPixelType=this._getOutputPixelType(e),o?.length){const i=s?.[0];if(n&&null==r){let e=i?.min??o[0],s=i?.max??o[0];e=Math.min.apply(null,[...o,e]),s=Math.max.apply(null,[...o,s]),t.statistics=[{min:e,max:s,avg:i?.avg??0,stddev:i?.stddev??-1}]}else{let e=o[0],s=e;for(let t=0;t<o.length;t++)e=e>o[t]?o[t]:e,s=s>o[t]?s:o[t];n&&null!=r&&(e=Math.min(e,r),s=Math.max(s,r)),t.statistics=[{min:e,max:s,avg:i?.avg??0,stddev:i?.stddev??-1}]}if(c){const{min:s,max:i}=t.statistics[0],a=["u8","s8","u16","s16","u32","s32","f32"],l=a.find(t=>{const[e,n]=(0,u.hP)(t);return s>=e&&i<=n})??"f64";o.some(t=>Math.floor(t)!==t)?this.outputPixelType="f64"===l?"f64":"f32":this.outputPixelType=n&&null==r&&a.indexOf(e)>a.indexOf(l)?e:l}}return t.pixelType=this.outputPixelType,this.rasterInfo=t,this.lookup=n?null:(0,Kt.XU)({srcPixelType:e,inputRanges:i,outputValues:o,noDataRanges:a,allowUnmatched:n,isLastInputRangeInclusive:l,outputPixelType:this.outputPixelType}),{success:!0,supportsGPU:(!o||o.length<=Kt.et)&&(!a||a.length<=Kt.et)}}_processPixels(t){const e=t.pixelBlocks?.[0];if(null==e)return null;const{lookup:s,outputPixelType:n}=this;if(s){const t=(0,Kt.eH)(e,{lut:[s.lut],offset:s.offset,outputPixelType:n});return null!=t&&s.mask&&(t.mask=(0,Kt.UK)(e.pixels[0],e.mask,s.mask,s.offset,"u8")),t}const{inputRanges:r,outputValues:o,noDataRanges:i,allowUnmatched:a,isLastInputRangeInclusive:u,replacementValue:l}=this.functionArguments;return(0,Kt.Ew)(e,{inputRanges:r,outputValues:o,noDataRanges:i,outputPixelType:n,allowUnmatched:a,isLastInputRangeInclusive:u,replacementValue:l})}_getWebGLParameters(){const{allowUnmatched:t,noDataRanges:e,isLastInputRangeInclusive:s}=this.functionArguments,n=this.functionArguments.inputRanges??[],r=this.functionArguments.outputValues??[],o=(0,Kt.bL)(n,r,s),i=new Float32Array(2*Kt.et);return i.fill(zs.pq),e?.length&&i.set(e),{allowUnmatched:t,rangeMaps:o,noDataRanges:i,clampRange:(0,u.hP)(this.outputPixelType),replacementValue:this.functionArguments.replacementValue}}};(0,i.Cg)([(0,a.MZ)({json:{write:!0,name:"rasterFunction"}})],Js.prototype,"functionName",void 0),(0,i.Cg)([(0,a.MZ)({type:qs,json:{write:!0,name:"rasterFunctionArguments"}})],Js.prototype,"functionArguments",void 0),(0,i.Cg)([(0,a.MZ)()],Js.prototype,"rasterArgumentNames",void 0),(0,i.Cg)([(0,a.MZ)({json:{write:!0}})],Js.prototype,"lookup",void 0),Js=(0,i.Cg)([(0,a.$K)("esri.layers.raster.functions.RemapFunction")],Js);const Xs=Js;var Qs;let Ys=Qs=class extends Is{readColorRamp(t){if("string"==typeof t){const e=ge.kH.jsonValues.find(e=>e.toLowerCase()===t.toLowerCase());return e?(0,ge.M5)(ge.kH.fromJSON(e)):null}return"toJSON"in t?t.toJSON():t}clone(){return new Qs({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,i.Cg)([(0,a.MZ)({json:{write:!0}})],Ys.prototype,"colorRamp",void 0),(0,i.Cg)([(0,ye.w)("colorRamp")],Ys.prototype,"readColorRamp",null),(0,i.Cg)([(0,a.MZ)({type:[[Number]],json:{write:!0}})],Ys.prototype,"colormap",void 0),Ys=Qs=(0,i.Cg)([(0,a.$K)("esri.layers.raster.functions.ShadedReliefFunctionArguments")],Ys);const tn=Ys;let en=class extends w{constructor(){super(...arguments),this.functionName="ShadedRelief",this.functionArguments=null,this.rasterArgumentNames=["raster"],this.isGCS=!1}_bindSourceRasters(){const t=this.sourceRasterInfos[0];if(t.bandCount>1)return{success:!1,supportsGPU:!1,error:"shadedrelief-function: source data must be single band"};let{colorRamp:e,colormap:s}=this.functionArguments;if(!e&&!s?.length)return{success:!1,supportsGPU:!1,error:"shadedrelief-function: a color ramp argument must be specified"};this.outputPixelType=this._getOutputPixelType("u8");const n=t.clone();this._removeStatsHistColormapVAT(n),n.pixelType=this.outputPixelType,n.bandCount=3,n.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=n,this.isGCS=n.spatialReference?.isGeographic??!1,s?.length||(s=(0,ge.R8)(e,{interpolateAlpha:!0}));const{indexedColormap:r,offset:o}=(0,Kt.zg)({colormap:s});if(!r?.length)return{success:!1,supportsGPU:!1,error:"shadedrelief-function: a valid colorramp is required"};const i=(0,ge.S2)(r);return this.lookup={indexedColormap:r,offset:o,hsvMap:i},{success:!0,supportsGPU:(0,Re.WN)(r)}}_processPixels(t){const e=t.pixelBlocks?.[0];if(!e||!this.lookup)return null;let s=t.primaryPixelSizes?.[0];if(null==s){const{extent:n}=t;s=n?{x:n.width/e.width,y:n.height/e.height}:{x:1,y:1}}const n=(0,zt.PP)(this.functionArguments,s,this.isGCS),r=(0,zt.fw)(e,n),o=this.sourceRasterInfos[0].statistics?.[0]??{min:0,max:8e3};return(0,zt.SC)(r,e,this.lookup.hsvMap,o),r.pixelType=this.outputPixelType,r}_getWebGLParameters(){const t=(0,zt.PP)(this.functionArguments,{x:1,y:1},this.isGCS),e=(0,zt.ng)(t),{slopeType:s,zFactor:n,pixelSizeFactor:r,pixelSizePower:o}=this.functionArguments,i="scaled"===s,{indexedColormap:a,offset:l}=this.lookup,c=this.sourceRasterInfos[0].statistics?.[0],p=(0,u.zw)(this.outputPixelType);return{...e,indexedColormap:a,offset:l,zFactor:n,gcsFactor:this.isGCS?zt.rk:1,pixelSizeFactor:i?r:0,pixelSizePower:i?o:0,minValue:c?.min??0,maxValue:c?.max??8e3,isOutputRounded:p}}_getNeighborhoodSize(){return{rows:3,cols:3}}};(0,i.Cg)([(0,a.MZ)({json:{write:!0,name:"rasterFunction"}})],en.prototype,"functionName",void 0),(0,i.Cg)([(0,a.MZ)({type:tn,json:{write:!0,name:"rasterFunctionArguments"}})],en.prototype,"functionArguments",void 0),(0,i.Cg)([(0,a.MZ)()],en.prototype,"rasterArgumentNames",void 0),(0,i.Cg)([(0,a.MZ)({json:{write:!0}})],en.prototype,"isGCS",void 0),(0,i.Cg)([(0,a.MZ)({json:{write:!0}})],en.prototype,"lookup",void 0),en=(0,i.Cg)([(0,a.$K)("esri.layers.raster.functions.ShadedReliefFunction")],en);const sn=en;var nn;const rn=new Dt.J({1:"degree",2:"percent-rise",3:"adjusted"},{useNumericKeys:!0});let on=nn=class extends p{constructor(){super(...arguments),this.slopeType="degree",this.zFactor=1,this.pixelSizePower=.664,this.pixelSizeFactor=.024,this.removeEdgeEffect=!1}clone(){return new nn({slopeType:this.slopeType,zFactor:this.zFactor,pixelSizePower:this.pixelSizePower,pixelSizeFactor:this.pixelSizeFactor,removeEdgeEffect:this.removeEdgeEffect,raster:this.raster})}};(0,i.Cg)([(0,Qt.e)(rn)],on.prototype,"slopeType",void 0),(0,i.Cg)([(0,a.MZ)({type:Number,json:{write:!0}})],on.prototype,"zFactor",void 0),(0,i.Cg)([(0,a.MZ)({type:Number,json:{name:"psPower",write:!0}})],on.prototype,"pixelSizePower",void 0),(0,i.Cg)([(0,a.MZ)({type:Number,json:{name:"psZFactor",write:!0}})],on.prototype,"pixelSizeFactor",void 0),(0,i.Cg)([(0,a.MZ)({type:Boolean,json:{write:!0}})],on.prototype,"removeEdgeEffect",void 0),on=nn=(0,i.Cg)([(0,a.$K)("esri.layers.raster.functions.SlopeFunctionArguments")],on);const an=on;let un=class extends w{constructor(){super(...arguments),this.functionName="Slope",this.functionArguments=null,this.rasterArgumentNames=["raster"],this.isGCS=!1}_bindSourceRasters(){this.outputPixelType=this._getOutputPixelType("f32");const t=this.sourceRasterInfos[0].clone();return t.pixelType=this.outputPixelType,this._removeStatsHistColormapVAT(t),t.statistics="percent-rise"!==this.functionArguments.slopeType?[{min:0,max:90,avg:1,stddev:1}]:null,t.bandCount=1,this.rasterInfo=t,this.isGCS=t.spatialReference?.isGeographic??!1,{success:!0,supportsGPU:!0}}_processPixels(t){const e=t.pixelBlocks?.[0];if(null==e)return null;const{zFactor:s,slopeType:n,pixelSizePower:r,pixelSizeFactor:o}=this.functionArguments,{isGCS:i}=this,{extent:a,primaryPixelSizes:u}=t,l=u?.[0],c=l??(a?{x:a.width/e.width,y:a.height/e.height}:{x:1,y:1});return(0,zt.yy)(e,{zFactor:s,slopeType:n,pixelSizePower:r,pixelSizeFactor:o,isGCS:i,resolution:c})}_getWebGLParameters(){const{zFactor:t,slopeType:e,pixelSizeFactor:s,pixelSizePower:n}=this.functionArguments;return{zFactor:this.isGCS&&t>=1?t*zt.rk:t,slopeType:e,pixelSizeFactor:s??0,pixelSizePower:n??0,isOutputRounded:(0,u.zw)(this.outputPixelType)}}_getNeighborhoodSize(){return{rows:3,cols:3}}};(0,i.Cg)([(0,a.MZ)({json:{write:!0,name:"rasterFunction"}})],un.prototype,"functionName",void 0),(0,i.Cg)([(0,a.MZ)({type:an,json:{write:!0,name:"rasterFunctionArguments"}})],un.prototype,"functionArguments",void 0),(0,i.Cg)([(0,a.MZ)()],un.prototype,"rasterArgumentNames",void 0),(0,i.Cg)([(0,a.MZ)({json:{write:!0}})],un.prototype,"isGCS",void 0),un=(0,i.Cg)([(0,a.$K)("esri.layers.raster.functions.SlopeFunction")],un);const ln=un;var cn;let pn=cn=class extends p{clone(){return new cn({conversionMatrix:[...this.conversionMatrix],raster:this.raster})}};(0,i.Cg)([(0,a.MZ)({type:[Number],json:{write:!0}})],pn.prototype,"conversionMatrix",void 0),pn=cn=(0,i.Cg)([(0,a.$K)("esri.layers.raster.functions.SpectralConversionFunctionArguments")],pn);const hn=pn;let mn=class extends w{constructor(){super(...arguments),this.functionName="SpectralConversion",this.functionArguments=null,this.rasterArgumentNames=["raster"]}_bindSourceRasters(){const 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:3===t.bandCount&&9===this.functionArguments.conversionMatrix.length}}_processPixels(t){const e=t.pixelBlocks?.[0];return null==e?null:function(t,e,s){const{width:n,height:r,mask:o,bandMasks:i}=t,a=i?.length?g.A.combineBandMasks(i):o,u=[],l=t.pixels.length;for(let n=0;n<e.length/l;n++){const r=xs(t,e.slice(n*l,(n+1)*l),s,a);u.push(r)}const c=new g.A({width:n,height:r,pixels:u,pixelType:s,mask:a});return c.updateStatistics(),c}(e,this.functionArguments.conversionMatrix,this.outputPixelType)}_getWebGLParameters(){const t=(0,u.hP)(this.outputPixelType),[e,s,n,r,o,i,a,l,c]=this.functionArguments.conversionMatrix;return{weights:[e,r,a,s,o,l,n,i,c],clampRange:t}}};(0,i.Cg)([(0,a.MZ)({json:{write:!0,name:"rasterFunction"}})],mn.prototype,"functionName",void 0),(0,i.Cg)([(0,a.MZ)({type:hn,json:{write:!0,name:"rasterFunctionArguments"}})],mn.prototype,"functionArguments",void 0),(0,i.Cg)([(0,a.MZ)()],mn.prototype,"rasterArgumentNames",void 0),mn=(0,i.Cg)([(0,a.$K)("esri.layers.raster.functions.SpectralConversionFunction")],mn);const dn=mn,gn=new Dt.J({1:"min",2:"max",3:"mean",4:"stddev",5:"median",6:"majority",7:"minority"},{useNumericKeys:!0});function fn(t,e){const{fillNoDataOnly:s}=e,{band:n,width:r,height:o,mask:i,outBand:a}=t;if(s&&!i)return void a.set(n);const{statisticsType:u,kernelRows:l,kernelCols:c}=e,p="stddev"===u,h=r*o,m=new Float64Array(h),d=new Float64Array(h),g=new Uint32Array(h);for(let t=0;t<o;t++){const e=t*r;let s=0,o=0,a=0;for(let t=0;t<c;t++)i&&!i[e+t]||(s+=n[e+t],p&&(o+=n[e+t]**2),a++);m[e]=s,d[e]=o,g[e]=a;for(let t=1;t<=r-c;t++){const r=e+t-1,u=r+c;i?(i[r]&&(a--,s-=n[r],p&&(o-=n[r]**2)),i[u]&&(a++,s+=n[u],p&&(o+=n[u]**2))):(s-=n[r],s+=n[u],p&&(o-=n[r]**2,o+=n[u]**2)),m[e+t]=s,g[e+t]=a,p&&(d[e+t]=o)}}const f=new Float64Array(h),y=new Float64Array(h),x=new Uint32Array(h),w=l*r;for(let t=0;t<=r-c;t++){let e=0,s=0,n=0;for(let o=0;o<l;o++){const i=o*r+t;e+=m[i],n+=g[i],p&&(s+=d[i])}f[t]=e,y[t]=s,x[t]=n;for(let i=1;i<=o-l;i++){const o=(i-1)*r+t,a=o+w;e-=m[o],e+=m[a],n-=g[o],n+=g[a],p&&(s-=d[o],s+=d[a]),f[i*r+t]=e,y[i*r+t]=s,x[i*r+t]=n}}const A=Math.floor(l/2),v=Math.floor(c/2);for(let t=A;t<o-A;t++){const e=t*r;for(let n=v;n<r-v;n++){const o=(t-A)*r+n-v,u=x[o];if(0===u||s&&(!i||i[e+n]))continue;const l=f[o]/u,c=p?Math.sqrt((y[o]-f[o]*l)/u):l;a[e+n]=c,i&&(i[e+n]=255)}}}function yn(t,e){const{fillNoDataOnly:s}=e,{band:n,width:r,height:o,mask:i,outBand:a}=t;if(s&&!i)return void a.set(n);const{kernelRows:u,kernelCols:l,statisticsType:c}=e,p=Math.floor(u/2),h=Math.floor(l/2),m="min"===c,d=a.slice(),g=new Uint32Array(r*o);for(let t=p;t<o-p;t++){const e=t*r;for(let t=h;t<r-h;t++){let s=m?Number.MAX_VALUE:-Number.MAX_VALUE,o=0;for(let a=0;a<u;a++)for(let u=0;u<l;u++){const l=e+t+(a-p)*r+u-h;i&&!i[l]||(s=m?Math.min(s,n[l]):Math.max(s,n[l]),o++)}i?(d[e+t]=0===o?0:s,g[e+t]=o):a[e+t]=0===o?0:s}}if(i)for(let t=p;t<o-p;t++){const e=t*r;for(let t=h;t<r-h;t++)if(g[e+t]){if(s&&i[e+t])continue;a[e+t]=d[e+t],i[e+t]=255}}}function xn(t,e){const{fillNoDataOnly:s}=e,{band:n,width:r,height:o,mask:i,outBand:a}=t;if(s&&!i)return void a.set(n);const{kernelRows:u,kernelCols:l}=e,c=Math.floor(u/2),p=Math.floor(l/2),h=a.slice(),m=new Uint32Array(r*o);for(let t=c;t<o-c;t++){const e=t*r;for(let t=p;t<r-p;t++){if(s&&i?.[e+t])continue;const o=[];for(let s=0;s<u;s++)for(let a=0;a<l;a++){const u=e+t+(s-c)*r+a-p;i&&!i[u]||o.push(n[u])}o.length&&(o.sort((t,e)=>t-e),i?(h[e+t]=o[Math.floor((o.length-1)/2)],m[e+t]=o.length):a[e+t]=o[Math.floor((o.length-1)/2)])}}if(i)for(let t=c;t<o-c;t++){const e=t*r;for(let t=p;t<r-p;t++)if(m[e+t]){if(s&&i[e+t])continue;a[e+t]=h[e+t],i[e+t]=255}}}function wn(t,e){const{fillNoDataOnly:s}=e,{band:n,width:r,height:o,mask:i,outBand:a}=t;if(s&&!i)return void a.set(n);const{kernelRows:u,kernelCols:l}=e,c=Math.floor(u/2),p=Math.floor(l/2),h="majority"===e.statisticsType,m=u*l,d=a.slice(),g=new Uint32Array(r*o);for(let t=c;t<o-c;t++){const e=t*r;for(let t=p;t<r-p;t++){if(s&&i?.[e+t])continue;const o=new Map;for(let s=0;s<u;s++)for(let a=0;a<l;a++){const u=e+t+(s-c)*r+a-p;if(i&&!i[u])continue;const l=n[u];o.set(l,o.has(l)?o.get(l)+1:1)}if(0===o.size)continue;let f=0,y=0,x=h?0:m+1;for(const t of o.keys())y=o.get(t),h===y>x&&(x=y,f=t);i?(d[e+t]=f,g[e+t]=o.size):a[e+t]=f}}if(i)for(let t=c;t<o-c;t++){const e=t*r;for(let t=p;t<r-p;t++)if(g[e+t]){if(s&&i[e+t])continue;a[e+t]=d[e+t],i[e+t]=255}}}var An;let vn=An=class extends p{constructor(){super(...arguments),this.rows=3,this.cols=3,this.fillNoDataOnly=!1,this.statisticsType="min"}clone(){return new An({rows:this.rows,cols:this.cols,fillNoDataOnly:this.fillNoDataOnly,statisticsType:this.statisticsType,raster:(0,o.o8)(this.raster)})}};(0,i.Cg)([(0,a.MZ)({json:{write:!0,read:{source:["kernelRows","rows"],reader:(t,e)=>Number(t??e?.kernelRows??3)}}})],vn.prototype,"rows",void 0),(0,i.Cg)([(0,a.MZ)({json:{write:!0,read:{source:["kernelCols","cols"],reader:(t,e)=>Number(t??e?.kernelCols??3)}}})],vn.prototype,"cols",void 0),(0,i.Cg)([(0,a.MZ)({json:{write:!0}})],vn.prototype,"fillNoDataOnly",void 0),(0,i.Cg)([(0,a.MZ)({json:{read:{source:["statisticsType","type"],reader:(t,e)=>gn.fromJSON(e?.statisticsType??e?.type)??"min"},write:{target:"type"}}}),(0,Qt.e)(gn)],vn.prototype,"statisticsType",void 0),vn=An=(0,i.Cg)([(0,a.$K)("esri.layers.raster.functions.StatisticsFunctionArguments")],vn);const Cn=vn;let bn=class extends w{constructor(){super(...arguments),this.functionName="Statistics",this.rasterArgumentNames=["raster"]}_bindSourceRasters(){const{type:t}=this.functionArguments.toJSON();if(t<1||t>7)return{success:!1,supportsGPU:!1,error:`statistics-function: the given statistics type is not supported ${t}`};const e=this.sourceRasterInfos[0];this.outputPixelType=this._getOutputPixelType(e.pixelType);const s=e.clone();s.pixelType=this.outputPixelType;const{statisticsType:n}=this.functionArguments;return"stddev"===n&&this._removeStatsHistColormapVAT(s),this.rasterInfo=s,{success:!0,supportsGPU:s.bandCount<=3&&t<5}}_processPixels(t){const e=t.pixelBlocks?.[0];if(null==e)return e;const{statisticsType:s,rows:n,cols:r,fillNoDataOnly:o}=this.functionArguments;return function(t,e){const{mask:s}=t,{fillNoDataOnly:n}=e;if(n&&!s)return t;const{pixels:r,width:o,height:i,bandMasks:a,pixelType:u}=t,l=r.length,c=o*i,p=[],{kernelRows:h,kernelCols:m,statisticsType:d,mirrorEdges:f}=e;if(n&&!s)return t;const y=e.outputPixelType??u,x=[];for(let t=0;t<l;t++){const u=r[t],l=g.A.createEmptyBand(y,c);n&&l.set(u);const w=a?.[t]??s,A=w?.slice()??null,v={band:u,width:o,height:i,mask:A,outBand:l};switch(d){case"min":case"max":yn(v,e);break;case"mean":case"stddev":fn(v,e);break;case"median":xn(v,e);break;case"majority":case"minority":wn(v,e)}f&&!n&&Qe(l,o,i,h,m),p.push(l),A&&x.push(A)}let w=x[0]??s;x.length!==l&&(x.length=0),l>1&&a?.length&&(w=g.A.combineBandMasks(a));const A=new g.A({pixelType:y,width:o,height:i,pixels:p,bandMasks:a&&x.length?x:null,mask:w});return A.updateStatistics(),A}(e,{kernelRows:n,kernelCols:r,fillNoDataOnly:o,outputPixelType:this.outputPixelType,statisticsType:s,mirrorEdges:!0})}_getWebGLParameters(){const{rows:t,cols:e,statisticsType:s,fillNoDataOnly:n}=this.functionArguments;return{fillNoDataOnly:n,kernelRows:t,kernelCols:e,statisticsType:s,clampRange:(0,u.hP)(this.outputPixelType)}}_getNeighborhoodSize(){const{rows:t,cols:e}=this.functionArguments;return{rows:t,cols:e}}};(0,i.Cg)([(0,a.MZ)({json:{write:!0,name:"rasterFunction"}})],bn.prototype,"functionName",void 0),(0,i.Cg)([(0,a.MZ)({type:Cn,json:{write:!0,name:"rasterFunctionArguments"}})],bn.prototype,"functionArguments",void 0),(0,i.Cg)([(0,a.MZ)()],bn.prototype,"rasterArgumentNames",void 0),bn=(0,i.Cg)([(0,a.$K)("esri.layers.raster.functions.StatisticsFunction")],bn);const Mn=bn;var Tn;let Pn=Tn=class extends p{constructor(){super(...arguments),this.statistics=null,this.histograms=null}readStatistics(t,e){if(!t?.length)return null;const s=[];return t.forEach(t=>{const e={min:t.min,max:t.max,avg:t.avg??t.mean,stddev:t.stddev??t.standardDeviation};s.push(e)}),s}writeStatistics(t,e,s){if(!t?.length)return;const n=[];t.forEach(t=>{const e={...t,mean:t.avg,standardDeviation:t.stddev};delete e.avg,delete e.stddev,n.push(e)}),e[s]=n}clone(){return new Tn({statistics:(0,o.o8)(this.statistics),histograms:(0,o.o8)(this.histograms)})}};(0,i.Cg)([(0,a.MZ)({json:{write:!0}})],Pn.prototype,"statistics",void 0),(0,i.Cg)([(0,ye.w)("statistics")],Pn.prototype,"readStatistics",null),(0,i.Cg)([(0,Se.K)("statistics")],Pn.prototype,"writeStatistics",null),(0,i.Cg)([(0,a.MZ)({json:{write:!0}})],Pn.prototype,"histograms",void 0),Pn=Tn=(0,i.Cg)([(0,a.$K)("esri.layers.raster.functions.StatisticsHistogramFunctionArguments")],Pn);const Nn=Pn;let In=class extends w{constructor(){super(...arguments),this.functionName="StatisticsHistogram",this.functionArguments=null,this.rasterArgumentNames=["raster"],this.isNoopProcess=!0}_bindSourceRasters(){const t=this.sourceRasterInfos[0];this.outputPixelType=this._getOutputPixelType("u8");const e=t.clone(),{statistics:s,histograms:n}=this.functionArguments;return n&&(e.histograms=n),s&&(e.statistics=s),this.rasterInfo=e,{success:!0,supportsGPU:!0}}_processPixels(t){return t.pixelBlocks?.[0]}};(0,i.Cg)([(0,a.MZ)({json:{write:!0,name:"rasterFunction"}})],In.prototype,"functionName",void 0),(0,i.Cg)([(0,a.MZ)({type:Nn,json:{write:!0,name:"rasterFunctionArguments"}})],In.prototype,"functionArguments",void 0),(0,i.Cg)([(0,a.MZ)()],In.prototype,"rasterArgumentNames",void 0),(0,i.Cg)([(0,a.MZ)({json:{write:!0}})],In.prototype,"indexedColormap",void 0),(0,i.Cg)([(0,a.MZ)()],In.prototype,"isNoopProcess",void 0),In=(0,i.Cg)([(0,a.$K)("esri.layers.raster.functions.StatisticsHistogramFunction")],In);const Rn=In;var Fn;const kn=new Dt.J({0:"none",3:"standard-deviation",4:"histogram-equalization",5:"min-max",6:"percent-clip",9:"sigmoid"},{useNumericKeys:!0});let _n=Fn=class extends p{constructor(){super(...arguments),this.computeGamma=!1,this.dynamicRangeAdjustment=!1,this.gamma=[],this.histograms=null,this.statistics=null,this.stretchType="none",this.useGamma=!1}writeStatistics(t,e,s){t?.length&&(Array.isArray(t[0])||(t=t.map(t=>[t.min,t.max,t.avg,t.stddev])),e[s]=t)}clone(){return new Fn({stretchType:this.stretchType,outputMin:this.outputMin,outputMax:this.outputMax,useGamma:this.useGamma,computeGamma:this.computeGamma,statistics:(0,o.o8)(this.statistics),gamma:(0,o.o8)(this.gamma),sigmoidStrengthLevel:this.sigmoidStrengthLevel,numberOfStandardDeviations:this.numberOfStandardDeviations,minPercent:this.minPercent,maxPercent:this.maxPercent,histograms:(0,o.o8)(this.histograms),dynamicRangeAdjustment:this.dynamicRangeAdjustment,raster:this.raster})}};(0,i.Cg)([(0,a.MZ)({type:Boolean,json:{write:!0}})],_n.prototype,"computeGamma",void 0),(0,i.Cg)([(0,a.MZ)({type:Boolean,json:{name:"dra",write:!0}})],_n.prototype,"dynamicRangeAdjustment",void 0),(0,i.Cg)([(0,a.MZ)({type:[Number],json:{write:!0}})],_n.prototype,"gamma",void 0),(0,i.Cg)([(0,a.MZ)()],_n.prototype,"histograms",void 0),(0,i.Cg)([(0,a.MZ)({type:Number,json:{write:!0}})],_n.prototype,"maxPercent",void 0),(0,i.Cg)([(0,a.MZ)({type:Number,json:{write:!0}})],_n.prototype,"minPercent",void 0),(0,i.Cg)([(0,a.MZ)({type:Number,json:{write:!0}})],_n.prototype,"numberOfStandardDeviations",void 0),(0,i.Cg)([(0,a.MZ)({type:Number,json:{name:"max",write:!0}})],_n.prototype,"outputMax",void 0),(0,i.Cg)([(0,a.MZ)({type:Number,json:{name:"min",write:!0}})],_n.prototype,"outputMin",void 0),(0,i.Cg)([(0,a.MZ)({type:Number,json:{write:!0}})],_n.prototype,"sigmoidStrengthLevel",void 0),(0,i.Cg)([(0,a.MZ)({json:{type:[[Number]],write:!0}})],_n.prototype,"statistics",void 0),(0,i.Cg)([(0,Se.K)("statistics")],_n.prototype,"writeStatistics",null),(0,i.Cg)([(0,Qt.e)(kn)],_n.prototype,"stretchType",void 0),(0,i.Cg)([(0,a.MZ)({type:Boolean,json:{write:!0}})],_n.prototype,"useGamma",void 0),_n=Fn=(0,i.Cg)([(0,a.$K)("esri.layers.raster.functions.StretchFunctionArguments")],_n);const Sn=_n;let Bn=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;const t=this.sourceRasterInfos[0],{pixelType:e}=t,{functionArguments:s}=this,{dynamicRangeAdjustment:n,gamma:r,useGamma:o}=s;if(!n&&["u8","u16","s8","s16"].includes(e)){const n=(0,qe.DP)(s.toJSON(),{rasterInfo:t}),i=(0,u.zw)(this.outputPixelType)?"round":"float";this.lookup=(0,qe.RP)({pixelType:e,...n,gamma:o?r:null,rounding:i}),this.cutOffs=n}else n||(this.cutOffs=(0,qe.DP)(s.toJSON(),{rasterInfo:t}));this.outputPixelType=this._getOutputPixelType(e);const i=t.clone();i.pixelType=this.outputPixelType,this._removeStatsHistColormapVAT(i),"u8"===this.outputPixelType&&(i.keyProperties.DataType="processed");const{outputMin:a=0,outputMax:l=255}=this.functionArguments;i.statistics=[];for(let t=0;t<i.bandCount;t++)i.statistics[t]={min:a,max:l};return this.rasterInfo=i,{success:!0,supportsGPU:!n}}_processPixels(t,e){const s=t.pixelBlocks?.[0];if(null==s)return s;const{lookup:n}=this;if(n)return(0,Kt.eH)(s,{...n,outputPixelType:this.rasterInfo.pixelType});const{functionArguments:r}=this,o=e?.stretchCutoff??this.cutOffs??(0,qe.DP)(r.toJSON(),{rasterInfo:this.sourceRasterInfos[0],pixelBlock:s}),i=r.useGamma?r.gamma:null;return(0,qe._N)(s,{...o,gamma:i,outputPixelType:this.outputPixelType})}_getWebGLParameters(){const{outputMin:t=0,outputMax:e=255,gamma:s,useGamma:n}=this.functionArguments,r=this.rasterInfo.bandCount>=2?3:1,o=n&&s?.length?(0,qe.Nh)(r,s):[1,1,1],{minCutOff:i,maxCutOff:a}=this.cutOffs??{minCutOff:[0,0,0],maxCutOff:[255,255,255]};1===i.length&&(i[1]=i[2]=i[0],a[1]=a[2]=a[0]);const l=a.map((s,n)=>(e-t)/(a[n]-i[n])),c=(0,u.zw)(this.outputPixelType),p=n&&s?[s[0],s[1]??s[0],s[2]??s[0]]:[1,1,1],h=n?[o[0],o[1]??o[0],o[2]??o[0]]:[1,1,1];return{bandCount:r,minOutput:t,maxOutput:e,minCutOff:i,maxCutOff:a,factor:l,useGamma:n,gamma:p,gammaCorrection:h,stretchType:this.functionArguments.stretchType,isOutputRounded:c,type:"stretch"}}};(0,i.Cg)([(0,a.MZ)({json:{write:!0,name:"rasterFunction"}})],Bn.prototype,"functionName",void 0),(0,i.Cg)([(0,a.MZ)({type:Sn,json:{write:!0,name:"rasterFunctionArguments"}})],Bn.prototype,"functionArguments",void 0),(0,i.Cg)([(0,a.MZ)()],Bn.prototype,"rasterArgumentNames",void 0),(0,i.Cg)([(0,a.MZ)({json:{write:!0}})],Bn.prototype,"lookup",void 0),(0,i.Cg)([(0,a.MZ)({json:{write:!0}})],Bn.prototype,"cutOffs",void 0),Bn=(0,i.Cg)([(0,a.$K)("esri.layers.raster.functions.StretchFunction")],Bn);const jn=Bn;var Zn;let zn=Zn=class extends p{constructor(){super(...arguments),this.attributeTableAsRecordSet=null}clone(){return new Zn({attributeTableAsRecordSet:(0,o.o8)(this.attributeTableAsRecordSet)})}};(0,i.Cg)([(0,a.MZ)({json:{write:!0}})],zn.prototype,"attributeTableAsRecordSet",void 0),zn=Zn=(0,i.Cg)([(0,a.$K)("esri.layers.raster.functions.TableFunctionArguments")],zn);const Gn=zn;let On=class extends w{constructor(){super(...arguments),this.functionName="Table",this.functionArguments=null,this.rasterArgumentNames=["raster"],this.isNoopProcess=!0}_bindSourceRasters(){const t=this.sourceRasterInfos[0];if(t.bandCount>1||t.pixelType.startsWith("f"))return{success:!1,supportsGPU:!1,error:"table-function: Source data must be single band and integer pixel type."};const{attributeTableAsRecordSet:e}=this.functionArguments;if(!e)return{success:!1,supportsGPU:!1,error:"table-function: Missing attributeTableAsRecordSet argument."};this.outputPixelType=this._getOutputPixelType(t.pixelType);const s=t.clone();return s.pixelType=this.outputPixelType,s.bandCount=1,"thematic"!==s.dataType&&(s.keyProperties=s.keyProperties?{...s.keyProperties,DataType:"thematic"}:{DataType:"thematic"}),this.rasterInfo=s,{success:!0,supportsGPU:!0}}_processPixels(t){return t.pixelBlocks?.[0]}};(0,i.Cg)([(0,a.MZ)({json:{write:!0,name:"rasterFunction"}})],On.prototype,"functionName",void 0),(0,i.Cg)([(0,a.MZ)({type:Gn,json:{write:!0,name:"rasterFunctionArguments"}})],On.prototype,"functionArguments",void 0),(0,i.Cg)([(0,a.MZ)()],On.prototype,"rasterArgumentNames",void 0),(0,i.Cg)([(0,a.MZ)()],On.prototype,"isNoopProcess",void 0),On=(0,i.Cg)([(0,a.$K)("esri.layers.raster.functions.TableFunction")],On);const Dn=On,En=new Map;function Vn(t,e){const{rasterFunctionArguments:s}=t;s&&(s.rasters||[s.raster,s.raster2]).forEach(t=>{t&&"number"!=typeof t&&("string"==typeof t?t.startsWith("http")&&(e.includes(t)||e.push(t)):"rasterFunctionArguments"in t&&Vn(t,e))})}function Un(t,e){e=e??{};try{if("function"in(t=(0,o.o8)(t))&&"arguments"in t&&t.arguments){const s=Jn(t,new Map,e);if(Qn(s),!s.renderingRule)throw new r.A("raster-function-helper","Unsupported raster function json.");t=s.renderingRule}if("rasterFunction"in t){const s=Kn(t=$n(t),e);return s.isRoot=!0,s}}catch{}throw new r.A("raster-function-helper","unsupported raster function json.")}function Ln(t){return!!(t&&"object"==typeof t&&t.rasterFunction&&t.rasterFunctionArguments)}function $n(t){const{rasterFunction:e,rasterFunctionArguments:s}=t,n={};for(const t in s){let e=s[t];const r=t.toLowerCase();if("rasters"===r&&Array.isArray(e))n.rasters=e.map(t=>Ln(t)?$n(t):t);else switch(Ln(e)&&(e=$n(e)),r){case"dra":n.dra=e;break;case"pspower":n.psPower=e;break;case"pszfactor":n.psZFactor=e;break;case"bandids":n.bandIds=e;break;default:n[t[0].toLowerCase()+t.slice(1)]=e}}return"Local"!==e||n.rasters?.length||(n.rasters=["$$"]),{...t,rasterFunctionArguments:n}}function Kn(t,e){const{rasterFunction:s,rasterFunctionArguments:n}=t,o=t.outputPixelType?.toLowerCase();if(null==s||!En.has(s))throw new r.A("raster-function-helper",`unsupported raster function: ${s}`);const i=En.get(s),a=("function"==typeof i.ctor?i.ctor:i.ctor.default).fromJSON({...t,outputPixelType:o}),{rasterArgumentNames:u}=a,l=[],c=function(t,e){return"rasters"===e[0]&&Array.isArray(t.rasters)?t.rasters:e.map(e=>t[e])}(n,u),p="rasters"===u[0]||u.length>1,h=[];for(let t=0;t<c.length;t++){const s=c[t];let n;null==s||"string"==typeof s&&s.startsWith("$")?l.push(e?.raster):"string"==typeof s?e[s]&&l.push(e[s]):"number"!=typeof s&&"rasterFunction"in s&&(n=Kn(s,e),p||(a.functionArguments[u[t]]=n),l.push(n)),p&&h.push(n??s)}if(p&&("rasters"===u[0]?a.functionArguments.rasters=h:u.forEach((t,e)=>{a.functionArguments[t]=h[e]})),e){a.sourceRasters=l;const t=e.raster?.url;t&&(a.mainPrimaryRasterId=t)}return a}function Wn(t,e){if(t&&e)for(const s in t){const n=t[s];n&&"object"==typeof n&&"type"in n&&("RasterFunctionTemplate"===n.type?Wn(n.arguments,e):"RasterFunctionVariable"===n.type&&null!=e[n.name]&&(n.value=e[n.name]))}}function Hn(t,e){if(!t||"object"!=typeof t)return t;const{value:s}=t;if(!s||"object"!=typeof s)return t.isDataset?"$$":s;if(Array.isArray(s))return 0===s.length?[]:s.map(t=>t&&"object"==typeof t&&"RasterFunctionVariable"===t.type?Hn(t,e):t);if("value"in s&&["number","string","boolean"].includes(typeof s.value))return s.value;if(t.isDataset&&"Scalar"!==s.type)return"$$";if(!("type"in s))return s;let n=s;switch(s.type){case"Scalar":n=s.value;break;case"AlgorithmicColorRamp":n=qn(s);break;case"MultiPartColorRamp":n={type:"multipart",colorRamps:s.ArrayOfColorRamp.map(qn)};break;case"ArgumentArray":if(s.elements?.length&&"RasterStatistics"!==s.elements[0].type){const t=[];for(let n=0;n<s.elements.length;n++){const o=s.elements[n],{type:i}=o;if(i)if("RasterFunctionTemplate"===i){const{renderingRule:s}=Jn(o,e);t.push(s),null!=o._object_id&&e.set(o._object_id,s)}else{if("RasterFunctionVariable"!==i)throw new r.A("raster-function-helper","unsupported raster function json.");{const s=Hn(o,e);t.push(s),null!=o._object_id&&e.set(o._object_id,s)}}else t.push(o)}n=t}else n=s.elements}return null!=s._object_id&&e.set(s._object_id,n),n}function qn(t){const e=t.algorithm??"esriHSVAlgorithm";let{FromColor:s,ToColor:r}=t;if(!Array.isArray(s)){const{r:t,g:e,b:r}=(0,n.$)({h:s.Hue,s:s.Saturation,v:s.Value});s=[t,e,r,s.AlphaValue]}if(!Array.isArray(r)){const{r:t,g:e,b:s}=(0,n.$)({h:r.Hue,s:r.Saturation,v:r.Value});r=[t,e,s,r.AlphaValue]}return{type:"algorithmic",algorithm:e,fromColor:s,toColor:r}}function Jn(t,e,s){s&&Wn(t,s);const n={renderingRule:{},templates:e};return Xn(t,n),n}function Xn(t,e){if(!t||!e.renderingRule)return;const{renderingRule:s,templates:n}=e,{function:r,arguments:o,_object_id:i}=t;if(!r||!o)return;null!=i&&n.set(i,s),s.rasterFunction=r.type.replace("Function",""),s.outputPixelType=r.pixelType;const a={};s.rasterFunctionArguments=a;for(const t in o){if("type"===t||"object_id"===t||"_object_ref_id"===t)continue;const e=o[t];e&&"object"==typeof e&&"type"in e&&("RasterFunctionTemplate"===e.type||"RasterFunctionVariable"===e.type)?("RasterFunctionVariable"===e.type?a[t]=Hn(e,n):(s.rasterFunctionArguments[t]={},Xn(e,{renderingRule:s.rasterFunctionArguments[t],templates:n})),null!=e._object_id&&n.set(e._object_id,a[t])):a[t]=e}switch(a.DEM&&!a.Raster&&(a.Raster=a.DEM,delete a.DEM),s.rasterFunction){case"Stretch":!function(t){t.Statistics?.length&&"object"==typeof t.Statistics&&(t.Statistics=t.Statistics.map(t=>[t.min,t.max,t.mean,t.standardDeviation])),null!=t.NumberOfStandardDeviation&&(t.NumberOfStandardDeviations=t.NumberOfStandardDeviation,delete t.NumberOfStandardDeviation)}(a);break;case"Colormap":!function(t){"randomcolorramp"===t.ColorRamp?.type?.toLowerCase()&&(delete t.ColorRamp,t.ColormapName="Random"),0===t.ColorSchemeType&&delete t.ColorRamp}(a);break;case"Convolution":!function(t){null!=t.ConvolutionType&&(t.Type=t.ConvolutionType,delete t.ConvolutionType)}(a);break;case"Mask":!function(t){t.NoDataValues?.length&&"string"==typeof t.NoDataValues[0]&&(t.NoDataValues=t.NoDataValues.filter(t=>""!==t).map(t=>Number(t)))}(a)}}function Qn(t){const{renderingRule:e,templates:s}=t;if("object"!=typeof e||!e?.rasterFunctionArguments||!s.size)return;const{rasterFunctionArguments:n}=e;for(const t in n){const e=n[t],o="_object_ref_id"===t?e:e&&"object"==typeof e&&"_object_ref_id"in e?e._object_ref_id:null;if(null!=o){if(!s.has(o))throw new r.A("raster-function-helper",`unsupported raster function json. _object_ref_id: ${o} does not exist`);const e=s.get(o);"_object_ref_id"!==t?n[t]=e:e&&"object"==typeof e&&Object.assign(n,e);continue}e&&"object"==typeof e&&(e.rasterFunctionArguments&&Qn({renderingRule:e,templates:s}),Array.isArray(e)&&e.forEach((t,n)=>{if(t&&"object"==typeof t)if(null!=t._object_ref_id){if(!s.has(t._object_ref_id))throw new r.A("raster-function-helper",`unsupported raster function json. _object_ref_id: ${e} does not exist`);const i=s.get(o);i&&"object"==typeof i?Object.assign(t,i):e[n]=i}else Qn({renderingRule:t,templates:s})}))}}En.set("Arithmetic",{desc:"Arithmetic Function",ctor:St,rasterArgumentNames:["rasters"]}),En.set("Aspect",{desc:"Aspect Function",ctor:Ot,rasterArgumentNames:["raster"]}),En.set("BandArithmetic",{desc:"Band Arithmetic Function",ctor:ne,rasterArgumentNames:["raster"]}),En.set("Colormap",{desc:"Colormap Function",ctor:Me,rasterArgumentNames:["raster"]}),En.set("ColormapToRGB",{desc:"ColormapToRGB Function",ctor:ke,rasterArgumentNames:["raster"]}),En.set("CompositeBand",{desc:"CompositeBand Function",ctor:ze,rasterArgumentNames:["rasters"]}),En.set("ComputeChange",{desc:"ComputeChange Function",ctor:$e,rasterArgumentNames:["rasters"]}),En.set("Convolution",{desc:"Convolution Function",ctor:is,rasterArgumentNames:["raster"]}),En.set("ContrastBrightness",{desc:"Contrast Brightness Function",ctor:Xe,rasterArgumentNames:["raster"]}),En.set("ExtractBand",{desc:"ExtractBand Function",ctor:ys,rasterArgumentNames:["raster"]}),En.set("Curvature",{desc:"Curvature Function",ctor:hs,rasterArgumentNames:["raster"]}),En.set("Hillshade",{desc:"Hillshade Function",ctor:Fs,rasterArgumentNames:["raster"]}),En.set("ShadedRelief",{desc:"ShadedRelief Function",ctor:sn,rasterArgumentNames:["raster"]}),En.set("Grayscale",{desc:"Grayscale Function",ctor:bs,rasterArgumentNames:["raster"]}),En.set("Clip",{desc:"Clip Function",ctor:me,rasterArgumentNames:["raster"]}),En.set("Local",{desc:"Local Function",ctor:js,rasterArgumentNames:["rasters"]}),En.set("Mask",{desc:"Mask Function",ctor:Es,rasterArgumentNames:["raster"]}),En.set("NDVI",{desc:"NDVI Function",ctor:Ks,rasterArgumentNames:["raster"]}),En.set("Remap",{desc:"Remap Function",ctor:Xs,rasterArgumentNames:["raster"]}),En.set("Slope",{desc:"Slope Function",ctor:ln,rasterArgumentNames:["raster"]}),En.set("SpectralConversion",{desc:"Spectral Conversion",ctor:dn,rasterArgumentNames:["raster"]}),En.set("Statistics",{desc:"Focal Statistics Function",ctor:Mn,rasterArgumentNames:["raster"]}),En.set("StatisticsHistogram",{desc:"Statistics Histogram Function",ctor:Rn,rasterArgumentNames:["raster"]}),En.set("Stretch",{desc:"Stretch Function",ctor:jn,rasterArgumentNames:["raster"]}),En.set("Table",{desc:"Attribute Table Function",ctor:Dn,rasterArgumentNames:["raster"]})}}]);
1
+ "use strict";(self.webpackChunkRemoteClient=self.webpackChunkRemoteClient||[]).push([[9235],{34930(t,e,s){s.d(e,{$Q:()=>a,Sd:()=>u,b7:()=>l});var n=s(86211),r=s(5443),o=s(86738),i=s(14140);async function a(t,e,n){if("extent"===n.type)return function(t,e,s){const{width:n,height:r}=t,o=new Uint8Array(n*r),a=e.width/n,u=e.height/r;if(s.width/a<.5||s.height/u<.5)return new i.A({pixelType:t.pixelType,width:n,height:r,mask:o,pixels:[...t.pixels]});const{xmin:l,xmax:c,ymin:p,ymax:h}=e,{xmin:m,xmax:d,ymin:g,ymax:f}=s,y=Math.max(l,m),x=Math.min(c,d),w=Math.max(p,g),A=Math.min(h,f),v=.5*a,C=.5*u;if(x-y<v||A-w<C||x<l+v||y>c-v||w>h-C||A<p+C)return new i.A({pixelType:t.pixelType,width:n,height:r,mask:o,pixels:[...t.pixels]});const b=Math.max(0,(y-l)/a),M=Math.min(n,Math.max(0,(x-l)/a)),T=Math.max(0,(h-A)/u),P=Math.min(r,Math.max(0,(h-w)/u)),N=Math.round(b),I=Math.round(M)-1,R=Math.round(T),F=Math.round(P)-1;if(N===I&&b%1>.5&&M%1<.5||R===F&&T%1>.5&&P%1<.5)return new i.A({pixelType:t.pixelType,width:n,height:r,mask:o,pixels:[...t.pixels]});if(0===N&&0===R&&I===n&&F===r)return t;const k=t.mask;for(let t=R;t<=F;t++)for(let e=N;e<=I;e++){const s=t*n+e;o[s]=k?k[s]:255}return new i.A({pixelType:t.pixelType,width:n,height:r,mask:o,pixels:[...t.pixels]})}(t,e,n);const{width:r,height:o}=t,a=new Uint8Array(r*o);return(await Promise.all([s.e(6042),s.e(1878),s.e(8885),s.e(5756),s.e(3299),s.e(1132)]).then(s.bind(s,25275))).execute(e,n)?"polyline"===n.type?function(t,e,s){const{width:n,height:r}=t,o=new Uint8Array(n*r),a=e.width/n,u=e.height/r,{xmin:l,ymax:c}=e,{paths:p}=s,h=t.mask;for(let t=0;t<p.length;t++){const e=p[t];for(let t=0;t<e.length-1;t++){const[s,i]=e[t],[p,m]=e[t+1],d=Math.min(i,m),g=Math.max(i,m),f=Math.max(0,Math.floor((c-g)/u)),y=Math.min(r-1,Math.floor((c-d)/u));if(!(y<f))if(f===y){const t=Math.min(s,p),e=Math.max(s,p),r=Math.max(0,Math.floor((t-l)/a)),i=Math.min(n-1,Math.floor((e-l)/a));if(i<r)continue;const u=f*n;for(let t=u+r;t<=u+i;t++)o[t]=h?h[t]:255}else{const t=(s-l)/a,e=(p-s)/(m-i)/a,r=u*e;for(let s=f;s<=y;s++){const a=e*(c-s*u-i)+t,l=Math.max(0,Math.floor(r>0?a-r:a)),p=Math.min(n-1,Math.floor(r>0?a:a-r));if(p<l)continue;const m=s*n;for(let t=m+l;t<=m+p;t++)o[t]=h?h[t]:255}}}}return new i.A({pixelType:t.pixelType,width:n,height:r,mask:o,pixels:[...t.pixels]})}(t,e,n):(await Promise.all([s.e(6042),s.e(1878),s.e(8885),s.e(5756),s.e(3299),s.e(6671)]).then(s.bind(s,30912))).execute(n,e)?t:function(t,e,s){if(!t)return t;const{width:n,height:r}=t,o=function(t){const{geometry:e,size:s,srcExtent:n,srcMask:r}=t,[o,i]=s;let a;const u=n.width/o,l=n.height/i,{xmin:c,ymax:p}=n;if("extent"===e.type){const t=(e.xmin-c)/u,s=(e.xmax-c)/u,n=(p-e.ymax)/l,r=(p-e.ymin)/l;a=[[[t,n],[t,r],[s,r],[s,n],[t,n]]]}else a=e.rings.map(t=>t.map(([t,e])=>[(t-c)/u,(p-e)/l]));return function(t,e,s){const[n,r]=e,o=new OffscreenCanvas(n,r).getContext("2d");o.fillStyle="#f00",o.beginPath(),t.forEach(t=>{o.moveTo(t[0][0],t[0][1]);for(let e=0;e<t.length;e++)o.lineTo(t[e][0],t[e][1]);o.closePath()}),o.fill();const i=o.getImageData(0,0,n,r).data,a=n*r,u=new Uint8Array(a);let l=!1;for(let t=0;t<a;t++)s&&!s[t]||(i[4*t+3]>127?u[t]=255:l=!0);return l||s?u:void 0}(a,s,r)}({geometry:s,size:[n,r],srcExtent:e,srcMask:t.mask});return new i.A({pixelType:t.pixelType,width:n,height:r,mask:o,maskIsAlpha:!1,pixels:[...t.pixels]})}(t,e,n):new i.A({pixelType:t.pixelType,width:r,height:o,mask:a,maskIsAlpha:!1,pixels:[...t.pixels]})}function u(t,e){const{extent:s}=l(t,e,new o.A({x:t.pixelSize.x,y:t.pixelSize.y,spatialReference:t.spatialReference})),{extent:n}=t.extent;if(s.xmax=Math.min(s.xmax,n.xmax),s.ymax=Math.min(s.ymax,n.ymax),s.xmin<s.xmax&&s.ymin<s.ymax){const{x:e,y:n}=t.pixelSize,r=Math.round(s.width/e),o=Math.round(s.height/n);t.extent=s,t.width=r,t.height=o}}function l(t,e,s,o=!0){const{spatialReference:i}=t,{x:a,y:u}=function(t,e){if(t.spatialReference.equals(e))return t;const s=(0,n.GA)(t.spatialReference),r=(0,n.GA)(e);if(s===r)return t;const o=s/r;return{x:t.x*o,y:t.y*o}}(s,i);let l,c,p;const h="extent"===e.type?e:e.extent;let{xmin:m,xmax:d,ymax:g,ymin:f}=h;const{xmin:y,ymax:x}=t.extent;return o?(m=y+(m>y?a*Math.round((m-y)/a):0),g=x-(g<x?u*Math.round((x-g)/u):0),d=y+(d>y?a*Math.round((d-y)/a):0),f=x-(f<x?u*Math.round((x-f)/u):0),l=new r.A({xmin:m,ymax:g,xmax:d,ymin:f,spatialReference:i}),c=Math.round(l.width/a),p=Math.round(l.height/u)):(c=Math.floor((d-m)/a+.8),p=Math.floor((g-f)/u+.8),m=y+(m>y?a*Math.floor((m-y)/a+.1):0),g=x-(g<x?u*Math.floor((x-g)/u+.1):0),d=m+c*a,f=g-p*u,l=new r.A({xmin:m,ymax:g,xmax:d,ymin:f,spatialReference:i})),{extent:l,width:c,height:p}}},99235(t,e,s){s.d(e,{vt:()=>Un,UD:()=>Vn});var n=s(85334),r=s(49186),o=s(4718),i=s(5482),a=s(91429),u=s(94778),l=s(25482);let c=class extends l.o{constructor(){super(...arguments),this.raster=void 0}};(0,i.Cg)([(0,a.MZ)({json:{write:!0}})],c.prototype,"raster",void 0),c=(0,i.Cg)([(0,a.$K)("esri.layers.raster.functions.BaseFunctionArguments")],c);const p=c;var h;let m=h=class extends p{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,i.Cg)([(0,a.MZ)({json:{write:!0}})],m.prototype,"operation",void 0),(0,i.Cg)([(0,a.MZ)({json:{write:!0}})],m.prototype,"raster2",void 0),(0,i.Cg)([(0,a.MZ)({readOnly:!0})],m.prototype,"rasters",null),m=h=(0,i.Cg)([(0,a.$K)("esri.layers.raster.functions.ArithmeticFunctionArguments")],m);const d=m;var g=s(14140),f=s(87186);const y=new Set(["slope","aspect","curvature","hillshade","shadedrelief","statistics"]);let x=class extends l.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(){const t=this.getWebGLProcessorDefinition();if(!t)return null;const e=[t],{parameters:s}=t;let n=s.rasters||s.raster&&[s.raster];for(;n?.length;){e.unshift(...n);const t=[];for(let e=0;e<n.length;e++){const{parameters:s}=n[e],r=s.rasters||s.raster&&[s.raster];r?.length&&t.push(...r)}n=t}for(let t=e.length-1;t>=0;t--)e[t].isNoopProcess&&e.splice(t,1);let r=!1;for(let t=0;t<e.length;t++){const s=e[t];s.id=e.length-t-1;const{rasters:n}=s.parameters;r=r||null!=n&&n.length>1}const o=e.some(({name:t})=>y.has(t.toLowerCase())),{rawSourceRasterInfos:i}=this;return{functions:e,hasBranches:r,hasFocalFunction:o,isSourceSingleBand:1===i?.[0]?.bandCount}}get neighborhoodSize(){let{rows:t,cols:e}=this._getNeighborhoodSize();const s=this.getImmediateChildFunctions();for(const n of s){const s=n.neighborhoodSize;t=Math.max(t,s.rows),e=Math.max(e,s.cols)}return{rows:t,cols:e}}bind(t,e=!1,s=-1){this.id=s+1;const n=this._getRasterValues();let r=!0;for(let s=0;s<n.length;s++){const o=n[s];if(null!=o&&this._isRasterFunctionValue(o)){const n=o.bind(t,e,this.id+s);if(!n.success)return this._bindingResult=n,n;r=r&&n.supportsGPU}}return!this.rasterInfo||e?(this.sourceRasterInfos=this._getSourceRasterInfos(t),this._bindingResult=this._bindSourceRasters(),r&&=this._bindingResult.supportsGPU,this._bindingResult.success&&(this._patchRasterInfo(),r&&this.isRoot)&&(this.processInputBandIds(),this.swizzleInputBandIds(this.rawInputBandIds)||(r=this.rawInputBandIds.length<=3)),this._bindingResult.supportsGPU=r,this._bindingResult):(this._bindingResult={success:!0,supportsGPU:!0},this._bindingResult)}queryRasterFunction(t){const e=[this];for(;e.length;){const s=e.pop();if(t(s))return s;const n=s.getImmediateChildFunctions();e.push(...n)}}getImmediateChildFunctions(){return this._getRasterValues().filter(t=>t&&"object"==typeof t&&"bind"in t)}process(t,e){const s=this._getRasterValues(),n=0===s.length?t.pixelBlocks??t.primaryPixelBlocks:s.map(s=>this._readRasterValue(s,t,e));return this._processPixels({...t,pixelBlocks:n},e)}processInputBandIds(){const t=this._getRasterValues().filter(this._isRasterFunctionValue);if(t.length>1){const e=t.map(t=>t.processInputBandIds());return this.rawInputBandIds=[...new Set(e.flat())],this.rawInputBandIds}const e=t[0];if(e)return this.rawInputBandIds=e.processInputBandIds(),this.rawInputBandIds;const{bandCount:s}=this.sourceRasterInfos[0],n=Array.from({length:s},(t,e)=>e);return this.rawInputBandIds=this._getInputBandIds(n),this.rawInputBandIds}swizzleInputBandIds(t){const e=this._getRasterValues().filter(this._isRasterFunctionValue);let s=!0;for(const n of e)s=n.swizzleInputBandIds(t)&&s;return!!s&&this._swizzleBandIds(t)}getPrimaryRasters(){const t=[],e=[];return this._getPrimaryRasters(this,t,e),{rasters:t,rasterIds:e}}getWebGLProcessorDefinition(){const t=this._getWebGLParameters(),{raster:e,rasters:s}=this.functionArguments;return s&&Array.isArray(s)&&s.length?(t.rasters=s.map(t=>this._isRasterFunctionValue(t)?t.getWebGLProcessorDefinition():"number"==typeof t?{name:"Constant",parameters:{value:t},pixelType:"f32",id:-1,isNoopProcess:!1}:{name:"Identity",parameters:{value:t},pixelType:"f32",id:-1,isNoopProcess:!1}),t.rasters.some(t=>null!=t)||(t.rasters=null)):this._isRasterFunctionValue(e)&&(t.raster=e.getWebGLProcessorDefinition()),{name:this.functionName,parameters:t,pixelType:this.outputPixelType,id:this.id,isNoopProcess:this.isNoopProcess}}getClippingGeometries(){const t=[];"Clip"===this.functionName&&t.push(this.functionArguments);const{raster:e,rasters:s}=this.functionArguments;if(s&&Array.isArray(s)&&s.length)s.forEach(e=>{if(this._isRasterFunctionValue(e)){const s=e.getClippingGeometries();t.push(...s)}});else if(this._isRasterFunctionValue(e)){const s=e.getClippingGeometries();t.push(...s)}return t}_getOutputPixelType(t){return"unknown"===this.outputPixelType?t:this.outputPixelType??t}_getWebGLParameters(){return{}}_getInputBandIds(t){return t}_swizzleBandIds(t){return!0}_isInputRasterPrimaryOrConstant(){return!this._getRasterValues().some(t=>t&&"object"==typeof t&&"rasterFunction"in t&&t.rasterFunction)}_getNeighborhoodSize(){return{rows:1,cols:1}}_removeStatsHistColormapVAT(t){t.statistics=null,t.histograms=null,t.colormap=null,t.attributeTable=null,t.multidimensionalInfo?.variables.forEach(t=>{t.statistics=void 0,t.histograms=void 0})}_getRasterValues(){const{rasterArgumentNames:t}=this;return"rasters"===t[0]?this.functionArguments.rasters??[]:t.flatMap(t=>this.functionArguments[t])}_getSourceRasterInfos(t){const e=this._getRasterValues(),{rasterInfos:s,rasterIds:n}=t;if(0===e.length)return s;const r=e.map(t=>t&&"object"==typeof t&&"bind"in t&&t.rasterInfo?t.rasterInfo:"string"==typeof t&&n.includes(t)?s[n.indexOf(t)]:"number"!=typeof t?s[0]:void 0),o=r.find(t=>t)??s[0];return r.forEach((t,e)=>{void 0===t&&(r[e]=o)}),r}_getPrimaryRasterId(t){return t?.rasterId}_getPrimaryRasters(t,e=[],s=[]){for(let n=0;n<t.sourceRasters.length;n++){const r=t.sourceRasters[n];if("number"!=typeof r)if("bind"in r)this._getPrimaryRasters(r,e,s);else{const t=r,n=this._getPrimaryRasterId(t);if(null==n)continue;s.includes(n)||(this.mainPrimaryRasterId===n?(e.unshift(t),s.unshift(n)):(e.push(t),s.push(n)))}}}_isRasterFunctionValue(t){return null!=t&&"object"==typeof t&&"getWebGLProcessorDefinition"in t}_readRasterValue(t,e,s){const{primaryPixelBlocks:n}=e;if(null==t||"$$"===t){const t=n[0];return null==t?null:t.clone()}if("string"==typeof t){const s=e.primaryRasterIds.indexOf(t);return-1===s?null:n[s]}if("number"==typeof t){const e=n[0];if(null==e)return null;const{width:s,height:r,pixelType:o}=e,i=new Float32Array(s*r);i.fill(t);const a=this.sourceRasterInfos[0].bandCount,u=new Array(a).fill(i);return new g.A({width:s,height:r,pixelType:o,pixels:u})}return t.process(e,s)}_patchRasterInfo(){const{rasterInfo:t}=this;if(!t?.keyProperties)return;const{bandCount:e,keyProperties:s,statistics:n,histograms:r}=t,o=s.BandProperties;o&&o.length!==e&&(t.keyProperties={...s,BandProperties:void 0}),n&&n.length!==e&&(t.statistics=n.length>e?n.slice(0,e):null),r&&r.length!==e&&(t.histograms=r.length>e?r.slice(0,e):null),s.BAND_COUNT&&Number(s.BAND_COUNT)!==e&&(t.keyProperties={...s,BAND_COUNT:"string"==typeof s.BAND_COUNT?String(e):e})}};(0,i.Cg)([(0,a.MZ)({json:{write:!0}})],x.prototype,"functionName",void 0),(0,i.Cg)([(0,a.MZ)({json:{write:!0}})],x.prototype,"functionArguments",void 0),(0,i.Cg)([(0,a.MZ)()],x.prototype,"rasterArgumentNames",void 0),(0,i.Cg)([(0,a.MZ)({json:{write:!0}}),(0,a.wg)(t=>t?.toLowerCase())],x.prototype,"outputPixelType",void 0),(0,i.Cg)([(0,a.MZ)({json:{write:!0}})],x.prototype,"mainPrimaryRasterId",void 0),(0,i.Cg)([(0,a.MZ)()],x.prototype,"sourceRasters",void 0),(0,i.Cg)([(0,a.MZ)({type:[f.A],json:{write:!0}})],x.prototype,"sourceRasterInfos",void 0),(0,i.Cg)([(0,a.MZ)({json:{write:!0}})],x.prototype,"rasterInfo",void 0),(0,i.Cg)([(0,a.MZ)({json:{write:!0}})],x.prototype,"readingBufferSize",void 0),(0,i.Cg)([(0,a.MZ)({json:{write:!0}})],x.prototype,"id",void 0),(0,i.Cg)([(0,a.MZ)()],x.prototype,"isNoopProcess",void 0),(0,i.Cg)([(0,a.MZ)()],x.prototype,"supportsGPU",null),(0,i.Cg)([(0,a.MZ)({json:{write:!0}})],x.prototype,"rawInputBandIds",void 0),(0,i.Cg)([(0,a.MZ)()],x.prototype,"rawSourceRasterInfos",void 0),(0,i.Cg)([(0,a.MZ)({json:{write:!0}})],x.prototype,"isInputBandIdsSwizzled",void 0),(0,i.Cg)([(0,a.MZ)({json:{write:!0}})],x.prototype,"swizzledBandSelection",void 0),(0,i.Cg)([(0,a.MZ)()],x.prototype,"isBranch",void 0),(0,i.Cg)([(0,a.MZ)()],x.prototype,"isRoot",void 0),(0,i.Cg)([(0,a.MZ)({readOnly:!0})],x.prototype,"flatWebGLFunctionChain",null),(0,i.Cg)([(0,a.MZ)({readOnly:!0})],x.prototype,"neighborhoodSize",null),(0,i.Cg)([(0,a.MZ)()],x.prototype,"_bindingResult",void 0),x=(0,i.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},C={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},b={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,...C,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,...b},T=new Map([[C.acos,{domain:[0,Math.PI],isInteger:!1}],[C.asin,{domain:[-Math.PI/2,Math.PI/2],isInteger:!1}],[C.atan,{domain:[-Math.PI/2,Math.PI/2],isInteger:!1}],[C.cos,{domain:[-1,1],isInteger:!1}],[C.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 P(t){return T.get(t)}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 I(t,e,s){const[n,r]=t,o=n.length,i=g.A.createEmptyBand(s,o);for(let t=0;t<o;t++)e&&!e[t]||(i[t]=n[t]+r[t]);return i}function R(t,e,s){const[n]=t,r=n.length,o=g.A.createEmptyBand("f32",r);return o.set(n),o}function F(t,e,s){const[n]=t,r=n.length,o=g.A.createEmptyBand(s,r);for(let t=0;t<r;t++)e&&!e[t]||(o[t]=n[t]*n[t]);return o}function k(t,e,s){const[n,r]=t,o=n.length,i=g.A.createEmptyBand(s,o);for(let t=0;t<o;t++)e&&!e[t]||(i[t]=n[t]-r[t]);return i}function _(t,e,s){const[n,r]=t,o=n.length,i=g.A.createEmptyBand(s,o);for(let t=0;t<o;t++)e&&!e[t]||(i[t]=n[t]*r[t]);return i}function S(t,e,s){const[n]=t,r=n.length,o=g.A.createEmptyBand(s,r);for(let t=0;t<r;t++)e&&!e[t]||(o[t]=Math.sign(n[t])*Math.floor(Math.abs(n[t])));return o}function B(t,e,s){const[n,r]=t,o=n.length,i=g.A.createEmptyBand(s,o);for(let t=0;t<o;t++)e&&!e[t]||(i[t]=n[t]/r[t]);return i}function j(t,e,s){return B(t,e,"f32")}function Z(t,e,s){const[n,r]=t,o=n.length,i=g.A.createEmptyBand(s,o);for(let t=0;t<o;t++)e&&!e[t]||(i[t]=Math.floor(n[t]/r[t]));return i}function z(t,e,s,n){const r=t[0],o=r.length,i=g.A.createEmptyBand(s,o);if(n===C.atanh){for(let t=0;t<o;t++)if(e[t]){const s=r[t];Math.abs(s)>=1?e[t]=0:i[t]=Math.atanh(s)}return i}const a=n===C.asin?Math.asin:Math.acos;for(let t=0;t<o;t++)if(e[t]){const s=r[t];Math.abs(s)>1?e[t]=0:i[t]=a(s)}return i}function G(t,e,s,n){const[r]=t,o=r.length,i=g.A.createEmptyBand(s,o);for(let t=0;t<o;t++)e&&!e[t]||(i[t]=n(r[t]));return i}function O(t,e,s,n){const[r,o]=t,i=r.length,a=g.A.createEmptyBand(s,i);for(let t=0;t<i;t++)e&&!e[t]||(a[t]=n(r[t],o[t]));return a}function D(t,e,s){const[n,r]=t,o=n.length,i=g.A.createEmptyBand(s,o);for(let t=0;t<o;t++)e&&!e[t]||(i[t]=n[t]&r[t]);return i}function E(t,e,s){const[n,r]=t,o=n.length,i=g.A.createEmptyBand(s,o);for(let t=0;t<o;t++)e&&!e[t]||(i[t]=n[t]<<r[t]);return i}function V(t,e,s){const[n]=t,r=n.length,o=g.A.createEmptyBand(s,r);for(let t=0;t<r;t++)e&&!e[t]||(o[t]=~n[t]);return o}function U(t,e,s){const[n,r]=t,o=n.length,i=g.A.createEmptyBand(s,o);for(let t=0;t<o;t++)e&&!e[t]||(i[t]=n[t]|r[t]);return i}function L(t,e,s){const[n,r]=t,o=n.length,i=g.A.createEmptyBand(s,o);for(let t=0;t<o;t++)e&&!e[t]||(i[t]=n[t]>>r[t]);return i}function $(t,e,s){const[n,r]=t,o=n.length,i=g.A.createEmptyBand(s,o);for(let t=0;t<o;t++)e&&!e[t]||(i[t]=n[t]^r[t]);return i}function K(t,e,s){const[n,r]=t,o=n.length,i=g.A.createEmptyBand(s,o);for(let t=0;t<o;t++)e&&!e[t]||(i[t]=n[t]&&r[t]?1:0);return i}function W(t,e,s){const[n]=t,r=n.length,o=g.A.createEmptyBand(s,r);for(let t=0;t<r;t++)e&&!e[t]||(o[t]=n[t]?0:1);return o}function H(t,e,s){const[n,r]=t,o=n.length,i=g.A.createEmptyBand(s,o);for(let t=0;t<o;t++)e&&!e[t]||(i[t]=n[t]||r[t]?1:0);return i}function q(t,e,s){const[n,r]=t,o=n.length,i=g.A.createEmptyBand(s,o);for(let t=0;t<o;t++)e&&!e[t]||(i[t]=(n[t]?1:0)^(r[t]?1:0));return i}function J(t,e,s){const[n,r]=t,o=n.length,i=g.A.createEmptyBand(s,o);for(let t=0;t<o;t++)e&&!e[t]||(i[t]=n[t]===r[t]?1:0);return i}function X(t,e,s,n){const[r]=t,o=r.length,i=g.A.createEmptyBand(s,o),a=n===Math.E;for(let t=0;t<o;t++)e&&!e[t]||(i[t]=a?Math.exp(r[t]):n**r[t]);return i}function Q(t,e,s){return X(t,e,s,10)}function Y(t,e,s){return X(t,e,s,2)}function tt(t,e,s){return X(t,e,s,Math.E)}function et(t,e,s,n){const[r]=t,o=r.length,i=g.A.createEmptyBand(s,o);for(let t=0;t<o;t++)e&&!e[t]||(r[t]<=0?e[t]=0:i[t]=n(r[t]));return i}function st(t,e,s){return et(t,e,s,Math.log10)}function nt(t,e,s){return et(t,e,s,Math.log2)}function rt(t,e,s){return et(t,e,s,Math.log)}function ot(t,e,s){const[n,r]=t,o=n.length,i=g.A.createEmptyBand(s,o);for(let t=0;t<o;t++)e&&!e[t]||(i[t]=n[t]>r[t]?1:0);return i}function it(t,e,s){const[n,r]=t,o=n.length,i=g.A.createEmptyBand(s,o);for(let t=0;t<o;t++)e&&!e[t]||(i[t]=n[t]>=r[t]?1:0);return i}function at(t,e,s){const[n,r]=t,o=n.length,i=g.A.createEmptyBand(s,o);for(let t=0;t<o;t++)e&&!e[t]||(i[t]=n[t]<r[t]?1:0);return i}function ut(t,e,s){const[n,r]=t,o=n.length,i=g.A.createEmptyBand(s,o);for(let t=0;t<o;t++)e&&!e[t]||(i[t]=n[t]<=r[t]?1:0);return i}function lt(t,e,s){const[n]=t,r=n.length,o=g.A.createEmptyBand(s,r);if(!e)return o;for(let t=0;t<r;t++)o[t]=e[t]?0:1;return o}function ct(t,e,s){const[n,r]=t,o=n.length,i=g.A.createEmptyBand(s,o);for(let t=0;t<o;t++)e&&!e[t]||(i[t]=n[t]%r[t]);return i}function pt(t,e,s){const[n]=t,r=n.length,o=g.A.createEmptyBand(s,r);for(let t=0;t<r;t++)e&&!e[t]||(o[t]=-n[t]);return o}function ht(t,e,s){const[n,r]=t,o=n.length,i=g.A.createEmptyBand(s,o);for(let t=0;t<o;t++)e&&!e[t]||(i[t]=n[t]===r[t]?0:1);return i}function mt(t,e,s){const[n,r]=t,o=n.length,i=g.A.createEmptyBand(s,o),a=new Uint8Array(o);for(let t=0;t<o;t++)null!=e&&!e[t]||0!==n[t]||(i[t]=r[t],a[t]=255);return{band:i,mask:a}}function dt(t,e,s){const[n,r,o]=t,i=n.length,a=g.A.createEmptyBand(s,i);for(let t=0;t<i;t++)e&&!e[t]||(a[t]=n[t]?r[t]:o[t]);return a}function gt(t,e,s){const n=t.length;if(n<2)return t[0];const[r]=t,o=r.length,i=g.A.createEmptyBand(s,o);for(let s=0;s<o;s++)if(!e||e[s]){let e=r[s];for(let r=1;r<n;r++){const n=t[r][s];e<n&&(e=n)}i[s]=e}return i}function ft(t,e,s){const n=t.length;if(n<2)return t[0];const[r]=t,o=r.length,i=g.A.createEmptyBand(s,o);for(let s=0;s<o;s++)if(!e||e[s]){let e=r[s];for(let r=1;r<n;r++){const n=t[r][s];e>n&&(e=n)}i[s]=e}return i}function yt(t,e,s){const n=t.length;if(n<2)return t[0];const[r]=t,o=r.length,i=g.A.createEmptyBand(s,o);for(let s=0;s<o;s++)if(!e||e[s]){let e=r[s],o=e;for(let r=1;r<n;r++){const n=t[r][s];o<n?o=n:e>n&&(e=n)}i[s]=o-e}return i}function xt(t,e,s){const n=t.length;if(n<2)return t[0];const[r]=t,o=r.length,i=g.A.createEmptyBand(s,o);for(let s=0;s<o;s++)if(!e||e[s]){let e=0;for(let r=0;r<n;r++)e+=t[r][s];i[s]=e/n}return i}function wt(t,e,s){const n=t.length;if(n<2)return t[0];const[r]=t,o=r.length,i=g.A.createEmptyBand(s,o);for(let s=0;s<o;s++)if(!e||e[s])for(let e=0;e<n;e++){const n=t[e];i[s]+=n[s]}return i}function At(t,e,s){const n=t.length;if(n<2)return t[0];const[r]=t,o=r.length,i=g.A.createEmptyBand(s,o);for(let s=0;s<o;s++)if(!e||e[s]){const e=new Float32Array(n);let r=0;for(let o=0;o<n;o++){const n=t[o];r+=n[s],e[o]=n[s]}r/=n;let o=0;for(let t=0;t<n;t++)o+=(e[t]-r)**2;i[s]=Math.sqrt(o/n)}return i}function vt(t,e,s){const n=t.length;if(n<2)return t[0];const r=Math.floor(n/2),[o]=t,i=o.length,a=g.A.createEmptyBand(s,i),u=new Float32Array(n),l=n%2==1;for(let s=0;s<i;s++)if(!e||e[s]){for(let e=0;e<n;e++)u[e]=t[e][s];u.sort(),a[s]=l?u[r]:(u[r]+u[r-1])/2}return a}function Ct(t,e,s){const[n,r]=t;if(null==r)return n;const o=n.length,i=g.A.createEmptyBand(s,o);for(let t=0;t<o;t++)e&&!e[t]||(i[t]=n[t]<r[t]?n[t]:r[t]);return i}function bt(t,e,s){const n=t.length;if(n<=2)return Ct(t,e,s);const r=t[0].length,o=g.A.createEmptyBand(s,r),i=new Map;for(let s=0;s<r;s++)if(!e||e[s]){i.clear();for(let e=0;e<n;e++){const n=t[e][s];i.set(n,i.has(n)?i.get(n)+1:1)}let e=0,r=0;const a=[];for(const t of i.keys())e=i.get(t),e>r?(r=e,a.length=0,a.push(t)):e===r&&a.push(t);a.length>1&&a.sort((t,e)=>t-e),o[s]=a[0]}return o}function Mt(t,e,s){const n=t.length;if(n<=2)return Ct(t,e,s);const r=t[0].length,o=g.A.createEmptyBand(s,r),i=new Map;for(let s=0;s<r;s++)if(!e||e[s]){i.clear();for(let e=0;e<n;e++){const n=t[e][s];i.set(n,i.has(n)?i.get(n)+1:1)}let e=0,r=t.length;const a=[];for(const t of i.keys())e=i.get(t),e<r?(r=e,a.length=0,a.push(t)):e===r&&a.push(t);a.length>1&&a.sort((t,e)=>t-e),o[s]=a[0]}return o}function Tt(t,e,s){const n=t.length;if(n<2)return t[0];const[r]=t,o=r.length,i=g.A.createEmptyBand(s,o),a=new Set;for(let s=0;s<o;s++)if(!e||e[s]){let e;a.clear();for(let r=0;r<n;r++)e=t[r][s],a.add(e);i[s]=a.size}return i}const Pt=new Map,Nt=new Map,It=new Map,Rt=new Map;function Ft(){Pt.size||(Pt.set(4,Math.sqrt),Pt.set(6,Math.acos),Pt.set(7,Math.asin),Pt.set(8,Math.atan),Pt.set(9,Math.atanh),Pt.set(10,Math.abs),Pt.set(21,Math.cos),Pt.set(22,Math.cosh),Pt.set(48,Math.floor),Pt.set(49,Math.ceil),Pt.set(51,Math.sin),Pt.set(52,Math.sinh),Pt.set(56,Math.tan),Pt.set(57,Math.tanh),Pt.set(59,Math.acosh),Pt.set(60,Math.asinh),Pt.set(65,Math.floor),Nt.set(5,Math.pow),Nt.set(61,Math.atan2),It.set(1,I),It.set(2,k),It.set(3,_),It.set(11,D),It.set(12,E),It.set(13,V),It.set(14,U),It.set(15,L),It.set(16,$),It.set(17,K),It.set(18,W),It.set(19,H),It.set(20,q),It.set(23,B),It.set(24,J),It.set(25,tt),It.set(26,Q),It.set(27,Y),It.set(28,ot),It.set(29,it),It.set(30,S),It.set(31,lt),It.set(32,R),It.set(33,at),It.set(34,ut),It.set(35,rt),It.set(36,st),It.set(37,nt),It.set(44,ct),It.set(45,pt),It.set(46,ht),It.set(53,F),It.set(64,j),It.set(65,Z),It.set(76,dt),It.set(78,dt),Rt.set(38,bt),Rt.set(39,gt),Rt.set(40,xt),Rt.set(41,vt),Rt.set(42,ft),Rt.set(43,Mt),Rt.set(47,yt),Rt.set(54,At),Rt.set(55,wt),Rt.set(58,Tt),Rt.set(66,bt),Rt.set(67,gt),Rt.set(68,xt),Rt.set(69,vt),Rt.set(70,ft),Rt.set(71,Mt),Rt.set(72,yt),Rt.set(73,At),Rt.set(74,wt),Rt.set(75,Tt))}function kt(t,e,s={}){Ft();let n=function(t,e=!1){const s=t.map(t=>t.mask),n=s.filter(t=>null!=t),r=t[0].pixels[0].length;if(0===n.length||e&&n.length!==s.length)return new Uint8Array(r).fill(255);const o=n[0],i=new Uint8Array(o);if(1===n.length)return i;if(!e){for(let t=1;t<n.length;t++){const e=n[t];for(let t=0;t<i.length;t++)i[t]&&(i[t]=e[t]?255:0)}return i}for(let t=1;t<n.length;t++){const e=n[t];for(let t=0;t<i.length;t++)0===i[t]&&(i[t]=e[t]?255:0)}return i}(t,e>=66&&e<=75);const{outputPixelType:r="f32"}=s,o=!Rt.has(e)||s.processAsMultiband,i=o?t[0].pixels.length:1,a=[];for(let s=0;s<i;s++){const i=Rt.has(e)&&!o?t.flatMap(t=>t.pixels):t.map(t=>t.pixels[s]);let l,c=!0;if(e===b.setNull){const t=mt(i,n,r);l=t.band,n=t.mask,c=!1}else It.has(e)?l=It.get(e)(i,n,"f64"):Pt.has(e)?l=e===C.asin||e===C.acos||e===C.atanh?z(i,n,"f64",e):G(i,n,"f64",Pt.get(e)):Nt.has(e)?l=O(i,n,"f64",Nt.get(e)):Rt.has(e)?l=Rt.get(e)(i,n,"f64"):(l=i[0],c=!1);if(c&&e!==v.isNull&&!T.has(e)){const t=g.A.createEmptyBand(r,l.length);n||(n=new Uint8Array(l.length).fill(255)),(0,u.$p)(l,n),(0,u.yM)(l,n,r,t),l=t}a.push(l)}const l=t[0];return new g.A({width:l.width,height:l.height,pixelType:r,mask:e===v.isNull?null:n,pixels:a})}let _t=class extends w{constructor(){super(...arguments),this.functionName="Arithmetic",this.functionArguments=null,this.rasterArgumentNames=["raster","raster2"]}_bindSourceRasters(){const{operation:t}=this.functionArguments;if(t<1||t>6)return{success:!1,supportsGPU:!1,error:"unsupported operation"};const 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:e.bandCount<=3}}_processPixels(t){const{pixelBlocks:e}=t;return null==e?.[0]||null==e?.[1]?null:function(t,e,s){return kt(t,e=[null,1,2,3,23,5,44][e]??1,{outputPixelType:s})}(e,this.functionArguments.operation,this.outputPixelType)}_getWebGLParameters(){const{operation:t}=this.functionArguments,e=["","plus","minus","times","divide","power","mod"][t],s=this.outputPixelType??"f32";let[n,r]=(0,u.hP)(s);const o=(0,u.zw)(s);return o&&(n-=1e-4,r+=1e-4),{imageCount:2,operationName:e,domainRange:[n,r],isOutputRounded:o}}};(0,i.Cg)([(0,a.MZ)({json:{write:!0,name:"rasterFunction"}})],_t.prototype,"functionName",void 0),(0,i.Cg)([(0,a.MZ)({type:d,json:{write:!0,name:"rasterFunctionArguments"}})],_t.prototype,"functionArguments",void 0),(0,i.Cg)([(0,a.MZ)()],_t.prototype,"rasterArgumentNames",void 0),_t=(0,i.Cg)([(0,a.$K)("esri.layers.raster.functions.ArithmeticFunction")],_t);const St=_t;var Bt;let jt=Bt=class extends p{clone(){return new Bt({raster:this.raster})}};jt=Bt=(0,i.Cg)([(0,a.$K)("esri.layers.raster.functions.AspectFunctionArguments")],jt);const Zt=jt;var zt=s(51181);let Gt=class extends w{constructor(){super(...arguments),this.functionName="Aspect",this.functionArguments=null,this.rasterArgumentNames=["raster"],this.isGCS=!1}_bindSourceRasters(){const t=this.sourceRasterInfos[0];this.isGCS=t.spatialReference?.isGeographic??!1,this.outputPixelType=this._getOutputPixelType("f32");const e=t.clone();return e.pixelType=this.outputPixelType,this._removeStatsHistColormapVAT(e),e.statistics=[{min:-1,max:360,avg:180,stddev:30}],e.bandCount=1,this.rasterInfo=e,{success:!0,supportsGPU:!0}}_processPixels(t){const e=t.pixelBlocks?.[0];if(null==e)return null;const{extent:s,primaryPixelSizes:n}=t,r=n?.[0],o=r??(s?{x:s.width/e.width,y:s.height/e.height}:{x:1,y:1});return(0,zt.di)(e,{resolution:o})}_getNeighborhoodSize(){return{rows:3,cols:3}}};(0,i.Cg)([(0,a.MZ)({json:{write:!0,name:"rasterFunction"}})],Gt.prototype,"functionName",void 0),(0,i.Cg)([(0,a.MZ)({type:Zt,json:{write:!0,name:"rasterFunctionArguments"}})],Gt.prototype,"functionArguments",void 0),(0,i.Cg)([(0,a.MZ)()],Gt.prototype,"rasterArgumentNames",void 0),(0,i.Cg)([(0,a.MZ)({json:{write:!0}})],Gt.prototype,"isGCS",void 0),Gt=(0,i.Cg)([(0,a.$K)("esri.layers.raster.functions.AspectFunction")],Gt);const Ot=Gt;var Dt=s(66552);const Et=new Set(["+","-","*","/","(",")"]);function Vt(t,e){return t.toLowerCase().startsWith("b")?e[parseInt(t.slice(1),10)-1]:parseFloat(t)}function Ut(t,e,s,n){if("number"==typeof s&&"number"==typeof n)return s+n;let r,o,i;"number"==typeof s?(i=n,r=i.length,o=new Float32Array(r),o.fill(s)):(r=s.length,o=s,n.constructor===Number?(i=new Float32Array(r),i.fill(n)):i=n);const a=new Float32Array(r);switch(e){case"+":for(let e=0;e<r;e++)(null==t||t[e])&&(a[e]=o[e]+i[e]);break;case"-":for(let e=0;e<r;e++)(null==t||t[e])&&(a[e]=o[e]-i[e]);break;case"*":for(let e=0;e<r;e++)(null==t||t[e])&&(a[e]=o[e]*i[e]);break;case"/":for(let e=0;e<r;e++)(null==t||t[e])&&i[e]&&(a[e]=o[e]/i[e]);break;case"(":case")":throw new Error("encountered error with custom band index equation")}return a}function Lt(t,e){t.splice(e,1);let s=0,n=0;do{s=0,n=0;for(let e=0;e<t.length;e++)if("("===t[e])s=e;else if(")"===t[e]){n=e;break}n===s+1&&t.splice(s,2)}while(n===s+1);return t}function $t(t){if(1===t.length)return{opIndex:0,numIndex:0};let e=0,s=0;for(let n=0;n<t.length;n++)if("("===t[n])e=n;else if(")"===t[n]){s=n;break}const n=0===s?t:t.slice(e+1,s);let r=-1;for(let t=0;t<n.length;t++)if("*"===n[t]||"/"===n[t]){r=t;break}if(r>-1)s>0&&(r+=e+1);else{for(let t=0;t<n.length;t++)if("+"===n[t]||"-"===n[t]){r=t;break}s>0&&(r+=e+1)}let o=0;for(let e=0;e<r;e++)"("===t[e]&&o++;return{opIndex:r,numIndex:r-o}}var Kt=s(47520);const Wt=new Dt.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 Ht(t,e){if(!(0,Kt.AB)(t))return t;const{equation:s,method:n}=e,r=e.bandIndexes.map(t=>t-1),{pixels:o,mask:i}=t;let a;switch(n){case"gndvi":case"nbr":case"ndbi":case"ndvi":case"ndvi-re":case"ndsi":case"ndmi":case"mndwi":a=Jt(i,o[r[0]],o[r[1]]);break;case"ndwi":a=Jt(i,o[r[1]],o[r[0]]);break;case"sr":case"sr-re":case"iron-oxide":case"ferrous-minerals":case"clay-minerals":a=function(t,e,s){const n=s.length,r=new Float32Array(n);for(let o=0;o<n;o++)if(null==t||t[o]){const t=e[o],n=s[o];n&&(r[o]=t/n)}return[r]}(i,o[r[0]],o[r[1]]);break;case"ci-g":case"ci-re":a=function(t,e,s){const n=e.length,r=new Float32Array(n);for(let o=0;o<n;o++)if(null==t||t[o]){const t=e[o],n=s[o];n&&(r[o]=t/n-1)}return[r]}(i,o[r[0]],o[r[1]]);break;case"savi":a=function(t,e,s,n){const r=s.length,o=new Float32Array(r);for(let i=0;i<r;i++)if(null==t||t[i]){const t=s[i],r=e[i],a=r+t+n;a&&(o[i]=(r-t)/a*(1+n))}return[o]}(i,o[r[0]],o[r[1]],r[2]+1);break;case"tsavi":a=function(t,e,s,n,r,o){const i=s.length,a=new Float32Array(i),u=-r*n+o*(1+n*n);for(let o=0;o<i;o++)if(null==t||t[o]){const t=s[o],i=e[o],l=r*i+t+u;l&&(a[o]=n*(i-n*t-r)/l)}return[a]}(i,o[r[0]],o[r[1]],r[2]+1,r[3]+1,r[4]+1);break;case"msavi":a=function(t,e,s){const n=s.length,r=new Float32Array(n);for(let o=0;o<n;o++)if(null==t||t[o]){const t=s[o],n=e[o],i=2*n+1;r[o]=.5*(i-Math.sqrt(i*i-8*(n-t)))}return[r]}(i,o[r[0]],o[r[1]]);break;case"gemi":a=function(t,e,s){const n=s.length,r=new Float32Array(n);for(let o=0;o<n;o++)if(null==t||t[o]){const t=s[o],n=e[o];if(1!==t&&n+t+.5!==0){const e=(2*(n*n-t*t)+1.5*n+.5*t)/(n+t+.5);r[o]=e*(1-.25*e)-(t-.125)/(1-t)}}return[r]}(i,o[r[0]],o[r[1]]);break;case"pvi":a=function(t,e,s,n,r){const o=s.length,i=new Float32Array(o),a=1/Math.sqrt(1+n*n);for(let u=0;u<o;u++)if(null==t||t[u]){const t=s[u],o=e[u];i[u]=(o-n*t-r)*a}return[i]}(i,o[r[0]],o[r[1]],r[2]+1,r[3]+1);break;case"gvitm":a=function(t,e){const[s,n,r,o,i,a]=e,u=s.length,l=new Float32Array(u);for(let e=0;e<u;e++)(null==t||t[e])&&(l[e]=-.2848*s[e]-.2435*n[e]-.5436*r[e]+.7243*o[e]+.084*i[e]-.18*a[e]);return[l]}(i,[o[r[0]],o[r[1]],o[r[2]],o[r[3]],o[r[4]],o[r[5]]]);break;case"sultan":a=function(t,e){const[s,n,r,o,i]=e,a=s.length,u=new Float32Array(a),l=new Float32Array(a),c=new Float32Array(a);for(let e=0;e<a;e++)(null==t||t[e])&&(u[e]=i[e]?o[e]/i[e]*100:0,l[e]=s[e]?o[e]/s[e]*100:0,c[e]=r[e]?n[e]/r[e]*(o[e]/r[e])*100:0);return[u,l,c]}(i,[o[r[0]],o[r[1]],o[r[2]],o[r[3]],o[r[4]]]);break;case"vari":a=function(t,e){const[s,n,r]=e,o=s.length,i=new Float32Array(o);for(let e=0;e<o;e++)if(null==t||t[e])for(e=0;e<o;e++){const t=s[e],o=n[e],a=o+t-r[e];a&&(i[e]=(o-t)/a)}return[i]}(i,[o[r[0]],o[r[1]],o[r[2]]]);break;case"mtvi2":a=function(t,e){const[s,n,r]=e,o=s.length,i=new Float32Array(o);for(let e=0;e<o;e++)if(null==t||t[e])for(e=0;e<o;e++){const t=s[e],o=n[e],a=r[e],u=Math.sqrt((2*t+1)**2-(6*t-5*Math.sqrt(o))-.5);if(u){const s=1.5*(1.2*(t-a)-2.5*(o-a));i[e]=s/u}}return[i]}(i,[o[r[0]],o[r[1]],o[r[2]]]);break;case"rtvi-core":a=function(t,e){const[s,n,r]=e,o=s.length,i=new Float32Array(o);for(let e=0;e<o;e++)if(null==t||t[e])for(e=0;e<o;e++){const t=s[e],o=n[e],a=r[e];i[e]=100*(t-o)-10*(t-a)}return[i]}(i,[o[r[0]],o[r[1]],o[r[2]]]);break;case"evi":a=function(t,e){const[s,n,r]=e,o=s.length,i=new Float32Array(o);for(let e=0;e<o;e++)if(null==t||t[e])for(e=0;e<o;e++){const t=s[e],o=n[e],a=t+6*o-7.5*r[e]+1;a&&(i[e]=2.5*(t-o)/a)}return[i]}(i,[o[r[0]],o[r[1]],o[r[2]]]);break;case"wndwi":a=function(t,e,s=.5){const[n,r,o]=e,i=r.length,a=new Float32Array(i);for(let e=0;e<i;e++)if(null==t||t[e])for(e=0;e<i;e++){const t=n[e],i=r[e],u=o[e],l=t+s*i+(1-s)*u;l&&(a[e]=(t-s*i-(1-s)*u)/l)}return[a]}(i,[o[r[0]],o[r[1]],o[r[2]]],r[3]?r[3]+1:.5);break;case"bai":a=function(t,e,s){const n=s.length,r=new Float32Array(n);for(let o=0;o<n;o++)if(null==t||t[o])for(o=0;o<n;o++){const t=(.1-e[o])**2+(.06-s[o])**2;t&&(r[o]=1/t)}return[r]}(i,o[r[0]],o[r[1]]);break;case"custom":a=function(t,e,s){let n,{ops:r,nums:o}=function(t,e){(t=t.replaceAll(" ","")).startsWith("-")&&(t="0"+t),t.startsWith("+")&&(t=t.slice(1));const s=t.split(""),n=[],r=[];let o="";for(let t=0;t<s.length;t++){const i=s[t];Et.has(i)?(o.length&&r.push(Vt(o,e)),n.push(i),o=""):o=o.concat(i)}return o.length&&r.push(Vt(o,e)),{ops:n,nums:r}}(s,e);if(0===r.length){const t=1===o.length?o[0]:e[0];if(t instanceof Float32Array)return[t];const s=new Float32Array(e[0].length);return"number"==typeof t?s.fill(t):s.set(t),[s]}for(;r.length>0;){const{numIndex:e,opIndex:s}=$t(r);if(n=Ut(t,r[s],o[e],o[e+1]),1===r.length)break;r=Lt(r,s),o.splice(e,2,n)}return[n]}(i,o,s);break;default:return t}const{outputPixelType:l="f32"}=e,c=null!=l&&(0,u.zw)(l);let p;i?(p=new Uint8Array(t.width*t.height),p.set(i)):c&&(p=new Uint8Array(t.width*t.height).fill(255)),c&&(a=a.map(t=>{const e=g.A.createEmptyBand(l,t.length);return(0,u.yM)(t,p,l,e),e}));const h=new g.A({width:t.width,height:t.height,pixelType:l,pixels:a,mask:p});return h.updateStatistics(),h}function qt(t){const e=new Float32Array(9);return e[3*t[0]]=1,e[3*t[1]+1]=1,e[3*t[2]+2]=1,e}function Jt(t,e,s){const n=s.length,r=new Float32Array(n);for(let o=0;o<n;o++)if(null==t||t[o]){const t=e[o],n=s[o],i=t+n;i&&(r[o]=(t-n)/i)}return[r]}var Xt,Qt=s(93223);let Yt=Xt=class extends p{constructor(){super(...arguments),this.method="custom"}clone(){return new Xt({method:this.method,bandIndexes:this.bandIndexes,raster:(0,o.o8)(this.raster)})}};(0,i.Cg)([(0,a.MZ)({json:{type:String,write:!0}})],Yt.prototype,"bandIndexes",void 0),(0,i.Cg)([(0,Qt.e)(Wt)],Yt.prototype,"method",void 0),Yt=Xt=(0,i.Cg)([(0,a.$K)("esri.layers.raster.functions.BandArithmeticFunctionArguments")],Yt);const te=Yt,ee=new Set(["vari","mtvi2","rtvi-core","evi"]);let se=class extends w{constructor(){super(...arguments),this.functionName="BandArithmetic",this.functionArguments=null,this.rasterArgumentNames=["raster"]}_bindSourceRasters(){this.outputPixelType=this._getOutputPixelType("f32");const t=this.sourceRasterInfos[0];if(t.bandCount<2)return{success:!1,supportsGPU:!1,error:"band-arithmetic-function: source raster has insufficient amount of raster bands"};const e=t.clone();return e.pixelType=this.outputPixelType,e.bandCount="sultan"===this.functionArguments.method?3:1,this._removeStatsHistColormapVAT(e),e.keyProperties={...e.keyProperties,BandProperties:void 0},this.rasterInfo=e,{success:!0,supportsGPU:!["custom","gvitm","sultan"].includes(this.functionArguments.method)}}_processPixels(t){const e=t.pixelBlocks?.[0];if(null==e)return e;const{method:s,bandIndexes:n}=this.functionArguments,r=n.split(" ").map(t=>parseFloat(t));if(this.rasterInfo.storageInfo.isBsqTile){const{rawInputBandIds:t}=this,e=ee.has(this.functionArguments.method)?3:2,s=r.slice(0,e).map(e=>t.indexOf(e-1));r.splice(0,e,...s)}return Ht(e,{method:s,bandIndexes:r,equation:n,outputPixelType:this.outputPixelType})}_getWebGLParameters(){const t=this.functionArguments.bandIndexes.split(" ").map(t=>parseFloat(t)-1);2===t.length&&t.push(0);const e=this.isInputBandIdsSwizzled?[0,1,2]:t;let s,n;const r=new Float32Array(3),{method:o}=this.functionArguments;switch(o){case"gndvi":case"nbr":case"ndbi":case"ndvi":case"ndvi-re":case"ndsi":case"ndmi":case"mndwi":s=qt([e[0],e[1],0]),n="ndxi";break;case"ndwi":s=qt([e[1],e[0],0]),n="ndxi";break;case"sr":case"sr-re":case"iron-oxide":case"ferrous-minerals":case"clay-minerals":s=qt([e[0],e[1],0]),n="sr";break;case"ci-g":case"ci-re":s=qt([e[0],e[1],0]),n="ci";break;case"savi":s=qt([e[0],e[1],0]),n="savi",r[0]=t[2]+1;break;case"tsavi":s=qt([e[0],e[1],0]),n="tsavi",r[0]=t[2]+1,r[1]=t[3]+1,r[2]=t[4]+1;break;case"msavi":s=qt([e[0],e[1],0]),n="msavi";break;case"gemi":s=qt([e[0],e[1],0]),n="gemi";break;case"pvi":s=qt([e[0],e[1],0]),n="tsavi",r[0]=t[2]+1,r[1]=t[3]+1;break;case"vari":s=qt([e[0],e[1],e[2]]),n="vari";break;case"mtvi2":s=qt([e[0],e[1],e[2]]),n="mtvi";break;case"rtvi-core":s=qt([e[0],e[1],e[2]]),n="rtvicore";break;case"evi":s=qt([e[0],e[1],e[2]]),n="evi";break;case"wndwi":s=qt([e[0],e[1],0]),n="wndwi",r[0]=t[3]?t[3]+1:.5;break;case"bai":s=qt([e[1],e[0],0]),n="bai";break;default:s=qt([0,1,2]),n="custom"}return{bandIndexMat3:s,indexType:n,adjustments:r,isOutputRounded:(0,u.zw)(this.outputPixelType)}}_getInputBandIds(t){if("custom"===this.functionArguments.method)return t;const e=this.functionArguments.bandIndexes.split(" ").map(t=>parseFloat(t)-1),s=t.length,n=e.map(t=>t>=s?s-1:t),r=ee.has(this.functionArguments.method)?3:2,o=n.slice(0,r).map(e=>t[e]);return 2===o.length&&o.push(0),o}_swizzleBandIds(t){const e=this.functionArguments.bandIndexes.split(" ").map(t=>parseFloat(t)-1);2===e.length&&e.push(0);const{method:s}=this.functionArguments,n=(["vari","mtvi2","rtvi-core","evi"].includes(s)?e.slice(0,3):"bai"===s||"ndwi"===s?[e[1],e[0]]:e.slice(0,2)).map(e=>t.indexOf(e));return n[2]??=n[1],this.isInputBandIdsSwizzled=!0,this.swizzledBandSelection=n,!1}};(0,i.Cg)([(0,a.MZ)({json:{write:!0,name:"rasterFunction"}})],se.prototype,"functionName",void 0),(0,i.Cg)([(0,a.MZ)({type:te,json:{write:!0,name:"rasterFunctionArguments"}})],se.prototype,"functionArguments",void 0),(0,i.Cg)([(0,a.MZ)()],se.prototype,"rasterArgumentNames",void 0),se=(0,i.Cg)([(0,a.$K)("esri.layers.raster.functions.BandArithmeticFunction")],se);const ne=se;var re,oe=s(65864),ie=s(50498);const ae=new Dt.J({1:"outside",2:"inside"},{useNumericKeys:!0});let ue=re=class extends p{constructor(){super(...arguments),this.clippingType="outside"}clone(){return new re({clippingGeometry:this.clippingGeometry.clone(),clippingType:this.clippingType})}};(0,i.Cg)([(0,a.MZ)({types:ie.yR,json:{read:oe.rS,write:!0}})],ue.prototype,"clippingGeometry",void 0),(0,i.Cg)([(0,a.MZ)({json:{read:ae.read,write:ae.write}})],ue.prototype,"clippingType",void 0),ue=re=(0,i.Cg)([(0,a.$K)("esri.layers.raster.functions.ClipFunctionArguments")],ue);const le=ue;var ce=s(34930),pe=s(37373);let he=class extends w{constructor(){super(...arguments),this.functionName="Clip",this.functionArguments=null,this.rasterArgumentNames=["raster"],this.isNoopProcess=!0}_bindSourceRasters(){const t=this.sourceRasterInfos[0].clone();this.outputPixelType=this._getOutputPixelType(t.pixelType),t.pixelType=this.outputPixelType,this.rasterInfo=t;const{functionArguments:e}=this,{clippingGeometry:s,clippingType:n}=e;if(!s)return{success:!1,supportsGPU:!1,error:"missing clipping geometry"};if("outside"===n)try{const{spatialReference:e}=t,n="extent"===s.type?(0,pe._l)(s,e):(0,pe.uk)(s,e).extent;n&&(0,ce.Sd)(t,n)}catch{}return{success:!0,supportsGPU:!0}}_processPixels(t){return t.pixelBlocks?.[0]}_getWebGLParameters(){const{clippingGeometry:t,clippingType:e}=this.functionArguments;return{clippingGeometry:t.toJSON(),clippingType:e}}};(0,i.Cg)([(0,a.MZ)({json:{write:!0,name:"rasterFunction"}})],he.prototype,"functionName",void 0),(0,i.Cg)([(0,a.MZ)({type:le,json:{write:!0,name:"rasterFunctionArguments"}})],he.prototype,"functionArguments",void 0),(0,i.Cg)([(0,a.MZ)()],he.prototype,"rasterArgumentNames",void 0),(0,i.Cg)([(0,a.MZ)()],he.prototype,"isNoopProcess",void 0),he=(0,i.Cg)([(0,a.$K)("esri.layers.raster.functions.ClipFunction")],he);const me=he;var de,ge=s(67369),fe=s(95349),ye=s(36005);let xe=de=class extends p{castColormapName(t){if(!t)return null;const e=t.toLowerCase();return ge.L7.includes(e)?e:null}readColorRamp(t){return(0,fe.r)(t)}readColorRampName(t,e){if(!t)return null;const s=ge.kH.jsonValues.find(e=>e.toLowerCase()===t.toLowerCase());return s?ge.kH.fromJSON(s):null}clone(){return new de({colormap:(0,o.o8)(this.colormap),colormapName:this.colormapName,colorRamp:this.colorRamp?.clone(),colorRampName:this.colorRampName})}};(0,i.Cg)([(0,a.MZ)({type:[[Number]],json:{write:!0}})],xe.prototype,"colormap",void 0),(0,i.Cg)([(0,a.MZ)({type:String,json:{write:!0}})],xe.prototype,"colormapName",void 0),(0,i.Cg)([(0,a.wg)("colormapName")],xe.prototype,"castColormapName",null),(0,i.Cg)([(0,a.MZ)({types:fe.g,json:{write:!0}})],xe.prototype,"colorRamp",void 0),(0,i.Cg)([(0,ye.w)("colorRamp")],xe.prototype,"readColorRamp",null),(0,i.Cg)([(0,a.MZ)({type:ge.kH.apiValues,json:{type:ge.kH.jsonValues,write:ge.kH.write}})],xe.prototype,"colorRampName",void 0),(0,i.Cg)([(0,ye.w)("colorRampName")],xe.prototype,"readColorRampName",null),xe=de=(0,i.Cg)([(0,a.$K)("esri.layers.raster.functions.ColormapFunctionArguments")],xe);const we=xe,Ae=[[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]],ve=[[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 Ce(t,e){const s=[],n=[];for(let e=0;e<t.length-1;e++)s.push({type:"algorithmic",algorithm:"esriHSVAlgorithm",fromColor:t[e].slice(1),toColor:t[e+1].slice(1)}),n.push(t[e+1][0]-t[e][0]);const r=t[t.length-1][0];return(0,ge.iv)({type:"multipart",colorRamps:s},{numColors:r,weights:e=e??n})}let be=class extends w{constructor(){super(...arguments),this.functionName="Colormap",this.functionArguments=null,this.rasterArgumentNames=["raster"],this.isNoopProcess=!0}_bindSourceRasters(){const t=this.sourceRasterInfos[0];if(t.bandCount>1)return{success:!1,supportsGPU:!1,error:"colormap-function: source data must be single band"};let{colormap:e,colormapName:s,colorRamp:n,colorRampName:r}=this.functionArguments;if(!e?.length)if(n)this.colorRamp=n,e=(0,ge.R8)(n,{interpolateAlpha:!0});else if(r){const t=(0,ge.M5)(r);t&&(e=(0,ge.R8)(t),this.colorRamp=(0,fe.r)(t))}else s&&(e=function(t){let e;switch(t){case"elevation":e=Ce([[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":e=(0,ge.iv)({type:"algorithmic",algorithm:"esriHSVAlgorithm",fromColor:[0,0,0],toColor:[255,255,255]});break;case"hillshade":e=Ce([[0,38,41,54],[69,79,82,90],[131,156,156,156],[256,253,253,241]],[.268,.238,.495]);break;case"ndvi":e=Ae;break;case"ndvi2":e=function(){const t=Ce([[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 e=t.length;e<256;e++)t.push([6,27,7]);return t}();break;case"ndvi3":e=ve;break;case"random":e=function(){const t=[];for(let e=0;e<256;e++){const e=[];for(let t=0;t<3;t++)e.push(Math.round(255*Math.random()));t.push(e)}return t}()}return e?(e=e.map((t,e)=>[e,...t]),e):null}(s));if(!e?.length)return{success:!1,supportsGPU:!1,error:"colormap-function: missing colormap argument"};const o=this._getOutputPixelType(t.pixelType);this.outputPixelType=o.startsWith("f")?"s32":o;const i=t.clone();return i.pixelType=this.outputPixelType,i.colormap=e,i.bandCount=1,this.rasterInfo=i,{success:!0,supportsGPU:!0}}_processPixels(t){let e=t.pixelBlocks?.[0];return!e||(0,u.zw)(e.pixelType)||(e=e.clone(),e.clamp(this.outputPixelType)),e}};(0,i.Cg)([(0,a.MZ)({json:{write:!0,name:"rasterFunction"}})],be.prototype,"functionName",void 0),(0,i.Cg)([(0,a.MZ)({type:we,json:{write:!0,name:"rasterFunctionArguments"}})],be.prototype,"functionArguments",void 0),(0,i.Cg)([(0,a.MZ)()],be.prototype,"rasterArgumentNames",void 0),(0,i.Cg)([(0,a.MZ)()],be.prototype,"isNoopProcess",void 0),(0,i.Cg)([(0,a.MZ)({json:{write:!0}})],be.prototype,"indexedColormap",void 0),(0,i.Cg)([(0,a.MZ)()],be.prototype,"colorRamp",void 0),be=(0,i.Cg)([(0,a.$K)("esri.layers.raster.functions.ColormapFunction")],be);const Me=be;var Te;let Pe=Te=class extends p{clone(){return new Te({raster:this.raster})}};Pe=Te=(0,i.Cg)([(0,a.$K)("esri.layers.raster.functions.ColormapToRGBFunctionArguments")],Pe);const Ne=Pe;var Ie=s(4151),Re=s(88178);let Fe=class extends w{constructor(){super(...arguments),this.functionName="ColormapToRGB",this.functionArguments=null,this.rasterArgumentNames=["raster"]}_bindSourceRasters(){const t=this.sourceRasterInfos[0];if(t.bandCount>1||!t.colormap?.length)return{success:!1,supportsGPU:!1,error:"colormap-to-rgb-function: source data must be single band with a colormap"};const e=t.clone();e.pixelType=this.outputPixelType=this._getOutputPixelType("u8"),this._removeStatsHistColormapVAT(e),e.bandCount=3,e.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=e;const s=[...t.colormap].sort((t,e)=>t[0]-e[0]),{indexedColormap:n,offset:r}=(0,Kt.zg)({colormap:s});return n?(this.lookup={indexedColormap:n,offset:r},{success:!0,supportsGPU:(0,Re.WN)(n)}):{success:!1,supportsGPU:!1,error:"colormap-to-rgb-function: the colormap is not supported"}}_processPixels(t){let e=t.pixelBlocks?.[0];if(!e||!this.lookup)return e;e=e.clone();const s=e.pixels[0],n=e.mask??new Uint8Array(s.length).fill(255),r=new Uint8Array(s.length),o=new Uint8Array(s.length),i=new Uint8Array(s.length),{indexedColormap:a,offset:u}=this.lookup,l=a.length;for(let t=0;t<s.length;t++)if(n[t]){let e=4*(s[t]-u);e<0||e>l-4?n[t]=0:(r[t]=a[e++],o[t]=a[e++],i[t]=a[e++])}return e.pixels=[r,o,i],e.statistics=[new Ie.A(0,255),new Ie.A(0,255),new Ie.A(0,255)],e.pixelType=this.outputPixelType,e}_getWebGLParameters(){return this.lookup}};(0,i.Cg)([(0,a.MZ)({json:{write:!0,name:"rasterFunction"}})],Fe.prototype,"functionName",void 0),(0,i.Cg)([(0,a.MZ)({type:Ne,json:{write:!0,name:"rasterFunctionArguments"}})],Fe.prototype,"functionArguments",void 0),(0,i.Cg)([(0,a.MZ)()],Fe.prototype,"rasterArgumentNames",void 0),(0,i.Cg)([(0,a.MZ)({json:{write:!0}})],Fe.prototype,"lookup",void 0),Fe=(0,i.Cg)([(0,a.$K)("esri.layers.raster.functions.ColormapToRGBFunction")],Fe);const ke=Fe;var _e,Se=s(43937);let Be=_e=class extends p{constructor(){super(...arguments),this.rasters=[]}writeRasters(t,e){e.rasters=t.map(t=>"number"==typeof t||"string"==typeof t?t:t.toJSON())}clone(){return new _e({rasters:(0,o.o8)(this.rasters)})}};(0,i.Cg)([(0,a.MZ)({json:{write:!0}})],Be.prototype,"rasters",void 0),(0,i.Cg)([(0,Se.K)("rasters")],Be.prototype,"writeRasters",null),Be=_e=(0,i.Cg)([(0,a.$K)("esri.layers.raster.functions.CompositeBandFunctionArguments")],Be);const je=Be;let Ze=class extends w{constructor(){super(...arguments),this.functionName="CompositeBand",this.functionArguments=null,this.rasterArgumentNames=["rasters"]}_bindSourceRasters(){const{sourceRasterInfos:t}=this,e=t[0];this.outputPixelType=this._getOutputPixelType(e.pixelType);const s=e.clone();if(s.attributeTable=null,s.colormap=null,s.pixelType=this.outputPixelType,s.bandCount=t.map(({bandCount:t})=>t).reduce((t,e)=>t+e),t.every(({statistics:t})=>null!=t&&t.length)){const e=[];t.forEach(({statistics:t})=>null!=t&&e.push(...t)),s.statistics=e}if(t.every(({histograms:t})=>null!=t&&t.length)){const e=[];t.forEach(({histograms:t})=>null!=t&&e.push(...t)),s.histograms=e}s.multidimensionalInfo&&s.multidimensionalInfo.variables.forEach(e=>{const s=t.map(t=>t.multidimensionalInfo?.variables.find(({name:t})=>t===e.name)),n=s.map(t=>t?.statistics?.length?t.statistics:null),r=s.map(t=>t?.histograms?.length?t.histograms:null);e.statistics=n.every(t=>null!=t)?n.flat():null,e.histograms=r.every(t=>null!=t)?r.flat():null}),s.bandCount>1&&(s.colormap=null,s.attributeTable=null);const n=t.every(t=>t.keyProperties.BandProperties?.length)?t.flatMap(t=>t.keyProperties.BandProperties):void 0;return s.keyProperties={...s.keyProperties,BandProperties:n},this.rasterInfo=s,{success:!0,supportsGPU:s.bandCount<=3}}_processPixels(t){const{pixelBlocks:e}=t;if(!e)return null;const s=e?.[0];return null==s?null:(0,Kt.Wy)(e)}_getWebGLParameters(){return{bandCount:this.rasterInfo.bandCount}}};(0,i.Cg)([(0,a.MZ)({json:{write:!0,name:"rasterFunction"}})],Ze.prototype,"functionName",void 0),(0,i.Cg)([(0,a.MZ)({type:je,json:{write:!0,name:"rasterFunctionArguments"}})],Ze.prototype,"functionArguments",void 0),(0,i.Cg)([(0,a.MZ)()],Ze.prototype,"rasterArgumentNames",void 0),Ze=(0,i.Cg)([(0,a.$K)("esri.layers.raster.functions.CompositeBandFunction")],Ze);const ze=Ze,Ge=new Dt.J({0:"difference",1:"relative-difference",2:"categorical",3:"euclidean-distance",4:"angle-difference",5:"band-with-most-change"},{useNumericKeys:!0}),Oe=new Dt.J({0:"all",1:"changed",2:"unchanged"},{useNumericKeys:!0});var De;let Ee=De=class extends p{constructor(){super(...arguments),this.method="difference",this.keepMethod="all",this.raster2=void 0}get rasters(){return[this.raster,this.raster2]}clone(){return new De({raster:this.raster,raster2:this.raster2,method:this.method,keepMethod:this.keepMethod})}};(0,i.Cg)([(0,Qt.e)(Ge)],Ee.prototype,"method",void 0),(0,i.Cg)([(0,Qt.e)(Oe)],Ee.prototype,"keepMethod",void 0),(0,i.Cg)([(0,a.MZ)({json:{write:!0}})],Ee.prototype,"raster2",void 0),(0,i.Cg)([(0,a.MZ)({readOnly:!0})],Ee.prototype,"rasters",null),Ee=De=(0,i.Cg)([(0,a.$K)("esri.layers.raster.functions.ComputeChangeFunctionArguments")],Ee);const Ve=Ee;var Ue=s(20437);let Le=class extends w{constructor(){super(...arguments),this.functionName="ComputeChange",this.functionArguments=null,this.rasterArgumentNames=["raster","raster2"]}_bindSourceRasters(){const{method:t}=this.functionArguments,e=this.sourceRasterInfos[0].clone();if(this.outputPixelType=this._getOutputPixelType(e.pixelType),e.pixelType=this.outputPixelType,this._removeStatsHistColormapVAT(e),"categorical"===t){const t=this.sourceRasterInfos.map(t=>t.attributeTable),s=this._getFieldNames(t,"value"),n=t.map(t=>this._getClassFieldName(t));if(null==s[0]||null==s[1]||null==n[0]||null==n[1])return{success:!1,supportsGPU:!1,error:"both inputs must have proper attribute table with value and class fields"};this._updateAttributeTable(e,s,n)}return e.bandCount=1,this.rasterInfo=e,{success:!0,supportsGPU:"difference"===t||"relative-difference"===t}}_processPixels(t){const{pixelBlocks:e}=t;if(null==e?.[0]||null==e?.[1])return null;const{method:s}=this.functionArguments;return function(t,e,s,n){const[r,o]=t,i=(0,u.zw)(s)&&!(0,u.zw)(r.pixelType)&&!(0,u.zw)(o.pixelType),a=[r.mask,o.mask].filter(t=>t),l=g.A.combineBandMasks(a),c=t.map(t=>t.pixels[0]),{width:p,height:h}=r,m=g.A.createEmptyBand(s,p*h);switch(e){case"difference":case"relative-difference":!function(t){const{bands:[e,s],mask:n,isRelative:r,isRoundingNeeded:o,outBand:i}=t,a=e.length;for(let t=0;t<a;t++)if(!n||n[t]){let n=e[t]-s[t];if(r){const r=Math.max(Math.abs(e[t]),Math.abs(s[t]));n=0===r?0:n/r}i[t]=o?Math.round(n):n}}({bands:c,mask:l,outBand:m,isRoundingNeeded:i,isRelative:"relative-difference"===e});break;case"categorical":!function(t){const{bands:[e,s],categoryIndexLookups:[n,r],classNames:[o,i],mask:a,keepMethod:u,outBand:l}=t,c=e.length,p=o.length,h=i.length,m=p*h,d=m+1,g=m+2;for(let t=0;t<c;t++)if(!a||a[t]){const a=e[t],c=s[t],p=n[a],f=r[c],y=o[p],x=i[f];l[t]=null==p||null==f?m:"changed"===u&&y===x?d:"unchanged"===u&&y!==x?g:p*h+f}}({bands:c,mask:l,outBand:m,...n});break;case"euclidean-distance":!function(t){const{pixels:[e,s],mask:n,outBand:r}=t,o=e[0].length,i=e.length;for(let t=0;t<o;t++)if(!n||n[t]){let n=0;for(let r=0;r<i;r++){const o=e[r][t]-s[r][t];n+=o*o}r[t]=Math.sqrt(n)}}({pixels:t.map(t=>t.pixels),mask:l,outBand:m});break;case"angle-difference":!function(t){const{pixels:[e,s],mask:n,outBand:r}=t,o=e[0].length,i=e.length;for(let t=0;t<o;t++)if(!n||n[t]){let n=0,o=0,a=0;for(let r=0;r<i;r++){const i=e[r][t],u=s[r][t];n+=i*u,o+=i*i,a+=u*u}const u=Math.sqrt(o*a);r[t]=u?Math.acos(n/u):1.5707963267948966}}({pixels:t.map(t=>t.pixels),mask:l,outBand:m});break;case"band-with-most-change":!function(t){const{pixels:[e,s],mask:n,outBand:r}=t,o=e[0].length,i=e.length;for(let t=0;t<o;t++)if(!n||n[t]){let n=0,o=0;for(let r=0;r<i;r++){const i=Math.abs(e[r][t]-s[r][t]);i>n&&(n=i,o=r)}r[t]=o}}({pixels:t.map(t=>t.pixels),mask:l,outBand:m})}const d=new g.A({width:p,height:h,pixels:[m],pixelType:s,mask:l});return d.updateStatistics(),d}(e,s,this.outputPixelType,this._categoryConfig)}_getWebGLParameters(){const t=this.outputPixelType??"f32";let[e,s]=(0,u.hP)(t);const n=(0,u.zw)(t);return n&&(e-=1e-4,s+=1e-4),{method:this.functionArguments.method,domainRange:[e,s],isOutputRounded:n}}_updateAttributeTable(t,e,s){const n=this.sourceRasterInfos.map(t=>t.attributeTable),r=n.map((t,s)=>t.features.map(t=>t.attributes[e[s]])),o=n.map((t,e)=>t.features.map(t=>t.attributes[s[e]])),i=r.map(t=>{const e=[];return t.forEach((t,s)=>e[t]=s),e}),{keepMethod:a}=this.functionArguments;this._categoryConfig={categoryIndexLookups:i,classNames:o,keepMethod:a};const u=n[0].clone();u.fields=[new Ue.A({name:"OID",type:"oid"}),new Ue.A({name:"Value",type:"integer"}),new Ue.A({name:"ClassName",type:"string"}),new Ue.A({name:"Class_From",type:"string"}),new Ue.A({name:"Class_To",type:"string"})];const l=this._getFieldNames(n,"red"),c=this._getFieldNames(n,"green"),p=this._getFieldNames(n,"blue"),h=[],m=2===l.length&&2===c.length&&2===p.length;m&&(h.push(...n.map((t,e)=>t.features.map(t=>[t.attributes[l[e]],t.attributes[c[e]],t.attributes[p[e]]]))),u.fields.push(new Ue.A({name:"Red",type:"integer"}),new Ue.A({name:"Green",type:"integer"}),new Ue.A({name:"Blue",type:"integer"})));const d=u.features[0].clone();d.geometry=null;const g=[],[f,y]=r.map(t=>t.length);let x=1;for(let t=0;t<f;t++){const e=o[0][t];for(let s=0;s<y;s++){const n=o[1][s];if("changed"===a&&e===n||"unchanged"===a&&e!==n)continue;const r=d.clone();r.attributes={OID:x++,Value:t*y+s,ClassName:e===n?e:`${e} -> ${n}`,Class_From:e,Class_To:n},m&&(r.attributes.Red=h[0][t][0]+h[1][s][0]>>1,r.attributes.Green=h[0][t][1]+h[1][s][1]>>1,r.attributes.Blue=h[0][t][2]+h[1][s][2]>>1),g.push(r)}}if("changed"===a){const t=d.clone();t.attributes={OID:x++,Value:f*y+1,ClassName:"No Change",Class_From:"Same",Class_To:"Same"},g.push(t)}else if("unchanged"===a){const t=d.clone();t.attributes={OID:x++,Value:f*y+2,ClassName:"Changed",Class_From:"Any",Class_To:"Any"},g.push(t)}u.features=g,t.attributeTable=u}_getFieldNames(t,e){return t.map(({fields:t})=>t.find(t=>t.name.toLowerCase()===e)?.name).filter(t=>t)}_getClassFieldName(t){const e=t.fields.find(t=>"string"===t.type&&t.name.toLowerCase().startsWith("class"))??t.fields.find(t=>"string"===t.type&&t.name.toLowerCase().includes("class")||t.name.toLowerCase().includes("type")||t.name.toLowerCase().includes("name"))??t.fields.find(t=>"string"===t.type);return e?.name}};(0,i.Cg)([(0,a.MZ)({json:{write:!0,name:"rasterFunction"}})],Le.prototype,"functionName",void 0),(0,i.Cg)([(0,a.MZ)({type:Ve,json:{write:!0,name:"rasterFunctionArguments"}})],Le.prototype,"functionArguments",void 0),(0,i.Cg)([(0,a.MZ)()],Le.prototype,"rasterArgumentNames",void 0),(0,i.Cg)([(0,a.MZ)({json:{write:!0}})],Le.prototype,"_categoryConfig",void 0),Le=(0,i.Cg)([(0,a.$K)("esri.layers.raster.functions.ComputeChangeFunction")],Le);const $e=Le;var Ke;let We=Ke=class extends p{constructor(){super(...arguments),this.contrastOffset=0,this.brightnessOffset=0}clone(){return new Ke({contrastOffset:this.contrastOffset,brightnessOffset:this.brightnessOffset,raster:this.raster})}};(0,i.Cg)([(0,a.MZ)({json:{write:!0}})],We.prototype,"contrastOffset",void 0),(0,i.Cg)([(0,a.MZ)({json:{write:!0}})],We.prototype,"brightnessOffset",void 0),We=Ke=(0,i.Cg)([(0,a.$K)("esri.layers.raster.functions.ContrastBrightnessFunctionArguments")],We);const He=We;var qe=s(51927);let Je=class extends w{constructor(){super(...arguments),this.functionName="ContrastBrightness",this.functionArguments=null,this.rasterArgumentNames=["raster"],this.lookup=null}_bindSourceRasters(){const{sourceRasterInfos:t}=this,e=t[0];if("u8"!==e.pixelType)return{success:!1,supportsGPU:!1,error:"Only unsigned 8 bit raster is supported by ContrastBrightness function."};this.outputPixelType=this._getOutputPixelType("u8");const s=e.clone();this._removeStatsHistColormapVAT(s),this.rasterInfo=s;const{contrastOffset:n,brightnessOffset:r}=this.functionArguments;return this.lookup=(0,qe.zj)(n,r),{success:!0,supportsGPU:!0}}_processPixels(t){const e=t.pixelBlocks?.[0];return null==e?null:(0,Kt.eH)(e,{lut:e.pixels.map(()=>this.lookup),offset:0,outputPixelType:"u8"})}_getWebGLParameters(){const{contrastOffset:t,brightnessOffset:e}=this.functionArguments;return{contrastOffset:t,brightnessOffset:e}}};(0,i.Cg)([(0,a.MZ)({json:{write:!0,name:"rasterFunction"}})],Je.prototype,"functionName",void 0),(0,i.Cg)([(0,a.MZ)({type:He,json:{write:!0,name:"rasterFunctionArguments"}})],Je.prototype,"functionArguments",void 0),(0,i.Cg)([(0,a.MZ)()],Je.prototype,"rasterArgumentNames",void 0),(0,i.Cg)([(0,a.MZ)({json:{write:!0}})],Je.prototype,"lookup",void 0),Je=(0,i.Cg)([(0,a.$K)("esri.layers.raster.functions.ContrastBrightnessFunction")],Je);const Xe=Je;function Qe(t,e,s,n,r){const o=Math.floor(n/2);for(let n=0;n<o;n++)for(let o=0;o<e;o++)t[n*e+o]=t[(r-1-n)*e+o],t[(s-1-n)*e+o]=t[(s-r+n)*e+o];const i=Math.floor(r/2);for(let n=0;n<s;n++){const s=n*e;for(let n=0;n<i;n++)t[s+n]=t[s+r-1-n],t[s+e-n-1]=t[s+e+n-r]}}const Ye=new Map;function ts(t,e,s,n,r,o,i){const a=new Float32Array(e*s),u=o.length,l=i?0:n,c=i?n:0,p=i?1:e;for(let i=l;i<s-l;i++){const s=i*e;for(let i=c;i<e-c;i++){if(r&&!r[s+i])continue;let e=0;for(let r=0;r<u;r++)e+=t[s+i+(r-n)*p]*o[r];a[s+i]=e}}return a}function es(t,e,s,n,r,o,i){const a=new Float32Array(e*s),u=Math.floor(n/2),l=Math.floor(r/2);for(let c=u;c<s-u;c++){const s=c*e;for(let c=l;c<e-l;c++){if(o&&!o[s+c])continue;let p=0;for(let o=0;o<n;o++)for(let n=0;n<r;n++)p+=t[s+c+(o-u)*e+n-l]*i[o*r+n];a[s+c]=p}}return a}var ss;Ye.set(A.none,[0,0,0,0,1,0,0,0,0]),Ye.set(A.lineDetectionHorizontal,[-1,-1,-1,2,2,2,-1,-1,-1]),Ye.set(A.lineDetectionVertical,[-1,2,-1,-1,2,-1,-1,2,-1]),Ye.set(A.lineDetectionLeftDiagonal,[2,-1,-1,-1,2,-1,-1,-1,2]),Ye.set(A.lineDetectionRightDiagonal,[-1,-1,2,-1,2,-1,2,-1,-1]),Ye.set(A.gradientNorth,[-1,-2,-1,0,0,0,1,2,1]),Ye.set(A.gradientWest,[-1,0,1,-2,0,2,-1,0,1]),Ye.set(A.gradientEast,[1,0,-1,2,0,-2,1,0,-1]),Ye.set(A.gradientSouth,[1,2,1,0,0,0,-1,-2,-1]),Ye.set(A.gradientNorthEast,[0,-1,-2,1,0,-1,2,1,0]),Ye.set(A.gradientNorthWest,[-2,-1,0,-1,0,1,0,1,2]),Ye.set(A.smoothArithmeticMean,[.111111111111,.111111111111,.111111111111,.111111111111,.111111111111,.111111111111,.111111111111,.111111111111,.111111111111]),Ye.set(A.smoothing3x3,[.0625,.125,.0625,.125,.25,.125,.0625,.125,.0625]),Ye.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]),Ye.set(A.sharpening3x3,[-1,-1,-1,-1,9,-1,-1,-1,-1]),Ye.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]),Ye.set(A.laplacian3x3,[0,-1,0,-1,4,-1,0,-1,0]),Ye.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]),Ye.set(A.sobelHorizontal,[-1,-2,-1,0,0,0,1,2,1]),Ye.set(A.sobelVertical,[-1,0,1,-2,0,2,-1,0,1]),Ye.set(A.sharpen,[0,-.25,0,-.25,2,-.25,0,-.25,0]),Ye.set(A.sharpen2,[-.25,-.25,-.25,-.25,3,-.25,-.25,-.25,-.25]),Ye.set(A.pointSpread,[-.627,.352,-.627,.352,2.923,.352,-.627,.352,-.627]);let ns=ss=class extends p{constructor(){super(...arguments),this.rows=3,this.cols=3,this.kernel=[0,0,0,0,1,0,0,0,0]}set convolutionType(t){this._set("convolutionType",t);const e=Ye.get(t);if(!e||t===A.userDefined||t===A.none)return;const s=Math.round(Math.sqrt(e.length));this._set("kernel",e),this._set("cols",s),this._set("rows",s)}clone(){return new ss({cols:this.cols,rows:this.rows,kernel:[...this.kernel],convolutionType:this.convolutionType,raster:(0,o.o8)(this.raster)})}};(0,i.Cg)([(0,a.MZ)({json:{type:Number,write:!0}})],ns.prototype,"rows",void 0),(0,i.Cg)([(0,a.MZ)({json:{type:Number,write:!0,name:"columns"}})],ns.prototype,"cols",void 0),(0,i.Cg)([(0,a.MZ)({json:{name:"type",type:Number,write:!0}})],ns.prototype,"convolutionType",null),(0,i.Cg)([(0,a.MZ)({json:{type:[Number],write:!0}})],ns.prototype,"kernel",void 0),ns=ss=(0,i.Cg)([(0,a.$K)("esri.layers.raster.functions.ConvolutionFunctionArguments")],ns);const rs=ns;let os=class extends w{constructor(){super(...arguments),this.functionName="Convolution",this.rasterArgumentNames=["raster"]}get _normalizedKernel(){const{kernel:t,convolutionType:e}=this.functionArguments,s=t.reduce((t,e)=>t+e);return-1===e||0===s||1===s?t:t.map(t=>t/s)}_bindSourceRasters(){const{convolutionType:t,rows:e,cols:s,kernel:n}=this.functionArguments;if(!Object.values(A).includes(t))return{success:!1,supportsGPU:!1,error:`convolution-function: the specified kernel type is not supported ${t}`};if(t!==A.none&&e*s!==n.length)return{success:!1,supportsGPU:!1,error:"convolution-function: the specified rows and cols do not match the length of the kernel"};const r=this.sourceRasterInfos[0];this.outputPixelType=this._getOutputPixelType(r.pixelType);const o=r.clone();o.pixelType=this.outputPixelType;const i=[A.none,A.sharpen,A.sharpen2,A.sharpening3x3,A.sharpening5x5];return(-1===t||"u8"!==this.outputPixelType&&!i.includes(t))&&(o.statistics=null,o.histograms=null),o.colormap=null,o.attributeTable=null,this.rasterInfo=o,{success:!0,supportsGPU:n.length<=25}}_processPixels(t){const e=t.pixelBlocks?.[0];if(null==e||this.functionArguments.convolutionType===A.none)return e;const{rows:s,cols:n}=this.functionArguments,{_normalizedKernel:r}=this;return function(t,e){const s=function(t){const e=Math.sqrt(t.length),s=t.slice(0,e),n=[1];for(let s=1;s<e;s++){let r=null;for(let n=0;n<e;n++){const o=t[n+s*e],i=t[n];if(null==r)if(0===i){if(o)return{separable:!1,row:null,col:null}}else r=o/i;else if(o/i!==r)return{separable:!1,row:null,col:null}}if(null==r)return{separable:!1,row:null,col:null};n.push(r)}return{separable:!0,row:s,col:n}}(e.kernel),n=!1!==e.mirrorEdges,r=s.separable?function(t,e,s,n=!0){const{pixels:r,width:o,height:i,pixelType:a,mask:u}=t,l=r.length,c=[],p=e.length,h=s.length,m=Math.floor(p/2),d=Math.floor(h/2);for(let t=0;t<l;t++){let a=ts(r[t],o,i,m,u,e,!0);a=ts(a,o,i,d,u,s,!1),n&&Qe(a,o,i,p,h),c.push(a)}return new g.A({width:o,height:i,pixelType:a,pixels:c,mask:u})}(t,s.row,s.col,n):function(t,e,s=!0){const{pixels:n,width:r,height:o,pixelType:i,mask:a}=t,u=n.length,l=[],{kernel:c,rows:p,cols:h}=e;for(let t=0;t<u;t++){const e=es(n[t],r,o,p,h,a,c);s&&Qe(e,r,o,p,h),l.push(e)}return new g.A({width:r,height:o,pixelType:i,pixels:l,mask:a})}(t,e,n),{outputPixelType:o}=e;return o&&r.clamp(o),r}(e,{kernel:r,rows:s,cols:n,outputPixelType:this.outputPixelType})}_getWebGLParameters(){const t=new Float32Array(25),{rows:e,cols:s}=this.functionArguments,{_normalizedKernel:n}=this;for(let r=0;r<e;r++)for(let e=0;e<s;e++)t[5*r+e]=n[r*s+e];return{kernelRows:e,kernelCols:s,kernel:t,clampRange:(0,u.hP)(this.outputPixelType)}}_getNeighborhoodSize(){const{rows:t,cols:e}=this.functionArguments;return{rows:t,cols:e}}};(0,i.Cg)([(0,a.MZ)({json:{write:!0,name:"rasterFunction"}})],os.prototype,"functionName",void 0),(0,i.Cg)([(0,a.MZ)({type:rs,json:{write:!0,name:"rasterFunctionArguments"}})],os.prototype,"functionArguments",void 0),(0,i.Cg)([(0,a.MZ)()],os.prototype,"rasterArgumentNames",void 0),(0,i.Cg)([(0,a.MZ)()],os.prototype,"_normalizedKernel",null),os=(0,i.Cg)([(0,a.$K)("esri.layers.raster.functions.ConvolutionFunction")],os);const is=os;var as;const us=new Dt.J({0:"standard",1:"planform",2:"profile"},{useNumericKeys:!0});let ls=as=class extends p{constructor(){super(...arguments),this.curvatureType="standard",this.zFactor=1}readCurvatureType(t,e){return us.fromJSON(e.type??e.curvatureType??0)}clone(){return new as({curvatureType:this.curvatureType,zFactor:this.zFactor,raster:this.raster})}};(0,i.Cg)([(0,a.MZ)({json:{write:{target:"type"}}}),(0,Qt.e)(us)],ls.prototype,"curvatureType",void 0),(0,i.Cg)([(0,ye.w)("curvatureType",["type","curvatureType"])],ls.prototype,"readCurvatureType",null),(0,i.Cg)([(0,a.MZ)({type:Number,json:{write:!0}})],ls.prototype,"zFactor",void 0),ls=as=(0,i.Cg)([(0,a.$K)("esri.layers.raster.functions.CurvatureFunctionArguments")],ls);const cs=ls;let ps=class extends w{constructor(){super(...arguments),this.functionName="Curvature",this.functionArguments=null,this.rasterArgumentNames=["raster"],this.isGCS=!1}_bindSourceRasters(){this.outputPixelType=this._getOutputPixelType("f32");const t=this.sourceRasterInfos[0].clone();return t.pixelType=this.outputPixelType,t.bandCount=1,this._removeStatsHistColormapVAT(t),this.rasterInfo=t,this.isGCS=t.spatialReference?.isGeographic??!1,{success:!0,supportsGPU:!0}}_processPixels(t){const e=t.pixelBlocks?.[0];if(null==e)return null;const{zFactor:s,curvatureType:n}=this.functionArguments,{extent:r,primaryPixelSizes:o}=t,i=o?.[0],a=i??(r?{x:r.width/e.width,y:r.height/e.height}:{x:1,y:1}),u=this.isGCS&&s>=1?s*zt.rk:s;return(0,zt.E0)(e,{zFactor:u,curvatureType:n,resolution:a})}_getWebGLParameters(){const{zFactor:t,curvatureType:e}=this.functionArguments;return{curvatureType:e,zFactor:this.isGCS&&t>=1?t*zt.rk:t}}_getNeighborhoodSize(){return{rows:3,cols:3}}};(0,i.Cg)([(0,a.MZ)({json:{write:!0,name:"rasterFunction"}})],ps.prototype,"functionName",void 0),(0,i.Cg)([(0,a.MZ)({type:cs,json:{write:!0,name:"rasterFunctionArguments"}})],ps.prototype,"functionArguments",void 0),(0,i.Cg)([(0,a.MZ)()],ps.prototype,"rasterArgumentNames",void 0),(0,i.Cg)([(0,a.MZ)({json:{write:!0}})],ps.prototype,"isGCS",void 0),ps=(0,i.Cg)([(0,a.$K)("esri.layers.raster.functions.CurvatureFunction")],ps);const hs=ps;var ms;let ds=ms=class extends p{constructor(){super(...arguments),this.bandIds=[],this.bandNames=[],this.bandWavelengths=[],this.missingBandAction=0}clone(){return new ms({bandIds:this.bandIds?.slice(),bandNames:this.bandNames?.slice(),bandWavelengths:this.bandWavelengths?.slice(),missingBandAction:this.missingBandAction,method:this.method,wavelengthMatchTolerance:this.wavelengthMatchTolerance})}};(0,i.Cg)([(0,a.MZ)({json:{write:!0}})],ds.prototype,"bandIds",void 0),(0,i.Cg)([(0,a.MZ)({json:{write:!0}})],ds.prototype,"bandNames",void 0),(0,i.Cg)([(0,a.MZ)({json:{write:!0}})],ds.prototype,"bandWavelengths",void 0),(0,i.Cg)([(0,Qt.e)({0:"name",1:"wavelength",2:"id"})],ds.prototype,"method",void 0),(0,i.Cg)([(0,a.MZ)({json:{write:!0}})],ds.prototype,"missingBandAction",void 0),(0,i.Cg)([(0,a.MZ)({json:{write:!0}})],ds.prototype,"wavelengthMatchTolerance",void 0),ds=ms=(0,i.Cg)([(0,a.$K)("esri.layers.raster.functions.ExtractBandFunctionArguments")],ds);const gs=ds;let fs=class extends w{constructor(){super(...arguments),this.functionName="ExtractBand",this.functionArguments=null,this.rasterArgumentNames=["raster"]}_bindSourceRasters(){const{functionArguments:t,sourceRasterInfos:e}=this,s=e[0],{method:n,bandNames:r,bandWavelengths:o,bandIds:i,missingBandAction:a}=t,u=r?.length&&("name"===n||"id"!==n&&!i?.length),l=o?.length&&("wavelength"===n||"id"!==n&&!i?.length),c=1===a,p=u?function(t,e){const s=t.bandInfos.map(({name:t})=>t.toLowerCase()),n=[];for(let t=0;t<e.length;t++){const r=e[t].toLowerCase();let o=s.indexOf(r);if(-1===o&&"nearinfrared"===r&&(o=s.findIndex(t=>t.startsWith("nearinfrared_1")),-1===o&&(o=s.findIndex(t=>t.startsWith("nearinfrared")))),-1===o)return null;n.push(o)}return n}(s,r):l?function(t,e,{wavelengthMatchTolerance:s},n){const{bandInfos:r}=t,o=[];for(let t=0;t<r.length;t++){const{minWavelength:e,maxWavelength:s}=r[t];if(!e||!s)return null;o.push({minWavelength:e,maxWavelength:s})}const i=[];for(let t=0;t<e.length;t++){const r=e[t];let a=!1,u=-1,l=Number.MAX_VALUE;for(let t=0;t<o.length;t++){const e=o[t],s=r>=e.minWavelength&&r<=e.maxWavelength,n=Math.abs(r-(e.minWavelength+e.maxWavelength)/2);s?n<l&&(a=!0,u=t,l=n):!a&&n<l&&(u=t,l=n)}if(!a&&s&&l<s&&(a=!0),!a&&n)return null;i.push(u)}return i}(s,o,this.functionArguments,c):function(t,e,s){const{bandCount:n}=t;return!e?.length||s&&e.some(t=>t<0||t>=n)?null:e}(s,i,c);if(null==p)return{success:!1,supportsGPU:!1,error:`extract-band-function: Invalid ${u?"band names":l?"band wavelengths":"band ids"} for the imagery data source`};this.functionArguments.bandIds=p,this.functionArguments.method="id",this.outputPixelType=this._getOutputPixelType(s.pixelType);const h=s.clone();h.pixelType=this.outputPixelType,h.bandCount=p.length;const{statistics:m,histograms:d}=h;null!=m&&m.length&&(h.statistics=p.map(t=>m[t]||m[m.length-1])),null!=d&&d.length&&(h.histograms=p.map(t=>d[t]||d[d.length-1])),h.multidimensionalInfo&&h.multidimensionalInfo.variables.forEach(t=>{const{statistics:e,histograms:s}=t;null!=e&&e.length&&(t.statistics=p.map(t=>e[t]||e[e.length-1])),null!=s&&s.length&&(t.histograms=p.map(t=>s[t]||s[s.length-1]))});let g=h.keyProperties?.BandProperties;return g?.length&&(g=p.map(t=>t>=g.length?g[g.length-1]:g[t]),h.keyProperties={...h.keyProperties,BandProperties:g}),this.rasterInfo=h,{success:!0,supportsGPU:h.bandCount<=3}}_processPixels(t){const e=t.pixelBlocks?.[0];if(null==e)return null;let{bandIds:s}=this.functionArguments;if(this.rasterInfo.storageInfo.isBsqTile){const{rawInputBandIds:t}=this;s=s.map(e=>t.indexOf(e))}else{const t=e.pixels.length;s=s.map(e=>e>=t?t-1:e)}return e.extractBands(s)}_getWebGLParameters(){let t;if(this.isInputBandIdsSwizzled)t=this.swizzledBandSelection.length?this.swizzledBandSelection:[0,1,2];else{t=[...this.functionArguments.bandIds],0===t.length?t=[0,1,2]:t.length<3&&(t[1]=t[1]??t[0],t[2]=t[2]??t[1]);for(let e=0;e<3;e++)t[e]=Math.min(t[e],2)}return{bandIndexMat3:qt(t)}}_getInputBandIds(t){const e=t.length;return this.functionArguments.bandIds.map(t=>t>=e?e-1:t).map(e=>t[e])}_swizzleBandIds(t){const e=this.functionArguments.bandIds.map(e=>t.indexOf(e));return this.isInputBandIdsSwizzled=!0,e[1]??=e[0],e[2]??=e[1],this.swizzledBandSelection=e,!1}};(0,i.Cg)([(0,a.MZ)({json:{write:!0,name:"rasterFunction"}})],fs.prototype,"functionName",void 0),(0,i.Cg)([(0,a.MZ)({type:gs,json:{write:!0,name:"rasterFunctionArguments"}})],fs.prototype,"functionArguments",void 0),(0,i.Cg)([(0,a.MZ)()],fs.prototype,"rasterArgumentNames",void 0),fs=(0,i.Cg)([(0,a.$K)("esri.layers.raster.functions.ExtractBandFunction")],fs);const ys=fs;function xs(t,e,s,n){const{pixels:r,width:o,height:i}=t,a=r.length,l=s.startsWith("f"),c=!l,[p,h]=(0,u.hP)(s),m=o*i,d=g.A.createEmptyBand(s,m);for(let t=0;t<i;t++){let s=t*o;for(let t=0;t<o;t++,s++)if(!n||n[s]){let t=0;for(let n=0;n<a;n++)t+=e[n]*r[n][s];l||(t=Math.round(t),c&&(t=t>h?h:t<p?p:t)),d[s]=t}}return d}var ws;let As=ws=class extends p{clone(){return new ws({conversionParameters:[...this.conversionParameters],raster:this.raster})}};(0,i.Cg)([(0,a.MZ)({type:[Number],json:{write:!0}})],As.prototype,"conversionParameters",void 0),As=ws=(0,i.Cg)([(0,a.$K)("esri.layers.raster.functions.GrayscaleFunctionArguments")],As);const vs=As;let Cs=class extends w{constructor(){super(...arguments),this.functionName="Grayscale",this.functionArguments=null,this.rasterArgumentNames=["raster"]}get _normalizedWeights(){const{conversionParameters:t}=this.functionArguments,e=t.reduce((t,e)=>t+e);return t.map(t=>t/e)}_bindSourceRasters(){const{conversionParameters:t}=this.functionArguments;if(!t?.length)return{success:!1,supportsGPU:!1,error:"missing valid conversion parameters."};const e=this.sourceRasterInfos[0].clone();this.outputPixelType=this._getOutputPixelType(e.pixelType),e.pixelType=this.outputPixelType;const s=3===t.length||3===e.bandCount&&t.length>3;return e.bandCount=1,this._removeStatsHistColormapVAT(e),this.rasterInfo=e,{success:!0,supportsGPU:s}}_processPixels(t){const e=t.pixelBlocks?.[0];return null==e?null:function(t,e,s){const{width:n,height:r,mask:o,bandMasks:i}=t,a=i?.length?g.A.combineBandMasks(i):o,u=xs(t,e,s,a),l=new g.A({width:n,height:r,pixels:[u],pixelType:s,mask:a});return l.updateStatistics(),l}(e,this._normalizedWeights,this.outputPixelType)}_getWebGLParameters(){return{weights:this._normalizedWeights}}};(0,i.Cg)([(0,a.MZ)({json:{write:!0,name:"rasterFunction"}})],Cs.prototype,"functionName",void 0),(0,i.Cg)([(0,a.MZ)({type:vs,json:{write:!0,name:"rasterFunctionArguments"}})],Cs.prototype,"functionArguments",void 0),(0,i.Cg)([(0,a.MZ)()],Cs.prototype,"rasterArgumentNames",void 0),(0,i.Cg)([(0,a.MZ)()],Cs.prototype,"_normalizedWeights",null),Cs=(0,i.Cg)([(0,a.$K)("esri.layers.raster.functions.GrayscaleFunction")],Cs);const bs=Cs;var Ms;const Ts=new Dt.J({0:"traditional",1:"multi-directional"},{useNumericKeys:!0}),Ps=new Dt.J({1:"degree",2:"percent-rise",3:"scaled"},{useNumericKeys:!0});let Ns=Ms=class extends p{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 Ms({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,i.Cg)([(0,a.MZ)({type:Number,json:{write:!0}})],Ns.prototype,"altitude",void 0),(0,i.Cg)([(0,a.MZ)({type:Number,json:{write:!0}})],Ns.prototype,"azimuth",void 0),(0,i.Cg)([(0,a.MZ)(),(0,Qt.e)(Ts)],Ns.prototype,"hillshadeType",void 0),(0,i.Cg)([(0,a.MZ)({type:Number,json:{write:!0,name:"psPower"}})],Ns.prototype,"pixelSizePower",void 0),(0,i.Cg)([(0,a.MZ)({type:Number,json:{write:!0,name:"psZFactor"}})],Ns.prototype,"pixelSizeFactor",void 0),(0,i.Cg)([(0,a.MZ)(),(0,Qt.e)(Ps)],Ns.prototype,"slopeType",void 0),(0,i.Cg)([(0,a.MZ)({type:Number,json:{write:!0}})],Ns.prototype,"zFactor",void 0),(0,i.Cg)([(0,a.MZ)({type:Boolean,json:{write:!0}})],Ns.prototype,"removeEdgeEffect",void 0),Ns=Ms=(0,i.Cg)([(0,a.$K)("esri.layers.raster.functions.HillshadeFunctionArguments")],Ns);const Is=Ns;let Rs=class extends w{constructor(){super(...arguments),this.functionName="Hillshade",this.functionArguments=null,this.rasterArgumentNames=["raster"],this.isGCS=!1}_bindSourceRasters(){const t=this.sourceRasterInfos[0];if(t.bandCount>1)return{success:!1,supportsGPU:!1,error:"hillshade-function: source data must be single band"};this.outputPixelType=this._getOutputPixelType("u8");const e=t.clone();return this._removeStatsHistColormapVAT(e),e.pixelType=this.outputPixelType,e.bandCount=1,e.statistics=[{min:0,max:255,avg:60,stddev:10}],this.rasterInfo=e,this.isGCS=e.spatialReference?.isGeographic??!1,{success:!0,supportsGPU:!0}}_processPixels(t){const e=t.pixelBlocks?.[0];if(!e)return null;const{extent:s,primaryPixelSizes:n}=t,r=n?.[0],o=r??(s?{x:s.width/e.width,y:s.height/e.height}:{x:1,y:1}),i=(0,zt.PP)(this.functionArguments,o,this.isGCS),a=(0,zt.fw)(e,i);return a.pixelType=this.outputPixelType,a}_getWebGLParameters(){const t=(0,zt.PP)(this.functionArguments,{x:1,y:1},this.isGCS),e=(0,zt.ng)(t),{slopeType:s,zFactor:n,pixelSizeFactor:r,pixelSizePower:o}=this.functionArguments,i="scaled"===s,a=(0,u.zw)(this.outputPixelType);return{...e,zFactor:n,gcsFactor:this.isGCS?zt.rk:1,pixelSizeFactor:i?r:0,pixelSizePower:i?o:0,isOutputRounded:a}}_getNeighborhoodSize(){return{rows:3,cols:3}}};(0,i.Cg)([(0,a.MZ)({json:{write:!0,name:"rasterFunction"}})],Rs.prototype,"functionName",void 0),(0,i.Cg)([(0,a.MZ)({type:Is,json:{write:!0,name:"rasterFunctionArguments"}})],Rs.prototype,"functionArguments",void 0),(0,i.Cg)([(0,a.MZ)()],Rs.prototype,"rasterArgumentNames",void 0),(0,i.Cg)([(0,a.MZ)({json:{write:!0}})],Rs.prototype,"isGCS",void 0),Rs=(0,i.Cg)([(0,a.$K)("esri.layers.raster.functions.HillshadeFunction")],Rs);const Fs=Rs;var ks;let _s=ks=class extends p{constructor(){super(...arguments),this.rasters=[],this.processAsMultiband=!0}writeRasters(t,e){e.rasters=t.map(t=>"number"==typeof t||"string"==typeof t?t:t.toJSON())}clone(){return new ks({operation:this.operation,processAsMultiband:this.processAsMultiband,rasters:(0,o.o8)(this.rasters)})}};(0,i.Cg)([(0,a.MZ)({json:{write:!0}})],_s.prototype,"operation",void 0),(0,i.Cg)([(0,a.MZ)({json:{write:!0}})],_s.prototype,"rasters",void 0),(0,i.Cg)([(0,Se.K)("rasters")],_s.prototype,"writeRasters",null),(0,i.Cg)([(0,a.MZ)({json:{write:!0}})],_s.prototype,"processAsMultiband",void 0),_s=ks=(0,i.Cg)([(0,a.$K)("esri.layers.raster.functions.LocalFunctionArguments")],_s);const Ss=_s;let Bs=class extends w{constructor(){super(...arguments),this.functionName="Local",this.functionArguments=null,this.rasterArgumentNames=["rasters"]}_bindSourceRasters(){const{sourceRasterInfos:t}=this,e=t[0],{bandCount:s}=e,{processAsMultiband:n}=this.functionArguments;if(t.some(t=>t.bandCount!==s))return{success:!1,supportsGPU:!1,error:"local-function: input rasters do not have same band count"};const{operation:r,rasters:o}=this.functionArguments,i=N[r];if(!(999===i||o.length===i||o.length<=1&&1===i))return{success:!1,supportsGPU:!1,error:`local-function: the length of functionArguments.rasters does not match operation's requirement: ${i}`};const a=e.clone();return a.bandCount=999!==i||n?s:1,this._removeStatsHistColormapVAT(a),this._updateStatistics(a),this._updatePixelType(a),this.rasterInfo=a,{success:!0,supportsGPU:1===a.bandCount&&i<=3}}_processPixels(t){const{pixelBlocks:e}=t;return null==e||e.some(t=>null==t)?null:kt(e,this.functionArguments.operation,{processAsMultiband:this.functionArguments.processAsMultiband,outputPixelType:this.outputPixelType??void 0})}_getWebGLParameters(){const{operation:t}=this.functionArguments,e=N[t],s=Object.keys(M).find(e=>M[e]===t)?.toLowerCase()??"undefined",n=this.outputPixelType??"f32";let[r,o]=(0,u.hP)(n);const i=(0,u.zw)(n);return i&&(r-=1e-4,o+=1e-4),{imageCount:e,operationName:s,domainRange:[r,o],isOutputRounded:i}}_updateStatistics(t){const e=this.sourceRasterInfos[0],{operation:s}=this.functionArguments,n=P(s)?.domain;if(n){t.statistics=[];for(let e=0;e<t.bandCount;e++)t.statistics[e]={min:n[0],max:n[1],avg:(n[0]+n[1])/2,stddev:(n[0]+n[1])/10}}else 45===s&&e.statistics?.length&&(t.statistics=e.statistics.map(t=>({min:-t.max,max:-t.min,avg:null!=t.avg?-t.avg:void 0,stddev:null!=t.stddev?-t.stddev:void 0})))}_updatePixelType(t){const{statistics:e,pixelType:s}=this.sourceRasterInfos[0],{operation:n}=this.functionArguments,{domain:r,isInteger:o}=P(n)??{domain:null,isInteger:!1};let i="f32";if(r&&o)i=(0,u.X1)(r[0],r[1]);else if(30===n){const t=e?.[0];i=t?(0,u.X1)(t.min,t.max):(0,u.zw)(s)?s:"s32"}else if(45===n&&(0,u.zw)(s)){const t=e?.map(({max:t})=>-t),n=e?.map(({min:t})=>-t),r=t?.length?Math.min(...t):null,o=n?.length?Math.min(...n):null;i=null!=r&&null!=o?(0,u.X1)(r,o):s.startsWith("s")?s.replace("s","u"):"u1"===s||"u2"===s||"u4"===s?"s8":"u8"===s?"s16":"s32"}t.pixelType=this.outputPixelType=this._getOutputPixelType(i)}};(0,i.Cg)([(0,a.MZ)({json:{write:!0,name:"rasterFunction"}})],Bs.prototype,"functionName",void 0),(0,i.Cg)([(0,a.MZ)({type:Ss,json:{write:!0,name:"rasterFunctionArguments"}})],Bs.prototype,"functionArguments",void 0),(0,i.Cg)([(0,a.MZ)()],Bs.prototype,"rasterArgumentNames",void 0),Bs=(0,i.Cg)([(0,a.$K)("esri.layers.raster.functions.LocalFunction")],Bs);const js=Bs;var Zs,zs=s(34727);let Gs=Zs=class extends p{constructor(){super(...arguments),this.includedRanges=null,this.noDataValues=null,this.noDataInterpretation=0}get normalizedNoDataValues(){const{noDataValues:t}=this;if(!t?.length)return null;let e=!1;const s=t.map(t=>{if("number"==typeof t)return e=!0,[t];if("string"==typeof t){const s=t.trim().split(" ").filter(t=>""!==t.trim()).map(t=>Number(t));return e=e||s.length>0,0===s.length?null:s}return null});return e?s:null}clone(){return new Zs({includedRanges:this.includedRanges?.slice()??[],noDataValues:this.noDataValues?.slice()??[],noDataInterpretation:this.noDataInterpretation})}};(0,i.Cg)([(0,a.MZ)({json:{write:!0}})],Gs.prototype,"includedRanges",void 0),(0,i.Cg)([(0,a.MZ)({json:{write:!0}})],Gs.prototype,"noDataValues",void 0),(0,i.Cg)([(0,a.MZ)()],Gs.prototype,"normalizedNoDataValues",null),(0,i.Cg)([(0,a.MZ)({json:{write:!0}})],Gs.prototype,"noDataInterpretation",void 0),Gs=Zs=(0,i.Cg)([(0,a.$K)("esri.layers.raster.functions.MaskFunctionArguments")],Gs);const Os=Gs;let Ds=class extends w{constructor(){super(...arguments),this.functionName="Mask",this.functionArguments=null,this.rasterArgumentNames=["raster"]}_bindSourceRasters(){const t=this.sourceRasterInfos[0].clone(),{pixelType:e}=t;this.outputPixelType=this._getOutputPixelType(e),t.pixelType=this.outputPixelType,this.rasterInfo=t;const{includedRanges:s,normalizedNoDataValues:n}=this.functionArguments;if(!s?.length&&!n?.length)return{success:!1,supportsGPU:!1,error:"missing includedRanges or noDataValues argument"};let r=[];for(let o=0;o<t.bandCount;o++){const t=(0,Kt.Wt)(e,s?.slice(2*o,2*o+2),n?.[o]);if(null==t){r=null;break}r.push(t)}this.lookups=r;const o=null!=n&&n.every(t=>t?.length===n[0]?.length);return{success:!0,supportsGPU:(!s||s.length<=2*Kt.et)&&(!n||o&&n[0].length<=Kt.et)}}_processPixels(t){const e=t.pixelBlocks?.[0];if(null==e)return null;const{outputPixelType:s,lookups:n}=this,{includedRanges:r,noDataInterpretation:o,normalizedNoDataValues:i}=this.functionArguments;return(0,Kt.dK)(e,{includedRanges:r,noDataValues:i,outputPixelType:s,matchAll:1===o,lookups:n})}_getWebGLParameters(){const{includedRanges:t,normalizedNoDataValues:e}=this.functionArguments,s=new Float32Array(Kt.et);s.fill(zs.pq),e?.[0]?.length&&s.set(e[0]);const n=new Float32Array(6);for(let e=0;e<n.length;e+=2)n[e]=t?.[e]??-zs.pq,n[e+1]=t?.[e+1]??zs.pq;return t?.length&&n.set(t),{bandCount:this.sourceRasterInfos[0].bandCount,noDataValues:s,includedRanges:n}}};(0,i.Cg)([(0,a.MZ)({json:{write:!0,name:"rasterFunction"}})],Ds.prototype,"functionName",void 0),(0,i.Cg)([(0,a.MZ)({type:Os,json:{write:!0,name:"rasterFunctionArguments"}})],Ds.prototype,"functionArguments",void 0),(0,i.Cg)([(0,a.MZ)()],Ds.prototype,"rasterArgumentNames",void 0),(0,i.Cg)([(0,a.MZ)({json:{write:!0}})],Ds.prototype,"lookups",void 0),Ds=(0,i.Cg)([(0,a.$K)("esri.layers.raster.functions.MaskFunction")],Ds);const Es=Ds;var Vs;let Us=Vs=class extends p{constructor(){super(...arguments),this.visibleBandID=0,this.infraredBandID=1,this.scientificOutput=!1}clone(){const{visibleBandID:t,infraredBandID:e,scientificOutput:s}=this;return new Vs({visibleBandID:t,infraredBandID:e,scientificOutput:s})}};(0,i.Cg)([(0,a.MZ)({json:{write:!0}})],Us.prototype,"visibleBandID",void 0),(0,i.Cg)([(0,a.MZ)({json:{write:!0}})],Us.prototype,"infraredBandID",void 0),(0,i.Cg)([(0,a.MZ)({json:{write:!0}})],Us.prototype,"scientificOutput",void 0),Us=Vs=(0,i.Cg)([(0,a.$K)("esri.layers.raster.functions.NDVIFunctionArguments")],Us);const Ls=Us;let $s=class extends w{constructor(){super(...arguments),this.functionName="NDVI",this.functionArguments=null,this.rasterArgumentNames=["raster"]}_bindSourceRasters(){const{scientificOutput:t,visibleBandID:e,infraredBandID:s}=this.functionArguments;this.outputPixelType=this._getOutputPixelType(t?"f32":"u8");const n=this.sourceRasterInfos[0],r=Math.max(e,s);if(n.bandCount<2||r>=n.bandCount)return{success:!1,supportsGPU:!1,error:"ndvi-function: source raster has insufficient amount of raster bands"};if(e<0||s<0)return{success:!1,supportsGPU:!1,error:"ndvi-function: invalid visible or infrared band id"};const o=n.clone();o.pixelType=this.outputPixelType,this._removeStatsHistColormapVAT(o),o.bandCount=1,o.keyProperties={...o.keyProperties,BandProperties:void 0};const[i,a,u,l]=t?[-1,1,0,.1]:[0,200,100,10];return o.statistics=[{min:i,max:a,avg:u,stddev:l}],this.rasterInfo=o,{success:!0,supportsGPU:!0}}_processPixels(t){const e=t.pixelBlocks?.[0];if(null==e)return null;let{visibleBandID:s,infraredBandID:n,scientificOutput:r}=this.functionArguments;if(this.rasterInfo.storageInfo.isBsqTile){const{rawInputBandIds:t}=this;n=t.indexOf(n),s=t.indexOf(s)}return function(t,e,s,n){const{mask:r,pixels:o,width:i,height:a}=t,u=o[s],l=o[e],c=l.length,p=n?new Uint8Array(c):new Float32Array(c),h=n?100:1,m=n?100.5:0;for(let t=0;t<c;t++)if(null==r||r[t]){const e=u[t],s=l[t],n=e+s;n&&(p[t]=(e-s)/n*h+m)}const d=new g.A({width:i,height:a,mask:r,pixelType:n?"u8":"f32",pixels:[p]});return d.updateStatistics(),d}(e,s,n,!r)}_getWebGLParameters(){const{visibleBandID:t,infraredBandID:e,scientificOutput:s}=this.functionArguments;return{bandIndexMat3:qt(this.isInputBandIdsSwizzled?[0,1,2]:[e,t,0]),scaled:!s}}_getInputBandIds(t){const{visibleBandID:e,infraredBandID:s}=this.functionArguments;return[s,e,0].map(e=>t[e])}_swizzleBandIds(t){const{visibleBandID:e,infraredBandID:s}=this.functionArguments,n=[e,s].map(e=>t.indexOf(e));return n[2]=n[1],this.isInputBandIdsSwizzled=!0,this.swizzledBandSelection=n,!1}};(0,i.Cg)([(0,a.MZ)({json:{write:!0,name:"rasterFunction"}})],$s.prototype,"functionName",void 0),(0,i.Cg)([(0,a.MZ)({type:Ls,json:{write:!0,name:"rasterFunctionArguments"}})],$s.prototype,"functionArguments",void 0),(0,i.Cg)([(0,a.MZ)()],$s.prototype,"rasterArgumentNames",void 0),$s=(0,i.Cg)([(0,a.$K)("esri.layers.raster.functions.NDVIFunction")],$s);const Ks=$s;var Ws;let Hs=Ws=class extends p{constructor(){super(...arguments),this.inputRanges=null,this.outputValues=null,this.noDataRanges=null,this.allowUnmatched=!1,this.isLastInputRangeInclusive=!1}clone(){return new Ws({inputRanges:[...this.inputRanges],outputValues:[...this.outputValues],noDataRanges:[...this.noDataRanges],allowUnmatched:this.allowUnmatched,isLastInputRangeInclusive:this.isLastInputRangeInclusive})}};(0,i.Cg)([(0,a.MZ)({json:{write:!0}})],Hs.prototype,"inputRanges",void 0),(0,i.Cg)([(0,a.MZ)({json:{write:!0}})],Hs.prototype,"outputValues",void 0),(0,i.Cg)([(0,a.MZ)({json:{write:!0}})],Hs.prototype,"noDataRanges",void 0),(0,i.Cg)([(0,a.MZ)({json:{write:!0}})],Hs.prototype,"allowUnmatched",void 0),(0,i.Cg)([(0,a.MZ)({json:{write:!0}})],Hs.prototype,"replacementValue",void 0),(0,i.Cg)([(0,a.MZ)({json:{write:!0}})],Hs.prototype,"isLastInputRangeInclusive",void 0),Hs=Ws=(0,i.Cg)([(0,a.$K)("esri.layers.raster.functions.RemapFunctionArguments")],Hs);const qs=Hs;let Js=class extends w{constructor(){super(...arguments),this.functionName="Remap",this.functionArguments=null,this.rasterArgumentNames=["raster"],this.lookup=null}_bindSourceRasters(){const t=this.sourceRasterInfos[0].clone(),{pixelType:e}=t;t.bandCount=1;const{statistics:s}=t;this._removeStatsHistColormapVAT(t);const{allowUnmatched:n,replacementValue:r,outputValues:o,inputRanges:i,noDataRanges:a,isLastInputRangeInclusive:l}=this.functionArguments,c="unknown"===this.outputPixelType||null==this.outputPixelType;if(this.outputPixelType=this._getOutputPixelType(e),o?.length){const i=s?.[0];if(n&&null==r){let e=i?.min??o[0],s=i?.max??o[0];e=Math.min.apply(null,[...o,e]),s=Math.max.apply(null,[...o,s]),t.statistics=[{min:e,max:s,avg:i?.avg??0,stddev:i?.stddev??-1}]}else{let e=o[0],s=e;for(let t=0;t<o.length;t++)e=e>o[t]?o[t]:e,s=s>o[t]?s:o[t];n&&null!=r&&(e=Math.min(e,r),s=Math.max(s,r)),t.statistics=[{min:e,max:s,avg:i?.avg??0,stddev:i?.stddev??-1}]}if(c){const{min:s,max:i}=t.statistics[0],a=["u8","s8","u16","s16","u32","s32","f32"],l=a.find(t=>{const[e,n]=(0,u.hP)(t);return s>=e&&i<=n})??"f64";o.some(t=>Math.floor(t)!==t)?this.outputPixelType="f64"===l?"f64":"f32":this.outputPixelType=n&&null==r&&a.indexOf(e)>a.indexOf(l)?e:l}}return t.pixelType=this.outputPixelType,this.rasterInfo=t,this.lookup=n?null:(0,Kt.XU)({srcPixelType:e,inputRanges:i,outputValues:o,noDataRanges:a,allowUnmatched:n,isLastInputRangeInclusive:l,outputPixelType:this.outputPixelType}),{success:!0,supportsGPU:(!o||o.length<=Kt.et)&&(!a||a.length<=Kt.et)}}_processPixels(t){const e=t.pixelBlocks?.[0];if(null==e)return null;const{lookup:s,outputPixelType:n}=this;if(s){const t=(0,Kt.eH)(e,{lut:[s.lut],offset:s.offset,outputPixelType:n});return null!=t&&s.mask&&(t.mask=(0,Kt.UK)(e.pixels[0],e.mask,s.mask,s.offset,"u8")),t}const{inputRanges:r,outputValues:o,noDataRanges:i,allowUnmatched:a,isLastInputRangeInclusive:u,replacementValue:l}=this.functionArguments;return(0,Kt.Ew)(e,{inputRanges:r,outputValues:o,noDataRanges:i,outputPixelType:n,allowUnmatched:a,isLastInputRangeInclusive:u,replacementValue:l})}_getWebGLParameters(){const{allowUnmatched:t,noDataRanges:e,isLastInputRangeInclusive:s}=this.functionArguments,n=this.functionArguments.inputRanges??[],r=this.functionArguments.outputValues??[],o=(0,Kt.bL)(n,r,s),i=new Float32Array(2*Kt.et);return i.fill(zs.pq),e?.length&&i.set(e),{allowUnmatched:t,rangeMaps:o,noDataRanges:i,clampRange:(0,u.hP)(this.outputPixelType),replacementValue:this.functionArguments.replacementValue}}};(0,i.Cg)([(0,a.MZ)({json:{write:!0,name:"rasterFunction"}})],Js.prototype,"functionName",void 0),(0,i.Cg)([(0,a.MZ)({type:qs,json:{write:!0,name:"rasterFunctionArguments"}})],Js.prototype,"functionArguments",void 0),(0,i.Cg)([(0,a.MZ)()],Js.prototype,"rasterArgumentNames",void 0),(0,i.Cg)([(0,a.MZ)({json:{write:!0}})],Js.prototype,"lookup",void 0),Js=(0,i.Cg)([(0,a.$K)("esri.layers.raster.functions.RemapFunction")],Js);const Xs=Js;var Qs;let Ys=Qs=class extends Is{readColorRamp(t){if("string"==typeof t){const e=ge.kH.jsonValues.find(e=>e.toLowerCase()===t.toLowerCase());return e?(0,ge.M5)(ge.kH.fromJSON(e)):null}return"toJSON"in t?t.toJSON():t}clone(){return new Qs({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,i.Cg)([(0,a.MZ)({json:{write:!0}})],Ys.prototype,"colorRamp",void 0),(0,i.Cg)([(0,ye.w)("colorRamp")],Ys.prototype,"readColorRamp",null),(0,i.Cg)([(0,a.MZ)({type:[[Number]],json:{write:!0}})],Ys.prototype,"colormap",void 0),Ys=Qs=(0,i.Cg)([(0,a.$K)("esri.layers.raster.functions.ShadedReliefFunctionArguments")],Ys);const tn=Ys;let en=class extends w{constructor(){super(...arguments),this.functionName="ShadedRelief",this.functionArguments=null,this.rasterArgumentNames=["raster"],this.isGCS=!1}_bindSourceRasters(){const t=this.sourceRasterInfos[0];if(t.bandCount>1)return{success:!1,supportsGPU:!1,error:"shadedrelief-function: source data must be single band"};let{colorRamp:e,colormap:s}=this.functionArguments;if(!e&&!s?.length)return{success:!1,supportsGPU:!1,error:"shadedrelief-function: a color ramp argument must be specified"};this.outputPixelType=this._getOutputPixelType("u8");const n=t.clone();this._removeStatsHistColormapVAT(n),n.pixelType=this.outputPixelType,n.bandCount=3,n.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=n,this.isGCS=n.spatialReference?.isGeographic??!1,s?.length||(s=(0,ge.R8)(e,{interpolateAlpha:!0}));const{indexedColormap:r,offset:o}=(0,Kt.zg)({colormap:s});if(!r?.length)return{success:!1,supportsGPU:!1,error:"shadedrelief-function: a valid colorramp is required"};const i=(0,ge.S2)(r);return this.lookup={indexedColormap:r,offset:o,hsvMap:i},{success:!0,supportsGPU:(0,Re.WN)(r)}}_processPixels(t){const e=t.pixelBlocks?.[0];if(!e||!this.lookup)return null;let s=t.primaryPixelSizes?.[0];if(null==s){const{extent:n}=t;s=n?{x:n.width/e.width,y:n.height/e.height}:{x:1,y:1}}const n=(0,zt.PP)(this.functionArguments,s,this.isGCS),r=(0,zt.fw)(e,n),o=this.sourceRasterInfos[0].statistics?.[0]??{min:0,max:8e3};return(0,zt.SC)(r,e,this.lookup.hsvMap,o),r.pixelType=this.outputPixelType,r}_getWebGLParameters(){const t=(0,zt.PP)(this.functionArguments,{x:1,y:1},this.isGCS),e=(0,zt.ng)(t),{slopeType:s,zFactor:n,pixelSizeFactor:r,pixelSizePower:o}=this.functionArguments,i="scaled"===s,{indexedColormap:a,offset:l}=this.lookup,c=this.sourceRasterInfos[0].statistics?.[0],p=(0,u.zw)(this.outputPixelType);return{...e,indexedColormap:a,offset:l,zFactor:n,gcsFactor:this.isGCS?zt.rk:1,pixelSizeFactor:i?r:0,pixelSizePower:i?o:0,minValue:c?.min??0,maxValue:c?.max??8e3,isOutputRounded:p}}_getNeighborhoodSize(){return{rows:3,cols:3}}};(0,i.Cg)([(0,a.MZ)({json:{write:!0,name:"rasterFunction"}})],en.prototype,"functionName",void 0),(0,i.Cg)([(0,a.MZ)({type:tn,json:{write:!0,name:"rasterFunctionArguments"}})],en.prototype,"functionArguments",void 0),(0,i.Cg)([(0,a.MZ)()],en.prototype,"rasterArgumentNames",void 0),(0,i.Cg)([(0,a.MZ)({json:{write:!0}})],en.prototype,"isGCS",void 0),(0,i.Cg)([(0,a.MZ)({json:{write:!0}})],en.prototype,"lookup",void 0),en=(0,i.Cg)([(0,a.$K)("esri.layers.raster.functions.ShadedReliefFunction")],en);const sn=en;var nn;const rn=new Dt.J({1:"degree",2:"percent-rise",3:"adjusted"},{useNumericKeys:!0});let on=nn=class extends p{constructor(){super(...arguments),this.slopeType="degree",this.zFactor=1,this.pixelSizePower=.664,this.pixelSizeFactor=.024,this.removeEdgeEffect=!1}clone(){return new nn({slopeType:this.slopeType,zFactor:this.zFactor,pixelSizePower:this.pixelSizePower,pixelSizeFactor:this.pixelSizeFactor,removeEdgeEffect:this.removeEdgeEffect,raster:this.raster})}};(0,i.Cg)([(0,Qt.e)(rn)],on.prototype,"slopeType",void 0),(0,i.Cg)([(0,a.MZ)({type:Number,json:{write:!0}})],on.prototype,"zFactor",void 0),(0,i.Cg)([(0,a.MZ)({type:Number,json:{name:"psPower",write:!0}})],on.prototype,"pixelSizePower",void 0),(0,i.Cg)([(0,a.MZ)({type:Number,json:{name:"psZFactor",write:!0}})],on.prototype,"pixelSizeFactor",void 0),(0,i.Cg)([(0,a.MZ)({type:Boolean,json:{write:!0}})],on.prototype,"removeEdgeEffect",void 0),on=nn=(0,i.Cg)([(0,a.$K)("esri.layers.raster.functions.SlopeFunctionArguments")],on);const an=on;let un=class extends w{constructor(){super(...arguments),this.functionName="Slope",this.functionArguments=null,this.rasterArgumentNames=["raster"],this.isGCS=!1}_bindSourceRasters(){this.outputPixelType=this._getOutputPixelType("f32");const t=this.sourceRasterInfos[0].clone();return t.pixelType=this.outputPixelType,this._removeStatsHistColormapVAT(t),t.statistics="percent-rise"!==this.functionArguments.slopeType?[{min:0,max:90,avg:1,stddev:1}]:null,t.bandCount=1,this.rasterInfo=t,this.isGCS=t.spatialReference?.isGeographic??!1,{success:!0,supportsGPU:!0}}_processPixels(t){const e=t.pixelBlocks?.[0];if(null==e)return null;const{zFactor:s,slopeType:n,pixelSizePower:r,pixelSizeFactor:o}=this.functionArguments,{isGCS:i}=this,{extent:a,primaryPixelSizes:u}=t,l=u?.[0],c=l??(a?{x:a.width/e.width,y:a.height/e.height}:{x:1,y:1});return(0,zt.yy)(e,{zFactor:s,slopeType:n,pixelSizePower:r,pixelSizeFactor:o,isGCS:i,resolution:c})}_getWebGLParameters(){const{zFactor:t,slopeType:e,pixelSizeFactor:s,pixelSizePower:n}=this.functionArguments;return{zFactor:this.isGCS&&t>=1?t*zt.rk:t,slopeType:e,pixelSizeFactor:s??0,pixelSizePower:n??0,isOutputRounded:(0,u.zw)(this.outputPixelType)}}_getNeighborhoodSize(){return{rows:3,cols:3}}};(0,i.Cg)([(0,a.MZ)({json:{write:!0,name:"rasterFunction"}})],un.prototype,"functionName",void 0),(0,i.Cg)([(0,a.MZ)({type:an,json:{write:!0,name:"rasterFunctionArguments"}})],un.prototype,"functionArguments",void 0),(0,i.Cg)([(0,a.MZ)()],un.prototype,"rasterArgumentNames",void 0),(0,i.Cg)([(0,a.MZ)({json:{write:!0}})],un.prototype,"isGCS",void 0),un=(0,i.Cg)([(0,a.$K)("esri.layers.raster.functions.SlopeFunction")],un);const ln=un;var cn;let pn=cn=class extends p{clone(){return new cn({conversionMatrix:[...this.conversionMatrix],raster:this.raster})}};(0,i.Cg)([(0,a.MZ)({type:[Number],json:{write:!0}})],pn.prototype,"conversionMatrix",void 0),pn=cn=(0,i.Cg)([(0,a.$K)("esri.layers.raster.functions.SpectralConversionFunctionArguments")],pn);const hn=pn;let mn=class extends w{constructor(){super(...arguments),this.functionName="SpectralConversion",this.functionArguments=null,this.rasterArgumentNames=["raster"]}_bindSourceRasters(){const 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:3===t.bandCount&&9===this.functionArguments.conversionMatrix.length}}_processPixels(t){const e=t.pixelBlocks?.[0];return null==e?null:function(t,e,s){const{width:n,height:r,mask:o,bandMasks:i}=t,a=i?.length?g.A.combineBandMasks(i):o,u=[],l=t.pixels.length;for(let n=0;n<e.length/l;n++){const r=xs(t,e.slice(n*l,(n+1)*l),s,a);u.push(r)}const c=new g.A({width:n,height:r,pixels:u,pixelType:s,mask:a});return c.updateStatistics(),c}(e,this.functionArguments.conversionMatrix,this.outputPixelType)}_getWebGLParameters(){const t=(0,u.hP)(this.outputPixelType),[e,s,n,r,o,i,a,l,c]=this.functionArguments.conversionMatrix;return{weights:[e,r,a,s,o,l,n,i,c],clampRange:t}}};(0,i.Cg)([(0,a.MZ)({json:{write:!0,name:"rasterFunction"}})],mn.prototype,"functionName",void 0),(0,i.Cg)([(0,a.MZ)({type:hn,json:{write:!0,name:"rasterFunctionArguments"}})],mn.prototype,"functionArguments",void 0),(0,i.Cg)([(0,a.MZ)()],mn.prototype,"rasterArgumentNames",void 0),mn=(0,i.Cg)([(0,a.$K)("esri.layers.raster.functions.SpectralConversionFunction")],mn);const dn=mn,gn=new Dt.J({1:"min",2:"max",3:"mean",4:"stddev",5:"median",6:"majority",7:"minority"},{useNumericKeys:!0});function fn(t,e){const{fillNoDataOnly:s}=e,{band:n,width:r,height:o,mask:i,outBand:a}=t;if(s&&!i)return void a.set(n);const{statisticsType:u,kernelRows:l,kernelCols:c}=e,p="stddev"===u,h=r*o,m=new Float64Array(h),d=new Float64Array(h),g=new Uint32Array(h);for(let t=0;t<o;t++){const e=t*r;let s=0,o=0,a=0;for(let t=0;t<c;t++)i&&!i[e+t]||(s+=n[e+t],p&&(o+=n[e+t]**2),a++);m[e]=s,d[e]=o,g[e]=a;for(let t=1;t<=r-c;t++){const r=e+t-1,u=r+c;i?(i[r]&&(a--,s-=n[r],p&&(o-=n[r]**2)),i[u]&&(a++,s+=n[u],p&&(o+=n[u]**2))):(s-=n[r],s+=n[u],p&&(o-=n[r]**2,o+=n[u]**2)),m[e+t]=s,g[e+t]=a,p&&(d[e+t]=o)}}const f=new Float64Array(h),y=new Float64Array(h),x=new Uint32Array(h),w=l*r;for(let t=0;t<=r-c;t++){let e=0,s=0,n=0;for(let o=0;o<l;o++){const i=o*r+t;e+=m[i],n+=g[i],p&&(s+=d[i])}f[t]=e,y[t]=s,x[t]=n;for(let i=1;i<=o-l;i++){const o=(i-1)*r+t,a=o+w;e-=m[o],e+=m[a],n-=g[o],n+=g[a],p&&(s-=d[o],s+=d[a]),f[i*r+t]=e,y[i*r+t]=s,x[i*r+t]=n}}const A=Math.floor(l/2),v=Math.floor(c/2);for(let t=A;t<o-A;t++){const e=t*r;for(let n=v;n<r-v;n++){const o=(t-A)*r+n-v,u=x[o];if(0===u||s&&(!i||i[e+n]))continue;const l=f[o]/u,c=p?Math.sqrt((y[o]-f[o]*l)/u):l;a[e+n]=c,i&&(i[e+n]=255)}}}function yn(t,e){const{fillNoDataOnly:s}=e,{band:n,width:r,height:o,mask:i,outBand:a}=t;if(s&&!i)return void a.set(n);const{kernelRows:u,kernelCols:l,statisticsType:c}=e,p=Math.floor(u/2),h=Math.floor(l/2),m="min"===c,d=a.slice(),g=new Uint32Array(r*o);for(let t=p;t<o-p;t++){const e=t*r;for(let t=h;t<r-h;t++){let s=m?Number.MAX_VALUE:-Number.MAX_VALUE,o=0;for(let a=0;a<u;a++)for(let u=0;u<l;u++){const l=e+t+(a-p)*r+u-h;i&&!i[l]||(s=m?Math.min(s,n[l]):Math.max(s,n[l]),o++)}i?(d[e+t]=0===o?0:s,g[e+t]=o):a[e+t]=0===o?0:s}}if(i)for(let t=p;t<o-p;t++){const e=t*r;for(let t=h;t<r-h;t++)if(g[e+t]){if(s&&i[e+t])continue;a[e+t]=d[e+t],i[e+t]=255}}}function xn(t,e){const{fillNoDataOnly:s}=e,{band:n,width:r,height:o,mask:i,outBand:a}=t;if(s&&!i)return void a.set(n);const{kernelRows:u,kernelCols:l}=e,c=Math.floor(u/2),p=Math.floor(l/2),h=a.slice(),m=new Uint32Array(r*o);for(let t=c;t<o-c;t++){const e=t*r;for(let t=p;t<r-p;t++){if(s&&i?.[e+t])continue;const o=[];for(let s=0;s<u;s++)for(let a=0;a<l;a++){const u=e+t+(s-c)*r+a-p;i&&!i[u]||o.push(n[u])}o.length&&(o.sort((t,e)=>t-e),i?(h[e+t]=o[Math.floor((o.length-1)/2)],m[e+t]=o.length):a[e+t]=o[Math.floor((o.length-1)/2)])}}if(i)for(let t=c;t<o-c;t++){const e=t*r;for(let t=p;t<r-p;t++)if(m[e+t]){if(s&&i[e+t])continue;a[e+t]=h[e+t],i[e+t]=255}}}function wn(t,e){const{fillNoDataOnly:s}=e,{band:n,width:r,height:o,mask:i,outBand:a}=t;if(s&&!i)return void a.set(n);const{kernelRows:u,kernelCols:l}=e,c=Math.floor(u/2),p=Math.floor(l/2),h="majority"===e.statisticsType,m=u*l,d=a.slice(),g=new Uint32Array(r*o);for(let t=c;t<o-c;t++){const e=t*r;for(let t=p;t<r-p;t++){if(s&&i?.[e+t])continue;const o=new Map;for(let s=0;s<u;s++)for(let a=0;a<l;a++){const u=e+t+(s-c)*r+a-p;if(i&&!i[u])continue;const l=n[u];o.set(l,o.has(l)?o.get(l)+1:1)}if(0===o.size)continue;let f=0,y=0,x=h?0:m+1;for(const t of o.keys())y=o.get(t),h===y>x&&(x=y,f=t);i?(d[e+t]=f,g[e+t]=o.size):a[e+t]=f}}if(i)for(let t=c;t<o-c;t++){const e=t*r;for(let t=p;t<r-p;t++)if(g[e+t]){if(s&&i[e+t])continue;a[e+t]=d[e+t],i[e+t]=255}}}var An;let vn=An=class extends p{constructor(){super(...arguments),this.rows=3,this.cols=3,this.fillNoDataOnly=!1,this.statisticsType="min"}clone(){return new An({rows:this.rows,cols:this.cols,fillNoDataOnly:this.fillNoDataOnly,statisticsType:this.statisticsType,raster:(0,o.o8)(this.raster)})}};(0,i.Cg)([(0,a.MZ)({json:{write:!0,read:{source:["kernelRows","rows"],reader:(t,e)=>Number(t??e?.kernelRows??3)}}})],vn.prototype,"rows",void 0),(0,i.Cg)([(0,a.MZ)({json:{write:!0,read:{source:["kernelCols","cols"],reader:(t,e)=>Number(t??e?.kernelCols??3)}}})],vn.prototype,"cols",void 0),(0,i.Cg)([(0,a.MZ)({json:{write:!0}})],vn.prototype,"fillNoDataOnly",void 0),(0,i.Cg)([(0,a.MZ)({json:{read:{source:["statisticsType","type"],reader:(t,e)=>gn.fromJSON(e?.statisticsType??e?.type)??"min"},write:{target:"type"}}}),(0,Qt.e)(gn)],vn.prototype,"statisticsType",void 0),vn=An=(0,i.Cg)([(0,a.$K)("esri.layers.raster.functions.StatisticsFunctionArguments")],vn);const Cn=vn;let bn=class extends w{constructor(){super(...arguments),this.functionName="Statistics",this.rasterArgumentNames=["raster"]}_bindSourceRasters(){const{type:t}=this.functionArguments.toJSON();if(t<1||t>7)return{success:!1,supportsGPU:!1,error:`statistics-function: the given statistics type is not supported ${t}`};const e=this.sourceRasterInfos[0];this.outputPixelType=this._getOutputPixelType(e.pixelType);const s=e.clone();s.pixelType=this.outputPixelType;const{statisticsType:n}=this.functionArguments;return"stddev"===n&&this._removeStatsHistColormapVAT(s),this.rasterInfo=s,{success:!0,supportsGPU:s.bandCount<=3&&t<5}}_processPixels(t){const e=t.pixelBlocks?.[0];if(null==e)return e;const{statisticsType:s,rows:n,cols:r,fillNoDataOnly:o}=this.functionArguments;return function(t,e){const{mask:s}=t,{fillNoDataOnly:n}=e;if(n&&!s)return t;const{pixels:r,width:o,height:i,bandMasks:a,pixelType:u}=t,l=r.length,c=o*i,p=[],{kernelRows:h,kernelCols:m,statisticsType:d,mirrorEdges:f}=e;if(n&&!s)return t;const y=e.outputPixelType??u,x=[];for(let t=0;t<l;t++){const u=r[t],l=g.A.createEmptyBand(y,c);n&&l.set(u);const w=a?.[t]??s,A=w?.slice()??null,v={band:u,width:o,height:i,mask:A,outBand:l};switch(d){case"min":case"max":yn(v,e);break;case"mean":case"stddev":fn(v,e);break;case"median":xn(v,e);break;case"majority":case"minority":wn(v,e)}f&&!n&&Qe(l,o,i,h,m),p.push(l),A&&x.push(A)}let w=x[0]??s;x.length!==l&&(x.length=0),l>1&&a?.length&&(w=g.A.combineBandMasks(a));const A=new g.A({pixelType:y,width:o,height:i,pixels:p,bandMasks:a&&x.length?x:null,mask:w});return A.updateStatistics(),A}(e,{kernelRows:n,kernelCols:r,fillNoDataOnly:o,outputPixelType:this.outputPixelType,statisticsType:s,mirrorEdges:!0})}_getWebGLParameters(){const{rows:t,cols:e,statisticsType:s,fillNoDataOnly:n}=this.functionArguments;return{fillNoDataOnly:n,kernelRows:t,kernelCols:e,statisticsType:s,clampRange:(0,u.hP)(this.outputPixelType)}}_getNeighborhoodSize(){const{rows:t,cols:e}=this.functionArguments;return{rows:t,cols:e}}};(0,i.Cg)([(0,a.MZ)({json:{write:!0,name:"rasterFunction"}})],bn.prototype,"functionName",void 0),(0,i.Cg)([(0,a.MZ)({type:Cn,json:{write:!0,name:"rasterFunctionArguments"}})],bn.prototype,"functionArguments",void 0),(0,i.Cg)([(0,a.MZ)()],bn.prototype,"rasterArgumentNames",void 0),bn=(0,i.Cg)([(0,a.$K)("esri.layers.raster.functions.StatisticsFunction")],bn);const Mn=bn;var Tn;let Pn=Tn=class extends p{constructor(){super(...arguments),this.statistics=null,this.histograms=null}readStatistics(t,e){if(!t?.length)return null;const s=[];return t.forEach(t=>{const e={min:t.min,max:t.max,avg:t.avg??t.mean,stddev:t.stddev??t.standardDeviation};s.push(e)}),s}writeStatistics(t,e,s){if(!t?.length)return;const n=[];t.forEach(t=>{const e={...t,mean:t.avg,standardDeviation:t.stddev};delete e.avg,delete e.stddev,n.push(e)}),e[s]=n}clone(){return new Tn({statistics:(0,o.o8)(this.statistics),histograms:(0,o.o8)(this.histograms)})}};(0,i.Cg)([(0,a.MZ)({json:{write:!0}})],Pn.prototype,"statistics",void 0),(0,i.Cg)([(0,ye.w)("statistics")],Pn.prototype,"readStatistics",null),(0,i.Cg)([(0,Se.K)("statistics")],Pn.prototype,"writeStatistics",null),(0,i.Cg)([(0,a.MZ)({json:{write:!0}})],Pn.prototype,"histograms",void 0),Pn=Tn=(0,i.Cg)([(0,a.$K)("esri.layers.raster.functions.StatisticsHistogramFunctionArguments")],Pn);const Nn=Pn;let In=class extends w{constructor(){super(...arguments),this.functionName="StatisticsHistogram",this.functionArguments=null,this.rasterArgumentNames=["raster"],this.isNoopProcess=!0}_bindSourceRasters(){const t=this.sourceRasterInfos[0];this.outputPixelType=this._getOutputPixelType("u8");const e=t.clone(),{statistics:s,histograms:n}=this.functionArguments;return n&&(e.histograms=n),s&&(e.statistics=s),this.rasterInfo=e,{success:!0,supportsGPU:!0}}_processPixels(t){return t.pixelBlocks?.[0]}};(0,i.Cg)([(0,a.MZ)({json:{write:!0,name:"rasterFunction"}})],In.prototype,"functionName",void 0),(0,i.Cg)([(0,a.MZ)({type:Nn,json:{write:!0,name:"rasterFunctionArguments"}})],In.prototype,"functionArguments",void 0),(0,i.Cg)([(0,a.MZ)()],In.prototype,"rasterArgumentNames",void 0),(0,i.Cg)([(0,a.MZ)({json:{write:!0}})],In.prototype,"indexedColormap",void 0),(0,i.Cg)([(0,a.MZ)()],In.prototype,"isNoopProcess",void 0),In=(0,i.Cg)([(0,a.$K)("esri.layers.raster.functions.StatisticsHistogramFunction")],In);const Rn=In;var Fn;const kn=new Dt.J({0:"none",3:"standard-deviation",4:"histogram-equalization",5:"min-max",6:"percent-clip",9:"sigmoid"},{useNumericKeys:!0});let _n=Fn=class extends p{constructor(){super(...arguments),this.computeGamma=!1,this.dynamicRangeAdjustment=!1,this.gamma=[],this.histograms=null,this.statistics=null,this.stretchType="none",this.useGamma=!1}writeStatistics(t,e,s){t?.length&&(Array.isArray(t[0])||(t=t.map(t=>[t.min,t.max,t.avg,t.stddev])),e[s]=t)}clone(){return new Fn({stretchType:this.stretchType,outputMin:this.outputMin,outputMax:this.outputMax,useGamma:this.useGamma,computeGamma:this.computeGamma,statistics:(0,o.o8)(this.statistics),gamma:(0,o.o8)(this.gamma),sigmoidStrengthLevel:this.sigmoidStrengthLevel,numberOfStandardDeviations:this.numberOfStandardDeviations,minPercent:this.minPercent,maxPercent:this.maxPercent,histograms:(0,o.o8)(this.histograms),dynamicRangeAdjustment:this.dynamicRangeAdjustment,raster:this.raster})}};(0,i.Cg)([(0,a.MZ)({type:Boolean,json:{write:!0}})],_n.prototype,"computeGamma",void 0),(0,i.Cg)([(0,a.MZ)({type:Boolean,json:{name:"dra",write:!0}})],_n.prototype,"dynamicRangeAdjustment",void 0),(0,i.Cg)([(0,a.MZ)({type:[Number],json:{write:!0}})],_n.prototype,"gamma",void 0),(0,i.Cg)([(0,a.MZ)()],_n.prototype,"histograms",void 0),(0,i.Cg)([(0,a.MZ)({type:Number,json:{write:!0}})],_n.prototype,"maxPercent",void 0),(0,i.Cg)([(0,a.MZ)({type:Number,json:{write:!0}})],_n.prototype,"minPercent",void 0),(0,i.Cg)([(0,a.MZ)({type:Number,json:{write:!0}})],_n.prototype,"numberOfStandardDeviations",void 0),(0,i.Cg)([(0,a.MZ)({type:Number,json:{name:"max",write:!0}})],_n.prototype,"outputMax",void 0),(0,i.Cg)([(0,a.MZ)({type:Number,json:{name:"min",write:!0}})],_n.prototype,"outputMin",void 0),(0,i.Cg)([(0,a.MZ)({type:Number,json:{write:!0}})],_n.prototype,"sigmoidStrengthLevel",void 0),(0,i.Cg)([(0,a.MZ)({json:{type:[[Number]],write:!0}})],_n.prototype,"statistics",void 0),(0,i.Cg)([(0,Se.K)("statistics")],_n.prototype,"writeStatistics",null),(0,i.Cg)([(0,Qt.e)(kn)],_n.prototype,"stretchType",void 0),(0,i.Cg)([(0,a.MZ)({type:Boolean,json:{write:!0}})],_n.prototype,"useGamma",void 0),_n=Fn=(0,i.Cg)([(0,a.$K)("esri.layers.raster.functions.StretchFunctionArguments")],_n);const Sn=_n;let Bn=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;const t=this.sourceRasterInfos[0],{pixelType:e}=t,{functionArguments:s}=this,{dynamicRangeAdjustment:n,gamma:r,useGamma:o}=s;if(!n&&["u8","u16","s8","s16"].includes(e)){const n=(0,qe.DP)(s.toJSON(),{rasterInfo:t}),i=(0,u.zw)(this.outputPixelType)?"round":"float";this.lookup=(0,qe.RP)({pixelType:e,...n,gamma:o?r:null,rounding:i}),this.cutOffs=n}else n||(this.cutOffs=(0,qe.DP)(s.toJSON(),{rasterInfo:t}));this.outputPixelType=this._getOutputPixelType(e);const i=t.clone();i.pixelType=this.outputPixelType,this._removeStatsHistColormapVAT(i),"u8"===this.outputPixelType&&(i.keyProperties.DataType="processed");const{outputMin:a=0,outputMax:l=255}=this.functionArguments;i.statistics=[];for(let t=0;t<i.bandCount;t++)i.statistics[t]={min:a,max:l};return this.rasterInfo=i,{success:!0,supportsGPU:!n}}_processPixels(t,e){const s=t.pixelBlocks?.[0];if(null==s)return s;const{lookup:n}=this;if(n)return(0,Kt.eH)(s,{...n,outputPixelType:this.rasterInfo.pixelType});const{functionArguments:r}=this,o=e?.stretchCutoff??this.cutOffs??(0,qe.DP)(r.toJSON(),{rasterInfo:this.sourceRasterInfos[0],pixelBlock:s}),i=r.useGamma?r.gamma:null;return(0,qe._N)(s,{...o,gamma:i,outputPixelType:this.outputPixelType})}_getWebGLParameters(){const{outputMin:t=0,outputMax:e=255,gamma:s,useGamma:n}=this.functionArguments,r=this.rasterInfo.bandCount>=2?3:1,o=n&&s?.length?(0,qe.Nh)(r,s):[1,1,1],{minCutOff:i,maxCutOff:a}=this.cutOffs??{minCutOff:[0,0,0],maxCutOff:[255,255,255]};1===i.length&&(i[1]=i[2]=i[0],a[1]=a[2]=a[0]);const l=a.map((s,n)=>(e-t)/(a[n]-i[n])),c=(0,u.zw)(this.outputPixelType),p=n&&s?[s[0],s[1]??s[0],s[2]??s[0]]:[1,1,1],h=n?[o[0],o[1]??o[0],o[2]??o[0]]:[1,1,1];return{bandCount:r,minOutput:t,maxOutput:e,minCutOff:i,maxCutOff:a,factor:l,useGamma:n,gamma:p,gammaCorrection:h,stretchType:this.functionArguments.stretchType,isOutputRounded:c,type:"stretch"}}};(0,i.Cg)([(0,a.MZ)({json:{write:!0,name:"rasterFunction"}})],Bn.prototype,"functionName",void 0),(0,i.Cg)([(0,a.MZ)({type:Sn,json:{write:!0,name:"rasterFunctionArguments"}})],Bn.prototype,"functionArguments",void 0),(0,i.Cg)([(0,a.MZ)()],Bn.prototype,"rasterArgumentNames",void 0),(0,i.Cg)([(0,a.MZ)({json:{write:!0}})],Bn.prototype,"lookup",void 0),(0,i.Cg)([(0,a.MZ)({json:{write:!0}})],Bn.prototype,"cutOffs",void 0),Bn=(0,i.Cg)([(0,a.$K)("esri.layers.raster.functions.StretchFunction")],Bn);const jn=Bn;var Zn;let zn=Zn=class extends p{constructor(){super(...arguments),this.attributeTableAsRecordSet=null}clone(){return new Zn({attributeTableAsRecordSet:(0,o.o8)(this.attributeTableAsRecordSet)})}};(0,i.Cg)([(0,a.MZ)({json:{write:!0}})],zn.prototype,"attributeTableAsRecordSet",void 0),zn=Zn=(0,i.Cg)([(0,a.$K)("esri.layers.raster.functions.TableFunctionArguments")],zn);const Gn=zn;let On=class extends w{constructor(){super(...arguments),this.functionName="Table",this.functionArguments=null,this.rasterArgumentNames=["raster"],this.isNoopProcess=!0}_bindSourceRasters(){const t=this.sourceRasterInfos[0];if(t.bandCount>1||t.pixelType.startsWith("f"))return{success:!1,supportsGPU:!1,error:"table-function: Source data must be single band and integer pixel type."};const{attributeTableAsRecordSet:e}=this.functionArguments;if(!e)return{success:!1,supportsGPU:!1,error:"table-function: Missing attributeTableAsRecordSet argument."};this.outputPixelType=this._getOutputPixelType(t.pixelType);const s=t.clone();return s.pixelType=this.outputPixelType,s.bandCount=1,"thematic"!==s.dataType&&(s.keyProperties=s.keyProperties?{...s.keyProperties,DataType:"thematic"}:{DataType:"thematic"}),this.rasterInfo=s,{success:!0,supportsGPU:!0}}_processPixels(t){return t.pixelBlocks?.[0]}};(0,i.Cg)([(0,a.MZ)({json:{write:!0,name:"rasterFunction"}})],On.prototype,"functionName",void 0),(0,i.Cg)([(0,a.MZ)({type:Gn,json:{write:!0,name:"rasterFunctionArguments"}})],On.prototype,"functionArguments",void 0),(0,i.Cg)([(0,a.MZ)()],On.prototype,"rasterArgumentNames",void 0),(0,i.Cg)([(0,a.MZ)()],On.prototype,"isNoopProcess",void 0),On=(0,i.Cg)([(0,a.$K)("esri.layers.raster.functions.TableFunction")],On);const Dn=On,En=new Map;function Vn(t,e){const{rasterFunctionArguments:s}=t;s&&(s.rasters||[s.raster,s.raster2]).forEach(t=>{t&&"number"!=typeof t&&("string"==typeof t?t.startsWith("http")&&(e.includes(t)||e.push(t)):"rasterFunctionArguments"in t&&Vn(t,e))})}function Un(t,e){e=e??{};try{if("function"in(t=(0,o.o8)(t))&&"arguments"in t&&t.arguments){const s=Jn(t,new Map,e);if(Qn(s),!s.renderingRule)throw new r.A("raster-function-helper","Unsupported raster function json.");t=s.renderingRule}if("rasterFunction"in t){const s=Kn(t=$n(t),e);return s.isRoot=!0,s}}catch{}throw new r.A("raster-function-helper","unsupported raster function json.")}function Ln(t){return!!(t&&"object"==typeof t&&t.rasterFunction&&t.rasterFunctionArguments)}function $n(t){const{rasterFunction:e,rasterFunctionArguments:s}=t,n={};for(const t in s){let e=s[t];const r=t.toLowerCase();if("rasters"===r&&Array.isArray(e))n.rasters=e.map(t=>Ln(t)?$n(t):t);else switch(Ln(e)&&(e=$n(e)),r){case"dra":n.dra=e;break;case"pspower":n.psPower=e;break;case"pszfactor":n.psZFactor=e;break;case"bandids":n.bandIds=e;break;default:n[t[0].toLowerCase()+t.slice(1)]=e}}return"Local"!==e||n.rasters?.length||(n.rasters=["$$"]),{...t,rasterFunctionArguments:n}}function Kn(t,e){const{rasterFunction:s,rasterFunctionArguments:n}=t,o=t.outputPixelType?.toLowerCase();if(null==s||!En.has(s))throw new r.A("raster-function-helper",`unsupported raster function: ${s}`);const i=En.get(s),a=("function"==typeof i.ctor?i.ctor:i.ctor.default).fromJSON({...t,outputPixelType:o}),{rasterArgumentNames:u}=a,l=[],c=function(t,e){return"rasters"===e[0]&&Array.isArray(t.rasters)?t.rasters:e.map(e=>t[e])}(n,u),p="rasters"===u[0]||u.length>1,h=[];for(let t=0;t<c.length;t++){const s=c[t];let n;null==s||"string"==typeof s&&s.startsWith("$")?l.push(e?.raster):"string"==typeof s?e[s]&&l.push(e[s]):"number"!=typeof s&&"rasterFunction"in s&&(n=Kn(s,e),p||(a.functionArguments[u[t]]=n),l.push(n)),p&&h.push(n??s)}if(p&&("rasters"===u[0]?a.functionArguments.rasters=h:u.forEach((t,e)=>{a.functionArguments[t]=h[e]})),e){a.sourceRasters=l;const t=e.raster?.url;t&&(a.mainPrimaryRasterId=t)}return a}function Wn(t,e){if(t&&e)for(const s in t){const n=t[s];n&&"object"==typeof n&&"type"in n&&("RasterFunctionTemplate"===n.type?Wn(n.arguments,e):"RasterFunctionVariable"===n.type&&null!=e[n.name]&&(n.value=e[n.name]))}}function Hn(t,e){if(!t||"object"!=typeof t)return t;const{value:s}=t;if(!s||"object"!=typeof s)return t.isDataset?"$$":s;if(Array.isArray(s))return 0===s.length?[]:s.map(t=>t&&"object"==typeof t&&"RasterFunctionVariable"===t.type?Hn(t,e):t);if("value"in s&&["number","string","boolean"].includes(typeof s.value))return s.value;if(t.isDataset&&"Scalar"!==s.type)return"$$";if(!("type"in s))return s;let n=s;switch(s.type){case"Scalar":n=s.value;break;case"AlgorithmicColorRamp":n=qn(s);break;case"MultiPartColorRamp":n={type:"multipart",colorRamps:s.ArrayOfColorRamp.map(qn)};break;case"ArgumentArray":if(s.elements?.length&&"RasterStatistics"!==s.elements[0].type){const t=[];for(let n=0;n<s.elements.length;n++){const o=s.elements[n],{type:i}=o;if(i)if("RasterFunctionTemplate"===i){const{renderingRule:s}=Jn(o,e);t.push(s),null!=o._object_id&&e.set(o._object_id,s)}else{if("RasterFunctionVariable"!==i)throw new r.A("raster-function-helper","unsupported raster function json.");{const s=Hn(o,e);t.push(s),null!=o._object_id&&e.set(o._object_id,s)}}else t.push(o)}n=t}else n=s.elements}return null!=s._object_id&&e.set(s._object_id,n),n}function qn(t){const e=t.algorithm??"esriHSVAlgorithm";let{FromColor:s,ToColor:r}=t;if(!Array.isArray(s)){const{r:t,g:e,b:r}=(0,n.$)({h:s.Hue,s:s.Saturation,v:s.Value});s=[t,e,r,s.AlphaValue]}if(!Array.isArray(r)){const{r:t,g:e,b:s}=(0,n.$)({h:r.Hue,s:r.Saturation,v:r.Value});r=[t,e,s,r.AlphaValue]}return{type:"algorithmic",algorithm:e,fromColor:s,toColor:r}}function Jn(t,e,s){s&&Wn(t,s);const n={renderingRule:{},templates:e};return Xn(t,n),n}function Xn(t,e){if(!t||!e.renderingRule)return;const{renderingRule:s,templates:n}=e,{function:r,arguments:o,_object_id:i}=t;if(!r||!o)return;null!=i&&n.set(i,s),s.rasterFunction=r.type.replace("Function",""),s.outputPixelType=r.pixelType;const a={};s.rasterFunctionArguments=a;for(const t in o){if("type"===t||"object_id"===t||"_object_ref_id"===t)continue;const e=o[t];e&&"object"==typeof e&&"type"in e&&("RasterFunctionTemplate"===e.type||"RasterFunctionVariable"===e.type)?("RasterFunctionVariable"===e.type?a[t]=Hn(e,n):(s.rasterFunctionArguments[t]={},Xn(e,{renderingRule:s.rasterFunctionArguments[t],templates:n})),null!=e._object_id&&n.set(e._object_id,a[t])):a[t]=e}switch(a.DEM&&!a.Raster&&(a.Raster=a.DEM,delete a.DEM),s.rasterFunction){case"Stretch":!function(t){t.Statistics?.length&&"object"==typeof t.Statistics&&(t.Statistics=t.Statistics.map(t=>[t.min,t.max,t.mean,t.standardDeviation])),null!=t.NumberOfStandardDeviation&&(t.NumberOfStandardDeviations=t.NumberOfStandardDeviation,delete t.NumberOfStandardDeviation)}(a);break;case"Colormap":!function(t){"randomcolorramp"===t.ColorRamp?.type?.toLowerCase()&&(delete t.ColorRamp,t.ColormapName="Random"),0===t.ColorSchemeType&&delete t.ColorRamp}(a);break;case"Convolution":!function(t){null!=t.ConvolutionType&&(t.Type=t.ConvolutionType,delete t.ConvolutionType)}(a);break;case"Mask":!function(t){t.NoDataValues?.length&&"string"==typeof t.NoDataValues[0]&&(t.NoDataValues=t.NoDataValues.filter(t=>""!==t).map(t=>Number(t)))}(a)}}function Qn(t){const{renderingRule:e,templates:s}=t;if("object"!=typeof e||!e?.rasterFunctionArguments||!s.size)return;const{rasterFunctionArguments:n}=e;for(const t in n){const e=n[t],o="_object_ref_id"===t?e:e&&"object"==typeof e&&"_object_ref_id"in e?e._object_ref_id:null;if(null!=o){if(!s.has(o))throw new r.A("raster-function-helper",`unsupported raster function json. _object_ref_id: ${o} does not exist`);const e=s.get(o);"_object_ref_id"!==t?n[t]=e:e&&"object"==typeof e&&Object.assign(n,e);continue}e&&"object"==typeof e&&(e.rasterFunctionArguments&&Qn({renderingRule:e,templates:s}),Array.isArray(e)&&e.forEach((t,n)=>{if(t&&"object"==typeof t)if(null!=t._object_ref_id){if(!s.has(t._object_ref_id))throw new r.A("raster-function-helper",`unsupported raster function json. _object_ref_id: ${e} does not exist`);const i=s.get(o);i&&"object"==typeof i?Object.assign(t,i):e[n]=i}else Qn({renderingRule:t,templates:s})}))}}En.set("Arithmetic",{desc:"Arithmetic Function",ctor:St,rasterArgumentNames:["rasters"]}),En.set("Aspect",{desc:"Aspect Function",ctor:Ot,rasterArgumentNames:["raster"]}),En.set("BandArithmetic",{desc:"Band Arithmetic Function",ctor:ne,rasterArgumentNames:["raster"]}),En.set("Colormap",{desc:"Colormap Function",ctor:Me,rasterArgumentNames:["raster"]}),En.set("ColormapToRGB",{desc:"ColormapToRGB Function",ctor:ke,rasterArgumentNames:["raster"]}),En.set("CompositeBand",{desc:"CompositeBand Function",ctor:ze,rasterArgumentNames:["rasters"]}),En.set("ComputeChange",{desc:"ComputeChange Function",ctor:$e,rasterArgumentNames:["rasters"]}),En.set("Convolution",{desc:"Convolution Function",ctor:is,rasterArgumentNames:["raster"]}),En.set("ContrastBrightness",{desc:"Contrast Brightness Function",ctor:Xe,rasterArgumentNames:["raster"]}),En.set("ExtractBand",{desc:"ExtractBand Function",ctor:ys,rasterArgumentNames:["raster"]}),En.set("Curvature",{desc:"Curvature Function",ctor:hs,rasterArgumentNames:["raster"]}),En.set("Hillshade",{desc:"Hillshade Function",ctor:Fs,rasterArgumentNames:["raster"]}),En.set("ShadedRelief",{desc:"ShadedRelief Function",ctor:sn,rasterArgumentNames:["raster"]}),En.set("Grayscale",{desc:"Grayscale Function",ctor:bs,rasterArgumentNames:["raster"]}),En.set("Clip",{desc:"Clip Function",ctor:me,rasterArgumentNames:["raster"]}),En.set("Local",{desc:"Local Function",ctor:js,rasterArgumentNames:["rasters"]}),En.set("Mask",{desc:"Mask Function",ctor:Es,rasterArgumentNames:["raster"]}),En.set("NDVI",{desc:"NDVI Function",ctor:Ks,rasterArgumentNames:["raster"]}),En.set("Remap",{desc:"Remap Function",ctor:Xs,rasterArgumentNames:["raster"]}),En.set("Slope",{desc:"Slope Function",ctor:ln,rasterArgumentNames:["raster"]}),En.set("SpectralConversion",{desc:"Spectral Conversion",ctor:dn,rasterArgumentNames:["raster"]}),En.set("Statistics",{desc:"Focal Statistics Function",ctor:Mn,rasterArgumentNames:["raster"]}),En.set("StatisticsHistogram",{desc:"Statistics Histogram Function",ctor:Rn,rasterArgumentNames:["raster"]}),En.set("Stretch",{desc:"Stretch Function",ctor:jn,rasterArgumentNames:["raster"]}),En.set("Table",{desc:"Attribute Table Function",ctor:Dn,rasterArgumentNames:["raster"]})}}]);