import { c as M } from "../../chunks/runtime.js";
import { css as k, html as r } from "lit";
import { LitElement as F, safeClassMap as i, safeStyleMap as a } from "@arcgis/lumina";
import { f as P, b as y, c as f, a as U, u as I, d as _, e as c } from "../../chunks/univariateUtils.js";
/*! 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 */
const j = k`.arcgis-legend__layer-body{margin-left:var(--calcite-spacing-sm);display:table}:dir(rtl) .arcgis-legend__layer-body{margin-right:var(--calcite-spacing-sm);margin-left:0;overflow:auto}.arcgis-legend__layer-row{display:table-row}.arcgis-legend__layer-cell{display:table-cell;padding:var(--calcite-spacing-xxs) 0;min-width:100px;vertical-align:middle;word-break:break-word}.arcgis-legend__layer-cell--info{padding-right:var(--calcite-spacing-sm);padding-left:var(--calcite-spacing-sm);max-width:250px;word-break:normal;word-wrap:normal;font-size:var(--calcite-font-size-sm)}.arcgis-legend__symbol{display:flex;justify-content:center}.arcgis-legend__ramps{margin-left:var(--calcite-spacing-md)}:dir(rtl) .arcgis-legend__ramps{margin-right:var(--calcite-spacing-md);margin-left:auto}.arcgis-legend__ramp-labels{display:flex;flex-flow:column nowrap;justify-content:space-between}.arcgis-legend__ramp-label{position:relative;padding:0 var(--calcite-spacing-sm);line-height:1em;white-space:nowrap;font-size:var(--calcite-font-size-sm)}.arcgis-legend__ramp-label:before{display:block;position:absolute;top:.25em;right:100%;border-width:3px 4px 3px 0;border-style:solid;border-color:transparent var(--calcite-color-text-1) transparent transparent;width:0;height:0;content:""}.arcgis-legend__ramp-label:first-child{margin-top:calc(var(--calcite-font-size-sm) / 3 * -1)}.arcgis-legend__ramp-label:last-child{bottom:calc(var(--calcite-font-size-sm) * .25 * -1)}:dir(rtl) .arcgis-legend__ramp-label:before{right:auto;left:100%;border-width:3px 0 3px 4px;border-color:transparent transparent transparent var(--calcite-color-text-1)}.arcgis-univariate-above-and-below-ramp__label{position:relative;margin-left:7px;line-height:1em;white-space:nowrap;font-size:var(--calcite-font-size-sm)}.arcgis-univariate-above-and-below-ramp__label:before{display:block;position:absolute;top:.45em;left:-19px;border-width:1px 0 0;border-style:solid;width:14px;height:0;content:""}.arcgis-univariate-above-and-below-ramp__label:first-child{top:calc(var(--calcite-font-size-sm) / 2.2 * -1)}.arcgis-univariate-above-and-below-ramp__label:last-child{bottom:calc(var(--calcite-font-size-sm) / 2.2 * -1)}:dir(rtl) .arcgis-univariate-above-and-below-ramp__label{margin-right:var(--calcite-spacing-sm);margin-left:auto}:dir(rtl) .arcgis-univariate-above-and-below-ramp__label:before{right:-19px;left:auto}.arcgis-univariate-above-and-below-ramp__symbol{display:flex;align-items:center;justify-content:center}`, e = {
  layerBody: "arcgis-legend__layer-body",
  layerRow: "arcgis-legend__layer-row",
  layerInfo: "arcgis-legend__layer-cell arcgis-legend__layer-cell--info",
  symbol: "arcgis-legend__symbol",
  rampContainer: "arcgis-legend__ramps",
  rampLabelsContainer: "arcgis-legend__ramp-labels",
  rampLabel: "arcgis-legend__ramp-label",
  univariateAboveAndBelowLabel: "arcgis-univariate-above-and-below-ramp__label"
};
class H extends F {
  constructor() {
    super(...arguments), this.legendElement = null, this.opacity = 1;
  }
  static {
    this.properties = { cssEffectFilter: 1, legendElement: 0, opacity: 9, messages: 0 };
  }
  static {
    this.styles = j;
  }
  render() {
    const { legendElement: h, opacity: d } = this, { sizeRampElement: s, colorRampElement: p } = P(h, this.messages, d);
    if (!s)
      return null;
    const m = this.messages.previewColorRampAriaLabel, g = y(s, "above", !0), v = y(s, "below", !0), b = 12, o = f(p, {
      width: b,
      height: g,
      rampAlignment: "vertical",
      opacity: d,
      type: "above",
      cssEffectFilter: this.cssEffectFilter,
      ariaLabel: m
    }), w = f(p, {
      width: b,
      height: v,
      rampAlignment: "vertical",
      opacity: d,
      type: "below",
      cssEffectFilter: this.cssEffectFilter,
      ariaLabel: m
    }), u = U(s), n = s.infos.map((l) => l.label), $ = n.map((l, t) => t === 0 ? r`<div class=${i(l ? o ? e.univariateAboveAndBelowLabel : e.rampLabel : void 0)}>${l}</div>` : t === 2 ? r`<div></div>` : null), x = n.length - 1, L = Math.floor(n.length / 2), R = n.map((l, t) => t === L || t === x ? r`<div class=${i(l ? o ? e.univariateAboveAndBelowLabel : e.rampLabel : void 0)}>${l}</div>` : null), A = { display: "table-cell", verticalAlign: "middle" }, C = { marginTop: `${u}px` }, E = { height: `${g}px` }, z = { height: `${v}px` };
    return r`<div style=${a(I)}><div class=${i(e.layerBody)}>${s.infos.map((l, t) => r`<div class=${i(e.layerRow)}><div class=${i(e.symbol)} style=${a(A)}>${l.preview}</div>${!o && t % 2 === 0 ? r`<div class=${i(e.layerInfo)}>${n[t]}</div>` : null}</div>`)}</div>${o ? r`<div style=${a(C)}><div style=${a(_)}><div style=${a(c)}><div class=${i(e.rampContainer)}>${o}</div></div><div style=${a(c)}><div class=${i(e.rampLabelsContainer)} style=${a(E)}>${$}</div></div></div><div style=${a(_)}><div style=${a(c)}><div class=${i(e.rampContainer)}>${w}</div></div><div style=${a(c)}><div class=${i(e.rampLabelsContainer)} style=${a(z)}>${R}</div></div></div></div>` : null}</div>`;
  }
}
M("arcgis-legend-classic-univariate-above-and-below-ramp", H);
export {
  H as ArcgisLegendClassicUnivariateAboveAndBelowRamp
};
