var t,e,o={329(t,e,o){o.d(e,{PG:()=>u,aF:()=>v,o6:()=>y}),o(5983),o(1821);var a=o(2900),i=o(3876),s=o(7704),r=o(9609),n=o(4084),d=o(2927),l=o(8899),p=o(4955),m=o(3517),h=o(6005),c=function(t,e,o,a){var i,s=arguments.length,r=s<3?e:null===a?a=Object.getOwnPropertyDescriptor(e,o):a;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,o,a);else for(var n=t.length-1;n>=0;n--)(i=t[n])&&(r=(s<3?i(r):s>3?i(e,o,r):i(e,o))||r);return s>3&&r&&Object.defineProperty(e,o,r),r};const y=["default","full","large","small","dialog"],u=["leading","center"];var v;!function(t){let e=class extends((0,s.dY)(d.LitElement)){constructor(){super(...arguments),this.show=!1,this.headerLabel="",this.headerMessage="",this.htmlId="",this.ariaLabel="modal",this.ariaLabelClose="Close Modal",this.ariaLabelCancel="Cancel Modal",this.ariaLabelSubmit="Submit Modal",this.ariaDescription="",this.showCloseButton=!1,this.backdropClickExit=!1,this.noExitOnEsc=!1,this.size="default",this.closeBtnName="",this.hideFooter=!1,this.hideHeader=!1,this.disableInitialFocus=!1,this.alignment=void 0,this.animating=!1,this.handleCloseOutside=t=>{t.code===a.Uz.Escape&&(t.preventDefault(),this.show&&!this.noExitOnEsc&&(this.show=!1))}}static get styles(){return[n.A,h.A]}connectedCallback(){super.connectedCallback(),document.addEventListener("keydown",this.handleCloseOutside)}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("keydown",this.handleCloseOutside)}update(t){super.update(t),t.has("show")&&(this.show?this.modalFadeIn():!0===t.get("show")&&this.modalFadeOut())}get computedAlignment(){return void 0===this.alignment?i.vz.isMomentumV2Enabled?"leading":"center":this.alignment}notifyModalClose(){this.dispatchEvent(new CustomEvent("close-modal",{composed:!0,bubbles:!0}))}focusInsideModal(){var t;(null===(t=this.focusableElements)||void 0===t?void 0:t.length)&&this.setInitialFocus()}handleKeyDown(t){t.code!==a.Uz.Enter&&t.code!==a.Uz.Space||this.show&&(this.show=!0)}transitionPromise(t){return new Promise(e=>{const o=()=>{t.removeEventListener("transitionend",o),this.activateFocusTrap(),this.setFocusableElements(),requestAnimationFrame(()=>{e()})},a=()=>{t.removeEventListener("transitioncancel",a),this.deactivateFocusTrap(),this.modalFadeOut(),e()};t.addEventListener("transitionend",o),t.addEventListener("transitioncancel",a),setTimeout(()=>{this.animating=!0},13)})}modalFadeIn(){return t=this,e=void 0,a=function*(){this.backDrop&&(yield this.transitionPromise(this.backDrop),this.disableInitialFocus||this.focusInsideModal())},new((o=void 0)||(o=Promise))(function(i,s){function r(t){try{d(a.next(t))}catch(t){s(t)}}function n(t){try{d(a.throw(t))}catch(t){s(t)}}function d(t){var e;t.done?i(t.value):(e=t.value,e instanceof o?e:new o(function(t){t(e)})).then(r,n)}d((a=a.apply(t,e||[])).next())});var t,e,o,a}modalFadeOut(){this.animating=!1,this.deactivateFocusTrap(),this.notifyModalClose()}handleCloseBackdrop(){this.backdropClickExit&&(this.show=!1)}hideModal(){this.animating=!1,this.show=!1}topCloseBtnTemplate(){return d.html`
        ${this.showCloseButton?d.html`
              <md-button
                variant="ghost"
                size="20"
                circle
                class="md-close md-modal__close"
                @click=${this.hideModal}
                @keydown=${this.handleKeyDown}
                ariaLabel=${this.ariaLabelClose}
              >
                <md-icon name="cancel-bold" size="16" iconSet="momentumDesign"></md-icon>
              </md-button>
            `:d.nothing}
      `}handleFooterClick(){this.show=!1}headerTemplate(){return this.hideHeader?d.html`
            <div id="modal_header" part="modal-header" class="md-modal__header">
              <slot name="header"></slot>
            </div>
          `:d.html`
            <div id="modal_header" part="modal-header" class="md-modal__header">
              <h2 class="md-modal__title">${this.headerLabel}</h2>
              ${this.headerMessage?d.html` <span class="md-modal__message">${this.headerMessage}</span> `:d.nothing}
            </div>
          `}footerTemplate(){return this.hideFooter?d.html`
            <div part="modal-footer" class="md-modal__footer">
              <slot name="footer"></slot>
            </div>
          `:d.html`
            <div part="modal-footer" class="md-modal__footer">
              <md-button
                aria-label=${this.ariaLabelCancel}
                @click=${this.handleFooterClick}
                @keydown=${this.handleKeyDown}
                variant="secondary"
              >
                <span>Cancel</span>
              </md-button>
              <md-button
                type="submit"
                variant="primary"
                aria-label=${this.ariaLabelSubmit}
                @click=${this.handleFooterClick}
                @keydown=${this.handleKeyDown}
              >
                <span>${this.closeBtnName}</span>
              </md-button>
            </div>
          `}get modalBackDropClassMap(){return{in:this.show&&this.animating}}get modalContainerClassMap(){return{in:this.show,[`md-modal--${this.size}`]:!!this.size,[`md-modal--${this.computedAlignment}`]:!!this.computedAlignment}}render(){return d.html`
        ${this.show?d.html`
              <div part="modal-backdrop" class="md-modal__backdrop fade ${(0,p.classMap)(this.modalBackDropClassMap)}">
                ${this.backdropClickExit?d.html` <div class="md-modal_overlay" @click=${this.handleCloseBackdrop}></div> `:d.nothing}

                <div
                  part="modal-container"
                  role="dialog"
                  id="${this.htmlId}"
                  class="md-modal ${(0,p.classMap)(this.modalContainerClassMap)}"
                  aria-label="${(0,m.ifDefined)(this.headerLabel||this.ariaLabel||void 0)}"
                  aria-describedby=${(0,m.ifDefined)(this.ariaDescription||void 0)}
                >
                  <div part="modal-content" class="md-modal__content">
                    <div class="md-modal__flex-container" part="modal-flex-container">
                      ${this.headerTemplate()} ${this.topCloseBtnTemplate()}
                      <div id="modal-body" part="modal-body" class="md-modal__body">
                        <slot></slot>
                      </div>
                      ${this.footerTemplate()}
                    </div>
                  </div>
                </div>
              </div>
            `:d.nothing}
      `}};c([(0,l.property)({type:Boolean})],e.prototype,"show",void 0),c([(0,l.property)({type:String})],e.prototype,"headerLabel",void 0),c([(0,l.property)({type:String})],e.prototype,"headerMessage",void 0),c([(0,l.property)({type:String})],e.prototype,"htmlId",void 0),c([(0,l.property)({type:String,attribute:"aria-label"})],e.prototype,"ariaLabel",void 0),c([(0,l.property)({type:String})],e.prototype,"ariaLabelClose",void 0),c([(0,l.property)({type:String})],e.prototype,"ariaLabelCancel",void 0),c([(0,l.property)({type:String})],e.prototype,"ariaLabelSubmit",void 0),c([(0,l.property)({type:String})],e.prototype,"ariaDescription",void 0),c([(0,l.property)({type:Boolean})],e.prototype,"showCloseButton",void 0),c([(0,l.property)({type:Boolean})],e.prototype,"backdropClickExit",void 0),c([(0,l.property)({type:Boolean})],e.prototype,"noExitOnEsc",void 0),c([(0,l.property)({type:String})],e.prototype,"size",void 0),c([(0,l.property)({type:String})],e.prototype,"closeBtnName",void 0),c([(0,l.property)({type:Boolean})],e.prototype,"hideFooter",void 0),c([(0,l.property)({type:Boolean})],e.prototype,"hideHeader",void 0),c([(0,l.property)({type:Boolean})],e.prototype,"disableInitialFocus",void 0),c([(0,l.property)({type:String})],e.prototype,"alignment",void 0),c([(0,l.state)()],e.prototype,"animating",void 0),c([(0,l.query)(".md-modal__backdrop")],e.prototype,"backDrop",void 0),e=c([(0,r.w)("md-modal")],e),t.ELEMENT=e}(v||(v={}))}},a={};function i(t){var e=a[t];if(void 0!==e)return e.exports;var s=a[t]={exports:{}};return o[t](s,s.exports,i),s.exports}i.m=o,t=[],i.O=(e,o,a,s)=>{if(!o){var r=1/0;for(p=0;p<t.length;p++){for(var[o,a,s]=t[p],n=!0,d=0;d<o.length;d++)(!1&s||r>=s)&&Object.keys(i.O).every(t=>i.O[t](o[d]))?o.splice(d--,1):(n=!1,s<r&&(r=s));if(n){t.splice(p--,1);var l=a();void 0!==l&&(e=l)}}return e}s=s||0;for(var p=t.length;p>0&&t[p-1][2]>s;p--)t[p]=t[p-1];t[p]=[o,a,s]},i.d=(t,e)=>{for(var o in e)i.o(e,o)&&!i.o(t,o)&&Object.defineProperty(t,o,{enumerable:!0,get:e[o]})},i.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),i.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e);export{i as __webpack_require__};e={6433:0},i.C=t=>{var o,a,{__webpack_esm_ids__:s,__webpack_esm_modules__:r,__webpack_esm_runtime__:n}=t,d=0;for(o in r)i.o(r,o)&&(i.m[o]=r[o]);for(n&&n(i);d<s.length;d++)a=s[d],i.o(e,a)&&e[a]&&e[a][0](),e[s[d]]=0;i.O()},i.O.j=t=>0===e[t];import*as s from"../9609.js";i.C(s);import*as r from"../4084.js";i.C(r);import*as n from"../4955.js";i.C(n);import*as d from"../3517.js";i.C(d);import*as l from"../1156.js";i.C(l);import*as p from"../3305.js";i.C(p);import*as m from"../4739.js";i.C(m);import*as h from"../7154.js";i.C(h);import*as c from"../9773.js";i.C(c);import*as y from"../5983.js";i.C(y);import*as u from"../7755.js";i.C(u);import*as v from"../1821.js";i.C(v);import*as f from"../2364.js";i.C(f);import*as b from"../5308.js";i.C(b);import*as C from"../9500.js";i.C(C);import*as g from"../4781.js";i.C(g);import*as _ from"../519.js";i.C(_);import*as w from"../5201.js";i.C(w);import*as k from"../5584.js";i.C(k);import*as j from"../8227.js";i.C(j);import*as E from"../1280.js";i.C(E);import*as $ from"../4700.js";i.C($);import*as L from"../2599.js";i.C(L);import*as F from"../3876.js";i.C(F);import*as O from"../6005.js";i.C(O);import*as M from"../561.js";i.C(M);var B=i.O(void 0,[9609,4084,4955,3517,1156,3305,4739,7154,9773,5983,7755,1821,2364,5308,9500,4781,519,5201,5584,8227,1280,4700,2599,3876,6005,561],()=>i(329));const x=(B=i.O(B)).aF,D=B.PG,S=B.o6;export{x as Modal,D as modalAlignment,S as modalType};