import{proxyCustomElement,HTMLElement,h}from"@stencil/core/internal/client";import{d as defineCustomElement$3}from"./sc-form-control2.js";import{d as defineCustomElement$2}from"./sc-visually-hidden2.js";const scButtonGroupCss=":host{display:inline-block;--gap:var(--sc-spacing-small)}.button-group{display:flex;flex-wrap:wrap}.button-group--separate{gap:var(--gap)}",ScButtonGroupStyle0=scButtonGroupCss,ScButtonGroup$1=proxyCustomElement(class extends HTMLElement{constructor(){super(),this.__registerHost(),this.__attachShadow(),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 o=this.el.shadowRoot.querySelector("slot").assignedNodes().indexOf(e),s=this.findButton(e);null===s&&this.separate||(s.classList.add("sc-button-group__button"),s.classList.toggle("sc-button-group__button--first",0===o),s.classList.toggle("sc-button-group__button--inner",o>0&&o<t.length-1),s.classList.toggle("sc-button-group__button--last",o===t.length-1))}))}render(){return h("sc-form-control",{key:"267fc3825115b41666e15f9f2ea5500ba121f08f",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:"02af1ec6d87ffb90fe4b4dcb3e808fb52a2b0073",onSlotchange:()=>this.handleSlotChange()}))}get el(){return this}static get style(){return ScButtonGroupStyle0}},[1,"sc-button-group",{label:[1],separate:[4]}]);function defineCustomElement$1(){"undefined"!=typeof customElements&&["sc-button-group","sc-form-control","sc-visually-hidden"].forEach((t=>{switch(t){case"sc-button-group":customElements.get(t)||customElements.define(t,ScButtonGroup$1);break;case"sc-form-control":customElements.get(t)||defineCustomElement$3();break;case"sc-visually-hidden":customElements.get(t)||defineCustomElement$2()}}))}const ScButtonGroup=ScButtonGroup$1,defineCustomElement=defineCustomElement$1;export{ScButtonGroup,defineCustomElement};