/* COPYRIGHT Esri - https://js.arcgis.com/5.0.18/LICENSE.txt */
import{__decorate as t,__param as o}from"tslib";import{GraphShaderModule as i,FragmentOutput as e,location as p,uniform as r,define as s,option as l,input as n,VertexInput as a,UniformGroup as h,FragmentInput as c}from"../../../GraphShaderModule.js";import{Vec3 as g,Vec4 as y,ifElse as d,texture2D as u,sign as v,mix as x,Vec2 as f,Sampler2D as m,Mat3 as P,Float as b}from"../../../graph/glsl.js";import{getPixelLocation as j,isOutside as k,getPixel as M,ProjectionConfig as C}from"./projection.js";class _ extends a{}t([p(0,f)],_.prototype,"position",void 0);class w extends c{}class E extends h{}t([r(m)],E.prototype,"texture",void 0),t([r(P)],E.prototype,"dvsMat3",void 0),t([r(f)],E.prototype,"coordScale",void 0),t([r(f)],E.prototype,"srcImageSize",void 0),t([r(b)],E.prototype,"opacity",void 0);class O extends h{}t([r(m)],O.prototype,"maskTexture",void 0);class S extends h{}t([r(m)],S.prototype,"highlightTexture",void 0);class T extends i{constructor(){super(...arguments),this.applyProjection=!0,this.lookupProjection=!1,this.bilinear=!1,this.bicubic=!1,this.nearestOnEdge=!1,this.applyPixelMask=!1,this.applyPixelHighlights=!1}vertex(t){const o=t.position,{dvsMat3:i,coordScale:e}=this.config,p=i.multiply(new g(o.multiply(e),1));return{uv:o,glPosition:new y(p,1)}}fragment(t){const o=new e,i=j(t.uv,this.applyProjection?this.projectionConfig:void 0,this.lookupProjection);let p=this._colorize(i,t.uv);this.applyPixelHighlights&&(p=this._highlightPixels(t.uv,p));const r=d(k(i),new y(0),p);let s=r.a.multiply(this.config.opacity);if(this.applyPixelMask){const o=this._getPixelMask(t.uv);s=s.multiply(o)}return o.fragColor=new y(r.rgb,1).multiply(s),o}_getPixel(t){const{config:o,bicubic:i,bilinear:e,nearestOnEdge:p}=this;return M(t,o,{bicubic:i,bilinear:e,nearestOnEdge:p})}_getPixelMask(t){const{maskTexture:o}=this.pixelMaskConfig,i=u(o,t);return v(i.a)}_highlightPixels(t,o){const{highlightTexture:i}=this.highlightConfig,e=u(i,t),p=v(e.a);return x(o,e,p)}}t([s],T.prototype,"applyProjection",void 0),t([s],T.prototype,"lookupProjection",void 0),t([s],T.prototype,"bilinear",void 0),t([s],T.prototype,"bicubic",void 0),t([s],T.prototype,"nearestOnEdge",void 0),t([s],T.prototype,"applyPixelMask",void 0),t([s],T.prototype,"applyPixelHighlights",void 0),t([r(E)],T.prototype,"config",void 0),t([l(C)],T.prototype,"projectionConfig",void 0),t([l(O)],T.prototype,"pixelMaskConfig",void 0),t([l(S)],T.prototype,"highlightConfig",void 0),t([o(0,n(_))],T.prototype,"vertex",null),t([o(0,n(w))],T.prototype,"fragment",null);export{T as BaseRasterColorizerShader,S as HighlightConfig,O as PixelMaskConfig,w as RasterColorizerFragmentInput,E as RasterConfig};
