import { r as registerInstance, h } from './index-07845439.js';
import { d as dist } from './index-82c01ab3.js';
import { s as sort, O as Order } from './index-aeffd5c5.js';
import './_commonjsHelpers-9bc404fc.js';

const styleCss = ".sc-ig-orders-h{display:block}[hidden].sc-ig-orders-h{display:none}.sc-ig-orders-h>div.sc-ig-orders>ig-orders-table.sc-ig-orders{border:1px solid rgb(var(--smoothly-medium-color))}.sc-ig-orders-h>div.sc-ig-orders>ig-orders-footer.sc-ig-orders{width:100%;max-width:90em;z-index:1;position:sticky;bottom:0;color:rgb(var(--smoothly-light-contrast));background-color:rgb(var(--smoothly-light-color));padding:.5em 0 .5em 0}smoothly-trigger.sc-ig-orders{display:inline}.sc-ig-orders-h>div.sc-ig-orders>div.sc-ig-orders>smoothly-trigger.sc-ig-orders:hover{border-color:transparent}.toolbar.sc-ig-orders{z-index:1;padding:0.5em 0 0.9em 0.5em;overflow:hidden;position:fixed;height:10.1em;background-color:rgb(var(--smoothly-light-color));top:33%;right:0;border-radius:.3em 0 0 .3em;box-shadow:var(--smoothly-shadow);animation-name:slide;animation-duration:.3s;animation-timing-function:ease-out}@keyframes slide{0%{width:0}}#charge.sc-ig-orders{display:inline-block;border-radius:5px 0 0 0;background-color:rgb(var(--smoothly-success-color))}#cancel.sc-ig-orders,#refund.sc-ig-orders{display:inline-block;border-radius:0;background-color:rgb(var(--smoothly-danger-color))}#synchronize.sc-ig-orders{display:inline-block;border-radius:0;background-color:rgb(var(--smoothly-dark-color));border-bottom-left-radius:5px}p.sc-ig-orders{margin:1em}";

const IntergiroOrders = class {
  constructor(hostRef) {
    registerInstance(this, hostRef);
    this.selected = {};
    this.display = false;
  }
  componentWillLoad() {
    if (!this.ordersFiltered)
      this.updateOrders();
  }
  handleFilterChanged(event) {
    this.filter = event.detail;
    event.stopPropagation();
  }
  updateOrders() {
    const result = this.orders && (this.filter ? dist.filter(this.filter, this.orders) : [...this.orders]);
    this.ordersFiltered = result && sort(result, "created");
  }
  handleSelectedChanged(event) {
    this.selected = event.detail;
    event.stopPropagation();
  }
  render() {
    return (h("div", null, h("ig-filter", { template: Order.template, filter: this.filter }), h("ig-orders-actions", { selected: this.selected }), h("ig-orders-table", { display: this.display, orders: this.ordersFiltered, selected: this.selected, receipt: this.receipt, embedded: this.embedded }), h("ig-orders-footer", { orders: this.ordersFiltered, selected: this.selected })));
  }
  static get watchers() { return {
    "orders": ["updateOrders"],
    "filter": ["updateOrders"]
  }; }
};
IntergiroOrders.style = styleCss;

export { IntergiroOrders as ig_orders };
