import{__decorate as t}from"tslib";import{html as i}from"lit";import{property as e,customElement as s}from"lit/decorators.js";import{s as o}from"./nile-side-bar-group-item-icon.css.esm.js";import{N as r}from"../internal/nile-element.esm.js";import"../internal/accessibility/a11y.state.enum.esm.js";import"../internal/accessibility/a11y.property.enum.esm.js";import"../internal/accessibility/role.enum.esm.js";let n=class extends r{constructor(){super(...arguments),this.icon="",this.tooltip="",this.method="fill",this.size="14",this.enableVisibilityEffect=!1,this.duration=200,this.sidebar=null}static get styles(){return[o]}connectedCallback(){if(this.hasAttribute("slot")||this.setAttribute("slot","icon"),super.connectedCallback(),this.sidebar=this.closest("nile-side-bar"),this.sidebar){const t=new MutationObserver((()=>this.requestUpdate()));t.observe(this.sidebar,{attributes:!0,attributeFilter:["collapsed"]}),this._observer=t}}disconnectedCallback(){super.disconnectedCallback(),this._observer?.disconnect()}getSiblingText(){const t=this.parentElement,i=t?.querySelector("nile-side-bar-group-item-text");return i?.textContent?.trim()??""}render(){const t=!!this.sidebar?.collapsed,e=this.tooltip||this.getSiblingText();return t&&e?i`

          <slot>
          <nile-lite-tooltip hoist distance="18" content=${e} placement="right" enableVisibilityEffect=${this.enableVisibilityEffect} duration=${this.duration}>
            ${this.icon?i`<nile-icon size=${this.size}  color="var(--nile-colors-dark-900,var(--ng-colors-fg-quaternary-400))" name=${this.icon} method=${this.method}></nile-icon>`:null}
            </nile-lite-tooltip>
          </slot>

      `:i`
      <slot>
        ${this.icon?i`<nile-icon size=${this.size} color="var(--nile-colors-dark-900,var(--ng-colors-fg-quaternary-400))" size="14" name=${this.icon} method=${this.method}></nile-icon>`:null}
      </slot>
    `}};t([e({type:String,reflect:!0})],n.prototype,"icon",void 0),t([e({type:String})],n.prototype,"tooltip",void 0),t([e({type:String})],n.prototype,"method",void 0),t([e({type:String})],n.prototype,"size",void 0),t([e({type:Boolean,attribute:!0,reflect:!0})],n.prototype,"enableVisibilityEffect",void 0),t([e({type:Number,attribute:!0,reflect:!0})],n.prototype,"duration",void 0),n=t([s("nile-side-bar-group-item-icon")],n);export{n as N};
