/**
 * @license
 * Copyright 2023 Tyler Technologies, Inc. 
 * License: Apache-2.0
 */
import{b as E}from"./chunk.EC5JFSHR.js";import{a as u}from"./chunk.BESB4RGK.js";import{a as p,b as d}from"./chunk.DL7NX432.js";import{a as c,l as m}from"./chunk.LJLEPTLU.js";import{l as a,t as r}from"./chunk.4LA6HEA7.js";import{k as s}from"./chunk.J2M2MXP2.js";import{f as l}from"./chunk.MCIQXNKY.js";var f=`${d}fab`,g={BUTTON:"button, a",ICON:"i,forge-icon,img,svg",LABEL:"span"},I={BUTTON:"forge-fab",BUTTON_EXTENDED:"forge-fab--extended",ICON:"forge-fab__icon",LABEL:"forge-fab__label",BUTTON_MINI:"forge-fab--mini",EXITED:"forge-fab--exited",RIPPLE:"forge-fab__ripple"},T={EXTENDED:"extended",MINI:"mini",EXITED:"exited"},e={elementName:f,selectors:g,classes:I,attributes:T};var o=class extends m{constructor(){super();this._isExtended=!1;this._isMini=!1;this._isExited=!1}static get observedAttributes(){return[e.attributes.EXITED,e.attributes.MINI,e.attributes.EXTENDED]}connectedCallback(){this.children.length?this._initialize():a(this).then(()=>this._initialize())}disconnectedCallback(){this._rippleInstance&&this._rippleInstance.destroy()}attributeChangedCallback(t,n,i){switch(t){case e.attributes.EXITED:this.exited=s(i);break;case e.attributes.MINI:this.mini=s(i);break;case e.attributes.EXTENDED:this.extended=s(i);break}}_initialize(){if(this._buttonElement=this.querySelector(e.selectors.BUTTON),!this._buttonElement)return;this._buttonElement.classList.add(e.classes.BUTTON);let t=this._buttonElement.querySelector(`.${e.classes.RIPPLE}`)||document.createElement("div");t.classList.add(e.classes.RIPPLE),this._buttonElement.insertAdjacentElement("afterbegin",t),this._sync(),this._rippleInstance&&this._rippleInstance.destroy(),this._rippleInstance=new E(this._buttonElement)}_sync(){if(!this._buttonElement)return;r(this._buttonElement,this._isExited,e.classes.EXITED),r(this._buttonElement,this._isMini,e.classes.BUTTON_MINI),r(this._buttonElement,this._isExtended,e.classes.BUTTON_EXTENDED);let t=this.querySelector(e.selectors.LABEL);t&&t.classList.add(e.classes.LABEL);let n=this.querySelector(e.selectors.ICON);n&&(n.classList.add(e.classes.ICON),n.setAttribute("aria-hidden","true"))}set exited(t){this._isExited!==t&&(this._isExited=t,this.setAttribute(e.attributes.EXITED,this._isExited.toString()),this._sync())}get exited(){return this._isExited}set mini(t){this._isMini!==t&&(this._isMini=t,this.setAttribute(e.attributes.MINI,this._isMini.toString()),this._sync())}get mini(){return this._isMini}set extended(t){this._isExtended!==t&&(this._isExtended=t,this.setAttribute(e.attributes.EXTENDED,this._isExtended.toString()),this._sync())}get extended(){return this._isExtended}};o=l([p({name:e.elementName})],o);var b=class extends u{constructor(t){super(t)}destroy(){this._buttonElement=void 0}_build(){var n,i;let t=document.createElement(e.elementName);return this._buttonElement=document.createElement("button"),this._buttonElement.type="button",this._buttonElement.textContent=(i=(n=this._config.options)==null?void 0:n.text)!=null?i:"",t.appendChild(this._buttonElement),t}onClick(t){var n;(n=this._buttonElement)==null||n.addEventListener("click",t)}onFocus(t){var n;(n=this._buttonElement)==null||n.addEventListener("focus",i=>t(i))}onBlur(t){var n;(n=this._buttonElement)==null||n.addEventListener("blur",i=>t(i))}};function P(){c(o)}export{e as a,o as b,b as c,P as d};
//# sourceMappingURL=chunk.MKMYJBTE.js.map
