import { r as registerInstance, j as createEvent, h, g as getElement } from './index-07845439.js';
import { d as dist } from './index-63517df5.js';
import './_commonjsHelpers-8fe71198.js';

const sv = {
  Edit: "Redigera",
  Delete: "Radera",
  primary: "primär",
  cellphone: "mobiltelefon",
  landline: "fast telefon",
};

function create(language) {
  return dist.create({
    sv,
  }, language);
}

const styleCss = ".sc-ig-phone-number-h{display:block;position:relative}[hidden].sc-ig-phone-number-h{display:none}smoothly-display.sc-ig-phone-number{border-top:1px solid rgb(var(--smoothly-medium-color));border-bottom:1px solid rgb(var(--smoothly-medium-color));padding-top:.5em;padding-bottom:.5em}label.sc-ig-phone-number{display:block;-webkit-margin-before:.6em;margin-block-start:.6em;-webkit-margin-after:.2em;margin-block-end:.2em;text-transform:capitalize;margin-bottom:.2em}smoothly-popup.sc-ig-phone-number{display:none;position:absolute;right:0}.sc-ig-phone-number-h:hover smoothly-popup.sc-ig-phone-number{display:inline}smoothly-icon.sc-ig-phone-number{cursor:pointer}";

const IntergiroPhoneNumber = class {
  constructor(hostRef) {
    registerInstance(this, hostRef);
    this.edit = createEvent(this, "edit", 7);
    this.delete = createEvent(this, "delete", 7);
    this.editable = true;
    this.type = "primary";
    this.mode = "display";
  }
  componentWillLoad() {
    this.t = create(this.element);
  }
  onEdit(event) {
    event.stopPropagation();
    this.value = event.detail;
    this.mode = "display";
    this.edit.emit({ type: this.type, value: this.value });
  }
  onDelete() {
    this.delete.emit(this.type);
  }
  render() {
    const t = this.t;
    return this.value.length > 0 ? (this.mode == "display" ? ([
      this.editable && (h("smoothly-popup", null, h("smoothly-icon", { name: "ellipsis-vertical-outline", size: "small" }), h("div", { color: "light", slot: "popup" }, h("smoothly-icon", { size: "small", name: "pencil-outline", toolTip: t("Edit"), onClick: () => (this.mode = "edit") }), h("smoothly-icon", { size: "small", name: "trash", toolTip: "Delete", onClick: () => this.onDelete() })))),
      h("label", null, t(this.type)),
      h("smoothly-display", { type: "phone", value: this.value }),
    ]) : (h("ig-phone-number-input", { value: this.value, onEdit: (e) => this.onEdit(e) }))) : ([]);
  }
  get element() { return getElement(this); }
};
IntergiroPhoneNumber.style = styleCss;

export { IntergiroPhoneNumber as ig_phone_number };
