/* COPYRIGHT Esri - https://js.arcgis.com/5.1.0/LICENSE.txt */
import{__decorate as e}from"tslib";import{property as t,subclass as i}from"../../../../core/accessorSupport/decorators.js";import o from"../../../Widget.js";import{css as s}from"./css.js";import{getUnivariateAboveAndBelowRampElements as r,getUnivariateSizeRampSize as l,getUnivariateColorRampSize as a,getUnivariateColorRampPreview as n,getUnivariateColorRampMargin as p}from"../support/univariateUtils.js";import{attachToNode as c}from"../../support/styleUtils.js";import{tsx as m,isRTL as d}from"../../../support/widget.js";let f=class extends o{constructor(e,t){super(e,t),this.cssEffectFilter=null,this.legendElement=null,this.opacity=1}render(){const{legendElement:e,opacity:t,cssEffectFilter:i,key:o}=this,{sizeRampElement:f,colorRampElement:y}=r(e,t,"horizontal");if(!f)return null;const v=l(f,"full",!0,"horizontal"),h=a(f,"above",!0,"horizontal"),u=a(f,"below",!0,"horizontal"),b=12,g=this.messages?.previewColorRampAriaLabel,w=n(y,{width:h,height:b,rampAlignment:"horizontal",opacity:t,type:"above",cssEffectFilter:i,ariaLabel:g}),x=n(y,{width:u,height:b,rampAlignment:"horizontal",opacity:t,type:"below",cssEffectFilter:i,ariaLabel:g}),E=p(f,"card"),z=f.infos.map(e=>e.label),C=z.length-1,R=z.map((e,t)=>0===t||t===C?m("div",{key:t},e):null),j={display:"flex",flexDirection:"column"},A={display:"flex",flexDirection:"row"},L={marginTop:"3px",display:"flex"};d(this.container)?L.marginRight=`${E}px`:L.marginLeft=`${E}px`;const k={width:`${v}px`,display:"flex",flexDirection:"row",justifyContent:"space-between"};return m("div",{class:s.layerRow,key:`${o}-container`,styles:j},m("div",{class:this.classes(s.symbolContainer,s.sizeRampHorizontal),styles:A},f.infos.map((e,t)=>m("div",{afterCreate:c,bind:e.preview,class:s.symbol,key:t}))),w?m("div",{class:s.univariateAboveAndBelowColorRamp,key:"color-ramp-preview",styles:L},m("div",{afterCreate:c,bind:w}),m("div",{afterCreate:c,bind:x})):null,m("div",{class:s.layerInfo},m("div",{class:s.rampLabelsContainer,styles:k},R)))}};e([t()],f.prototype,"cssEffectFilter",void 0),e([t()],f.prototype,"legendElement",void 0),e([t()],f.prototype,"messages",void 0),e([t()],f.prototype,"opacity",void 0),f=e([i("esri.widgets.Legend.styles.card.UnivariateAboveAndBelowRamp")],f);export{f as default};
