import { unsafeCSS, LitElement, html } from "lit";
import { property } from "lit/decorators.js";
import compentStyle from "./automation-readout.css.js";
import { classMap } from "lit/directives/class-map.js";
import { lineWidth } from "../index.js";
import { customElement } from "../../decorator.js";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __decorateClass = (decorators, target, key, kind) => {
  var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
    if (decorator = decorators[i])
      result = (kind ? decorator(target, key, result) : decorator(result)) || result;
  if (kind && result) __defProp(target, key, result);
  return result;
};
var AutomationReadoutPosition = /* @__PURE__ */ ((AutomationReadoutPosition2) => {
  AutomationReadoutPosition2["Left"] = "left";
  AutomationReadoutPosition2["Right"] = "right";
  AutomationReadoutPosition2["Top"] = "top";
  AutomationReadoutPosition2["Bottom"] = "bottom";
  return AutomationReadoutPosition2;
})(AutomationReadoutPosition || {});
let ObcAutomationReadout = class extends LitElement {
  constructor() {
    super(...arguments);
    this.value = 0;
    this.unit = "";
    this.numberOfDigits = 3;
    this.position = "bottom";
    this.lineType = void 0;
  }
  render() {
    const offset = this.getLineWidth() / 2;
    return html`
      <button
        class=${classMap({
      wrapper: true,
      [`position-${this.position}`]: true
    })}
        style="--offset: ${offset}px;"
      >
        <div class="visible-wrapper">
          <div
            class="value"
            style="min-width: ${this.numberOfDigits.toFixed(0)}ch"
          >
            ${this.value.toFixed(0)}
          </div>
          <div class="unit">${this.unit}</div>
        </div>
      </button>
    `;
  }
  getLineWidth() {
    if (this.lineType === void 0) {
      return 0;
    }
    return lineWidth(this.lineType);
  }
};
ObcAutomationReadout.styles = unsafeCSS(compentStyle);
__decorateClass([
  property({ type: Number })
], ObcAutomationReadout.prototype, "value", 2);
__decorateClass([
  property({ type: String })
], ObcAutomationReadout.prototype, "unit", 2);
__decorateClass([
  property({ type: Number })
], ObcAutomationReadout.prototype, "numberOfDigits", 2);
__decorateClass([
  property({ type: String })
], ObcAutomationReadout.prototype, "position", 2);
__decorateClass([
  property({ type: String })
], ObcAutomationReadout.prototype, "lineType", 2);
ObcAutomationReadout = __decorateClass([
  customElement("obc-automation-readout")
], ObcAutomationReadout);
export {
  AutomationReadoutPosition,
  ObcAutomationReadout
};
//# sourceMappingURL=automation-readout.js.map
