import{__decorate as e,__classPrivateFieldGet as t,__classPrivateFieldSet as s}from"../../_virtual/_tslib.js";import'./../../external/lit/external/@lit/reactive-element/reactive-element.js';import'./../../external/lit/external/lit-html/lit-html.js';import{LitElement as l}from'./../../external/lit-element/lit-element.js';import{customElement as o}from'./../../external/lit/external/@lit/reactive-element/decorators/custom-element.js';import{property as a}from'./../../external/lit/external/@lit/reactive-element/decorators/property.js';import{state as i}from'./../../external/lit/external/@lit/reactive-element/decorators/state.js';import{queryAssignedElements as r}from'./../../external/lit/external/@lit/reactive-element/decorators/query-assigned-elements.js';import n from"./accordion.scss.js";import{html as d}from'./../../external/lit-element/external/lit-html/lit-html.js';var m,p,h,c,u,_,f,b;let g=class extends l{constructor(){super(...arguments),m.set(this,!1),p.set(this,1),h.set(this,!1),c.set(this,!1),u.set(this,"Expand all items"),_.set(this,"Collapse all items"),f.set(this,!1),b.set(this,void 0)}get showNumbers(){return t(this,m,"f")}set showNumbers(e){s(this,m,e,"f")}get startNumber(){return t(this,p,"f")}set startNumber(e){s(this,p,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")}set collapseLabel(e){s(this,_,e,"f")}get _allOpenState(){return t(this,f,"f")}set _allOpenState(e){s(this,f,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._filledHeader=this.filledHeaders,e._compact=this.compact,e._index=this.startNumber+t,e._showNumber=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"),d`
      <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>
    `}};m=new WeakMap,p=new WeakMap,h=new WeakMap,c=new WeakMap,u=new WeakMap,_=new WeakMap,f=new WeakMap,b=new WeakMap,g.styles=[n],e([a({type:Boolean})],g.prototype,"showNumbers",null),e([a({type:Number})],g.prototype,"startNumber",null),e([a({type:Boolean})],g.prototype,"filledHeaders",null),e([a({type:Boolean})],g.prototype,"compact",null),e([a({type:String})],g.prototype,"expandLabel",null),e([a({type:String})],g.prototype,"collapseLabel",null),e([i()],g.prototype,"_allOpenState",null),e([r({selector:"kd-accordion-item"})],g.prototype,"_accordionItems",null),g=e([o("kd-accordion")],g);export{g as Accordion};
//# sourceMappingURL=accordion.js.map
