/* COPYRIGHT Esri - https://js.arcgis.com/5.1.2/LICENSE.txt */
import{__decorate as t,__param as o}from"tslib";import{GraphShaderModule as e,FragmentOutput as i,location as r,uniform as p,define as a,input as n,VertexInput as s,UniformGroup as l,FragmentInput as d}from"../../../GraphShaderModule.js";import{Float as y,clamp as c,Vec2 as v,cos as u,sin as g,Int as m,Vec4 as f,Vec3 as x,Mat3 as h,FixedArray as w}from"../../../graph/glsl.js";class b extends s{}t([r(0,v)],b.prototype,"position",void 0),t([r(1,v)],b.prototype,"offset",void 0),t([r(2,v)],b.prototype,"vv",void 0);class R extends d{}class S extends l{}t([p(h)],S.prototype,"dvsMat3",void 0),t([p(v)],S.prototype,"coordScale",void 0),t([p(v)],S.prototype,"symbolSize",void 0),t([p(v)],S.prototype,"symbolPercentRange",void 0),t([p(v)],S.prototype,"dataRange",void 0),t([p(y)],S.prototype,"rotation",void 0),t([p(w.ofType(f,48))],S.prototype,"colors",void 0),t([p(y)],S.prototype,"opacity",void 0);const G=new y(3.14159265359);class M extends e{constructor(){super(...arguments),this.type="MagDirShader",this.rotationGeographic=null,this.dataRange=null}vertex(t){const{position:o,offset:e,vv:i}=t,{dataRange:r,rotation:p,symbolSize:a,symbolPercentRange:n,colors:s,coordScale:l,dvsMat3:d}=this.config;let h,w=e.y.add(p);if(this.rotationGeographic||(w=G.multiply(new y(2)).subtract(w).subtract(G.divide(new y(2)))),this.dataRange){const t=c(i.y.subtract(r.x).divide(r.y.subtract(r.x)),new y(0),new y(1)),o=n.x.add(t.multiply(n.y.subtract(n.x)));h=c(o,n.x,n.y)}else h=n.x.add(n.y).divide(new y(2));const b=new v(u(w),g(w)).multiply(e.x),R=o.add(b.multiply(h.multiply(a))),S=s.get(new m(i.x));return{glPosition:new f(d.multiply(new x(R.multiply(l),new y(1))),new y(1)),color:S}}fragment(t){const o=new i;return o.fragColor=t.color.multiply(this.config.opacity),o}}t([a],M.prototype,"rotationGeographic",void 0),t([a],M.prototype,"dataRange",void 0),t([p(S)],M.prototype,"config",void 0),t([o(0,n(b))],M.prototype,"vertex",null),t([o(0,n(R))],M.prototype,"fragment",null);export{M as MagDirShader};
