export const __webpack_esm_id__=2583;export const __webpack_esm_ids__=[2583];export const __webpack_esm_modules__={2583(t,e,o){o.d(e,{v:()=>i}),o(2708),o(9613);var i,r=o(2900),s=o(9609),n=o(4084),l=o(2927),p=o(8899),h=o(4955),d=o(3517),a=o(9558),c=function(t,e,o,i){var r,s=arguments.length,n=s<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,o):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(t,e,o,i);else for(var l=t.length-1;l>=0;l--)(r=t[l])&&(n=(s<3?r(n):s>3?r(e,o,n):r(e,o))||n);return s>3&&n&&Object.defineProperty(e,o,n),n};!function(t){let e=class extends l.LitElement{constructor(){super(...arguments),this.color="",this.bgColor="",this.textColor="",this.height="",this.icon="",this.iconColor="",this.iconSize="",this.role="group",this.id="",this.small=!1,this.readonly=!1,this.selected=!1,this.disabled=!1,this.determinateProgress=0,this.indeterminateProgress=!1,this.tooltipText="",this.tooltipPlacement="auto",this.iconSet="momentumUI",this.suppressDefaultMaxWidth=!1,this.decorative=!1,this.shouldTruncateValue=!0,this.value="",this.textOverflow=!1,this.renderedText="",this.MAXWIDTH=115,this.selectionChange=t=>{this.dispatchEvent(new CustomEvent("chip-selected",{composed:!0,bubbles:!0,detail:{selected:t}}))},this.handleClear=t=>{this.dispatchEvent(new CustomEvent("chip-deleted",{composed:!0,bubbles:!0,detail:{id:t}}))},this.handleSelect=()=>{this.disabled||(this.selected=!0,this.selectionChange(!0))},this.handleDeSelect=()=>{this.selected=!1,this.selectionChange(!1)},this.renderBgColor=()=>this.bgColor?`background-color: ${this.bgColor};`:l.nothing,this.renderTextColor=()=>this.textColor?`color: ${this.textColor};`:l.nothing,this.renderHeight=()=>this.height?`height: ${this.height};`:l.nothing,this.getStyles=()=>this.bgColor||this.textColor||this.height?l.html`
          <style>
            :host .md-chip {
              ${this.renderBgColor()};
              ${this.renderTextColor()};
              ${this.renderHeight()};
            }
          </style>
        `:l.nothing}connectedCallback(){super.connectedCallback(),this.truncStringPortion(this.value),this.setAttribute("role",this.role)}willUpdate(t){super.willUpdate(t),(t.has("value")||t.has("shouldTruncateValue"))&&this.truncStringPortion(this.value)}getTextWidth(t,e){const o=null!=e?e:getComputedStyle(this).font,i=document.createElement("canvas").getContext("2d");return i?(i.font=o,i.measureText(t).width):0}truncStringPortion(t){const e=this.getTextWidth(t);if(!this.shouldTruncateValue||e<this.MAXWIDTH)return this.renderedText=t,void(this.textOverflow=!1);const o=Array.from(t);let i=Math.min(4,o.length),r=Math.min(5,Math.max(0,o.length-i-1)),s=o.slice(0,i).join(""),n=o.slice(-r).join(""),l=`${s}…${n}`;if(this.getTextWidth(l)>this.MAXWIDTH)return this.renderedText=l,void(this.textOverflow=!0);for(;i+r<o.length;){let t=!1;if(i+r<o.length){const e=s+o[i],r=`${e}…${n}`;this.getTextWidth(r)<=this.MAXWIDTH&&(s=e,i+=1,l=r,t=!0)}if(i+r<o.length){const e=o[o.length-r-1]+n,i=`${s}…${e}`;this.getTextWidth(i)<=this.MAXWIDTH&&(n=e,r+=1,l=i,t=!0)}if(!t)break}this.renderedText=l,this.textOverflow=!0}handleClick(){var t;const e=null===(t=this.shadowRoot)||void 0===t?void 0:t.querySelector("md-tooltip");null==e||e.dispatchEvent(new CustomEvent("tooltip-destroy",{bubbles:!0,composed:!0,detail:{placement:null==e?void 0:e.placement,reference:null==e?void 0:e.reference,popper:null==e?void 0:e.popper}})),this.dispatchEvent(new CustomEvent("chip-interaction",{composed:!0,bubbles:!0,detail:{id:this.id}}))}handleKeydown(t){switch(t.code){case r.Uz.Space:case r.Uz.Enter:this.handleSelect(),this.handleClick()}}static get styles(){return[n.A,a.A]}loadingTemplate(){return this.determinateProgress||this.indeterminateProgress?this.determinateProgress?l.html`
              <md-progress-bar
                class="md-chip--loading"
                type="determinate"
                value="${this.determinateProgress}"
                displayFormat="none"
              >
              </md-progress-bar>
            `:l.html`
              <md-progress-bar class="md-chip--loading" type="indeterminate" displayFormat="none"></md-progress-bar>
            `:l.nothing}iconTemplate(){const t=this.disabled?"":this.iconColor;return this.icon?l.html`
            <md-icon
              class="md-chip--icon"
              part="chip-icon"
              name="${this.icon}"
              color="${t}"
              iconSet=${(0,d.ifDefined)(this.iconSet)}
              size="${(0,d.ifDefined)(this.iconSize)}"
            >
            </md-icon>
          `:l.nothing}getToolTipContent(){return this.tooltipText&&this.textOverflow?this.value===this.tooltipText?this.tooltipText:`${this.value}, ${this.tooltipText}`:this.tooltipText?this.tooltipText:this.value}get textContentClassMap(){return{"md-chip--textcontent":!0,"md-chip--suppress-default-max-width":this.suppressDefaultMaxWidth}}get textContentTemplate(){return l.html`<span part="text-content" class=${(0,h.classMap)(this.textContentClassMap)}> ${this.renderedText}</span>`}render(){const t={"md-chip--small":this.small,"md-chip--disabled":this.disabled,[`md-chip--${this.color}`]:this.color,"suppress-max-width":this.suppressDefaultMaxWidth,"md-chip--interactive":!this.decorative},e=this.decorative?void 0:this.selected?"true":"false";return l.html`
        ${this.getStyles()}
        <md-tooltip
          ?disabled=${!this.tooltipText&&!this.textOverflow}
          message="${this.getToolTipContent()}"
          part="tooltip"
          placement="${this.tooltipPlacement}"
        >
          <span
            role=${(0,d.ifDefined)(this.decorative?void 0:"button")}
            tabindex="0"
            class="md-chip ${(0,h.classMap)(t)}"
            part="chip"
            aria-pressed=${(0,d.ifDefined)(e)}
            @click=${this.decorative?void 0:()=>this.handleClick()}
            @keydown=${this.decorative?void 0:t=>this.handleKeydown(t)}
          >
            ${this.loadingTemplate()} ${this.iconTemplate()}
            <slot name="custom-left-content" part="chip-left"> </slot>
            ${this.renderedText?this.textContentTemplate:l.nothing}
            <slot name="custom-right-content" part="chip-right"> </slot>
          </span>
        </md-tooltip>
      `}};c([(0,p.property)({type:String})],e.prototype,"color",void 0),c([(0,p.property)({type:String})],e.prototype,"bgColor",void 0),c([(0,p.property)({type:String})],e.prototype,"textColor",void 0),c([(0,p.property)({type:String})],e.prototype,"height",void 0),c([(0,p.property)({type:String})],e.prototype,"icon",void 0),c([(0,p.property)({type:String})],e.prototype,"iconColor",void 0),c([(0,p.property)({type:String})],e.prototype,"iconSize",void 0),c([(0,p.property)({type:String})],e.prototype,"role",void 0),c([(0,p.property)({type:String,reflect:!0})],e.prototype,"id",void 0),c([(0,p.property)({type:Boolean})],e.prototype,"small",void 0),c([(0,p.property)({type:Boolean})],e.prototype,"readonly",void 0),c([(0,p.property)({type:Boolean,reflect:!0})],e.prototype,"selected",void 0),c([(0,p.property)({type:Boolean})],e.prototype,"disabled",void 0),c([(0,p.property)({type:Number})],e.prototype,"determinateProgress",void 0),c([(0,p.property)({type:Boolean})],e.prototype,"indeterminateProgress",void 0),c([(0,p.property)({type:String})],e.prototype,"tooltipText",void 0),c([(0,p.property)({type:String})],e.prototype,"tooltipPlacement",void 0),c([(0,p.property)({type:String})],e.prototype,"iconSet",void 0),c([(0,p.property)({type:Boolean,attribute:"suppress-default-max-width"})],e.prototype,"suppressDefaultMaxWidth",void 0),c([(0,p.property)({type:Boolean})],e.prototype,"decorative",void 0),c([(0,p.property)({type:Boolean})],e.prototype,"shouldTruncateValue",void 0),c([(0,p.property)({type:String,hasChanged:(t,e)=>t!==e})],e.prototype,"value",void 0),c([(0,p.state)({hasChanged:(t,e)=>t!==e})],e.prototype,"textOverflow",void 0),c([(0,p.state)()],e.prototype,"renderedText",void 0),e=c([(0,s.w)("md-chip")],e),t.ELEMENT=e}(i||(i={}))}};