// 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 ../../core/colorUtils ../../core/has ../../core/Error ../../core/Logger ../../core/screenUtils ./gfxUtils ./IconSymbol3DLayerResource ./ObjectSymbol3DLayerResource ./previewUtils ./renderUtils ./utils ./webStyleSymbolUtils".split(" "),function(z,O,P,fa,Q,V,w,B,W,X,k,C,R,Y){function y(a){const b=a.outline;var d=null!=a.material?a.material.color:null;d=null!=d?d.toHex():null;if(null==b||"pattern"in b&&null!=b.pattern&&"style"===b.pattern.type&&"none"===b.pattern.style)return"fill"=== a.type&&"#ffffff"===d?{color:"#bdc3c7",width:.75}:null;a=w.pt2px(b.size)||0;return{color:"rgba("+(null!=b.color?b.color.toRgba():"255,255,255,1")+")",width:Math.min(a,J),style:"pattern"in b&&null!=b.pattern&&"style"===b.pattern.type?B.dekebabifyLineStyle(b.pattern.style):null,join:"butt",cap:"patternCap"in b?b.patternCap:"butt"}}async function Z(a,b){if(a.thumbnail?.url)return a.thumbnail.url;if("icon"===b.type&&b?.resource?.href)return R.getIconHref(b);b=O.getAssetUrl("esri/images/Legend/legend3dsymboldefault.png"); return a.styleOrigin&&(a.styleOrigin.styleName||a.styleOrigin.styleUrl)&&(a=await Y.resolveWebStyleSymbol(a.styleOrigin,{portal:a.styleOrigin.portal},"webRef").catch(()=>null))&&"thumbnail"in a&&a.thumbnail?.url?a.thumbnail.url:b}function K(a,b=1){const d=a.a;a=P.toHSV(a);const {r:g,g:t,b:v}=P.toRGB({h:a.h,s:a.s/b,v:100-(100-a.v)/b});return[g,t,v,d]}function D(a){return"water"===a.type?null==a.color?null:a.color:null==a.material?.color?null:a.material.color}function f(a,b=0){var d=D(a);if(!d){if("fill"=== a.type)return null;b=k.adjustColorComponentBrightness(B.defaultThematicColor.r,b);return[b,b,b,100]}a=d.toRgba();for(d=0;3>d;d++)a[d]=k.adjustColorComponentBrightness(a[d],b);return a}async function S(a,b){a=a.style;return"none"===a?null:{type:"pattern",x:0,y:0,src:await B.getPatternUrlWithColor(O.getAssetUrl(`esri/symbols/patterns/${a}.png`),b.toCss(!0)),width:5,height:5}}function T(a){return a.outline?y(a):{color:"rgba(0, 0, 0, 1)",width:1.5}}function L(a,b){a=D(a);if(!a)return null;let d;d="rgba("+ (k.adjustColorComponentBrightness(a.r,b)+",");d+=k.adjustColorComponentBrightness(a.g,b)+",";d+=k.adjustColorComponentBrightness(a.b,b)+",";return d+a.a+");"}function M(a,b){b=L(a,b);if(!b)return{};if("pattern"in a&&null!=a.pattern&&"style"===a.pattern.type&&"none"===a.pattern.style)return null;const d=Math.min(a.size?w.pt2px(a.size):.75,J);return{color:b,width:d,style:"pattern"in a&&null!=a.pattern&&"style"===a.pattern.type?B.dekebabifyLineStyle(a.pattern.style):null,cap:"cap"in a?a.cap:null,join:"join"in a?"miter"===a.join?w.pt2px(2):a.join:null}}function E(a,b,d){d=null!=d?.75*d:0;return{type:"linear",x1:d?.25*d:0,y1:d?.5*d:0,x2:d||4,y2:d?.5*d:4,colors:[{color:a,offset:0},{color:b,offset:1}]}}function aa(a){const b=a.depth,d=a.height;a=a.width;return 0!==a&&0!==b&&0!==d&&a===b&&null!=a&&null!=d&&a{if("icon"===e.type||"object"===e.type){var p="icon"===e.type?e.size&&w.pt2px(e.size):0,n=d||p?Math.ceil(Math.min(d||p,g||G)):x;if(e?.resource?.href){var u=Z(a,e).then(A=>{const H=e?.material?.color;var I= "icon"===e.type?"multiply":"tint";return C.tintImageWithColor(A,n,H,I,t)}).then(A=>{const H=A.width,I=A.height;l=Math.max(l,H);r=Math.max(r,I);return[{shape:{type:"image",x:0,y:0,width:H,height:I,src:A.url},fill:null,stroke:null}]});q.push(u)}else u=n,"icon"===e.type&&h&&d&&(u=p/h*n),p="tall"===b?.symbolConfig||b?.symbolConfig?.isTall||("object"===e.type?aa(e):!1),l=Math.max(l,p?N:u),r=Math.max(r,u),q.push(Promise.resolve(ba(e,u,p)))}});const m=[];(await Promise.allSettled(q)).forEach(e=>{"fulfilled"=== e.status?m.push(e.value):e.reason&&V.getLogger("esri.symbols.support.previewSymbol3D").warn("error while building swatchInfo!",e.reason)});return C.renderSymbol(m,[l,r],{node:b?.node,scale:!1,opacity:b?.opacity,ariaLabel:b?.ariaLabel})}function da(a,b){const d=a.symbolLayers,g=[];a=R.isVolumetricSymbol(a);const t=F(b),v=(b?.maxSize?w.pt2px(b.maxSize):null)||J;let q=0,l=0,r;d.forEach((c,h)=>{if(c&&("line"===c.type||"path"===c.type)){var m=[];switch(c.type){case "line":var e=M(c,0);if(null==e)break; var p=e?.width||0;0===h&&(r=p);c=Math.min(t||p,v);h=0===h?c:t?p/r*c:c;p=h>U/2?2*h:U;l=Math.max(l,h);q=Math.max(q,p);e.width=h;m.push({shape:{type:"path",path:[{command:"M",values:[0,.5*l]},{command:"L",values:[q,.5*l]}]},stroke:e});break;case "path":e=Math.min(t||x,v);h=f(c,0);p=f(c,-.2);var n=L(c,-.4);n=n?{color:n,width:1}:{};if("quad"===c.profile){const u=c.width;c=c.height;c=k.getPathSymbolShapes(u&&c?u/c:1,0===c,0===u);n={...n,join:"bevel"};m.push({shape:c[0],fill:p,stroke:n},{shape:c[1],fill:p, stroke:n},{shape:c[2],fill:h,stroke:n})}else m.push({shape:k.shapes.pathSymbol3DLayer[0],fill:p,stroke:n},{shape:k.shapes.pathSymbol3DLayer[1],fill:h,stroke:n});q=l=Math.max(l,e)}g.push(m)}});return Promise.resolve(C.renderSymbol(g,[q,l],{node:b?.node,scale:a,opacity:b?.opacity,ariaLabel:b?.ariaLabel}))}async function ea(a,b){const d="mesh-3d"===a.type;a=a.symbolLayers;var g=F(b);const t=b?.maxSize?w.pt2px(b.maxSize):null;g=g||x;const v=[];let q=0,l=0;var r=!1;for(let p=0;p