1import{a as at,b as ot,c as nt}from"./chunk-ZKMK3G3L.js";import{a as lt,b as ut,c as fe,d as ct,e as B,f as mt,g as ht,h as pt,i as dt,j as w,k as v}from"./chunk-UFI2Y6AY.js";import{a as it}from"./chunk-BU2OARIC.js";import"./chunk-BC7GE5Q6.js";import{a as st}from"./chunk-5SVNS6GQ.js";import{a as et,b as tt}from"./chunk-AJMYRDGM.js";import{a as rt}from"./chunk-XOB4EQ2T.js";import{a as X}from"./chunk-QAUWK5ZP.js";import{a as de,b as $e,g as Y}from"./chunk-MJE36VRY.js";import"./chunk-I2LACOYT.js";import{a as Ke,d as D,s as J}from"./chunk-ZPHOBEVG.js";import"./chunk-RBLEGQPK.js";import"./chunk-HOYTWQCF.js";import"./chunk-BYXBJQAS.js";import"./chunk-3WIR6N5K.js";import"./chunk-IXYJJ4D3.js";import"./chunk-Q4R7JTUT.js";import{c as je}from"./chunk-GFWX74CO.js";import"./chunk-67QB3CB7.js";import"./chunk-NOUYXRP4.js";import{j as ke,k as Ee}from"./chunk-LODTDSX4.js";import"./chunk-B7IX6UFG.js";import"./chunk-UZSTUBKI.js";import"./chunk-XAHD7XBV.js";import{b as Ve}from"./chunk-XM37QHMN.js";import"./chunk-W5OI4BJ2.js";import{c as E,i as le,k as j,l as De,o as Be,p as Le}from"./chunk-ZAQLF7TN.js";import"./chunk-BKLTKOZS.js";import"./chunk-S3DH7XZE.js";import{n as Ze}from"./chunk-PCRX3JX6.js";import"./chunk-WBPLJNRU.js";import"./chunk-QQX4FGZT.js";import{a as S}from"./chunk-4KGZTO2H.js";import"./chunk-T3HRP72S.js";import{a as Xe}from"./chunk-R4ZRZJFL.js";import"./chunk-L657QK52.js";import{a as Je,b as Ye,c as he,h as pe}from"./chunk-6XQL7KTK.js";import{d as me}from"./chunk-VYYV2WR2.js";import"./chunk-DJEFBPF6.js";import{a as Ae,b as ue}from"./chunk-ECZ7PBWU.js";import{b as Ge}from"./chunk-H3HTOQNB.js";import"./chunk-RCTOGBGJ.js";import"./chunk-4D3QHJI2.js";import"./chunk-E2J2V7JN.js";import"./chunk-FRLOFI6C.js";import"./chunk-WFHAGO45.js";import{b as q}from"./chunk-37H4LYIE.js";import"./chunk-6I4ZS4ET.js";import"./chunk-HUYHDVA2.js";import{c as We,h as Ne,n as ce,o as Qe}from"./chunk-RFETR5NS.js";import{G as He,b as qe}from"./chunk-7SOB5VNT.js";import"./chunk-YUIUJIOR.js";import{a as Oe}from"./chunk-6TDLGY7R.js";import"./chunk-UEJLHX2E.js";import{a as Ue}from"./chunk-45365BH5.js";import"./chunk-KBUBAKBM.js";import"./chunk-TFCWMFOQ.js";import"./chunk-MBFI6CGI.js";import"./chunk-353PICLG.js";import"./chunk-CAZ7M5DC.js";import"./chunk-LOMYR75D.js";import"./chunk-RHFXNMSL.js";import"./chunk-GZKVZ4TD.js";import"./chunk-7QY3BMVN.js";import"./chunk-NWPYI2UP.js";import"./chunk-TNPL7MIN.js";import{e as ne}from"./chunk-PDBA6QOJ.js";import{b as Ce,c as Fe,g as Q,h as H,i as ze,k as Me}from"./chunk-CF52RSJZ.js";import"./chunk-2ETHV3H2.js";import"./chunk-4ZBUTOIE.js";import"./chunk-DLMNTZQ6.js";import"./chunk-IYY5JQTE.js";import{b as oe}from"./chunk-V5IFIIWL.js";import"./chunk-V2JYXY4D.js";import"./chunk-PNJVOMPP.js";import"./chunk-PCLUZ65O.js";import"./chunk-MIR5A3Z7.js";import"./chunk-5MU2G7HW.js";import"./chunk-7SO6IQPR.js";import"./chunk-EBWCXIFH.js";import"./chunk-5OX7OX74.js";import"./chunk-VJFR7CVY.js";import"./chunk-7LEM3RHH.js";import"./chunk-II4RWQI3.js";import"./chunk-5OZU24FS.js";import"./chunk-7Q3YF2MG.js";import"./chunk-SKQ7RYUF.js";import"./chunk-UNL5XY5B.js";import"./chunk-PLK75Q3A.js";import"./chunk-KNHCPC3N.js";import"./chunk-TGH4HSNW.js";import"./chunk-LSBFLPDJ.js";import"./chunk-AM3VOA32.js";import"./chunk-OQAEBRA5.js";import"./chunk-SAOUSUZE.js";import"./chunk-XFYGS4YQ.js";import"./chunk-XUA64EFT.js";import{a as V,g as Pe,h as Se}from"./chunk-TCZU6JLS.js";import"./chunk-OG6NDV7Y.js";import"./chunk-HSLYIFR4.js";import"./chunk-M5DNT3MU.js";import"./chunk-4XBJYZ5W.js";import"./chunk-R4JFECO7.js";import"./chunk-SWOLYJBS.js";import"./chunk-LK4PFQLP.js";import"./chunk-QYC4ILGT.js";import"./chunk-JYRXWQX5.js";import"./chunk-N4C3TQXV.js";import"./chunk-3ZSPAYUG.js";import"./chunk-OEUDK4A7.js";import"./chunk-ZJQZEXV4.js";import"./chunk-D22JVIG4.js";import"./chunk-QWLQUMDY.js";import"./chunk-VU5W7W6Y.js";import"./chunk-NOXQXPZQ.js";import"./chunk-WMLW3QJQ.js";import{a as N}from"./chunk-5CEFM27D.js";import"./chunk-BCREO4Q5.js";import{k as Ie,u as Re}from"./chunk-FYHO4ULB.js";import"./chunk-FUMVX7XQ.js";import"./chunk-YZHSVWQ6.js";import"./chunk-JDT5QXWG.js";import"./chunk-M52MQETK.js";import"./chunk-76YVRX2R.js";import"./chunk-OZF6BMOL.js";import"./chunk-GJP6PTKT.js";import"./chunk-RSDQHAJX.js";import"./chunk-DOTYW6ST.js";import"./chunk-VOYK3LZF.js";import"./chunk-QGCCROOZ.js";
1import"./chunk-2BAXJKYK.js";import"./chunk-Z5Y2GXLN.js";import{L as h,O as ve}from"./chunk-672GO22T.js";import"./chunk-SNFOAZZQ.js";import{S as P}from"./chunk-RNRCJDVT.js";import"./chunk-OVHPPCBL.js";import{a as c}from"./chunk-W3WDPWBE.js";import{B as we,s as F}from"./chunk-DE4UMQWQ.js";import{c as C}from"./chunk-MLSR6YE6.js";import"./chunk-GCWVITNF.js";import{r as U,t as Te}from"./chunk-JWWEG5TZ.js";import"./chunk-PXPVXIY2.js";import{a as R,b as M,g as T}from"./chunk-JEGVIFEP.js";var qt={bandCount:3,outMin:0,outMax:1,minCutOff:[0,0,0],maxCutOff:[255,255,255],factor:[1/255,1/255,1/255],useGamma:!1,gamma:[1,1,1],gammaCorrection:[1,1,1],colormap:null,colormapOffset:null,stretchType:"none",type:"stretch"},Z=class extends Ke{constructor(e=null,t=null,s=null){super(),this._textureInvalidated=!0,this._colormapTextureInvalidated=!0,this._rasterTexture=null,this._rasterTextureBandIds=null,this._transformGridTexture=null,this._colormapTexture=null,this._colormap=null,this._supportsBilinearTexture=!0,this._processedTexture=null,this.functionTextures=[],this.projected=!1,this.stencilRef=0,this.coordScale=[1,1],this._processed=!1,this._symbolizerParameters=null,this.height=null,this.isRendereredSource=!1,this.pixelRatio=1,this.resolution=0,this.rotation=0,this._source=null,this.rawPixelData=null,this._suspended=!1,this._bandIds=null,this._interpolation=null,this._transformGrid=null,this.width=null,this.x=0,this.y=0,this.source=e,this.transformGrid=t,this.interpolation=s}destroy(){this._disposeTextures()}get processedTexture(){return this._processedTexture}set processedTexture(e){this._processedTexture!==e&&(this._disposeTextures(!0),this._processedTexture=e)}get rasterTexture(){return this._rasterTexture}set rasterTexture(e){this._rasterTexture!==e&&(this._rasterTexture?.dispose(),this._rasterTexture=e),e==null&&(this.projected=!1)}get processed(){return this._processed}set processed(e){this._processed=e,e||(C(this.processedTexture),this.invalidateTexture())}get symbolizerParameters(){return this._symbolizerParameters||qt}set symbolizerParameters(e){this._symbolizerParameters!==e&&(this._symbolizerParameters=e,this._colormapTextureInvalidated=!0,this.commonUniforms=null)}get source(){return this._source}set source(e){this._source!==e&&(this._source=e,this._rasterTexture&&(this._rasterTexture.dispose(),this._rasterTexture=null,this._rasterTextureBandIds=null),this.commonUniforms=null,this.projected=!1,this.invalidateTexture())}get suspended(){return this._suspended}set suspended(e){this._suspended&&!e&&this.stage&&(this.ready(),this.requestRender()),this._suspended=e}get bandIds(){return this._bandIds}set bandIds(e){this._bandIds=e,this._isBandIdsChanged(e)&&(this.projected=!1,this.invalidateTexture())}get interpolation(){return this._interpolation||"nearest"}set interpolation(e){this._interpolation=e,this._rasterTexture&&this._rasterTexture.setSamplingMode(this._getTextureSamplingMethod(e||"nearest")==="bilinear"?j.LINEAR:j.NEAREST)}get transformGrid(){return this._transformGrid}set transformGrid(e){this._transformGrid!==e&&(this._transformGrid=e,this._transformGridTexture=C(this._transformGridTexture))}invalidateTexture(){this._textureInvalidated||(this._textureInvalidated=!0,this.requestRender())}getRasterTextureSize(e=!1){let t=e||this.projected;return[t?this.width:this.source?.width||this.width,t?this.height:this.source?.height||this.height]}getRasterCellSize(){let e=this.rawPixelData?.srcPixelSize,{projected:t,resolution:s}=this;return e&&!t?[e.x,e.y]:[s,s]}_createTransforms(){return{displayViewScreenMat3:S()}}setTransform(e){let t=Fe(this.transforms.displayViewScreenMat3),[s,i]=e.toScreenNoRotation([0,0],[this.x,this.y]),a=this.resolution/this.pixelRatio/e.resolution,o=a*this.width,n=a*this.height,l=Math.PI*this.rotation/180;H(t,t,q(s,i)),H(t,t,q(o/2,n/2)),ze(t,t,-l),H(t,t,q(-o/2,-n/2)),Me(t,t,q(o,n)),Q(this.transforms.displayViewScreenMat3,e.displayViewMat3,t)}getTextures({forProcessing:e=!1,useProcessedTexture:t=!1}={}){let s=t?this._processedTexture??this._rasterTexture:this._rasterTexture,i=[],a=[];return s?(this._transformGridTexture&&!this.projected&&(a.push(this._transformGridTexture),i.push("u_transformGrid")),t?(a.push(s),i.push("u_image"),this._colormapTexture&&(a.push(this._colormapTexture),i.push("u_colormap")),{names:i,textures:a}):(a.push(s),i.push("u_image"),this._colormapTexture&&!e&&(a.push(this._colormapTexture),i.push("u_colormap")),{names:i,textures:a})):{names:i,textures:a}}onAttach(){this.invalidateTexture()}onDetach(){this.invalidateTexture()}updateTexture({context:e}){if(!this.stage)return void this._disposeTextures();let t=this._isValidSource(this.source);t&&this._colormapTextureInvalidated&&(this._colormapTextureInvalidated=!1,this._updateColormapTexture(e)),this._textureInvalidated&&(this._textureInvalidated=!1,this._createOrDestroyRasterTexture(e),this._rasterTexture&&(t?this.transformGrid&&!this._transformGridTexture&&(this._transformGridTexture=ut(e,this.transformGrid)):this._rasterTexture.setData(null)),this.suspended||(this.ready(),this.requestRender()))}updateProcessedTexture(){let{functionTextures:e}=this;e.length!==0&&(this.processedTexture=e.shift(),e.forEach(t=>t?.dispose()),e.length=0)}_createOrDestroyRasterTexture(e){let t=this.source?.extractBands(this.bandIds);if(!this._isValidSource(t))return void(this._rasterTexture&&(this._rasterTexture.dispose(),this._rasterTextureBandIds=null,this._rasterTexture=null));let s=!this._isBandIdsChanged(this.bandIds);if(this._rasterTexture){if(s)return;this._rasterTexture.dispose(),this._rasterTextureBandIds=null,this._rasterTexture=null}this._supportsBilinearTexture=!!e.capabilities.textureFloatLinear;let i=this._getTextureSamplingMethod(this.interpolation),a=this.isRendereredSource;this._rasterTexture=lt(e,t,i,a),this.projected=!1,this._processed=!1,this._rasterTextureBandIds=this.bandIds?[...this.bandIds]:null}_isBandIdsChanged(e){let t=this._rasterTextureBandIds;return!(t==null&&e==null||t&&e&&t.join("")===e.join(""))}_isValidSource(e){return e!=null&&e.pixels?.length>0}_getTextureSamplingMethod(e){let{type:t}=this.symbolizerParameters,s=t==="lut"||t==="hillshade"||t==="stretch"&&this.symbolizerParameters.bandCount===1;return!this._supportsBilinearTexture||s||e!=="bilinear"&&e!=="cubic"?"nearest":"bilinear"}_updateColormapTexture(e){let t=this._colormap,s=this.symbolizerParameters.colormap;return s?t?s.length!==t.length||s.some((i,a)=>
1i!==t[a])?(this._colormapTexture&&(this._colormapTexture.dispose(),this._colormapTexture=null),this._colormapTexture=fe(e,s),void(this._colormap=s)):void 0:(this._colormapTexture=fe(e,s),void(this._colormap=s)):(this._colormapTexture&&(this._colormapTexture.dispose(),this._colormapTexture=null),void(this._colormap=null))}_disposeTextures(e=!1){!this._transformGridTexture||e&&!this.projected||(this._transformGridTexture.dispose(),this._transformGridTexture=null),!e&&this._colormapTexture&&(this._colormapTexture.dispose(),this._colormapTexture=null,this._colormap=null,this._colormapTextureInvalidated=!0),!e&&this._rasterTexture&&(this._rasterTexture.dispose(),this._rasterTexture=null,this._rasterTextureBandIds=null),this._processedTexture&&(this._processedTexture.dispose(),this._processedTexture=null)}};function ft(r){return r.source!=null}function L(r){let e=[];return r&&(e.push("applyProjection"),r.spacing[0]===1&&e.push("lookupProjection")),e}function K(r,e,t){let s=!t.capabilities.textureFloatLinear,i=[];return r==="cubic"?i.push("bicubic"):r==="bilinear"&&(e?(i.push("bilinear"),i.push("nnedge")):s&&i.push("bilinear")),i}var Wt={vsPath:"raster/common",fsPath:"raster/lut",attributes:new Map([["a_position",0],["a_texcoord",1]])};function Nt(r,e,t){let s=t?[]:L(e.transformGrid);return{defines:s,program:r.painter.materialManager.getProgram(Wt,s)}}function Qt(r,e,t,s,i=!1){let{names:a,textures:o}=t.getTextures({useProcessedTexture:i});v(r.context,e,a,o),w(e,s,t.commonUniforms),e.setUniformMatrix3fv("u_dvsMat3",t.transforms.displayViewScreenMat3);let{colormap:n,colormapOffset:l}=t.symbolizerParameters,m=B(n,l);w(e,s,m)}var gt={createProgram:Nt,bindTextureAndUniforms:Qt};var Ht={vsPath:"raster/common",fsPath:"raster/hillshade",attributes:new Map([["a_position",0],["a_texcoord",1]])};function Jt(r,e,t){let{colormap:s}=e.symbolizerParameters,i=[...t?[]:L(e.transformGrid),...K(e.interpolation,!0,r.context)];return s!=null&&i.push("applyColormap"),{defines:i,program:r.painter.materialManager.getProgram(Ht,i)}}function Yt(r,e,t,s,i=!1){let{names:a,textures:o}=t.getTextures({useProcessedTexture:i});v(r.context,e,a,o),w(e,s,t.commonUniforms),e.setUniformMatrix3fv("u_dvsMat3",t.transforms.displayViewScreenMat3);let n=t.symbolizerParameters,{colormap:l,colormapOffset:m}=n;if(l!=null){let u=B(l,m);w(e,s,u)}let g=pt(n);w(e,s,g)}var _t={createProgram:Jt,bindTextureAndUniforms:Yt};var Xt={vsPath:"raster/common",fsPath:"raster/stretch",attributes:new Map([["a_position",0],["a_texcoord",1]])};function Zt(r,e,t){let{colormap:s,bandCount:i}=e.symbolizerParameters,a=[...t?[]:L(e.transformGrid),...K(e.interpolation,i===1,r.context)];return e.isRendereredSource&&!t?a.push("noop"):s!=null&&a.push("applyColormap"),{defines:a,program:r.painter.materialManager.getProgram(Xt,a)}}function Kt(r,e,t,s,i=!1){let{names:a,textures:o}=t.getTextures({useProcessedTexture:i});v(r.context,e,a,o),w(e,s,t.commonUniforms),e.setUniformMatrix3fv("u_dvsMat3",t.transforms.displayViewScreenMat3);let n=t.symbolizerParameters,{colormap:l,colormapOffset:m}=n;if(l!=null){let u=B(l,m);w(e,s,u)}let g=ht(n);w(e,s,g)}var xt={createProgram:Zt,bindTextureAndUniforms:Kt};var $=new Map;function yt(r){return $.get(r)}$.set("lut",gt),$.set("hillshade",_t),$.set("stretch",xt);var $t=[1,1],er=[2,0,0,0,2,0,-1,-1,0];function d(r,e,t){let{context:s,rasterFunction:i,hasBranches:a}=r,{raster:o}=i.parameters,n=a?o?.id??-1:0,l=t.functionTextures[n]??t.rasterTexture;v(s,e,["u_image"],[l])}function O(r,e,t){let{rasters:s}=r.rasterFunction.parameters;if(!s)return;if(s.length<2)return d(r,e,t);let i=s.filter(a=>a.name!=="Constant").map(a=>a.id!=null&&a.name!=="Identity"?t.functionTextures[a.id]:t.rasterTexture);if(v(r.context,e,["u_image","u_image1","u_image2"].slice(0,i.length),i),i.length!==s.length){if(s.length===2){let a=s.findIndex(l=>l.name==="Constant"),o=a===0?[0,1,0,1,0,0,0,0,0]:[1,0,0,0,1,0,0,0,0],{value:n}=s[a].parameters;e.setUniform1f("u_image1Const",n),e.setUniformMatrix3fv("u_imageSwap",o)}else if(s.length===3){let a=[];if(s.forEach((o,n)=>o.name==="Constant"&&a.push(n)),a.length===1){let{value:o}=s[a[0]].parameters;e.setUniform1f("u_image1Const",o);let n=a[0]===0?[0,1,0,0,0,1,1,0,0]:a[0]===1?[1,0,0,0,0,1,0,1,0]:[1,0,0,0,1,0,0,0,1];e.setUniformMatrix3fv("u_imageSwap",n)}else if(a.length===2){let{value:o}=s[a[0]].parameters;e.setUniform1f("u_image1Const",o);let{value:n}=s[a[1]].parameters;e.setUniform1f("u_image2Const",n);let l=s.findIndex(g=>g.name!=="Constant"),m=l===0?[1,0,0,0,1,0,0,0,1]:l===1?[0,1,0,1,0,0,0,0,1]:[0,0,1,1,0,0,0,1,0];e.setUniformMatrix3fv("u_imageSwap",m)}}}}function p(r){r.setUniform2fv("u_coordScale",$t),r.setUniformMatrix3fv("u_dvsMat3",er)}var tr={vsPath:"raster/rfx/vs",fsPath:"raster/rfx/aspect",attributes:new Map([["a_position",0],["a_texcoord",1]])};function rr(r,e){return r.painter.materialManager.getProgram(tr,[])}function sr(r,e,t){d(r,e,t),p(e);let s=t.getRasterTextureSize();e.setUniform2fv("u_srcImageSize",s);let i=t.getRasterCellSize();e.setUniform2fv("u_cellSize",i)}var bt={createProgram:rr,bindTextureAndUniforms:sr};var ir={vsPath:"raster/rfx/vs",fsPath:"raster/rfx/bandarithmetic",attributes:new Map([["a_position",0],["a_texcoord",1]])};
1function ar(r,e){let{painter:t,rasterFunction:s}=r,{indexType:i}=s.parameters;return t.materialManager.getProgram(ir,[i])}function or(r,e,t){d(r,e,t),p(e);let{bandIndexMat3:s}=r.rasterFunction.parameters;e.setUniformMatrix3fv("u_bandIndexMat3",s)}var Tt={createProgram:ar,bindTextureAndUniforms:or};var nr={vsPath:"raster/rfx/vs",fsPath:"raster/rfx/compositeband",attributes:new Map([["a_position",0],["a_texcoord",1]])};function lr(r,e){let t=r.rasterFunction.parameters.rasters.filter(i=>i.name==="Constant"),s=[];return t.length&&(s.push("oneConstant"),t.length===2&&s.push("twoConstant")),r.painter.materialManager.getProgram(nr,s)}function ur(r,e,t){O(r,e,t),p(e)}var wt={createProgram:lr,bindTextureAndUniforms:ur};var cr={vsPath:"raster/rfx/vs",fsPath:"raster/rfx/computechange",attributes:new Map([["a_position",0],["a_texcoord",1]])};function mr(r){let{painter:e,rasterFunction:t}=r,{method:s,rasters:i,isOutputRounded:a}=t.parameters,o=[s.includes("-")?s.slice(0,s.indexOf("-")):s];return i.filter(n=>n.name==="Constant").length&&o.push("oneConstant"),a&&o.push("roundOutput"),e.materialManager.getProgram(cr,o)}function hr(r,e,t){O(r,e,t),p(e);let{domainRange:s}=r.rasterFunction.parameters;e.setUniform2fv("u_domainRange",s)}var vt={createProgram:mr,bindTextureAndUniforms:hr};var pr={vsPath:"raster/rfx/vs",fsPath:"raster/rfx/contrast",attributes:new Map([["a_position",0],["a_texcoord",1]])};function dr(r,e){return r.painter.materialManager.getProgram(pr,[])}function fr(r,e,t){d(r,e,t),p(e);let{contrastOffset:s,brightnessOffset:i}=r.rasterFunction.parameters;e.setUniform1f("u_contrastOffset",s),e.setUniform1f("u_brightnessOffset",i)}var Pt={createProgram:dr,bindTextureAndUniforms:fr};var gr={vsPath:"raster/rfx/vs",fsPath:"raster/rfx/convolution",attributes:new Map([["a_position",0],["a_texcoord",1]])};function _r(r,e){let{painter:t,rasterFunction:s}=r,{kernelRows:i,kernelCols:a}=s.parameters,o=[{name:"rows",value:i},{name:"cols",value:a}];return t.materialManager.getProgram(gr,o)}function xr(r,e,t){d(r,e,t),p(e),e.setUniform2fv("u_srcImageSize",[t.width,t.height]);let{kernel:s,clampRange:i}=r.rasterFunction.parameters;e.setUniform1fv("u_kernel",s),e.setUniform2fv("u_clampRange",i)}var St={createProgram:_r,bindTextureAndUniforms:xr};var yr={vsPath:"raster/rfx/vs",fsPath:"raster/rfx/curvature",attributes:new Map([["a_position",0],["a_texcoord",1]])};function br(r,e){let{painter:t,rasterFunction:s}=r,{curvatureType:i}=s.parameters,a=[i];return t.materialManager.getProgram(yr,a)}function Tr(r,e,t){d(r,e,t),p(e);let s=t.getRasterTextureSize();e.setUniform2fv("u_srcImageSize",s);let{zFactor:i}=r.rasterFunction.parameters,a=t.getRasterCellSize();e.setUniform1f("u_zlFactor",200*i/a[0]/a[1])}var It={createProgram:br,bindTextureAndUniforms:Tr};var wr={vsPath:"raster/rfx/vs",fsPath:"raster/rfx/extractband",attributes:new Map([["a_position",0],["a_texcoord",1]])};function vr(r,e){return r.painter.materialManager.getProgram(wr,[])}function Pr(r,e,t){d(r,e,t),p(e);let{bandIndexMat3:s}=r.rasterFunction.parameters;e.setUniformMatrix3fv("u_bandIndexMat3",s)}var Rt={createProgram:vr,bindTextureAndUniforms:Pr};var Sr={vsPath:"raster/rfx/vs",fsPath:"raster/rfx/focalstatistics",attributes:new Map([["a_position",0],["a_texcoord",1]])};function Ir(r,e){let{painter:t,rasterFunction:s}=r,{kernelRows:i,kernelCols:a,fillNoDataOnly:o,statisticsType:n}=s.parameters,l=[{name:"rows",value:i},{name:"cols",value:a},n];return o&&l.push("fill"),t.materialManager.getProgram(Sr,l)}function Rr(r,e,t){d(r,e,t),p(e),e.setUniform2fv("u_srcImageSize",[t.width,t.height]);let{clampRange:s}=r.rasterFunction.parameters;e.setUniform2fv("u_clampRange",s)}var Ut={createProgram:Ir,bindTextureAndUniforms:Rr};var Ur={vsPath:"raster/rfx/vs",fsPath:"raster/rfx/grayscale",attributes:new Map([["a_position",0],["a_texcoord",1]])};function Cr(r,e){return r.painter.materialManager.getProgram(Ur,[])}function Fr(r,e,t){d(r,e,t),p(e);let{weights:s}=r.rasterFunction.parameters;e.setUniform3fv("u_weights",s)}var Ct={createProgram:Cr,bindTextureAndUniforms:Fr};var zr={vsPath:"raster/rfx/vs",fsPath:"raster/rfx/local",attributes:new Map([["a_position",0],["a_texcoord",1]])};
1function Mr(r){let{painter:e,rasterFunction:t}=r,{imageCount:s,operationName:i,rasters:a,isOutputRounded:o}=t.parameters,n=[i.toLowerCase()];s===2&&n.push("twoImages");let l=a.filter(m=>m.name==="Constant");return l.length&&(n.push("oneConstant"),l.length===2&&n.push("twoConstant")),o&&n.push("roundOutput"),e.materialManager.getProgram(zr,n)}function Vr(r,e,t){O(r,e,t),p(e);let{domainRange:s}=r.rasterFunction.parameters;e.setUniform2fv("u_domainRange",s)}var ge={createProgram:Mr,bindTextureAndUniforms:Vr};var Dr={vsPath:"raster/rfx/vs",fsPath:"raster/rfx/mask",attributes:new Map([["a_position",0],["a_texcoord",1]])};function Br(r,e){let{painter:t,rasterFunction:s}=r,i=s.parameters.bandCount>1?["multiBand"]:[];return t.materialManager.getProgram(Dr,i)}function Lr(r,e,t){d(r,e,t),p(e);let{includedRanges:s,noDataValues:i}=r.rasterFunction.parameters;e.setUniform1fv("u_includedRanges",s),e.setUniform1fv("u_noDataValues",i)}var Ft={createProgram:Br,bindTextureAndUniforms:Lr};var Or={vsPath:"raster/rfx/vs",fsPath:"raster/rfx/ndvi",attributes:new Map([["a_position",0],["a_texcoord",1]])};function Gr(r,e){let{painter:t,rasterFunction:s}=r,i=s.parameters.scaled?["scaled"]:[];return t.materialManager.getProgram(Or,i)}function Ar(r,e,t){d(r,e,t),p(e);let{bandIndexMat3:s}=r.rasterFunction.parameters;e.setUniformMatrix3fv("u_bandIndexMat3",s)}var zt={createProgram:Gr,bindTextureAndUniforms:Ar};var kr={vsPath:"raster/rfx/vs",fsPath:"raster/rfx/remap",attributes:new Map([["a_position",0],["a_texcoord",1]])};function Er(r,e){return r.painter.materialManager.getProgram(kr,[])}function jr(r,e,t){d(r,e,t),p(e);let{noDataRanges:s,rangeMaps:i,allowUnmatched:a,clampRange:o}=r.rasterFunction.parameters;e.setUniform1fv("u_noDataRanges",s),e.setUniform1fv("u_rangeMaps",i),e.setUniform1f("u_unmatchMask",a?1:0),e.setUniform2fv("u_clampRange",o)}var Mt={createProgram:Er,bindTextureAndUniforms:jr};var qr={vsPath:"raster/common",fsPath:"raster/reproject",attributes:new Map([["a_position",0],["a_texcoord",1]])};function Wr(r,e){let{painter:t}=r,s=[],{interpolation:i,transformGrid:a}=e,o=r.rasterFunction?.parameters;return i==="cubic"?s.push("bicubic"):i==="bilinear"&&(s.push("bilinear"),o?.requireNNEdge&&s.push("nnedge")),a&&(s.push("applyProjection"),a.spacing[0]===1&&s.push("lookupProjection")),t.materialManager.getProgram(qr,s)}function Nr(r,e,t){let{names:s,textures:i}=t.getTextures({forProcessing:!0});v(r.context,e,s,i),e.setUniform1f("u_scale",1),e.setUniform2fv("u_offset",[0,0]),e.setUniform2fv("u_coordScale",[1,1]),e.setUniformMatrix3fv("u_dvsMat3",[2,0,0,0,2,0,-1,-1,0]),e.setUniform1i("u_flipY",0),e.setUniform1f("u_opacity",1);let{width:a,height:o,source:n,transformGrid:l}=t;e.setUniform2fv("u_srcImageSize",[n.width,n.height]),e.setUniform2fv("u_targetImageSize",[a,o]),e.setUniform2fv("u_transformSpacing",l?l.spacing:ne),e.setUniform2fv("u_transformGridSize",l?l.size:ne)}var Vt={createProgram:Wr,bindTextureAndUniforms:Nr};
1var Qr={vsPath:"raster/rfx/vs",fsPath:"raster/rfx/slope",attributes:new Map([["a_position",0],["a_texcoord",1]])};function Hr(r,e){let{painter:t,rasterFunction:s}=r,{slopeType:i}=s.parameters,a=i==="percent-rise"?["percentRise"]:[];return t.materialManager.getProgram(Qr,a)}function Jr(r,e,t){d(r,e,t),p(e);let s=t.getRasterTextureSize();e.setUniform2fv("u_srcImageSize",s);let i=t.getRasterCellSize();e.setUniform2fv("u_cellSize",i);let{zFactor:a,slopeType:o,pixelSizePower:n,pixelSizeFactor:l}=r.rasterFunction.parameters;e.setUniform1f("u_zFactor",a),e.setUniform1f("u_pixelSizePower",o==="adjusted"?n:0),e.setUniform1f("u_pixelSizeFactor",o==="adjusted"?l:0)}var Dt={createProgram:Hr,bindTextureAndUniforms:Jr};var Yr={vsPath:"raster/rfx/vs",fsPath:"raster/rfx/stretch",attributes:new Map([["a_position",0],["a_texcoord",1]])};function Xr(r,e){let{useGamma:t,bandCount:s,isOutputRounded:i}=r.rasterFunction.parameters,a=[];return t&&a.push("useGamma"),s>1&&a.push("multiBand"),i&&a.push("roundOutput"),r.painter.materialManager.getProgram(Yr,a)}function Zr(r,e,t){d(r,e,t),p(e);let{width:s,height:i}=t,a=r.rasterFunction.parameters;e.setUniform2fv("u_srcImageSize",[s,i]),e.setUniform1f("u_minOutput",a.outMin),e.setUniform1f("u_maxOutput",a.outMax),e.setUniform1fv("u_factor",a.factor),e.setUniform1fv("u_minCutOff",a.minCutOff),e.setUniform1fv("u_maxCutOff",a.maxCutOff),e.setUniform1fv("u_gamma",a.gamma),e.setUniform1fv("u_gammaCorrection",a.gammaCorrection)}var Bt={createProgram:Xr,bindTextureAndUniforms:Zr};var x=new Map;function _e(r,e){let t=new ke;
1return t.width=r,t.height=e,t.internalFormat=Be.RGBA32F,t.samplingMode=j.NEAREST,t.dataType=Le.FLOAT,t.isImmutable=!0,t.wrapMode=De.CLAMP_TO_EDGE,t}function Kr(r,e,t,s){let{context:i,requestRender:a,allowDelayedRender:o}=r,n=s.createProgram(r,t);return o&&a!=null&&!n.compiled?(a(),null):(i.bindFramebuffer(e),i.setViewport(0,0,e.width,e.height),i.useProgram(n),n)}function $r(r){return x.get(r.toLowerCase())}function Lt(r,e,t,s){let i=r.rasterFunction.name.toLowerCase(),a=i==="reproject"?Vt:$r(i);if(a==null)return;let o=Kr(r,t,s,a);if(!o)return;a.bindTextureAndUniforms(r,o,s);let{interpolation:n}=s;i==="reproject"&&(s.interpolation="nearest"),e.draw();let[l,m]=s.getRasterTextureSize(i==="reproject"),g=_e(l,m),u=new Ee(r.context,g);if(t.copyToTexture(0,0,l,m,0,0,u),i==="reproject")s.rasterTexture=u,s.projected=!0,s.interpolation=n;else{let f=r.hasBranches?r.rasterFunction.id:0;s.functionTextures[f]=u}}x.set("arithmetic",ge),x.set("aspect",bt),x.set("bandarithmetic",Tt),x.set("computechange",vt),x.set("compositeband",wt),x.set("convolution",St),x.set("contrastbrightness",Pt),x.set("curvature",It),x.set("extractband",Rt),x.set("statistics",Ut),x.set("grayscale",Ct),x.set("local",ge),x.set("mask",Ft),x.set("ndvi",zt),x.set("remap",Mt),x.set("slope",Dt),x.set("stretch",Bt);var ee=class extends $e{constructor(){super(...arguments),this.name="raster",this._quad=null,this._rendererUniformInfos=new Map,this._fbo=null}dispose(){C(this._quad),C(this._fbo)}prepareState(e){let{context:t,renderPass:s}=e,i=s==="raster";t.setBlendingEnabled(!i),t.setBlendFunctionSeparate(E.ONE,E.ONE_MINUS_SRC_ALPHA,E.ONE,E.ONE_MINUS_SRC_ALPHA),t.setColorMask(!0,!0,!0,!0),t.setStencilWriteMask(0),t.setStencilTestEnabled(!i)}draw(e,t){if(!ft(t)||t.suspended)return;let{renderPass:s}=e;if(s!=="raster-bitmap")return s==="raster"?this._process(e,t):void this._drawBitmap(e,t,!0);this._drawBitmap(e,t)}
1_process(e,t){let{rasterFunction:s}=e,i=s.name==="Reproject";if(!(i?!(t.rasterTexture&&t.projected):!t.processed))return;let{timeline:a,context:o}=e;a.begin(this.name);let n=o.getBoundFramebufferObject(),l=o.getViewport();i||(t.processedTexture=C(t.processedTexture)),o.setStencilFunction(le.EQUAL,t.stencilRef,255),t.updateTexture(e),this._initQuad(o);let[m,g]=t.getRasterTextureSize(i),{isStandardRasterTileSize:u,fbo:f}=this._getRasterFBO(o,m,g);Lt(e,this._quad,f,t),u||f.dispose(),o.bindFramebuffer(n),o.setViewport(l.x,l.y,l.width,l.height),a.end(this.name)}_drawBitmap(e,t,s=!1){let{timeline:i,context:a}=e;if(i.begin(this.name),a.setStencilFunction(le.EQUAL,t.stencilRef,255),t.updateTexture(e),s&&!t.processedTexture){if(t.updateProcessedTexture(),!t.processedTexture)return void i.end(this.name);t.processed=!0}this._initBitmapCommonUniforms(t);let o=t.symbolizerParameters.type,n=yt(o),{requestRender:l,allowDelayedRender:m}=e,{defines:g,program:u}=n.createProgram(e,t,t.projected&&s);if(m&&l!=null&&!u.compiled)return void l();a.useProgram(u);let f=this._getUniformInfos(o,a,u,g);this._quad||(this._quad=new de(a,[0,0,1,0,0,1,1,1])),n.bindTextureAndUniforms(e,u,t,f,s),this._quad.draw(),i.end(this.name)}_initBitmapCommonUniforms(e){if(!e.commonUniforms){let t=mt(1,[0,0]),{transformGrid:s,width:i,height:a}=e,o=ct(s,[i,a],[e.source.width,e.source.height],1,!1);e.commonUniforms=M(R(R({},t),o),{u_coordScale:e.coordScale})}}
1_getRasterFBO(e,t,s){let i=t===512&&s===512;return i?(this._fbo||(this._fbo=this._createNewFBO(e,t,s)),{isStandardRasterTileSize:i,fbo:this._fbo}):{isStandardRasterTileSize:i,fbo:this._createNewFBO(e,t,s)}}_createNewFBO(e,t,s){let i=_e(t,s);return new je(e,i)}_initQuad(e){this._quad||(this._quad=new de(e,[0,0,1,0,0,1,1,1]))}_getUniformInfos(e,t,s,i){let a=i.length>0?e+"-"+i.join("-"):e;if(this._rendererUniformInfos.has(a))return this._rendererUniformInfos.get(a);let o=dt(t,s);return this._rendererUniformInfos.set(a,o),o}};var te=class extends Y{constructor(e,t,s,i,a,o,n=null){super(e,t,s,i,a,o),this.bitmap=null,this.bitmap=new Z(n,null,null),this.bitmap.coordScale=[a,o],this.bitmap.once("isReady",()=>this.ready())}destroy(){super.destroy(),this.bitmap.destroy(),this.bitmap=null,this.stage=null}set stencilRef(e){this.bitmap.stencilRef=e}get stencilRef(){return this.bitmap.stencilRef}setTransform(e){super.setTransform(e),this.bitmap.transforms.displayViewScreenMat3=this.transforms.displayViewScreenMat3}_createTransforms(){return{displayViewScreenMat3:S(),tileMat3:S()}}onAttach(){this.bitmap.stage=this.stage}onDetach(){this.bitmap.stage=null}};var re=class extends X{constructor(){super(...arguments),this.isCustomTilingScheme=!1}createTile(e){let t=this._getTileBounds(e),[s,i]=this._tileInfoView.tileInfo.size,a=this._tileInfoView.getTileResolution(e.level);return new te(e,a,t[0],t[3],s,i)}prepareRenderPasses(e){let t=e.registerRenderPass({name:"imagery (tile)",brushes:[ee],target:()=>this.children.map(s=>s.bitmap),drawPhase:D.MAP});return[...super.prepareRenderPasses(e),t]}doRender(e){if(!this.visible||e.drawPhase!==D.MAP)return;
1let{rasterFunctionChain:t}=this;if(!t)return e.renderPass="raster-bitmap",void super.doRender(e);if(!t.hasFocalFunction){let[s,i]=this._tileInfoView.tileInfo.size;e.renderPass="raster",e.rasterFunction={name:"Reproject",parameters:{targetImageSize:[s,i],requireNNEdge:t.isSourceSingleBand},pixelType:"f32",id:0,isNoopProcess:!1},super.doRender(e)}if(t?.functions.length){let{functions:s,hasBranches:i}=t;for(let a=0;a<s.length;a++){let o=s[a];o.name!=="Constant"&&o.name!=="Identity"&&(e.renderPass="raster",e.rasterFunction=o,e.hasBranches=i,super.doRender(e))}}e.rasterFunction=null,e.renderPass="bitmap",super.doRender(e)}_getTileBounds(e){let t=this._tileInfoView.getTileBounds(N(),e);if(this.isCustomTilingScheme&&e.world){let{tileInfo:s}=this._tileInfoView,i=Ze(s.spatialReference);if(i){let a=s.lodAt(e.level);if(!a)return t;let{resolution:o}=a,n=i/o%s.size[0],l=n?(s.size[0]-n)*o:0;t[0]-=l*e.world,t[2]-=l*e.world}}return t}};var es=[0,0],b=class extends ve{constructor(){super(...arguments),this._updatingHandles=new Oe,this._emptyTilePixelBlock=null,this._tileStrategy=null,this._tileInfoView=null,this._fetchQueue=null,this._blockCacheRegistryUrl=null,this._blockCacheRegistryId=null,this._srcResolutions=[],this.previousLOD=null,this._needBlockCacheUpdate=!1,this._globalSymbolizerParams=null,this._symbolizerParams=null,this._abortController=null,this._isCustomTilingScheme=!1,this._maxIndexedColormapSize=0,this._rasterFunctionState="na",this._globalUpdateRequested=!1,this.attached=!1,this.timeExtent=null,this.redrawOrRefetch=we((...e)=>T(this,[...e],function*(r={}){let t=this._rasterFunctionState;if(r.reprocess&&(yield this._updatingHandles.addPromise(this.layer.updateRasterFunction()),this.updateRasterFunctionParameters()),!this.previousLOD||this.layerView.suspended)return;let s=this._rasterFunctionState,{type:i}=this;return r.refetch||i!=="raster"&&r.reprocess||s==="cpu"||t==="cpu"?this._updatingHandles.addPromise(this.doRefresh()):this._updatingHandles.addPromise(this._redrawImage(r.signal))}))}destroy(){this._updatingHandles.destroy()}get useWebGLForProcessing(){return this._get("useWebGLForProcessing")??!0}set useWebGLForProcessing(r){this._set("useWebGLForProcessing",r)}get useProgressiveUpdate(){return this._get("useProgressiveUpdate")??!0}set useProgressiveUpdate(r){if(this._tileStrategy&&this.useProgressiveUpdate!==r){this._tileStrategy.destroy(),this.container.removeAllChildren();let e=this._getCacheSize(r);this._tileStrategy=new ue({cachePolicy:"purge",acquireTile:t=>this.acquireTile(t),releaseTile:t=>this.releaseTile(t),cacheSize:e,tileInfoView:this._tileInfoView}),this._set("useProgressiveUpdate",r),this.layerView.requestUpdate()}}update(r){this._fetchQueue.pause(),this._fetchQueue.state=r.state,this._tileStrategy.update(r),this._fetchQueue.resume();let{extent:e,resolution:t,scale:s}=r.state,i=this._tileInfoView.getClosestInfoForScale(s);if(this.layer.raster){if(!this.useProgressiveUpdate||this._needBlockCacheUpdate){let a=this._srcResolutions[i.level],o=e.toJSON?e:Re.fromJSON(e);pe(this._blockCacheRegistryUrl,this._blockCacheRegistryId,o,t,a,this.layer.raster.ioConfig.sampling)}this._needBlockCacheUpdate=!1,this.previousLOD?.level!==i.level&&(this.previousLOD=i,this._symbolizerParams==null||this.layerView.hasTilingEffects||this._updateSymbolizerParams(),this._tileStrategy.updateCacheSize(0))}}moveEnd(){!this.layerView.hasTilingEffects&&this.useProgressiveUpdate||(this._abortController&&this._abortController.abort(),this._abortController=new AbortController,this._fetchQueue.length===0&&this._redrawImage(this._abortController.signal).then(()=>{this._globalUpdateRequested=!1,this.layerView.requestUpdate()}));let r=this._getCacheSize(this.useProgressiveUpdate);this._tileStrategy.updateCacheSize(r),this.layerView.requestUpdate()}get updating(){return this._globalUpdateRequested||this._updatingHandles?.updating}attach(){let r=Xe();this._maxIndexedColormapSize=4*(r.maxTextureSize||4096),this._initializeTileInfo(),this._tileInfoView=new Ge(this.layerView.tileInfo,this.layerView.fullExtent);let e=this._computeFetchConcurrency();this._fetchQueue=new Ae({tileInfoView:this._tileInfoView,concurrency:e,process:(s,i)=>this._fetchTile(s,i)});let t=this._getCacheSize(this.useProgressiveUpdate);this._tileStrategy=new ue({cachePolicy:"purge",acquireTile:s=>this.acquireTile(s),releaseTile:s=>this.releaseTile(s),cacheSize:t,tileInfoView:this._tileInfoView}),this._updateBlockCacheRegistry()}detach(){this._tileStrategy.destroy(),this._fetchQueue.clear(),this.container.removeAllChildren(),this._fetchQueue=this._tileStrategy=this._tileInfoView=null,he(this._blockCacheRegistryUrl,this._blockCacheRegistryId),this._blockCacheRegistryUrl=this._blockCacheRegistryId=null}acquireTile(r){let e=this.container.createTile(r);return this._updatingHandles.addPromise(this._enqueueTileFetch(e)),this.layerView.requestUpdate(),this._needBlockCacheUpdate=!0,this._globalUpdateRequested=this.layerView.hasTilingEffects||!this.useProgressiveUpdate,e}releaseTile(r){this._fetchQueue.abort(r.key.id),this.container.removeChild(r),r.once("detach",()=>{r.destroy(),this.layerView.requestUpdate()}),this.layerView.requestUpdate()}createEmptyTilePixelBlock(r=null){let e=r==null||r.join(",")===this._tileInfoView.tileInfo.size.join(",");if(e&&this._emptyTilePixelBlock!=null)return this._emptyTilePixelBlock;r=r||this._tileInfoView.tileInfo.size;let[t,s]=r,i=new qe({width:t,height:s,pixels:[new Uint8Array(t*s)],mask:new Uint8Array(t*s),pixelType:"u8"});return e&&(this._emptyTilePixelBlock=i),i}
1_getBandIds(){if(!("rasterFunctionChain"in this.container)||!this.container.rasterFunctionChain)return this.layer.bandIds;let{bandIds:r,raster:e}=this.layer,t="rasterFunction"in e?e.rasterFunction.rawInputBandIds:null;return r?.length&&t?.length&&e.rasterInfo.bandCount!==1?r.map(s=>t[Math.min(s,t.length-1)]):r||t}updateRasterFunctionParameters(){}_fetchTile(r,e){let t=this._getFetchOptions(r.level,e.signal);return this.fetchTile(r,t)}_getFetchOptions(r,e){let t=this.canUseWebGLForProcessing(),{layerView:s}=this,{tileInfo:i}=s,a=!i.isWrappable&&Ne(s.view.spatialReference)!=null,o=t&&this.layer.raster.hasUniqueSourceStorageInfo;return{allowPartialFill:!0,datumTransformation:s.datumTransformation,interpolation:t?"nearest":this.layer.interpolation,registryId:this._blockCacheRegistryId,requestRawData:o,skipRasterFunction:this.type==="raster"&&this.container.rasterFunctionChain!=null,signal:e,srcResolution:this._srcResolutions[r],timeExtent:s.timeExtent,tileInfo:i,disableWrapAround:a}}_getCacheSize(r){return r?40:0}_initializeTileInfo(){let{layerView:r}=this,e=r.view.spatialReference;if(this._canUseLayerLODs()){let{origin:m,lods:g}=this.layer.tileInfo,u=g.map(({scale:_})=>_),f=oe.create({spatialReference:e,size:512,scales:u,origin:m});return r.set("tileInfo",f),void(this._srcResolutions=g.map(({resolution:_})=>({x:_,y:_})))}let{scales:t,srcResolutions:s,isCustomTilingScheme:i}=Qe(this.layer.serviceRasterInfo,e,{tileSize:512,alignGlobalDatasetWithAGOL:!0,limitToSrcResolution:!1}),a=oe.create({spatialReference:e,size:512,scales:t}),o=a.origin.x===0,{xmin:n,ymax:l}=r.fullExtent;(o||i&&a.origin.x>n)&&(a.origin=new Ie({x:n,y:l,spatialReference:e})),this._isCustomTilingScheme=i,r.set("tileInfo",a),this._srcResolutions=s??[]}_canUseLayerLODs(){let{layer:r,layerView:e}=this;if(r.raster.tileType!=="Map")return!1;let{lods:t}=r.tileInfo,s=e.view.constraints?.effectiveLODs;return s?.length===t.length&&s.every(({scale:i},a)=>Math.abs(i-t[a].scale)<.001)}_computeFetchConcurrency(){let{blockBoundary:r}=this.layer.serviceRasterInfo.storageInfo,e=r[r.length-1];return(e.maxCol-e.minCol+1)*(e.maxRow-e.minRow+1)>64?2:10}_enqueueTileFetch(r,e){return T(this,null,function*(){if(!this._fetchQueue.has(r.key.id)){try{let t=yield this._fetchQueue.push(r.key),s=this._getBandIds(),i=!this.useProgressiveUpdate||this.layerView.hasTilingEffects&&!this._globalSymbolizerParams;if(this._globalUpdateRequested&&!this.layerView.moving&&this._fetchQueue.length===0){i=!1;try{yield this._redrawImage(this._abortController?.signal)}catch(n){F(n)&&U.getLogger(this).error(n)}this._globalUpdateRequested=!1}!this.canUseWebGLForProcessing()&&this.type!=="rasterVF"||this.layerView.hasTilingEffects||this._symbolizerParams!=null||this._updateSymbolizerParams();let a=this._tileInfoView.getTileCoords(es,r.key),o=this._tileInfoView.getTileResolution(r.key);yield this.updateTileSource(r,{source:t,symbolizerParams:this._symbolizerParams,globalSymbolizerParams:this._globalSymbolizerParams,suspended:i,bandIds:s,coords:a,resolution:o}),r.once("attach",()=>this.layerView.requestUpdate()),this.container.addChild(r)}catch(t){F(t)||U.getLogger(this).error(t)}this.layerView.requestUpdate()}})}_redrawImage(r){return T(this,null,function*(){if(this.container.children.length===0)return;yield this.layer.updateRenderer(),this.layerView.hasTilingEffects?yield this._updateGlobalSymbolizerParams(r):(this._updateSymbolizerParams(),this._globalSymbolizerParams=null);let e=this.container.children.map(t=>T(this,null,function*(){return this.updateTileSymbolizerParameters(t,{local:this._symbolizerParams,global:this._globalSymbolizerParams})}));yield Promise.allSettled(e),this.container.requestRender()})}_updateGlobalSymbolizerParams(r){return T(this,null,function*(){let e=this._getFetchOptions(this.previousLOD.level,r),t=yield this.layer.fetchPixels(this.layerView.view.extent,this.layerView.view.width,this.layerView.view.height,M(R({},e),{interpolation:"nearest",requestRawData:!1,skipRasterFunction:!1}));if(!t?.pixelBlock)return;let{resolution:s}=this.previousLOD,i=this._getBandIds(),a=this.layer.symbolizer.generateWebGLParameters({pixelBlock:t.pixelBlock.extractBands(i),isGCS:this.layerView.view.spatialReference.isGeographic,resolution:{x:s,y:s},bandIds:i});!this.canUseWebGLForProcessing()&&a&&a.type==="stretch"&&this.layer.renderer&&this.layer.renderer.type==="raster-stretch"&&(a.factor=a.factor.map(o=>255*o),a.outMin=Math.round(255*a.outMin),a.outMax=Math.round(255*a.outMax)),this._globalSymbolizerParams=a})}_updateSymbolizerParams(){let{resolution:r}=this.previousLOD,e=this._getBandIds();this._symbolizerParams=this.layer.symbolizer.generateWebGLParameters({pixelBlock:null,isGCS:this.layerView.view.spatialReference.isGeographic,resolution:{x:r,y:r},bandIds:e})}_updateBlockCacheRegistry(r=!1){let{layer:e,layerView:t}=this,{raster:s}=e,{multidimensionalDefinition:i}=e.normalizeRasterFetchOptions({multidimensionalDefinition:e.multidimensionalDefinition,timeExtent:t.timeExtent}),a=s.rasterInfo.multidimensionalInfo?s.getSliceIndex(i):null,o=Je(s.rasterId,a);if(o!==this._blockCacheRegistryUrl){if(this._blockCacheRegistryUrl!=null&&he(this._blockCacheRegistryUrl,this._blockCacheRegistryId),this._blockCacheRegistryId=Ye(o,s.rasterInfo),r){let{view:n}=t,l=this._tileInfoView.getClosestInfoForScale(n.scale),m=this._srcResolutions[l.level];pe(o,this._blockCacheRegistryId,n.extent,n.resolution,m,s.ioConfig.sampling)}this._blockCacheRegistryUrl=o}}doRefresh(){return T(this,null,function*(){if(!this.attached||!this.previousLOD||this.layerView.suspended)return;yield this.layer.updateRenderer(),this.layerView.hasTilingEffects||this._updateSymbolizerParams(),this._updateBlockCacheRegistry(!0),this._fetchQueue.reset();let r=[];this._globalUpdateRequested=this.layerView.hasTilingEffects||!this.useProgressiveUpdate,this._tileStrategy.refresh(e=>r.push(this._enqueueTileFetch(e))),yield this._updatingHandles.addPromise(Promise.allSettled(r))})}};c([h()],b.prototype,"_globalUpdateRequested",void 0),c([h()],b.prototype,"attached",void 0),c([h()],b.prototype,"container",void 0),c([h()],b.prototype,"layer",void 0),c([h()],b.prototype,"layerView",void 0),c([h()],b.prototype,"type",void 0),c([h()],b.prototype,"useWebGLForProcessing",null),c([h()],b.prototype,"useProgressiveUpdate",null),c([h()],b.prototype,"timeExtent",void 0),c([h()],b.prototype,"updating",null),b=c([P("esri.views.2d.layers.imagery.BaseImageryTileSubView2D")],b);var A=class extends b{constructor(){super(...arguments),this.type="raster"}attach(){super.attach(),this.container=new re(this._tileInfoView),this.container.isCustomTilingScheme=this._isCustomTilingScheme,this.updateRasterFunctionParameters()}detach(){super.detach(),this.container.removeAllChildren(),this.container=null}canUseWebGLForProcessing(){let{symbolizer:r}=this.layer,e=r.lookup?.colormapLut?.indexedColormap,t=e&&e.length>this._maxIndexedColormapSize;return this.useWebGLForProcessing&&r.canRenderInWebGL&&!t&&!(this.layer.interpolation==="majority"&&J(this.layer))}fetchTile(r,e){return this.layer.fetchTile(r.level,r.row,r.col,e)}
1updateRasterFunctionParameters(){let{clips:r,view:e}=this.layerView;this._geometry!=null&&r.remove(this._geometry);let{raster:t,type:s}=this.layer;if(t.datasetFormat==="Function"){let _=t.getClippingGeometry(e.spatialReference);if(_){let y=new et({geometry:_});r.add(y),this._geometry=y}}let{container:i}=this;if(t.datasetFormat!=="Function"||s==="wcs")return i.rasterFunctionChain=null,i.children.forEach(_=>{let{bitmap:y}=_;y&&(y.suspended=!0,y.processed=!1,y.projected&&(y.invalidateTexture(),y.rasterTexture=null))}),void(this._rasterFunctionState="na");let a=this._rasterFunctionState,{rasterFunction:o,primaryRasters:n}=t,l=o.supportsGPU&&(!n||n.rasters.length<=1),m=l?o.flatWebGLFunctionChain:null,{renderer:g}=this.layer,u=!l||!m?.functions.length||g?.type==="raster-stretch"&&g.dynamicRangeAdjustment||!this.canUseWebGLForProcessing();i.rasterFunctionChain=u?null:m;let f=o==null?"na":i.rasterFunctionChain?"gpu":"cpu";i.children.forEach(_=>{let{bitmap:y}=_;y&&(y.suspended=a!==f,y.processed=!1,y.processedTexture=null)}),this._rasterFunctionState=f}updateTileSource(r,e){return T(this,null,function*(){let t=this._getBandIds(),s=this._getLayerInterpolation(),i=this.canUseWebGLForProcessing(),{source:a,globalSymbolizerParams:o,suspended:n,coords:l,resolution:m}=e,g=this.layerView.hasTilingEffects?o:e.symbolizerParams,{bitmap:u}=r;if([u.x,u.y]=l,u.resolution=m,a?.pixelBlock!=null){let f={extent:a.extent,pixelBlock:a.pixelBlock,srcPixelSize:a.srcTilePixelSize};if(u.rawPixelData=f,i)u.source=a.pixelBlock,u.isRendereredSource=!1;else{let _=yield this.layer.applyRenderer(f,o?.type==="stretch"?o:void 0);u.source=_,u.isRendereredSource=!0}u.symbolizerParameters=i?g:null,u.transformGrid=i?a.transformGrid:null}else{let f=this.createEmptyTilePixelBlock();u.source=f,u.symbolizerParameters=i?g:null,u.transformGrid=null}u.bandIds=i?t:null,u.width=this._tileInfoView.tileInfo.size[0],u.height=this._tileInfoView.tileInfo.size[1],u.interpolation=s,u.suspended=n,u.invalidateTexture()})}updateTileSymbolizerParameters(r,e){return T(this,null,function*(){let{local:t,global:s}=e,i=this._getBandIds(),a=this._getLayerInterpolation(),o=this.canUseWebGLForProcessing(),{bitmap:n}=r,{rawPixelData:l}=n;o||l==null?(n.isRendereredSource&&l!=null&&(n.source=l.pixelBlock),n.isRendereredSource=!1):(n.source=yield this.layer.applyRenderer(l,s?.type==="stretch"?s:void 0),n.isRendereredSource=!0),n.symbolizerParameters=o?this.layerView.hasTilingEffects?s:t:null,n.bandIds=o?i:null,n.interpolation=a,n.suspended=!1})}_getLayerInterpolation(){let{interpolation:r,renderer:e}=this.layer;if(!e)return r;let t=e.type;return t==="raster-colormap"||t==="unique-value"||t==="class-breaks"?"nearest":e.type==="raster-stretch"&&e.colorRamp!=null?r==="bilinear"||r==="cubic"?"bilinear":"nearest":r}};c([h()],A.prototype,"container",void 0),c([h()],A.prototype,"layer",void 0),c([h()],A.prototype,"type",void 0),A=c([P("esri.views.2d.layers.imagery.ImageryTileView2D")],A);var Ot=A;var se=class extends Y{constructor(e,t,s,i,a,o,n=null){super(e,t,s,i,a,o),this.tileData=new nt(n),this.tileData.coordScale=[a,o],this.tileData.once("isReady",()=>this.ready())}destroy(){super.destroy(),this.tileData.destroy(),this.tileData=null,this.stage=null}set stencilRef(e){this.tileData.stencilRef=e}get stencilRef(){return this.tileData.stencilRef}_createTransforms(){return{displayViewScreenMat3:S(),tileMat3:S()}}setTransform(e){super.setTransform(e);let t=this.resolution/(e.resolution*e.pixelRatio),s=this.transforms.tileMat3,[i,a]=this.tileData.offset,o=[this.x+i*this.resolution,this.y-a*this.resolution],[n,l]=e.toScreenNoRotation([0,0],o),{symbolTileSize:m}=this.tileData.symbolizerParameters,g=Math.round((this.width-this.tileData.offset[0])/m)*m,u=Math.round((this.height-this.tileData.offset[1])/m)*m,f=g/this.rangeX*t,_=u/this.rangeY*t;Ce(s,f,0,0,0,_,0,n,l,1),Q(this.transforms.displayViewScreenMat3,e.displayViewMat3,s),this.tileData.transforms.displayViewScreenMat3=this.transforms.displayViewScreenMat3}onAttach(){this.tileData.stage=this.stage}onDetach(){this.tileData.stage=null}};var ie=class extends X{constructor(){super(...arguments),this.isCu
1stomTilingScheme=!1,this.symbolTypes=["triangle"]}createTile(e){let t=this._tileInfoView.getTileBounds(N(),e),[s,i]=this._tileInfoView.tileInfo.size,a=this._tileInfoView.getTileResolution(e.level);return new se(e,a,t[0],t[3],s,i)}prepareRenderPasses(e){let t=e.registerRenderPass({name:"imagery (vf tile)",brushes:[ot],target:()=>this.children.map(s=>s.tileData),drawPhase:D.MAP});return[...super.prepareRenderPasses(e),t]}doRender(e){this.visible&&e.drawPhase===D.MAP&&this.symbolTypes.forEach(t=>{e.renderPass=t,super.doRender(e)})}};var k=class extends b{constructor(){super(...arguments),this._handle=null,this.type="rasterVF"}canUseWebGLForProcessing(){return!1}fetchTile(r,e){return T(this,null,function*(){e=M(R({},e),{interpolation:"nearest",requestProjectedLocalDirections:!0});let t=yield this.layer.fetchTile(r.level,r.row,r.col,e);return this.layer.serviceRasterInfo?.dataType==="vector-magdir"&&t?.pixelBlock&&(t.pixelBlock=yield this.layer.convertVectorFieldData(t.pixelBlock,e)),t})}updateTileSource(r,e){let t=e.symbolizerParams,{tileData:s}=r;s.key=r.key,s.width=this._tileInfoView.tileInfo.size[0],s.height=this._tileInfoView.tileInfo.size[1];let{symbolTileSize:i}=t,{source:a}=e;if(s.offset=this._getTileSymbolOffset(s.key,i),a?.pixelBlock!=null){let o={extent:a.extent,pixelBlock:a.pixelBlock};s.rawPixelData=o,s.symbolizerParameters=t,s.source=this._sampleVectorFieldData(a.pixelBlock,t,s.offset)}else{let o=[Math.round((this._tileInfoView.tileInfo.size[0]-s.offset[0])/i),Math.round((this._tileInfoView.tileInfo.size[1]-s.offset[1])/i)],n=this.createEmptyTilePixelBlock(o);s.source=n,s.symbolizerParameters=t}return s.invalidateVAO(),Promise.resolve()}updateTileSymbolizerParameters(r,e){let t=e.local,{symbolTileSize:s}=t,{tileData:i}=r;i.offset=this._getTileSymbolOffset(i.key,s);let a=i.symbolizerParameters.symbolTileSize;i.symbolizerParameters=t;let o=i.rawPixelData?.pixelBlock;return o!=null&&a!==s&&(i.source=this._sampleVectorFieldData(o,i.symbolizerParameters,i.offset)),Promise.resolve()}attach(){super.attach(),this.container=new ie(this._tileInfoView),this.container.isCustomTilingScheme=this._isCustomTilingScheme,this._updateSymbolType(this.layer.renderer),this._handle=V(()=>this.layer.renderer,r=>this._updateSymbolType(r))}detach(){super.detach(),this.container.removeAllChildren(),this._handle?.remove(),this._handle=null,this.container=null}_getTileSymbolOffset(r,e){let t=r.col*this._tileInfoView.tileInfo.size[0]%e,s=r.row*this._tileInfoView.tileInfo.size[1]%e;return[t>e/2?e-t:-t,s>e/2?e-s:-s]}_sampleVectorFieldData(r,e,t){let{symbolTileSize:s}=e;return He(r,"vector-uv",s,t)}_updateSymbolType(r){r.type==="vector-field"&&(this.container.symbolTypes=r.style==="wind-barb"?["scalar","triangle"]:r.style==="simple-scalar"?["scalar"]:["triangle"])}};c([h()],k.prototype,"container",void 0),c([h()],k.prototype,"layer",void 0),c([h()],k.prototype,"type",void 0),k=c([P("esri.views.2d.layers.imagery.VectorFieldTileView2D")],k);var Gt=k;var At=r=>{let e=class extends r{constructor(){super(...arguments),this._rasterFieldPrefix="Raster.",this.layer=null,this.view=null,this.tileInfo=null}get fullExtent(){return this._getfullExtent()}get timeExtent(){return it(this.layer,this.view?.timeExtent,this._get("timeExtent"))}get hasTilingEffects(){return!!(this.layer.renderer&&"dynamicRangeAdjustment"in this.layer.renderer&&this.layer.renderer.dynamicRangeAdjustment)}get datumTransformation(){return We(this.layer.fullExtent,this.view.spatialReference,!0)}supportsSpatialReference(t){return!!ce(this.layer.serviceRasterInfo,t)}fetchPopupFeaturesAtLocation(t,s){return T(this,null,function*(){let{layer:i}=this;if(!t)throw new Te("imageryTileLayerView:fetchPopupFeatures","Nothing to fetch without area",{layer:i});let{popupEnabled:a}=i,o=Ve(i,s);if(!a||o==null)return[];let n=[],{value:l,magdirValue:m,processedValue:g}=yield i.identify(t,{timeExtent:this.timeExtent,signal:s?.signal}),u="";if(l?.length){u=i.type==="imagery-tile"&&i.hasStandardTime()&&l[0]!=null?l.map(ae=>i.getStandardTimeValue(ae)).join(", "):l.join(", ");let f={ObjectId:0},_="Raster.ServicePixelValue";f[_]=i.type==="imagery-tile"&&i.raster.datasetFormat==="Function"?g?.join(", "):u,f[_+".Raw"]=u;let y=i.raster?.rasterInfo??i.serviceRasterInfo,xe=y?.attributeTable;if(xe!=null){let{fields:ae,features:Et}=xe,be=ae.find(({name:I})=>I.toLowerCase()==="value"),jt=f[_],W=be?Et.find(I=>String(I.attributes[be.name])===jt):null;if(W)for(let I in W.attributes)W.attributes.hasOwnProperty(I)&&(f[this._rasterFieldPrefix+I]=W.attributes[I])}let ye=y?.dataType;ye!=="vector-magdir"&&ye!=="vector-uv"||(f["Raster.Magnitude"]=m?.[0],f["Raster.Direction"]=m?.[1]);let kt=new Ue({geometry:this.fullExtent.clone(),attributes:f,layer:i,sourceLayer:i});n.push(kt)}return n})}_getfullExtent(){return ce(this.layer.serviceRasterInfo,this.view.spatialReference)}};return c([h()],e.prototype,"fullExtent",null),c([h()],e.prototype,"layer",void 0),c([h({readOnly:!0})],e.prototype,"timeExtent",null),c([h()],e.prototype,"view",void 0),c([h()],e.prototype,"tileInfo",void 0),c([h({readOnly:!0})],e.prototype,"hasTilingEffects",null),c([h()],e.prototype,"datumTransformation",null),e=c([P("esri.views.layers.ImageryTileLayerView")],e),e};var z=class extends At(st(tt(rt))){constructor(){super(...arguments),this._useWebGLForProcessing=!0,this._useProgressiveUpdate=!0,this.subview=null}get useWebGLForProcessing(){return this._useWebGLForProcessing}set useWebGLForProcessing(r){this._useWebGLForProcessing=r,this.subview&&"useWebGLForProcessing"in this.subview&&(this.subview.useWebGLForProcessing=r)}get useProgressiveUpdate(){return this._useWebGLForProcessing}set useProgressiveUpdate(r){this._useProgressiveUpdate=r,this.subview&&"useProgressiveUpdate"in this.subview&&(this.subview.useProgressiveUpdate=r)}get displayParameters(){let{layer:r}=this,e=this._get("displayParameters");return r.renderer?{bandIds:r.bandIds,renderer:r.renderer,interpolation:r.interpolation,multidimensionalDefinition:r.multidimensionalDefinition,rasterFu
vendor: 2,820 bytes, line 1
1nction:r.type==="imagery-tile"?r.rasterFunction:null}:e}update(r){this.subview?.update(r),this.notifyChange("updating")}isUpdating(){return!this.subview||this.subview.updating}attach(){this.layer.increaseRasterJobHandlerUsage(),this._updateSubview(),this.addAttachHandles([V(()=>this.displayParameters,(r,e)=>{let t=r.interpolation!==e?.interpolation&&(r.interpolation==="majority"||e?.interpolation==="majority")&&J(this.layer),s=r.renderer!==e?.renderer&&this._getSubviewType(e?.renderer)!==this._getSubviewType(r.renderer);s&&this._updateSubview();let i=r.multidimensionalDefinition!==e?.multidimensionalDefinition,a=r.rasterFunction!==e?.rasterFunction,o=a&&!this._useWebGLForProcessing,n=i||t||s||o;this.subview.redrawOrRefetch({refetch:n,reprocess:a}).catch(l=>{F(l)||U.getLogger(this).error(l)}),this.notifyChange("updating")}),V(()=>this.layer.multidimensionalSubset??null,(r,e)=>{let{multidimensionalDefinition:t}=this.layer;t!=null&&me(t,r)!==me(t,e)&&(this.subview.redrawOrRefetch({refetch:!0}).catch(s=>{F(s)||U.getLogger(this).error(s)}),this.notifyChange("updating"))},Pe),V(()=>this.timeExtent,()=>{this.subview.timeExtent=this.timeExtent,this.subview.redrawOrRefetch({refetch:!0}).catch(r=>{F(r)||U.getLogger(this).error(r)})},Se)])}detach(){this.layer.decreaseRasterJobHandlerUsage(),this._detachSubview(this.subview),this.subview?.destroy(),this.subview=null}viewChange(){this.requestUpdate()}moveEnd(){this.subview.moveEnd()}doRefresh(){return this.subview?this.subview.doRefresh():Promise.resolve()}_updateSubview(){let{renderer:r}=this.layer;if(!r)return;let e=this._getSubviewType(r);if(this.subview){if(this.subview.type===e)return void this._attachSubview(this.subview);this._detachSubview(this.subview),this.subview?.destroy(),this.subview=null}let{layer:t}=this,s;if(s=e==="rasterVF"?new Gt({layer:t,layerView:this}):e==="flow"?new at({layer:t,layerView:this}):new Ot({layer:t,layerView:this}),"useWebGLForProcessing"in s&&(s.useWebGLForProcessing=this._useWebGLForProcessing),"useProgressiveUpdate"in s&&(s.useProgressiveUpdate=this._useProgressiveUpdate),"previousLOD"in s){let{subview:i}=this;s.previousLOD=i&&"previousLOD"in i?i.previousLOD:null}this._attachSubview(s),this.subview=s,this.requestUpdate()}_attachSubview(r){r&&!r.attached&&(r.attach(),r.attached=!0,this.container.addChildAt(r.container,0))}_detachSubview(r){r?.attached&&(this.container.removeChild(r.container),r.detach(),r.attached=!1)}_getSubviewType(r){let e=r?.type;return e==="vector-field"?"rasterVF":e==="flow"?"flow":"raster"}};c([h()],z.prototype,"subview",void 0),c([h()],z.prototype,"useWebGLForProcessing",null),c([h()],z.prototype,"useProgressiveUpdate",null),c([h({readOnly:!0})],z.prototype,"displayParameters",null),z=c([P("esri.views.2d.layers.ImageryTileLayerView2D")],z);var Lo=z;export{Lo as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.