import{r as t,c as s,h as a,H as r,g as o}from"./p-add854e8.js";import{a as i}from"./p-479b8fc9.js";const e=class{constructor(a){t(this,a),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,this.status=void 0}watchHandler(){this._updated()}connectedCallback(){this._handleSlotChange=this._handleSlotChange.bind(this),this._updated(),this.hasMessageSlot=i(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=i(this.el)}render(){return a(r,null,a("div",{class:`rux-toast rux-toast-status__${this.status}`,part:"container"},a("div",{class:{"rux-toast__content":!0},part:"message"},this.status?a("rux-status",{status:this.status}):null,a("slot",{onSlotchange:this._handleSlotChange}),!this.hasMessageSlot&&this.message?a("span",null,this.message):null),this.hideClose?null:a("div",{class:"rux-toast__actions"},a("rux-icon",{role:"button",tabindex:"1",class:"rux-toast__close",onClick:this._onClick,onKeyDown:this._onKeyPress,icon:"clear",exportparts:"icon",size:getComputedStyle(this.el).getPropertyValue("--iconSize")}))))}get el(){return o(this)}static get watchers(){return{closeAfter:["watchHandler"]}}};e.style=":host{display:contents;--height:auto;--iconSize:16px}.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__content{display:flex;justify-content:center;align-items:center;gap:var(--spacing-4, 1rem)}.rux-toast__close{cursor:pointer}.rux-toast.rux-toast-status__standby{border-color:var(--color-status-standby, #2dccff)}.rux-toast.rux-toast-status__standby rux-icon::part(icon){color:var(--color-status-standby, #2dccff)}.rux-toast.rux-toast-status__critical{border-color:var(--color-status-critical, #ff3838)}.rux-toast.rux-toast-status__critical rux-icon::part(icon){color:var(--color-status-critical, #ff3838)}.rux-toast.rux-toast-status__serious{border-color:var(--color-status-serious, #ffb302)}.rux-toast.rux-toast-status__serious rux-icon::part(icon){color:var(--color-status-serious, #ffb302)}.rux-toast.rux-toast-status__caution{border-color:var(--color-status-caution, #fce83a)}.rux-toast.rux-toast-status__caution rux-icon::part(icon){color:var(--color-status-caution, #fce83a)}.rux-toast.rux-toast-status__off{border-color:var(--color-status-off, #a4abb6)}.rux-toast.rux-toast-status__off rux-icon::part(icon){color:var(--color-status-off, #a4abb6)}.rux-toast.rux-toast-status__normal{border-color:var(--color-status-normal, #56f000)}.rux-toast.rux-toast-status__normal rux-icon::part(icon){color:var(--color-status-normal, #56f000)}";export{e as rux_toast}