var e,t,o={9613(e,t,o){o.d(t,{FH:()=>f,m_:()=>v,vF:()=>u});var s=o(6142),i=o(2900),n=o(7704),r=o(9609),p=o(2050),l=o(4084),a=o(2927),d=o(8899),h=o(4955),c=o(6343),m=function(e,t,o,s){var i,n=arguments.length,r=n<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,o):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(e,t,o,s);else for(var p=e.length-1;p>=0;p--)(i=e[p])&&(r=(n<3?i(r):n>3?i(t,o,r):i(t,o))||r);return n>3&&r&&Object.defineProperty(t,o,r),r};const f=s.W,u=["fixed","absolute"];var v;!function(e){let t=class extends((0,n.UM)((0,n.yC)(a.LitElement))){constructor(){super(...arguments),this.message="",this.placement="auto",this.disabled=!1,this.opened=!1,this.slotToTooltip=!1,this.slotContent=null,this._keyDownListener=e=>{this.handleKeyDown(e)},this._wheelListener=e=>{this.opened&&this.notifyTooltipDestroy()}}hasMessage(){return this.message&&this.message.trim().length>0}hasSlotContent(){return this.slotContent&&this.slotContent.length>0}get hasTooltipContent(){return this.hasMessage()||this.hasSlotContent()}connectedCallback(){super.connectedCallback(),document.addEventListener("keydown",this._keyDownListener),window.addEventListener("wheel",this._wheelListener,{passive:!0})}disconnectedCallback(){this.notifyTooltipDisconnected(),super.disconnectedCallback(),document.removeEventListener("keydown",this._keyDownListener),window.removeEventListener("wheel",this._wheelListener)}handleResize(e){var t;null===(t=super.handleResize)||void 0===t||t.call(this,e),(0,p.sg)(()=>{this.slotToTooltip&&(this.disabled=this.reference&&!this.isContentTruncated(this.reference))},100)()}handleFocusIn(e){super.handleFocusIn&&super.handleFocusIn(e),this.notifyTooltipCreate()}handleFocusOut(e){super.handleFocusOut&&super.handleFocusOut(e),this.notifyTooltipDestroy()}openTooltip(){this.dispatchEvent(new CustomEvent("tooltip-create",{bubbles:!0,composed:!0,detail:Object.assign({placement:this.placement,reference:this.reference,popper:this.popper},!this.message&&{slotContent:this.slotContent})}))}notifyTooltipDisconnected(){document.dispatchEvent(new CustomEvent("tooltip-disconnected",{bubbles:!0,composed:!0,detail:{}}))}closeTooltip(){this.dispatchEvent(new CustomEvent("tooltip-destroy",{bubbles:!0,composed:!0,detail:{placement:this.placement,reference:this.reference,popper:this.popper}}))}changeMessage(){this.dispatchEvent(new CustomEvent("tooltip-message",{bubbles:!0,composed:!0,detail:{placement:this.placement,reference:this.reference,popper:this.popper}}))}changeSlotContent(e){this.dispatchEvent(new CustomEvent("tooltip-slot",{bubbles:!0,composed:!0,detail:{placement:this.placement,reference:this.reference,popper:this.popper,slotContent:e}}))}notifyTooltipCreate(){!this.disabled&&this.hasTooltipContent&&(this.opened=!0)}notifyTooltipDestroy(){this.disabled||(this.opened=!1)}handleKeyDown(e){e.code===i.Uz.Escape&&this.notifyTooltipDestroy()}handleSlotContentChange(e){const t=e.target;if(t){const e=t.assignedElements({flatten:!0});e.length&&(this.slotContent&&this.changeSlotContent(e),this.slotContent=e)}}updated(e){super.updated(e),e.has("opened")&&(this.opened?this.openTooltip():this.closeTooltip()),e.has("message")&&this.changeMessage(),e.has("disabled")&&this.opened&&(this.opened=!1)}handleSlotChanged(e){const t=e.target;if(this.slotToTooltip&&t){const e=t.assignedNodes({flatten:!0}).map(e=>e.textContent).join(" ").trim();this.message=e,this.disabled=this.reference&&!this.isContentTruncated(this.reference)}}isContentTruncated(e){return e.scrollWidth>e.clientWidth}get tooltipClassMap(){return{"md-tooltip--disabled":this.disabled}}render(){return a.html`
        <div class="md-tooltip ${(0,h.classMap)(this.tooltipClassMap)}">
          <div class="md-tooltip__popper" role="tooltip" part="tooltip-popper">
            <div id="md-tooltip__content" class="md-tooltip__content" part="tooltip-content">
              ${this.message||a.html` <slot name="tooltip-content" @slotchange=${this.handleSlotContentChange}></slot> `}
            </div>
            <div id="arrow" class="md-tooltip__arrow" data-popper-arrow></div>
          </div>
          <div
            class="md-tooltip__reference"
            part="tooltip_reference"
            @mouseenter=${()=>this.notifyTooltipCreate()}
            @mouseleave=${()=>this.notifyTooltipDestroy()}
            @focusin=${e=>this.handleFocusIn(e)}
            @focusout=${e=>this.handleFocusOut(e)}
            @keydown=${e=>this.handleKeyDown(e)}
            aria-describedby="md-tooltip__content"
          >
            <slot @slotchange=${this.handleSlotChanged}></slot>
          </div>
        </div>
      `}static get styles(){return[l.A,c.A]}};m([(0,d.property)({type:String})],t.prototype,"message",void 0),m([(0,d.property)({type:String,reflect:!0})],t.prototype,"placement",void 0),m([(0,d.property)({type:Boolean,reflect:!0})],t.prototype,"disabled",void 0),m([(0,d.property)({type:Boolean,reflect:!0})],t.prototype,"opened",void 0),m([(0,d.property)({type:Boolean,reflect:!0,attribute:"slot-to-tooltip"})],t.prototype,"slotToTooltip",void 0),m([(0,d.query)(".md-tooltip__popper")],t.prototype,"popper",void 0),m([(0,d.query)(".md-tooltip__reference")],t.prototype,"reference",void 0),t=m([(0,r.w)("md-tooltip")],t),e.ELEMENT=t}(v||(v={}))}},s={};function i(e){var t=s[e];if(void 0!==t)return t.exports;var n=s[e]={exports:{}};return o[e](n,n.exports,i),n.exports}i.m=o,e=[],i.O=(t,o,s,n)=>{if(!o){var r=1/0;for(d=0;d<e.length;d++){for(var[o,s,n]=e[d],p=!0,l=0;l<o.length;l++)(!1&n||r>=n)&&Object.keys(i.O).every(e=>i.O[e](o[l]))?o.splice(l--,1):(p=!1,n<r&&(r=n));if(p){e.splice(d--,1);var a=s();void 0!==a&&(t=a)}}return t}n=n||0;for(var d=e.length;d>0&&e[d-1][2]>n;d--)e[d]=e[d-1];e[d]=[o,s,n]},i.d=(e,t)=>{for(var o in t)i.o(t,o)&&!i.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},i.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);export{i as __webpack_require__};t={3943:0,9613:0},i.C=e=>{var o,s,{__webpack_esm_ids__:n,__webpack_esm_modules__:r,__webpack_esm_runtime__:p}=e,l=0;for(o in r)i.o(r,o)&&(i.m[o]=r[o]);for(p&&p(i);l<n.length;l++)s=n[l],i.o(t,s)&&t[s]&&t[s][0](),t[n[l]]=0;i.O()},i.O.j=e=>0===t[e];import*as n from"../9609.js";i.C(n);import*as r from"../4084.js";i.C(r);import*as p from"../4955.js";i.C(p);import*as l from"../2364.js";i.C(l);import*as a from"../9938.js";i.C(a);import*as d from"../4781.js";i.C(d);import*as h from"../5584.js";i.C(h);import*as c from"../8227.js";i.C(c);import*as m from"../2900.js";i.C(m);import*as f from"../2927.js";i.C(f);import*as u from"../2050.js";i.C(u);import*as v from"../6343.js";i.C(v);import*as y from"../7582.js";i.C(y);import*as C from"../8899.js";i.C(C);import*as g from"../5323.js";i.C(g);import*as b from"../6142.js";i.C(b);var _=i.O(void 0,[9609,4084,4955,2364,9938,4781,5584,8227,2900,2927,2050,6343,7582,8899,5323,6142],()=>i(9613));const w=(_=i.O(_)).m_,T=_.FH,j=_.vF;export{w as Tooltip,T as tooltipPlacement,j as tooltipStrategy};