!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t(require("lit"),require("lit/decorators.js"));else if("function"==typeof define&&define.amd)define(["lit","lit/decorators.js"],t);else{var s="object"==typeof exports?t(require("lit"),require("lit/decorators.js")):t(e.lit,e["lit/decorators.js"]);for(var i in s)("object"==typeof exports?exports:e)[i]=s[i]}}(self,(e,t)=>(()=>{"use strict";var s,i={2890(e,t,s){s.r(t),s.d(t,{ButtonGroup:()=>i});var i,r=s(2900),o=s(7704),n=s(4084),d=s(7161),l=s(429),a=s(2670),c=function(e,t,s,i){var r,o=arguments.length,n=o<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,s):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(e,t,s,i);else for(var d=e.length-1;d>=0;d--)(r=e[d])&&(n=(o<3?r(n):o>3?r(t,s,n):r(t,s))||n);return o>3&&n&&Object.defineProperty(t,s,n),n};!function(e){let t=class extends((0,o.TS)((0,o.yC)(d.LitElement))){constructor(){super(...arguments),this.active=0,this.tabIndex=0,this.newMomentum=!1,this._disabled=!1}get disabled(){return this._disabled}set disabled(e){const t=this._disabled;this._disabled=e,this.setAttribute("aria-disabled",`${e}`),this.tabIndex=e?-1:0,this.requestUpdate("disabled",t)}get slotElement(){return this.buttonSlot}static get styles(){return[n.A,a.A]}firstUpdated(e){super.firstUpdated(e),this.setAttribute("role","group")}setButtonTabIndex(){this.slotted.forEach(e=>e.tabIndex=-1)}updated(e){super.updated(e),e.has("slotted")&&(this.setButtonTabIndex(),this.setFirstActive())}get selectedBtnValue(){return this.slotted[this.active].value}notifySelectedChange(){this.dispatchEvent(new CustomEvent("button-group-change",{detail:{selected:this.selectedBtnValue},bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("focus-visible",{composed:!0,bubbles:!0}))}setSelected(e){var t,s;const i=this.findSelectedBtnIndex();-1!==i&&i!==e&&(null===(t=this.slotted[i])||void 0===t||t.toggleAttribute("selected",!1)),null===(s=this.slotted[e])||void 0===s||s.toggleAttribute("selected",!0)}setFirstActive(){-1===this.findSelectedBtnIndex()&&this.setSelected(this.active)}findBtnIndex(e){const t=e.composedPath();return this.slotted.findIndex(e=>t.includes(e))}findSelectedBtnIndex(){return this.slotted.findIndex(e=>e.hasAttribute("selected"))}isBtnDisabled(e){return this.slotted[e].disabled}connectedCallback(){super.connectedCallback(),this.addEventListener("keydown",this.handleKeyDown),this.addEventListener("click",this.handleClick)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("keydown",this.handleKeyDown),this.removeEventListener("click",this.handleClick)}switchBtnOnArrowPress(e,t=1){const s=this.getAvailableSelectedIndex(e,t);-1!==s&&(this.active=s,this.setSelected(s),this.notifySelectedChange())}getAvailableSelectedIndex(e,t=1){const s=this.slotted.length;for(let i=0,r=e;i<s;i+=1,r+=t){r<0?r=s-1:r>=s&&(r=0);const e=this.slotted[r];if(this.isFocusable(e))return r}return-1}isFocusable(e){return!e.hasAttribute("disabled")&&!e.hasAttribute("hidden")}handleClick(e){const t=this.findBtnIndex(e);-1!==t&&(this.isBtnDisabled(t)||(this.active=t,this.setSelected(t),this.notifySelectedChange()))}handleKeyDown(e){const{code:t}=e;switch(t){case r.Uz.Enter:case r.Uz.Space:this.isBtnDisabled(this.active)||(this.setSelected(this.active),this.notifySelectedChange());break;case r.Uz.ArrowLeft:0===this.active?this.switchBtnOnArrowPress(this.slotted.length-1,-1):this.switchBtnOnArrowPress(this.active-1,-1);break;case r.Uz.ArrowRight:this.active===this.slotted.length-1?this.switchBtnOnArrowPress(0):this.switchBtnOnArrowPress(this.active+1)}}render(){return d.html`
        <div role="group" class="md-button-group" part="button-group">
          <slot name="button"></slot>
        </div>
      `}};c([(0,l.property)({type:Number,reflect:!0})],t.prototype,"active",void 0),c([(0,l.property)({type:Number,reflect:!0})],t.prototype,"tabIndex",void 0),c([(0,l.property)({type:Boolean,reflect:!0})],t.prototype,"newMomentum",void 0),c([(0,l.query)("slot[name='button']")],t.prototype,"buttonSlot",void 0),c([(0,l.property)({type:Boolean,reflect:!0})],t.prototype,"disabled",null),t=c([(0,o.wW)("md-button-group")],t),e.ELEMENT=t}(i||(i={}))},7704(e,t,s){s.d(t,{TS:()=>r.T,wW:()=>o.w,yC:()=>i.y}),s(2364);var i=s(3203),r=(s(9938),s(5201),s(4781),s(608)),o=s(9609)},7161(t){t.exports=e},429(e){e.exports=t}},r={};function o(e){var t=r[e];if(void 0!==t)return t.exports;var s=r[e]={exports:{}};return i[e](s,s.exports,o),s.exports}o.m=i,s=[],o.O=(e,t,i,r)=>{if(!t){var n=1/0;for(c=0;c<s.length;c++){for(var[t,i,r]=s[c],d=!0,l=0;l<t.length;l++)(!1&r||n>=r)&&Object.keys(o.O).every(e=>o.O[e](t[l]))?t.splice(l--,1):(d=!1,r<n&&(n=r));if(d){s.splice(c--,1);var a=i();void 0!==a&&(e=a)}}return e}r=r||0;for(var c=s.length;c>0&&s[c-1][2]>r;c--)s[c]=s[c-1];s[c]=[t,i,r]},o.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return o.d(t,{a:t}),t},o.d=(e,t)=>{for(var s in t)o.o(t,s)&&!o.o(e,s)&&Object.defineProperty(e,s,{enumerable:!0,get:t[s]})},o.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),o.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},(()=>{var e={561:0,2942:0,5310:0,5323:0,7704:0,8180:0};o.O.j=t=>0===e[t];var t=(t,s)=>{var i,r,[n,d,l]=s,a=0;if(n.some(t=>0!==e[t])){for(i in d)o.o(d,i)&&(o.m[i]=d[i]);if(l)var c=l(o)}for(t&&t(s);a<n.length;a++)r=n[a],o.o(e,r)&&e[r]&&e[r][0](),e[r]=0;return o.O(c)},s=self["momentum-web-components-[id]"]=self["momentum-web-components-[id]"]||[];s.forEach(t.bind(null,0)),s.push=t.bind(null,s.push.bind(s))})();var n=o.O(void 0,[9609,4084,2364,9938,4781,5201,5584,2900,608,2670],()=>o(2890));return o.O(n)})());