/* COPYRIGHT Esri - https://js.arcgis.com/5.0/LICENSE.txt */
import a from"./ZKOJATCN.js";import{O as P,P as k,Q as g,U as A,a as N,b as v}from"./7H4DKXI2.js";import"./ALDX5YZO.js";export default $arcgis.t(([{e:C,g:I,h:R}])=>{var B=N`.size-ramp-container{display:flex;align-items:center;justify-content:center}.size-ramp-vertical-container{display:flex;flex-direction:column;align-items:center;justify-content:center}.size-ramp-label{margin:0 .5em;white-space:nowrap}.size-ramp-vertical-ramp{display:flex;flex-direction:column;align-items:center}.size-ramp-ramp{display:flex;flex-direction:row-reverse;align-items:center}.size-ramp-preview{display:flex}`,O="#ddd";function X(e){if(!e)return;if(e.type.includes("3d")){if(!("symbolLayers"in e)||!e.symbolLayers?.length)return;let s=e.symbolLayers.at(-1),i=s&&"resource"in s?s.resource?.primitive:void 0;return i==="circle"||i==="cross"||i==="kite"||i==="sphere"||i==="cube"||i==="diamond"}let n="style"in e?e.style:void 0;return n==="circle"||n==="diamond"||n==="cross"}function Y(e){if(e){if(e.type.includes("3d")){if(!("symbolLayers"in e)||!e.symbolLayers?.length)return;let n=e.symbolLayers.at(-1),s=n&&"resource"in n?n.resource?.primitive:void 0;return s==="triangle"||s==="cone"||s==="tetrahedron"}return"style"in e&&e.style==="triangle"}}var j=class extends P{constructor(){super(...arguments),this.hasIndicators=!1,this.legendElement=null,this.opacity=1}static{this.properties={hasIndicators:5,legendElement:0,opacity:9,messages:0}}static{this.styles=B}render(){if(this.legendElement.theme==="spike")return v`<div style=${g({display:"flex",flex:"1",justifyContent:"center"})}><arcgis-legend-spike-ramp .legendElement=${this.legendElement} .messages=${this.messages}></arcgis-legend-spike-ramp></div>`;let{legendElement:n,hasIndicators:s,opacity:i}=this,o=n.infos,d=o.at(0),m=o.at(-1);if(!d||!m)return null;let{label:y,...z}=d,{label:f,...x}=m,r=z.preview,t=x.preview;if(!r||!t)return null;r=r.cloneNode(!0),r.style.display="flex",R(r,I(this.messages,y)),t=t.cloneNode(!0),t.style.display="flex",R(t,I(this.messages,f));let l={opacity:`${i??""}`};return v`<div class=${k(s?"size-ramp-vertical-container":"size-ramp-container")}><div class="size-ramp-label">${s?y:f}</div><div class=${k(s?"size-ramp-vertical-ramp":"size-ramp-ramp")}><div class="size-ramp-preview" style=${g(l)}>${r}</div>${this._renderSizeRampLines(n)}<div class="size-ramp-preview" style=${g(l)}>${t}</div></div><div class="size-ramp-label">${s?f:y}</div></div>`}_renderSizeRampLines(n){let s=n.infos,i=s.at(0),o=s.at(-1);if(!i||!o)return null;let d=i.symbol,m=this.hasIndicators,y=i.size&&typeof i.size=="number"?i.size:0,z=o.size&&typeof o.size=="number"?o.size:0,f=i.outlineSize||0,x=o.outlineSize||0,r=C(y+f),t=C(z+x),l=m?r:r+50,p=m?r/2+50:r,u=Y(d),h=X(d),c=document.createElement("canvas");c.width=l,c.height=p,c.style.width=`${c.width}px`,c.style.height=`${c.height}px`;let a=c.getContext("2d");if(m){a.beginPath();let $=0,b=0,w=l/2-t/2,M=p;a.moveTo($,b),a.lineTo(w,M);let L=l,T=0,E=l/2+t/2,S=p;a.moveTo(L,T),a.lineTo(E,S)}else{a.beginPath();let $=0,b=p/2-t/2,w=l;a.moveTo($,b),a.lineTo(w,0);let L=0,T=p/2+t/2,E=l,S=p;a.moveTo(L,T),a.lineTo(E,S)}return a.strokeStyle=O,a.stroke(),v`<div style=${g(m?{display:"flex",marginTop:`-${u?0:h?r/2:0}px`,marginBottom:`-${u?t:h?t/2:0}px`}:{display:"flex",marginRight:`-${u?0:h?r/2:0}px`,marginLeft:`-${u?0:h?t/2:0}px`})}>${c}</div>`}};A("arcgis-legend-card-size-ramp",j);return j},a)