// All material copyright Esri, All Rights Reserved, unless otherwise specified. // See https://js.arcgis.com/4.30/esri/copyright.txt for details. //>>built define("exports ../../assets ../../Color ../../request ../../core/LRUCache ../../core/screenUtils ./cimSymbolUtils".split(" "),function(f,u,m,v,w,h,x){function p(a){if(!a)return null;let b=null;switch(a.type){case "simple-fill":case "picture-fill":case "simple-marker":b=p(a.outline);break;case "simple-line":const c=h.pt2px(a.width);null!=a.style&&"none"!==a.style&&0!==c&&(b={color:a.color,style:q(a.style),width:c,cap:a.cap,join:"miter"===a.join?h.pt2px(a.miterLimit):a.join},b.dashArray=r(b).join(",")|| "none");break;default:b=null}return b}function r(a){if(!a?.style)return[];const {dashArray:b,style:c,width:e}=a;if("string"===typeof b&&"none"!==b)return b.split(",").map(d=>Number(d));const k=e??0,l=t.has(c)?t.get(c).map(d=>d*k):[];if("butt"!==a.cap)for(const [d,g]of l.entries())l[d]=1===d%2?g+k:Math.max(g-k,1);return l}const t=new Map([["dash",[4,3]],["dashdot",[4,3,1,3]],["dot",[1,3]],["longdash",[8,3]],["longdashdot",[8,3,1,3]],["longdashdotdot",[8,3,1,3,1,3]],["shortdash",[4,1]],["shortdashdot", [4,1,1,1]],["shortdashdotdot",[4,1,1,1,1,1]],["shortdot",[1,1]],["solid",[]]]),n=new w.LRUCache(1E3),q=(()=>{const a={};return b=>{if(a[b])return a[b];const c=b.replaceAll("-","");return a[b]=c}})();m=new m([128,128,128]);f.defaultThematicColor=m;f.dekebabifyLineStyle=q;f.getDashArray=r;f.getFill=function(a){const b=a.style;let c=null;if(a)switch(a.type){case "simple-marker":"cross"!==b&&"x"!==b&&(c=a.color);break;case "simple-fill":b&&"solid"!==b?"none"!==b&&(c={type:"pattern",x:0,y:0,src:u.getAssetUrl(`esri/symbols/patterns/${b}.png`), width:5,height:5}):c=a.color;break;case "picture-fill":c={type:"pattern",src:a.url,width:h.pt2px(a.width)*a.xscale,height:h.pt2px(a.height)*a.yscale,x:h.pt2px(a.xoffset),y:h.pt2px(a.yoffset)};break;case "text":c=a.color;break;case "cim":c=x.getCIMSymbolColor(a)}return c};f.getPatternUrlWithColor=function(a,b){const c=a+"-"+b;return void 0!==n.get(c)?Promise.resolve(n.get(c)):v(a,{responseType:"image"}).then(e=>{e=e.data;const k=e.naturalWidth,l=e.naturalHeight,d=document.createElement("canvas");d.width= k;d.height=l;const g=d.getContext("2d");g.fillStyle=b;g.fillRect(0,0,k,l);g.globalCompositeOperation="destination-in";g.drawImage(e,0,0);e=d.toDataURL();n.put(c,e);return e})};f.getStroke=p;Object.defineProperty(f,Symbol.toStringTag,{value:"Module"})});