import{r as t,h as o,a as s}from"./p-e97fde0a.js";const n=":host{display:inline-block;--gap:var(--sc-spacing-small)}.button-group{display:flex;flex-wrap:wrap}.button-group--separate{gap:var(--gap)}";const u=n;const e=class{constructor(o){t(this,o);this.label=undefined;this.separate=undefined}findButton(t){return["sc-button"].includes(t.tagName.toLowerCase())?t:t.querySelector(["sc-button"].join(","))}handleFocus(t){const o=this.findButton(t.target);o===null||o===void 0?void 0:o.classList.add("sc-button-group__button--focus")}handleBlur(t){const o=this.findButton(t.target);o===null||o===void 0?void 0:o.classList.remove("sc-button-group__button--focus")}handleMouseOver(t){const o=this.findButton(t.target);o===null||o===void 0?void 0:o.classList.add("sc-button-group__button--hover")}handleMouseOut(t){const o=this.findButton(t.target);o===null||o===void 0?void 0:o.classList.remove("sc-button-group__button--hover")}handleSlotChange(){if(this.separate)return;const t=this.el.shadowRoot.querySelector("slot").assignedElements({flatten:true});t.forEach((o=>{const s=this.el.shadowRoot.querySelector("slot");const n=s.assignedNodes().indexOf(o);const u=this.findButton(o);if(u!==null||!this.separate){u.classList.add("sc-button-group__button");u.classList.toggle("sc-button-group__button--first",n===0);u.classList.toggle("sc-button-group__button--inner",n>0&&n<t.length-1);u.classList.toggle("sc-button-group__button--last",n===t.length-1)}}))}render(){return o("sc-form-control",{key:"670a71100bef02c3c1ba247c7eb212f95d9365c8",part:"base",class:{"button-group":true,"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},o("slot",{key:"e5a818d570e09f76934170b219be96f90ad6e620",onSlotchange:()=>this.handleSlotChange()}))}get el(){return s(this)}};e.style=u;export{e as sc_button_group};
//# sourceMappingURL=p-4ccc2739.entry.js.map