/* COPYRIGHT Esri - https://js.arcgis.com/5.1.0/LICENSE.txt */
import{Vec2 as t,Float as l,fract as u,texture2D as d,mix as i,Vec4 as y}from"../../graph/glsl.js";function n(t){const u=new l(1/6),d=t.multiply(t),i=d.multiply(t),n=u.multiply(i.multiply(-1).add(new l(3).multiply(d)).subtract(new l(3).multiply(t)).add(1)),p=u.multiply(i.multiply(3).subtract(d.multiply(6)).add(4)),m=u.multiply(i.multiply(-3).add(d.multiply(3)).add(t.multiply(3)).add(1)),a=u.multiply(i);return new y(n,p,m,a)}function p(t){const u=n(t),d=u.x.add(u.y),i=u.z.add(u.w),p=new l(1).subtract(u.y.divide(d)).add(t),m=new l(1).add(u.w.divide(i)).subtract(t);return new y(p,m,d,i)}function m(y,n,m){const a=new t(new l(1).divide(m.x),0),e=new t(0,new l(1).divide(m.y)),r=n.multiply(m).subtract(.5),c=p(u(r).x).xyz,s=p(u(r).y).xyz;let w=n.add(c.x.multiply(a)),o=n.subtract(c.y.multiply(a));const x=w.add(s.x.multiply(e)),b=o.add(s.x.multiply(e));w=w.subtract(s.y.multiply(e)),o=o.subtract(s.y.multiply(e));let z=d(y,o),f=d(y,w);const v=d(y,b),g=d(y,x);return z=i(z,v,s.z),f=i(f,g,s.z),z=i(z,f,c.z),z}export{m as sampleBicubicBSpline};
