import*as e from"../../../../core/common/common.js";import*as t from"../../../../core/i18n/i18n.js";import*as i from"../../../../core/platform/platform.js";import*as o from"../../../visual_logging/visual_logging.js";import*as r from"../../legacy.js";import*as s from"../../../components/render_coordinator/render_coordinator.js";var n={cssText:`.data-grid{position:relative;border:1px solid var(--sys-color-divider)!important;line-height:120%}.data-grid table{table-layout:fixed;border-spacing:0;border-collapse:separate;height:100%;width:100%}.data-grid .data-container{position:absolute;inset:0;overflow:hidden auto;transform:translateZ(0);background-color:var(--sys-color-cdt-base-container)}.data-grid thead{position:sticky;top:0;height:21px;z-index:1}.data-grid .aria-live-label{width:1px;height:1px;overflow:hidden}.data-grid.inline .data-container{position:static}.data-grid .corner{width:14px;padding-right:0;padding-left:0;border-left:0 none transparent!important}.data-grid.inline .corner{display:none}.data-grid.data-grid-fits-viewport .corner{display:none}.data-grid .top-filler-td,\n.data-grid .bottom-filler-td{height:auto!important;padding:0!important}.data-grid table.data{position:absolute;inset:0;border-top:0 none transparent;table-layout:fixed}.data-grid.inline table.data{position:static}.data-grid tbody tr{display:none;height:20px;&:has(td.show-more){height:var(--sys-size-13)}}.data-grid tbody tr.revealed{display:table-row}.striped-data-grid .revealed.data-grid-data-grid-node:nth-child(odd):not(.dirty, .selected),\n.striped-data-grid-starts-with-odd .revealed.data-grid-data-grid-node:nth-child(even):not(.dirty, .selected){background-color:var(--sys-color-surface1)}.data-grid td,\n.data-grid th{white-space:nowrap;text-overflow:ellipsis;overflow:hidden;line-height:18px;height:18px;border-left:1px solid var(--sys-color-divider);padding:1px 4px}.data-grid td{vertical-align:top;user-select:text}.data-grid tr:has(th){background-color:var(--sys-color-surface1)}.data-grid th{border-bottom:1px solid var(--sys-color-divider);text-align:left;font-weight:normal;vertical-align:middle}.data-grid th:first-child,\n.data-grid td:first-child{border-left-width:0}.data-grid tr.selected td,\n.data-grid tr.selected th{border-left-color:var(--sys-color-divider-on-tonal-container)}.data-grid td > div,\n.data-grid th > div{white-space:nowrap;text-overflow:ellipsis;overflow:hidden;min-width:8px}.data-grid td.editing > div{text-overflow:clip}.data-grid .center{text-align:center}.data-grid .right{text-align:right}.data-grid th.sortable{position:relative}.data-grid th .sort-order-icon-container{min-width:0;position:absolute;top:1px;right:0;bottom:1px;display:flex;align-items:center}.data-grid th .sort-order-icon{margin-right:4px;margin-bottom:-2px;width:14px;height:14px;display:none;background-color:var(--icon-default)}.data-grid th.sort-ascending .sort-order-icon{display:inline-block;mask-image:var(--image-file-triangle-up)}.data-grid th.sort-descending .sort-order-icon{display:inline-block;mask-image:var(--image-file-triangle-down)}.data-grid th.sort-ascending,\n.data-grid th.sort-descending{padding-right:14px}.data-grid th.sortable:hover,\n.data-grid th.sortable:focus-within{background-color:var(--sys-color-state-hover-on-subtle)}.data-grid .top-filler-td{border-bottom:0 none transparent;line-height:0}.data-grid button{line-height:18px;color:inherit}.data-grid td.disclosure::before{user-select:none;mask-image:var(--image-file-triangle-right);float:left;width:14px;height:14px;margin-right:2px;content:"";position:relative;top:3px;background-color:var(--icon-default);transition:transform 200ms}.data-grid tr:not(.parent) td.disclosure::before{background-color:transparent}.data-grid tr.expanded td.disclosure::before{transform:rotate(90deg)}.data-grid tbody tr.revealed.selected{background-color:var(--sys-color-neutral-container);color:inherit;& ::selection{background-color:var(--sys-color-state-focus-select);color:currentcolor}}.data-grid:focus-within tbody tr.revealed.selected{background-color:var(--sys-color-tonal-container)}.data-grid tbody tr.revealed:not(.data-grid-filler-row, .selected):hover{background-color:var(--sys-color-state-hover-on-subtle)}.data-grid tbody tr.revealed.selected.dirty{color:var(--sys-color-on-tonal-container)}.data-grid.no-selection:focus-visible{border:1px solid var(--sys-color-state-focus-ring)!important}.data-grid:focus tbody tr.selected{background-color:var(--sys-color-tonal-container);color:var(--sys-color-on-tonal-container)}.data-grid tbody tr.selected.dirty{--override-data-grid-dirty-background-color:var(--sys-color-error);background-color:var(--override-data-grid-dirty-background-color)}.data-grid:focus tr.selected.dirty{--override-data-grid-dirty-background-color:var(--sys-color-error-container)}.data-grid:focus tr.selected .devtools-link{color:var(--sys-color-on-tonal-container)}.data-grid:focus tr.parent.selected td.disclosure::before{background-color:var(--sys-color-on-tonal-container)}.data-grid tr.inactive{color:var(--sys-color-state-disabled);font-style:italic}.data-grid tr.dirty{--override-data-grid-dirty-background-color:var(--sys-color-surface-error);background-color:var(--override-data-grid-dirty-background-color);color:var(--sys-color-error);font-style:normal}.data-grid tr.highlighted:not(.selected){background-color:var(--sys-color-surface-yellow)}.striped-data-grid .revealed.data-grid-data-grid-node.highlighted:nth-child(odd):not(.dirty, .selected),\n.striped-data-grid-starts-with-odd .revealed.data-grid-data-grid-node.highlighted:nth-child(even):not(.dirty, .selected){background-color:var(--sys-color-surface-yellow-high)}.data-grid td.show-more{white-space:normal;gap:var(--sys-size-3);devtools-button{margin-right:var(--sys-size-6);position:relative;margin-top:3px;margin-bottom:3px}}.data-grid td.show-more::before{display:none}.data-grid-resizer{position:absolute;top:0;bottom:0;width:5px;z-index:500}@media (forced-colors: active){.sort-order-icon-container .sort-order-icon{forced-color-adjust:none;background-color:ButtonText}.data-grid td.disclosure::before{forced-color-adjust:none;color:ButtonText}.data-grid.no-selection:focus-visible *{color:ButtonText}.data-grid th.sortable:hover *,\n  .data-grid tr.parent.selected td.disclosure::before,\n  .data-grid:focus tr.parent.selected td.disclosure::before,\n  .data-grid tbody tr.parent.revealed:hover td.disclosure::before{color:HighlightText}.data-grid th.sortable:hover .sort-order-icon-container .sort-order-icon{background-color:HighlightText}.striped-data-grid .revealed.data-grid-data-grid-node:nth-child(odd):not(.dirty, .selected),\n  .striped-data-grid-starts-with-odd .revealed.data-grid-data-grid-node:nth-child(even):not(.dirty, .selected),\n  .request-cookies-view tr.revealed.data-grid-data-grid-node.flagged-cookie-attribute-row:not(.selected):nth-child(2n),\n  .cookies-table tr.revealed.data-grid-data-grid-node.flagged-cookie-attribute-row:not(.selected):nth-child(odd){background-color:canvas}.data-grid.no-selection:focus-visible{forced-color-adjust:none;border-color:Highlight}.data-grid th.sortable:hover,\n  .data-grid tbody tr.revealed:hover,\n  .data-grid tbody tr.revealed.selected,\n  .striped-data-grid .revealed:hover.data-grid-data-grid-node:nth-child(odd):not(.dirty, .selected),\n  .striped-data-grid-starts-with-odd .revealed:hover.data-grid-data-grid-node:nth-child(even):not(.dirty, .selected),\n  .request-cookies-view tr.revealed:hover.data-grid-data-grid-node.flagged-cookie-attribute-row:not(.selected):nth-child(2n),\n  .cookies-table tr.revealed:hover.data-grid-data-grid-node.flagged-cookie-attribute-row:not(.selected):nth-child(odd){forced-color-adjust:none;background-color:Highlight}.data-grid tbody tr.revealed:hover *,\n  .data-grid tbody tr.revealed.selected *,\n  .data-grid tbody tr.revealed:focus *,\n  .data-grid tbody tr.revealed:hover .heap-object-tag{color:HighlightText}.data-grid th{background-color:canvas;border-color:Highlight}}\n/*# sourceURL=${import.meta.resolve("./dataGrid.css")} */\n`};const a={expanded:"expanded",collapsed:"collapsed",sRowS:"{PH1} Row {PH2}",rowsS:"Rows: {PH1}",sSUseTheUpAndDownArrowKeysTo:"{PH1} {PH2}, use the up and down arrow keys to navigate and interact with the rows of the table; Use browse mode to read cell by cell.",sortByString:"Sort By",resetColumns:"Reset Columns",headerOptions:"Header Options",refresh:"Refresh",addNew:"Add new",editS:'Edit "{PH1}"',delete:"Delete",levelS:"level {PH1}",checked:"checked",emptyRowCreated:"An empty table row has been created. You may double click or use context menu to edit.",enterToSort:"Column sort state: {PH1}. Press enter to apply sorting filter",sortableColumn:"Sortable column. Press enter to apply sorting filter"},l=t.i18n.registerUIStrings("ui/legacy/components/data_grid/DataGrid.ts",a),d=t.i18n.getLocalizedString.bind(void 0,l),h=new WeakMap,c=new WeakMap,u=new WeakMap,g=new WeakMap,p=new WeakMap;class b extends e.ObjectWrapper.ObjectWrapper{element;displayName;editCallback;deleteCallback;refreshCallback;dataTableHeaders;scrollContainerInternal;dataContainerInternal;dataTable;inline;columnsArray;columns;visibleColumnsArray;cellClass;dataTableHeadInternal;headerRow;dataTableColumnGroup;dataTableBody;topFillerRow;bottomFillerRow;editing;selectedNode;expandNodesWhenArrowing;indentWidth;resizers;columnWidthsInitialized;cornerWidth;resizeMethod;headerContextMenuCallback;rowContextMenuCallback;elementToDataGridNode;disclosureColumnId;sortColumnCell;rootNodeInternal;editingNode;columnWeightsSetting;creationNode;currentResizer;dataGridWidget;constructor(e){super();const{displayName:t,columns:i,deleteCallback:o,refreshCallback:s}=e;this.element=document.createElement("div"),this.element.classList.add("data-grid"),this.element.tabIndex=0,this.element.addEventListener("keydown",this.keyDown.bind(this),!1),this.element.addEventListener("contextmenu",this.contextMenu.bind(this),!0),this.element.addEventListener("focusin",(e=>{this.updateGridAccessibleNameOnFocus(),e.consume(!0)})),this.element.addEventListener("focusout",(e=>{e.consume(!0)})),r.ARIAUtils.markAsApplication(this.element),this.displayName=t,this.deleteCallback=o,this.refreshCallback=s,this.dataTableHeaders={},this.dataContainerInternal=this.element.createChild("div","data-container"),this.dataTable=this.dataContainerInternal.createChild("table","data"),this.scrollContainerInternal=this.dataContainerInternal,this.dataTable.addEventListener("dblclick",this.ondblclick.bind(this),!1),this.dataTable.addEventListener("mousedown",this.mouseDownInDataTable.bind(this)),this.dataTable.addEventListener("click",this.clickInDataTable.bind(this),!0),this.inline=!1,this.columnsArray=[],this.columns={},this.visibleColumnsArray=i,i.forEach((e=>this.innerAddColumn(e))),this.cellClass=null,this.dataTableColumnGroup=this.dataTable.createChild("colgroup"),this.dataTableHeadInternal=this.dataTable.createChild("thead"),this.headerRow=this.dataTableHeadInternal.createChild("tr"),this.dataTableBody=this.dataTable.createChild("tbody"),this.topFillerRow=this.dataTableBody.createChild("tr","data-grid-filler-row revealed"),r.ARIAUtils.setHidden(this.topFillerRow,!0),this.bottomFillerRow=this.dataTableBody.createChild("tr","data-grid-filler-row revealed"),r.ARIAUtils.setHidden(this.bottomFillerRow,!0),this.setVerticalPadding(0,0,!0),this.refreshHeader(),this.editing=!1,this.selectedNode=null,this.expandNodesWhenArrowing=!0,this.setRootNode(new y),this.setHasSelection(!1),this.indentWidth=15,this.resizers=[],this.columnWidthsInitialized=!1,this.cornerWidth=m,this.resizeMethod="nearest",this.headerContextMenuCallback=null,this.rowContextMenuCallback=null,this.elementToDataGridNode=new WeakMap}setEditCallback(e,t){this.editCallback=e}firstSelectableNode(){let e=this.rootNodeInternal;for(;e&&!e.selectable;)e=e.traverseNextNode(!0)||void 0;return e}lastSelectableNode(){let e=this.rootNodeInternal,t=this.rootNodeInternal;for(;t;)t.selectable&&(e=t),t=t.traverseNextNode(!0)||void 0;return e}setElementContent(e,t){const i=this.columnIdFromNode(e);if(!i)return;const o=this.columns[i],r=e.parentElement;let s;r&&(s=this.elementToDataGridNode.get(r)),"Boolean"===o.dataType?b.setElementBoolean(e,Boolean(t),s):null!==t&&b.setElementText(e,t,Boolean(o.longText),s)}static setElementText(e,t,o,s){o&&t.length>1e3?(e.textContent=i.StringUtilities.trimEndWithMaxLength(t,1e3),r.Tooltip.Tooltip.install(e,t),h.set(e,t)):(e.textContent=t,r.Tooltip.Tooltip.install(e,""),h.delete(e)),s&&b.updateNodeAccessibleText(s)}static setElementBoolean(e,t,i){e.textContent=t?"✓":"",r.Tooltip.Tooltip.install(e,""),i&&b.updateNodeAccessibleText(i)}static updateNodeAccessibleText(e){let t="",i=e.elementInternal?.children[0]||null;if(i){for(;i&&!i.classList.contains("corner");){let o=null;for(const e of i.classList)if(e.includes("-column")){o=e.substring(0,e.indexOf("-column"));break}if(o&&e.dataGrid){const r=e.dataGrid.columns[o];r&&(t+=`${r.title}: ${i.textContent}, `)}i=i.nextElementSibling}t.length>0&&(t=t.substring(0,t.length-2)),e.nodeAccessibleText=t}}setStriped(e){this.element.classList.toggle("striped-data-grid",e)}setFocusable(e){this.element.tabIndex=e?0:-1,!1===e&&r.ARIAUtils.removeRole(this.element)}setHasSelection(e){this.element.classList.toggle("no-selection",!e)}announceSelectedGridNode(){if(this.element===i.DOMUtilities.deepActiveElement(this.element.ownerDocument)&&this.selectedNode?.existingElement()){let e;this.selectedNode.hasChildren()&&(e=this.selectedNode.expanded?d(a.expanded):d(a.collapsed));const t=e?`${this.selectedNode.nodeAccessibleText}, ${e}`:this.selectedNode.nodeAccessibleText;r.ARIAUtils.alert(t)}}getNumberOfRows(){return this.rootNodeInternal?this.enumerateChildren(this.rootNodeInternal,[],1).length:0}updateGridAccessibleNameOnFocus(){let e;if(this.selectedNode?.existingElement()){let t="";this.selectedNode.hasChildren()&&(t=this.selectedNode.expanded?d(a.expanded):d(a.collapsed));e=`${d(a.sRowS,{PH1:this.displayName,PH2:t})} ${this.selectedNode.nodeAccessibleText}`}else{if(!this.rootNodeInternal)return;const t=this.getNumberOfRows(),i=d(a.rowsS,{PH1:t});e=d(a.sSUseTheUpAndDownArrowKeysTo,{PH1:this.displayName,PH2:i})}r.ARIAUtils.alert(e)}innerAddColumn(e,t){e.defaultWeight=e.weight;const s=e.id;s in this.columns&&this.innerRemoveColumn(s),void 0===t&&(t=this.columnsArray.length),this.columnsArray.splice(t,0,e),this.columns[s]=e,e.disclosure&&(this.disclosureColumnId=s);const n=document.createElement("th");n.setAttribute("jslog",`${o.tableHeader().track({click:e.sortable,resize:!0}).context(i.StringUtilities.toKebabCase(s))}`),n.className=s+"-column",n.setAttribute("tabindex","0"),n.setAttribute("role","columnheader"),c.set(n,s),this.dataTableHeaders[s]=n;const l=document.createElement("div");if(e.titleDOMFragment?l.appendChild(e.titleDOMFragment):l.textContent=e.title||null,n.appendChild(l),e.sort&&(n.classList.add(e.sort),this.sortColumnCell=n),e.sortable){n.addEventListener("click",this.clickInHeaderCell.bind(this),!1),n.addEventListener("keydown",this.keydownHeaderCell.bind(this),!1),n.classList.add("sortable");const t=document.createElement("span");t.className="sort-order-icon",n.createChild("div","sort-order-icon-container").appendChild(t),e.title&&r.ARIAUtils.setLabel(n,d(a.sortableColumn))}}addColumn(e,t){this.innerAddColumn(e,t)}innerRemoveColumn(e){if(!this.columns[e])return;delete this.columns[e];const t=this.columnsArray.findIndex((t=>t.id===e));this.columnsArray.splice(t,1);const i=this.dataTableHeaders[e];i.parentElement&&i.parentElement.removeChild(i),delete this.dataTableHeaders[e]}removeColumn(e){this.innerRemoveColumn(e)}setCellClass(e){this.cellClass=e}refreshHeader(){this.dataTableColumnGroup.removeChildren(),this.headerRow.removeChildren(),this.topFillerRow.removeChildren(),this.bottomFillerRow.removeChildren();for(let e=0;e<this.visibleColumnsArray.length;++e){const t=this.visibleColumnsArray[e],i=t.id,o=this.dataTableColumnGroup.createChild("col");t.width&&(o.style.width=t.width),this.headerRow.appendChild(this.dataTableHeaders[i]);const r=this.topFillerRow.createChild("th","top-filler-td");r.textContent=t.title||null,r.scope="col";const s=this.bottomFillerRow.createChild("td","bottom-filler-td");c.set(s,i)}const e=this.headerRow.createChild("th","corner");r.ARIAUtils.setHidden(e,!0);const t=this.topFillerRow.createChild("th","corner");t.classList.add("top-filler-td"),t.scope="col",this.bottomFillerRow.createChild("td","corner").classList.add("bottom-filler-td"),this.dataTableColumnGroup.createChild("col","corner")}setVerticalPadding(e,t,i=!1){const o=e+"px",r=e||t?t+"px":"auto";this.topFillerRow.style.height===o&&this.bottomFillerRow.style.height===r||(this.topFillerRow.style.height=o,this.bottomFillerRow.style.height=r,i||this.dispatchEventToListeners("PaddingChanged"))}setRootNode(e){this.rootNodeInternal&&(this.rootNodeInternal.removeChildren(),this.rootNodeInternal.dataGrid=null,this.rootNodeInternal.isRoot=!1),this.rootNodeInternal=e,e.isRoot=!0,e.setHasChildren(!1),e.expandedInternal=!0,e.revealedInternal=!0,e.selectable=!1,e.dataGrid=this}rootNode(){let e=this.rootNodeInternal;return e||(e=new y,this.setRootNode(e)),e}isColumnEditable(e){const t=this.columns[e];return Boolean(t&&t.editable&&this.editCallback)}ondblclick(e){if(!this.editCallback||this.editing||this.editingNode)return;const t=this.columnIdFromNode(e.target);t&&this.isColumnEditable(t)&&this.startEditing(e.target)}startEditingColumnOfDataGridNode(e,t){this.editing=!0,this.editingNode=e,this.editingNode.select();const i=this.editingNode.element();if(!i)return;const o=i.children[t],s=h.get(o);s&&(o.textContent=s);const n=this.visibleColumnsArray[t];if("Boolean"===n.dataType){const t=r.UIUtils.CheckboxLabel.create(void 0,e.data[n.id]);r.ARIAUtils.setLabel(t,n.title||"");let i=!1;t.style.height="100%";const s=t.checkboxElement;s.classList.add("inside-datagrid");const a=s.checked;s.addEventListener("change",(()=>{i=!0,this.editingCommitted(o,s.checked,a,void 0,"forward")}),!1),s.addEventListener("keydown",(e=>{if("Tab"===e.key)return e.consume(!0),i=!0,this.editingCommitted(o,s.checked,a,void 0,e.shiftKey?"backward":"forward");" "===e.key?(e.consume(!0),s.checked=!s.checked):"Enter"===e.key&&(e.consume(!0),i=!0,this.editingCommitted(o,s.checked,a,void 0,"forward"))}),!1),s.addEventListener("blur",(()=>{i||this.editingCommitted(o,s.checked,s.checked,void 0,"next")}),!1),o.innerHTML="",o.appendChild(t),s.focus()}else{r.InplaceEditor.InplaceEditor.startEditing(o,this.startEditingConfig(o));const e=o.getComponentSelection();e&&e.selectAllChildren(o)}}startEditingNextEditableColumnOfDataGridNode(e,t,i){const o=this.columns[t],r=this.visibleColumnsArray.indexOf(o),s=this.nextEditableColumn(r,!1,i);-1!==s&&this.startEditingColumnOfDataGridNode(e,s)}startEditing(e){if(!r.UIUtils.enclosingNodeOrSelfWithNodeName(e,"td"))return;if(this.editingNode=this.dataGridNodeFromNode(e),!this.editingNode){if(!this.creationNode)return;this.editingNode=this.creationNode}if(this.editingNode instanceof C&&this.editingNode.isCreationNode)return void this.startEditingColumnOfDataGridNode(this.editingNode,this.nextEditableColumn(-1));const t=this.columnIdFromNode(e);if(!t)return;const i=this.columns[t],o=this.visibleColumnsArray.indexOf(i);this.editingNode&&this.startEditingColumnOfDataGridNode(this.editingNode,o)}renderInline(){this.element.classList.add("inline"),this.cornerWidth=0,this.inline=!0,this.updateWidths()}startEditingConfig(e){return new r.InplaceEditor.Config(this.editingCommitted.bind(this),this.editingCancelled.bind(this),void 0)}editingCommitted(e,t,i,o,r){const s=this.columnIdFromNode(e);if(!s)return void this.editingCancelled(e);const n=this.columns[s],a=this.visibleColumnsArray.indexOf(n);if(!this.editingNode)return;const l=this.editingNode.data[s],d=this.editingNode;function h(e){if(r){if("forward"===r){const t=this.nextEditableColumn(-1),i=d instanceof C&&d.isCreationNode;if(i&&a===t&&!e)return;const o=this.nextEditableColumn(a);if(-1!==o)return void this.startEditingColumnOfDataGridNode(d,o);const r=d.traverseNextNode(!0,null,!0);return r?void this.startEditingColumnOfDataGridNode(r,t):i&&e&&this.creationNode?(this.addCreationNode(!1),void this.startEditingColumnOfDataGridNode(this.creationNode,t)):void 0}if("backward"!==r);else{const e=this.nextEditableColumn(a,!0);if(-1!==e)return void this.startEditingColumnOfDataGridNode(d,e);const t=this.nextEditableColumn(this.visibleColumnsArray.length,!0),i=d.traversePreviousNode(!0,!0);i&&this.startEditingColumnOfDataGridNode(i,t)}}}if(this.setElementContent(e,t),l===t)return this.editingCancelled(e),void h.call(this,!1);this.editingNode.data[s]=t,this.editCallback&&(this.editCallback(this.editingNode,s,l,t,r),this.editingNode instanceof C&&this.editingNode.isCreationNode&&this.addCreationNode(!1),this.editingCancelled(e),h.call(this,!0))}editingCancelled(e){this.editing=!1,this.editingNode=null}nextEditableColumn(e,t,i){const o=t?-1:1,r=i?e:e+o,s=this.visibleColumnsArray;for(let e=r;e>=0&&e<s.length;e+=o)if(this.isColumnEditable(s[e].id))return e;return-1}sortColumnId(){return this.sortColumnCell&&c.get(this.sortColumnCell)||null}sortOrder(){return!this.sortColumnCell||this.sortColumnCell.classList.contains(f.Ascending)?f.Ascending:this.sortColumnCell.classList.contains(f.Descending)?f.Descending:null}isSortOrderAscending(){return!this.sortColumnCell||this.sortColumnCell.classList.contains(f.Ascending)}autoSizeWidths(e,t,i){t&&(t=Math.min(t,Math.floor(100/e.length)));let o=0;for(let t=0;t<e.length;++t)o+=e[t];let r=0;for(let s=0;s<e.length;++s){let n=Math.round(100*e[s]/o);t&&n<t?n=t:i&&n>i&&(n=i),r+=n,e[s]=n}let s=r-100;for(;t&&s>0;)for(let i=0;i<e.length&&(!(e[i]>t)||(--e[i],--s,s));++i);for(;i&&s<0;)for(let t=0;t<e.length&&(!(e[t]<i)||(++e[t],++s,s));++t);return e}autoSizeColumns(e,t,i){let o=[];for(let e=0;e<this.columnsArray.length;++e)o.push((this.columnsArray[e].title||"").length);if(i=i||0,!this.rootNodeInternal)return;const r=this.enumerateChildren(this.rootNodeInternal,[],i+1);for(let e=0;e<r.length;++e){const t=r[e];for(let e=0;e<this.columnsArray.length;++e){const i=String(t.data[this.columnsArray[e].id]);i.length>o[e]&&(o[e]=i.length)}}o=this.autoSizeWidths(o,e,t);for(let e=0;e<this.columnsArray.length;++e)this.columnsArray[e].weight=o[e];this.columnWidthsInitialized=!1,this.updateWidths()}enumerateChildren(e,t,i){if(e.isRoot||t.push(e),!i)return[];for(let o=0;o<e.children.length;++o)this.enumerateChildren(e.children[o],t,i-1);return t}onResize(){this.updateWidths()}updateWidths(){if(!this.columnWidthsInitialized&&this.element.offsetWidth){const e=this.element.offsetWidth-this.cornerWidth,t=this.dataTableHeadInternal.rows[0].cells.length-1;for(let i=0;i<t;i++){const t=this.visibleColumnsArray[i];t.weight||(t.weight=100*this.getPreferredWidth(i)/e||10)}this.columnWidthsInitialized=!0}this.applyColumnWeights()}indexOfVisibleColumn(e){return this.visibleColumnsArray.findIndex((t=>t.id===e))}setName(t){this.columnWeightsSetting=e.Settings.Settings.instance().createSetting("data-grid-"+t+"-column-weights",{}),this.loadColumnWeights()}resetColumnWeights(){for(const e of this.columnsArray)e.defaultWeight&&(e.weight=e.defaultWeight);this.applyColumnWeights(),this.saveColumnWeights()}loadColumnWeights(){if(!this.columnWeightsSetting)return;const e=this.columnWeightsSetting.get();for(let t=0;t<this.columnsArray.length;++t){const i=this.columnsArray[t],o=e[i.id];o&&(i.weight=o)}this.applyColumnWeights()}saveColumnWeights(){if(!this.columnWeightsSetting)return;const e={};for(let t=0;t<this.columnsArray.length;++t){const i=this.columnsArray[t];e[i.id]=i.weight}this.columnWeightsSetting.set(e)}wasShown(){this.loadColumnWeights()}willHide(){}getPreferredWidth(e){return u.get(this.dataTableColumnGroup.children[e])||this.dataTableHeadInternal.rows[0].cells[e].offsetWidth}applyColumnWeights(){let e=this.element.offsetWidth-this.cornerWidth;if(e<=0)return;let t=0;const i=[];for(let o=0;o<this.visibleColumnsArray.length;++o){if(this.visibleColumnsArray[o].fixedWidth){const t=this.getPreferredWidth(o);i[o]=t,e-=t}else t+=this.visibleColumnsArray[o].weight||0}let o=0,r=0;for(let s=0;s<this.visibleColumnsArray.length;++s){const n=this.visibleColumnsArray[s];let a;if(n.fixedWidth)a=i[s];else{o+=n.weight||0;const i=o*e/t|0;a=Math.max(i-r,14),r=i}this.setPreferredWidth(s,a)}this.positionResizers()}setColumnsVisibility(e){this.visibleColumnsArray=[];for(const t of this.columnsArray)e.has(t.id)&&this.visibleColumnsArray.push(t);this.refreshHeader(),this.applyColumnWeights();const t=this.enumerateChildren(this.rootNode(),[],-1);for(const e of t)e.refresh()}get scrollContainer(){return this.scrollContainerInternal}positionResizers(){const e=this.dataTableColumnGroup.children.length-1,t=[],i=this.resizers;for(;i.length>e-1;){const e=i.pop();e&&e.remove()}for(let i=0;i<e-1;i++)t[i]=(t[i-1]||0)+this.dataTableHeadInternal.rows[0].cells[i].offsetWidth;for(let o=0;o<e-1;o++){let e=i[o];e||(e=document.createElement("div"),p.set(e,o),e.classList.add("data-grid-resizer"),r.UIUtils.installDragHandle(e,this.startResizerDragging.bind(this),this.resizerDragging.bind(this),this.endResizerDragging.bind(this),"col-resize"),this.element.appendChild(e),i.push(e)),g.get(e)!==t[o]&&(g.set(e,t[o]),e.style.left=t[o]+"px")}}addCreationNode(e){this.creationNode&&(this.creationNode.isCreationNode=!1);const t={};for(const e in this.columns)t[e]=null;this.creationNode=new C(t,e),r.ARIAUtils.alert(d(a.emptyRowCreated)),this.rootNode().appendChild(this.creationNode)}keyDown(e){if(!(e instanceof KeyboardEvent))return;if(this.selectedNode&&this.selectedNode.element().tabIndex<0&&o.logKeyDown(this.selectedNode.element(),e),e.shiftKey||e.metaKey||e.ctrlKey||this.editing||r.UIUtils.isEditing())return;let t,s=!1;if(this.selectedNode)if("ArrowUp"!==e.key||e.altKey)if("ArrowDown"!==e.key||e.altKey){if("ArrowLeft"===e.key)this.selectedNode.expanded?(e.altKey?this.selectedNode.collapseRecursively():this.selectedNode.collapse(),s=!0):this.selectedNode.parent&&!this.selectedNode.parent.isRoot&&(s=!0,this.selectedNode.parent.selectable?(t=this.selectedNode.parent,s=!!t):this.selectedNode.parent&&this.selectedNode.parent.collapse());else if("ArrowRight"===e.key){if(!this.expandNodesWhenArrowing)return;this.selectedNode.revealed?this.selectedNode.hasChildren()&&(s=!0,this.selectedNode.expanded?(t=this.selectedNode.children[0],s=!!t):e.altKey?this.selectedNode.expandRecursively():this.selectedNode.expand()):(this.selectedNode.reveal(),s=!0)}else if(8===e.keyCode||46===e.keyCode)this.deleteCallback&&(s=!0,this.deleteCallback(this.selectedNode));else if("Enter"===e.key)if(this.editCallback){s=!0;const e=this.selectedNode.element();if(!e)return;this.startEditing(e.children[this.nextEditableColumn(-1)])}else this.dispatchEventToListeners("OpenedNode",this.selectedNode)}else{for(t=this.selectedNode.traverseNextNode(!0);t&&!t.selectable;)t=t.traverseNextNode(!0);s=!!t}else{for(t=this.selectedNode.traversePreviousNode(!0);t&&!t.selectable;)t=t.traversePreviousNode(!0);s=!!t}else"ArrowUp"!==e.key||e.altKey?"ArrowDown"!==e.key||e.altKey||(t=this.firstSelectableNode()):t=this.lastSelectableNode(),s=!!t;t&&(t.reveal(),t.select());const n=i.DOMUtilities.deepActiveElement(this.element.ownerDocument);s&&this.element!==n&&!this.element.contains(n)&&this.element.focus(),s&&e.consume(!0)}updateSelectionBeforeRemoval(e,t){let i,o=this.selectedNode;for(;o&&o!==e;)o=o.parent;if(o){for(o=e;o&&!o.nextSibling;)o=o.parent;for(o&&(i=o.nextSibling);i&&!i.selectable;)i=i.traverseNextNode(!0);if(!i||i.isCreationNode){if(!e)return;for(i=e.traversePreviousNode(!0);i&&!i.selectable;)i=i.traversePreviousNode(!0)}i?(i.reveal(),i.select()):this.selectedNode&&this.selectedNode.deselect()}}dataGridNodeFromNode(e){const t=r.UIUtils.enclosingNodeOrSelfWithNodeName(e,"tr");return t&&this.elementToDataGridNode.get(t)||null}columnIdFromNode(e){const t=r.UIUtils.enclosingNodeOrSelfWithNodeName(e,"td");return t&&c.get(t)||null}clickInHeaderCell(e){const t=r.UIUtils.enclosingNodeOrSelfWithNodeName(e.target,"th");t&&this.sortByColumnHeaderCell(t)}keydownHeaderCell(e){"Enter"!==e.key&&" "!==e.key||this.clickInHeaderCell(e)}sortByColumnHeaderCell(e){if(!c.has(e)||!e.classList.contains("sortable"))return;let t=f.Ascending;e===this.sortColumnCell&&this.isSortOrderAscending()&&(t=f.Descending),this.sortColumnCell&&(this.sortColumnCell.classList.remove(f.Ascending,f.Descending),this.sortColumnCell.removeAttribute("aria-sort")),this.sortColumnCell=e,e.classList.add(t);const i=this.isSortOrderAscending()?"ascending":"descending";e.setAttribute("aria-sort",i),r.ARIAUtils.alert(d(a.enterToSort,{PH1:i||""})),this.dispatchEventToListeners("SortingChanged")}markColumnAsSortedBy(e,t){this.sortColumnCell&&this.sortColumnCell.classList.remove(f.Ascending,f.Descending),this.sortColumnCell=this.dataTableHeaders[e],this.sortColumnCell.classList.add(t)}headerTableHeader(e){return this.dataTableHeaders[e]}mouseDownInDataTable(e){const t=e.target,i=this.dataGridNodeFromNode(t);if(!i||!i.selectable||i.isEventWithinDisclosureTriangle(e))return;const o=this.columnIdFromNode(t);o&&this.columns[o].nonSelectable||(e.metaKey?i.selected?i.deselect():i.select():(i.select(),this.dispatchEventToListeners("OpenedNode",i)))}setHeaderContextMenuCallback(e){this.headerContextMenuCallback=e}setRowContextMenuCallback(e){this.rowContextMenuCallback=e}contextMenu(e){if(!(e instanceof MouseEvent))return;const t=new r.ContextMenu.ContextMenu(e),o=e.target,s=this.visibleColumnsArray.filter((e=>e.sortable&&e.title)),n=this.columnsArray.filter((e=>-1===s.indexOf(e)&&e.allowInSortByEvenWhenHidden)),l=[...s,...n];if(l.length>0){const e=t.defaultSection().appendSubMenuItem(d(a.sortByString),!1,"sort-by");for(const t of l){const o=this.dataTableHeaders[t.id];e.defaultSection().appendItem(t.title,this.sortByColumnHeaderCell.bind(this,o),{jslogContext:i.StringUtilities.toKebabCase(t.id)})}}if(o.isSelfOrDescendant(this.dataTableHeadInternal))return this.headerContextMenuCallback&&this.headerContextMenuCallback(t),t.defaultSection().appendItem(d(a.resetColumns),this.resetColumnWeights.bind(this),{jslogContext:"reset-columns"}),void t.show();const h=t.defaultSection().appendSubMenuItem(d(a.headerOptions),!1,"header-options");this.headerContextMenuCallback&&this.headerContextMenuCallback(h),h.defaultSection().appendItem(d(a.resetColumns),this.resetColumnWeights.bind(this),{jslogContext:"reset-columns"});const c=0===e.button,u=c?this.selectedNode:this.dataGridNodeFromNode(o),g=this.selectedNode?.existingElement();if(c&&g){const e=g.getBoundingClientRect();if(e){const i=(e.right+e.left)/2,o=(e.bottom+e.top)/2;t.setX(i),t.setY(o)}}if(!this.refreshCallback||u&&u===this.creationNode||t.defaultSection().appendItem(d(a.refresh),this.refreshCallback.bind(this),{jslogContext:"refresh"}),u&&u.selectable&&!u.isEventWithinDisclosureTriangle(e)){if(this.editCallback)if(u===this.creationNode){const e=this.nextEditableColumn(-1),i=u.element().children[e];t.defaultSection().appendItem(d(a.addNew),this.startEditing.bind(this,i),{jslogContext:"add-new"})}else if(c){const e=this.nextEditableColumn(-1);if(e>-1){const i=this.visibleColumnsArray[e];i&&this.isColumnEditable(i.id)&&t.defaultSection().appendItem(d(a.editS,{PH1:String(i.title)}),this.startEditingColumnOfDataGridNode.bind(this,u,e),{jslogContext:"edit"})}}else{const e=this.columnIdFromNode(o);e&&this.isColumnEditable(e)&&t.defaultSection().appendItem(d(a.editS,{PH1:String(this.columns[e].title)}),this.startEditing.bind(this,o),{jslogContext:"edit"})}this.deleteCallback&&u!==this.creationNode&&t.defaultSection().appendItem(d(a.delete),this.deleteCallback.bind(this,u),{jslogContext:"delete"}),this.rowContextMenuCallback&&this.rowContextMenuCallback(t,u)}t.show()}clickInDataTable(e){const t=this.dataGridNodeFromNode(e.target);t&&t.hasChildren()&&t.isEventWithinDisclosureTriangle(e)&&(t.expanded?e.altKey?t.collapseRecursively():t.collapse():e.altKey?t.expandRecursively():t.expand())}setResizeMethod(e){this.resizeMethod=e}startResizerDragging(e){return this.currentResizer=e.target,!0}endResizerDragging(){this.currentResizer=null,this.saveColumnWeights()}resizerDragging(e){const t=this.currentResizer;if(!t)return;let o=e.clientX-this.element.getBoundingClientRect().left,r=0,s=p.get(t);if(void 0===s)return;let n=s+1;for(let e=0;e<s;e++)r+=this.getPreferredWidth(e);"last"===this.resizeMethod?n=this.resizers.length:"first"===this.resizeMethod&&(r+=this.getPreferredWidth(s)-this.getPreferredWidth(0),s=0);const a=r+this.getPreferredWidth(s)+this.getPreferredWidth(n),l=r+v,d=a-v;if(l>d)return;o=i.NumberUtilities.clamp(o,l,d);const h=o-x;g.set(t,h),t.style.left=h+"px",this.setPreferredWidth(s,o-r),this.setPreferredWidth(n,a-o);const c=this.visibleColumnsArray[s],u=this.visibleColumnsArray[n];if(c.weight&&u.weight){const e=c.weight+u.weight,t=a-r;c.weight=(o-r)*e/t,u.weight=(a-o)*e/t}this.positionResizers(),this.updateWidths(),e.preventDefault()}setPreferredWidth(e,t){const i=this.dataTableColumnGroup.children[e];u.set(i,t),i.style.width=t+"px"}columnOffset(e){if(!this.element.offsetWidth)return 0;for(let t=1;t<this.visibleColumnsArray.length;++t)if(e===this.visibleColumnsArray[t].id&&this.resizers[t-1])return g.get(this.resizers[t-1])||0;return 0}asWidget(e){return this.dataGridWidget||(this.dataGridWidget=new w(this,e)),this.dataGridWidget}topFillerRowElement(){return this.topFillerRow}headerHeightInScroller(){return this.scrollContainer===this.dataContainerInternal?this.headerHeight():0}headerHeight(){return this.dataTableHeadInternal.offsetHeight}revealNode(e){e.scrollIntoViewIfNeeded(!1),e.offsetTop-this.scrollContainer.scrollTop<this.headerHeight()&&(this.scrollContainer.scrollTop=e.offsetTop-this.headerHeight())}}const m=14;var f;!function(e){e.Ascending="sort-ascending",e.Descending="sort-descending"}(f||(f={}));const v=34,x=3;class y{elementInternal=null;expandedInternal=!1;selectedInternal=!1;dirty=!1;inactive=!1;highlighted=!1;depthInternal;revealedInternal;attachedInternal=!1;savedPosition=null;shouldRefreshChildrenInternal=!0;children=[];dataGrid=null;parent=null;previousSibling=null;nextSibling=null;#e=20;selectable=!0;isRoot=!1;nodeAccessibleText="";cellAccessibleTextMap=new Map;isCreationNode=!1;dataInternal;hasChildrenInternal;constructor(e,t){this.dataInternal=e||{},this.hasChildrenInternal=t||!1}element(){if(!this.elementInternal){const e=this.createElement();this.createCells(e)}return this.elementInternal}createElement(){return this.elementInternal=document.createElement("tr"),this.elementInternal.setAttribute("jslog",`${o.tableRow().track({keydown:"ArrowUp|ArrowDown|ArrowLeft|ArrowRight|Enter|Space"})}`),this.elementInternal.classList.add("data-grid-data-grid-node"),this.dataGrid&&this.dataGrid.elementToDataGridNode.set(this.elementInternal,this),this.hasChildrenInternal&&this.elementInternal.classList.add("parent"),this.expanded&&this.elementInternal.classList.add("expanded"),this.selected&&this.elementInternal.classList.add("selected"),this.revealed&&this.elementInternal.classList.add("revealed"),this.dirty&&this.elementInternal.classList.add("dirty"),this.inactive&&this.elementInternal.classList.add("inactive"),this.highlighted&&this.elementInternal.classList.add("highlighted"),this.isCreationNode&&this.elementInternal.classList.add("creation-node"),this.elementInternal}existingElement(){return this.elementInternal||null}resetElement(){this.elementInternal=null}createCells(e){if(e.removeChildren(),!this.dataGrid||!this.parent)return;const t=this.dataGrid.visibleColumnsArray,i=[];!this.hasChildrenInternal&&this.parent.isRoot||i.push(d(a.levelS,{PH1:this.depth+1}));for(let o=0;o<t.length;++o){const r=t[o],s=e.appendChild(this.createCell(r.id));"Boolean"===r.dataType&&!0===this.data[r.id]&&this.setCellAccessibleName(d(a.checked),s,r.id),i.push(`${r.title}: ${this.cellAccessibleTextMap.get(r.id)||s.textContent}`)}this.nodeAccessibleText=i.join(", ");const o=this.createTDWithClass("corner");r.ARIAUtils.setHidden(o,!0),e.appendChild(o)}get data(){return this.dataInternal}set data(e){this.dataInternal=e||{},this.refresh()}get revealed(){if(void 0!==this.revealedInternal)return this.revealedInternal;let e=this.parent;for(;e&&!e.isRoot;){if(!e.expanded)return this.revealedInternal=!1,!1;e=e.parent}return this.revealed=!0,!0}set revealed(e){if(this.revealedInternal!==e){this.revealedInternal=e,this.elementInternal&&this.elementInternal.classList.toggle("revealed",this.revealedInternal);for(let t=0;t<this.children.length;++t)this.children[t].revealed=e&&this.expanded}}isDirty(){return this.dirty}setDirty(e){this.dirty!==e&&(this.dirty=e,this.elementInternal&&(e?this.elementInternal.classList.add("dirty"):this.elementInternal.classList.remove("dirty")))}setInactive(e){this.inactive!==e&&(this.inactive=e,this.elementInternal&&(e?this.elementInternal.classList.add("inactive"):this.elementInternal.classList.remove("inactive")))}setHighlighted(e){this.highlighted!==e&&(this.highlighted=e,this.elementInternal&&(e?this.elementInternal.classList.add("highlighted"):this.elementInternal.classList.remove("highlighted")))}hasChildren(){return this.hasChildrenInternal}setHasChildren(e){this.hasChildrenInternal!==e&&(this.hasChildrenInternal=e,this.elementInternal&&(this.elementInternal.classList.toggle("parent",this.hasChildrenInternal),this.elementInternal.classList.toggle("expanded",this.hasChildrenInternal&&this.expanded)))}get depth(){return void 0!==this.depthInternal||(this.parent&&!this.parent.isRoot?this.depthInternal=this.parent.depth+1:this.depthInternal=0),this.depthInternal}get leftPadding(){return this.depth*(this.dataGrid?this.dataGrid.indentWidth:1)}get shouldRefreshChildren(){return this.shouldRefreshChildrenInternal}set shouldRefreshChildren(e){this.shouldRefreshChildrenInternal=e,e&&this.expanded&&this.expand()}get selected(){return this.selectedInternal}set selected(e){e?this.select():this.deselect()}get expanded(){return this.expandedInternal}set expanded(e){e?this.expand():this.collapse()}refresh(){this.dataGrid||(this.elementInternal=null),this.elementInternal&&this.createCells(this.elementInternal)}createTDWithClass(e){const t=document.createElement("td");e&&(t.className=e);const i=this.dataGrid?this.dataGrid.cellClass:null;return i&&t.classList.add(i),t}createTD(e){const t=this.createTDWithClass(e+"-column");if(c.set(t,e),this.dataGrid){const r=this.dataGrid.isColumnEditable(e);t.setAttribute("jslog",`${o.tableCell().track({click:!0,keydown:!!r&&"Enter|Space|Escape",dblclick:r,change:r}).context(i.StringUtilities.toKebabCase(e))}`);const s=this.dataGrid.columns[e].align;s&&t.classList.add(s),e===this.dataGrid.disclosureColumnId&&(t.classList.add("disclosure"),this.leftPadding&&t.style.setProperty("padding-left",this.leftPadding+"px")),r&&(t.tabIndex=0,t.ariaHasPopup="true")}return t}createCell(e){const t=this.createTD(e),i=this.data[e];return i instanceof Node?t.appendChild(i):null!==i&&this.dataGrid&&this.dataGrid.setElementContent(t,i),t}setCellAccessibleName(e,t,i){this.cellAccessibleTextMap.set(i,e);for(let e=0;e<t.children.length;e++)r.ARIAUtils.setHidden(t.children[e],!0);r.ARIAUtils.setLabel(t,e)}nodeSelfHeight(){return 20}appendChild(e){this.insertChild(e,this.children.length)}resetNode(e){delete this.depthInternal,delete this.revealedInternal,e||(this.previousSibling&&(this.previousSibling.nextSibling=this.nextSibling),this.nextSibling&&(this.nextSibling.previousSibling=this.previousSibling),this.dataGrid=null,this.parent=null,this.nextSibling=null,this.previousSibling=null,this.attachedInternal=!1)}insertChild(e,t){if(!e)throw new Error("insertChild: Node can't be undefined or null.");if(e.parent===this){const i=this.children.indexOf(e);if(i<0&&console.assert(!1,"Inconsistent DataGrid state"),i===t)return;i<t&&--t}e.remove(),this.children.splice(t,0,e),this.setHasChildren(!0),e.parent=this,e.dataGrid=this.dataGrid,e.recalculateSiblings(t),e.shouldRefreshChildrenInternal=!0;let i=e.children[0];for(;i;)i.resetNode(!0),i.dataGrid=this.dataGrid,i.attachedInternal=!1,i.shouldRefreshChildrenInternal=!0,i=i.traverseNextNode(!1,e,!0);this.expanded&&e.attach(),this.revealed||(e.revealed=!1)}remove(){this.parent&&this.parent.removeChild(this)}removeChild(e){if(!e)throw new Error("removeChild: Node can't be undefined or null.");if(e.parent!==this)throw new Error("removeChild: Node is not a child of this node.");this.dataGrid&&this.dataGrid.updateSelectionBeforeRemoval(e,!1),e.detach(),e.resetNode(),i.ArrayUtilities.removeElement(this.children,e,!0),this.children.length<=0&&this.setHasChildren(!1)}removeChildren(){this.dataGrid&&this.dataGrid.updateSelectionBeforeRemoval(this,!0);for(let e=0;e<this.children.length;++e){const t=this.children[e];t.detach(),t.resetNode()}this.children=[],this.setHasChildren(!1)}recalculateSiblings(e){if(!this.parent)return;const t=this.parent.children[e-1]||null;t&&(t.nextSibling=this),this.previousSibling=t;const i=this.parent.children[e+1]||null;i&&(i.previousSibling=this),this.nextSibling=i}collapse(){if(!this.isRoot){this.elementInternal&&this.elementInternal.classList.remove("expanded"),this.expandedInternal=!1,this.selected&&this.dataGrid&&this.dataGrid.announceSelectedGridNode();for(let e=0;e<this.children.length;++e)this.children[e].revealed=!1}}collapseRecursively(){let e=this;for(;e;)e.expanded&&e.collapse(),e=e.traverseNextNode(!1,this,!0)}populate(){}expand(){if(this.hasChildrenInternal&&!this.expandedInternal&&!this.isRoot){if(this.revealed&&!this.shouldRefreshChildrenInternal)for(let e=0;e<this.children.length;++e)this.children[e].revealed=!0;if(this.shouldRefreshChildrenInternal){for(let e=0;e<this.children.length;++e)this.children[e].detach();if(this.populate(),this.attachedInternal)for(let e=0;e<this.children.length;++e){const t=this.children[e];this.revealed&&(t.revealed=!0),t.attach()}this.shouldRefreshChildrenInternal=!1}this.elementInternal&&this.elementInternal.classList.add("expanded"),this.selected&&this.dataGrid&&this.dataGrid.announceSelectedGridNode(),this.expandedInternal=!0}}expandRecursively(){let e=this;for(;e;)e.expand(),e=e.traverseNextNode(!1,this)}reveal(){if(this.isRoot||!this.dataGrid)return;let e=this.parent;for(;e&&!e.isRoot;)e.expanded||e.expand(),e=e.parent;this.dataGrid.revealNode(this.element())}select(e){this.dataGrid&&this.selectable&&!this.selected&&(this.dataGrid.selectedNode&&this.dataGrid.selectedNode.deselect(),this.selectedInternal=!0,this.dataGrid.selectedNode=this,this.elementInternal&&(this.elementInternal.classList.add("selected"),this.elementInternal.focus(),this.dataGrid.setHasSelection(!0),this.dataGrid.announceSelectedGridNode()),e||this.dataGrid.dispatchEventToListeners("SelectedNode",this))}revealAndSelect(){this.isRoot||(this.reveal(),this.select())}deselect(e){this.dataGrid&&this.dataGrid.selectedNode===this&&this.selected&&(this.selectedInternal=!1,this.dataGrid.selectedNode=null,this.elementInternal&&(this.elementInternal.classList.remove("selected"),this.dataGrid.setHasSelection(!1)),e||this.dataGrid.dispatchEventToListeners("DeselectedNode"))}traverseNextNode(e,t,i,o){!i&&this.hasChildrenInternal&&this.populate(),o&&(o.depthChange=0);let r=!e||this.revealed?this.children[0]:null;if(r&&(!e||this.expanded))return o&&(o.depthChange=1),r;if(this===t)return null;if(r=!e||this.revealed?this.nextSibling:null,r)return r;for(r=this;r&&!r.isRoot&&(e&&!r.revealed||!r.nextSibling)&&r.parent!==t;)o&&(o.depthChange-=1),r=r.parent;return r&&(!e||r.revealed)?r.nextSibling:null}traversePreviousNode(e,t){let i=!e||this.revealed?this.previousSibling:null;for(!t&&i?.hasChildrenInternal&&i.populate();i&&(!e||i.revealed&&i.expanded)&&i.children[i.children.length-1];)!t&&i.hasChildrenInternal&&i.populate(),i=!e||i.revealed&&i.expanded?i.children[i.children.length-1]:null;return i||(!this.parent||this.parent.isRoot?null:this.parent)}isEventWithinDisclosureTriangle(e){if(!this.hasChildrenInternal)return!1;const t=r.UIUtils.enclosingNodeOrSelfWithNodeName(e.target,"td");if(!(t&&t instanceof HTMLElement&&t.classList.contains("disclosure")))return!1;const i=t.getBoundingClientRect().left+this.leftPadding;return e.pageX>=i&&e.pageX<=i+this.#e}attach(){if(!this.dataGrid||this.attachedInternal)return;this.attachedInternal=!0;const e=this.traversePreviousNode(!0,!0),t=e?e.element():this.dataGrid.topFillerRow;if(this.dataGrid.dataTableBody.insertBefore(this.element(),t.nextSibling),this.expandedInternal)for(let e=0;e<this.children.length;++e)this.children[e].attach()}detach(){if(this.attachedInternal){this.attachedInternal=!1,this.elementInternal&&this.elementInternal.remove();for(let e=0;e<this.children.length;++e)this.children[e].detach()}}savePosition(){if(!this.savedPosition){if(!this.parent)throw new Error("savePosition: Node must have a parent.");this.savedPosition={parent:this.parent,index:this.parent.children.indexOf(this)}}}restorePosition(){this.savedPosition&&(this.parent!==this.savedPosition.parent&&this.savedPosition.parent.insertChild(this,this.savedPosition.index),this.savedPosition=null)}}class C extends y{isCreationNode;constructor(e,t){super(e,t),this.isCreationNode=!0}}class w extends r.Widget.VBox{dataGrid;constructor(e,t){super(void 0,void 0,t),this.dataGrid=e,this.element.appendChild(e.element),this.setDefaultFocusedElement(e.element),this.registerRequiredCSS(n)}wasShown(){super.wasShown(),this.dataGrid.wasShown()}willHide(){this.dataGrid.willHide(),super.willHide()}onResize(){super.onResize(),this.dataGrid.onResize()}elementsToRestoreScrollPositionsFor(){return[this.dataGrid.scrollContainer]}}var N=Object.freeze({__proto__:null,CenterResizerOverBorderAdjustment:x,ColumnResizePadding:v,CornerWidth:m,CreationDataGridNode:C,DataGridImpl:b,DataGridNode:y,DataGridWidget:w,get Order(){return f}});let k=0;class S extends(e.ObjectWrapper.eventMixin(b)){onScrollBound;visibleNodes;enableAutoScrollToBottom=!1;keepScrollingToBottom=!1;updateIsFromUser;lastScrollTop;firstVisibleIsStriped;isStriped;filters=[];id=k++;constructor(e){super(e),this.onScrollBound=this.onScroll.bind(this),this.scrollContainer.addEventListener("scroll",this.onScrollBound,!0),this.visibleNodes=[],this.inline=!1,this.updateIsFromUser=!1,this.lastScrollTop=0,this.firstVisibleIsStriped=!1,this.isStriped=!1,this.setRootNode(new I)}setStriped(e){this.isStriped=e;let t=!0;if(this.visibleNodes.length){const e=this.filteredNodes();t=Boolean(e.indexOf(this.visibleNodes[0]))}this.updateStripesClass(t)}setFilters(e){this.filters!==e&&(this.filters=e,this.scheduleUpdate())}updateStripesClass(e){this.element.classList.toggle("striped-data-grid",!e&&this.isStriped),this.element.classList.toggle("striped-data-grid-starts-with-odd",e&&this.isStriped)}setScrollContainer(e){this.scrollContainer.removeEventListener("scroll",this.onScrollBound,!0),this.scrollContainerInternal=e,this.scrollContainer.addEventListener("scroll",this.onScrollBound,!0)}onResize(){this.keepScrollingToBottom&&(this.scrollContainer.scrollTop=this.scrollContainer.scrollHeight-this.scrollContainer.clientHeight),this.scheduleUpdate(),super.onResize()}setEnableAutoScrollToBottom(e){this.keepScrollingToBottom=this.enableAutoScrollToBottom=e}onScroll(e){this.lastScrollTop!==this.scrollContainer.scrollTop&&this.scheduleUpdate(!0)}scheduleUpdateStructure(){this.scheduleUpdate()}scheduleUpdate(e){this.updateIsFromUser=this.updateIsFromUser||Boolean(e),s.write(`ViewportDataGrid.render ${this.id}`,this.update.bind(this))}updateInstantly(){this.update()}renderInline(){this.inline=!0,super.renderInline(),this.update()}getStringifiedCellValues(e,t){return JSON.stringify(Object.entries(e).filter((([e])=>t.has(e))).map((([,e])=>e instanceof Node?e.textContent:String(e)))).toLowerCase()}testNodeWithFilter(e,t){let i=!1;const{key:o,text:r,negative:s,regex:n}=t,a=this.getStringifiedCellValues(e.data,o?new Set(o.split(",")):new Set(this.visibleColumnsArray.map((e=>e.id))));return n?i=n.test(a):r&&(i=a.includes(r.toLowerCase())),s?!i:i}testNodeWithFilters(e){for(const t of this.filters){if(!this.testNodeWithFilter(e,t))return!1}return!0}calculateVisibleNodes(e,t){const i=this.filteredNodes();if(this.inline)return{topPadding:0,bottomPadding:0,contentHeight:0,visibleNodes:i,offset:0};const o=i.length;let r=0,s=0;for(;r<o&&s+i[r].nodeSelfHeight()<t;++r)s+=i[r].nodeSelfHeight();const n=r,a=s;for(;r<o&&s<t+e;++r)s+=i[r].nodeSelfHeight();const l=r;let d=0;for(;r<o;++r)d+=i[r].nodeSelfHeight();return this.enableAutoScrollToBottom&&(this.keepScrollingToBottom=l===i.length),{topPadding:a,bottomPadding:d,contentHeight:s-a,visibleNodes:i.slice(n,l),offset:n}}getNumberOfRows(){return this.filteredNodes().length}contentHeight(){const e=this.filteredNodes();let t=0;for(let i=0,o=e.length;i<o;++i)t+=e[i].nodeSelfHeight();return t}update(){const e=this.scrollContainer.clientHeight-this.headerHeightInScroller(),t=this.contentHeight(),i=this.scrollContainer.scrollTop,o=Math.max(0,t-e);let r=i;!this.updateIsFromUser&&this.keepScrollingToBottom&&(r=o),this.updateIsFromUser=!1,r=Math.min(o,r);const s=this.calculateVisibleNodes(e,r),n=s.visibleNodes,a=new Set(n);for(let e=0;e<this.visibleNodes.length;++e){const t=this.visibleNodes[e];if(!a.has(t)&&t.attached()){const e=t.existingElement();e&&e.remove()}}let l=this.topFillerRowElement();const d=this.dataTableBody;let h=s.offset;if(n.length){const e=this.filteredNodes().indexOf(n[0]);this.updateStripesClass(Boolean(e%2)),this.keepScrollingToBottom&&-1!==e&&Boolean(e%2)!==this.firstVisibleIsStriped&&(h+=1)}this.firstVisibleIsStriped=Boolean(h%2);for(let e=0;e<n.length;++e){const t=n[e],i=t.element();t.setStriped((h+e)%2==0),i!==l.nextSibling&&d.insertBefore(i,l.nextSibling),t.revealed=!0,l=i}this.setVerticalPadding(s.topPadding,s.bottomPadding),this.lastScrollTop=r,r!==i&&(this.scrollContainer.scrollTop=r);const c=s.contentHeight<=e&&s.topPadding+s.bottomPadding===0;c!==this.element.classList.contains("data-grid-fits-viewport")&&(this.element.classList.toggle("data-grid-fits-viewport",c),this.updateWidths()),this.visibleNodes=n,this.dispatchEventToListeners("ViewportCalculated")}revealViewportNode(e){const t=this.filteredNodes(),i=t.indexOf(e);if(-1===i)return;let o=0;for(let e=0;e<i;++e)o+=t[e].nodeSelfHeight();const r=o+e.nodeSelfHeight();let s=this.scrollContainer.scrollTop;const n=this.scrollContainer.offsetHeight-this.headerHeightInScroller();s>o?(s=o,this.keepScrollingToBottom=!1):s+n<r&&(s=r-n),this.scrollContainer.scrollTop=s}filteredNodes(){return this.rootNode().flatChildren().filter(this.testNodeWithFilters.bind(this))}}class I extends y{stale;flatNodes;isStripedInternal;constructor(e,t){super(e,t),this.stale=!1,this.flatNodes=null,this.isStripedInternal=!1}element(){const e=this.existingElement(),t=e||this.createElement();return e&&!this.stale||(this.createCells(t),this.stale=!1),t}nodeSelfHeight(){const e=this.dataGrid?.topFillerRow?.nextElementSibling;return e?.classList.contains("data-grid-data-grid-node")&&e.clientHeight||super.nodeSelfHeight()}setStriped(e){this.isStripedInternal=e,this.element().classList.toggle("odd",e)}isStriped(){return this.isStripedInternal}clearFlatNodes(){this.flatNodes=null;const e=this.parent;e&&e.clearFlatNodes()}flatChildren(){if(this.flatNodes)return this.flatNodes;const e=[],t=[this.children],i=[0];let o=0;for(;o>=0;){if(t[o].length<=i[o]){o--;continue}const r=t[o][i[o]++];e.push(r),r.expanded&&r.children.length&&(o++,t[o]=r.children,i[o]=0)}return this.flatNodes=e,e}insertChild(e,t){if(this.clearFlatNodes(),e.parent===this){const i=this.children.indexOf(e);if(i<0&&console.assert(!1,"Inconsistent DataGrid state"),i===t)return;i<t&&--t}e.remove(),e.parent=this,e.dataGrid=this.dataGrid,this.children.length||this.setHasChildren(!0),this.children.splice(t,0,e),e.recalculateSiblings(t),this.expanded&&this.dataGrid&&this.dataGrid.scheduleUpdateStructure()}removeChild(e){if(this.dataGrid&&this.dataGrid.updateSelectionBeforeRemoval(e,!1),this.clearFlatNodes(),e.previousSibling&&(e.previousSibling.nextSibling=e.nextSibling),e.nextSibling&&(e.nextSibling.previousSibling=e.previousSibling),e.parent!==this)throw new Error("removeChild: Node is not a child of this node.");i.ArrayUtilities.removeElement(this.children,e,!0),e.unlink(),this.children.length||this.setHasChildren(!1),this.expanded&&this.dataGrid&&this.dataGrid.scheduleUpdateStructure()}removeChildren(){this.dataGrid&&this.dataGrid.updateSelectionBeforeRemoval(this,!0),this.clearFlatNodes();for(let e=0;e<this.children.length;++e)this.children[e].unlink();this.children=[],this.expanded&&this.dataGrid&&this.dataGrid.scheduleUpdateStructure()}unlink(){const e=this.existingElement();this.attached()&&e&&e.remove(),this.resetNode()}collapse(){if(!this.expanded)return;this.clearFlatNodes(),this.expandedInternal=!1;const e=this.existingElement();e&&e.classList.remove("expanded"),this.selected&&this.dataGrid.announceSelectedGridNode(),this.dataGrid.scheduleUpdateStructure()}expand(){this.expanded||(this.dataGrid.keepScrollingToBottom=!1,this.clearFlatNodes(),super.expand(),this.dataGrid.scheduleUpdateStructure())}traverseNextNode(e,t,i,o){const r=super.traverseNextNode(e,t,i,o);return r&&e&&!this.dataGrid.testNodeWithFilters(r)?r.traverseNextNode(e,t,i,o):r}traversePreviousNode(e,t){const i=super.traversePreviousNode(e,t);return i&&e&&!this.dataGrid.testNodeWithFilters(i)?i.traversePreviousNode(e,t):i}attached(){const e=this.existingElement();return Boolean(this.dataGrid&&e?.parentElement)}refresh(){this.attached()?(this.stale=!0,this.dataGrid.scheduleUpdate()):this.resetElement()}reveal(){this.dataGrid.revealViewportNode(this)}recalculateSiblings(e){this.clearFlatNodes(),super.recalculateSiblings(e)}}var E=Object.freeze({__proto__:null,ViewportDataGrid:S,ViewportDataGridNode:I});class A extends S{sortingFunction;constructor(e){super(e),this.sortingFunction=A.TrivialComparator,this.setRootNode(new G)}static TrivialComparator(e,t){return 0}static NumericComparator(e,t,i){const o=t.data[e],r=i.data[e],s=Number(o instanceof Node?o.textContent:o),n=Number(r instanceof Node?r.textContent:r);return s<n?-1:s>n?1:0}static StringComparator(e,t,i){const o=t.data[e],r=i.data[e],s=o instanceof Node?o.textContent:String(o),n=r instanceof Node?r.textContent:String(r);return s&&n?s<n?-1:s>n?1:0:0}static Comparator(e,t,i,o){return i.isCreationNode&&!o.isCreationNode?1:!i.isCreationNode&&o.isCreationNode?-1:t?e(o,i):e(i,o)}static create(e,t,i){const o=e.length;if(!o)return null;const r=[];for(let t=0;t<e.length;++t){const i=String(t);r.push({id:i,title:e[t],sortable:!0})}const s=[];for(let i=0;i<t.length/o;++i){const r={};for(let s=0;s<e.length;++s)r[s]=t[o*i+s];const n=new G(r);n.selectable=!1,s.push(n)}const n=new A({displayName:i,columns:r}),a=s.length,l=n.rootNode();for(let e=0;e<a;++e)l.appendChild(s[e]);return n.addEventListener("SortingChanged",(function(){const e=n.rootNode().children,t=n.sortColumnId();if(!t)return;let i=!0;for(let o=0;o<e.length;o++){const r=e[o].data[t];if(isNaN(r instanceof Node?r.textContent:r)){i=!1;break}}const o=i?A.NumericComparator:A.StringComparator;n.sortNodes(o.bind(null,t),!n.isSortOrderAscending())})),n}insertChild(e){this.rootNode().insertChildOrdered(e)}sortNodes(e,t){this.sortingFunction=A.Comparator.bind(null,e,t),this.rootNode().recalculateSiblings(0),this.rootNode().sortChildren(),this.scheduleUpdateStructure()}}class G extends I{constructor(e,t){super(e,t)}insertChildOrdered(e){const t=this.dataGrid;t&&this.insertChild(e,i.ArrayUtilities.upperBound(this.children,e,t.sortingFunction))}sortChildren(){const e=this.dataGrid;if(e){this.children.sort(e.sortingFunction);for(let e=0;e<this.children.length;++e){this.children[e].recalculateSiblings(e)}for(let e=0;e<this.children.length;++e){this.children[e].sortChildren()}}}}var T=Object.freeze({__proto__:null,SortableDataGrid:A,SortableDataGridNode:G});const R={showDBefore:"Show {PH1} before",showDAfter:"Show {PH1} after",showAllD:"Show all {PH1}"},H=t.i18n.registerUIStrings("ui/legacy/components/data_grid/ShowMoreDataGridNode.ts",R),L=t.i18n.getLocalizedString.bind(void 0,H);var z=Object.freeze({__proto__:null,ShowMoreDataGridNode:class extends y{callback;startPosition;endPosition;chunkSize;showNext;showAll;showLast;selectable;hasCells;constructor(e,t,i,o){super({summaryRow:!0},!1),this.callback=e,this.startPosition=t,this.endPosition=i,this.chunkSize=o,this.showNext=r.UIUtils.createTextButton(L(R.showDBefore,{PH1:this.chunkSize})),this.showNext.addEventListener("click",this.showNextChunk.bind(this),!1),this.showAll=r.UIUtils.createTextButton(""),this.showAll.addEventListener("click",this.showAllInternal.bind(this),!1),this.showLast=r.UIUtils.createTextButton(L(R.showDAfter,{PH1:this.chunkSize})),this.showLast.addEventListener("click",this.showLastChunk.bind(this),!1),this.updateLabels(),this.selectable=!1}showNextChunk(){this.callback(this.startPosition,this.startPosition+this.chunkSize)}showAllInternal(){this.callback(this.startPosition,this.endPosition)}showLastChunk(){this.callback(this.endPosition-this.chunkSize,this.endPosition)}updateLabels(){const e=this.endPosition-this.startPosition;e>this.chunkSize?(this.showNext.classList.remove("hidden"),this.showLast.classList.remove("hidden")):(this.showNext.classList.add("hidden"),this.showLast.classList.add("hidden")),this.showAll.textContent=L(R.showAllD,{PH1:e})}createCells(e){this.hasCells=!1,super.createCells(e)}createCell(e){const t=this.createTD(e);return t.classList.add("show-more"),this.hasCells||(this.hasCells=!0,this.depth&&this.dataGrid&&t.style.setProperty("padding-left",this.depth*this.dataGrid.indentWidth+"px"),t.appendChild(this.showNext),t.appendChild(this.showAll),t.appendChild(this.showLast)),t}setStartPosition(e){this.startPosition=e,this.updateLabels()}setEndPosition(e){this.endPosition=e,this.updateLabels()}nodeSelfHeight(){return 40}dispose(){}}}),W={cssText:`*{box-sizing:border-box;min-width:0;min-height:0}:root{height:100%;overflow:hidden;interpolate-size:allow-keywords}body{height:100%;width:100%;position:relative;overflow:hidden;margin:0;cursor:default;font-family:var(--default-font-family);font-size:12px;tab-size:4;user-select:none;color:var(--sys-color-on-surface);background:var(--sys-color-cdt-base-container)}:focus{outline-width:0}.monospace{font-family:var(--monospace-font-family);font-size:var(\n    --monospace-font-size\n  )!important}.source-code{font-family:var(--source-code-font-family);font-size:var(\n    --source-code-font-size\n  )!important;white-space:pre-wrap;&:not(input)::selection{color:var(--sys-color-on-surface)}}.source-code.breakpoint{white-space:nowrap}.source-code .devtools-link.text-button{max-width:100%;overflow:hidden;text-overflow:ellipsis}img{-webkit-user-drag:none}iframe,\na img{border:none}.fill{position:absolute;inset:0}iframe.fill{width:100%;height:100%}.widget{position:relative;flex:auto;contain:style}.hbox{display:flex;flex-direction:row!important;position:relative}.vbox{display:flex;flex-direction:column!important;position:relative}.view-container > devtools-toolbar{border-bottom:1px solid var(--sys-color-divider)}.flex-auto{flex:auto}.flex-none{flex:none}.flex-centered{display:flex;align-items:center;justify-content:center}.overflow-auto{overflow:auto;background-color:var(--sys-color-cdt-base-container)}iframe.widget{position:absolute;width:100%;height:100%;inset:0}.hidden{display:none!important}.highlighted-search-result{border-radius:1px;background-color:var(--sys-color-yellow-container);outline:1px solid var(--sys-color-yellow-container)}.link{cursor:pointer;text-decoration:underline;color:var(--sys-color-primary);outline-offset:2px}button,\ninput,\nselect{font-family:inherit;font-size:inherit}select option,\nselect optgroup,\ninput{background-color:var(--sys-color-cdt-base-container)}input{color:inherit;&[type="checkbox"]{position:relative;outline:none;display:flex;align-items:center;justify-content:center;&:hover::after,\n    &:active::before{content:"";height:24px;width:24px;border-radius:var(--sys-shape-corner-full);position:absolute}&:not(.-theme-preserve){accent-color:var(--sys-color-primary-bright);color:var(--sys-color-on-primary)}&:not(:disabled):hover::after{background-color:var(--sys-color-state-hover-on-subtle)}&:not(:disabled):active::before{background-color:var(--sys-color-state-ripple-neutral-on-subtle)}&:not(:disabled):focus-visible::before{content:"";height:15px;width:15px;border-radius:5px;position:absolute;border:2px solid var(--sys-color-state-focus-ring)}&.small:hover::after,\n    &.small:active::before{height:12px;width:12px;border-radius:2px}}}input::placeholder{--override-input-placeholder-color:rgb(0 0 0/54%);color:var(--override-input-placeholder-color)}.theme-with-dark-background input::placeholder,\n:host-context(.theme-with-dark-background) input::placeholder{--override-input-placeholder-color:rgb(230 230 230/54%)}.harmony-input:not([type]),\n.harmony-input[type="number"],\n.harmony-input[type="text"]{padding:3px 6px;height:24px;border:1px solid var(--sys-color-neutral-outline);border-radius:4px;&.error-input,\n  &:invalid{border-color:var(--sys-color-error)}&:not(.error-input, :invalid):focus{border-color:var(--sys-color-state-focus-ring)}&:not(.error-input, :invalid):hover:not(:focus){background:var(--sys-color-state-hover-on-subtle)}}input[type="radio"]{height:17px;width:17px;min-width:17px;border-radius:8px;vertical-align:sub;margin:0 5px 5px 0;accent-color:var(--sys-color-primary-bright);color:var(--sys-color-on-primary);&:focus{box-shadow:var(--legacy-focus-ring-active-shadow)}}@media (forced-colors: active){input[type="radio"]{--gradient-start:ButtonFace;--gradient-end:ButtonFace;&:checked{--gradient-start:Highlight;--gradient-end:Highlight}}}input[type="range"]{appearance:none;margin:0;padding:0;height:10px;width:88px;outline:none;background:none}input[type="range"]::-webkit-slider-thumb,\n.-theme-preserve{appearance:none;margin:0;padding:0;border:0;width:12px;height:12px;margin-top:-5px;border-radius:50%;background-color:var(--sys-color-primary)}input[type="range"]::-webkit-slider-runnable-track{appearance:none;margin:0;padding:0;width:100%;height:2px;background-color:var(--sys-color-surface-variant)}input[type="range"]:focus::-webkit-slider-thumb{box-shadow:0 0 0 2px var(--sys-color-inverse-primary)}input[type="range"]:disabled::-webkit-slider-thumb{background-color:var(--sys-color-state-disabled)}@media (forced-colors: active){input[type="range"]{forced-color-adjust:none}}.highlighted-search-result.current-search-result{--override-current-search-result-background-color:rgb(255 127 0/80%);border-radius:1px;padding:1px;margin:-1px;background-color:var(--override-current-search-result-background-color)}.dimmed{opacity:60%}.editing{box-shadow:var(--drop-shadow);background-color:var(--sys-color-cdt-base-container);text-overflow:clip!important;padding-left:2px;margin-left:-2px;padding-right:2px;margin-right:-2px;margin-bottom:-1px;padding-bottom:1px;opacity:100%!important}.editing,\n.editing *{color:var(\n    --sys-color-on-surface\n  )!important;text-decoration:none!important}select{appearance:none;user-select:none;height:var(--sys-size-11);border:var(--sys-size-1) solid var(--sys-color-neutral-outline);border-radius:var(--sys-shape-corner-extra-small);color:var(--sys-color-on-surface);font:inherit;margin:0;outline:none;padding:0 var(--sys-size-9) 0 var(--sys-size-5);background-image:var(--combobox-dropdown-arrow);background-color:transparent;background-position:right center;background-repeat:no-repeat;&:disabled{opacity:100%;border-color:transparent;color:var(--sys-color-state-disabled);background-color:var(--sys-color-state-disabled-container);pointer-events:none}&:enabled{&:hover{background-color:var(--sys-color-state-hover-on-subtle)}&:active{background-color:var(--sys-color-state-ripple-neutral-on-subtle)}&:hover:active{background:var(--combobox-dropdown-arrow),linear-gradient(var(--sys-color-state-hover-on-subtle),var(--sys-color-state-hover-on-subtle)),linear-gradient(var(--sys-color-state-ripple-neutral-on-subtle),var(--sys-color-state-ripple-neutral-on-subtle));background-position:right center;background-repeat:no-repeat}&:focus{outline:var(--sys-size-2) solid var(--sys-color-state-focus-ring);outline-offset:-1px}}}@media (forced-colors: active) and (prefers-color-scheme: light){:root,\n  .theme-with-dark-background,\n  :host-context(.theme-with-dark-background){--combobox-dropdown-arrow:var(--image-file-arrow-drop-down-light)}}@media (forced-colors: active) and (prefers-color-scheme: dark){:root,\n  .theme-with-dark-background,\n  :host-context(.theme-with-dark-background){--combobox-dropdown-arrow:var(--image-file-arrow-drop-down-dark)}}.chrome-select-label{margin:0 var(--sys-size-10);flex:none;p p{margin-top:0;color:var(--sys-color-token-subtle)}.reload-warning{margin-left:var(--sys-size-5)}}.settings-select{margin:0}select optgroup,\nselect option{background-color:var(--sys-color-cdt-base-container);color:var(--sys-color-on-surface)}.gray-info-message{text-align:center;font-style:italic;padding:6px;color:var(--sys-color-token-subtle);white-space:nowrap}.empty-state{margin:var(--sys-size-5);display:flex;flex-grow:1;justify-content:center;align-items:center;flex-direction:column;text-align:center;min-height:fit-content;min-width:fit-content;> *{max-width:var(--sys-size-29)}.empty-state-header{font:var(--sys-typescale-headline5);margin-bottom:var(--sys-size-3)}.empty-state-description{font:var(--sys-typescale-body4-regular);color:var(--sys-color-on-surface-subtle);> x-link{white-space:nowrap;margin-left:var(--sys-size-3)}}> devtools-button{margin-top:var(--sys-size-7)}}dt-icon-label{flex:none}.full-widget-dimmed-banner a{color:inherit}.full-widget-dimmed-banner{color:var(--sys-color-token-subtle);background-color:var(--sys-color-cdt-base-container);display:flex;justify-content:center;align-items:center;text-align:center;padding:20px;position:absolute;inset:0;font-size:13px;overflow:auto;z-index:500}.dot::before{content:var(--image-file-empty);width:6px;height:6px;border-radius:50%;outline:1px solid var(--icon-gap-default);left:9px;position:absolute;top:9px;z-index:1}.green::before{background-color:var(--sys-color-green-bright)}.purple::before{background-color:var(--sys-color-purple-bright)}.expandable-inline-button{background-color:var(--sys-color-cdt-base-container);color:var(--sys-color-on-surface);cursor:pointer;border-radius:3px}.undisplayable-text,\n.expandable-inline-button{border:none;padding:1px 3px;margin:0 2px;font-size:11px;font-family:sans-serif;white-space:nowrap;display:inline-block}.undisplayable-text::after,\n.expandable-inline-button::after{content:attr(data-text)}.undisplayable-text{color:var(--sys-color-state-disabled);font-style:italic}.expandable-inline-button:hover,\n.expandable-inline-button:focus-visible{background-color:var(--sys-color-state-hover-on-subtle)}.expandable-inline-button:focus-visible{background-color:var(--sys-color-state-focus-highlight)}::selection{background-color:var(--sys-color-state-text-highlight);color:var(--sys-color-state-on-text-highlight)}button.link{border:none;background:none;padding:3px}button.link:focus-visible{outline:2px solid var(--sys-color-state-focus-ring);outline-offset:2px;border-radius:var(--sys-shape-corner-full)}.data-grid-data-grid-node button.link:focus-visible{border-radius:var(--sys-shape-corner-extra-small);padding:0;margin-top:3px}@media (forced-colors: active){.dimmed,\n  select:disabled{opacity:100%}.harmony-input:not([type]),\n  .harmony-input[type="number"],\n  .harmony-input[type="text"]{border:1px solid ButtonText}.harmony-input:not([type]):focus,\n  .harmony-input[type="number"]:focus,\n  .harmony-input[type="text"]:focus{border:1px solid Highlight}}input.custom-search-input::-webkit-search-cancel-button{appearance:none;width:16px;height:15px;margin-right:0;opacity:70%;mask-image:var(--image-file-cross-circle-filled);mask-position:center;mask-repeat:no-repeat;mask-size:99%;background-color:var(--icon-default)}input.custom-search-input::-webkit-search-cancel-button:hover{opacity:99%}.spinner::before{display:block;width:var(--dimension,24px);height:var(--dimension,24px);border:var(--override-spinner-size,3px) solid var(--override-spinner-color,var(--sys-color-token-subtle));border-radius:12px;clip:rect(0,var(--clip-size,15px),var(--clip-size,15px),0);content:"";position:absolute;animation:spinner-animation 1s linear infinite;box-sizing:border-box}@keyframes spinner-animation{from{transform:rotate(0)}to{transform:rotate(360deg)}}.adorner-container{display:inline-flex;vertical-align:middle}.adorner-container.hidden{display:none}.adorner-container devtools-adorner{margin-left:3px}:host-context(.theme-with-dark-background) devtools-adorner{--override-adorner-border-color:var(--sys-color-tonal-outline);--override-adorner-active-background-color:var(\n    --sys-color-state-riple-neutral-on-subtle\n  )}.panel{display:flex;overflow:hidden;position:absolute;inset:0;z-index:0;background-color:var(--sys-color-cdt-base-container)}.panel-sidebar{overflow-x:hidden;background-color:var(--sys-color-cdt-base-container)}iframe.extension{flex:auto;width:100%;height:100%}iframe.panel.extension{display:block;height:100%}@media (forced-colors: active){:root{--legacy-accent-color:Highlight;--legacy-focus-ring-inactive-shadow-color:ButtonText}}devtools-toolbar{& > *{position:relative;display:flex;background-color:transparent;flex:none;align-items:center;justify-content:center;height:var(--toolbar-height);border:none;white-space:pre;overflow:hidden;max-width:100%;color:var(--icon-default);cursor:default;& .devtools-link{color:var(--icon-default)}}.status-buttons{padding:0 var(--sys-size-2);gap:var(--sys-size-2)}& > :not(select){padding:0}& > devtools-issue-counter{margin-top:-4px;padding:0 1px}devtools-adorner.fix-perf-icon{--override-adorner-text-color:transparent;--override-adorner-border-color:transparent;--override-adorner-background-color:transparent}devtools-issue-counter.main-toolbar{margin-left:1px;margin-right:1px}.toolbar-dropdown-arrow{pointer-events:none;flex:none;top:2px}.toolbar-button.dark-text .toolbar-dropdown-arrow{color:var(--sys-color-on-surface)}.toolbar-button{white-space:nowrap;overflow:hidden;min-width:28px;background:transparent;border-radius:0;&[aria-haspopup="true"][aria-expanded="true"]{pointer-events:none}}.toolbar-item-search{min-width:5.2em;max-width:300px;flex:1 1 auto;justify-content:start;overflow:revert}.toolbar-text{margin:0 5px;flex:none;color:var(--ui-text)}.toolbar-text:empty{margin:0}.toolbar-has-dropdown{justify-content:space-between;height:var(--sys-size-9);padding:0 var(--sys-size-2) 0 var(--sys-size-4);margin:0 var(--sys-size-2);gap:var(--sys-size-2);border-radius:var(--sys-shape-corner-extra-small);&:hover::after,\n    &:active::before{content:"";height:100%;width:100%;border-radius:inherit;position:absolute;top:0;left:0}&:hover::after{background-color:var(--sys-color-state-hover-on-subtle)}&:active::before{background-color:var(--sys-color-state-ripple-neutral-on-subtle)}&:focus-visible{outline:var(--sys-size-2) solid var(--sys-color-state-focus-ring)}&[disabled]{pointer-events:none;background-color:var(--sys-color-state-disabled-container);color:var(--sys-color-state-disabled)}}.toolbar-has-dropdown-shrinkable{flex-shrink:1}.toolbar-has-dropdown .toolbar-text{margin:0;text-overflow:ellipsis;flex:auto;overflow:hidden;text-align:right}.toolbar-button:not(.toolbar-has-dropdown):focus-visible::before{position:absolute;inset:2px;background-color:var(--sys-color-state-focus-highlight);border-radius:2px;content:"";z-index:-1}.toolbar-glyph{flex:none}.toolbar-button:disabled{opacity:50%}.toolbar-button.copied-to-clipboard::after{content:attr(data-content);position:fixed;margin-top:calc(2 * var(--toolbar-height));padding:3px 5px;color:var(--sys-color-token-subtle);background:var(--sys-color-cdt-base-container);animation:2s fade-out;font-weight:normal;border:1px solid var(--sys-color-divider);border-radius:3px}.toolbar-button.toolbar-state-on .toolbar-glyph{color:var(--icon-toggled)}.toolbar-state-on.toolbar-toggle-with-dot .toolbar-text::after{content:"";position:absolute;bottom:2px;background-color:var(--sys-color-primary-bright);width:4.5px;height:4.5px;border:2px solid var(--override-toolbar-background-color,--sys-color-cdt-base-container);border-radius:50%;right:0}.toolbar-button.toolbar-state-on.toolbar-toggle-with-red-color .toolbar-glyph,\n  .toolbar-button.toolbar-state-off.toolbar-default-with-red-color\n    .toolbar-glyph{color:var(\n      --icon-error\n    )!important}.toolbar-button:not(\n      .toolbar-has-glyph,\n      .toolbar-has-dropdown,\n      .largeicon-menu,\n      .toolbar-button-secondary\n    ){font-weight:bold}.toolbar-button.dark-text .toolbar-text{color:var(\n      --sys-color-on-surface\n    )!important}.toolbar-button.toolbar-state-on .toolbar-text{color:var(--sys-color-primary)}.toolbar-button.toolbar-state-on:enabled:active .toolbar-text{color:var(--sys-color-primary-bright)}.toolbar-button:enabled:hover:not(:active) .toolbar-glyph{color:var(--sys-color-on-surface)}.toolbar-button:enabled:hover:not(:active) .toolbar-text{color:var(--sys-color-on-surface)}.toolbar-button.toolbar-state-on:enabled:hover:not(:active) .toolbar-glyph{color:var(--sys-color-primary)}.toolbar-button.toolbar-state-on:enabled:hover:not(:active) .toolbar-text{color:var(--sys-color-primary)}& > dt-checkbox{padding:0 5px 0 0}& > select{height:var(--sys-size-9);min-width:var(--sys-size-14)}.toolbar-input{box-shadow:inset 0 0 0 2px transparent;box-sizing:border-box;width:120px;height:var(--sys-size-9);padding:0 var(--sys-size-2) 0 var(--sys-size-5);margin:1px 3px;border-radius:100px;min-width:35px;position:relative;&.focused{box-shadow:inset 0 0 0 2px var(--sys-color-state-focus-ring)}&:not(:has(devtools-button:hover), .disabled):hover{background-color:var(--sys-color-state-hover-on-subtle)}&::before{content:"";box-sizing:inherit;height:100%;width:100%;position:absolute;left:0;background:var(--sys-color-cdt-base);z-index:-1}& > devtools-icon{color:var(--sys-color-on-surface-subtle);width:var(--sys-size-8);height:var(--sys-size-8);margin-right:var(--sys-size-3)}&.disabled > devtools-icon{color:var(--sys-color-state-disabled)}}.toolbar-filter .toolbar-input-clear-button{margin-right:var(--sys-size-4)}.toolbar-input-empty .toolbar-input-clear-button{display:none}.toolbar-prompt-proxy{flex:1}.toolbar-input-prompt{flex:1;overflow:hidden;white-space:nowrap;cursor:text;color:var(--sys-color-on-surface)}.toolbar-divider{background-color:var(--sys-color-divider);width:1px;margin:5px 4px;height:16px}.toolbar-spacer{flex:auto}.toolbar-button.emulate-active{background-color:var(--sys-color-surface-variant)}&:not([floating]) > :last-child:not(:first-child, select){flex-shrink:1;justify-content:left}&:not([floating]) > .toolbar-button:last-child:not(:first-child, select){justify-content:left;margin-right:2px}& > .highlight::before{content:"";position:absolute;inset:2px;border-radius:2px;background:var(--sys-color-neutral-container);z-index:-1}& > .highlight:focus-visible{background:var(--sys-color-tonal-container);& > .title{color:var(--sys-color-on-tonal-container)}}devtools-icon.leading-issue-icon{margin:0 7px}@media (forced-colors: active){.toolbar-button:disabled{opacity:100%;color:Graytext}devtools-toolbar > *,\n    .toolbar-text{color:ButtonText}.toolbar-button:disabled .toolbar-text{color:Graytext}devtools-toolbar > select:disabled{opacity:100%;color:Graytext}.toolbar-button.toolbar-state-on .toolbar-glyph{forced-color-adjust:none;color:Highlight}.toolbar-button.toolbar-state-on .toolbar-text{forced-color-adjust:none;color:Highlight}.toolbar-button:enabled:hover:not(:active) .toolbar-text,\n    .toolbar-button:enabled:focus:not(:active) .toolbar-text{color:HighlightText}.toolbar-button:disabled devtools-icon{color:GrayText}.toolbar-button:disabled .toolbar-glyph{color:GrayText}.toolbar-button:enabled.hover:not(:active) .toolbar-glyph{forced-color-adjust:none;color:Highlight}.toolbar-button:enabled:hover .toolbar-glyph,\n    .toolbar-button:enabled:focus .toolbar-glyph,\n    .toolbar-button:enabled:hover:not(:active) .toolbar-glyph,\n    .toolbar-button:enabled:hover devtools-icon,\n    .toolbar-button:enabled:focus devtools-icon{color:HighlightText}.toolbar-input{forced-color-adjust:none;background:canvas;box-shadow:var(--legacy-focus-ring-inactive-shadow)}.toolbar-input.focused,\n    .toolbar-input:not(.toolbar-input-empty){forced-color-adjust:none;background:canvas;box-shadow:var(--legacy-focus-ring-active-shadow)}.toolbar-input:hover{box-shadow:var(--legacy-focus-ring-active-shadow)}devtools-toolbar .devtools-link{color:linktext}.toolbar-has-dropdown{forced-color-adjust:none;background:ButtonFace;color:ButtonText}}}@keyframes fade-out{from{opacity:100%}to{opacity:0%}}.webkit-css-property{color:var(--webkit-css-property-color,var(--sys-color-token-property-special))}.webkit-html-comment{color:var(--sys-color-token-comment)}.webkit-html-tag{color:var(--sys-color-token-tag)}.webkit-html-tag-name,\n.webkit-html-close-tag-name{color:var(--sys-color-token-tag)}.webkit-html-pseudo-element{color:var(--sys-color-token-pseudo-element)}.webkit-html-js-node,\n.webkit-html-css-node{color:var(--text-primary);white-space:pre-wrap}.webkit-html-text-node{color:var(--text-primary);unicode-bidi:-webkit-isolate}.webkit-html-entity-value{background-color:rgb(0 0 0/15%);unicode-bidi:-webkit-isolate}.webkit-html-doctype{color:var(--text-secondary)}.webkit-html-attribute-name{color:var(--sys-color-token-attribute);unicode-bidi:-webkit-isolate}.webkit-html-attribute-value{color:var(--sys-color-token-attribute-value);unicode-bidi:-webkit-isolate;word-break:break-all}.devtools-link{color:var(--text-link);text-decoration:underline;outline-offset:2px;.elements-disclosure &{color:var(--text-link)}devtools-icon{vertical-align:baseline;color:var(--sys-color-primary)}:focus .selected & devtools-icon{color:var(--sys-color-tonal-container)}&:focus-visible{outline-width:unset}&.invalid-link{color:var(--text-disabled);text-decoration:none}&:not(.devtools-link-prevent-click, .invalid-link){cursor:pointer}@media (forced-colors: active){&:not(.devtools-link-prevent-click){forced-color-adjust:none;color:linktext}&:focus-visible{background:Highlight;color:HighlightText}}}\n/*# sourceURL=${import.meta.resolve("./inspectorCommon.css")} */\n`};class D extends HTMLElement{static observedAttributes=["striped","name","inline"];#t=A.create(["dummy"],[],"");#i=new MutationObserver(this.#o.bind(this));#r=new ResizeObserver((()=>{this.inline||this.#t.onResize()}));#s;#n=[];#a=new Set;#l=new Set;#d=null;constructor(){super(),this.style.display="flex",this.#t.element.style.flex="auto",this.#s=this.attachShadow({mode:"open",delegatesFocus:!0}),this.#s.createChild("style").textContent=n.cssText,this.#s.createChild("style").textContent=W.cssText,this.#s.appendChild(this.#t.element),this.#t.addEventListener("SelectedNode",(e=>this.dispatchEvent(new CustomEvent("select",{detail:e.data.configElement})))),this.#t.addEventListener("DeselectedNode",(()=>this.dispatchEvent(new CustomEvent("select",{detail:null})))),this.#t.addEventListener("SortingChanged",(()=>this.dispatchEvent(new CustomEvent("sort",{detail:{columnId:this.#t.sortColumnId(),ascending:this.#t.isSortOrderAscending()}})))),this.#t.setRowContextMenuCallback(((e,t)=>{this.dispatchEvent(new CustomEvent("contextmenu",{detail:{menu:e,element:t.configElement}}))})),this.#t.setHeaderContextMenuCallback((e=>{for(const t of this.#n)this.#a.has(t.id)&&e.defaultSection().appendCheckboxItem(this.#t.columns[t.id].title,(()=>{this.#l.has(t.id)?this.#l.delete(t.id):this.#l.add(t.id),this.#t.setColumnsVisibility(new Set(this.#n.map((({id:e})=>e)).filter((e=>!this.#l.has(e)))))}),{checked:!this.#l.has(t.id)})})),this.#i.observe(this,{childList:!0,attributes:!0,subtree:!0,characterData:!0}),this.#r.observe(this),this.#h(),this.#c(this.querySelectorAll("tr"))}attributeChangedCallback(e,t,i){if(t!==i)switch(e){case"striped":this.#t.setStriped("true"!==i);break;case"name":this.#t.displayName=i??"";break;case"inline":this.#t.renderInline()}}set striped(e){this.toggleAttribute("striped",e)}get striped(){return B(this,"striped")}set inline(e){this.toggleAttribute("inline",e)}get inline(){return B(this,"inline")}set displayName(e){this.setAttribute("name",e)}get displayName(){return this.getAttribute("name")}set filters(e){this.#t.setFilters(e),this.#t.element.setAttribute("aria-rowcount",String(this.#t.getNumberOfRows()))}get columns(){return this.#n}#h(){for(const e of Object.keys(this.#t.columns))this.#t.removeColumn(e);this.#a.clear(),this.#n=[];let e=!1;for(const t of this.querySelectorAll("th[id]")||[]){const i=t.id;let o=t.textContent?.trim()||"";const r=t.firstElementChild?document.createDocumentFragment():void 0;if(r){o="";for(const e of t.children)r.appendChild(e.cloneNode(!0)),o+=e.shadowRoot?e.shadowRoot.textContent:e.textContent}const s=B(t,"sortable"),n=t.getAttribute("width")??void 0,a=t.hasAttribute("fixed");let l=t.getAttribute("align")??void 0;"center"!==l&&"right"!==l&&(l=void 0);const d="boolean"===t.getAttribute("type")?"Boolean":"String",h=parseFloat(t.getAttribute("weight")||"")??void 0,c=t.hasAttribute("editable");c&&(e=!0);const u={id:i,title:o,titleDOMFragment:r,sortable:s,fixedWidth:a,width:n,align:l,weight:h,editable:c,dataType:d};this.#t.addColumn(u),this.#n.push(u),B(t,"hideable")&&this.#a.add(i)}const t=new Set(this.#n.map((({id:e})=>e)).filter((e=>!this.#l.has(e))));t.size&&this.#t.setColumnsVisibility(t),this.#t.setEditCallback(e?this.#u.bind(this):void 0,U),this.#t.deleteCallback=e?this.#g.bind(this):void 0}#p(e){for(const t of e){for(const e of[...t.removedNodes,...t.addedNodes])if(e instanceof HTMLElement&&("TH"===e.nodeName||e.querySelector("th")))return!0;if(t.target instanceof HTMLElement&&t.target.closest("th"))return!0}return!1}#b(e){return[...e].flatMap((e=>e instanceof HTMLTableRowElement?[e]:e instanceof HTMLElement?[...e.querySelectorAll("tr")]:[])).filter((e=>e.querySelector("td")&&!B(e,"placeholder")))}#m(e){for(let t=e.nextElementSibling;t;t=t.nextElementSibling){const e=P.get(t);if(e)return e}return null}#c(e){for(const t of this.#b(e)){const e=this.#t.rootNode(),i=this.#m(t),o=i?e.children.indexOf(i):e.children.length,r=new P(t,this);e.insertChild(r,o),B(t,"selected")&&r.select(),B(t,"dirty")&&r.setDirty(!0),B(t,"inactive")&&r.setInactive(!0),B(t,"highlighted")&&r.setHighlighted(!0)}}#f(e){for(const t of this.#b(e)){const e=P.get(t);e&&e.remove()}}#v(e,t){for(;e?.parentNode&&!(e instanceof HTMLElement);)e=e.parentNode;const i=e instanceof HTMLElement?e.closest("tr"):null,o=i?P.get(i):null;o&&i&&("selected"===t?B(i,"selected")?o.select():o.deselect():"dirty"===t?o.setDirty(B(i,"dirty")):"inactive"===t?o.setInactive(B(i,"inactive")):"highlighted"===t?o.setHighlighted(B(i,"highlighted")):o.refresh())}#x(){this.#d&&(P.remove(this.#d),this.#d=null,this.#t.creationNode=void 0);const e=this.querySelector("tr[placeholder]");if(e){if(!P.get(e)){this.#t.creationNode?.remove();const t=new P(e,this);this.#t.creationNode=t,this.#t.rootNode().appendChild(t)}}else this.#t.creationNode?.remove(),this.#t.creationNode=void 0}#o(e){this.#p(e)&&this.#h(),this.#x();for(const t of e)this.#f(t.removedNodes),this.#c(t.addedNodes),this.#v(t.target,t.attributeName)}#u(e,t,i,o,r){if(e.isCreationNode){this.#d=e;let i=!1;if(r){const e=this.#n.findIndex((({id:e})=>e===t));i=("forward"===r?this.#n.slice(e+1):this.#n.slice(0,e)).some((({editable:e})=>e))}i||e.deselect()}else this.dispatchEvent(new CustomEvent("edit",{detail:{node:e.configElement,columnId:t,valueBeforeEditing:i,newText:o}}))}#g(e){this.dispatchEvent(new CustomEvent("delete",{detail:e.configElement}))}addEventListener(...e){super.addEventListener(...e),"refresh"===e[0]&&(this.#t.refreshCallback=this.#y.bind(this))}#y(){this.dispatchEvent(new CustomEvent("refresh"))}}class P extends G{static#C=new WeakMap;#w;#N;#k=new Set;constructor(e,t){super(),this.#w=e,P.#C.set(e,this),this.#N=t,this.#S(),this.isCreationNode=B(this.#w,"placeholder")}static get(e){return e&&P.#C.get(e)}get configElement(){return this.#w}#S(){const e=this.#w.querySelectorAll("td");for(let t=0;t<e.length;++t){const i=e[t],o=this.#N.columns[t];"Boolean"===o.dataType?this.data[o.id]=B(i,"data-value"):this.data[o.id]=i.dataset.value??i.textContent??""}}createElement(){const e=super.createElement();e.addEventListener("click",this.#I.bind(this)),e.addEventListener("mouseenter",this.#I.bind(this)),e.addEventListener("mouseleave",this.#I.bind(this)),this.#w.hasAttribute("style")&&e.setAttribute("style",this.#w.getAttribute("style")||"");for(const t of this.#w.classList)e.classList.add(t);return e}refresh(){this.#S(),super.refresh();const e=this.existingElement();if(e){this.#w.hasAttribute("style")&&e.setAttribute("style",this.#w.getAttribute("style")||"");for(const t of this.#k)e.classList.remove(t);for(const t of this.#w.classList)e.classList.add(t)}}#I(e){let t=e.target;const i=[];for(;t?.parentElement&&t!==e.currentTarget;)i.push([...t.parentElement.children].indexOf(t)),t=t.parentElement;if(!t)throw new Error("Cell click event target not found in the data grid");let o=this.#w;for(const e of i.reverse())o=o.children[e];o instanceof HTMLElement&&o?.dispatchEvent(new MouseEvent(e.type,{bubbles:!0,composed:!0}))}createCell(e){const t=this.#N.columns.findIndex((({id:t})=>t===e));if("Boolean"===this.#N.columns[t].dataType)return super.createCell(e);const i=this.createTD(e);if(this.isCreationNode)return i;const o=this.#w.querySelectorAll("td")[t];if(!o)throw new Error(`Column ${e} not found in the data grid`);for(const e of o.childNodes)i.appendChild(e.cloneNode(!0));for(const e of o.classList)i.classList.add(e);return i.title=o.title,o.hasAttribute("aria-label")&&this.setCellAccessibleName(o.getAttribute("aria-label")||"",i,e),i}static remove(e){P.#C.delete(e.#w),e.remove()}deselect(){super.deselect(),this.isCreationNode&&this.#N.dispatchEvent(new CustomEvent("create",{detail:this.data}))}}function B(e,t){return e.hasAttribute(t)&&"false"!==e.getAttribute(t)}customElements.define("devtools-data-grid",D);const U={token:"DataGridInternalToken"};export{N as DataGrid,z as ShowMoreDataGridNode,T as SortableDataGrid,E as ViewportDataGrid};
