import { proxyCustomElement, HTMLElement, h, Host } from '@stencil/core/internal/client';
import { d as defineCustomElement$2 } from './klevu-icon2.js';
import { d as defineCustomElement$1 } from './klevu-typography2.js';

const klevuAccordionCss = ":host{--klevu-accordion-background:inherit;display:block;padding:var(--klevu-spacing-04) 0;border-top:1px solid var(--klevu-color-neutral-4)}input{position:absolute;opacity:0;z-index:-1}.content{max-height:0;overflow:hidden;transition:max-height var(--klevu-animation-duration-normal);padding:0 4px}label{cursor:pointer;display:flex;justify-content:space-between;align-items:center;background:var(--klevu-accordion-background);transition:margin var(--klevu-animation-duration-slow) var(--klevu-animation-timing-function)}input:checked+label{margin-bottom:var(--klevu-spacing-04)}input:checked~.content{max-height:var(--klevu-accordion-content-height, 600px);padding:4px}label klevu-icon{color:var(--klevu-color-neutral-8);transition:transform var(--klevu-animation-duration-fast) var(--klevu-animation-timing-function);user-select:none}input:checked+label klevu-icon{transform:rotate(-180deg)}";

var __classPrivateFieldSet = (undefined && undefined.__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 = (undefined && undefined.__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 _KlevuAccordion_id;
const KlevuAccordion = /*@__PURE__*/ proxyCustomElement(class KlevuAccordion extends HTMLElement {
  constructor() {
    super();
    this.__registerHost();
    this.__attachShadow();
    _KlevuAccordion_id.set(this, void 0);
    this.open = false;
    this.startOpen = undefined;
    __classPrivateFieldSet(this, _KlevuAccordion_id, `chk${Math.floor(Math.random() * 1000000)}`, "f");
  }
  connectedCallback() {
    if (this.startOpen) {
      this.open = true;
    }
  }
  render() {
    return (h(Host, null, h("input", { type: "checkbox", id: __classPrivateFieldGet(this, _KlevuAccordion_id, "f"), checked: this.open, onChange: () => (this.open = !this.open) }), h("label", { htmlFor: __classPrivateFieldGet(this, _KlevuAccordion_id, "f") }, h("klevu-typography", { variant: "body-s-bold" }, h("slot", { name: "header" })), h("klevu-icon", { name: "expand_more" })), h("div", { class: "content" }, h("slot", { name: "content" }))));
  }
  static get style() { return klevuAccordionCss; }
}, [1, "klevu-accordion", {
    "open": [516],
    "startOpen": [4, "start-open"]
  }]);
_KlevuAccordion_id = new WeakMap();
function defineCustomElement() {
  if (typeof customElements === "undefined") {
    return;
  }
  const components = ["klevu-accordion", "klevu-icon", "klevu-typography"];
  components.forEach(tagName => { switch (tagName) {
    case "klevu-accordion":
      if (!customElements.get(tagName)) {
        customElements.define(tagName, KlevuAccordion);
      }
      break;
    case "klevu-icon":
      if (!customElements.get(tagName)) {
        defineCustomElement$2();
      }
      break;
    case "klevu-typography":
      if (!customElements.get(tagName)) {
        defineCustomElement$1();
      }
      break;
  } });
}
defineCustomElement();

export { KlevuAccordion as K, defineCustomElement as d };

//# sourceMappingURL=klevu-accordion2.js.map