/*! All material copyright Esri, All Rights Reserved, unless otherwise specified.
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
v4.34.7 */
import a from"./7OU6NVXW.js";import{a as u}from"./DJOTU35N.js";import"./CAGG7IOD.js";import{a as w}from"./2Z6ISORA.js";import{b as c}from"./IMJMO6DB.js";import{J as L,K as t,L as v,M as y,P as C,a as k,b as l}from"./RNRMSLW5.js";import"./G6QKOIC3.js";export default $arcgis.t(([f,{a:b,b:z,d:F,g:$,h:x}])=>{var I=k`.esri-widget__heading{color:var(--calcite-color-text-2);margin:0 0 .5rem;font-weight:var(--calcite-font-weight-semibold)}h1.esri-widget__heading{font-size:var(--calcite-font-size-xl)}h2.esri-widget__heading{font-size:var(--calcite-font-size-md)}h3.esri-widget__heading,h4.esri-widget__heading,h5.esri-widget__heading,h6.esri-widget__heading{font-size:var(--calcite-font-size)}.arcgis-legend--card__section{word-break:break-word;word-wrap:break-word;padding:var(--calcite-spacing-sm) var(--calcite-spacing-md);min-width:250px;max-width:500px;height:100%;height:-moz-available;height:-webkit-fill-available;height:fill-available;overflow:auto;font-size:var(--calcite-font-size-sm)}.arcgis-legend--card__carousel-title-container{margin-bottom:var(--calcite-spacing-sm)}.arcgis-legend--card__carousel-title{margin:0}.arcgis-legend--card__section-title{font-weight:var(--calcite-font-weight-normal)}.arcgis-legend--card__layer-caption{padding:var(--calcite-spacing-xs) 0;margin:0;font-weight:var(--calcite-font-weight-normal)}.arcgis-legend--card__imagery-layer-image--stretched{display:block;margin-bottom:-2px}.arcgis-legend--card__image-label{padding-right:var(--calcite-spacing-xs);padding-left:var(--calcite-spacing-xs)}.arcgis-legend--card__label-element{margin:.1em;padding:.5em 1em;min-width:2em;min-height:1em;text-align:center;display:flex;align-items:center;justify-content:center;flex:1}.arcgis-legend--card__layer-row{display:flex;align-items:center}.arcgis-legend--card__symbol{display:block;margin:auto}.arcgis-legend--card__pie-chart-ramp-preview{display:flex;justify-content:center}.arcgis-legend--card__relationship-container{display:flex;flex-direction:column}.arcgis-legend--card__relationship-container .arcgis-legend--card__layer-row{padding-bottom:.5em}.arcgis-legend--card__relationship-container .arcgis-legend--card__layer-row:last-child{padding-bottom:0}.arcgis-legend--card__container{display:flex;gap:var(--calcite-spacing-sm);flex-wrap:wrap}.arcgis-legend--card__background-styles-container{display:flex;flex-wrap:wrap}:host([stacked]) .arcgis-legend--card__container{display:table}:host([stacked]) .arcgis-legend--card__symbol-row{display:table-row;width:100%}:host([stacked]) .arcgis-legend--card__label-cell{display:table-cell;vertical-align:middle;padding:var(--calcite-spacing-xxs)}:host([stacked]) .arcgis-legend--card__symbol-cell{display:table-cell;vertical-align:middle;text-align:center;padding:var(--calcite-spacing-xxs)}:host([stacked]) .arcgis-legend--card__symbol-cell div{display:flex;align-items:center;justify-content:center}`,a={carouselTitleContainer:"arcgis-legend--card__carousel-title-container",carouselTitle:"arcgis-legend--card__carousel-title",sectionTitle:"arcgis-legend--card__section-title",imageryLayerStretchedImage:"arcgis-legend--card__imagery-layer-image--stretched",imageLabel:"arcgis-legend--card__image-label",layerCaption:"arcgis-legend--card__layer-caption",labelElement:"arcgis-legend--card__label-element",layerRow:"arcgis-legend--card__layer-row",labelCell:"arcgis-legend--card__label-cell",section:"arcgis-legend--card__section",symbol:"arcgis-legend--card__symbol",symbolRow:"arcgis-legend--card__symbol-row",symbolCell:"arcgis-legend--card__symbol-cell",pieChartRampPreview:"arcgis-legend--card__pie-chart-ramp-preview",relationshipContainer:"arcgis-legend--card__relationship-container",backgroundStylesContainer:"arcgis-legend--card__background-styles-container",container:"arcgis-legend--card__container"};function S(p){return p?p.r*.299+p.g*.587+p.b*.114>=127:void 0}var E=class extends L{constructor(){super(...arguments),this.stacked=!1,this.headingLevel=3}static{this.properties={cssEffectFilter:1,stacked:7,activeLayerInfo:0,headingLevel:9,layer:0,legendElement:0,messages:0}}static{this.styles=I}_getBackgroundStyles(e){let r=e.symbol,i=r.color,n=!!i?.a,s="outline"in r?r.outline:null,d=!!s?.color?.a,o=n&&i?new f([i.r,i.g,i.b,i.a*this.layer.opacity]):new f([255,255,255,0]),g=d&&s.color?new f([s.color.r,s.color.g,s.color.b,s.color.a*this.layer.opacity]):new f([255,255,255,0]),m=S(e.symbol.color)??!0,h=m?"black":"white",_=m?"rgba(255, 255, 255, .6)":"rgba(0, 0, 0, .6)";return{background:n?o.toCss(!0):"none",color:h,textShadow:`-1px -1px 0 ${_},
                  1px -1px 0 ${_},
                  -1px 1px 0 ${_},
                  1px 1px 0 ${_}`,border:d?`1px solid ${g.toCss(!0)}`:"none",filter:this.cssEffectFilter??""}}render(){let e=this._renderLegendElement(),r=z(this.legendElement,this.messages),i=this.stacked?l`<div class=${t(a.carouselTitleContainer)}>${u({class:c(a.carouselTitle,w.heading),level:this.headingLevel,children:this.activeLayerInfo.title})}${r?l`<p class=${t(a.layerCaption)}>${r}</p>`:null}</div>`:r?u({class:c(a.sectionTitle,w.heading),level:this.headingLevel,children:r}):null;return l`<section class=${t(a.section)} role=tabpanel tabindex=0>${i}${e}</section>`}_renderLegendElement(){switch(this.legendElement.type){case"symbol-table":return this._renderSymbolTable(this.legendElement);case"size-ramp":return l`<arcgis-legend-card-size-ramp .hasIndicators=${this.stacked} .legendElement=${this.legendElement} .messages=${this.messages} .opacity=${this.layer.opacity}></arcgis-legend-card-size-ramp>`;case"color-ramp":case"opacity-ramp":case"heatmap-ramp":case"stretch-ramp":return l`<arcgis-legend-card-color-ramp .cssEffectFilter=${this.cssEffectFilter} .legendElement=${this.legendElement} .messages=${this.messages} .opacity=${this.layer.opacity}></arcgis-legend-card-color-ramp>`;case"relationship-ramp":return l`<arcgis-legend-relationship-ramp .cssEffectFilter=${this.cssEffectFilter} .legendElement=${this.legendElement} .opacity=${this.layer.opacity} .messages=${this.messages}></arcgis-legend-relationship-ramp>`;case"pie-chart-ramp":{let{preview:e}=this.legendElement;return x(e,this.messages.previewPieChartAriaLabel),l`<div class=${t(a.pieChartRampPreview)}>${e}</div>`}case"univariate-above-and-below-ramp":return l`<arcgis-legend-card-univariate-above-and-below-ramp .cssEffectFilter=${this.cssEffectFilter} .legendElement=${this.legendElement} .messages=${this.messages} .opacity=${this.layer.opacity}></arcgis-legend-card-univariate-above-and-below-ramp>`;case"univariate-color-size-ramp":return l`<arcgis-legend-card-univariate-color-size-ramp .cssEffectFilter=${this.cssEffectFilter} .legendElement=${this.legendElement} .messages=${this.messages} .opacity=${this.layer.opacity}></arcgis-legend-card-univariate-color-size-ramp>`;default:return null}}_renderSymbolTable(e){let r=e.infos.map(s=>this._renderElementInfo(s,e.legendType)).filter(Boolean);if(!r.length)return null;let i=e.infos.some(s=>"symbol"in s&&s.symbol?.type.includes("simple-fill")),n=this.activeLayerInfo.legendElements.some(({type:s})=>s==="relationship-ramp")?a.relationshipContainer:i?a.backgroundStylesContainer:a.container;return l`<div class=${t(n)}>${r}</div>`}_renderElementInfo(e,r){let{layer:i}=this,n="label"in e?e.label:null;if("type"in e&&e.type)return l`<arcgis-legend-card-element .activeLayerInfo=${this.activeLayerInfo} .cssEffectFilter=${this.cssEffectFilter} .stacked=${this.stacked} .headingLevel=${this.headingLevel} .layer=${i} .legendElement=${e} .messages=${this.messages}></arcgis-legend-card-element>`;if(!("preview"in e&&e.preview)&&!("src"in e&&e.src))return null;let s=F(i,r),d=b(this.messages,n,!1)||"";if("src"in e&&e.src){let o={[a.symbolCell]:this.stacked};return l`<div class=${t(c(a.layerRow,{[a.symbolRow]:this.stacked}))}><div class=${t(c(o))}>${this._renderImage(e,i,s)}</div><div class=${t(c(a.imageLabel,{[a.labelCell]:this.stacked}))}>${d}</div></div>`}if("symbol"in e&&e.preview){if(!e.symbol?.type.includes("simple-fill")){if(!e.label)return l`<div>${e.preview}</div>`;let o={[a.symbolCell]:this.stacked},{preview:g}=e,m="previewAriaLabel"in e?e.previewAriaLabel:null,h="label"in e?b(this.messages,e.label,!1):null;return x(g,$(this.messages,m||h)),l`<div class=${t(c(a.layerRow,{[a.symbolRow]:this.stacked}))}><div class=${t(c(o))}>${g}</div><div class=${t(c(a.imageLabel,{[a.labelCell]:this.stacked}))}>${d}</div></div>`}return l`<div class=${t(a.layerRow)}><div class=${t(a.labelElement)} style=${v(this._getBackgroundStyles(e))}>${d}</div></div>`}return null}_renderImage(e,r,i){let{previewAriaLabel:n,src:s,opacity:d}=e,o=b(this.messages,e.label,!1),g={[a.imageryLayerStretchedImage]:i,[a.symbol]:!i},m={opacity:`${d??r.opacity}`},h=$(this.messages,n||o);return l`<img alt=${h??y} .ariaLabel=${h} class=${t(c(g))} height=${e.height??void 0??y} src=${s??y} style=${v(m)} width=${e.width??void 0??y}>`}};C("arcgis-legend-card-element",E);return E},"Color",a)