import { LitElement, html } from "lit";
import { customElement } from "../../decorator.js";
import { property } from "lit/decorators.js";
import { Priority } from "../types.js";
import { SetpointMixin } from "../../svghelpers/setpoint-mixin.js";
import "../../building-blocks/instrument-radial/instrument-radial.js";
import { TickmarkStyle } from "../watch/tickmark.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 ObcGaugeRadialType = /* @__PURE__ */ ((ObcGaugeRadialType2) => {
  ObcGaugeRadialType2["filled"] = "filled";
  ObcGaugeRadialType2["bar"] = "bar";
  ObcGaugeRadialType2["needle"] = "needle";
  return ObcGaugeRadialType2;
})(ObcGaugeRadialType || {});
let ObcRotSector = class extends SetpointMixin(LitElement) {
  constructor() {
    super(...arguments);
    this.value = 0;
    this.maxValue = 100;
    this.showLabels = false;
    this.tickmarksInside = false;
    this.primaryTickmarkInterval = 50;
    this.secondaryTickmarkInterval = 10;
    this.tertiaryTickmarkInterval = void 0;
    this.priority = Priority.regular;
    this.portStarboard = false;
    this.tickmarkStyle = TickmarkStyle.regular;
    this.advices = [];
    this.zoomToFitArc = false;
    this.rotArcExtent = 60;
    this.getAngle = (v) => {
      if (!this.maxValue) return 0;
      return v / this.maxValue * this.rotArcExtent;
    };
  }
  get _type() {
    return "bar";
  }
  get _barColor() {
    if (this.priority !== Priority.enhanced) {
      return "var(--instrument-regular-tertiary-color)";
    }
    if (this.portStarboard) {
      if (this.value > 0) {
        return "var(--instrument-starboard-secondary-color)";
      }
      return "var(--instrument-port-secondary-color)";
    }
    return "var(--instrument-enhanced-tertiary-color)";
  }
  render() {
    const barColor = this._barColor;
    return html`
      <obc-instrument-radial
        .value=${this.value}
        .setpoint=${this.setpoint}
        .newSetpoint=${this.newSetpoint}
        .setpointAtZeroDeadband=${this.setpointAtZeroDeadband}
        .setpointOverride=${this.setpointOverride}
        .touching=${this.touching}
        .autoAtSetpoint=${this.autoAtSetpoint}
        .autoAtSetpointDeadband=${this.autoAtSetpointDeadband}
        .maxValue=${this.maxValue}
        .minValue=${-this.maxValue}
        .getAngle=${this.getAngle}
        .needleColor=${this._needleColor}
        .barColor=${barColor}
        .showLabels=${this.showLabels}
        .tickmarksInside=${this.tickmarksInside}
        .tickmarkStyle=${this.tickmarkStyle}
        .primaryTickmarkInterval=${this.primaryTickmarkInterval}
        .secondaryTickmarkInterval=${this.secondaryTickmarkInterval}
        .tertiaryTickmarkInterval=${this.tertiaryTickmarkInterval}
        .type=${this._type}
        .needleType=${this._type}
        .advices=${this.advices}
        .clipBottom=${50}
        .zoomToFitArc=${this.zoomToFitArc}
      >
      </obc-instrument-radial>
    `;
  }
  get _needleColor() {
    if (this.priority !== Priority.enhanced) {
      return "var(--instrument-regular-secondary-color)";
    }
    if (this.portStarboard) {
      if (this.value > 0) {
        return "var(--instrument-starboard-primary-color)";
      }
      if (this.value < 0) {
        return "var(--instrument-port-primary-color)";
      }
      return "var(--instrument-regular-secondary-color)";
    }
    return "var(--instrument-enhanced-secondary-color)";
  }
};
__decorateClass([
  property({ type: Number })
], ObcRotSector.prototype, "value", 2);
__decorateClass([
  property({ type: Number })
], ObcRotSector.prototype, "maxValue", 2);
__decorateClass([
  property({ type: Boolean })
], ObcRotSector.prototype, "showLabels", 2);
__decorateClass([
  property({ type: Boolean })
], ObcRotSector.prototype, "tickmarksInside", 2);
__decorateClass([
  property({ type: Number })
], ObcRotSector.prototype, "primaryTickmarkInterval", 2);
__decorateClass([
  property({ type: Number })
], ObcRotSector.prototype, "secondaryTickmarkInterval", 2);
__decorateClass([
  property({ type: Number })
], ObcRotSector.prototype, "tertiaryTickmarkInterval", 2);
__decorateClass([
  property({ type: String })
], ObcRotSector.prototype, "priority", 2);
__decorateClass([
  property({ type: Boolean })
], ObcRotSector.prototype, "portStarboard", 2);
__decorateClass([
  property({ type: String })
], ObcRotSector.prototype, "tickmarkStyle", 2);
__decorateClass([
  property({ type: Array, attribute: false })
], ObcRotSector.prototype, "advices", 2);
__decorateClass([
  property({ type: Boolean })
], ObcRotSector.prototype, "zoomToFitArc", 2);
__decorateClass([
  property({ type: Number })
], ObcRotSector.prototype, "rotArcExtent", 2);
ObcRotSector = __decorateClass([
  customElement("obc-rot-sector")
], ObcRotSector);
export {
  ObcGaugeRadialType,
  ObcRotSector
};
//# sourceMappingURL=rot-sector.js.map
