/* COPYRIGHT Esri - https://js.arcgis.com/5.1.0/LICENSE.txt */
import{__decorate as e}from"tslib";import{uniform as r,texture as t,UniformGroup as n,TextureGroup as o}from"../../../GraphShaderModule.js";import{step as i,Vec2 as s,Bool as a,texture2D as m,floor as u,fract as p,IVec2 as d,int as c,Vec3 as f,ifElse as l,lessThanEqual as w,texelFetch as g,Int as x,dot as y,Sampler2D as b}from"../../../graph/glsl.js";import{sampleBicubicBSpline as S}from"../bitmapUtils.js";import{oneMinus as v}from"../utils.js";import{sampleBilinear as j}from"./sampleBilinear.js";class z extends n{}e([r(s)],z.prototype,"targetImageSize",void 0),e([r(s)],z.prototype,"transformSpacing",void 0),e([r(s)],z.prototype,"transformGridSize",void 0);class I extends o{}function h(e,r){const t=m(r.transformTexture,e);return new s(t.r,t.g)}function T(e,r,t){const{targetImageSize:n,transformSpacing:o}=r,{transformTexture:i}=t,a=u(e.multiply(n)),m=new s(4,1),g=u(a.divide(o)).multiply(m),x=p(a.add(new s(.5,.5)).divide(o)),y=new d(c(g.x),c(g.y)),b=new f(x,1);return l(w(x.x,x.y),G(i,y,b),B(i,y,b))}function G(e,r,t){const n=g(e,r,new x(0)),o=new d(r.x.add(1),r.y),i=g(e,o,new x(0));return new s(y(n.rgb,t),y(i.rgb,t))}function B(e,r,t){const n=new d(r.x.add(2),r.y),o=g(e,n,new x(0)),i=new d(r.x.add(3),r.y),a=g(e,i,new x(0));return new s(y(o.rgb,t),y(a.rgb,t))}function E(e){const r=i(new s(-1e-5,-1e-5),e).multiply(i(e,new s(1.00001,1.00001))),t=v(r.x.multiply(r.y));return new a(t)}function M(e,r,t,n=!1){return r&&t?n?h(e,t):T(e,r,t):e}function O(e,r,t){const{bicubic:n=!1,bilinear:o=!1,nearestOnEdge:i=!1}=t??{};return n||o?n?S(r.texture,e,r.srcImageSize):j(r.texture,e,r.srcImageSize,i):m(r.texture,e)}e([t(b)],I.prototype,"transformTexture",void 0);export{z as ProjectionConfig,I as ProjectionTextures,O as getPixel,M as getPixelLocation,E as isOutside};
