var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
  if (kind === "m")
    throw new TypeError("Private method is not writable");
  if (kind === "a" && !f)
    throw new TypeError("Private accessor was defined without a setter");
  if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
    throw new TypeError("Cannot write private member to an object whose class did not declare it");
  return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
};
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
  if (kind === "a" && !f)
    throw new TypeError("Private accessor was defined without a getter");
  if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
    throw new TypeError("Cannot read private member from an object whose class did not declare it");
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
};
var _KlevuSort_instances, _KlevuSort_selected, _KlevuSort_onChange;
import { KlevuSearchSorting } from "@klevu/core";
import { h, Host } from "@stencil/core";
/**
 * Sort dropdown. User can select what kind of sorting they want
 */
export class KlevuSort {
  constructor() {
    _KlevuSort_instances.add(this);
    _KlevuSort_selected.set(this, KlevuSearchSorting.Relevance);
    this.variant = "default";
    this.options = [
      { value: KlevuSearchSorting.Relevance, text: "Relevance" },
      { value: KlevuSearchSorting.NameAsc, text: "Name ▲" },
      { value: KlevuSearchSorting.NameDesc, text: "Name ▼" },
      { value: KlevuSearchSorting.NewArrivalAsc, text: "New arrivals ▲" },
      { value: KlevuSearchSorting.NewArrivalDesc, text: "New arrivals ▼" },
      { value: KlevuSearchSorting.PriceAsc, text: "Price ▲" },
      { value: KlevuSearchSorting.PriceDesc, text: "Price ▼" },
      { value: KlevuSearchSorting.RatingAsc, text: "Rating ▲" },
      { value: KlevuSearchSorting.RatingDesc, text: "Rating ▼" },
    ];
  }
  render() {
    return (h(Host, null, h("klevu-dropdown", { name: "sort", options: this.options, selected: __classPrivateFieldGet(this, _KlevuSort_selected, "f"), variant: this.variant, onKlevuDropdownChanged: __classPrivateFieldGet(this, _KlevuSort_instances, "m", _KlevuSort_onChange).bind(this) })));
  }
  static get is() { return "klevu-sort"; }
  static get encapsulation() { return "shadow"; }
  static get originalStyleUrls() {
    return {
      "$": ["klevu-sort.css"]
    };
  }
  static get styleUrls() {
    return {
      "$": ["klevu-sort.css"]
    };
  }
  static get properties() {
    return {
      "variant": {
        "type": "string",
        "mutable": false,
        "complexType": {
          "original": "KlevuDropdownVariant",
          "resolved": "\"default\" | \"inline\"",
          "references": {
            "KlevuDropdownVariant": {
              "location": "import",
              "path": "../../components",
              "id": "src/components.d.ts::KlevuDropdownVariant"
            }
          }
        },
        "required": false,
        "optional": false,
        "docs": {
          "tags": [],
          "text": "Dropdown variant"
        },
        "attribute": "variant",
        "reflect": false,
        "defaultValue": "\"default\""
      },
      "options": {
        "type": "unknown",
        "mutable": false,
        "complexType": {
          "original": "Array<{ value: KlevuSearchSorting; text: string }>",
          "resolved": "{ value: KlevuSearchSorting; text: string; }[]",
          "references": {
            "Array": {
              "location": "global",
              "id": "global::Array"
            },
            "KlevuSearchSorting": {
              "location": "import",
              "path": "@klevu/core",
              "id": "../klevu-core/dist/cjs/index.d.ts::KlevuSearchSorting"
            }
          }
        },
        "required": false,
        "optional": false,
        "docs": {
          "tags": [],
          "text": "Pass custom options for the sort dropdown"
        },
        "defaultValue": "[\n    { value: KlevuSearchSorting.Relevance, text: \"Relevance\" },\n    { value: KlevuSearchSorting.NameAsc, text: \"Name \u25B2\" },\n    { value: KlevuSearchSorting.NameDesc, text: \"Name \u25BC\" },\n    { value: KlevuSearchSorting.NewArrivalAsc, text: \"New arrivals \u25B2\" },\n    { value: KlevuSearchSorting.NewArrivalDesc, text: \"New arrivals \u25BC\" },\n    { value: KlevuSearchSorting.PriceAsc, text: \"Price \u25B2\" },\n    { value: KlevuSearchSorting.PriceDesc, text: \"Price \u25BC\" },\n    { value: KlevuSearchSorting.RatingAsc, text: \"Rating \u25B2\" },\n    { value: KlevuSearchSorting.RatingDesc, text: \"Rating \u25BC\" },\n  ]"
      }
    };
  }
  static get events() {
    return [{
        "method": "klevuSortChanged",
        "name": "klevuSortChanged",
        "bubbles": true,
        "cancelable": true,
        "composed": true,
        "docs": {
          "tags": [],
          "text": "When the sorting changes"
        },
        "complexType": {
          "original": "KlevuSearchSorting",
          "resolved": "KlevuSearchSorting.AdvancedSorting | KlevuSearchSorting.NameAsc | KlevuSearchSorting.NameDesc | KlevuSearchSorting.NewArrivalAsc | KlevuSearchSorting.NewArrivalDesc | KlevuSearchSorting.PriceAsc | KlevuSearchSorting.PriceDesc | KlevuSearchSorting.RatingAsc | KlevuSearchSorting.RatingDesc | KlevuSearchSorting.Relevance",
          "references": {
            "KlevuSearchSorting": {
              "location": "import",
              "path": "@klevu/core",
              "id": "../klevu-core/dist/cjs/index.d.ts::KlevuSearchSorting"
            }
          }
        }
      }];
  }
}
_KlevuSort_selected = new WeakMap(), _KlevuSort_instances = new WeakSet(), _KlevuSort_onChange = function _KlevuSort_onChange(event) {
  const newSort = event.detail;
  __classPrivateFieldSet(this, _KlevuSort_selected, newSort, "f");
  this.klevuSortChanged.emit(newSort);
};
//# sourceMappingURL=klevu-sort.js.map
