@tylertech/forge 2.23.0 → 2.24.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (73) hide show
  1. package/custom-elements.json +2578 -2584
  2. package/dist/esm/app-bar/help-button/index.js +1 -1
  3. package/dist/esm/app-bar/index.js +1 -1
  4. package/dist/esm/app-bar/notification-button/index.js +1 -1
  5. package/dist/esm/autocomplete/index.js +1 -1
  6. package/dist/esm/badge/index.js +1 -1
  7. package/dist/esm/chunks/{chunk.XA3EJJBV.js → chunk.36RT7UOR.js} +2 -2
  8. package/dist/esm/chunks/{chunk.DE65YGZ2.js → chunk.4QVF44G5.js} +2 -2
  9. package/dist/esm/chunks/{chunk.DD4LOZWG.js → chunk.7NUOX3JD.js} +2 -2
  10. package/dist/esm/chunks/chunk.BNIUTBJV.js +7 -0
  11. package/dist/esm/chunks/chunk.BNIUTBJV.js.map +7 -0
  12. package/dist/esm/chunks/{chunk.OSB2SHDM.js → chunk.E6FHH3CM.js} +2 -2
  13. package/dist/esm/chunks/{chunk.VQYGXL7B.js → chunk.EPFMWAIO.js} +2 -2
  14. package/dist/esm/chunks/{chunk.2MGNUJ3M.js → chunk.HSUOYMJT.js} +2 -2
  15. package/dist/esm/chunks/{chunk.AKVM7WU7.js → chunk.HVYDNI2O.js} +2 -2
  16. package/dist/esm/chunks/{chunk.AVEQLUJ2.js → chunk.K2O3KSP7.js} +2 -2
  17. package/dist/esm/chunks/{chunk.CTLT7PRY.js → chunk.KNNT4CGL.js} +2 -2
  18. package/dist/esm/chunks/{chunk.S3XNIY4R.js → chunk.LZOAYM6V.js} +2 -2
  19. package/dist/esm/chunks/chunk.MA2P7CG4.js +7 -0
  20. package/dist/esm/chunks/chunk.MA2P7CG4.js.map +7 -0
  21. package/dist/esm/chunks/{chunk.XFZQ7ZUR.js → chunk.MSOMQ4HD.js} +2 -2
  22. package/dist/esm/chunks/{chunk.FHCIRSN5.js → chunk.NHZTE4I4.js} +2 -2
  23. package/dist/esm/chunks/{chunk.FHCIRSN5.js.map → chunk.NHZTE4I4.js.map} +1 -1
  24. package/dist/esm/chunks/{chunk.VXCPWDOQ.js → chunk.OLNY6ZNB.js} +2 -2
  25. package/dist/esm/chunks/{chunk.VXCPWDOQ.js.map → chunk.OLNY6ZNB.js.map} +3 -3
  26. package/dist/esm/chunks/{chunk.SBVZNHJ4.js → chunk.PTEWJ5PZ.js} +2 -2
  27. package/dist/esm/chunks/{chunk.7DS2AYTH.js → chunk.QRWYYBZC.js} +2 -2
  28. package/dist/esm/chunks/{chunk.DGWMH6BD.js → chunk.SDZC7JIX.js} +2 -2
  29. package/dist/esm/chunks/{chunk.CGWB5K7D.js → chunk.ZN6U7WVM.js} +2 -2
  30. package/dist/esm/index.js +1 -1
  31. package/dist/esm/list/index.js +1 -1
  32. package/dist/esm/list/list/index.js +1 -1
  33. package/dist/esm/list/list-item/index.js +1 -1
  34. package/dist/esm/list-dropdown/index.js +1 -1
  35. package/dist/esm/menu/index.js +1 -1
  36. package/dist/esm/paginator/index.js +1 -1
  37. package/dist/esm/select/core/index.js +1 -1
  38. package/dist/esm/select/index.js +1 -1
  39. package/dist/esm/select/select/index.js +1 -1
  40. package/dist/esm/select/select-dropdown/index.js +1 -1
  41. package/dist/esm/split-view/index.js +1 -1
  42. package/dist/esm/split-view/split-view/index.js +1 -1
  43. package/dist/esm/split-view/split-view-panel/index.js +1 -1
  44. package/dist/esm/table/index.js +1 -1
  45. package/dist/esm/time-picker/index.js +1 -1
  46. package/esm/badge/badge.js +2 -2
  47. package/esm/list/list-item/list-item-foundation.d.ts +2 -2
  48. package/esm/list/list-item/list-item-foundation.js +3 -6
  49. package/esm/list/list-item/list-item.d.ts +2 -0
  50. package/esm/list/list-item/list-item.js +3 -0
  51. package/esm/split-view/split-view-panel/split-view-panel.js +1 -1
  52. package/esm/table/table-foundation.js +10 -1
  53. package/package.json +1 -1
  54. package/styles/badge/_mixins.scss +10 -3
  55. package/dist/esm/chunks/chunk.KJFXHFAX.js +0 -7
  56. package/dist/esm/chunks/chunk.KJFXHFAX.js.map +0 -7
  57. package/dist/esm/chunks/chunk.PLTEMN6W.js +0 -7
  58. package/dist/esm/chunks/chunk.PLTEMN6W.js.map +0 -7
  59. /package/dist/esm/chunks/{chunk.XA3EJJBV.js.map → chunk.36RT7UOR.js.map} +0 -0
  60. /package/dist/esm/chunks/{chunk.DE65YGZ2.js.map → chunk.4QVF44G5.js.map} +0 -0
  61. /package/dist/esm/chunks/{chunk.DD4LOZWG.js.map → chunk.7NUOX3JD.js.map} +0 -0
  62. /package/dist/esm/chunks/{chunk.OSB2SHDM.js.map → chunk.E6FHH3CM.js.map} +0 -0
  63. /package/dist/esm/chunks/{chunk.VQYGXL7B.js.map → chunk.EPFMWAIO.js.map} +0 -0
  64. /package/dist/esm/chunks/{chunk.2MGNUJ3M.js.map → chunk.HSUOYMJT.js.map} +0 -0
  65. /package/dist/esm/chunks/{chunk.AKVM7WU7.js.map → chunk.HVYDNI2O.js.map} +0 -0
  66. /package/dist/esm/chunks/{chunk.AVEQLUJ2.js.map → chunk.K2O3KSP7.js.map} +0 -0
  67. /package/dist/esm/chunks/{chunk.CTLT7PRY.js.map → chunk.KNNT4CGL.js.map} +0 -0
  68. /package/dist/esm/chunks/{chunk.S3XNIY4R.js.map → chunk.LZOAYM6V.js.map} +0 -0
  69. /package/dist/esm/chunks/{chunk.XFZQ7ZUR.js.map → chunk.MSOMQ4HD.js.map} +0 -0
  70. /package/dist/esm/chunks/{chunk.SBVZNHJ4.js.map → chunk.PTEWJ5PZ.js.map} +0 -0
  71. /package/dist/esm/chunks/{chunk.7DS2AYTH.js.map → chunk.QRWYYBZC.js.map} +0 -0
  72. /package/dist/esm/chunks/{chunk.DGWMH6BD.js.map → chunk.SDZC7JIX.js.map} +0 -0
  73. /package/dist/esm/chunks/{chunk.CGWB5K7D.js.map → chunk.ZN6U7WVM.js.map} +0 -0
@@ -3,5 +3,5 @@
3
3
  * Copyright 2023 Tyler Technologies, Inc.
4
4
  * License: Apache-2.0
5
5
  */
6
- import{a as q,b as x,c as v,d as X}from"./chunk.DONAMICM.js";import{c as ce}from"./chunk.ZVHFSAID.js";import{c as re}from"./chunk.M4PI24CI.js";import{a as M,d as ne}from"./chunk.SXQ22MNR.js";import{a as R}from"./chunk.4DAIIJ37.js";import{b as te}from"./chunk.MZLPUI6R.js";import{a as ae}from"./chunk.SYHVVXRW.js";import{a as ie,d as oe,l as se}from"./chunk.WHQZNZHW.js";import{a as Y}from"./chunk.2KXSGD3S.js";import{a as le}from"./chunk.BESB4RGK.js";import{a as U}from"./chunk.UWYANU5D.js";import{a as b}from"./chunk.KTGSZEAG.js";import{a as J,b as ee}from"./chunk.DL7NX432.js";import{a as j,l as Q}from"./chunk.LJLEPTLU.js";import{d as g,e as F,f as p,g as D,i as W,j as K,t as $}from"./chunk.4LA6HEA7.js";import{b as L,c as G,d as y,h as H,j as w,k as h,l as V,o as Z}from"./chunk.J2M2MXP2.js";import{a as C,f as _}from"./chunk.MCIQXNKY.js";var I=class{constructor(e){this._key=e,this._items=[]}getItems(){return[...this._items]}count(){return this._items.length}setKey(e){this._key=e}add(e){return e instanceof Array||(e=[e]),e.forEach(t=>{this.exists(t)||this._items.push(t)}),this}remove(e){e instanceof Array||(e=[e]);for(let t=e.length-1;t>=0;t--)this.exists(e[t])&&this._items.splice(this._items.indexOf(this._getItem(e[t])),1);return this}clear(){return this._items=[],this}exists(e){return this._getItem(e)!==null}_getItem(e){return this._key?x(this._items,v(this._key,e))||null:this._items.find(t=>t===e)||null}};var S=`${ee}table`,de={TABLE:"forge-table",TABLE_DENSE:"forge-table--dense",TABLE_ROOMY:"forge-table--roomy",TABLE_RESIZABLE:"forge-table--resizable",TABLE_RESIZING:"forge-table--resizing",TABLE_RESIZE_HANDLE:"forge-table__resize-handle",TABLE_NO_WRAP_CONTENT:"forge-table--no-wrap-content",TABLE_LAYOUT_FIXED:"forge-table--layout-fixed",TABLE_FILTER_VISIBLE:"forge-table--filter-visible",TABLE_FIXED:"forge-table--fixed",TABLE_HEAD:"forge-table-head",TABLE_HEAD_ROW:"forge-table-head__row",TABLE_HEAD_ROW_FILTER:"forge-table-head__row__filter",TABLE_HEAD_CELL:"forge-table-head__cell",TABLE_HEAD_CELL_CONTAINER:"forge-table-head__cell-container",TABLE_HEAD_CELL_SORTABLE:"forge-table-head__cell--sortable",TABLE_HEAD_CELL_SORT_ICON:"forge-table-head__cell-sort-icon",TABLE_HEAD_CELL_TEXT:"forge-table-head__cell-text",TABLE_HEAD_CELL_SORT_ICON_ACTIVE:"forge-table-head__cell-sort-icon--active",TABLE_HEAD_CELL_SORTED_ASCENDING:"forge-table-head__cell--sorted-ascending",TABLE_HEAD_CELL_SORTED_DESCENDING:"forge-table-head__cell--sorted-descending",TABLE_HEAD_CELL_SORT_ORDER:"forge-table-head__cell__sort-order",TABLE_HEAD_CELL_SORT_ORDER_HIDDEN:"forge-table-head__cell__sort-order--hidden",TABLE_BODY:"forge-table-body",TABLE_BODY_ROW:"forge-table-body__row",TABLE_BODY_ROW_SELECTED:"forge-table-body__row--selected",TABLE_BODY_ROW_CLICKABLE:"forge-table-body__row--clickable",TABLE_BODY_CELL:"forge-table-body__cell",TABLE_ROW:"forge-table-row",TABLE_ROW_EXPANDED:"forge-table-row--expanded",TABLE_ROW_EXPANDABLE_CONTENT:"forge-table-row__expandable-content",TABLE_ROW_EXPANDABLE_CONTENT_CELL:"forge-table-row__expandable-content-cell",TABLE_CELL:"forge-table-cell",TABLE_CELL_SELECT:"forge-table-cell__select",TABLE_CELL_SELECT_CHECKBOX:"forge-table-cell__select-checkbox",TABLE_CELL_SELECT_CHECKBOX_CONTAINER:"forge-table-cell__select-checkbox-container",TABLE_CELL_SELECT_CHECKBOX_CONTAINER_ALIGN_RIGHT:"forge-table-cell__select-checkbox-container--align-right",TABLE_CELL_SELECT_CHECKBOX_CONTAINER_ALIGN_LEFT:"forge-table-cell__select-checkbox-container--align-left",TABLE_CELL_SELECT_CHECKBOX_CONTAINER_ALIGN_CENTER:"forge-table-cell__select-checkbox-container--align-center",TABLE_CELL_CONTAINER:"forge-table-cell__container",TABLE_CELL_CONTAINER_TEXT:"forge-table-cell__container-text",TABLE_CELL_CENTER:"forge-table-cell--center",TABLE_CELL_RIGHT:"forge-table-cell--right",TABLE_CELL_RESIZABLE:"forge-table-cell--resizing"},_e={TABLE:".forge-table",CHECKBOX_INPUT:"forge-checkbox > input[type=checkbox]:not([forge-ignore])",SELECT_ALL_TEMPLATE_CHECKBOX_INPUT:"input[type=checkbox]:not([forge-ignore])",ROW_SELECTED:`.${de.TABLE_BODY_ROW_SELECTED}`},be={SELECT:"select",MULTISELECT:"multiselect",SELECT_KEY:"select-key",DENSE:"dense",ROOMY:"roomy",FILTER:"filter",FIXED_HEADERS:"fixed-headers",LAYOUT_TYPE:"layout-type",WRAP_CONTENT:"wrap-content",RESIZABLE:"resizable",MIN_RESIZE_WIDTH:"min-resize-width",ALLOW_ROW_CLICK:"allow-row-click",MULTI_COLUMN_SORT:"multi-column-sort",SELECT_CHECKBOX_ALIGNMENT:"select-checkbox-alignment",TOOLTIP_SELECT:"tooltip-select",TOOLTIP_SELECT_ALL:"tooltip-select-all",CHECKBOX_TYPE:"forge-checkbox-type",CUSTOM_CELL_TEMPLATE:"data-cell-template",CUSTOM_CELL_TEMPLATE_STOP_PROPAGATION:"data-cell-template-stop-propagation"},pe={ROW_CLICK:`${S}-row-click`,SELECT:`${S}-select`,SELECT_DOUBLE:`${S}-select-double`,SELECT_ALL:`${S}-select-all`,SORT:`${S}-sort`,FILTER:`${S}-filter`,INITIALIZED:`${S}-initialized`,COLUMN_RESIZE:`${S}-column-resize`},Te={SELECT_ALL:"select-all",SELECT_ROW:"select-row",DEFAULT_LAYOUT_TYPE:"auto"},Ce={SORT_DOWN:"arrow_downward"},he={DEFAULT_FILTER_DEBOUNCE_TIME:750,MIN_RESIZE_WIDTH:100,RESIZE_HOVER_DURATION:150},o={elementName:S,classes:de,selectors:_e,attributes:be,events:pe,strings:Te,icons:Ce,numbers:he};var B=(l=>(l.Left="left",l.Right="right",l.Center="center",l))(B||{}),O=(l=>(l.Ascending="ASC",l.Descending="DESC",l.Unset="UNSET",l))(O||{}),Le=(s=>(s.InputText="text",s.InputNumber="number",s.Select="select",s.SelectMultiple="select-multiple",s.Date="date",s.DateRange="date-range",s))(Le||{});function me(f){return f&&typeof f=="object"&&"content"in f}var a=class{static createTable(e){a._resetTable(e.tableElement);let t=a._createTableHead(e),l=a._createTableBody(e);e.clickListener&&(a._attachRowClickListeners(l,e.clickListener,e.doubleClickListener),a._addRowClickAttributes(l)),e.fixedHeaders&&a.setFixedHeaders(e),e.resizable&&a.setResizable(e),e.dense&&a.setDenseState(e.tableElement,e.dense),e.wrapContent&&a.setWrapContentState(e.tableElement,e.wrapContent),e.selectListener&&a._addSelectColumn(t,l,e.selectListener,e.selectAllListener,e.selectAllTemplate,e.selectCheckboxAlignment,e.data,e.tooltipSelect,e.tooltipSelectAll),(e.resizable||e.columnConfigurations.some(i=>!!i.sortable))&&(a._attachHeadRowMouseDownListener(t,e.headRowMouseDownListener),a._isMac()&&a._attachHeadRowContextMenuListener(t,e.headRowContextMenuListener)),a.setLayoutType(e),a._setTableHead(e.tableElement,t),e.filter&&a.setFilterRow(e),a._setTableBody(e.tableElement,l)}static _setTableHead(e,t){e.tHead?F(t,e.tHead):e.appendChild(t)}static _setTableBody(e,t){e.tBodies.length?F(t,e.tBodies[0]):e.appendChild(t)}static recreateTableBody(e){let t=a._createTableBody(e);e.clickListener&&(a._attachRowClickListeners(t,e.clickListener,e.doubleClickListener),a._addRowClickAttributes(t)),e.selectListener&&(a._createBodySelectColumn(t,e.selectCheckboxAlignment,e.data,e.tooltipSelect,e.tooltipSelectAll),a._attachRowSelectListeners(t,e.selectListener)),a._setTableBody(e.tableElement,t)}static _resetTable(e){g(e)}static _createMultisortTooltip(){let e=document.createElement(ae.elementName);return e.textContent="Ctrl + click to sort multiple columns",e.position="bottom",e.delay=0,e}static _createTableHead(e){let t=document.createElement("thead"),l=t.insertRow();p([o.classes.TABLE_ROW,o.classes.TABLE_HEAD_ROW],l);let i=!1;for(let n=0;n<e.columnConfigurations.length;n++){let s=e.columnConfigurations[n],r=document.createElement("th");r.scope="col",p([o.classes.TABLE_CELL,o.classes.TABLE_HEAD_CELL],r);let c;if(s.sortable?(c=document.createElement("button"),c.type="button",c.addEventListener("keydown",e.sortableHeadCellKeydownListener)):c=document.createElement("div"),c.classList.add(o.classes.TABLE_HEAD_CELL_CONTAINER),e.multiColumnSort){let d=a._createMultisortTooltip();c.appendChild(d)}if(s.align&&a._setCellAlignmentClass(c,s.align),L(s.width)){let d=K(s.width);d&&(r.style.width=d)}if(e.resizable&&s.resizable!==!1){let d=document.createElement("div");d.classList.add(o.classes.TABLE_RESIZE_HANDLE),r.appendChild(d)}L(s.headerCellStyle)&&w(s.headerCellStyle)&&(Object.assign(r.style,s.headerCellStyle),Object.assign(c.style,s.headerCellStyle));let m=document.createElement("span");if(m.classList.add(o.classes.TABLE_HEAD_CELL_TEXT),m.textContent=s.header&&typeof s.header=="string"?s.header.trim():"",s.sortable){r.classList.add(o.classes.TABLE_HEAD_CELL_SORTABLE);let d=document.createElement("span");p([o.classes.TABLE_HEAD_CELL_SORT_ORDER_HIDDEN,o.classes.TABLE_HEAD_CELL_SORT_ORDER],d);let u=document.createElement(ie.elementName);u.name=o.icons.SORT_DOWN,p([o.classes.TABLE_HEAD_CELL_SORT_ICON],u),e.multiColumnSort?typeof s.initialSort=="object"&&s.initialSort.sortOrder&&(d.textContent=s.initialSort.sortOrder.toString(),e.columnConfigurations.filter(T=>typeof T.initialSort=="object").length>1&&D(o.classes.TABLE_HEAD_CELL_SORT_ORDER_HIDDEN,d),r.classList.add(o.classes.TABLE_HEAD_CELL_SORTED_DESCENDING),u.classList.add(o.classes.TABLE_HEAD_CELL_SORT_ICON_ACTIVE),a._setColumnSortDirection(r,s.initialSort.direction)):e.sortedColumn===n&&!i&&!e.multiColumnSort&&(r.classList.add(o.classes.TABLE_HEAD_CELL_SORTED_DESCENDING),u.classList.add(o.classes.TABLE_HEAD_CELL_SORT_ICON_ACTIVE),a._setColumnSortDirection(r,e.sortDirection),i=!0),c.appendChild(u),c.appendChild(d)}typeof s.headerTemplate=="function"?Promise.resolve(s.headerTemplate(n,c,s)).then(d=>{if(d){let u=document.createElement("div");p(o.classes.TABLE_CELL_CONTAINER,u),typeof d=="string"?u.innerHTML=d:a._prepend(d,u),u.setAttribute(o.attributes.CUSTOM_CELL_TEMPLATE,""),a._prepend(u,c)}}):a._prepend(m,c),r.appendChild(c),l.appendChild(r)}return t}static setSortDirection(e,t,l){let i=a._getHeaderCellByIndex(e,t);e.querySelectorAll("th[aria-sort]").forEach(n=>n.removeAttribute("aria-sort")),a._setColumnSortDirection(i,l)}static _setColumnSortDirection(e,t){e.classList.contains(o.classes.TABLE_HEAD_CELL_SORTED_ASCENDING)&&e.classList.remove(o.classes.TABLE_HEAD_CELL_SORTED_ASCENDING),e.classList.contains(o.classes.TABLE_HEAD_CELL_SORTED_DESCENDING)&&e.classList.remove(o.classes.TABLE_HEAD_CELL_SORTED_DESCENDING),!t||t==="DESC"?(e.setAttribute("aria-sort","descending"),e.classList.add(o.classes.TABLE_HEAD_CELL_SORTED_DESCENDING)):(e.setAttribute("aria-sort","ascending"),e.classList.add(o.classes.TABLE_HEAD_CELL_SORTED_ASCENDING))}static _createTableBody(e){let t=document.createElement("tbody");return a._getOrderedRowData(e.columnConfigurations,e.data).forEach((i,n)=>{let s=t.insertRow();p([o.classes.TABLE_ROW,o.classes.TABLE_BODY_ROW],s),a._populateRowCells(e,s,i,n),typeof e.rowCreatedCallback=="function"&&e.rowCreatedCallback(s,n,C({},e.data[n].data))}),t}static _populateRowCells(e,t,l,i){for(let n=0;n<l.length;n++){let s=e.columnConfigurations[n],r=t.insertCell();if(p([o.classes.TABLE_CELL,o.classes.TABLE_BODY_CELL],r),L(s.width)){let m=K(s.width);m&&(r.style.width=m)}let c=document.createElement("div");if(c.classList.add(o.classes.TABLE_CELL_CONTAINER),L(s.cellStyle)&&w(s.cellStyle)&&(Object.assign(r.style,s.cellStyle),Object.assign(c.style,s.cellStyle)),s.template&&typeof s.template=="function"){let m=e.data[i]?e.data[i].data:void 0;Promise.resolve(s.template(i,c,m,n)).then(d=>{let u=me(d)?d:{content:d,stopClickPropagation:s.stopCellTemplateClickPropagation};!u.content||(typeof u.content=="string"?c.innerHTML=u.content:c.appendChild(u.content),c.setAttribute(o.attributes.CUSTOM_CELL_TEMPLATE,""),u.stopClickPropagation&&c.setAttribute(o.attributes.CUSTOM_CELL_TEMPLATE_STOP_PROPAGATION,""))})}else if(s.property){let m=document.createElement("span");m.classList.add(o.classes.TABLE_CELL_CONTAINER_TEXT),c.appendChild(m),s.transform&&typeof s.transform=="function"?Promise.resolve(s.transform(l[n])).then(d=>m.textContent=d):l[n]==null?m.textContent="":m.textContent=l[n].toString()}if(s.align&&a._setCellAlignmentClass(c,s.align),r.appendChild(c),L(s.columnSpan)){if(s.columnSpan==="all"){r.colSpan=l.length-n;break}else if(typeof s.columnSpan=="number"&&s.columnSpan>0){let m=s.columnSpan;s.columnSpan>l.length-n&&(m=l.length),r.colSpan=m,n=n+(m-1)}}typeof e.cellCreatedCallback=="function"&&e.cellCreatedCallback(r,i,n)}}static _setCellAlignmentClass(e,t){switch(t){case"center":e.classList.add(o.classes.TABLE_CELL_CENTER);break;case"right":e.classList.add(o.classes.TABLE_CELL_RIGHT);break}}static _getNonExpandedRows(e){return Array.from(e).filter(t=>!t.classList.contains(o.classes.TABLE_ROW_EXPANDABLE_CONTENT))}static _getExpandedRows(e){return Array.from(e).filter(t=>t.classList.contains(o.classes.TABLE_ROW_EXPANDABLE_CONTENT))}static _createColumnDataMap(e,t){return e.map(l=>({config:l,data:t.map(i=>{if(l.property){let n=q(i.data,l.property);return L(n)?n:null}return null})}))}static _getOrderedRowData(e,t){let l=a._createColumnDataMap(e,t),i=[];for(let n of l)for(let s=0;s<n.data.length;s++)i[s]||(i[s]=[]),i[s].push(n.data[s]);return i}static _attachRowClickListeners(e,t,l){a._getNonExpandedRows(e.rows).forEach(n=>{n.addEventListener("click",t),l&&n.addEventListener("dblclick",l)})}static _addRowClickAttributes(e){a._getNonExpandedRows(e.rows).forEach(l=>{l.classList.add(o.classes.TABLE_BODY_ROW_CLICKABLE)})}static _removeRowClickAttributes(e){a._getNonExpandedRows(e.rows).forEach(l=>{l.classList.remove(o.classes.TABLE_BODY_ROW_CLICKABLE)})}static _attachRowSelectListeners(e,t){a._getNonExpandedRows(e.rows).forEach(i=>a._attachRowSelectListener(i,t))}static _attachRowSelectListener(e,t){let l=a._getCheckboxElement(e);l==null||l.addEventListener("click",t)}static _detachRowSelectListeners(e,t){Array.from(e.rows).forEach(l=>{let i=a._getCheckboxElement(l);i==null||i.removeEventListener("click",t)})}static _detachRowClickListeners(e,t,l){Array.from(e.rows).forEach(i=>{i.removeEventListener("click",t),i.removeEventListener("dblclick",l)})}static _attachSelectAllListener(e,t){let l=e.rows[e.rows.length-1],i=a._getCheckboxElement(l);if(!i)throw new Error("Checkbox element not found.");i.addEventListener("change",t)}static _tryAttachSelectAllTemplateListener(e,t){let l=e.rows[e.rows.length-1],i=a._tryGetSelectAllCheckboxElement(l);i&&i.addEventListener("change",t)}static _detachSelectAllListener(e,t){let l=e.rows[e.rows.length-1],i=a._tryGetSelectAllCheckboxElement(l);!i||i.removeEventListener("change",t)}static _attachHeadRowMouseDownListener(e,t){let l=e.rows[0];if(!l)throw new Error("Missing table header row. Unable to attach sort listener.");l.addEventListener("mousedown",t)}static _attachHeadRowContextMenuListener(e,t){let l=e.rows[0];if(!l)throw new Error("Missing table header row. Unable to attach sort listener.");l.addEventListener("contextmenu",t)}static _createSelectColumn(e,t,l,i,n,s,r,c,m){e&&a._createHeadSelectColumn(e,l,i,n,s,m),t&&a._createBodySelectColumn(t,s,r,c,m)}static _createHeadSelectColumn(e,t,l,i,n,s){var r;if(Array.from(e.rows).forEach(c=>{let m=document.createElement("th");p([o.classes.TABLE_CELL,o.classes.TABLE_HEAD_CELL],m),c.insertBefore(m,c.cells.item(0))}),t){let c=(r=e.rows.item(e.rows.length-1))==null?void 0:r.cells.item(0);c.classList.add(o.classes.TABLE_CELL_SELECT),typeof l=="function"?a._renderSelectAllTemplate(l,e).then(()=>{typeof i=="function"&&i()}):c==null||c.appendChild(a._createCheckboxElement(!0,n,null,null,null,s))}}static _createBodySelectColumn(e,t,l,i,n){if(a._getNonExpandedRows(e.rows).forEach((r,c)=>a._addRowSelectColumn(r,t,c,l[c],i,n)),e.rows.length){let r=e.rows.item(0);r&&a._updateExpandedRowColspan(e.rows,r.cells.length)}}static _addRowSelectColumn(e,t,l,i,n,s){let r=e.insertCell(0);p([o.classes.TABLE_CELL,o.classes.TABLE_BODY_CELL,o.classes.TABLE_CELL_SELECT],r),r.appendChild(a._createCheckboxElement(!1,t,l,i,n,s))}static _destroySelectColumn(e,t){let l=a._getNonExpandedRows(t.rows);if(Array.from(e.rows).forEach(i=>i.removeChild(i.cells.item(0))),Array.from(l).forEach(i=>i.removeChild(i.cells.item(0))),t.rows.length){let i=t.rows.item(0);i&&a._updateExpandedRowColspan(t.rows,i.cells.length)}}static _hasSelectColumn(e,t){return[...Array.from(e.rows),...Array.from(t.rows)].some(i=>i.cells.item(0).classList.contains(o.classes.TABLE_CELL_SELECT))}static _createCheckboxElement(e,t,l,i,n,s){let r=document.createElement("div");if(r.classList.add(o.classes.TABLE_CELL_SELECT_CHECKBOX_CONTAINER),t)switch(t){case"center":r.classList.add(o.classes.TABLE_CELL_SELECT_CHECKBOX_CONTAINER_ALIGN_CENTER);break;case"left":r.classList.add(o.classes.TABLE_CELL_SELECT_CHECKBOX_CONTAINER_ALIGN_LEFT);break;case"right":r.classList.add(o.classes.TABLE_CELL_SELECT_CHECKBOX_CONTAINER_ALIGN_RIGHT);break}let c=document.createElement(re.elementName),m=document.createElement("input");m.type="checkbox";let d=n||"";i&&typeof n=="function"&&(d=n.call(null,l,i.data));let u=document.createElement("forge-tooltip");return u.position="left",e?u.textContent=s||"":u.textContent=d,m.setAttribute("aria-label","Select row"),c.appendChild(m),r.appendChild(u),r.appendChild(c),r}static _getCheckboxElement(e){let t=e.querySelector(`.${o.classes.TABLE_CELL_SELECT}`);return t?t.querySelector(o.selectors.CHECKBOX_INPUT):null}static _tryGetSelectAllCheckboxElement(e){let t=e.querySelector(`.${o.classes.TABLE_CELL_SELECT}`);return t?t.querySelector(o.selectors.CHECKBOX_INPUT)||t.querySelector(o.selectors.SELECT_ALL_TEMPLATE_CHECKBOX_INPUT):null}static _setSelectedCheckboxState(e,t){e&&(e.checked=t)}static _setIndeterminateCheckboxState(e,t){e&&(e.indeterminate=t)}static _setRowSelectedState(e,t){t?e.classList.contains(o.classes.TABLE_BODY_ROW_SELECTED)||e.classList.add(o.classes.TABLE_BODY_ROW_SELECTED):e.classList.remove(o.classes.TABLE_BODY_ROW_SELECTED)}static _updateExpandedRowColspan(e,t){a._getExpandedRows(e).forEach(i=>{let n=i.cells.item(0);n&&(n.colSpan=t)})}static updateSelectedState(e,t){a._setRowSelectedState(e,t);let l=a._getCheckboxElement(e);l&&a._setSelectedCheckboxState(l,t)}static getRowByIndex(e,t){return a._getNonExpandedRows(e.tBodies[0].rows)[t]}static updateSelectAllState(e,t,l){if(!e.tHead)return;let i=e.tHead.rows[e.tHead.rows.length-1],n=a._tryGetSelectAllCheckboxElement(i);n&&(a._setSelectedCheckboxState(n,t),a._setIndeterminateCheckboxState(n,!!l))}static setSelectedRows(e,t,l,i,n=!1){if(!e.tBodies.length)return;n||a.clearSelectedRows(e);let s=e.tBodies[0].rows,r=0;i.length&&Array.from(s).forEach((c,m)=>{let d=l[m];if(x(i,v(t,d))){a._setRowSelectedState(c,!0);let T=a._getCheckboxElement(c);T&&a._setSelectedCheckboxState(T,!0),r++}}),a.updateSelectAllState(e,r>0&&s.length===r)}static clearSelectedRows(e){if(!e.tBodies.length)return;a._getNonExpandedRows(e.tBodies[0].rows).forEach(l=>{a._setRowSelectedState(l,!1);let i=a._getCheckboxElement(l);i&&a._setSelectedCheckboxState(i,!1)})}static setSortedColumn(e,t,l){let i=a._getHeaderCellByIndex(e,t);a._getSortIconElementFromHeaderCell(i).classList.add(o.classes.TABLE_HEAD_CELL_SORT_ICON_ACTIVE),a._setColumnSortDirection(i,l)}static setMultiSortColumnSortNumber(e,t,l,i){let r=a._getHeaderCellByIndex(e,l).querySelector(`.${o.classes.TABLE_HEAD_CELL_CONTAINER}`).querySelector(`.${o.classes.TABLE_HEAD_CELL_SORT_ORDER}`);r&&($(r,typeof i!="number"||!t,o.classes.TABLE_HEAD_CELL_SORT_ORDER_HIDDEN),i&&(r.textContent=i.toString()))}static removeColumnSort(e,t){let l=a._getHeaderCellByIndex(e,t);l.removeAttribute("aria-sort"),l.classList.contains(o.classes.TABLE_HEAD_CELL_SORTED_ASCENDING)&&l.classList.remove(o.classes.TABLE_HEAD_CELL_SORTED_ASCENDING),l.classList.contains(o.classes.TABLE_HEAD_CELL_SORTED_DESCENDING)&&l.classList.remove(o.classes.TABLE_HEAD_CELL_SORTED_DESCENDING);let i=a._getSortIconElementFromHeaderCell(l);i&&i.classList.contains(o.classes.TABLE_HEAD_CELL_SORT_ICON_ACTIVE)&&i.classList.remove(o.classes.TABLE_HEAD_CELL_SORT_ICON_ACTIVE)}static _getHeaderCellByIndex(e,t){if(!e.tHead)throw new Error("Table head element cannot be null.");return e.tHead.rows.item(0).cells.item(t)}static _getSortIconElementFromHeaderCell(e){return e.querySelector(`.${o.classes.TABLE_HEAD_CELL_SORT_ICON}`)}static setSelectColumnVisibility(e,t,l,i,n,s,r,c,m){let d=e.tHead,u=e.tBodies[0];!d||!u||(t?a._addSelectColumn(d,u,l,i,n,s,r,c,m):a._hasSelectColumn(d,u)&&(l&&a._detachRowSelectListeners(u,l),i&&a._detachSelectAllListener(d,i),a._destroySelectColumn(d,u)))}static _addSelectColumn(e,t,l,i,n,s,r,c,m){a._createSelectColumn(e,t,!!i,n,()=>{i&&a._tryAttachSelectAllTemplateListener(e,i)},s,r,c,m),l&&a._attachRowSelectListeners(t,l),i&&!n&&a._tryAttachSelectAllTemplateListener(e,i)}static setDenseState(e,t){e.classList.contains(o.classes.TABLE_DENSE)&&e.classList.remove(o.classes.TABLE_DENSE),t&&e.classList.add(o.classes.TABLE_DENSE)}static setRoomyState(e,t){e.classList.contains(o.classes.TABLE_ROOMY)&&e.classList.remove(o.classes.TABLE_ROOMY),t&&e.classList.add(o.classes.TABLE_ROOMY)}static setResizable(e){let t=e.tableElement.tHead;e.resizable?(e.tableElement.classList.add(o.classes.TABLE_RESIZABLE),a._addResizeHandles(t,e)):(e.tableElement.classList.remove(o.classes.TABLE_RESIZABLE),a._removeResizeHandles(t,e))}static _addResizeHandles(e,t){if(!e)return;let l=e.rows.item(0);if(l){let i=Array.from(l.cells);t.selectListener&&(i=i.slice(1));for(let n of i){let s=i.indexOf(n);if(t.columnConfigurations[s].resizable!==!1){let c=document.createElement("div");c.classList.add(o.classes.TABLE_RESIZE_HANDLE),n.appendChild(c)}}}}static _removeResizeHandles(e,t){if(!e)return;let l=e.rows.item(0);if(l){let i=Array.from(l.cells);t.selectListener&&(i=i.slice(1));for(let n of i){let s=document.querySelector(`.${o.classes.TABLE_RESIZE_HANDLE}`);s&&n.removeChild(s)}}}static setWrapContentState(e,t){t?e.classList.remove(o.classes.TABLE_NO_WRAP_CONTENT):e.classList.add(o.classes.TABLE_NO_WRAP_CONTENT)}static setSelectAllVisibility(e,t,l,i,n,s){let r=e.tHead;if(!r)return;!t&&l&&a._detachSelectAllListener(r,l);let m=r.rows[r.rows.length-1].cells.item(0);t?m.childElementCount||(m.classList.add(o.classes.TABLE_CELL_SELECT),i?a._renderSelectAllTemplate(i,r).then(()=>{l&&a._tryAttachSelectAllTemplateListener(r,l)}):m.appendChild(a._createCheckboxElement(!0,n||null,null,null,null,s)),l&&!i&&a._attachSelectAllListener(r,l)):(l&&a._detachSelectAllListener(r,l),g(m))}static setFilterRow(e){if(!e.tableElement.tHead)return;let t=a._getFilterRowElement(e.tableElement.tHead),l;if(e.filter?e.tableElement.classList.add(o.classes.TABLE_FILTER_VISIBLE):e.tableElement.classList.remove(o.classes.TABLE_FILTER_VISIBLE),e.filter&&!t){if(e.columnConfigurations.every(n=>!n.filter))return;e.selectListener&&e.selectAllListener&&(l=e.tableElement.tHead.rows[e.tableElement.tHead.rows.length-1].cells.item(0));let i=a._createFilterRowElement(e);i&&l&&Array.from(l.children).forEach(n=>{var s;(s=i.cells.item(0))==null||s.appendChild(n)})}else if(!e.filter&&t){if(e.selectListener&&e.selectAllListener){l=t.cells.item(0);let i=Array.from(e.tableElement.tHead.rows).indexOf(t)-1,n=e.tableElement.tHead.rows.item(i);n&&Array.from(l.children).forEach(s=>{var r;(r=n.cells.item(0))==null||r.appendChild(s)})}W(t)}}static _createFilterRowElement(e){if(!e.tableElement.tHead)throw new Error("Table head element cannot be null.");let t=e.tableElement.tHead.insertRow();if(p([o.classes.TABLE_ROW,o.classes.TABLE_HEAD_ROW_FILTER],t),e.selectListener){let l=document.createElement("th");p([o.classes.TABLE_CELL,o.classes.TABLE_HEAD_CELL],l),t.insertBefore(l,t.cells[0]),l.classList.add(o.classes.TABLE_CELL_SELECT)}return e.columnConfigurations.forEach((l,i)=>{let n=document.createElement("th");if(p([o.classes.TABLE_CELL,o.classes.TABLE_HEAD_CELL],n),l.filter&&L(l.filterDelegate)){let s=document.createElement("div");s.classList.add(o.classes.TABLE_HEAD_CELL_CONTAINER),l.align&&a._setCellAlignmentClass(s,l.align);let r=a._createFilterElement(l,i,e.filterListener);s.appendChild(r),n.appendChild(s)}t.appendChild(n)}),t}static _createFilterElement(e,t,l){let i;if(H(e.filterDelegate))i=e.filterDelegate();else if(e.filterDelegate instanceof Y||e.filterDelegate instanceof le)i=e.filterDelegate;else throw new Error("Invalid filter delegate.");if(!!l&&i instanceof Y&&H(i.onChange))if(!L(e.filterDebounceTime)||y(e.filterDebounceTime)){let n=L(e.filterDebounceTime)?e.filterDebounceTime:o.numbers.DEFAULT_FILTER_DEBOUNCE_TIME;i.onChange(Z(s=>l(s,t),n))}else i.onChange(n=>l(n,t));return i.element}static _getFilterRowElement(e){if(!!e)return Array.from(e.rows).find(t=>t.classList.contains(o.classes.TABLE_HEAD_ROW_FILTER))}static async expandRow(e,t,l){let i=e.tableElement.tBodies[0],s=a._getNonExpandedRows(i.rows)[t];s.classList.add(o.classes.TABLE_ROW_EXPANDED);let r=Array.from(i.rows).indexOf(s),c=i.insertRow(r+1);p([o.classes.TABLE_ROW,o.classes.TABLE_BODY_ROW,o.classes.TABLE_ROW_EXPANDABLE_CONTENT],c);let m=c.insertCell();m.setAttribute("colspan",s.cells.length.toString()),m.classList.add(o.classes.TABLE_ROW_EXPANDABLE_CONTENT_CELL);let d=document.createElement("div"),u=document.createElement(M.elementName);u.appendChild(d),m.appendChild(u);let T=l;if(H(l)){let ue=e.data[t]?e.data[t].data:void 0,Ee=l(t,d,ue);try{let A=await Promise.resolve(Ee);T=me(A)?A.content:A}catch(A){console.error("Failed to load row template "+A.message),T=""}}T&&a._setRowTemplate(d,T),window.requestAnimationFrame(()=>u.open=!0)}static _setRowTemplate(e,t){G(t)?e.innerHTML=t:e.appendChild(t)}static collapseRow(e,t){if(!e.tableElement||!e.tableElement.tBodies.length||!e.tableElement.tBodies[0].rows.length)return Promise.resolve();let l=e.tableElement.tBodies[0],n=a._getNonExpandedRows(l.rows)[t],s=Array.from(l.rows).indexOf(n);if(n&&n.classList.contains(o.classes.TABLE_ROW_EXPANDED)){let r=l.rows[s+1],c=r.querySelector(M.elementName);if(c&&c.open)return c.open=!1,new Promise(m=>{setTimeout(()=>{n.classList.remove(o.classes.TABLE_ROW_EXPANDED),W(r),m()},M.numbers.COLLAPSE_ANIMATION_DURATION)})}return Promise.resolve()}static isRowExpanded(e,t){let l=e.tableElement.tBodies[0],n=a._getNonExpandedRows(l.rows)[t];return n&&n.classList.contains(o.classes.TABLE_ROW_EXPANDED)}static setFixedHeaders(e){e.fixedHeaders?e.tableElement.classList.add(o.classes.TABLE_FIXED):e.tableElement.classList.remove(o.classes.TABLE_FIXED)}static setLayoutType(e){e.layoutType==="fixed"?e.tableElement.classList.add(o.classes.TABLE_LAYOUT_FIXED):e.tableElement.classList.remove(o.classes.TABLE_LAYOUT_FIXED)}static normalizeColumnWidths(e){let t=e.tableElement;if(t.tHead&&t.tHead.rows.length){let l=Array.from(t.tHead.rows[0].cells);for(let i of l){let n=getComputedStyle(i).width;i.style.width&&i.style.width!==n&&(i.style.width=n)}}}static setColumnResizeIndicatorVisibility(e,t,l){let i=e.tableElement;if(i.tHead&&i.tHead.rows.length){let n=Array.from(i.tHead.rows);for(let s of n){let r=s.cells[t];r&&(l?r.classList.add(o.classes.TABLE_CELL_RESIZABLE):r.classList.remove(o.classes.TABLE_CELL_RESIZABLE))}}if(i.tBodies.length){let n=Array.from(i.tBodies[0].rows);for(let s of n){let r=s.cells[t];r&&(l?r.classList.add(o.classes.TABLE_CELL_RESIZABLE):r.classList.remove(o.classes.TABLE_CELL_RESIZABLE))}}}static setRowClickListeners(e,t,l,i){let n=e.tBodies[0];!n||(t?a._attachRowClickListeners(n,l,i):a._detachRowClickListeners(n,l,i))}static setRowClickAttributes(e,t){let l=e.tBodies[0];!l||(t?a._addRowClickAttributes(l):a._removeRowClickAttributes(l))}static getOwnerDocument(e){return e.ownerDocument||document}static _prepend(e,t){let l=t.childNodes.item(0);l?t.insertBefore(e,l):t.appendChild(e)}static _isMac(){return!!(navigator&&navigator.platform&&navigator.platform.substr(0,3)==="Mac")}static _renderSelectAllTemplate(e,t){return Promise.resolve(e()).then(l=>{let i=t.rows.item(t.rows.length-1);if(!i)return;let n=i.cells.item(0);l&&n&&(typeof l=="string"?n.innerHTML=l:l instanceof HTMLElement&&n.appendChild(l),n.setAttribute(o.attributes.CUSTOM_CELL_TEMPLATE,""))})}};var N=class extends U{constructor(t){super(t)}initialize(){this._tableElement||(this._tableElement=document.createElement("table"),this._tableElement.classList.add(o.classes.TABLE),this._component.children.length&&g(this._component),this._component.appendChild(this._tableElement))}getTableElement(){return this._tableElement||this.initialize(),this._tableElement}createTable(t){return a.createTable(t)}recreateTableBody(t){a.recreateTableBody(t)}setSelectedRows(t,l,i,n,s=!1){a.setSelectedRows(t,l,i,n,s)}clearSelectedRows(t){a.clearSelectedRows(t)}updateSelectedState(t,l){a.updateSelectedState(t,l)}updateSelectAllState(t,l,i){a.updateSelectAllState(t,l,i)}setSortedColumn(t,l,i){a.setSortedColumn(t,l,i)}removeColumnSort(t,l){a.removeColumnSort(t,l)}setSortDirection(t,l,i){a.setSortDirection(t,l,i)}setSelectColumnVisibility(t,l,i,n,s,r,c,m,d){a.setSelectColumnVisibility(t,l,i,n||null,s||null,r||null,c||[],m||null,d||null)}setDense(t,l){a.setDenseState(t,l)}setRoomy(t,l){a.setRoomyState(t,l)}setResizable(t){a.setResizable(t)}setSelectAllVisibility(t,l,i,n,s,r=null){a.setSelectAllVisibility(t,l,i,n,s||null,r||null)}setFilterRow(t){a.setFilterRow(t)}expandRow(t,l,i){return a.expandRow(t,l,i)}collapseRow(t,l){return a.collapseRow(t,l)}isRowExpanded(t,l){return a.isRowExpanded(t,l)}setFixedHeaders(t){a.setFixedHeaders(t)}setTableLayoutType(t){a.setLayoutType(t)}setWrapContentState(t){a.setWrapContentState(t.tableElement,t.wrapContent)}addDocumentListener(t,l){a.getOwnerDocument(this._component).addEventListener(t,l)}removeDocumentListener(t,l){a.getOwnerDocument(this._component).removeEventListener(t,l)}normalizeColumnWidths(t){a.normalizeColumnWidths(t)}setResizeColumnVisibility(t,l,i){a.setColumnResizeIndicatorVisibility(t,l,i)}addTableClass(t){p(t,this._tableElement)}removeTableClass(t){D(t,this._tableElement)}setRowClickListeners(t,l,i,n){a.setRowClickListeners(t,l,i,n)}setRowClickAttributes(t,l){a.setRowClickAttributes(t,l)}};var k=class{constructor(){this._sortedColumns=[]}get sortedColumns(){return[...this._sortedColumns.map(e=>C({},e))]}addSortColumn(e){this._sortedColumns.push(C({},e)),this._updateSortNumbers()}updateSortColumn(e){let t=this._sortedColumns.find(l=>l.columnIndex===e.columnIndex);if(t)switch(t.direction){case"ASC":this.removeSortColumn(e);break;case"DESC":t.direction="ASC";break;case"UNSET":t.direction="DESC";break}}setSortColumns(e){this._sortedColumns=[...e.map(t=>C({},t))]}removeSortColumn(e){typeof e=="number"?this._sortedColumns.splice(e,1):this._sortedColumns.splice(this._sortedColumns.indexOf(e),1),this._updateSortNumbers()}isSortColumn(e){return typeof e=="number"?this._sortedColumns.some(t=>t.columnIndex===e):this._sortedColumns.includes(e)}clearMultiSort(){this._sortedColumns=[]}getSortColumn(e){return this._sortedColumns.find(t=>t.columnIndex===e)}_updateSortNumbers(){this._sortedColumns.every(e=>typeof e.sortOrder=="number")&&this._sortedColumns.sort((e,t)=>e.sortOrder-t.sortOrder),this._sortedColumns.forEach((e,t)=>e.sortOrder=t+1)}};var P=class{constructor(e,t=!1){this.data=e;this.selected=t}};var z=class{constructor(e){this._adapter=e;this._tableRows=[];this._data=[];this._columnConfigurations=[];this._select=!1;this._multiselect=!0;this._dense=!1;this._roomy=!1;this._filter=!1;this._fixedHeaders=!1;this._layoutType=o.strings.DEFAULT_LAYOUT_TYPE;this._wrapContent=!0;this._resizable=!1;this._minResizeWidth=o.numbers.MIN_RESIZE_WIDTH;this._multiColumnSort=!1;this._selectCheckboxAlignment="center";this._isAllSelected=!1;this._sortedColumnIndex=-1;this._rendered=!1;this._allowRowClick=!1;this._multiSortManager=new k;this._rowClickListener=t=>this._onRowClick(t),this._rowDoubleClickListener=t=>this._onRowDoubleClick(t),this._selectRowListener=t=>this._onRowSelected(t),this._selectAllListener=t=>this._onSelectAll(t),this._sortableHeadCellKeydownListener=t=>this._onSortableHeadCellKeydown(t),this._headRowMouseDownListener=t=>this._onHeadRowMouseDown(t),this._headRowContextMenuListener=t=>this._onHeadRowContextMenu(t),this._documentMouseMoveListener=t=>this._onMouseMove(t),this._documentMouseUpListener=t=>this._onMouseUp(t),this._filterListener=(t,l)=>this._onFilter(t,l),this._selectionManager=new I(this._selectKey),this._hiddenColumnManager=new I}initialize(){this.connect(),this._adapter.setHostAttribute(o.attributes.SELECT,this._select.toString()),this._adapter.setHostAttribute(o.attributes.MULTISELECT,this._multiselect.toString()),this._adapter.setHostAttribute(o.attributes.DENSE,this._dense.toString()),this._adapter.setHostAttribute(o.attributes.ROOMY,this._roomy.toString()),this._adapter.setHostAttribute(o.attributes.FILTER,this._filter.toString()),this._adapter.emitHostEvent(o.events.INITIALIZED,void 0,!1)}connect(){this._adapter.initialize()}disconnect(){this._resizeDescriptor=void 0,this._adapter.removeDocumentListener("mousemove",this._documentMouseMoveListener),this._adapter.removeDocumentListener("mouseup",this._documentMouseUpListener)}set data(e){Array.isArray(e)&&e.length>0?w(e[0])?this._data=e.map(t=>C({},t)):this._data=[...e]:this._data=[],this._tableRows=this._data.map(t=>new P(t,this._selectionManager.exists(t))),this._renderBody()}get data(){return this._data.map(e=>C({},e))}set columnConfigurations(e){this._columnConfigurations=e.map(t=>C({},t)),this._hiddenColumnManager.clear(),this._columnConfigurations.forEach(t=>{t.hidden&&this._hiddenColumnManager.add(t)}),this._refreshTableSort(),this.render()}get columnConfigurations(){return this._columnConfigurations.map(e=>C({},e))}get _visibleColumnConfigurations(){return this._columnConfigurations.filter(e=>!this._hiddenColumnManager.exists(e))}get _tableConfiguration(){return{tableElement:this._adapter.getTableElement(),columnConfigurations:this._visibleColumnConfigurations,data:this._tableRows,clickListener:this._allowRowClick?this._rowClickListener:null,doubleClickListener:this._allowRowClick?this._rowDoubleClickListener:null,selectListener:this._select?this._selectRowListener:null,selectAllListener:this._multiselect?this._selectAllListener:null,sortableHeadCellKeydownListener:this._sortableHeadCellKeydownListener,headRowMouseDownListener:this._headRowMouseDownListener,headRowContextMenuListener:this._headRowContextMenuListener,filterListener:this._filter?this._filterListener:null,sortDirection:this._sortDirection,sortedColumn:this._sortedColumnIndex,multiColumnSort:this._multiColumnSort,filter:this._filter,wrapContent:this._wrapContent,fixedHeaders:this._fixedHeaders,layoutType:this._layoutType,dense:this._dense,resizable:this._resizable,rowCreatedCallback:this._rowCreatedCallback,cellCreatedCallback:this._cellCreatedCallback,selectAllTemplate:this._selectAllTemplate,selectCheckboxAlignment:this._selectCheckboxAlignment,tooltipSelect:this._tooltipSelect,tooltipSelectAll:this._tooltipSelectAll}}set select(e){this._select!==e&&(this._select=e,this._adapter.setSelectColumnVisibility(this._adapter.getTableElement(),this._select,this._selectRowListener,this._multiselect?this._selectAllListener:void 0,this._multiselect?this._selectAllTemplate:null,this._selectCheckboxAlignment,this._tableRows,this._tooltipSelect,this._tooltipSelectAll),this._updateSelections(!0),this._select?this._adapter.setHostAttribute(o.attributes.SELECT,this._select.toString()):this._adapter.removeHostAttribute(o.attributes.SELECT))}get select(){return this._select}set multiselect(e){this._multiselect!==e&&(this._multiselect=e,this._select&&(this._adapter.setSelectAllVisibility(this._adapter.getTableElement(),this._multiselect,this._multiselect?this._selectAllListener:null,this._multiselect?this.selectAllTemplate:null,this._selectCheckboxAlignment,this._tooltipSelectAll),this._updateSelections(!0)),this._adapter.setHostAttribute(o.attributes.MULTISELECT,this._multiselect.toString()))}get multiselect(){return this._multiselect}get selectKey(){return Array.isArray(this._selectKey)?[...this._selectKey]:this._selectKey}set selectKey(e){this._originalSelectKey!==e&&(Array.isArray(e)?(this._originalSelectKey=[...e],this._selectKey=[...e]):(this._originalSelectKey=e,this._selectKey=[e]),this._selectionManager.setKey(this._selectKey),this._updateSelections(!1))}get dense(){return this._dense}set dense(e){this._dense!==e&&(this._dense=e,this._adapter.setDense(this._adapter.getTableElement(),this._dense),this._adapter.setHostAttribute(o.attributes.DENSE,this._dense.toString()))}get roomy(){return this._roomy}set roomy(e){e!==this._roomy&&(this._roomy=e,this._applyRoomy())}set filter(e){this._filter!==e&&(this._filter=e,this._adapter.setFilterRow(this._tableConfiguration),this._adapter.setHostAttribute(o.attributes.FILTER,this._filter.toString()))}get filter(){return this._filter}set fixedHeaders(e){this._fixedHeaders!==e&&(this._fixedHeaders=e,this._adapter.setFixedHeaders(this._tableConfiguration))}get fixedHeaders(){return this._fixedHeaders}get layoutType(){return this._layoutType}set layoutType(e){this._layoutType!==e&&(this._layoutType=e,this._adapter.setTableLayoutType(this._tableConfiguration))}get wrapContent(){return this._wrapContent}set wrapContent(e){this._wrapContent!==e&&(this._wrapContent=e,this._adapter.setWrapContentState(this._tableConfiguration))}get resizable(){return this._resizable}set resizable(e){this._resizable!==e&&(this._resizable=e,this._adapter.setResizable(this._tableConfiguration))}get minResizeWidth(){return this._minResizeWidth}set minResizeWidth(e){this._minResizeWidth!==e&&(this._minResizeWidth=e,y(this._minResizeWidth)?this._minResizeWidth<0&&(this._minResizeWidth=0):this._minResizeWidth=o.numbers.MIN_RESIZE_WIDTH)}get allowRowClick(){return this._allowRowClick}set allowRowClick(e){this._allowRowClick!==e&&(this._allowRowClick=e,this._rendered&&(this._adapter.setRowClickListeners(this._adapter.getTableElement(),this._allowRowClick,this._rowClickListener,this._rowDoubleClickListener),this._adapter.setRowClickAttributes(this._adapter.getTableElement(),this._allowRowClick)))}get multiColumnSort(){return this._multiColumnSort}set multiColumnSort(e){e!==this._multiColumnSort&&(this._multiColumnSort=e,this._refreshTableSort(),this.render())}get selectCheckboxAlignment(){return this._selectCheckboxAlignment}set selectCheckboxAlignment(e){e!==this._selectCheckboxAlignment&&(this._selectCheckboxAlignment=e,this._adapter.setHostAttribute(o.attributes.SELECT_CHECKBOX_ALIGNMENT,e),this.render())}get tooltipSelect(){return this._tooltipSelect}set tooltipSelect(e){e!==this._tooltipSelect&&(this._tooltipSelect=e,typeof e=="string"&&this._adapter.setHostAttribute(o.attributes.TOOLTIP_SELECT,e),this.render())}get tooltipSelectAll(){return this._tooltipSelectAll}set tooltipSelectAll(e){e!==this._tooltipSelectAll&&(this._tooltipSelectAll=e,this._adapter.setHostAttribute(o.attributes.TOOLTIP_SELECT_ALL,e),this.render())}get selectAllTemplate(){return this._selectAllTemplate}set selectAllTemplate(e){e!==this._selectAllTemplate&&(this._selectAllTemplate=e,this.render())}get rowCreated(){return this._rowCreatedCallback}set rowCreated(e){this._rowCreatedCallback=e}get cellCreated(){return this._cellCreatedCallback}set cellCreated(e){this._cellCreatedCallback=e}isRowSelected(e){let t=v(Array.isArray(this._selectKey)?this._selectKey:[this._selectKey],e);return this.selectKey?!!this._selectionManager.getItems().find(l=>X(l,t)):this._selectionManager.exists(e)}getSelectedRows(){return this._selectionManager.getItems()}selectRows(e,t){if(!this._selectKey)throw new Error("You must set a selectKey to select rows.");(!this._multiselect||t)&&this.clearSelections(),e&&e.length&&(this._selectionManager.add(e),this._updateSelections(!t))}deselectRows(e){e&&e.length&&(this._selectionManager.remove(e),this._updateSelections(!1))}clearSelections(){let e=this._adapter.getTableElement();this._selectionManager.clear(),this._tableRows.forEach(t=>t.selected=!1),this._isAllSelected=!1,this._adapter.clearSelectedRows(e),this._select&&this._multiselect&&this._adapter.updateSelectAllState(e,!1)}hideColumn(e){let t=this._columnConfigurations[e];this._sortedColumnIndex===e&&(this._sortedColumnIndex=-1),this._hiddenColumnManager.exists(t)||(this._hiddenColumnManager.add(t),this.render())}showColumn(e){let t=this._columnConfigurations[e];this._hiddenColumnManager.exists(t)&&(this._hiddenColumnManager.remove(t),this.render())}isColumnHidden(e){let t=this._columnConfigurations[e];return!!t&&this._hiddenColumnManager.exists(t)}render(){this._adapter.createTable(this._tableConfiguration),this._renderSelections(),this._rendered=!0}_renderBody(){!this._rendered||(this._adapter.recreateTableBody(this._tableConfiguration),this._renderSelections())}_renderSelections(){this.select&&(this._isAllSelected=this._getSelectAllState(),this._multiselect&&this._adapter.updateSelectAllState(this._adapter.getTableElement(),this._isAllSelected,this._isIndeterminate(this._isAllSelected)));let e=this._selectionManager.getItems();e.length&&this._adapter.setSelectedRows(this._adapter.getTableElement(),this._selectKey,this._data,e,!1)}expandRow(e,t){if(!this._rendered)throw new Error("Cannot expand a row before the table has rendered.");if(e<0||e>this._tableRows.length)throw new Error(`Invalid row index: ${e}.`);return this._adapter.expandRow(this._tableConfiguration,e,t)}collapseRow(e){return!this._rendered||e<0||e>this._tableRows.length?Promise.resolve():this._adapter.collapseRow(this._tableConfiguration,e)}isRowExpanded(e){return this._adapter.isRowExpanded(this._tableConfiguration,e)}selectRowsByIndex(e,t){let l=e.map(i=>this._data[i]).filter(i=>!!i);this.selectRows(l,!t)}deselectRowsByIndex(e){let t=e.map(l=>this._data[l]).filter(l=>!!l);this.deselectRows(t)}_getSelectAllState(){return this._tableRows.length>0&&this._tableRows.every(e=>e.selected)}_updateSelections(e){this._tableRows.forEach(l=>l.selected=this._selectionManager.exists(l.data));let t=this._getSelectAllState();this._adapter.setSelectedRows(this._adapter.getTableElement(),this._selectKey,this._data,this._selectionManager.getItems(),e),(t!==this._isAllSelected||this._isIndeterminate(t))&&(this._isAllSelected=t,this._multiselect&&this._adapter.updateSelectAllState(this._adapter.getTableElement(),this._isAllSelected,this._isIndeterminate(this._isAllSelected)))}_onRowClick(e){if(e.stopImmediatePropagation(),e.target.tagName==="INPUT"&&e.target.type==="checkbox")return;let i=R(e).filter(m=>m.nodeType===1).find(m=>m.hasAttribute(o.attributes.CUSTOM_CELL_TEMPLATE));if(i&&i.hasAttribute(o.attributes.CUSTOM_CELL_TEMPLATE_STOP_PROPAGATION))return;let{index:s,data:r}=this._getSelectedRowFromEvent(e),c={index:s,data:r};this._adapter.emitHostEvent(o.events.ROW_CLICK,c,!0,!1)}_onRowDoubleClick(e){if(e.stopPropagation(),e.target.tagName==="INPUT"&&e.target.type==="checkbox")return;let t=this._getSelectedRowFromEvent(e),l={index:t.index,data:t.data};this._adapter.emitHostEvent(o.events.SELECT_DOUBLE,l,!0,!1)}_onRowSelected(e){let t=this._getSelectedRowFromEvent(e);this._multiselect||this._tableRows.filter(r=>r.selected).forEach(r=>{X(r.data,v(this._selectKey,t.data))||this.deselectRows([r.data])});let l=!this._selectionManager.exists(t.data);this._adapter.updateSelectedState(t.rowElement,l),l?this._selectionManager.add(t.data):this._selectionManager.remove(t.data),this._tableRows[t.index].selected=l;let i=[t.index],n=!1;if(this._multiselect){if(e.shiftKey&&this._previouslyClickedRow&&(i=this._shiftSelectRows(t),i.includes(this._previouslyClickedRow.index))){let r=i.indexOf(this._previouslyClickedRow.index);i.splice(r,1)}n=this._getSelectAllState(),this._adapter.updateSelectAllState(this._adapter.getTableElement(),n,this._isIndeterminate(n))}for(let s of i){let r=this._tableRows[s].data,m={selected:this._selectionManager.exists(r),index:s,data:r};this._adapter.emitHostEvent(o.events.SELECT,m,!0,!1)}if(this._isAllSelected!==n){this._isAllSelected=n;let s={status:this._isAllSelected,count:this._tableRows.filter(r=>r.selected).length,data:[...this._data],targetType:"row"};this._adapter.emitHostEvent(o.events.SELECT_ALL,s,!0,!1)}this._previouslyClickedRow=C({},t)}_getSelectedRowFromEvent(e){let l=R(e).find(r=>r.tagName==="TR"),i=l.parentElement,n=this._getNonExpandedRows(i).findIndex(r=>r===l),s=this._tableRows[n].data;return{rowElement:l,index:n,data:s}}_getNonExpandedRows(e){return Array.from(e.rows).filter(t=>!t.classList.contains(o.classes.TABLE_ROW_EXPANDABLE_CONTENT))}_onSelectAll(e){e.stopPropagation(),this._isAllSelected=!this._isAllSelected;let t=this._adapter.getTableElement();this._adapter.updateSelectAllState(t,this._isAllSelected),this._tableRows.forEach((i,n)=>{i.selected=this._isAllSelected,this._isAllSelected?this._selectionManager.add(i.data):this._selectionManager.remove(i.data);let s=a.getRowByIndex(t,n);s&&this._adapter.updateSelectedState(s,this._isAllSelected)});let l={status:this._isAllSelected,count:this._tableRows.filter(i=>i.selected).length,data:[...this._data],targetType:"select-all"};this._adapter.emitHostEvent(o.events.SELECT_ALL,l,!0,!1)}_onHeadRowContextMenu(e){e.ctrlKey&&e.preventDefault()}_onHeadRowMouseDown(e){if(e.button!==0)return;let t=R(e),l=e.target,i=t.find(r=>r.tagName==="TR"),n=t.find(r=>r.tagName==="TH"),s=Array.from(i.cells).findIndex(r=>r===n);this._headCellMouseDownIndex=s,l!==n&&l.classList.contains(o.classes.TABLE_RESIZE_HANDLE)&&(this._resizeDescriptor={element:n,startWidth:n.offsetWidth,startX:e.pageX,width:n.offsetWidth,index:this._select?s-1:s},this._adapter.addDocumentListener("mousemove",this._documentMouseMoveListener),this._adapter.setResizeColumnVisibility(this._tableConfiguration,s,!0)),this._adapter.addDocumentListener("mouseup",this._documentMouseUpListener)}_onMouseMove(e){if(this._resizeDescriptor){let t=this._resizeDescriptor.startWidth+(e.pageX-this._resizeDescriptor.startX);t<this._minResizeWidth&&(t=this._minResizeWidth),this._resizeDescriptor.width=t,this._resizeDescriptor.element.style.width=`${t}px`,this._adapter.addTableClass(o.classes.TABLE_RESIZING)}}_onMouseUp(e){if(this._adapter.removeDocumentListener("mousemove",this._documentMouseMoveListener),this._adapter.removeDocumentListener("mouseup",this._documentMouseUpListener),this._adapter.removeTableClass(o.classes.TABLE_RESIZING),this._headCellMouseDownIndex!==void 0){if(this._resizeDescriptor){this._adapter.normalizeColumnWidths(this._tableConfiguration),this._adapter.setResizeColumnVisibility(this._tableConfiguration,this._headCellMouseDownIndex,!1);let t={index:this._resizeDescriptor.index,width:this._resizeDescriptor.width};this._adapter.emitHostEvent(o.events.COLUMN_RESIZE,t),this._resizeDescriptor=void 0}else this._tableConfiguration.tableElement.tHead.contains(e.target)&&(this._multiColumnSort?this._onMultiSort(this._headCellMouseDownIndex,e.ctrlKey):this._onSort(this._headCellMouseDownIndex));this._headCellMouseDownIndex=void 0}}_onSortableHeadCellKeydown(e){if(e.key===" "||e.key==="Enter"){let t=R(e),l=t.find(s=>s.tagName==="TR"),i=t.find(s=>s.tagName==="TH"),n=Array.from(l.cells).findIndex(s=>s===i);this._onSort(n)}}_onSort(e){let t=this._select?e-1:e,l=t>=0?this._visibleColumnConfigurations[t]:null;if(!l||!l.sortable)return;let i="ASC",n=t===this._sortedColumnIndex,s=this._sortDirection==="ASC"||this._sortDirection===void 0,r=n&&this._sortDirection==="DESC";n&&s&&(i="DESC"),r&&!l.preventUnsort&&(i="UNSET");let c={direction:i,columnIndex:t};if(!!this._adapter.emitHostEvent(o.events.SORT,c,!0,!0)){if(n&&this._sortDirection==="DESC"&&!l.preventUnsort){this._adapter.removeColumnSort(this._adapter.getTableElement(),this._select?this._sortedColumnIndex+1:this._sortedColumnIndex),this._sortedColumnIndex=-1;return}this._sortDirection=i,t===this._sortedColumnIndex?this._adapter.setSortDirection(this._adapter.getTableElement(),e,this._sortDirection):(this._sortedColumnIndex>=0&&this._adapter.removeColumnSort(this._adapter.getTableElement(),this._select?this._sortedColumnIndex+1:this._sortedColumnIndex),this._sortedColumnIndex=t,this._adapter.setSortedColumn(this._adapter.getTableElement(),e,this._sortDirection))}}_onMultiSort(e,t){let l=this._select?e-1:e,i=l>=0?this._visibleColumnConfigurations[l]:null;if(!i||!i.sortable)return;let n=this._multiSortManager.sortedColumns,s=this._multiSortManager.getSortColumn(l);s?this._multiSortManager.updateSortColumn(s):t?this._multiSortManager.addSortColumn({direction:"DESC",columnIndex:l,propertyName:i.property}):(this._multiSortManager.clearMultiSort(),this._multiSortManager.addSortColumn({direction:"DESC",columnIndex:l,propertyName:i.property}));let r=this._multiSortManager.sortedColumns.map(d=>C({},d));if(!this._adapter.emitHostEvent(o.events.SORT,r,!0,!0)){this._multiSortManager.setSortColumns(n);return}let m=this._multiSortManager.sortedColumns.length>1;for(let d=0;d<this._visibleColumnConfigurations.length;d++){let u=this._select?d+1:d;if(!this._multiSortManager.isSortColumn(d))this._adapter.removeColumnSort(this._adapter.getTableElement(),u),a.setMultiSortColumnSortNumber(this._adapter.getTableElement(),m,u,null);else{let T=this._multiSortManager.getSortColumn(d);T&&(this._adapter.setSortedColumn(this._adapter.getTableElement(),u,T.direction),a.setMultiSortColumnSortNumber(this._adapter.getTableElement(),m,u,T.sortOrder||null))}}}_onFilter(e,t){let l={value:e,columnIndex:t};this._adapter.emitHostEvent(o.events.FILTER,l,!0,!1)}_shiftSelectRows(e){let t=[];if(this._previouslyClickedRow){let l=this._previouslyClickedRow.index,i=e.index,n=i>=l?l:i,s=i>=l?i:l;s+=s>n?1:0,n+=n>s?1:0;let r=d=>this.selectRows(d,!1),c=this._tableRows.find(d=>d.selected&&d.data===e.data),m=this._tableRows.find(d=>{var u;return d.data===((u=this._previouslyClickedRow)==null?void 0:u.data)&&!d.selected});(!c||m)&&(r=d=>this.deselectRows(d));for(let d=n;d<s;d++)t.push(d);r(this.data.filter((d,u)=>t.includes(u)))}return t}_isIndeterminate(e){return!e&&this.getSelectedRows().length>0&&this._data.length!==this.getSelectedRows().length}_applyRoomy(){this._adapter.setRoomy(this._adapter.getTableElement(),this._roomy),this._adapter.setHostAttribute(o.attributes.ROOMY,this._roomy.toString())}_refreshTableSort(){if(this._sortedColumnIndex=this._visibleColumnConfigurations.findIndex(e=>e.initialSort),this._sortDirection=this._sortedColumnIndex>=0?this._visibleColumnConfigurations[this._sortedColumnIndex].sortDirection:void 0,this._multiColumnSort){let e=[];this._visibleColumnConfigurations.forEach((t,l)=>{typeof t.initialSort=="object"&&e.push({columnIndex:l,direction:t.initialSort.direction,sortOrder:t.initialSort.sortOrder,propertyName:t.property})}),this._multiSortManager.setSortColumns(e)}}};var E=class extends Q{constructor(){super();oe.define(te),this._foundation=new z(new N(this))}static get observedAttributes(){return[o.attributes.SELECT,o.attributes.MULTISELECT,o.attributes.SELECT_KEY,o.attributes.DENSE,o.attributes.ROOMY,o.attributes.FILTER,o.attributes.FIXED_HEADERS,o.attributes.LAYOUT_TYPE,o.attributes.WRAP_CONTENT,o.attributes.RESIZABLE,o.attributes.MIN_RESIZE_WIDTH,o.attributes.ALLOW_ROW_CLICK,o.attributes.MULTI_COLUMN_SORT,o.attributes.SELECT_CHECKBOX_ALIGNMENT,o.attributes.TOOLTIP_SELECT,o.attributes.TOOLTIP_SELECT_ALL]}initializedCallback(){this._foundation.initialize()}connectedCallback(){this._foundation.connect()}disconnectedCallback(){this._foundation.disconnect()}attributeChangedCallback(t,l,i){switch(t){case o.attributes.SELECT:this.select=h(i);break;case o.attributes.MULTISELECT:this.multiselect=h(i);break;case o.attributes.SELECT_KEY:this.selectKey=i;break;case o.attributes.DENSE:this.dense=h(i);break;case o.attributes.ROOMY:this.roomy=h(i);break;case o.attributes.FILTER:this.filter=h(i);break;case o.attributes.FIXED_HEADERS:this.fixedHeaders=h(i);break;case o.attributes.LAYOUT_TYPE:this.layoutType=i;break;case o.attributes.WRAP_CONTENT:this.wrapContent=h(i);break;case o.attributes.RESIZABLE:this.resizable=h(i);break;case o.attributes.MIN_RESIZE_WIDTH:this.minResizeWidth=V(i);break;case o.attributes.ALLOW_ROW_CLICK:this.allowRowClick=h(i);break;case o.attributes.MULTI_COLUMN_SORT:this.multiColumnSort=h(i);break;case o.attributes.SELECT_CHECKBOX_ALIGNMENT:this.selectCheckboxAlignment=this.getAttribute(o.attributes.SELECT_CHECKBOX_ALIGNMENT)||"center";break;case o.attributes.TOOLTIP_SELECT:this.tooltipSelect=i;break;case o.attributes.TOOLTIP_SELECT_ALL:this.tooltipSelectAll=i;break}}hideColumn(t){this._foundation.hideColumn(t)}showColumn(t){this._foundation.showColumn(t)}isColumnHidden(t){return this._foundation.isColumnHidden(t)}getSelectedRows(){return this._foundation.getSelectedRows()}selectRow(t){this._foundation.selectRows([t],!1)}selectRows(t,l=!1){this._foundation.selectRows(t,!l)}deselectRow(t){this._foundation.deselectRows([t])}deselectRows(t){this._foundation.deselectRows(t)}clearSelections(){this._foundation.clearSelections()}render(){this._foundation.render()}expandRow(t,l){return this._foundation.expandRow(t,l)}collapseRow(t){return this._foundation.collapseRow(t)}isRowExpanded(t){return this._foundation.isRowExpanded(t)}selectRowsByIndex(t,l){typeof t=="number"?this._foundation.selectRowsByIndex([t],l):Array.isArray(t)&&this._foundation.selectRowsByIndex(t,l)}deselectRowsByIndex(t){typeof t=="number"?this._foundation.deselectRowsByIndex([t]):Array.isArray(t)&&this._foundation.deselectRowsByIndex(t)}isRowSelected(t){return this._foundation.isRowSelected(t)}};_([b()],E.prototype,"data",2),_([b()],E.prototype,"columnConfigurations",2),_([b()],E.prototype,"select",2),_([b()],E.prototype,"multiselect",2),_([b()],E.prototype,"selectKey",2),_([b()],E.prototype,"tooltipSelect",2),_([b()],E.prototype,"tooltipSelectAll",2),_([b()],E.prototype,"dense",2),_([b()],E.prototype,"roomy",2),_([b()],E.prototype,"filter",2),_([b()],E.prototype,"fixedHeaders",2),_([b()],E.prototype,"layoutType",2),_([b()],E.prototype,"wrapContent",2),_([b()],E.prototype,"resizable",2),_([b()],E.prototype,"minResizeWidth",2),_([b()],E.prototype,"allowRowClick",2),_([b()],E.prototype,"multiColumnSort",2),_([b()],E.prototype,"rowCreated",2),_([b()],E.prototype,"cellCreated",2),_([b()],E.prototype,"selectAllTemplate",2),_([b()],E.prototype,"selectCheckboxAlignment",2),E=_([J({name:o.elementName,dependencies:[ne,se,ce]})],E);function El(){j(E)}export{o as a,B as b,O as c,Le as d,N as e,P as f,z as g,E as h,El as i};
7
- //# sourceMappingURL=chunk.VXCPWDOQ.js.map
6
+ import{a as q,b as x,c as v,d as X}from"./chunk.DONAMICM.js";import{c as ce}from"./chunk.ZVHFSAID.js";import{c as re}from"./chunk.M4PI24CI.js";import{a as M,d as ne}from"./chunk.SXQ22MNR.js";import{a as R}from"./chunk.4DAIIJ37.js";import{b as te}from"./chunk.MZLPUI6R.js";import{a as ae}from"./chunk.SYHVVXRW.js";import{a as ie,d as oe,l as se}from"./chunk.WHQZNZHW.js";import{a as Y}from"./chunk.2KXSGD3S.js";import{a as le}from"./chunk.BESB4RGK.js";import{a as U}from"./chunk.UWYANU5D.js";import{a as b}from"./chunk.KTGSZEAG.js";import{a as J,b as ee}from"./chunk.DL7NX432.js";import{a as j,l as Q}from"./chunk.LJLEPTLU.js";import{d as g,e as F,f as p,g as D,i as W,j as K,t as $}from"./chunk.4LA6HEA7.js";import{b as L,c as G,d as y,h as H,j as w,k as h,l as V,o as Z}from"./chunk.J2M2MXP2.js";import{a as C,f as _}from"./chunk.MCIQXNKY.js";var I=class{constructor(e){this._key=e,this._items=[]}getItems(){return[...this._items]}count(){return this._items.length}setKey(e){this._key=e}add(e){return e instanceof Array||(e=[e]),e.forEach(t=>{this.exists(t)||this._items.push(t)}),this}remove(e){e instanceof Array||(e=[e]);for(let t=e.length-1;t>=0;t--)this.exists(e[t])&&this._items.splice(this._items.indexOf(this._getItem(e[t])),1);return this}clear(){return this._items=[],this}exists(e){return this._getItem(e)!==null}_getItem(e){return this._key?x(this._items,v(this._key,e))||null:this._items.find(t=>t===e)||null}};var S=`${ee}table`,de={TABLE:"forge-table",TABLE_DENSE:"forge-table--dense",TABLE_ROOMY:"forge-table--roomy",TABLE_RESIZABLE:"forge-table--resizable",TABLE_RESIZING:"forge-table--resizing",TABLE_RESIZE_HANDLE:"forge-table__resize-handle",TABLE_NO_WRAP_CONTENT:"forge-table--no-wrap-content",TABLE_LAYOUT_FIXED:"forge-table--layout-fixed",TABLE_FILTER_VISIBLE:"forge-table--filter-visible",TABLE_FIXED:"forge-table--fixed",TABLE_HEAD:"forge-table-head",TABLE_HEAD_ROW:"forge-table-head__row",TABLE_HEAD_ROW_FILTER:"forge-table-head__row__filter",TABLE_HEAD_CELL:"forge-table-head__cell",TABLE_HEAD_CELL_CONTAINER:"forge-table-head__cell-container",TABLE_HEAD_CELL_SORTABLE:"forge-table-head__cell--sortable",TABLE_HEAD_CELL_SORT_ICON:"forge-table-head__cell-sort-icon",TABLE_HEAD_CELL_TEXT:"forge-table-head__cell-text",TABLE_HEAD_CELL_SORT_ICON_ACTIVE:"forge-table-head__cell-sort-icon--active",TABLE_HEAD_CELL_SORTED_ASCENDING:"forge-table-head__cell--sorted-ascending",TABLE_HEAD_CELL_SORTED_DESCENDING:"forge-table-head__cell--sorted-descending",TABLE_HEAD_CELL_SORT_ORDER:"forge-table-head__cell__sort-order",TABLE_HEAD_CELL_SORT_ORDER_HIDDEN:"forge-table-head__cell__sort-order--hidden",TABLE_BODY:"forge-table-body",TABLE_BODY_ROW:"forge-table-body__row",TABLE_BODY_ROW_SELECTED:"forge-table-body__row--selected",TABLE_BODY_ROW_CLICKABLE:"forge-table-body__row--clickable",TABLE_BODY_CELL:"forge-table-body__cell",TABLE_ROW:"forge-table-row",TABLE_ROW_EXPANDED:"forge-table-row--expanded",TABLE_ROW_EXPANDABLE_CONTENT:"forge-table-row__expandable-content",TABLE_ROW_EXPANDABLE_CONTENT_CELL:"forge-table-row__expandable-content-cell",TABLE_CELL:"forge-table-cell",TABLE_CELL_SELECT:"forge-table-cell__select",TABLE_CELL_SELECT_CHECKBOX:"forge-table-cell__select-checkbox",TABLE_CELL_SELECT_CHECKBOX_CONTAINER:"forge-table-cell__select-checkbox-container",TABLE_CELL_SELECT_CHECKBOX_CONTAINER_ALIGN_RIGHT:"forge-table-cell__select-checkbox-container--align-right",TABLE_CELL_SELECT_CHECKBOX_CONTAINER_ALIGN_LEFT:"forge-table-cell__select-checkbox-container--align-left",TABLE_CELL_SELECT_CHECKBOX_CONTAINER_ALIGN_CENTER:"forge-table-cell__select-checkbox-container--align-center",TABLE_CELL_CONTAINER:"forge-table-cell__container",TABLE_CELL_CONTAINER_TEXT:"forge-table-cell__container-text",TABLE_CELL_CENTER:"forge-table-cell--center",TABLE_CELL_RIGHT:"forge-table-cell--right",TABLE_CELL_RESIZABLE:"forge-table-cell--resizing"},_e={TABLE:".forge-table",CHECKBOX_INPUT:"forge-checkbox > input[type=checkbox]:not([forge-ignore])",SELECT_ALL_TEMPLATE_CHECKBOX_INPUT:"input[type=checkbox]:not([forge-ignore])",ROW_SELECTED:`.${de.TABLE_BODY_ROW_SELECTED}`},be={SELECT:"select",MULTISELECT:"multiselect",SELECT_KEY:"select-key",DENSE:"dense",ROOMY:"roomy",FILTER:"filter",FIXED_HEADERS:"fixed-headers",LAYOUT_TYPE:"layout-type",WRAP_CONTENT:"wrap-content",RESIZABLE:"resizable",MIN_RESIZE_WIDTH:"min-resize-width",ALLOW_ROW_CLICK:"allow-row-click",MULTI_COLUMN_SORT:"multi-column-sort",SELECT_CHECKBOX_ALIGNMENT:"select-checkbox-alignment",TOOLTIP_SELECT:"tooltip-select",TOOLTIP_SELECT_ALL:"tooltip-select-all",CHECKBOX_TYPE:"forge-checkbox-type",CUSTOM_CELL_TEMPLATE:"data-cell-template",CUSTOM_CELL_TEMPLATE_STOP_PROPAGATION:"data-cell-template-stop-propagation"},pe={ROW_CLICK:`${S}-row-click`,SELECT:`${S}-select`,SELECT_DOUBLE:`${S}-select-double`,SELECT_ALL:`${S}-select-all`,SORT:`${S}-sort`,FILTER:`${S}-filter`,INITIALIZED:`${S}-initialized`,COLUMN_RESIZE:`${S}-column-resize`},Te={SELECT_ALL:"select-all",SELECT_ROW:"select-row",DEFAULT_LAYOUT_TYPE:"auto"},Ce={SORT_DOWN:"arrow_downward"},he={DEFAULT_FILTER_DEBOUNCE_TIME:750,MIN_RESIZE_WIDTH:100,RESIZE_HOVER_DURATION:150},o={elementName:S,classes:de,selectors:_e,attributes:be,events:pe,strings:Te,icons:Ce,numbers:he};var B=(l=>(l.Left="left",l.Right="right",l.Center="center",l))(B||{}),O=(l=>(l.Ascending="ASC",l.Descending="DESC",l.Unset="UNSET",l))(O||{}),Le=(s=>(s.InputText="text",s.InputNumber="number",s.Select="select",s.SelectMultiple="select-multiple",s.Date="date",s.DateRange="date-range",s))(Le||{});function me(f){return f&&typeof f=="object"&&"content"in f}var a=class{static createTable(e){a._resetTable(e.tableElement);let t=a._createTableHead(e),l=a._createTableBody(e);e.clickListener&&(a._attachRowClickListeners(l,e.clickListener,e.doubleClickListener),a._addRowClickAttributes(l)),e.fixedHeaders&&a.setFixedHeaders(e),e.resizable&&a.setResizable(e),e.dense&&a.setDenseState(e.tableElement,e.dense),e.wrapContent&&a.setWrapContentState(e.tableElement,e.wrapContent),e.selectListener&&a._addSelectColumn(t,l,e.selectListener,e.selectAllListener,e.selectAllTemplate,e.selectCheckboxAlignment,e.data,e.tooltipSelect,e.tooltipSelectAll),(e.resizable||e.columnConfigurations.some(i=>!!i.sortable))&&(a._attachHeadRowMouseDownListener(t,e.headRowMouseDownListener),a._isMac()&&a._attachHeadRowContextMenuListener(t,e.headRowContextMenuListener)),a.setLayoutType(e),a._setTableHead(e.tableElement,t),e.filter&&a.setFilterRow(e),a._setTableBody(e.tableElement,l)}static _setTableHead(e,t){e.tHead?F(t,e.tHead):e.appendChild(t)}static _setTableBody(e,t){e.tBodies.length?F(t,e.tBodies[0]):e.appendChild(t)}static recreateTableBody(e){let t=a._createTableBody(e);e.clickListener&&(a._attachRowClickListeners(t,e.clickListener,e.doubleClickListener),a._addRowClickAttributes(t)),e.selectListener&&(a._createBodySelectColumn(t,e.selectCheckboxAlignment,e.data,e.tooltipSelect,e.tooltipSelectAll),a._attachRowSelectListeners(t,e.selectListener)),a._setTableBody(e.tableElement,t)}static _resetTable(e){g(e)}static _createMultisortTooltip(){let e=document.createElement(ae.elementName);return e.textContent="Ctrl + click to sort multiple columns",e.position="bottom",e.delay=0,e}static _createTableHead(e){let t=document.createElement("thead"),l=t.insertRow();p([o.classes.TABLE_ROW,o.classes.TABLE_HEAD_ROW],l);let i=!1;for(let n=0;n<e.columnConfigurations.length;n++){let s=e.columnConfigurations[n],r=document.createElement("th");r.scope="col",p([o.classes.TABLE_CELL,o.classes.TABLE_HEAD_CELL],r);let c;if(s.sortable?(c=document.createElement("button"),c.type="button",c.addEventListener("keydown",e.sortableHeadCellKeydownListener)):c=document.createElement("div"),c.classList.add(o.classes.TABLE_HEAD_CELL_CONTAINER),e.multiColumnSort){let d=a._createMultisortTooltip();c.appendChild(d)}if(s.align&&a._setCellAlignmentClass(c,s.align),L(s.width)){let d=K(s.width);d&&(r.style.width=d)}if(e.resizable&&s.resizable!==!1){let d=document.createElement("div");d.classList.add(o.classes.TABLE_RESIZE_HANDLE),r.appendChild(d)}L(s.headerCellStyle)&&w(s.headerCellStyle)&&(Object.assign(r.style,s.headerCellStyle),Object.assign(c.style,s.headerCellStyle));let m=document.createElement("span");if(m.classList.add(o.classes.TABLE_HEAD_CELL_TEXT),m.textContent=s.header&&typeof s.header=="string"?s.header.trim():"",s.sortable){r.classList.add(o.classes.TABLE_HEAD_CELL_SORTABLE);let d=document.createElement("span");p([o.classes.TABLE_HEAD_CELL_SORT_ORDER_HIDDEN,o.classes.TABLE_HEAD_CELL_SORT_ORDER],d);let u=document.createElement(ie.elementName);u.name=o.icons.SORT_DOWN,p([o.classes.TABLE_HEAD_CELL_SORT_ICON],u),e.multiColumnSort?typeof s.initialSort=="object"&&s.initialSort.sortOrder&&(d.textContent=s.initialSort.sortOrder.toString(),e.columnConfigurations.filter(T=>typeof T.initialSort=="object").length>1&&D(o.classes.TABLE_HEAD_CELL_SORT_ORDER_HIDDEN,d),r.classList.add(o.classes.TABLE_HEAD_CELL_SORTED_DESCENDING),u.classList.add(o.classes.TABLE_HEAD_CELL_SORT_ICON_ACTIVE),a._setColumnSortDirection(r,s.initialSort.direction)):e.sortedColumn===n&&!i&&!e.multiColumnSort&&(r.classList.add(o.classes.TABLE_HEAD_CELL_SORTED_DESCENDING),u.classList.add(o.classes.TABLE_HEAD_CELL_SORT_ICON_ACTIVE),a._setColumnSortDirection(r,e.sortDirection),i=!0),c.appendChild(u),c.appendChild(d)}typeof s.headerTemplate=="function"?Promise.resolve(s.headerTemplate(n,c,s)).then(d=>{if(d){let u=document.createElement("div");p(o.classes.TABLE_CELL_CONTAINER,u),typeof d=="string"?u.innerHTML=d:a._prepend(d,u),u.setAttribute(o.attributes.CUSTOM_CELL_TEMPLATE,""),a._prepend(u,c)}}):a._prepend(m,c),r.appendChild(c),l.appendChild(r)}return t}static setSortDirection(e,t,l){let i=a._getHeaderCellByIndex(e,t);e.querySelectorAll("th[aria-sort]").forEach(n=>n.removeAttribute("aria-sort")),a._setColumnSortDirection(i,l)}static _setColumnSortDirection(e,t){e.classList.contains(o.classes.TABLE_HEAD_CELL_SORTED_ASCENDING)&&e.classList.remove(o.classes.TABLE_HEAD_CELL_SORTED_ASCENDING),e.classList.contains(o.classes.TABLE_HEAD_CELL_SORTED_DESCENDING)&&e.classList.remove(o.classes.TABLE_HEAD_CELL_SORTED_DESCENDING),!t||t==="DESC"?(e.setAttribute("aria-sort","descending"),e.classList.add(o.classes.TABLE_HEAD_CELL_SORTED_DESCENDING)):(e.setAttribute("aria-sort","ascending"),e.classList.add(o.classes.TABLE_HEAD_CELL_SORTED_ASCENDING))}static _createTableBody(e){let t=document.createElement("tbody");return a._getOrderedRowData(e.columnConfigurations,e.data).forEach((i,n)=>{let s=t.insertRow();p([o.classes.TABLE_ROW,o.classes.TABLE_BODY_ROW],s),a._populateRowCells(e,s,i,n),typeof e.rowCreatedCallback=="function"&&e.rowCreatedCallback(s,n,C({},e.data[n].data))}),t}static _populateRowCells(e,t,l,i){for(let n=0;n<l.length;n++){let s=e.columnConfigurations[n],r=t.insertCell();if(p([o.classes.TABLE_CELL,o.classes.TABLE_BODY_CELL],r),L(s.width)){let m=K(s.width);m&&(r.style.width=m)}let c=document.createElement("div");if(c.classList.add(o.classes.TABLE_CELL_CONTAINER),L(s.cellStyle)&&w(s.cellStyle)&&(Object.assign(r.style,s.cellStyle),Object.assign(c.style,s.cellStyle)),s.template&&typeof s.template=="function"){let m=e.data[i]?e.data[i].data:void 0;Promise.resolve(s.template(i,c,m,n)).then(d=>{let u=me(d)?d:{content:d,stopClickPropagation:s.stopCellTemplateClickPropagation};!u.content||(typeof u.content=="string"?c.innerHTML=u.content:c.appendChild(u.content),c.setAttribute(o.attributes.CUSTOM_CELL_TEMPLATE,""),u.stopClickPropagation&&c.setAttribute(o.attributes.CUSTOM_CELL_TEMPLATE_STOP_PROPAGATION,""))})}else if(s.property){let m=document.createElement("span");m.classList.add(o.classes.TABLE_CELL_CONTAINER_TEXT),c.appendChild(m),s.transform&&typeof s.transform=="function"?Promise.resolve(s.transform(l[n])).then(d=>m.textContent=d):l[n]==null?m.textContent="":m.textContent=l[n].toString()}if(s.align&&a._setCellAlignmentClass(c,s.align),r.appendChild(c),L(s.columnSpan)){if(s.columnSpan==="all"){r.colSpan=l.length-n;break}else if(typeof s.columnSpan=="number"&&s.columnSpan>0){let m=s.columnSpan;s.columnSpan>l.length-n&&(m=l.length),r.colSpan=m,n=n+(m-1)}}typeof e.cellCreatedCallback=="function"&&e.cellCreatedCallback(r,i,n)}}static _setCellAlignmentClass(e,t){switch(t){case"center":e.classList.add(o.classes.TABLE_CELL_CENTER);break;case"right":e.classList.add(o.classes.TABLE_CELL_RIGHT);break}}static _getNonExpandedRows(e){return Array.from(e).filter(t=>!t.classList.contains(o.classes.TABLE_ROW_EXPANDABLE_CONTENT))}static _getExpandedRows(e){return Array.from(e).filter(t=>t.classList.contains(o.classes.TABLE_ROW_EXPANDABLE_CONTENT))}static _createColumnDataMap(e,t){return e.map(l=>({config:l,data:t.map(i=>{if(l.property){let n=q(i.data,l.property);return L(n)?n:null}return null})}))}static _getOrderedRowData(e,t){let l=a._createColumnDataMap(e,t),i=[];for(let n of l)for(let s=0;s<n.data.length;s++)i[s]||(i[s]=[]),i[s].push(n.data[s]);return i}static _attachRowClickListeners(e,t,l){a._getNonExpandedRows(e.rows).forEach(n=>{n.addEventListener("click",t),l&&n.addEventListener("dblclick",l)})}static _addRowClickAttributes(e){a._getNonExpandedRows(e.rows).forEach(l=>{l.classList.add(o.classes.TABLE_BODY_ROW_CLICKABLE)})}static _removeRowClickAttributes(e){a._getNonExpandedRows(e.rows).forEach(l=>{l.classList.remove(o.classes.TABLE_BODY_ROW_CLICKABLE)})}static _attachRowSelectListeners(e,t){a._getNonExpandedRows(e.rows).forEach(i=>a._attachRowSelectListener(i,t))}static _attachRowSelectListener(e,t){let l=a._getCheckboxElement(e);l==null||l.addEventListener("click",t)}static _detachRowSelectListeners(e,t){Array.from(e.rows).forEach(l=>{let i=a._getCheckboxElement(l);i==null||i.removeEventListener("click",t)})}static _detachRowClickListeners(e,t,l){Array.from(e.rows).forEach(i=>{i.removeEventListener("click",t),i.removeEventListener("dblclick",l)})}static _attachSelectAllListener(e,t){let l=e.rows[e.rows.length-1],i=a._getCheckboxElement(l);if(!i)throw new Error("Checkbox element not found.");i.addEventListener("change",t)}static _tryAttachSelectAllTemplateListener(e,t){let l=e.rows[e.rows.length-1],i=a._tryGetSelectAllCheckboxElement(l);i&&i.addEventListener("change",t)}static _detachSelectAllListener(e,t){let l=e.rows[e.rows.length-1],i=a._tryGetSelectAllCheckboxElement(l);!i||i.removeEventListener("change",t)}static _attachHeadRowMouseDownListener(e,t){let l=e.rows[0];if(!l)throw new Error("Missing table header row. Unable to attach sort listener.");l.addEventListener("mousedown",t)}static _attachHeadRowContextMenuListener(e,t){let l=e.rows[0];if(!l)throw new Error("Missing table header row. Unable to attach sort listener.");l.addEventListener("contextmenu",t)}static _createSelectColumn(e,t,l,i,n,s,r,c,m){e&&a._createHeadSelectColumn(e,l,i,n,s,m),t&&a._createBodySelectColumn(t,s,r,c,m)}static _createHeadSelectColumn(e,t,l,i,n,s){var r;if(Array.from(e.rows).forEach(c=>{let m=document.createElement("th");p([o.classes.TABLE_CELL,o.classes.TABLE_HEAD_CELL],m),c.insertBefore(m,c.cells.item(0))}),t){let c=(r=e.rows.item(e.rows.length-1))==null?void 0:r.cells.item(0);c.classList.add(o.classes.TABLE_CELL_SELECT),typeof l=="function"?a._renderSelectAllTemplate(l,e).then(()=>{typeof i=="function"&&i()}):c==null||c.appendChild(a._createCheckboxElement(!0,n,null,null,null,s))}}static _createBodySelectColumn(e,t,l,i,n){if(a._getNonExpandedRows(e.rows).forEach((r,c)=>a._addRowSelectColumn(r,t,c,l[c],i,n)),e.rows.length){let r=e.rows.item(0);r&&a._updateExpandedRowColspan(e.rows,r.cells.length)}}static _addRowSelectColumn(e,t,l,i,n,s){let r=e.insertCell(0);p([o.classes.TABLE_CELL,o.classes.TABLE_BODY_CELL,o.classes.TABLE_CELL_SELECT],r),r.appendChild(a._createCheckboxElement(!1,t,l,i,n,s))}static _destroySelectColumn(e,t){let l=a._getNonExpandedRows(t.rows);if(Array.from(e.rows).forEach(i=>i.removeChild(i.cells.item(0))),Array.from(l).forEach(i=>i.removeChild(i.cells.item(0))),t.rows.length){let i=t.rows.item(0);i&&a._updateExpandedRowColspan(t.rows,i.cells.length)}}static _hasSelectColumn(e,t){return[...Array.from(e.rows),...Array.from(t.rows)].some(i=>i.cells.item(0).classList.contains(o.classes.TABLE_CELL_SELECT))}static _createCheckboxElement(e,t,l,i,n,s){let r=document.createElement("div");if(r.classList.add(o.classes.TABLE_CELL_SELECT_CHECKBOX_CONTAINER),t)switch(t){case"center":r.classList.add(o.classes.TABLE_CELL_SELECT_CHECKBOX_CONTAINER_ALIGN_CENTER);break;case"left":r.classList.add(o.classes.TABLE_CELL_SELECT_CHECKBOX_CONTAINER_ALIGN_LEFT);break;case"right":r.classList.add(o.classes.TABLE_CELL_SELECT_CHECKBOX_CONTAINER_ALIGN_RIGHT);break}let c=document.createElement(re.elementName),m=document.createElement("input");m.type="checkbox";let d=n||"";i&&typeof n=="function"&&(d=n.call(null,l,i.data));let u=document.createElement("forge-tooltip");return u.position="left",e?u.textContent=s||"":u.textContent=d,m.setAttribute("aria-label","Select row"),c.appendChild(m),r.appendChild(u),r.appendChild(c),r}static _getCheckboxElement(e){let t=e.querySelector(`.${o.classes.TABLE_CELL_SELECT}`);return t?t.querySelector(o.selectors.CHECKBOX_INPUT):null}static _tryGetSelectAllCheckboxElement(e){let t=e.querySelector(`.${o.classes.TABLE_CELL_SELECT}`);return t?t.querySelector(o.selectors.CHECKBOX_INPUT)||t.querySelector(o.selectors.SELECT_ALL_TEMPLATE_CHECKBOX_INPUT):null}static _setSelectedCheckboxState(e,t){e&&(e.checked=t)}static _setIndeterminateCheckboxState(e,t){e&&(e.indeterminate=t)}static _setRowSelectedState(e,t){t?e.classList.contains(o.classes.TABLE_BODY_ROW_SELECTED)||e.classList.add(o.classes.TABLE_BODY_ROW_SELECTED):e.classList.remove(o.classes.TABLE_BODY_ROW_SELECTED)}static _updateExpandedRowColspan(e,t){a._getExpandedRows(e).forEach(i=>{let n=i.cells.item(0);n&&(n.colSpan=t)})}static updateSelectedState(e,t){a._setRowSelectedState(e,t);let l=a._getCheckboxElement(e);l&&a._setSelectedCheckboxState(l,t)}static getRowByIndex(e,t){return a._getNonExpandedRows(e.tBodies[0].rows)[t]}static updateSelectAllState(e,t,l){if(!e.tHead)return;let i=e.tHead.rows[e.tHead.rows.length-1],n=a._tryGetSelectAllCheckboxElement(i);n&&(a._setSelectedCheckboxState(n,t),a._setIndeterminateCheckboxState(n,!!l))}static setSelectedRows(e,t,l,i,n=!1){if(!e.tBodies.length)return;n||a.clearSelectedRows(e);let s=e.tBodies[0].rows,r=0;i.length&&Array.from(s).forEach((c,m)=>{let d=l[m];if(x(i,v(t,d))){a._setRowSelectedState(c,!0);let T=a._getCheckboxElement(c);T&&a._setSelectedCheckboxState(T,!0),r++}}),a.updateSelectAllState(e,r>0&&s.length===r)}static clearSelectedRows(e){if(!e.tBodies.length)return;a._getNonExpandedRows(e.tBodies[0].rows).forEach(l=>{a._setRowSelectedState(l,!1);let i=a._getCheckboxElement(l);i&&a._setSelectedCheckboxState(i,!1)})}static setSortedColumn(e,t,l){let i=a._getHeaderCellByIndex(e,t);a._getSortIconElementFromHeaderCell(i).classList.add(o.classes.TABLE_HEAD_CELL_SORT_ICON_ACTIVE),a._setColumnSortDirection(i,l)}static setMultiSortColumnSortNumber(e,t,l,i){let r=a._getHeaderCellByIndex(e,l).querySelector(`.${o.classes.TABLE_HEAD_CELL_CONTAINER}`).querySelector(`.${o.classes.TABLE_HEAD_CELL_SORT_ORDER}`);r&&($(r,typeof i!="number"||!t,o.classes.TABLE_HEAD_CELL_SORT_ORDER_HIDDEN),i&&(r.textContent=i.toString()))}static removeColumnSort(e,t){let l=a._getHeaderCellByIndex(e,t);l.removeAttribute("aria-sort"),l.classList.contains(o.classes.TABLE_HEAD_CELL_SORTED_ASCENDING)&&l.classList.remove(o.classes.TABLE_HEAD_CELL_SORTED_ASCENDING),l.classList.contains(o.classes.TABLE_HEAD_CELL_SORTED_DESCENDING)&&l.classList.remove(o.classes.TABLE_HEAD_CELL_SORTED_DESCENDING);let i=a._getSortIconElementFromHeaderCell(l);i&&i.classList.contains(o.classes.TABLE_HEAD_CELL_SORT_ICON_ACTIVE)&&i.classList.remove(o.classes.TABLE_HEAD_CELL_SORT_ICON_ACTIVE)}static _getHeaderCellByIndex(e,t){if(!e.tHead)throw new Error("Table head element cannot be null.");return e.tHead.rows.item(0).cells.item(t)}static _getSortIconElementFromHeaderCell(e){return e.querySelector(`.${o.classes.TABLE_HEAD_CELL_SORT_ICON}`)}static setSelectColumnVisibility(e,t,l,i,n,s,r,c,m){let d=e.tHead,u=e.tBodies[0];!d||!u||(t?a._addSelectColumn(d,u,l,i,n,s,r,c,m):a._hasSelectColumn(d,u)&&(l&&a._detachRowSelectListeners(u,l),i&&a._detachSelectAllListener(d,i),a._destroySelectColumn(d,u)))}static _addSelectColumn(e,t,l,i,n,s,r,c,m){a._createSelectColumn(e,t,!!i,n,()=>{i&&a._tryAttachSelectAllTemplateListener(e,i)},s,r,c,m),l&&a._attachRowSelectListeners(t,l),i&&!n&&a._tryAttachSelectAllTemplateListener(e,i)}static setDenseState(e,t){e.classList.contains(o.classes.TABLE_DENSE)&&e.classList.remove(o.classes.TABLE_DENSE),t&&e.classList.add(o.classes.TABLE_DENSE)}static setRoomyState(e,t){e.classList.contains(o.classes.TABLE_ROOMY)&&e.classList.remove(o.classes.TABLE_ROOMY),t&&e.classList.add(o.classes.TABLE_ROOMY)}static setResizable(e){let t=e.tableElement.tHead;e.resizable?(e.tableElement.classList.add(o.classes.TABLE_RESIZABLE),a._addResizeHandles(t,e)):(e.tableElement.classList.remove(o.classes.TABLE_RESIZABLE),a._removeResizeHandles(t,e))}static _addResizeHandles(e,t){if(!e)return;let l=e.rows.item(0);if(l){let i=Array.from(l.cells);t.selectListener&&(i=i.slice(1));for(let n of i){let s=i.indexOf(n);if(t.columnConfigurations[s].resizable!==!1){let c=document.createElement("div");c.classList.add(o.classes.TABLE_RESIZE_HANDLE),n.appendChild(c)}}}}static _removeResizeHandles(e,t){if(!e)return;let l=e.rows.item(0);if(l){let i=Array.from(l.cells);t.selectListener&&(i=i.slice(1));for(let n of i){let s=document.querySelector(`.${o.classes.TABLE_RESIZE_HANDLE}`);s&&n.removeChild(s)}}}static setWrapContentState(e,t){t?e.classList.remove(o.classes.TABLE_NO_WRAP_CONTENT):e.classList.add(o.classes.TABLE_NO_WRAP_CONTENT)}static setSelectAllVisibility(e,t,l,i,n,s){let r=e.tHead;if(!r)return;!t&&l&&a._detachSelectAllListener(r,l);let m=r.rows[r.rows.length-1].cells.item(0);t?m.childElementCount||(m.classList.add(o.classes.TABLE_CELL_SELECT),i?a._renderSelectAllTemplate(i,r).then(()=>{l&&a._tryAttachSelectAllTemplateListener(r,l)}):m.appendChild(a._createCheckboxElement(!0,n||null,null,null,null,s)),l&&!i&&a._attachSelectAllListener(r,l)):(l&&a._detachSelectAllListener(r,l),g(m))}static setFilterRow(e){if(!e.tableElement.tHead)return;let t=a._getFilterRowElement(e.tableElement.tHead),l;if(e.filter?e.tableElement.classList.add(o.classes.TABLE_FILTER_VISIBLE):e.tableElement.classList.remove(o.classes.TABLE_FILTER_VISIBLE),e.filter&&!t){if(e.columnConfigurations.every(n=>!n.filter))return;e.selectListener&&e.selectAllListener&&(l=e.tableElement.tHead.rows[e.tableElement.tHead.rows.length-1].cells.item(0));let i=a._createFilterRowElement(e);i&&l&&Array.from(l.children).forEach(n=>{var s;(s=i.cells.item(0))==null||s.appendChild(n)})}else if(!e.filter&&t){if(e.selectListener&&e.selectAllListener){l=t.cells.item(0);let i=Array.from(e.tableElement.tHead.rows).indexOf(t)-1,n=e.tableElement.tHead.rows.item(i);n&&Array.from(l.children).forEach(s=>{var r;(r=n.cells.item(0))==null||r.appendChild(s)})}W(t)}}static _createFilterRowElement(e){if(!e.tableElement.tHead)throw new Error("Table head element cannot be null.");let t=e.tableElement.tHead.insertRow();if(p([o.classes.TABLE_ROW,o.classes.TABLE_HEAD_ROW_FILTER],t),e.selectListener){let l=document.createElement("th");p([o.classes.TABLE_CELL,o.classes.TABLE_HEAD_CELL],l),t.insertBefore(l,t.cells[0]),l.classList.add(o.classes.TABLE_CELL_SELECT)}return e.columnConfigurations.forEach((l,i)=>{let n=document.createElement("th");if(p([o.classes.TABLE_CELL,o.classes.TABLE_HEAD_CELL],n),l.filter&&L(l.filterDelegate)){let s=document.createElement("div");s.classList.add(o.classes.TABLE_HEAD_CELL_CONTAINER),l.align&&a._setCellAlignmentClass(s,l.align);let r=a._createFilterElement(l,i,e.filterListener);s.appendChild(r),n.appendChild(s)}t.appendChild(n)}),t}static _createFilterElement(e,t,l){let i;if(H(e.filterDelegate))i=e.filterDelegate();else if(e.filterDelegate instanceof Y||e.filterDelegate instanceof le)i=e.filterDelegate;else throw new Error("Invalid filter delegate.");if(!!l&&i instanceof Y&&H(i.onChange))if(!L(e.filterDebounceTime)||y(e.filterDebounceTime)){let n=L(e.filterDebounceTime)?e.filterDebounceTime:o.numbers.DEFAULT_FILTER_DEBOUNCE_TIME;i.onChange(Z(s=>l(s,t),n))}else i.onChange(n=>l(n,t));return i.element}static _getFilterRowElement(e){if(!!e)return Array.from(e.rows).find(t=>t.classList.contains(o.classes.TABLE_HEAD_ROW_FILTER))}static async expandRow(e,t,l){let i=e.tableElement.tBodies[0],s=a._getNonExpandedRows(i.rows)[t];s.classList.add(o.classes.TABLE_ROW_EXPANDED);let r=Array.from(i.rows).indexOf(s),c=i.insertRow(r+1);p([o.classes.TABLE_ROW,o.classes.TABLE_BODY_ROW,o.classes.TABLE_ROW_EXPANDABLE_CONTENT],c);let m=c.insertCell();m.setAttribute("colspan",s.cells.length.toString()),m.classList.add(o.classes.TABLE_ROW_EXPANDABLE_CONTENT_CELL);let d=document.createElement("div"),u=document.createElement(M.elementName);u.appendChild(d),m.appendChild(u);let T=l;if(H(l)){let ue=e.data[t]?e.data[t].data:void 0,Ee=l(t,d,ue);try{let A=await Promise.resolve(Ee);T=me(A)?A.content:A}catch(A){console.error("Failed to load row template "+A.message),T=""}}T&&a._setRowTemplate(d,T),window.requestAnimationFrame(()=>u.open=!0)}static _setRowTemplate(e,t){G(t)?e.innerHTML=t:e.appendChild(t)}static collapseRow(e,t){if(!e.tableElement||!e.tableElement.tBodies.length||!e.tableElement.tBodies[0].rows.length)return Promise.resolve();let l=e.tableElement.tBodies[0],n=a._getNonExpandedRows(l.rows)[t],s=Array.from(l.rows).indexOf(n);if(n&&n.classList.contains(o.classes.TABLE_ROW_EXPANDED)){let r=l.rows[s+1],c=r.querySelector(M.elementName);if(c&&c.open)return c.open=!1,new Promise(m=>{setTimeout(()=>{n.classList.remove(o.classes.TABLE_ROW_EXPANDED),W(r),m()},M.numbers.COLLAPSE_ANIMATION_DURATION)})}return Promise.resolve()}static isRowExpanded(e,t){let l=e.tableElement.tBodies[0],n=a._getNonExpandedRows(l.rows)[t];return n&&n.classList.contains(o.classes.TABLE_ROW_EXPANDED)}static setFixedHeaders(e){e.fixedHeaders?e.tableElement.classList.add(o.classes.TABLE_FIXED):e.tableElement.classList.remove(o.classes.TABLE_FIXED)}static setLayoutType(e){e.layoutType==="fixed"?e.tableElement.classList.add(o.classes.TABLE_LAYOUT_FIXED):e.tableElement.classList.remove(o.classes.TABLE_LAYOUT_FIXED)}static normalizeColumnWidths(e){let t=e.tableElement;if(t.tHead&&t.tHead.rows.length){let l=Array.from(t.tHead.rows[0].cells);for(let i of l){let n=getComputedStyle(i).width;i.style.width&&i.style.width!==n&&(i.style.width=n)}}}static setColumnResizeIndicatorVisibility(e,t,l){let i=e.tableElement;if(i.tHead&&i.tHead.rows.length){let n=Array.from(i.tHead.rows);for(let s of n){let r=s.cells[t];r&&(l?r.classList.add(o.classes.TABLE_CELL_RESIZABLE):r.classList.remove(o.classes.TABLE_CELL_RESIZABLE))}}if(i.tBodies.length){let n=Array.from(i.tBodies[0].rows);for(let s of n){let r=s.cells[t];r&&(l?r.classList.add(o.classes.TABLE_CELL_RESIZABLE):r.classList.remove(o.classes.TABLE_CELL_RESIZABLE))}}}static setRowClickListeners(e,t,l,i){let n=e.tBodies[0];!n||(t?a._attachRowClickListeners(n,l,i):a._detachRowClickListeners(n,l,i))}static setRowClickAttributes(e,t){let l=e.tBodies[0];!l||(t?a._addRowClickAttributes(l):a._removeRowClickAttributes(l))}static getOwnerDocument(e){return e.ownerDocument||document}static _prepend(e,t){let l=t.childNodes.item(0);l?t.insertBefore(e,l):t.appendChild(e)}static _isMac(){return!!(navigator&&navigator.platform&&navigator.platform.substr(0,3)==="Mac")}static _renderSelectAllTemplate(e,t){return Promise.resolve(e()).then(l=>{let i=t.rows.item(t.rows.length-1);if(!i)return;let n=i.cells.item(0);l&&n&&(typeof l=="string"?n.innerHTML=l:l instanceof HTMLElement&&n.appendChild(l),n.setAttribute(o.attributes.CUSTOM_CELL_TEMPLATE,""))})}};var N=class extends U{constructor(t){super(t)}initialize(){this._tableElement||(this._tableElement=document.createElement("table"),this._tableElement.classList.add(o.classes.TABLE),this._component.children.length&&g(this._component),this._component.appendChild(this._tableElement))}getTableElement(){return this._tableElement||this.initialize(),this._tableElement}createTable(t){return a.createTable(t)}recreateTableBody(t){a.recreateTableBody(t)}setSelectedRows(t,l,i,n,s=!1){a.setSelectedRows(t,l,i,n,s)}clearSelectedRows(t){a.clearSelectedRows(t)}updateSelectedState(t,l){a.updateSelectedState(t,l)}updateSelectAllState(t,l,i){a.updateSelectAllState(t,l,i)}setSortedColumn(t,l,i){a.setSortedColumn(t,l,i)}removeColumnSort(t,l){a.removeColumnSort(t,l)}setSortDirection(t,l,i){a.setSortDirection(t,l,i)}setSelectColumnVisibility(t,l,i,n,s,r,c,m,d){a.setSelectColumnVisibility(t,l,i,n||null,s||null,r||null,c||[],m||null,d||null)}setDense(t,l){a.setDenseState(t,l)}setRoomy(t,l){a.setRoomyState(t,l)}setResizable(t){a.setResizable(t)}setSelectAllVisibility(t,l,i,n,s,r=null){a.setSelectAllVisibility(t,l,i,n,s||null,r||null)}setFilterRow(t){a.setFilterRow(t)}expandRow(t,l,i){return a.expandRow(t,l,i)}collapseRow(t,l){return a.collapseRow(t,l)}isRowExpanded(t,l){return a.isRowExpanded(t,l)}setFixedHeaders(t){a.setFixedHeaders(t)}setTableLayoutType(t){a.setLayoutType(t)}setWrapContentState(t){a.setWrapContentState(t.tableElement,t.wrapContent)}addDocumentListener(t,l){a.getOwnerDocument(this._component).addEventListener(t,l)}removeDocumentListener(t,l){a.getOwnerDocument(this._component).removeEventListener(t,l)}normalizeColumnWidths(t){a.normalizeColumnWidths(t)}setResizeColumnVisibility(t,l,i){a.setColumnResizeIndicatorVisibility(t,l,i)}addTableClass(t){p(t,this._tableElement)}removeTableClass(t){D(t,this._tableElement)}setRowClickListeners(t,l,i,n){a.setRowClickListeners(t,l,i,n)}setRowClickAttributes(t,l){a.setRowClickAttributes(t,l)}};var k=class{constructor(){this._sortedColumns=[]}get sortedColumns(){return[...this._sortedColumns.map(e=>C({},e))]}addSortColumn(e){this._sortedColumns.push(C({},e)),this._updateSortNumbers()}updateSortColumn(e){let t=this._sortedColumns.find(l=>l.columnIndex===e.columnIndex);if(t)switch(t.direction){case"ASC":this.removeSortColumn(e);break;case"DESC":t.direction="ASC";break;case"UNSET":t.direction="DESC";break}}setSortColumns(e){this._sortedColumns=[...e.map(t=>C({},t))]}removeSortColumn(e){typeof e=="number"?this._sortedColumns.splice(e,1):this._sortedColumns.splice(this._sortedColumns.indexOf(e),1),this._updateSortNumbers()}isSortColumn(e){return typeof e=="number"?this._sortedColumns.some(t=>t.columnIndex===e):this._sortedColumns.includes(e)}clearMultiSort(){this._sortedColumns=[]}getSortColumn(e){return this._sortedColumns.find(t=>t.columnIndex===e)}_updateSortNumbers(){this._sortedColumns.every(e=>typeof e.sortOrder=="number")&&this._sortedColumns.sort((e,t)=>e.sortOrder-t.sortOrder),this._sortedColumns.forEach((e,t)=>e.sortOrder=t+1)}};var P=class{constructor(e,t=!1){this.data=e;this.selected=t}};var z=class{constructor(e){this._adapter=e;this._tableRows=[];this._data=[];this._columnConfigurations=[];this._select=!1;this._multiselect=!0;this._dense=!1;this._roomy=!1;this._filter=!1;this._fixedHeaders=!1;this._layoutType=o.strings.DEFAULT_LAYOUT_TYPE;this._wrapContent=!0;this._resizable=!1;this._minResizeWidth=o.numbers.MIN_RESIZE_WIDTH;this._multiColumnSort=!1;this._selectCheckboxAlignment="center";this._isAllSelected=!1;this._sortedColumnIndex=-1;this._rendered=!1;this._allowRowClick=!1;this._multiSortManager=new k;this._rowClickListener=t=>this._onRowClick(t),this._rowDoubleClickListener=t=>this._onRowDoubleClick(t),this._selectRowListener=t=>this._onRowSelected(t),this._selectAllListener=t=>this._onSelectAll(t),this._sortableHeadCellKeydownListener=t=>this._onSortableHeadCellKeydown(t),this._headRowMouseDownListener=t=>this._onHeadRowMouseDown(t),this._headRowContextMenuListener=t=>this._onHeadRowContextMenu(t),this._documentMouseMoveListener=t=>this._onMouseMove(t),this._documentMouseUpListener=t=>this._onMouseUp(t),this._filterListener=(t,l)=>this._onFilter(t,l),this._selectionManager=new I(this._selectKey),this._hiddenColumnManager=new I}initialize(){this.connect(),this._adapter.setHostAttribute(o.attributes.SELECT,this._select.toString()),this._adapter.setHostAttribute(o.attributes.MULTISELECT,this._multiselect.toString()),this._adapter.setHostAttribute(o.attributes.DENSE,this._dense.toString()),this._adapter.setHostAttribute(o.attributes.ROOMY,this._roomy.toString()),this._adapter.setHostAttribute(o.attributes.FILTER,this._filter.toString()),this._adapter.emitHostEvent(o.events.INITIALIZED,void 0,!1)}connect(){this._adapter.initialize()}disconnect(){this._resizeDescriptor=void 0,this._adapter.removeDocumentListener("mousemove",this._documentMouseMoveListener),this._adapter.removeDocumentListener("mouseup",this._documentMouseUpListener)}set data(e){Array.isArray(e)&&e.length>0?w(e[0])?this._data=e.map(t=>C({},t)):this._data=[...e]:this._data=[],this._tableRows=this._data.map(t=>new P(t,this._selectionManager.exists(t))),this._renderBody()}get data(){return this._data.map(e=>C({},e))}set columnConfigurations(e){this._columnConfigurations=e.map(t=>C({},t)),this._hiddenColumnManager.clear(),this._columnConfigurations.forEach(t=>{t.hidden&&this._hiddenColumnManager.add(t)}),this._refreshTableSort(),this.render()}get columnConfigurations(){return this._columnConfigurations.map(e=>C({},e))}get _visibleColumnConfigurations(){return this._columnConfigurations.filter(e=>!this._hiddenColumnManager.exists(e))}get _tableConfiguration(){return{tableElement:this._adapter.getTableElement(),columnConfigurations:this._visibleColumnConfigurations,data:this._tableRows,clickListener:this._allowRowClick?this._rowClickListener:null,doubleClickListener:this._allowRowClick?this._rowDoubleClickListener:null,selectListener:this._select?this._selectRowListener:null,selectAllListener:this._multiselect?this._selectAllListener:null,sortableHeadCellKeydownListener:this._sortableHeadCellKeydownListener,headRowMouseDownListener:this._headRowMouseDownListener,headRowContextMenuListener:this._headRowContextMenuListener,filterListener:this._filter?this._filterListener:null,sortDirection:this._sortDirection,sortedColumn:this._sortedColumnIndex,multiColumnSort:this._multiColumnSort,filter:this._filter,wrapContent:this._wrapContent,fixedHeaders:this._fixedHeaders,layoutType:this._layoutType,dense:this._dense,resizable:this._resizable,rowCreatedCallback:this._rowCreatedCallback,cellCreatedCallback:this._cellCreatedCallback,selectAllTemplate:this._selectAllTemplate,selectCheckboxAlignment:this._selectCheckboxAlignment,tooltipSelect:this._tooltipSelect,tooltipSelectAll:this._tooltipSelectAll}}set select(e){this._select!==e&&(this._select=e,this._adapter.setSelectColumnVisibility(this._adapter.getTableElement(),this._select,this._selectRowListener,this._multiselect?this._selectAllListener:void 0,this._multiselect?this._selectAllTemplate:null,this._selectCheckboxAlignment,this._tableRows,this._tooltipSelect,this._tooltipSelectAll),this._updateSelections(!0),this._select?this._adapter.setHostAttribute(o.attributes.SELECT,this._select.toString()):this._adapter.removeHostAttribute(o.attributes.SELECT))}get select(){return this._select}set multiselect(e){this._multiselect!==e&&(this._multiselect=e,this._select&&(this._adapter.setSelectAllVisibility(this._adapter.getTableElement(),this._multiselect,this._multiselect?this._selectAllListener:null,this._multiselect?this.selectAllTemplate:null,this._selectCheckboxAlignment,this._tooltipSelectAll),this._updateSelections(!0)),this._adapter.setHostAttribute(o.attributes.MULTISELECT,this._multiselect.toString()))}get multiselect(){return this._multiselect}get selectKey(){return Array.isArray(this._selectKey)?[...this._selectKey]:this._selectKey}set selectKey(e){this._originalSelectKey!==e&&(Array.isArray(e)?(this._originalSelectKey=[...e],this._selectKey=[...e]):(this._originalSelectKey=e,this._selectKey=[e]),this._selectionManager.setKey(this._selectKey),this._updateSelections(!1))}get dense(){return this._dense}set dense(e){this._dense!==e&&(this._dense=e,this._adapter.setDense(this._adapter.getTableElement(),this._dense),this._adapter.setHostAttribute(o.attributes.DENSE,this._dense.toString()))}get roomy(){return this._roomy}set roomy(e){e!==this._roomy&&(this._roomy=e,this._applyRoomy())}set filter(e){this._filter!==e&&(this._filter=e,this._adapter.setFilterRow(this._tableConfiguration),this._adapter.setHostAttribute(o.attributes.FILTER,this._filter.toString()))}get filter(){return this._filter}set fixedHeaders(e){this._fixedHeaders!==e&&(this._fixedHeaders=e,this._adapter.setFixedHeaders(this._tableConfiguration))}get fixedHeaders(){return this._fixedHeaders}get layoutType(){return this._layoutType}set layoutType(e){this._layoutType!==e&&(this._layoutType=e,this._adapter.setTableLayoutType(this._tableConfiguration))}get wrapContent(){return this._wrapContent}set wrapContent(e){this._wrapContent!==e&&(this._wrapContent=e,this._adapter.setWrapContentState(this._tableConfiguration))}get resizable(){return this._resizable}set resizable(e){this._resizable!==e&&(this._resizable=e,this._adapter.setResizable(this._tableConfiguration))}get minResizeWidth(){return this._minResizeWidth}set minResizeWidth(e){this._minResizeWidth!==e&&(this._minResizeWidth=e,y(this._minResizeWidth)?this._minResizeWidth<0&&(this._minResizeWidth=0):this._minResizeWidth=o.numbers.MIN_RESIZE_WIDTH)}get allowRowClick(){return this._allowRowClick}set allowRowClick(e){this._allowRowClick!==e&&(this._allowRowClick=e,this._rendered&&(this._adapter.setRowClickListeners(this._adapter.getTableElement(),this._allowRowClick,this._rowClickListener,this._rowDoubleClickListener),this._adapter.setRowClickAttributes(this._adapter.getTableElement(),this._allowRowClick)))}get multiColumnSort(){return this._multiColumnSort}set multiColumnSort(e){e!==this._multiColumnSort&&(this._multiColumnSort=e,this._refreshTableSort(),this.render())}get selectCheckboxAlignment(){return this._selectCheckboxAlignment}set selectCheckboxAlignment(e){e!==this._selectCheckboxAlignment&&(this._selectCheckboxAlignment=e,this._adapter.setHostAttribute(o.attributes.SELECT_CHECKBOX_ALIGNMENT,e),this.render())}get tooltipSelect(){return this._tooltipSelect}set tooltipSelect(e){e!==this._tooltipSelect&&(this._tooltipSelect=e,typeof e=="string"&&this._adapter.setHostAttribute(o.attributes.TOOLTIP_SELECT,e),this.render())}get tooltipSelectAll(){return this._tooltipSelectAll}set tooltipSelectAll(e){e!==this._tooltipSelectAll&&(this._tooltipSelectAll=e,this._adapter.setHostAttribute(o.attributes.TOOLTIP_SELECT_ALL,e),this.render())}get selectAllTemplate(){return this._selectAllTemplate}set selectAllTemplate(e){e!==this._selectAllTemplate&&(this._selectAllTemplate=e,this.render())}get rowCreated(){return this._rowCreatedCallback}set rowCreated(e){this._rowCreatedCallback=e}get cellCreated(){return this._cellCreatedCallback}set cellCreated(e){this._cellCreatedCallback=e}isRowSelected(e){let t=v(Array.isArray(this._selectKey)?this._selectKey:[this._selectKey],e);return this.selectKey?!!this._selectionManager.getItems().find(l=>X(l,t)):this._selectionManager.exists(e)}getSelectedRows(){return this._selectionManager.getItems()}selectRows(e,t){if(!this._selectKey)throw new Error("You must set a selectKey to select rows.");(!this._multiselect||t)&&this.clearSelections(),e&&e.length&&(this._selectionManager.add(e),this._updateSelections(!t))}deselectRows(e){e&&e.length&&(this._selectionManager.remove(e),this._updateSelections(!1))}clearSelections(){let e=this._adapter.getTableElement();this._selectionManager.clear(),this._tableRows.forEach(t=>t.selected=!1),this._isAllSelected=!1,this._adapter.clearSelectedRows(e),this._select&&this._multiselect&&this._adapter.updateSelectAllState(e,!1)}hideColumn(e){let t=this._columnConfigurations[e];this._sortedColumnIndex===e&&(this._sortedColumnIndex=-1),this._hiddenColumnManager.exists(t)||(this._hiddenColumnManager.add(t),this.render())}showColumn(e){let t=this._columnConfigurations[e];this._hiddenColumnManager.exists(t)&&(this._hiddenColumnManager.remove(t),this.render())}isColumnHidden(e){let t=this._columnConfigurations[e];return!!t&&this._hiddenColumnManager.exists(t)}render(){this._adapter.createTable(this._tableConfiguration),this._renderSelections(),this._rendered=!0}_renderBody(){!this._rendered||(this._adapter.recreateTableBody(this._tableConfiguration),this._renderSelections())}_renderSelections(){this.select&&(this._isAllSelected=this._getSelectAllState(),this._multiselect&&this._adapter.updateSelectAllState(this._adapter.getTableElement(),this._isAllSelected,this._isIndeterminate(this._isAllSelected)));let e=this._selectionManager.getItems();e.length&&this._adapter.setSelectedRows(this._adapter.getTableElement(),this._selectKey,this._data,e,!1)}expandRow(e,t){if(!this._rendered)throw new Error("Cannot expand a row before the table has rendered.");if(e<0||e>this._tableRows.length)throw new Error(`Invalid row index: ${e}.`);return this._adapter.expandRow(this._tableConfiguration,e,t)}collapseRow(e){return!this._rendered||e<0||e>this._tableRows.length?Promise.resolve():this._adapter.collapseRow(this._tableConfiguration,e)}isRowExpanded(e){return this._adapter.isRowExpanded(this._tableConfiguration,e)}selectRowsByIndex(e,t){let l=e.map(i=>this._data[i]).filter(i=>!!i);this.selectRows(l,!t)}deselectRowsByIndex(e){let t=e.map(l=>this._data[l]).filter(l=>!!l);this.deselectRows(t)}_getSelectAllState(){return this._tableRows.length>0&&this._tableRows.every(e=>e.selected)}_updateSelections(e){this._tableRows.forEach(l=>l.selected=this._selectionManager.exists(l.data));let t=this._getSelectAllState();this._adapter.setSelectedRows(this._adapter.getTableElement(),this._selectKey,this._data,this._selectionManager.getItems(),e),(t!==this._isAllSelected||this._isIndeterminate(t))&&(this._isAllSelected=t,this._multiselect&&this._adapter.updateSelectAllState(this._adapter.getTableElement(),this._isAllSelected,this._isIndeterminate(this._isAllSelected)))}_onRowClick(e){if(e.stopImmediatePropagation(),e.target.tagName==="INPUT"&&e.target.type==="checkbox")return;let i=R(e).filter(m=>m.nodeType===1).find(m=>m.hasAttribute(o.attributes.CUSTOM_CELL_TEMPLATE));if(i&&i.hasAttribute(o.attributes.CUSTOM_CELL_TEMPLATE_STOP_PROPAGATION))return;let{index:s,data:r}=this._getSelectedRowFromEvent(e),c={index:s,data:r};this._adapter.emitHostEvent(o.events.ROW_CLICK,c,!0,!1)}_onRowDoubleClick(e){if(e.stopPropagation(),e.target.tagName==="INPUT"&&e.target.type==="checkbox")return;let t=this._getSelectedRowFromEvent(e),l={index:t.index,data:t.data};this._adapter.emitHostEvent(o.events.SELECT_DOUBLE,l,!0,!1)}_onRowSelected(e){let t=this._getSelectedRowFromEvent(e);this._multiselect||this._tableRows.filter(r=>r.selected).forEach(r=>{X(r.data,v(this._selectKey,t.data))||this.deselectRows([r.data])});let l=!this._selectionManager.exists(t.data);this._adapter.updateSelectedState(t.rowElement,l),l?this._selectionManager.add(t.data):this._selectionManager.remove(t.data),this._tableRows[t.index].selected=l;let i=[t.index],n=!1;if(this._multiselect){if(e.shiftKey&&this._previouslyClickedRow&&(i=this._shiftSelectRows(t),i.includes(this._previouslyClickedRow.index))){let r=i.indexOf(this._previouslyClickedRow.index);i.splice(r,1)}n=this._getSelectAllState(),this._adapter.updateSelectAllState(this._adapter.getTableElement(),n,this._isIndeterminate(n))}for(let s of i){let r=this._tableRows[s].data,m={selected:this._selectionManager.exists(r),index:s,data:r};this._adapter.emitHostEvent(o.events.SELECT,m,!0,!1)}if(this._isAllSelected!==n){this._isAllSelected=n;let s={status:this._isAllSelected,count:this._tableRows.filter(r=>r.selected).length,data:[...this._data],targetType:"row"};this._adapter.emitHostEvent(o.events.SELECT_ALL,s,!0,!1)}this._previouslyClickedRow=C({},t)}_getSelectedRowFromEvent(e){let l=R(e).find(r=>r.tagName==="TR"),i=l.parentElement,n=this._getNonExpandedRows(i).findIndex(r=>r===l),s=this._tableRows[n].data;return{rowElement:l,index:n,data:s}}_getNonExpandedRows(e){return Array.from(e.rows).filter(t=>!t.classList.contains(o.classes.TABLE_ROW_EXPANDABLE_CONTENT))}_onSelectAll(e){e.stopPropagation(),this._isAllSelected=!this._isAllSelected;let t=this._adapter.getTableElement();this._adapter.updateSelectAllState(t,this._isAllSelected),this._tableRows.forEach((i,n)=>{i.selected=this._isAllSelected,this._isAllSelected?this._selectionManager.add(i.data):this._selectionManager.remove(i.data);let s=a.getRowByIndex(t,n);s&&this._adapter.updateSelectedState(s,this._isAllSelected)});let l={status:this._isAllSelected,count:this._tableRows.filter(i=>i.selected).length,data:[...this._data],targetType:"select-all"};this._adapter.emitHostEvent(o.events.SELECT_ALL,l,!0,!1)}_onHeadRowContextMenu(e){e.ctrlKey&&e.preventDefault()}_onHeadRowMouseDown(e){if(e.button!==0)return;let t=R(e),l=e.target,i=t.find(r=>r.tagName==="TR"),n=t.find(r=>r.tagName==="TH"),s=Array.from(i.cells).findIndex(r=>r===n);this._headCellMouseDownIndex=s,l!==n&&l.classList.contains(o.classes.TABLE_RESIZE_HANDLE)&&(this._resizeDescriptor={element:n,startWidth:n.offsetWidth,startX:e.pageX,width:n.offsetWidth,index:this._select?s-1:s},this._adapter.addDocumentListener("mousemove",this._documentMouseMoveListener),this._adapter.setResizeColumnVisibility(this._tableConfiguration,s,!0)),this._adapter.addDocumentListener("mouseup",this._documentMouseUpListener)}_onMouseMove(e){if(this._resizeDescriptor){let t=this._resizeDescriptor.startWidth+(e.pageX-this._resizeDescriptor.startX);t<this._minResizeWidth&&(t=this._minResizeWidth),this._resizeDescriptor.width=t,this._resizeDescriptor.element.style.width=`${t}px`,this._adapter.addTableClass(o.classes.TABLE_RESIZING)}}_onMouseUp(e){if(this._adapter.removeDocumentListener("mousemove",this._documentMouseMoveListener),this._adapter.removeDocumentListener("mouseup",this._documentMouseUpListener),this._adapter.removeTableClass(o.classes.TABLE_RESIZING),this._headCellMouseDownIndex!==void 0){if(this._resizeDescriptor){this._adapter.normalizeColumnWidths(this._tableConfiguration),this._adapter.setResizeColumnVisibility(this._tableConfiguration,this._headCellMouseDownIndex,!1);let t={index:this._resizeDescriptor.index,width:this._resizeDescriptor.width};this._adapter.emitHostEvent(o.events.COLUMN_RESIZE,t),this._resizeDescriptor=void 0}else this._tableConfiguration.tableElement.tHead.contains(e.target)&&(this._multiColumnSort?this._onMultiSort(this._headCellMouseDownIndex,e.ctrlKey):this._onSort(this._headCellMouseDownIndex));this._headCellMouseDownIndex=void 0}}_onSortableHeadCellKeydown(e){if(e.key===" "||e.key==="Enter"){let t=R(e),l=t.find(s=>s.tagName==="TR"),i=t.find(s=>s.tagName==="TH"),n=Array.from(l.cells).findIndex(s=>s===i);this._onSort(n)}}_onSort(e){let t=this._select?e-1:e,l=t>=0?this._visibleColumnConfigurations[t]:null;if(!l||!l.sortable)return;let i="ASC",n=t===this._sortedColumnIndex,s=this._sortDirection==="ASC"||this._sortDirection===void 0,r=n&&this._sortDirection==="DESC";n&&s&&(i="DESC"),r&&!l.preventUnsort&&(i="UNSET");let c={direction:i,columnIndex:t};if(!!this._adapter.emitHostEvent(o.events.SORT,c,!0,!0)){if(n&&this._sortDirection==="DESC"&&!l.preventUnsort){this._adapter.removeColumnSort(this._adapter.getTableElement(),this._select?this._sortedColumnIndex+1:this._sortedColumnIndex),this._sortedColumnIndex=-1;return}this._sortDirection=i,t===this._sortedColumnIndex?this._adapter.setSortDirection(this._adapter.getTableElement(),e,this._sortDirection):(this._sortedColumnIndex>=0&&this._adapter.removeColumnSort(this._adapter.getTableElement(),this._select?this._sortedColumnIndex+1:this._sortedColumnIndex),this._sortedColumnIndex=t,this._adapter.setSortedColumn(this._adapter.getTableElement(),e,this._sortDirection))}}_onMultiSort(e,t){let l=this._select?e-1:e,i=l>=0?this._visibleColumnConfigurations[l]:null;if(!i||!i.sortable)return;let n=this._multiSortManager.sortedColumns,s=this._multiSortManager.getSortColumn(l);s?this._multiSortManager.updateSortColumn(s):t?this._multiSortManager.addSortColumn({direction:"DESC",columnIndex:l,propertyName:i.property}):(this._multiSortManager.clearMultiSort(),this._multiSortManager.addSortColumn({direction:"DESC",columnIndex:l,propertyName:i.property}));let r=this._multiSortManager.sortedColumns.map(d=>C({},d));if(!this._adapter.emitHostEvent(o.events.SORT,r,!0,!0)){this._multiSortManager.setSortColumns(n);return}let m=this._multiSortManager.sortedColumns.length>1;for(let d=0;d<this._visibleColumnConfigurations.length;d++){let u=this._select?d+1:d;if(!this._multiSortManager.isSortColumn(d))this._adapter.removeColumnSort(this._adapter.getTableElement(),u),a.setMultiSortColumnSortNumber(this._adapter.getTableElement(),m,u,null);else{let T=this._multiSortManager.getSortColumn(d);T&&(this._adapter.setSortedColumn(this._adapter.getTableElement(),u,T.direction),a.setMultiSortColumnSortNumber(this._adapter.getTableElement(),m,u,T.sortOrder||null))}}}_onFilter(e,t){let l={value:e,columnIndex:t};this._adapter.emitHostEvent(o.events.FILTER,l,!0,!1)}_shiftSelectRows(e){let t=[];if(this._previouslyClickedRow){let l=this._previouslyClickedRow.index,i=e.index,n=i>=l?l:i,s=i>=l?i:l;s+=s>n?1:0,n+=n>s?1:0;let r=d=>this.selectRows(d,!1),c=this._tableRows.find(d=>d.selected&&d.data===e.data),m=this._tableRows.find(d=>{var u;return d.data===((u=this._previouslyClickedRow)==null?void 0:u.data)&&!d.selected});(!c||m)&&(r=d=>this.deselectRows(d));for(let d=n;d<s;d++)t.push(d);r(this.data.filter((d,u)=>t.includes(u)))}return t}_isIndeterminate(e){return!e&&this.getSelectedRows().length>0&&this._data.length!==this.getSelectedRows().length}_applyRoomy(){this._adapter.setRoomy(this._adapter.getTableElement(),this._roomy),this._adapter.setHostAttribute(o.attributes.ROOMY,this._roomy.toString())}_refreshTableSort(){if(this._sortedColumnIndex=this._visibleColumnConfigurations.findIndex(e=>e.initialSort),this._sortedColumnIndex>=0&&this._sortDirection===void 0){let e=this._visibleColumnConfigurations[this._sortedColumnIndex];e.initialSort===!0&&e.sortDirection?this._sortDirection=e.sortDirection:typeof e.initialSort=="object"&&e.initialSort.direction&&(this._sortDirection=e.initialSort.direction)}if(this._multiColumnSort){let e=[];this._visibleColumnConfigurations.forEach((t,l)=>{typeof t.initialSort=="object"&&e.push({columnIndex:l,direction:t.initialSort.direction,sortOrder:t.initialSort.sortOrder,propertyName:t.property})}),this._multiSortManager.setSortColumns(e)}}};var E=class extends Q{constructor(){super();oe.define(te),this._foundation=new z(new N(this))}static get observedAttributes(){return[o.attributes.SELECT,o.attributes.MULTISELECT,o.attributes.SELECT_KEY,o.attributes.DENSE,o.attributes.ROOMY,o.attributes.FILTER,o.attributes.FIXED_HEADERS,o.attributes.LAYOUT_TYPE,o.attributes.WRAP_CONTENT,o.attributes.RESIZABLE,o.attributes.MIN_RESIZE_WIDTH,o.attributes.ALLOW_ROW_CLICK,o.attributes.MULTI_COLUMN_SORT,o.attributes.SELECT_CHECKBOX_ALIGNMENT,o.attributes.TOOLTIP_SELECT,o.attributes.TOOLTIP_SELECT_ALL]}initializedCallback(){this._foundation.initialize()}connectedCallback(){this._foundation.connect()}disconnectedCallback(){this._foundation.disconnect()}attributeChangedCallback(t,l,i){switch(t){case o.attributes.SELECT:this.select=h(i);break;case o.attributes.MULTISELECT:this.multiselect=h(i);break;case o.attributes.SELECT_KEY:this.selectKey=i;break;case o.attributes.DENSE:this.dense=h(i);break;case o.attributes.ROOMY:this.roomy=h(i);break;case o.attributes.FILTER:this.filter=h(i);break;case o.attributes.FIXED_HEADERS:this.fixedHeaders=h(i);break;case o.attributes.LAYOUT_TYPE:this.layoutType=i;break;case o.attributes.WRAP_CONTENT:this.wrapContent=h(i);break;case o.attributes.RESIZABLE:this.resizable=h(i);break;case o.attributes.MIN_RESIZE_WIDTH:this.minResizeWidth=V(i);break;case o.attributes.ALLOW_ROW_CLICK:this.allowRowClick=h(i);break;case o.attributes.MULTI_COLUMN_SORT:this.multiColumnSort=h(i);break;case o.attributes.SELECT_CHECKBOX_ALIGNMENT:this.selectCheckboxAlignment=this.getAttribute(o.attributes.SELECT_CHECKBOX_ALIGNMENT)||"center";break;case o.attributes.TOOLTIP_SELECT:this.tooltipSelect=i;break;case o.attributes.TOOLTIP_SELECT_ALL:this.tooltipSelectAll=i;break}}hideColumn(t){this._foundation.hideColumn(t)}showColumn(t){this._foundation.showColumn(t)}isColumnHidden(t){return this._foundation.isColumnHidden(t)}getSelectedRows(){return this._foundation.getSelectedRows()}selectRow(t){this._foundation.selectRows([t],!1)}selectRows(t,l=!1){this._foundation.selectRows(t,!l)}deselectRow(t){this._foundation.deselectRows([t])}deselectRows(t){this._foundation.deselectRows(t)}clearSelections(){this._foundation.clearSelections()}render(){this._foundation.render()}expandRow(t,l){return this._foundation.expandRow(t,l)}collapseRow(t){return this._foundation.collapseRow(t)}isRowExpanded(t){return this._foundation.isRowExpanded(t)}selectRowsByIndex(t,l){typeof t=="number"?this._foundation.selectRowsByIndex([t],l):Array.isArray(t)&&this._foundation.selectRowsByIndex(t,l)}deselectRowsByIndex(t){typeof t=="number"?this._foundation.deselectRowsByIndex([t]):Array.isArray(t)&&this._foundation.deselectRowsByIndex(t)}isRowSelected(t){return this._foundation.isRowSelected(t)}};_([b()],E.prototype,"data",2),_([b()],E.prototype,"columnConfigurations",2),_([b()],E.prototype,"select",2),_([b()],E.prototype,"multiselect",2),_([b()],E.prototype,"selectKey",2),_([b()],E.prototype,"tooltipSelect",2),_([b()],E.prototype,"tooltipSelectAll",2),_([b()],E.prototype,"dense",2),_([b()],E.prototype,"roomy",2),_([b()],E.prototype,"filter",2),_([b()],E.prototype,"fixedHeaders",2),_([b()],E.prototype,"layoutType",2),_([b()],E.prototype,"wrapContent",2),_([b()],E.prototype,"resizable",2),_([b()],E.prototype,"minResizeWidth",2),_([b()],E.prototype,"allowRowClick",2),_([b()],E.prototype,"multiColumnSort",2),_([b()],E.prototype,"rowCreated",2),_([b()],E.prototype,"cellCreated",2),_([b()],E.prototype,"selectAllTemplate",2),_([b()],E.prototype,"selectCheckboxAlignment",2),E=_([J({name:o.elementName,dependencies:[ne,se,ce]})],E);function El(){j(E)}export{o as a,B as b,O as c,Le as d,N as e,P as f,z as g,E as h,El as i};
7
+ //# sourceMappingURL=chunk.OLNY6ZNB.js.map