import { r as l, c as s, h as e, H as r } from "./index.61732cef.js";
import { c as p } from "./index-orsBiyT_.fc4357c3.js";
import { d as g } from "./utils-CCck-DTo.e4e43b6a.js";
import "react";
import "react-dom";
const c = () => ":host{display:block;width:-webkit-fit-content;width:-moz-fit-content;width:fit-content}:host *{box-sizing:border-box}.pagination{display:block;width:100%}.pagination--variant-simple .pagination__list{gap:0}.pagination__list{display:flex;margin:0;padding:0;justify-content:flex-start;align-items:center;line-height:var(--s-line-height-base);list-style:none}@media (min-width: 992px) and (max-width: 1439px) and (hover: hover),(min-width: 1440px){.pagination__list{font-size:var(--s-font-size-sm);line-height:var(--s-line-height-sm)}}.pagination__page-size-selection{display:flex;padding-right:var(--s-space-24);flex-shrink:0;align-items:center;color:var(--s-interactive-primary-default);white-space:nowrap;gap:var(--s-space-8)}.pagination__page-size-select-container{position:relative}.pagination__page-size-select{padding-right:calc(1rem + var(--s-space-4));border:none;color:var(--s-interactive-primary-default);background-color:transparent;font:inherit;font-weight:var(--s-font-weight-medium);line-height:var(--s-line-height-base);cursor:pointer;-webkit-appearance:none;-moz-appearance:none;appearance:none}.pagination__page-size-select:focus:not(:focus-visible){outline:none}.pagination__page-size-select:focus-visible{outline-color:var(--s-focus-default)}@media (min-width: 992px) and (max-width: 1439px) and (hover: hover),(min-width: 1440px){.pagination__page-size-select{font-size:var(--s-font-size-sm);line-height:var(--s-line-height-sm)}}.pagination__page-size-select-icon{position:absolute;top:50%;right:0;transform:translateY(-50%);pointer-events:none}.pagination__page-label{padding-right:var(--s-space-8);padding-left:var(--s-space-8)}.pagination__advanced-label{display:flex;align-items:center;white-space:nowrap;gap:var(--s-space-8)}.pagination__page-input{display:inline-flex;width:3.25rem;padding-top:var(--s-space-8);padding-right:var(--s-space-8);padding-bottom:var(--s-space-8);padding-left:var(--s-space-8);border:none;border-radius:var(--s-border-radius-sm);background-color:transparent;font:inherit;line-height:var(--s-line-height-base);text-align:center;box-shadow:inset 0 0 0 var(--s-border-width-default) var(--s-border-strong)}.pagination__page-input:focus:not(:focus-visible){outline:none}.pagination__page-input:focus-visible{outline-color:var(--s-focus-default)}@media (min-width: 992px) and (max-width: 1439px) and (hover: hover),(min-width: 1440px){.pagination__page-input{font-size:var(--s-font-size-sm);line-height:var(--s-line-height-sm)}}", h = class {
  constructor(n) {
    l(this, n), this.setPage = s(this, "setPage", 7), this.setPageSize = s(this, "setPageSize", 7), this.firstPageButtonLabel = "First page", this.lastPageButtonLabel = "Last page", this.nextButtonLabel = "Next page", this.pageLabel = "out of", this.pageSelectLabel = "Select a page", this.pageSize = 10, this.pageSizeOptions = [10, 25, 50], this.pageSizeSelectLabel = "Items per page:", this.prevButtonLabel = "Previous page", this.variant = "default", this.onFocusPageInput = (a) => {
      a.target.select();
    }, this.onFirstPageButtonClick = () => {
      this.page !== 1 && this.setPage.emit(1);
    }, this.onLastPageButtonClick = () => {
      this.page !== this.pages && this.setPage.emit(this.pages);
    }, this.onPrevButtonClick = () => {
      const a = Math.max(this.page - 1, 1);
      this.page !== a && this.setPage.emit(a);
    }, this.onNextButtonClick = () => {
      const a = Math.min(this.page + 1, this.pages);
      this.page !== a && this.setPage.emit(a);
    }, this.onPageInput = () => {
      let a = +this.pageInput.value;
      isNaN(a) ? (a = this.page, this.pageInput.value = String(a)) : a > this.pages ? (a = this.pages, this.pageInput.value = String(a)) : a < 1 && (a = 1, this.pageInput.value = String(a)), this.page !== a && this.onPageUpdate(a);
    }, this.onPageUpdate = g((a) => {
      this.setPage.emit(a);
    }, 500), this.onPageSizeSelect = (a) => {
      const t = +a.target.value;
      this.pageSize !== t && this.setPageSize.emit(t);
    };
  }
  render() {
    const n = this.variant !== "simple", a = this.variant === "advanced", t = `${this.page.toLocaleString()} ${this.pageLabel} ${this.pages.toLocaleString()}`, o = p("pagination", `pagination--variant-${this.variant}`);
    return e(r, { key: "533480526127c200f46a30459ae307b2d9af6607" }, e("nav", { key: "4479e763749f078330b7714a8ae2b227657f800a", "aria-label": this.label, class: o }, e("ul", { key: "b23c1220d0ca0e532aa42891d518486d58d872b9", class: "pagination__list", part: "pagination__list" }, this.showPageSizeSelect && e("li", { key: "8a37a3353563d9987d006d2a7b0052fed8ca0529", class: "pagination__list-item" }, e("label", { key: "7799918b3bad55eebcdbc6cc02388aaea9735658", class: "pagination__page-size-selection" }, e("swirl-text", { key: "171e68e78aa0fd013a7eed874d8a679d778b9ad1", whiteSpace: "inherit" }, this.pageSizeSelectLabel), e("swirl-stack", { key: "2a40b83b50c87a8870f119b14e7714eb41872890", align: "center", class: "pagination__page-size-select-container", orientation: "horizontal" }, e("select", { key: "304e6ee6e895b689d4af651ebba8a97171a8fe34", class: "pagination__page-size-select", onChange: this.onPageSizeSelect }, this.pageSizeOptions.map((i) => e("option", { key: i, selected: i === this.pageSize, value: i }, i))), e("swirl-icon-expand-more", { key: "d8509fae30daabdd277f8507d39f4059488ae1c1", "aria-hidden": "true", class: "pagination__page-size-select-icon", size: 16 })))), e("li", { key: "2d563389fae0560afb21e19258d1a875fdb402b8", class: "pagination__list-item" }, e("swirl-button", { key: "a3e6fbf331537b67b7c277052c10a2757a70c68a", class: "pagination__first-page-button", disabled: this.page <= 1, hideLabel: !0, icon: "<swirl-icon-double-arrow-left></swirl-icon-double-arrow-left>", intent: "primary", label: this.firstPageButtonLabel, onClick: this.onFirstPageButtonClick })), e("li", { key: "d2c35cbd64937e2a51fc107681a998e87fe9a764", class: "pagination__list-item" }, e("swirl-button", { key: "eb2489e0d4e941eef63a4bef3913cee5be4fcc0a", class: "pagination__prev-button", disabled: this.page <= 1, hideLabel: !0, icon: "<swirl-icon-chevron-left></swirl-icon-chevron-left>", intent: "primary", label: this.prevButtonLabel, onClick: this.onPrevButtonClick })), n ? e("li", { class: "pagination__list-item  pagination__page-label" }, e("span", null, a ? e("span", { "aria-current": "page", class: "pagination__advanced-label" }, e("input", { "aria-label": this.pageSelectLabel, class: "pagination__page-input", onFocus: this.onFocusPageInput, onInput: this.onPageInput, ref: (i) => this.pageInput = i, type: "text", value: this.page }), e("span", { "aria-hidden": "true" }, this.pageLabel, " ", this.pages.toLocaleString())) : e("span", { "aria-current": "page" }, t))) : e("li", { class: "pagination__list-item" }, e("swirl-visually-hidden", null, e("span", { "aria-current": "page" }, t))), e("li", { key: "730b2dce2be338eae5d7b9ae850aab1c6aaac7a7", class: "pagination__list-item" }, e("swirl-button", { key: "12c3ef4fcd8a963572419aa0682e89b38ca716e7", class: "pagination__next-button", disabled: this.page >= this.pages, hideLabel: !0, icon: "<swirl-icon-chevron-right></swirl-icon-chevron-right>", iconPosition: "end", intent: "primary", label: this.nextButtonLabel, onClick: this.onNextButtonClick })), e("li", { key: "6b7a4e55abdd1bcfe336b17a086cd5d79d761d04", class: "pagination__list-item" }, e("swirl-button", { key: "eceb8824892c6fb6e5161ee095c00ba5e5bef8d2", class: "pagination__last-page-button", disabled: this.page >= this.pages, hideLabel: !0, icon: "<swirl-icon-double-arrow-right></swirl-icon-double-arrow-right>", intent: "primary", label: this.lastPageButtonLabel, onClick: this.onLastPageButtonClick })))));
  }
};
h.style = c();
export {
  h as swirl_pagination
};
