!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t(require("lit"),require("lit/decorators.js"),require("lit/directives/class-map.js"),require("lit/directives/style-map.js"),require("lit/directives/if-defined.js"),require("@momentum-ui/icons/data/momentumUiIconsNames.json"),require("@momentum-ui/utils/lib/getColorValue"),require("mobx"),require("papaparse"));else if("function"==typeof define&&define.amd)define(["lit","lit/decorators.js","lit/directives/class-map.js","lit/directives/style-map.js","lit/directives/if-defined.js","@momentum-ui/icons/data/momentumUiIconsNames.json","@momentum-ui/utils/lib/getColorValue","mobx","papaparse"],t);else{var r="object"==typeof exports?t(require("lit"),require("lit/decorators.js"),require("lit/directives/class-map.js"),require("lit/directives/style-map.js"),require("lit/directives/if-defined.js"),require("@momentum-ui/icons/data/momentumUiIconsNames.json"),require("@momentum-ui/utils/lib/getColorValue"),require("mobx"),require("papaparse")):t(e.lit,e["lit/decorators.js"],e["lit/directives/class-map.js"],e["lit/directives/style-map.js"],e["lit/directives/if-defined.js"],e["@momentum-ui/icons/data/momentumUiIconsNames.json"],e["@momentum-ui/utils/lib/getColorValue"],e.mobx,e.papaparse);for(var o in r)("object"==typeof exports?exports:e)[o]=r[o]}}(self,(e,t,r,o,s,i,a,l,n)=>(()=>{"use strict";var d,p={3273(e,t,r){r.r(t),r.d(t,{Table:()=>u,formatType:()=>m}),r(1821);var o=r(9609),s=r(4084),i=r(7161),a=r(429),l=r(5125),n=r(8187),d=r.n(n),p=r(1928),c=function(e,t,r,o){var s,i=arguments.length,a=i<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,r):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,o);else for(var l=e.length-1;l>=0;l--)(s=e[l])&&(a=(i<3?s(a):i>3?s(t,r,a):s(t,r))||a);return i>3&&a&&Object.defineProperty(t,r,a),a};const m=["number","default"];var u;!function(e){let t=class extends i.LitElement{constructor(){super(...arguments),this.tabledata="",this.zebra=!1,this.clean=!1,this.sorting=!1,this.nodata="No data Loaded",this.stickheader=!1,this.label="Table",this.noBorders=!1,this.format="default",this.warning=[],this.errors=[],this.sort={columnName:"",sortting:!1},this.csvData=void 0,this.config={quoteChar:'"',escapeChar:'""',header:!1,preview:0,comments:!1,step:void 0,complete:void 0}}connectedCallback(){super.connectedCallback(),this.results=d().parse(this.tabledata,this.config),this.headerRow=this.results.data[0],this.csvData=this.results.data.slice(1,this.results.data.length)}get rowItem(){return this.rowTable}linkCellItems(){const e=this.rowTable;null==e||e.forEach((e,t)=>{this.warning.forEach(r=>{t+1===r.row&&e.querySelectorAll('td[role="cell"').forEach((e,t)=>{t+1===r.col&&(e.classList.add("warning"),e.insertAdjacentHTML("beforeend",'<md-icon name="warning-regular" size="24" iconSet="momentumDesign" color="var(--md-alert-warning-text-color)"></md-icon>'))})}),this.errors.forEach(r=>{t+1===r.row&&e.querySelectorAll('td[role="cell"').forEach((e,t)=>{t+1===r.col&&(e.classList.add("error"),e.insertAdjacentHTML("beforeend",'<md-icon name="clear-bold" size="24" iconSet="momentumDesign" color="var(--md-alert-error-text-color)"></md-icon>'))})})})}sortTab(e,t){const r=e.target,o=Array.from(this.csvData),s=this.headerRow.indexOf(t);t!==this.sort.columnName||!0!==this.sort.sortting?(o.sort(function(e,t){const r=e[s].toLowerCase(),o=t[s].toLowerCase();return r>o?1:r<o?-1:0}),this.sort.sortting=!0,r.classList.remove("sortedZyx"),r.classList.add("sortedAbc")):(o.reverse(),this.sort.sortting=!1,r.classList.remove("sortedAbc"),r.classList.add("sortedZyx")),this.sort.columnName=t,this.csvData=o,this.requestUpdate("csvData")}willUpdate(e){super.willUpdate(e),e.has("tabledata")&&(this.results=d().parse(this.tabledata,this.config),this.headerRow=this.results.data[0],this.csvData=this.results.data.slice(1,this.results.data.length))}updated(e){super.updated(e),e.has("tabledata")&&this.linkCellItems()}static get styles(){return[s.A,p.A]}get tableClassMap(){return{"md-table--clean":this.clean,"md-table--no-borders":this.noBorders,"md-table--stripped":this.zebra,"md-table--sorting":this.sorting}}getSortTemplate(e){return this.sort.columnName!==e?i.nothing:i.html`
        <md-icon
          name=${this.sort.sortting?"sort-descending-bold":"sort-ascending-bold"}
          iconSet="momentumDesign"
          size="16"
        ></md-icon>
      `}render(){return i.html`
        <div class=${"md-table-container "+(this.stickheader?"md-table-container_stickly":"")}>
          ${0!=this.csvData.length?i.html`
                <table
                  class="md-table ${(0,l.classMap)(this.tableClassMap)}"
                  tabindex="0"
                  role="table"
                  aria-label="${this.label}"
                >
                  <thead class="md-table__header" role="rowgroup" tabindex="0">
                    <tr role="row">
                      ${this.headerRow.map(e=>i.html`
                          <th role="columnheader">
                            ${this.sorting?i.html`
                                  <a @click=${t=>this.sortTab(t,e)}>
                                    ${e}${this.getSortTemplate(e)}
                                  </a>
                                `:i.html` ${e}`}
                          </th>
                        `)}
                    </tr>
                  </thead>
                  <tbody class="md-table__body" role="rowgroup">
                    ${this.csvData.map((e,t)=>i.html`
                        <tr tabindex="0" role="row" part=${0===t?"first-row":"row"}>
                          ${e.map((e,t)=>{const r="number"===this.format&&0!==t?Number(e).toLocaleString():e;return i.html`
                              <td part=${0===t?"left-cell":"cell"} role="cell">
                                <span>${r}</span>
                              </td>
                            `})}
                        </tr>
                      `)}
                  </tbody>
                </table>
              `:i.html` <p>${this.nodata}</p> `}
        </div>
      `}};c([(0,a.property)({type:String})],t.prototype,"tabledata",void 0),c([(0,a.property)({type:Boolean})],t.prototype,"zebra",void 0),c([(0,a.property)({type:Boolean})],t.prototype,"clean",void 0),c([(0,a.property)({type:Boolean})],t.prototype,"sorting",void 0),c([(0,a.property)({type:String})],t.prototype,"nodata",void 0),c([(0,a.property)({type:Boolean})],t.prototype,"stickheader",void 0),c([(0,a.property)({type:String})],t.prototype,"label",void 0),c([(0,a.property)({type:Boolean,attribute:"no-borders"})],t.prototype,"noBorders",void 0),c([(0,a.property)({type:String})],t.prototype,"format",void 0),c([(0,a.property)({type:Array})],t.prototype,"warning",void 0),c([(0,a.property)({type:Array})],t.prototype,"errors",void 0),c([(0,a.state)()],t.prototype,"sort",void 0),c([(0,a.state)()],t.prototype,"csvData",void 0),c([(0,a.queryAll)('.md-table__body tr[role="row"]')],t.prototype,"rowTable",void 0),t=c([(0,o.w)("md-table")],t),e.ELEMENT=t}(u||(u={}))},2022(e){e.exports=i},554(e){e.exports=a},7161(t){t.exports=e},429(e){e.exports=t},5125(e){e.exports=r},291(e){e.exports=s},318(e){e.exports=o},5314(e){e.exports=l},8187(e){e.exports=n}},c={};function m(e){var t=c[e];if(void 0!==t)return t.exports;var r=c[e]={exports:{}};return p[e](r,r.exports,m),r.exports}m.m=p,d=[],m.O=(e,t,r,o)=>{if(!t){var s=1/0;for(n=0;n<d.length;n++){for(var[t,r,o]=d[n],i=!0,a=0;a<t.length;a++)(!1&o||s>=o)&&Object.keys(m.O).every(e=>m.O[e](t[a]))?t.splice(a--,1):(i=!1,o<s&&(s=o));if(i){d.splice(n--,1);var l=r();void 0!==l&&(e=l)}}return e}o=o||0;for(var n=d.length;n>0&&d[n-1][2]>o;n--)d[n]=d[n-1];d[n]=[t,r,o]},m.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return m.d(t,{a:t}),t},m.d=(e,t)=>{for(var r in t)m.o(t,r)&&!m.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},m.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),m.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},(()=>{var e={8510:0};m.O.j=t=>0===e[t];var t=(t,r)=>{var o,s,[i,a,l]=r,n=0;if(i.some(t=>0!==e[t])){for(o in a)m.o(a,o)&&(m.m[o]=a[o]);if(l)var d=l(m)}for(t&&t(r);n<i.length;n++)s=i[n],m.o(e,s)&&e[s]&&e[s][0](),e[s]=0;return m.O(d)},r=self["momentum-web-components-[id]"]=self["momentum-web-components-[id]"]||[];r.forEach(t.bind(null,0)),r.push=t.bind(null,r.push.bind(r))})();var u=m.O(void 0,[9609,4084,3305,4739,7154,9773,5983,9488,1821,519,1928],()=>m(3273));return m.O(u)})());