import { unsafeCSS, LitElement, html, nothing } from "lit";
import { property } from "lit/decorators.js";
import { customElement } from "../../../decorator.js";
import componentStyle from "./poi-selection-frame.css.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;
};
const OBC_POI_SELECTION_FRAME_MIN_CUSTOM_SIZE_PX = 28;
var ObcPoiSelectionFrameType = /* @__PURE__ */ ((ObcPoiSelectionFrameType2) => {
  ObcPoiSelectionFrameType2["Indicator"] = "indicator";
  ObcPoiSelectionFrameType2["Button"] = "button";
  ObcPoiSelectionFrameType2["Enhanced"] = "enhanced";
  return ObcPoiSelectionFrameType2;
})(ObcPoiSelectionFrameType || {});
var ObcPoiSelectionFrameState = /* @__PURE__ */ ((ObcPoiSelectionFrameState2) => {
  ObcPoiSelectionFrameState2["Regular"] = "regular";
  ObcPoiSelectionFrameState2["Alert"] = "alert";
  ObcPoiSelectionFrameState2["None"] = "none";
  ObcPoiSelectionFrameState2["Flat"] = "flat";
  return ObcPoiSelectionFrameState2;
})(ObcPoiSelectionFrameState || {});
let ObcPoiSelectionFrame = class extends LitElement {
  constructor() {
    super(...arguments);
    this.type = "indicator";
    this.state = "regular";
    this.customMode = false;
    this.boxWidth = null;
    this.boxHeight = null;
  }
  get resolvedCustomBoxWidthPx() {
    const width = Number(this.boxWidth);
    const offsetWidth = Number.isFinite(width) && width >= 0 ? width : 0;
    return OBC_POI_SELECTION_FRAME_MIN_CUSTOM_SIZE_PX + offsetWidth;
  }
  get resolvedCustomBoxHeightPx() {
    const height = Number(this.boxHeight);
    const offsetHeight = Number.isFinite(height) && height >= 0 ? height : 0;
    return OBC_POI_SELECTION_FRAME_MIN_CUSTOM_SIZE_PX + offsetHeight;
  }
  get resolvedCustomVisualWidthPx() {
    return this.resolvedCustomBoxWidthPx;
  }
  get resolvedCustomVisualHeightPx() {
    return this.resolvedCustomBoxHeightPx;
  }
  renderCorner(position) {
    return html` <span class="corner ${position}"></span> `;
  }
  renderFrame() {
    if (this.state === "none") {
      return nothing;
    }
    const style = this.customMode ? `--obc-poi-selection-frame-custom-width: ${this.resolvedCustomVisualWidthPx}px; --obc-poi-selection-frame-custom-height: ${this.resolvedCustomVisualHeightPx}px;` : "";
    const parts = this.customMode ? "corner-frame custom-frame" : "corner-frame";
    return html`
      <span class="corner-frame" part=${parts} style=${style}>
        ${this.renderCorner(
      "tl"
      /* TopLeft */
    )}
        ${this.renderCorner(
      "tr"
      /* TopRight */
    )}
        ${this.renderCorner(
      "bl"
      /* BottomLeft */
    )}
        ${this.renderCorner(
      "br"
      /* BottomRight */
    )}
      </span>
    `;
  }
  render() {
    return html`<span class="frame" part="frame" aria-hidden="true"
      >${this.renderFrame()}</span
    >`;
  }
};
ObcPoiSelectionFrame.styles = unsafeCSS(componentStyle);
__decorateClass([
  property({ type: String, reflect: true })
], ObcPoiSelectionFrame.prototype, "type", 2);
__decorateClass([
  property({ type: String, reflect: true })
], ObcPoiSelectionFrame.prototype, "state", 2);
__decorateClass([
  property({ type: Boolean, reflect: true, attribute: "custom-mode" })
], ObcPoiSelectionFrame.prototype, "customMode", 2);
__decorateClass([
  property({ type: Number, attribute: "box-width" })
], ObcPoiSelectionFrame.prototype, "boxWidth", 2);
__decorateClass([
  property({ type: Number, attribute: "box-height" })
], ObcPoiSelectionFrame.prototype, "boxHeight", 2);
ObcPoiSelectionFrame = __decorateClass([
  customElement("obc-poi-selection-frame")
], ObcPoiSelectionFrame);
export {
  OBC_POI_SELECTION_FRAME_MIN_CUSTOM_SIZE_PX,
  ObcPoiSelectionFrame,
  ObcPoiSelectionFrameState,
  ObcPoiSelectionFrameType
};
//# sourceMappingURL=poi-selection-frame.js.map
