'use strict';

Object.defineProperty(exports, '__esModule', { value: true });

const index$1 = require('./index-df541290.js');
const index = require('./index-b7493032.js');
require('./_commonjsHelpers-10109b76.js');

const sv = {
  Edit: "Redigera",
  Delete: "Radera",
  primary: "primär",
  billing: "fakturering",
  delivery: "leverans",
  visit: "besök",
};

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

const styleCss = ".sc-ig-address-h{display:block;position:relative}[hidden].sc-ig-address-h{display:none}smoothly-icon.sc-ig-address{cursor:pointer;margin-top:.3em}label.sc-ig-address{display:inline-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-address{display:none;position:absolute;right:0}.sc-ig-address-h:hover smoothly-popup.sc-ig-address{display:inline}";

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

exports.ig_address = IntergiroAddress;
