import{LitElement as t,html as e,css as i}from"../../../lit/index.js";import{A11yCollapse as s}from"../a11y-collapse.js";class A11yCollapseGroup extends t{static get styles(){return[i`
        :host {
          display: block;
          margin: var(--a11y-collapse-group-margin, 15px 0);
          --a11y-collapse-margin: 15px;
        }
        :host([hidden]) {
          display: none;
        }
        #heading {
          font-weight: bold;
        }
        .wrapper {
          border-radius: 0;
          display: block;
          --a11y-collapse-margin: 0 0;
          --a11y-collapse-border-between: none;
        }
      `]}render(){return e` <div class="wrapper"><slot></slot></div> `}constructor(){super(),this.globalOptions={},this.radio=!1,this.__items=[],this.addEventListener("a11y-collapse-attached",(t=>{t.stopPropagation(),t.stopImmediatePropagation(),this._attachItem(t.detail)})),this.addEventListener("a11y-collapse-detached",(t=>{t.stopPropagation(),t.stopImmediatePropagation(),this._detachItem(t.detail)})),this.addEventListener("a11y-collapse-click",(t=>{t.stopPropagation(),t.stopImmediatePropagation(),this.radioToggle(t.detail)})),this.addEventListener("toggle",(t=>{t.stopPropagation(),t.stopImmediatePropagation(),this.radioToggle(t.detail)}))}static get tag(){return"a11y-collapse-group"}static get properties(){return{...super.properties,...s.properties,globalOptions:{type:Object,attribute:"global-options",reflect:!0},radio:{type:Boolean,reflect:!0},__items:{type:Array}}}static get haxProperties(){return new URL(`./${this.tag}.haxProperties.json`,import.meta.url).href}get items(){return this.__items}_attachItem(t){this.__items.push(t),Object.keys(A11yCollapseGroup.properties||{}).forEach((e=>this._updateItem(t,e)))}updated(t){t.forEach(((t,e)=>{this.__items.forEach((i=>this._updateItem(i,e,t)))}))}_updateItem(t,e,i=void 0){if("globalOptions"===e||"__items"===e){if(this.globalOptions!={})for(let e in this.globalOptions)this.globalOptions.hasOwnProperty(e)&&(t[e]=this.globalOptions[e])}else"radio"===e&&this.radio?t.expanded=!1:null===this[e]&&void 0===this[e]||(t[e]=this[e])}_detachItem(t){if(this.__items&&t)for(let e=0;e<this.__items.length;e++)this.__items[e]===t&&this.__items.splice(e,1)}radioToggle(t){if(this.radio&&t.expanded)for(let e=0;e<this.__items.length;e++)this.__items[e]!==t&&this.__items[e].toggle(!1)}}customElements.define(A11yCollapseGroup.tag,A11yCollapseGroup);export{A11yCollapseGroup};