import{h}from"@stencil/core";export class ScButtonGroup{constructor(){this.label=void 0,this.separate=void 0}findButton(t){return["sc-button"].includes(t.tagName.toLowerCase())?t:t.querySelector(["sc-button"].join(","))}handleFocus(t){const e=this.findButton(t.target);null==e||e.classList.add("sc-button-group__button--focus")}handleBlur(t){const e=this.findButton(t.target);null==e||e.classList.remove("sc-button-group__button--focus")}handleMouseOver(t){const e=this.findButton(t.target);null==e||e.classList.add("sc-button-group__button--hover")}handleMouseOut(t){const e=this.findButton(t.target);null==e||e.classList.remove("sc-button-group__button--hover")}handleSlotChange(){if(this.separate)return;const t=this.el.shadowRoot.querySelector("slot").assignedElements({flatten:!0});t.forEach((e=>{const s=this.el.shadowRoot.querySelector("slot").assignedNodes().indexOf(e),o=this.findButton(e);null===o&&this.separate||(o.classList.add("sc-button-group__button"),o.classList.toggle("sc-button-group__button--first",0===s),o.classList.toggle("sc-button-group__button--inner",s>0&&s<t.length-1),o.classList.toggle("sc-button-group__button--last",s===t.length-1))}))}render(){return h("sc-form-control",{key:"670a71100bef02c3c1ba247c7eb212f95d9365c8",part:"base",class:{"button-group":!0,"button-group--separate":this.separate},role:"group","aria-label":this.label,onFocusout:t=>this.handleBlur(t),onFocusin:t=>this.handleFocus(t),onMouseOver:t=>this.handleMouseOver(t),onMouseOut:t=>this.handleMouseOut(t),label:this.label},h("slot",{key:"e5a818d570e09f76934170b219be96f90ad6e620",onSlotchange:()=>this.handleSlotChange()}))}static get is(){return"sc-button-group"}static get encapsulation(){return"shadow"}static get originalStyleUrls(){return{$:["sc-button-group.scss"]}}static get styleUrls(){return{$:["sc-button-group.css"]}}static get properties(){return{label:{type:"string",mutable:!1,complexType:{original:"string",resolved:"string",references:{}},required:!1,optional:!1,docs:{tags:[],text:""},attribute:"label",reflect:!1},separate:{type:"boolean",mutable:!1,complexType:{original:"boolean",resolved:"boolean",references:{}},required:!1,optional:!1,docs:{tags:[],text:""},attribute:"separate",reflect:!1}}}static get elementRef(){return"el"}}