import { r as registerInstance, j as createEvent, h, g as getElement } from './index-aeac5cad.js';
import './_commonjsHelpers-91fffb88.js';
import { I as Item } from './index-df45deab.js';
import { d as dist } from './index-fdd60c34.js';

const sv = {
  "@": "à",
  "Remove item": "Ta bort artikel",
};

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

const styleCss = ".sc-payfunc-display-item-h{display:block}[hidden].sc-payfunc-display-item-h{display:none}.sc-payfunc-display-item-h>section.sc-payfunc-display-item{margin-left:.3em;display:flex;flex-wrap:nowrap}.sc-payfunc-display-item-h>section.sc-payfunc-display-item>span.sc-payfunc-display-item{margin-bottom:0.8em;padding-left:1.5em;white-space:nowrap;overflow:hidden;text-overflow:visible}.sc-payfunc-display-item-h>section.sc-payfunc-display-item>span.medium.sc-payfunc-display-item{flex-grow:2}.sc-payfunc-display-item-h>section.sc-payfunc-display-item>span.small.sc-payfunc-display-item{flex-grow:1}.sc-payfunc-display-item-h>section.sc-payfunc-display-item>span.big.sc-payfunc-display-item{flex-grow:3}.left.sc-payfunc-display-item{border-left:1px solid rgb(var(--smoothly-medium-color))}.sc-payfunc-display-item-h>section.sc-payfunc-display-item>smoothly-trigger.sc-payfunc-display-item{margin-right:0px;margin-left:8px;margin-top:-3px;float:right}";

const PayfuncDisplayItem = class {
  constructor(hostRef) {
    registerInstance(this, hostRef);
    this.itemDeleted = createEvent(this, "itemDeleted", 7);
    this.item = {};
    this.removable = true;
  }
  componentWillLoad() {
    this.t = create(this.element);
  }
  delete(event) {
    if (event.detail.name == "item") {
      event.stopPropagation();
      this.itemDeleted.emit({ index: this.index });
    }
  }
  render() {
    const t = this.t;
    return [
      this.item ? (h("section", null, h("span", { class: "small" }, this.item.quantity ? this.item.quantity : this.item.unit ? 1 : "", " ", this.item.unit), h("span", { class: "big" }, this.item.name), h("span", { class: "medium" }, t("@"), " ", Item.amount(this.item) / (this.item.quantity ? this.item.quantity : 1), " ", this.currency), h("span", { class: "medium" }, Item.amount(this.item), " ", this.currency), this.removable ? (h("smoothly-trigger", { fill: "clear", name: "item" }, h("smoothly-icon", { size: "small", toolTip: t("Remove item"), name: "trash" }))) : (""))) : (""),
    ];
  }
  get element() { return getElement(this); }
};
PayfuncDisplayItem.style = styleCss;

export { PayfuncDisplayItem as payfunc_display_item };
