import { Component, h, Prop } from '@stencil/core';
import { openWormhole } from 'stencil-wormhole';
export class ScTotal {
  constructor() {
    this.total = 'amount_due';
    this.order_key = {
      total: 'total_amount',
      subtotal: 'subtotal_amount',
      amount_due: 'amount_due',
    };
  }
  render() {
    var _a, _b, _c, _d, _e;
    if (!((_a = this.order) === null || _a === void 0 ? void 0 : _a.currency))
      return;
    if (!((_d = (_c = (_b = this.order) === null || _b === void 0 ? void 0 : _b.line_items) === null || _c === void 0 ? void 0 : _c.data) === null || _d === void 0 ? void 0 : _d.length))
      return;
    return h("sc-format-number", { type: "currency", currency: this.order.currency, value: (_e = this.order) === null || _e === void 0 ? void 0 : _e[this.order_key[this.total]] });
  }
  static get is() { return "sc-total"; }
  static get originalStyleUrls() { return {
    "$": ["sc-total.css"]
  }; }
  static get styleUrls() { return {
    "$": ["sc-total.css"]
  }; }
  static get properties() { return {
    "total": {
      "type": "string",
      "mutable": false,
      "complexType": {
        "original": "'total' | 'subtotal' | 'amount_due'",
        "resolved": "\"amount_due\" | \"subtotal\" | \"total\"",
        "references": {}
      },
      "required": false,
      "optional": false,
      "docs": {
        "tags": [],
        "text": ""
      },
      "attribute": "total",
      "reflect": false,
      "defaultValue": "'amount_due'"
    },
    "order": {
      "type": "unknown",
      "mutable": false,
      "complexType": {
        "original": "Checkout",
        "resolved": "Checkout",
        "references": {
          "Checkout": {
            "location": "import",
            "path": "../../../../types"
          }
        }
      },
      "required": false,
      "optional": false,
      "docs": {
        "tags": [],
        "text": ""
      }
    }
  }; }
}
openWormhole(ScTotal, ['order'], false);
