import{__decorate as e,__classPrivateFieldGet as t,__classPrivateFieldSet as s}from"../../_virtual/_tslib.js";import'./../../external/@lit/reactive-element/reactive-element.js';import{html as l}from'./../../external/lit-html/lit-html.js';import{LitElement as a}from'./../../external/lit-element/lit-element.js';import{customElement as o}from'./../../external/@lit/reactive-element/decorators/custom-element.js';import{property as r}from'./../../external/@lit/reactive-element/decorators/property.js';import{state as i}from'./../../external/@lit/reactive-element/decorators/state.js';import{queryAssignedElements as n}from'./../../external/@lit/reactive-element/decorators/query-assigned-elements.js';import p from"./accordion.scss.js";var d,m,h,c,u,f,_,b;let g=class extends a{constructor(){super(...arguments),d.set(this,!1),m.set(this,1),h.set(this,!1),c.set(this,!1),u.set(this,"Expand all items"),f.set(this,"Collapse all items"),_.set(this,!1),b.set(this,void 0)}get showNumbers(){return t(this,d,"f")}set showNumbers(e){s(this,d,e,"f")}get startNumber(){return t(this,m,"f")}set startNumber(e){s(this,m,e,"f")}get filledHeaders(){return t(this,h,"f")}set filledHeaders(e){s(this,h,e,"f")}get compact(){return t(this,c,"f")}set compact(e){s(this,c,e,"f")}get expandLabel(){return t(this,u,"f")}set expandLabel(e){s(this,u,e,"f")}get collapseLabel(){return t(this,f,"f")}set collapseLabel(e){s(this,f,e,"f")}get _allOpenState(){return t(this,_,"f")}set _allOpenState(e){s(this,_,e,"f")}get _accordionItems(){return t(this,b,"f")}set _accordionItems(e){s(this,b,e,"f")}_handleSlotChange(){this._updateChildren()}willUpdate(e){(e.has("filledHeaders")||e.has("compact")||e.has("startNumber")||e.has("showNumbers"))&&this._updateChildren()}_updateChildren(){this._accordionItems.forEach(((e,t)=>{e.setFilledHeader(this.filledHeaders),e.setCompact(this.compact),e.setIndex(this.startNumber+t),e.setShowNumbers(this.showNumbers)}))}_openAllItems(){this._accordionItems.map((e=>{e.open()}))}_closeAllItems(){this._accordionItems.map((e=>{e.close()}))}_toggleExpandAll(){this._allOpenState?(this._closeAllItems(),this._allOpenState=!1):(this._openAllItems(),this._allOpenState=!0)}render(){let e="";return this.filledHeaders&&(e+=" filled-headers"),l`
      <div class="kd-accordion">
        <div class="toggle-container">
          <a href="javascript:void(0)" @click="${this._toggleExpandAll}">
            ${this._allOpenState?this.collapseLabel:this.expandLabel}
          </a>
        </div>

        <div class="accordion-item-container${e}">
          <slot @slotchange="${this._handleSlotChange}"></slot>
        </div>
      </div>
    `}};d=new WeakMap,m=new WeakMap,h=new WeakMap,c=new WeakMap,u=new WeakMap,f=new WeakMap,_=new WeakMap,b=new WeakMap,g.styles=[p],e([r({type:Boolean})],g.prototype,"showNumbers",null),e([r({type:Number})],g.prototype,"startNumber",null),e([r({type:Boolean})],g.prototype,"filledHeaders",null),e([r({type:Boolean})],g.prototype,"compact",null),e([r({type:String})],g.prototype,"expandLabel",null),e([r({type:String})],g.prototype,"collapseLabel",null),e([i()],g.prototype,"_allOpenState",null),e([n({selector:"kd-accordion-item"})],g.prototype,"_accordionItems",null),g=e([o("kd-accordion")],g);export{g as Accordion};
//# sourceMappingURL=accordion.js.map
