/*
All material copyright Esri, All Rights Reserved, unless otherwise specified.
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
*/
import{text as e,outline as r,line as a,icon as t,fill as s,circle as n,background as c}from"./Programs.js";class o{constructor(){this._programByKey=new Map}dispose(){this._programByKey.forEach(e=>e.dispose()),this._programByKey.clear()}getMaterialProgram(e,r,a){const t=r.key<<3|this._getMaterialOptionsValue(r.type,a);if(this._programByKey.has(t))return this._programByKey.get(t);const s=this._getProgramTemplate(r.type),{shaders:n}=s,{vertexShader:c,fragmentShader:o}=n(a),p=r.getShaderHeader(),i=r.getShaderMain(),u=c.replace("#pragma header",p).replace("#pragma main",i),g=e.programCache.acquire(u,o,r.getAttributeLocations());return this._programByKey.set(t,g),g}_getMaterialOptionsValue(e,r){switch(e){case 0:return(r.pattern?1:0)<<1;case 1:return(r.pattern?1:0)<<1;case 2:case 5:case 6:default:return 0;case 3:{const e=r;return(e.sdf?1:0)<<2|(e.pattern?1:0)<<1}case 4:return(r.sdf?1:0)<<1}}_getProgramTemplate(o){switch(o){case 0:return c;case 5:return n;case 1:return s;case 4:return t;case 3:return a;case 2:return r;case 6:return e;default:return null}}}export{o as default};
