import{r as t,h as o,g as i}from"./p-f06dc8f3.js";import{m as r}from"./p-84ba0a57.js";const e=class{constructor(o){t(this,o),this.position="right",this.show=!1,this.containerClass=()=>r("ibk-drawer",["open-"+this.position,{container:null!=this.container}]),this.getContainerLimits=()=>{if(null!=this.container){let t={};const o=document.querySelector(this.container),i=o.offsetTop,r=o.offsetLeft,e=window.innerHeight-(i+o.clientHeight),n=window.innerWidth-(r+o.clientWidth),s=o.clientHeight,a=o.clientWidth;return"right"==this.position?(t.top=i+"px",t.right=n+"px"):"bottom"==this.position?(t.bottom=e+"px",t.left=r+"px"):("left"==this.position||"top"==this.position)&&(t.top=i+"px",t.left=r+"px"),t.width=a+"px",t.height=s+"px",t}},this.hideDrawer=t=>{null==t.target.closest(".ibk-drawer__content")&&this.host.removeAttribute("show")}}onShowChange(t){const o=this.host.querySelector(".ibk-drawer"),i=this.host.querySelector(".ibk-drawer__content");t?(o.style.display="block",setTimeout((()=>o.style.opacity="1"),10),setTimeout((()=>{"right"==this.position?i.style.right="0":"left"==this.position?i.style.left="0":"bottom"==this.position?i.style.bottom="0":"top"==this.position&&(i.style.top="0")}),250)):("right"==this.position?i.style.right="-100%":"left"==this.position?i.style.left="-100%":"bottom"==this.position?i.style.bottom="-100%":"top"==this.position&&(i.style.top="-100%"),setTimeout((()=>o.style.opacity="0"),250),setTimeout((()=>o.style.display="none"),500))}render(){return o("div",{class:this.containerClass(),onClick:this.hideDrawer,style:this.getContainerLimits()},o("div",{class:"ibk-drawer__content",style:{backgroundColor:this.backgroundColor}},o("button",{onClick:()=>this.host.removeAttribute("show"),type:"button",class:"ibk-drawer__close icon-m-close"}),o("slot",null)))}get host(){return i(this)}static get watchers(){return{show:["onShowChange"]}}};e.style=".ibk-drawer{box-sizing:border-box;position:fixed;height:100%;width:100%;background-color:rgba(255, 255, 255, 0.75);cursor:pointer;top:0;left:0;opacity:0;display:none;transition:var(--slow);overflow:hidden;z-index:10}.ibk-drawer--container{top:initial;left:initial;z-index:initial}.ibk-drawer *{box-sizing:border-box}.ibk-drawer__content{padding:30px;background-color:white;position:absolute;cursor:default;transition:var(--slow)}.ibk-drawer--open-right .ibk-drawer__content{top:0;right:-100%;height:100%;width:500px;box-shadow:-2px 0 5px 0 var(--gray4)}.ibk-drawer--open-left .ibk-drawer__content{top:0;left:-100%;height:100%;width:500px;box-shadow:2px 0 5px 0 var(--gray4)}.ibk-drawer--open-top .ibk-drawer__content{top:-100%;left:0;width:100%;box-shadow:0 2px 5px 0 var(--gray4)}.ibk-drawer--open-bottom .ibk-drawer__content{bottom:-100%;left:0;width:100%;box-shadow:0 -2px 5px 0 var(--gray4)}.ibk-drawer__close{appearance:none;-webkit-appearance:none;-moz-appearance:none;outline:none;background-color:transparent;border:none;position:absolute;top:20px;right:20px;font-size:24px;cursor:pointer;color:var(--grayText)}.ibk-drawer__close:active{transform:translateY(1px)}";export{e as ibk_drawer}