/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
import { c as g } from "../../chunks/runtime.js";
import { css as u, html as i } from "lit";
import { LitElement as x, safeClassMap as b } from "@arcgis/lumina";
import { c as r } from "../../chunks/time-utils.js";
import { V as n } from "../../chunks/visible-element.js";
const C = u`:host{--calcite-label-margin-bottom: 0;gap:var(--calcite-spacing-md);flex-direction:column;display:flex}.label{display:block}.discrete-label-text{font-weight:var(--calcite-font-weight-medium);opacity:var(--calcite-opacity-disabled)}.label-open{&:not(.label-empty){margin-bottom:var(--calcite-spacing-xs)}.discrete-label-text{opacity:1}}arcgis-shadow-cast-discrete-config{padding:0 var(--calcite-spacing-xs)}`;
class f extends x {
  constructor() {
    super(...arguments), this.scale = "s", this.minMinDuration = 0, this.maxMinDuration = r(8, "hours", "milliseconds"), this.hideColorPicker = !1, this.hideSlider = !1, this.hideContextOptions = !1, this.hideContextToggle = !1, this.hideContextColorPicker = !1, this.hideContextInterval = !1;
  }
  static {
    this.properties = { options: 0, scale: 1, minMinDuration: 9, maxMinDuration: 9, messages: 0, hideColorPicker: 5, hideSlider: 5, hideContextOptions: 5, hideContextToggle: 5, hideContextColorPicker: 5, hideContextInterval: 5 };
  }
  static {
    this.styles = C;
  }
  render() {
    const { options: s, scale: t } = this, e = this.messages?.minDuration;
    return i`${n({ hidden: this.hideSlider, children: i`<calcite-label .scale=${t}>${e?.minDurationLabel}<calcite-slider fill-placement=end label-ticks .min=${c(this.minMinDuration)} .max=${c(this.maxMinDuration)} .value=${c(s.minDuration)} snap step=0.5 .scale=${t} ticks=1 @calciteSliderInput=${(o) => {
      s.minDuration = $(o.currentTarget.value);
    }}></calcite-slider></calcite-label>` })}${n({ hidden: this.hideColorPicker, children: i`<arcgis-color-select .color=${this.options.color} .label=${e?.colorLabel} @arcgisColorChanged=${(o) => {
      s.color = o.detail;
    }}></arcgis-color-select>` })}${n({ hidden: this.hideContextOptions, children: this._renderContextOptions() })}`;
  }
  _renderContextOptions() {
    const { options: s, scale: t } = this, e = s.contextEnabled, o = this.messages?.minDuration, l = !this.hideContextToggle, h = !this.hideContextColorPicker, m = !this.hideContextInterval, d = h || m;
    if (!(!l && (!e || !d)))
      return i`<div><calcite-label class=${b({
        label: !0,
        "label-open": e,
        "label-empty": !d
      })} .layout=${l ? "inline-space-between" : "default"} .scale=${t}><span class="discrete-label-text">${o?.discreteLabel ?? "foo"}</span>${n({ hidden: !l, children: i`<calcite-switch .checked=${e} .scale=${t} @calciteSwitchChange=${(p) => {
        this.options.contextEnabled = p.target.checked;
      }}></calcite-switch>` })}</calcite-label>${n({ hidden: !e, children: i`<arcgis-shadow-cast-discrete-config .hideColorPicker=${this.hideContextColorPicker} .hideInterval=${this.hideContextInterval} .messages=${this.messages} .options=${this.options.contextOptions} .scale=${t}></arcgis-shadow-cast-discrete-config>` })}</div>`;
  }
}
function c(a) {
  return r(a, "milliseconds", "hours");
}
function $(a) {
  return Math.round(r(a, "hours", "milliseconds"));
}
g("arcgis-shadow-cast-min-duration-config", f);
export {
  f as ArcgisShadowCastMinDurationConfig
};
