/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
import { c } from "../../chunks/runtime.js";
import t from "@arcgis/core/Color.js";
import { LitElement as e } from "@arcgis/lumina";
import { css as m, html as n } from "lit";
const p = m`:host{display:block;block-size:30px;inline-size:100%}:host([layout="vertical"]){writing-mode:vertical-lr}arcgis-ramp-color{block-size:inherit;inline-size:inherit}`, l = new t([0, 121, 193]);
class h extends e {
  constructor() {
    super(...arguments), this._rampStops = [], this.fillColor = l.clone(), this.layout = "horizontal", this.min = 0, this.max = 1, this.stops = [];
  }
  static {
    this.properties = { fillColor: 1, layout: 1, min: 9, max: 9, stops: 0 };
  }
  static {
    this.styles = p;
  }
  willUpdate(o) {
    if (super.willUpdate(o), o.has("fillColor") || o.has("stops")) {
      const { stops: a, fillColor: s } = this, i = (s instanceof t ? s : t.fromString(s) ?? l).toRgb();
      this._rampStops = a.map((r) => ({
        color: new t(i && [...i, r.opacity]),
        value: r.value
      }));
    }
  }
  render() {
    return n`<arcgis-ramp-color .layout=${this.layout} .stops=${this._rampStops} .min=${this.min} .max=${this.max}></arcgis-ramp-color>`;
  }
}
c("arcgis-ramp-opacity", h);
export {
  h as ArcgisRampOpacity
};
