var __awaiter=this&&this.__awaiter||function(n,t,e,r){function i(n){return n instanceof e?n:new e((function(t){t(n)}))}return new(e||(e=Promise))((function(e,a){function o(n){try{f(r.next(n))}catch(n){a(n)}}function u(n){try{f(r["throw"](n))}catch(n){a(n)}}function f(n){n.done?e(n.value):i(n.value).then(o,u)}f((r=r.apply(n,t||[])).next())}))};var __generator=this&&this.__generator||function(n,t){var e={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]},r,i,a,o;return o={next:u(0),throw:u(1),return:u(2)},typeof Symbol==="function"&&(o[Symbol.iterator]=function(){return this}),o;function u(n){return function(t){return f([n,t])}}function f(u){if(r)throw new TypeError("Generator is already executing.");while(o&&(o=0,u[0]&&(e=0)),e)try{if(r=1,i&&(a=u[0]&2?i["return"]:u[0]?i["throw"]||((a=i["return"])&&a.call(i),0):i.next)&&!(a=a.call(i,u[1])).done)return a;if(i=0,a)u=[u[0]&2,a.value];switch(u[0]){case 0:case 1:a=u;break;case 4:e.label++;return{value:u[1],done:false};case 5:e.label++;i=u[1];u=[0];continue;case 7:u=e.ops.pop();e.trys.pop();continue;default:if(!(a=e.trys,a=a.length>0&&a[a.length-1])&&(u[0]===6||u[0]===2)){e=0;continue}if(u[0]===3&&(!a||u[1]>a[0]&&u[1]<a[3])){e.label=u[1];break}if(u[0]===6&&e.label<a[1]){e.label=a[1];a=u;break}if(a&&e.label<a[2]){e.label=a[2];e.ops.push(u);break}if(a[2])e.ops.pop();e.trys.pop();continue}u=t.call(n,e)}catch(n){u=[6,n];i=0}finally{r=a=0}if(u[0]&5)throw u[1];return{value:u[0]?u[1]:void 0,done:true}}};System.register(["./p-CZqZRJHG.system.js"],(function(n){"use strict";var t,e,r;return{setters:[function(n){t=n.a;e=n.R;r=n.S}],execute:function(){var i=this;var a='[tabindex]:not([tabindex^="-"]):not([hidden]):not([disabled]), input:not([type=hidden]):not([tabindex^="-"]):not([hidden]):not([disabled]), textarea:not([tabindex^="-"]):not([hidden]):not([disabled]), button:not([tabindex^="-"]):not([hidden]):not([disabled]), select:not([tabindex^="-"]):not([hidden]):not([disabled]), .bal-focusable:not([tabindex^="-"]):not([hidden]):not([disabled]), .bal-focusable[disabled="false"]:not([tabindex^="-"]):not([hidden])';var o=function(n,t){var e=n.querySelector(a);f(e,t!==null&&t!==void 0?t:n)};var u=function(n,t){var e=Array.from(n.querySelectorAll(a));var r=e.length>0?e[e.length-1]:null;f(r,t!==null&&t!==void 0?t:n)};var f=function(n,t){var e=n;var r=n===null||n===void 0?void 0:n.shadowRoot;if(r){e=r.querySelector(a)||n}if(e){c(e)}else{t.focus({preventScroll:true})}};var c=function(n){n.focus({preventScroll:true});if(n.classList.contains("bal-focusable")){var t=n.closest("bal-app");if(t){t.setFocus([n])}}};var d=0;var l="backdrop";var s=n("p",(function(n){if(t.hasDocument){h(document)}var e=d++;n.overlayIndex=e;if(!n.el.hasAttribute("id")){n.el.id="bal-overlay-".concat(e)}}));var v=n("g",(function(n,t){if(t===undefined){t="bal-modal,bal-snackbar,bal-toast"}return Array.from(n.querySelectorAll(t)).filter((function(n){return n.overlayIndex>0}))}));var b=n("a",(function(n,t,e){var r=v(n,t);return e===undefined?r[r.length-1]:r.find((function(n){return n.id===e}))}));var h=function(n){if(d===0){d=1;n.addEventListener("focus",(function(t){x(t,n)}),true);n.addEventListener("keyup",(function(t){if(t.key==="Escape"){var e=b(n);if(e){if(e.isClosable===false){return}e.dismiss(undefined,l)}}}))}};var y=function(n,t,e){var r=p(n,t);return r[r.length-1]};var p=function(n,t){return v(n,t).filter((function(n){return!w(n)}))};var w=function(n){return n.classList.contains("is-hidden")};var x=function(n,t){var e=y(t,"bal-modal");var r=n.target;if(!e||!r){return}var i=function(){if(e===r){e.lastFocus=undefined}else{var n=e;var i=n.querySelector(".bal-modal__container");if(!i){return}if(i.contains(r)||r===n.querySelector("bal-modal__background")){e.lastFocus=r}else{var a=e.lastFocus;o(i,e);if(a===t.activeElement){u(i,e)}e.lastFocus=t.activeElement}}};var a=function(){if(e.contains(r)){e.lastFocus=r}else if(r.tagName==="BAL-TOAST"){S(e.lastFocus,e)}else{var n=e.lastFocus;o(e);if(n===t.activeElement){u(e)}e.lastFocus=t.activeElement}};if(e.shadowRoot){a()}else{i()}};var _=n("d",(function(n,t,e,r){return __awaiter(i,void 0,void 0,(function(){var i;return __generator(this,(function(a){switch(a.label){case 0:if(!n.presented){return[2,false]}a.label=1;case 1:a.trys.push([1,3,,4]);n.el.style.setProperty("pointer-events","none");n.willDismiss.emit({data:t,role:e});return[4,r()];case 2:a.sent();n.presented=false;n.didDismiss.emit({data:t,role:e});return[3,4];case 3:i=a.sent();n.presented=false;console.error(i);return[3,4];case 4:n.el.remove();return[2,true]}}))}))}));var m=n("e",(function(n,t){var e;var r=new Promise((function(n){return e=n}));k(n,t,(function(n){e(n.detail)}));return r}));var k=function(n,t,i){var a=function(e){r(n,t,a);i(e)};e(n,t,a)};var S=function(n,t){var e=n;var r=n===null||n===void 0?void 0:n.shadowRoot;if(r){e=r.querySelector(a)||n}if(e){c(e)}else{t.focus()}};var g=n("F","bal-disable-focus-trap")}}}));