import{r as t,c as s,h as i,H as a,g as e}from"./p-add854e8.js";import{h as r}from"./p-b2575aeb.js";const o=class{constructor(i){t(this,i),this.ruxToastOpen=s(this,"ruxtoastopen",7),this.ruxToastClosed=s(this,"ruxtoastclosed",7),this._timeoutRef=null,this.hasMessageSlot=!1,this.message="",this.closeAfter=void 0,this.hideClose=!1}watchHandler(){this._updated()}connectedCallback(){this._handleSlotChange=this._handleSlotChange.bind(this),this._updated(),this.hasMessageSlot=r(this.el),this._onClick=this._onClick.bind(this),this._onKeyPress=this._onKeyPress.bind(this)}componentDidLoad(){this._handleOpen()}_handleOpen(){this.ruxToastOpen.emit()}_handleClose(){this.ruxToastClosed.emit(),this.el.remove()}_updated(){this._closeAfter&&(this._timeoutRef=window.setTimeout((()=>{this._handleClose()}),this._closeAfter))}_onClick(){this._timeoutRef&&clearTimeout(this._timeoutRef),this._handleClose()}_onKeyPress(t){"Enter"===t.key&&this._onClick()}get _closeAfter(){return this.closeAfter&&this.closeAfter<=999&&(this.closeAfter*=1e3),(this.closeAfter&&this.closeAfter>1e4||this.closeAfter&&this.closeAfter<2e3)&&(this.closeAfter=2e3),this.closeAfter}_handleSlotChange(){this.hasMessageSlot=r(this.el)}render(){return i(a,null,i("div",{class:{"rux-toast":!0},part:"container"},i("div",{class:{"rux-toast__content":!0},part:"message"},i("slot",{onSlotchange:this._handleSlotChange}),!this.hasMessageSlot&&this.message?i("span",null,this.message):null),this.hideClose?null:i("div",{class:"rux-toast__actions"},i("rux-icon",{role:"button",tabindex:"1",class:"rux-toast__close",onClick:this._onClick,onKeyDown:this._onKeyPress,icon:"clear",exportparts:"icon",size:"16px"}))))}get el(){return e(this)}static get watchers(){return{closeAfter:["watchHandler"]}}};o.style=":host{display:contents;--height:auto}.rux-toast{display:flex;align-items:center;align-content:center;box-sizing:border-box;width:calc((var(--spacing-20, 5rem) * 3) + (var(--spacing-10, 2.5rem)));border-radius:var(--radius-base, 3px);background:var(--color-background-base-default, #101923);padding:calc(var(--spacing-4, 1rem) + var(--spacing-050, 0.125rem)) var(--spacing-2, 0.5rem) calc(var(--spacing-4, 1rem) + var(--spacing-050, 0.125rem)) var(--spacing-4, 1rem);margin-block-start:var(--spacing-3, 0.75rem);min-height:calc(var(--spacing-14, 3.5rem) + var(--spacing-1, 0.25rem));height:var(--height);border:var(--border-width-xs, 1px) solid var(--color-border-interactive-default, #4dacff);font-family:var(--font-body-1-font-family, 'Roboto', -apple-system, BlinkMacSystemFont, 'Segoe UI', Oxygen-Sans, Ubuntu, Cantarell, 'Helvetica Neue', sans-serif);font-size:var(--font-body-1-font-size, 1rem);font-weight:var(--font-body-1-font-weight, 400);letter-spacing:var(--font-body-1-letter-spacing, 0.005em);line-height:var(--line-height-base, 1.5rem);opacity:inherit}.rux-toast__actions{margin-left:auto;margin-bottom:auto;display:flex}.rux-toast__close:focus-visible{border-radius:var(--radius-base, 3px);outline:var(--border-width-focus-default, 1px) solid var(--color-border-focus-default, #da9ce7);outline-offset:var(--spacing-focus-default, 0.125rem)}.rux-toast__close{cursor:pointer}";export{o as rux_toast}