var __awaiter=this&&this.__awaiter||function(t,e,i,r){function n(t){return t instanceof i?t:new i((function(e){e(t)}))}return new(i||(i=Promise))((function(i,a){function o(t){try{c(r.next(t))}catch(t){a(t)}}function s(t){try{c(r["throw"](t))}catch(t){a(t)}}function c(t){t.done?i(t.value):n(t.value).then(o,s)}c((r=r.apply(t,e||[])).next())}))};var __generator=this&&this.__generator||function(t,e){var i={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]},r,n,a,o;return o={next:s(0),throw:s(1),return:s(2)},typeof Symbol==="function"&&(o[Symbol.iterator]=function(){return this}),o;function s(t){return function(e){return c([t,e])}}function c(s){if(r)throw new TypeError("Generator is already executing.");while(o&&(o=0,s[0]&&(i=0)),i)try{if(r=1,n&&(a=s[0]&2?n["return"]:s[0]?n["throw"]||((a=n["return"])&&a.call(n),0):n.next)&&!(a=a.call(n,s[1])).done)return a;if(n=0,a)s=[s[0]&2,a.value];switch(s[0]){case 0:case 1:a=s;break;case 4:i.label++;return{value:s[1],done:false};case 5:i.label++;n=s[1];s=[0];continue;case 7:s=i.ops.pop();i.trys.pop();continue;default:if(!(a=i.trys,a=a.length>0&&a[a.length-1])&&(s[0]===6||s[0]===2)){i=0;continue}if(s[0]===3&&(!a||s[1]>a[0]&&s[1]<a[3])){i.label=s[1];break}if(s[0]===6&&i.label<a[1]){i.label=a[1];a=s;break}if(a&&i.label<a[2]){i.label=a[2];i.ops.push(s);break}if(a[2])i.ops.pop();i.trys.pop();continue}s=e.call(t,i)}catch(t){s=[6,t];n=0}finally{r=a=0}if(s[0]&5)throw s[1];return{value:s[0]?s[1]:void 0,done:true}}};import{r as registerInstance,c as createEvent,h}from"./index-2bf16536.js";var alertCss=".alert__dialog{opacity:0;visibility:hidden;background-color:rgba(0, 0, 0, 0.7);width:100%;height:100%;position:fixed;top:0;left:0;-webkit-transition:opacity 0.3s ease-in-out;transition:opacity 0.3s ease-in-out;z-index:80000}.alert__dialog .alert{position:relative;margin:48px auto 0;overflow:hidden;max-width:424px;border-radius:8px;background:var(--color-surface-1, #F6F6F6);-webkit-box-shadow:0px 4px 10px var(--color-shadow-1, rgba(0, 0, 0, 0.16));box-shadow:0px 4px 10px var(--color-shadow-1, rgba(0, 0, 0, 0.16))}.alert__dialog--open{opacity:1;visibility:visible}.alert__dialog--fixed{position:fixed}.alert__dialog--contain{position:absolute}";var BdsAlertStyle0=alertCss;var BdsAlert=function(){function t(t){var e=this;registerInstance(this,t);this.bdsAlertChanged=createEvent(this,"bdsAlertChanged",7);this.listener=function(t){if(t.key=="Enter"||t.key=="Escape"){e.toggle()}};this.open=false;this.dataTest=null;this.position="fixed"}t.prototype.toggle=function(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(t){this.open=!this.open;if(this.open){this.bdsAlertChanged.emit({alertStatus:"opened"})}else{this.bdsAlertChanged.emit({alertStatus:"closed"})}return[2]}))}))};t.prototype.isOpenChanged=function(){if(this.open){document.addEventListener("keydown",this.listener,false)}else document.removeEventListener("keydown",this.listener,false)};t.prototype.render=function(){var t;return h("div",{key:"722f05c7a43fcb76030315eb01e75e92245c1fe2",class:(t={alert__dialog:true,"alert__dialog--open":this.open},t["alert__dialog--".concat(this.position)]=true,t)},h("div",{key:"64d389933ae6bcebf563c9874951ef43aa03b503",class:"alert","data-test":this.dataTest},h("slot",{key:"33be6a83aa0ec0092cf55b81f0fe0e30220aa3f6"})))};Object.defineProperty(t,"watchers",{get:function(){return{open:["isOpenChanged"]}},enumerable:false,configurable:true});return t}();BdsAlert.style=BdsAlertStyle0;export{BdsAlert as bds_alert};
//# sourceMappingURL=bds-alert.entry.js.map