!function(t,e){if("object"==typeof exports&&"object"==typeof module)module.exports=e(require("lit"),require("lit/decorators.js"),require("lit/directives/class-map.js"),require("lit/directives/if-defined.js"));else if("function"==typeof define&&define.amd)define(["lit","lit/decorators.js","lit/directives/class-map.js","lit/directives/if-defined.js"],e);else{var i="object"==typeof exports?e(require("lit"),require("lit/decorators.js"),require("lit/directives/class-map.js"),require("lit/directives/if-defined.js")):e(t.lit,t["lit/decorators.js"],t["lit/directives/class-map.js"],t["lit/directives/if-defined.js"]);for(var o in i)("object"==typeof exports?exports:t)[o]=i[o]}}(self,(t,e,i,o)=>(()=>{"use strict";var r,s={2583(t,e,i){i.r(e),i.d(e,{Chip:()=>o}),i(2708),i(9613);var o,r=i(2900),s=i(9609),n=i(4084),l=i(7161),p=i(429),d=i(5125),h=i(291),a=i(9558),c=function(t,e,i,o){var r,s=arguments.length,n=s<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(t,e,i,o);else for(var l=t.length-1;l>=0;l--)(r=t[l])&&(n=(s<3?r(n):s>3?r(e,i,n):r(e,i))||n);return s>3&&n&&Object.defineProperty(e,i,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 i=null!=e?e:getComputedStyle(this).font,o=document.createElement("canvas").getContext("2d");return o?(o.font=i,o.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 i=Array.from(t);let o=Math.min(4,i.length),r=Math.min(5,Math.max(0,i.length-o-1)),s=i.slice(0,o).join(""),n=i.slice(-r).join(""),l=`${s}…${n}`;if(this.getTextWidth(l)>this.MAXWIDTH)return this.renderedText=l,void(this.textOverflow=!0);for(;o+r<i.length;){let t=!1;if(o+r<i.length){const e=s+i[o],r=`${e}…${n}`;this.getTextWidth(r)<=this.MAXWIDTH&&(s=e,o+=1,l=r,t=!0)}if(o+r<i.length){const e=i[i.length-r-1]+n,o=`${s}…${e}`;this.getTextWidth(o)<=this.MAXWIDTH&&(n=e,r+=1,l=o,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,h.ifDefined)(this.iconSet)}
              size="${(0,h.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,d.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,h.ifDefined)(this.decorative?void 0:"button")}
            tabindex="0"
            class="md-chip ${(0,d.classMap)(t)}"
            part="chip"
            aria-pressed=${(0,h.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}(o||(o={}))},7161(e){e.exports=t},429(t){t.exports=e},5125(t){t.exports=i},291(t){t.exports=o}},n={};function l(t){var e=n[t];if(void 0!==e)return e.exports;var i=n[t]={exports:{}};return s[t](i,i.exports,l),i.exports}l.m=s,r=[],l.O=(t,e,i,o)=>{if(!e){var s=1/0;for(h=0;h<r.length;h++){for(var[e,i,o]=r[h],n=!0,p=0;p<e.length;p++)(!1&o||s>=o)&&Object.keys(l.O).every(t=>l.O[t](e[p]))?e.splice(p--,1):(n=!1,o<s&&(s=o));if(n){r.splice(h--,1);var d=i();void 0!==d&&(t=d)}}return t}o=o||0;for(var h=r.length;h>0&&r[h-1][2]>o;h--)r[h]=r[h-1];r[h]=[e,i,o]},l.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return l.d(e,{a:e}),e},l.d=(t,e)=>{for(var i in e)l.o(e,i)&&!l.o(t,i)&&Object.defineProperty(t,i,{enumerable:!0,get:e[i]})},l.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),l.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},(()=>{var t={8894:0};l.O.j=e=>0===t[e];var e=(e,i)=>{var o,r,[s,n,p]=i,d=0;if(s.some(e=>0!==t[e])){for(o in n)l.o(n,o)&&(l.m[o]=n[o]);if(p)var h=p(l)}for(e&&e(i);d<s.length;d++)r=s[d],l.o(t,r)&&t[r]&&t[r][0](),t[r]=0;return l.O(h)},i=self["momentum-web-components-[id]"]=self["momentum-web-components-[id]"]||[];i.forEach(e.bind(null,0)),i.push=e.bind(null,i.push.bind(i))})();var p=l.O(void 0,[9609,4084,2364,9938,4781,5584,8227,2900,2050,6343,7582,9613,5323,6631,9558,2708],()=>l(2583));return l.O(p)})());