/* COPYRIGHT Esri - https://js.arcgis.com/5.0.18/LICENSE.txt */
import{__decorate as t,__param as e}from"tslib";import{GraphShaderModule as o,FragmentOutput as n,location as i,uniform as d,define as r,input as p,VertexInput as l,UniformGroup as a,FragmentInput as s}from"../../../GraphShaderModule.js";import{clamp as y,Float as c,Vec4 as m,Vec3 as u,length as w,smoothstep as v,ifElse as f,lessThan as g,abs as x,Vec2 as h,Mat3 as b}from"../../../graph/glsl.js";import{oneMinus as S}from"../utils.js";class R extends l{}t([i(0,h)],R.prototype,"position",void 0),t([i(1,h)],R.prototype,"offset",void 0),t([i(2,h)],R.prototype,"vv",void 0);class C extends s{}class j extends a{}t([d(b)],j.prototype,"dvsMat3",void 0),t([d(h)],j.prototype,"coordScale",void 0),t([d(h)],j.prototype,"symbolSize",void 0),t([d(h)],j.prototype,"symbolPercentRange",void 0),t([d(h)],j.prototype,"dataRange",void 0),t([d(c)],j.prototype,"opacity",void 0);const M=new m(new c(.2),new c(.2),new c(.2),new c(1)),P=new c(.02),z=new c(.25),G=new c(.42),k=new c(.15);class q extends o{constructor(){super(...arguments),this.type="ScalarShader",this.innerCircle=null,this.dataRange=null}vertex(t){const{position:e,offset:o,vv:n}=t,{dataRange:i,symbolSize:d,symbolPercentRange:r,coordScale:p,dvsMat3:l}=this.config;let a;if(i){const t=y(n.y.subtract(i.x).divide(i.y.subtract(i.x)),new c(0),new c(1)),e=r.y.subtract(r.x).multiply(t).add(r.x);a=y(e,r.x,r.y)}else a=r.x.add(r.y).divide(new c(2));const s=d.multiply(a),w=e.add(o.multiply(s));return{glPosition:new m(l.multiply(new u(w.multiply(p),new c(1))),new c(1)),pos:o}}fragment(t){const e=new n,{opacity:o}=this.config,{pos:i}=t,d=w(i);let r,p=v(G,G.add(P),d);return p=p.multiply(S(v(G.add(P),G.add(new c(.1).add(P)),d))),this.innerCircle?(r=v(z,z.add(P),d),r=r.multiply(S(v(z.add(P),z.add(new c(.1).add(P)),d)))):r=f(g(x(i.x),k),new c(1),new c(0)).multiply(f(g(x(i.y),k),new c(1),new c(0))),e.fragColor=M.multiply(o).multiply(r.add(p)),e}}t([r],q.prototype,"innerCircle",void 0),t([r],q.prototype,"dataRange",void 0),t([d(j)],q.prototype,"config",void 0),t([e(0,p(R))],q.prototype,"vertex",null),t([e(0,p(C))],q.prototype,"fragment",null);export{q as ScalarShader};
