@keenmate/web-grid 1.0.0-rc07 → 1.0.0-rc08

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.
@@ -1,238 +1,239 @@
1
- (function(V,z){typeof exports=="object"&&typeof module<"u"?z(exports):typeof define=="function"&&define.amd?define(["exports"],z):(V=typeof globalThis<"u"?globalThis:V||self,z(V.WebGrid={}))})(this,function(V){"use strict";var mr=Object.defineProperty;var br=(V,z,ct)=>z in V?mr(V,z,{enumerable:!0,configurable:!0,writable:!0,value:ct}):V[z]=ct;var f=(V,z,ct)=>br(V,typeof z!="symbol"?z+"":z,ct);const z={rowActions:"Row actions",inlineActionsHeader:"Actions",keyboardShortcuts:"Keyboard shortcuts",paginationFirst:"⏮",paginationPrevious:"◀",paginationNext:"▶",paginationLast:"⏭",paginationPageInfo:"Page {current} of {total}",paginationItemCount:"{count} items",paginationPerPage:"per page",dropdownNoOptions:"No options",dropdownSearching:"Searching..."};class ct{constructor(){f(this,"_items",[]);f(this,"_columns",[]);f(this,"_sortMode","none");f(this,"_filterable",!1);f(this,"_pageable",!1);f(this,"_pageSize",10);f(this,"_pageSizes",[10,25,50,100]);f(this,"_striped",!0);f(this,"_hoverable",!0);f(this,"_editable",!1);f(this,"_editTrigger","dblclick");f(this,"_editStartSelection","mousePosition");f(this,"_mode","excel");f(this,"_dropdownToggleVisibility","always");f(this,"_dropdownShowOnFocus",!0);f(this,"_openDropdownOnEnter",!1);f(this,"_checkboxAlwaysEditable",!1);f(this,"_showRowNumbers",!1);f(this,"_invalidCells",[]);f(this,"_showRowToolbar",!1);f(this,"_rowToolbar",["add","delete","duplicate"]);f(this,"_toolbarVerticalAlign","bottom");f(this,"_toolbarHorizontalAlign","center");f(this,"_toolbarTrigger","hover");f(this,"_toolbarPosition","auto");f(this,"_inlineActionsTitle","");f(this,"_contextMenu");f(this,"_contextMenuXOffset",8);f(this,"_contextMenuYOffset",0);f(this,"_rowShortcuts");f(this,"_showShortcutsHelp",!1);f(this,"_shortcutsHelpPosition","top-right");f(this,"_shortcutsHelpContentCallback");f(this,"_idValueMember");f(this,"_idValueCallback");f(this,"_rowLocking");f(this,"_externalLocks",new Map);f(this,"_onrowlockchange");f(this,"_onrowchange");f(this,"_onroweditstart");f(this,"_onroweditcancel");f(this,"_onvalidationerror");f(this,"_validationTooltipCallback");f(this,"_ontoolbarclick");f(this,"_onrowaction");f(this,"_oncontextmenuopen");f(this,"_ondatarequest");f(this,"_onrowdelete");f(this,"_sort",[]);f(this,"_filters",{});f(this,"_currentPage",1);f(this,"_totalItems",null);f(this,"_showPagination",!0);f(this,"_paginationPosition","bottom-center");f(this,"_paginationLabelsCallback");f(this,"_paginationLayout","pageSize|previous|pageInfo|next");f(this,"_summaryPosition");f(this,"_summaryContentCallback");f(this,"_summaryMetadata");f(this,"_summaryInline",!0);f(this,"_customStylesCallback");f(this,"_rowClassCallback");f(this,"_labels",{...z});f(this,"_virtualScroll",!1);f(this,"_virtualScrollThreshold",100);f(this,"_virtualScrollRowHeight",38);f(this,"_virtualScrollBuffer",10);f(this,"_infiniteScroll",!1);f(this,"_infiniteScrollThreshold",100);f(this,"_hasMoreItems",!0);f(this,"_isLoadingMore",!1);f(this,"_editingCell",null);f(this,"_currentCellError",null);f(this,"_isValidating",!1);f(this,"_draftRows",new Map);f(this,"_focusedCell",null);f(this,"_isCommittingFromKeyboard",!1);f(this,"_skipNextDropdownAutoEdit",!1);f(this,"_hoveredRowIndex",null);f(this,"_onInteractionChange",null)}get items(){return this._items}set items(o){this._items=o,this.requestUpdate()}get columns(){return this._columns}set columns(o){this._columns=o,this.requestUpdate()}get sortMode(){return this._sortMode}set sortMode(o){this._sortMode=o,this.requestUpdate()}get filterable(){return this._filterable}set filterable(o){this._filterable=o,this.requestUpdate()}get pageable(){return this._pageable}set pageable(o){this._pageable=o,this.requestUpdate()}get pageSize(){return this._pageSize}set pageSize(o){this._pageSize=o,this.requestUpdate()}get pageSizes(){return this._pageSizes}set pageSizes(o){this._pageSizes=o,this.requestUpdate()}get striped(){return this._striped}set striped(o){this._striped=o,this.requestUpdate()}get hoverable(){return this._hoverable}set hoverable(o){this._hoverable=o,this.requestUpdate()}get editable(){return this._editable}set editable(o){this._editable=o,this.requestUpdate()}get editTrigger(){return this._editTrigger}set editTrigger(o){this._editTrigger=o,this.requestUpdate()}get editStartSelection(){return this._editStartSelection}set editStartSelection(o){this._editStartSelection=o}get mode(){return this._mode}set mode(o){this._mode=o,this.applyModeDefaults(),this.requestUpdate()}get dropdownToggleVisibility(){return this._dropdownToggleVisibility}set dropdownToggleVisibility(o){this._dropdownToggleVisibility=o,this.requestUpdate()}getEffectiveToggleVisibility(o){return o.dropdownToggleVisibility??this._dropdownToggleVisibility}get dropdownShowOnFocus(){return this._dropdownShowOnFocus}set dropdownShowOnFocus(o){this._dropdownShowOnFocus=o}get openDropdownOnEnter(){return this._openDropdownOnEnter}set openDropdownOnEnter(o){this._openDropdownOnEnter=o}getEffectiveOpenDropdownOnEnter(o){return o.openDropdownOnEnter??this._openDropdownOnEnter}get checkboxAlwaysEditable(){return this._checkboxAlwaysEditable}set checkboxAlwaysEditable(o){this._checkboxAlwaysEditable=o,this.requestUpdate()}get showRowNumbers(){return this._showRowNumbers}set showRowNumbers(o){this._showRowNumbers=o,this.requestUpdate()}get invalidCells(){return this._invalidCells}set invalidCells(o){this._invalidCells=o,this.requestUpdate()}get editingCell(){return this._editingCell}get isValidating(){return this._isValidating}get currentCellError(){return this._currentCellError}get hoveredRowIndex(){return this._hoveredRowIndex}get showRowToolbar(){return this._showRowToolbar}set showRowToolbar(o){this._showRowToolbar=o,this.requestUpdate()}get rowToolbar(){return this._rowToolbar}set rowToolbar(o){this._rowToolbar=o,this.requestUpdate()}get toolbarVerticalAlign(){return this._toolbarVerticalAlign}set toolbarVerticalAlign(o){this._toolbarVerticalAlign=o,this.requestUpdate()}get toolbarHorizontalAlign(){return this._toolbarHorizontalAlign}set toolbarHorizontalAlign(o){this._toolbarHorizontalAlign=o,this.requestUpdate()}get toolbarAlign(){return this._toolbarVerticalAlign}set toolbarAlign(o){this.toolbarVerticalAlign=o}get toolbarTopPosition(){return this._toolbarHorizontalAlign}set toolbarTopPosition(o){this.toolbarHorizontalAlign=o}get toolbarTrigger(){return this._toolbarTrigger}set toolbarTrigger(o){this._toolbarTrigger=o,this.requestUpdate()}get toolbarPosition(){return this._toolbarPosition}set toolbarPosition(o){this._toolbarPosition=o,this.requestUpdate()}get inlineActionsTitle(){return this._inlineActionsTitle}set inlineActionsTitle(o){this._inlineActionsTitle=o,this.requestUpdate()}get contextMenu(){return this._contextMenu}set contextMenu(o){this._contextMenu=o,this.requestUpdate()}get contextMenuXOffset(){return this._contextMenuXOffset}set contextMenuXOffset(o){this._contextMenuXOffset=o}get contextMenuYOffset(){return this._contextMenuYOffset}set contextMenuYOffset(o){this._contextMenuYOffset=o}get rowShortcuts(){return this._rowShortcuts}set rowShortcuts(o){this._rowShortcuts=o,this.requestUpdate()}get showShortcutsHelp(){return this._showShortcutsHelp}set showShortcutsHelp(o){this._showShortcutsHelp=o,this.requestUpdate()}get shortcutsHelpPosition(){return this._shortcutsHelpPosition}set shortcutsHelpPosition(o){this._shortcutsHelpPosition=o,this.requestUpdate()}get shortcutsHelpContentCallback(){return this._shortcutsHelpContentCallback}set shortcutsHelpContentCallback(o){this._shortcutsHelpContentCallback=o,this.requestUpdate()}get sort(){return this._sort}set sort(o){this._sort=o,this.requestUpdate()}get currentPage(){return this._currentPage}set currentPage(o){this._currentPage=o,this.requestUpdate()}get totalItems(){return this._totalItems}set totalItems(o){this._totalItems=o,this.requestUpdate()}get showPagination(){return this._showPagination}set showPagination(o){this._showPagination=o,this.requestUpdate()}get paginationPosition(){return this._paginationPosition}set paginationPosition(o){this._paginationPosition=o,this.requestUpdate()}get paginationLabelsCallback(){return this._paginationLabelsCallback}set paginationLabelsCallback(o){this._paginationLabelsCallback=o,this.requestUpdate()}get paginationLayout(){return this._paginationLayout}set paginationLayout(o){this._paginationLayout=o,this.requestUpdate()}get summaryPosition(){return this._summaryPosition}set summaryPosition(o){this._summaryPosition=o,this.requestUpdate()}get summaryContentCallback(){return this._summaryContentCallback}set summaryContentCallback(o){this._summaryContentCallback=o,this.requestUpdate()}get summaryMetadata(){return this._summaryMetadata}set summaryMetadata(o){this._summaryMetadata=o,this.requestUpdate()}get summaryInline(){return this._summaryInline}set summaryInline(o){this._summaryInline=o,this.requestUpdate()}get customStylesCallback(){return this._customStylesCallback}set customStylesCallback(o){this._customStylesCallback=o}get rowClassCallback(){return this._rowClassCallback}set rowClassCallback(o){this._rowClassCallback=o,this.requestUpdate()}get labels(){return this._labels}set labels(o){this._labels={...z,...o},this.requestUpdate()}get virtualScroll(){return this._virtualScroll}set virtualScroll(o){this._virtualScroll=o,this.requestUpdate()}get virtualScrollThreshold(){return this._virtualScrollThreshold}set virtualScrollThreshold(o){this._virtualScrollThreshold=o,this.requestUpdate()}get virtualScrollRowHeight(){return this._virtualScrollRowHeight}set virtualScrollRowHeight(o){this._virtualScrollRowHeight=o,this.requestUpdate()}get virtualScrollBuffer(){return this._virtualScrollBuffer}set virtualScrollBuffer(o){this._virtualScrollBuffer=o,this.requestUpdate()}get infiniteScroll(){return this._infiniteScroll}set infiniteScroll(o){this._infiniteScroll=o,this.requestUpdate()}get infiniteScrollThreshold(){return this._infiniteScrollThreshold}set infiniteScrollThreshold(o){this._infiniteScrollThreshold=o}get hasMoreItems(){return this._hasMoreItems}set hasMoreItems(o){this._hasMoreItems=o}get isLoadingMore(){return this._isLoadingMore}set isLoadingMore(o){this._isLoadingMore=o}shouldUseVirtualScroll(){return this._virtualScroll===!1?!1:this._virtualScroll===!0?!0:this.displayItems.length>=this._virtualScrollThreshold}get showRowActions(){return this._showRowToolbar}set showRowActions(o){this.showRowToolbar=o}get rowActions(){return this._rowToolbar}set rowActions(o){this.rowToolbar=o}set onrowchange(o){this._onrowchange=o}set onroweditstart(o){this._onroweditstart=o}set onroweditcancel(o){this._onroweditcancel=o}set onvalidationerror(o){this._onvalidationerror=o}get validationTooltipCallback(){return this._validationTooltipCallback}set validationTooltipCallback(o){this._validationTooltipCallback=o}get ontoolbarclick(){return this._ontoolbarclick}set ontoolbarclick(o){this._ontoolbarclick=o}set onrowaction(o){this._onrowaction=o}set oncontextmenuopen(o){this._oncontextmenuopen=o}get ondatarequest(){return this._ondatarequest}set ondatarequest(o){this._ondatarequest=o}get onrowdelete(){return this._onrowdelete}set onrowdelete(o){this._onrowdelete=o}get idValueMember(){return this._idValueMember}set idValueMember(o){this._idValueMember=o}get idValueCallback(){return this._idValueCallback}set idValueCallback(o){this._idValueCallback=o}get rowLocking(){return this._rowLocking}set rowLocking(o){this._rowLocking=o,this.requestUpdate()}get onrowlockchange(){return this._onrowlockchange}set onrowlockchange(o){this._onrowlockchange=o}get isNavigateMode(){return this._editTrigger==="navigate"||this._columns.some(o=>o.editTrigger==="navigate")}get filteredItems(){return!this._filterable||Object.keys(this._filters).length===0?this._items:this._items.filter(o=>Object.entries(this._filters).every(([t,i])=>i?String(o[t]??"").toLowerCase().includes(i.toLowerCase()):!0))}get sortedItems(){return this._sort.length===0?this.filteredItems:[...this.filteredItems].sort((o,t)=>{for(const i of this._sort){const r=o[i.column],n=t[i.column];if(r===n)continue;let s=0;return typeof r=="string"&&typeof n=="string"?s=r.localeCompare(n):typeof r=="number"&&typeof n=="number"?s=r-n:s=String(r??"").localeCompare(String(n??"")),i.direction==="asc"?s:-s}return 0})}get paginatedItems(){if(!this._pageable)return this.sortedItems;const o=(this._currentPage-1)*this._pageSize,t=o+this._pageSize;return this.sortedItems.slice(o,t)}get totalPages(){const o=this._totalItems!==null?this._totalItems:this.sortedItems.length;return Math.max(1,Math.ceil(o/this._pageSize))}get displayItems(){return this.paginatedItems}fireDataRequest(o){if(this._ondatarequest){const t=o==="loadMore"?this._items.length:(this._currentPage-1)*this._pageSize,i={sort:[...this._sort],page:this._currentPage,pageSize:this._pageSize,trigger:o,mode:o==="loadMore"?"append":"replace",skip:t};this._ondatarequest(i)}}getColumnSortState(o){return this._sort.find(t=>t.column===o)}getColumnSortPriority(o){const t=this._sort.findIndex(i=>i.column===o);return t>=0?t+1:0}applyModeDefaults(){switch(this._mode){case"read-only":this._editable=!1,this._dropdownToggleVisibility="on-focus";break;case"excel":this._editable=!0,this._editTrigger="navigate",this._dropdownToggleVisibility="always",this._dropdownShowOnFocus=!1;break;case"input-matrix":this._editable=!0,this._editTrigger="always",this._dropdownToggleVisibility="always",this._dropdownShowOnFocus=!0;break}}requestUpdate(){}getRowDraft(o){return this._draftRows.get(o)}hasRowDraft(o){return this._draftRows.has(o)}discardRowDraft(o){this._draftRows.delete(o),this._invalidCells=this._invalidCells.filter(t=>t.rowIndex!==o),this.requestUpdate()}getDraftRowIndices(){return Array.from(this._draftRows.keys())}discardAllDrafts(){this._draftRows.clear(),this._invalidCells=[],this.requestUpdate()}getCellRawValue(o,t,i){const r=this._draftRows.get(t);return r?r[i]:o[i]}getCellValue(o,t,i){if(t.templateCallback)return t.templateCallback(o);const r=i!==void 0?this.getCellRawValue(o,i,String(t.field)):o[String(t.field)];return t.formatCallback?t.formatCallback(r,o):String(r??"")}isCellInvalid(o,t){return this._invalidCells.some(i=>i.rowIndex===o&&i.field===t)}getCellValidationError(o,t){const i=this._invalidCells.find(r=>r.rowIndex===o&&r.field===t);return(i==null?void 0:i.error)||null}addInvalidCell(o,t,i){const r=this._invalidCells.findIndex(n=>n.rowIndex===o&&n.field===t);r>=0?this._invalidCells[r]={rowIndex:o,field:t,error:i}:this._invalidCells=[...this._invalidCells,{rowIndex:o,field:t,error:i}]}removeInvalidCell(o,t){this._invalidCells=this._invalidCells.filter(i=>!(i.rowIndex===o&&i.field===t))}isEditing(o,t){var i,r;return((i=this._editingCell)==null?void 0:i.rowIndex)===o&&((r=this._editingCell)==null?void 0:r.field)===t}startEdit(o,t,i){var s,c;if(!this.canEditCell(o,t))return;const r=this.displayItems[o];if(!r)return;this._draftRows.has(o)||this._draftRows.set(o,{...r});const n=this._editingCell;this._editingCell={rowIndex:o,field:t,initialSearchQuery:i==null?void 0:i.initialSearchQuery,cursorPosition:i==null?void 0:i.cursorPosition},(s=this._onInteractionChange)==null||s.call(this,"editingCell",{prev:n,current:this._editingCell}),this._currentCellError=null,(c=this._onroweditstart)==null||c.call(this,{row:r,rowIndex:o,field:t})}cancelEdit(){var o,t;if(this._editingCell){const i=this._editingCell,{rowIndex:r,field:n}=i,s=this.displayItems[r];s&&((o=this._onroweditcancel)==null||o.call(this,{row:s,rowIndex:r,field:n})),this._editingCell=null,(t=this._onInteractionChange)==null||t.call(this,"editingCell",{prev:i,current:null}),this._currentCellError=null}}normalizeValidationResult(o,t){return o==null||o===!0?{valid:!0,finalValue:t}:o===!1?{valid:!1,message:"Validation failed",finalValue:t}:typeof o=="string"?{valid:!1,message:o,finalValue:t}:{valid:o.valid,message:o.message,finalValue:o.transformedValue!==void 0?o.transformedValue:t}}async commitEdit(o,t,i){var h,u,p;const r=this._columns.find(b=>String(b.field)===t);if(!r)return;const n=this.displayItems[o];if(!n)return;const s=n[t];let c=i,a=null,l=!0;this._isValidating=!0;try{if(r.beforeCommitCallback){const b={value:i,oldValue:s,row:n,rowIndex:o,field:t},v=await Promise.resolve(r.beforeCommitCallback(b)),w=this.normalizeValidationResult(v,i);l=w.valid,a=w.message||null,c=w.finalValue}else if(r.validateCallback){const b=await Promise.resolve(r.validateCallback(i,n));b&&(l=!1,a=b)}}catch(b){l=!1,a=b instanceof Error?b.message:"Validation failed"}this._isValidating=!1;let g=this._draftRows.get(o);g||(g={...n},this._draftRows.set(o,g)),g[t]=c,l?(this.removeInvalidCell(o,t),this._currentCellError=null):(this.addInvalidCell(o,t,a||"Invalid value"),this._currentCellError=a,(h=this._onvalidationerror)==null||h.call(this,{row:n,rowIndex:o,field:t,error:a||"Invalid value"})),(u=this._onrowchange)==null||u.call(this,{row:n,draftRow:g,rowIndex:o,field:t,oldValue:s,newValue:c,isValid:l,validationError:a});const d=this._editingCell;this._editingCell=null,(p=this._onInteractionChange)==null||p.call(this,"editingCell",{prev:d,current:null})}isCellEditable(o){return o.editable===!1?!1:this._editable||o.editor!==void 0}getEditableColumns(){return this._columns.map((o,t)=>({index:t,column:o})).filter(({column:o})=>this.isCellEditable(o))}isCellFocused(o,t){var i,r;return((i=this._focusedCell)==null?void 0:i.rowIndex)===o&&((r=this._focusedCell)==null?void 0:r.colIndex)===t}get focusedCell(){return this._focusedCell}setFocusedCell(o,t){var n;const i=this._focusedCell,r={rowIndex:o,colIndex:t};(i==null?void 0:i.rowIndex)===r.rowIndex&&(i==null?void 0:i.colIndex)===r.colIndex||(this._focusedCell=r,(n=this._onInteractionChange)==null||n.call(this,"focusedCell",{prev:i,current:r}))}clearFocusedCell(){var t;const o=this._focusedCell;o!==null&&(this._focusedCell=null,(t=this._onInteractionChange)==null||t.call(this,"focusedCell",{prev:o,current:null}))}setHoveredRow(o){var i;if(this._hoveredRowIndex===o)return;const t=this._hoveredRowIndex;this._hoveredRowIndex=o,(i=this._onInteractionChange)==null||i.call(this,"hoveredRow",{prev:t,current:o})}getRowId(o){if(this._idValueCallback)return this._idValueCallback(o);if(this._idValueMember)return o[String(this._idValueMember)]}findRowById(o){const t=this._items.findIndex(i=>this.getRowId(i)===o);return t===-1?null:{row:this._items[t],index:t}}getRowLockInfo(o){let t,i,r=-1;if(typeof o=="object"&&o!==null)t=o,i=this.getRowId(t),r=this._items.indexOf(t),r===-1&&(r=this.displayItems.indexOf(t));else{i=o;const s=this.findRowById(i);s&&(t=s.row,r=s.index)}if(i!==void 0&&this._externalLocks.has(i))return this._externalLocks.get(i);if(!t)return null;const n=this._rowLocking;if(!n)return null;if(n.getLockInfoCallback){const s=n.getLockInfoCallback(t,r);if(s!=null&&s.isLocked)return s}if(n.isLockedCallback&&n.isLockedCallback(t,r))return{isLocked:!0};if(n.lockInfoMember){const s=t[String(n.lockInfoMember)];if(s!=null&&s.isLocked)return s}return n.lockedMember&&t[String(n.lockedMember)]?{isLocked:!0}:null}isRowLocked(o){const t=this.getRowLockInfo(o);return(t==null?void 0:t.isLocked)===!0}lockRowById(o,t){var n;const i={isLocked:!0,lockedBy:t==null?void 0:t.lockedBy,lockedAt:(t==null?void 0:t.lockedAt)??new Date,reason:t==null?void 0:t.reason,...t};this._externalLocks.set(o,i);const r=this.findRowById(o);return r&&this._editingCell&&this._editingCell.rowIndex===r.index&&this.cancelEdit(),this.requestUpdate(),(n=this._onrowlockchange)==null||n.call(this,{rowId:o,row:(r==null?void 0:r.row)??null,rowIndex:(r==null?void 0:r.index)??-1,lockInfo:i,source:"external"}),!0}unlockRowById(o){var i;const t=this._externalLocks.has(o);if(this._externalLocks.delete(o),t){this.requestUpdate();const r=this.findRowById(o);(i=this._onrowlockchange)==null||i.call(this,{rowId:o,row:(r==null?void 0:r.row)??null,rowIndex:(r==null?void 0:r.index)??-1,lockInfo:null,source:"external"})}return t}getExternalLocks(){return new Map(this._externalLocks)}clearExternalLocks(){this._externalLocks.clear(),this.requestUpdate()}updateRowById(o,t){const i=this.findRowById(o);if(!i)return!1;Object.assign(this._items[i.index],t);const r=this._draftRows.get(i.index);return r&&Object.assign(r,t),this.requestUpdate(),!0}replaceRowById(o,t){const i=this.findRowById(o);return i?(this._items[i.index]=t,this._draftRows.delete(i.index),this.requestUpdate(),!0):!1}canEditCell(o,t){var a;const i=this._columns.find(l=>String(l.field)===t);if(!i||!this.isCellEditable(i))return!1;const r=this.displayItems[o];if(!r)return!1;const n=this.getRowLockInfo(r);if(!(n!=null&&n.isLocked))return!0;const s=this._rowLocking;switch((s==null?void 0:s.lockedEditBehavior)??"block"){case"allow":return!0;case"callback":return((a=s==null?void 0:s.canEditLockedCallback)==null?void 0:a.call(s,r,n))??!1;case"block":default:return!1}}}const ro=':host{--wg-rem: 10px;font-family:var(--wg-font-family);display:block;--wg-accent-color: var(--base-accent-color, #0078d4);--wg-accent-color-hover: var(--base-accent-color-hover, #106ebe);--wg-accent-color-active: var(--base-accent-color-active, #005a9e);--wg-accent-color-light: var(--base-accent-color-light, #e6f2ff);--wg-text-color-1: var(--base-text-color-1, #242424);--wg-text-color-2: var(--base-text-color-2, #424242);--wg-text-color-3: var(--base-text-color-3, #707070);--wg-text-on-accent: var(--base-text-color-on-accent, #ffffff);--wg-surface-1: var(--base-main-bg, #ffffff);--wg-surface-2: var(--base-elevated-bg, #f5f5f5);--wg-surface-3: var(--base-hover-bg, #ebebeb);--wg-surface-floating: var(--base-dropdown-bg, var(--base-main-bg, #ffffff));--wg-border-color: var(--base-border-color, #e0e0e0);--wg-border-color-hover: var(--base-border-color, #d1d1d1);--wg-input-bg: var(--base-input-bg, #ffffff);--wg-input-color: var(--base-input-color, var(--wg-text-color-1));--wg-input-border: var(--base-input-border, 1px solid #d1d1d1);--wg-input-border-hover: var(--base-input-border-hover, 1px solid #0078d4);--wg-input-border-focus: var(--base-input-border-focus, 1px solid #0078d4);--wg-input-placeholder-color: var(--base-input-placeholder-color, #707070);--wg-danger-color: var(--base-danger-color, #d13438);--wg-danger-bg-light: var(--base-danger-bg-light, #fde7e9);--wg-hover-bg: var(--base-hover-bg, #f0f0f0);--wg-active-bg: var(--base-hover-bg, #e0e0e0);--wg-font-size-base: calc(var(--base-font-size-sm, 1.4) * var(--wg-rem));--wg-font-size-sm: calc(var(--base-font-size-xs, 1.2) * var(--wg-rem));--wg-font-size-xs: calc(var(--base-font-size-2xs, 1.1) * var(--wg-rem));--wg-font-size-lg: calc(var(--base-font-size-base, 1.6) * var(--wg-rem));--wg-font-family: var(--base-font-family, inherit);--wg-line-height-base: var(--base-line-height-normal, 1.5);--wg-font-weight-normal: var(--base-font-weight-normal, 400);--wg-font-weight-semibold: var(--base-font-weight-semibold, 600);--wg-font-family-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;--wg-border-radius-sm: calc(var(--base-border-radius-sm, .4) * var(--wg-rem));--wg-border-radius-md: calc(var(--base-border-radius-md, .6) * var(--wg-rem));--wg-border-radius-lg: calc(var(--base-border-radius-lg, .8) * var(--wg-rem));--wg-spacing-xs: calc(.4 * var(--wg-rem));--wg-spacing-sm: calc(.8 * var(--wg-rem));--wg-spacing-md: calc(1.2 * var(--wg-rem));--wg-spacing-lg: calc(1.6 * var(--wg-rem));--wg-spacing-xl: calc(2.4 * var(--wg-rem));--wg-table-bg: var(--wg-surface-1);--wg-table-border: 1px solid var(--wg-border-color);--wg-header-bg: var(--wg-surface-2);--wg-header-bg-hover: var(--wg-surface-3);--wg-header-bg-sorted: var(--wg-surface-3);--wg-header-color: var(--wg-text-color-1);--wg-header-border: 2px solid var(--wg-border-color);--wg-header-padding: var(--wg-spacing-sm) var(--wg-spacing-md);--wg-header-font-weight: var(--wg-font-weight-semibold);--wg-cell-padding: var(--wg-spacing-sm) var(--wg-spacing-md);--wg-cell-padding-block: var(--wg-spacing-sm);--wg-cell-padding-inline: var(--wg-spacing-md);--wg-cell-color: var(--wg-text-color-1);--wg-cell-border: 1px solid var(--wg-border-color);--wg-cell-bg-hover: var(--wg-hover-bg);--wg-cell-bg-editing: var(--wg-surface-1);--wg-cell-readonly-bg: var(--base-disabled-bg, var(--wg-surface-2));--wg-row-border: 1px solid var(--wg-border-color);--wg-row-bg-even: var(--wg-surface-2);--wg-row-bg-hover: var(--wg-surface-3);--wg-filter-bg: var(--wg-surface-1);--wg-filter-border: 1px solid var(--wg-border-color);--wg-filter-padding: var(--wg-spacing-xs) var(--wg-spacing-sm);--wg-filter-input-padding: calc(.4 * var(--wg-rem)) calc(.8 * var(--wg-rem));--wg-filter-input-bg: var(--wg-input-bg);--wg-filter-input-border: var(--wg-input-border);--wg-filter-input-border-focus: var(--wg-input-border-focus);--wg-filter-input-border-radius: var(--wg-border-radius-sm);--wg-filter-input-font-size: var(--wg-font-size-sm);--wg-sort-indicator-size: calc(1.4 * var(--wg-rem));--wg-sort-indicator-opacity: .9;--wg-sort-placeholder-opacity: .3;--wg-sort-priority-size: calc(1.1 * var(--wg-rem));--wg-pagination-padding: var(--wg-spacing-md);--wg-pagination-gap: calc(1.6 * var(--wg-rem));--wg-pagination-bg: var(--wg-surface-1);--wg-pagination-border: 1px solid var(--wg-border-color);--wg-pagination-btn-padding: calc(.6 * var(--wg-rem)) calc(1.6 * var(--wg-rem));--wg-pagination-btn-bg: var(--wg-surface-1);--wg-pagination-btn-bg-hover: var(--wg-surface-2);--wg-pagination-btn-bg-active: var(--wg-surface-3);--wg-pagination-btn-border: 1px solid var(--wg-border-color);--wg-pagination-btn-border-hover: 1px solid var(--wg-border-color-hover);--wg-pagination-btn-border-radius: var(--wg-border-radius-sm);--wg-pagination-btn-disabled-opacity: .4;--wg-empty-padding: var(--wg-spacing-xl);--wg-empty-color: var(--wg-text-color-3);--wg-error-cell-bg: var(--wg-danger-bg-light);--wg-error-cell-border: 1px solid var(--wg-danger-color);--wg-error-message-color: var(--wg-danger-color);--wg-error-message-font-size: var(--wg-font-size-xs);--wg-error-indicator-color: var(--wg-danger-color);--wg-editor-bg: var(--wg-surface-1);--wg-editor-outline: 2px solid var(--wg-accent-color);--wg-editor-outline-offset: -2px;--wg-editor-validating-opacity: .7;--wg-dropdown-toggle-right: var(--wg-spacing-md);--wg-dropdown-toggle-size: calc(1.2 * var(--wg-rem));--wg-dropdown-toggle-hitbox: calc(2.4 * var(--wg-rem));--wg-date-trigger-size: calc(2.8 * var(--wg-rem));--wg-toolbar-bg: var(--wg-surface-floating);--wg-toolbar-border: 1px solid var(--wg-border-color);--wg-toolbar-border-radius: var(--wg-border-radius-sm);--wg-toolbar-shadow: var(--base-dropdown-box-shadow, 0 2px 8px rgba(0, 0, 0, .15));--wg-toolbar-divider-color: var(--wg-border-color);--wg-toolbar-row-height: calc(3.7 * var(--wg-rem));--wg-toolbar-btn-min-width: calc(2.4 * var(--wg-rem));--wg-toolbar-btn-padding: 0 calc(.4 * var(--wg-rem));--wg-toolbar-btn-border-radius: var(--wg-border-radius-sm);--wg-toolbar-btn-bg-hover: var(--wg-hover-bg);--wg-toolbar-btn-bg-active: var(--wg-active-bg);--wg-toolbar-btn-color: var(--wg-text-color-1);--wg-toolbar-trigger-color: var(--wg-text-color-3);--wg-toolbar-trigger-color-hover: var(--wg-text-color-1);--wg-toolbar-trigger-bg-hover: var(--wg-hover-bg);--wg-tooltip-bg: var(--base-tooltip-bg, #333);--wg-tooltip-color: var(--base-tooltip-color, #fff);--wg-context-menu-z-index: 1001;--wg-context-menu-min-width: calc(16 * var(--wg-rem));--wg-focus-outline: 2px solid var(--wg-accent-color);--wg-focus-outline-offset: -2px;--wg-focus-bg: var(--wg-hover-bg);--wg-transition-fast: .1s ease;--wg-transition-normal: .15s ease;--wg-z-dropdown: 9999;--wg-z-toolbar: 1000;--wg-z-context-menu: 1001;--wg-z-tooltip: 10000}web-grid:not(:defined){display:block;min-height:calc(10 * var(--wg-rem));color:transparent!important;background:transparent}.wg{position:relative;width:100%;max-height:inherit;overflow:auto;overscroll-behavior:contain;border:var(--wg-table-border)}.wg__table{width:max-content;min-width:100%;border-collapse:collapse;table-layout:fixed;background:var(--wg-table-bg);font-size:var(--wg-font-size-base);line-height:var(--wg-line-height-base)}.wg__table tbody tr{border-bottom:var(--wg-row-border)}.wg__row-number-header,.wg__row-number{width:40px;min-width:40px;max-width:40px;text-align:center;color:var(--wg-text-color-2);background:var(--wg-header-bg);-webkit-user-select:none;user-select:none;font-size:var(--wg-font-size-sm)}.wg__row-number{border-right:var(--wg-cell-border)}.wg__actions-column{width:32px;min-width:32px;max-width:32px;padding:0!important;text-align:center}thead .wg__actions-column{background:var(--wg-header-bg);border-bottom:var(--wg-header-border)}.wg__filter-row .wg__actions-column{background:var(--wg-filter-bg);border-bottom:var(--wg-filter-border)}.wg__header{position:sticky;top:0;z-index:1;background:var(--wg-header-bg);color:var(--wg-header-color);font-weight:var(--wg-header-font-weight);padding:var(--wg-header-padding);border-bottom:var(--wg-header-border);text-align:left;-webkit-user-select:none;user-select:none}.wg__header--sortable{cursor:pointer}.wg__header--sortable:hover{background:var(--wg-header-bg-hover)}.wg__header--sorted{background:var(--wg-header-bg-sorted)}.wg__header-content{display:flex;align-items:center;gap:4px;justify-content:space-between}.wg__header-title{flex:1}.wg__sort-indicator{font-size:var(--wg-sort-indicator-size);opacity:var(--wg-sort-indicator-opacity);min-width:16px;text-align:center;display:inline-flex;align-items:center}.wg__sort-placeholder{opacity:var(--wg-sort-placeholder-opacity)}.wg__sort-priority{font-size:var(--wg-sort-priority-size);font-weight:600;margin-left:2px;vertical-align:super;line-height:1}.wg__header-info{display:inline-flex;align-items:center;color:var(--wg-accent-color);cursor:help;opacity:.7;margin-left:4px;vertical-align:middle}.wg__header-info:hover{opacity:1}.wg__filter-row th{padding:var(--wg-filter-padding);background:var(--wg-filter-bg);border-bottom:var(--wg-filter-border)}.wg__filter-input{width:100%;padding:var(--wg-filter-input-padding);border:var(--wg-filter-input-border);border-radius:var(--wg-filter-input-border-radius);background:var(--wg-surface-1);color:var(--wg-text-color-1);font-family:inherit;font-size:var(--wg-filter-input-font-size);box-sizing:border-box}.wg__filter-input:focus{outline:none;border:var(--wg-filter-input-border-focus);box-shadow:0 0 0 1px var(--wg-accent-color)}.wg__cell{padding:var(--wg-cell-padding);color:var(--wg-cell-color);scroll-margin-top:3rem;scroll-margin-bottom:.5rem;-webkit-user-select:none;user-select:none;overflow:hidden}.wg__cell-text{-webkit-user-select:none;user-select:none}.wg__cell--ellipsis{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.wg__cell--editable{cursor:pointer;position:relative}.wg__cell--editable:hover{background:var(--wg-cell-bg-hover)}.wg__cell--editable:hover:after{content:"";position:absolute;top:2px;right:2px;bottom:2px;left:2px;border:1px dashed var(--wg-border-color);border-radius:2px;pointer-events:none}.wg__cell--editing{position:relative;background:var(--wg-surface-1);outline:2px solid var(--wg-accent-color);outline-offset:-2px}.wg__cell--editing:after{display:none}.wg__cell--invalid{background:var(--wg-danger-bg-light, #fee);box-shadow:inset 0 0 0 2px var(--wg-danger-color, #c00)}.wg--navigate-mode .wg__cell:not(.wg__cell--editable){background:var(--wg-cell-readonly-bg, #f5f5f5)}:host{--wg-row-locked-bg: var(--base-disabled-bg, #f5f5f5);--wg-row-locked-opacity: .7}.wg__row--locked{background:var(--wg-row-locked-bg)!important}.wg__row--locked .wg__cell{opacity:var(--wg-row-locked-opacity)}.wg__row--locked .wg__cell--editable{cursor:not-allowed}.wg__row--locked .wg__cell--editable:hover{background:inherit}.wg__row--locked .wg__cell--editable:hover:after{display:none}.wg__row-number--locked{opacity:1!important;cursor:help}.wg__editor{position:absolute;top:0;left:0;right:0;width:100%;padding:var(--wg-cell-padding);border:none;background:transparent;color:var(--wg-text-color-1);font-size:var(--wg-font-size-base);font-family:inherit;line-height:inherit;box-sizing:border-box}.wg__editor:focus,.wg__editor:focus-visible{outline:none;box-shadow:none}.wg__editor--text{text-align:inherit}.wg__editor--number{text-align:right}.wg__editor--date{position:absolute;top:0;right:0;bottom:0;left:0;display:flex;align-items:center;background:var(--wg-editor-bg);padding:var(--wg-cell-padding)}.wg__date-input{flex:1;min-width:0;height:100%;border:none;background:transparent;font:inherit;padding:0;outline:none;color:inherit}.wg__date-trigger{width:var(--wg-date-trigger-size, 28px);height:100%;display:flex;align-items:center;justify-content:center;border:none;background:transparent;color:var(--wg-text-color-3);cursor:pointer;padding:0;flex-shrink:0}.wg__date-trigger:hover{color:var(--wg-accent-color, #0078d4);background:var(--wg-hover-bg, rgba(0, 0, 0, .05))}.wg__editor--checkbox{width:auto;height:auto;margin:0 auto}.wg__editor--custom{position:absolute;top:0;right:0;bottom:0;left:0;display:flex;align-items:center;background:var(--wg-editor-bg);padding:var(--wg-cell-padding-block) var(--wg-cell-padding-inline);cursor:pointer}.wg__editor--custom:focus{outline:none}.wg__custom-value{flex:1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;display:block;cursor:pointer}.wg__editor--combobox,.wg__editor--autocomplete{position:absolute;top:0;right:0;bottom:0;left:0;display:flex;align-items:center;padding:var(--wg-cell-padding);padding-right:0;background:transparent;box-sizing:border-box}.wg__combobox-input,.wg__autocomplete-input{flex:1;width:100%;height:100%;padding:0 24px 0 0;border:none;background:transparent;color:var(--wg-text-color-1);font-size:var(--wg-font-size-base);font-family:inherit;line-height:var(--wg-line-height-base);outline:none;box-sizing:border-box;margin:0;-webkit-appearance:none;-moz-appearance:none;appearance:none}.wg__combobox-input:focus,.wg__autocomplete-input:focus{outline:none}.wg__combobox-toggle{position:absolute;right:var(--wg-dropdown-toggle-right);top:50%;transform:translateY(-50%);font-size:var(--wg-dropdown-toggle-size);color:var(--wg-text-color-2);pointer-events:auto;cursor:pointer}.wg__combobox-toggle:before{content:"";position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);width:var(--wg-dropdown-toggle-hitbox);height:48px}.wg__loading-indicator{position:absolute;right:var(--wg-dropdown-toggle-right);top:50%;transform:translateY(-50%);font-size:12px;animation:wg-pulse 1s infinite}@keyframes wg-pulse{0%,to{opacity:1}50%{opacity:.4}}.wg__select-trigger{display:flex;align-items:center;justify-content:space-between;cursor:pointer;background:transparent}.wg__select-trigger:focus,.wg__select-trigger:focus-visible{outline:none;box-shadow:none}.wg__select-value{flex:1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.wg__select-toggle{position:relative;font-size:var(--wg-dropdown-toggle-size);opacity:.6;margin-left:4px;flex-shrink:0;pointer-events:auto;cursor:pointer}.wg__select-toggle:before{content:"";position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);width:var(--wg-dropdown-toggle-hitbox);height:48px}.wg__cell-dropdown-display{display:flex;align-items:center;justify-content:space-between;width:100%;cursor:pointer}.wg__cell-dropdown-display--toggle-on-focus .wg__select-toggle{opacity:0}.wg__cell:hover .wg__cell-dropdown-display--toggle-on-focus .wg__select-toggle,.wg__cell--focused .wg__cell-dropdown-display--toggle-on-focus .wg__select-toggle{opacity:.6}.wg__cell-date-display{display:flex;align-items:center;justify-content:space-between;width:100%;cursor:pointer}.wg__cell-date-display .wg__date-trigger{position:relative;background:none;border:none;padding:0;margin:0;cursor:pointer;opacity:.6;display:flex;align-items:center;justify-content:center;color:inherit}.wg__cell-date-display .wg__date-trigger:before{content:"";position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);width:var(--wg-dropdown-toggle-hitbox);height:48px}.wg__cell-date-display--toggle-on-focus .wg__date-trigger{opacity:0}.wg__cell:hover .wg__cell-date-display--toggle-on-focus .wg__date-trigger,.wg__cell--focused .wg__cell-date-display--toggle-on-focus .wg__date-trigger{opacity:.6}.wg__dropdown{background:var(--wg-surface-floating, #fff);border:1px solid var(--wg-border-color, #d1d1d1);border-radius:4px;box-shadow:var(--wg-toolbar-shadow);max-height:200px;overflow-y:auto;font-size:var(--wg-font-size-base);font-family:inherit;line-height:var(--wg-line-height-base)}.wg__dropdown-option{display:flex;align-items:center;gap:var(--wg-spacing-sm);padding:6px 12px;cursor:pointer;color:var(--wg-text-color-1)}.wg__dropdown-option:hover,.wg__dropdown-option--highlighted{background:var(--wg-hover-bg, #f0f0f0)}.wg__dropdown-option--selected{background:var(--wg-accent-color-light, #e6f2ff)}.wg__dropdown-option--disabled{opacity:.5;cursor:not-allowed;pointer-events:none}.wg__dropdown-option-icon{flex-shrink:0;width:1.5em;text-align:center}.wg__dropdown-option-content{flex:1;min-width:0;overflow:hidden}.wg__dropdown-option-label{display:block;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.wg__dropdown-option-subtitle{display:block;font-size:var(--wg-font-size-sm);color:var(--wg-text-color-2);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.wg__dropdown-empty{padding:8px 12px;color:var(--wg-text-color-2);font-style:italic;text-align:center}.wg--navigate-mode .wg__cell{cursor:cell}.wg--navigate-mode .wg__cell:focus{outline:none}.wg--navigate-mode .wg__cell.wg__cell--focused{outline:var(--wg-focus-outline);outline-offset:-2px}.wg__cell--focused:after{display:none}.wg__pagination{display:flex;align-items:center;justify-content:center;gap:var(--wg-pagination-gap);padding:var(--wg-pagination-padding);border-top:var(--wg-pagination-border);background:var(--wg-pagination-bg)}.wg__pagination-btn{padding:var(--wg-pagination-btn-padding);background:var(--wg-pagination-btn-bg);border:var(--wg-pagination-btn-border);border-radius:var(--wg-pagination-btn-border-radius);color:var(--wg-cell-color);font-family:inherit;font-size:var(--wg-font-size-base);cursor:pointer;transition:all var(--wg-transition-fast)}.wg__pagination-btn:hover:not(:disabled){background:var(--wg-pagination-btn-bg-hover);border:var(--wg-pagination-btn-border-hover)}.wg__pagination-btn:active:not(:disabled){background:var(--wg-pagination-btn-bg-active)}.wg__pagination-btn:disabled{opacity:var(--wg-pagination-btn-disabled-opacity);cursor:not-allowed}.wg__pagination-info{font-size:var(--wg-font-size-base);color:var(--wg-cell-color)}.wg__pagination-count{font-size:var(--wg-font-size-sm);color:var(--wg-text-color-3);margin-left:4px}.wg__pagination-pagesize{display:flex;align-items:center;gap:6px}.wg__pagination-select{padding:4px 8px;background:var(--wg-pagination-btn-bg);border:var(--wg-pagination-btn-border);border-radius:var(--wg-pagination-btn-border-radius);color:var(--wg-cell-color);font-family:inherit;font-size:var(--wg-font-size-base);cursor:pointer}.wg__pagination-select:hover{background:var(--wg-pagination-btn-bg-hover);border:var(--wg-pagination-btn-border-hover)}.wg__pagination-select:focus{outline:2px solid var(--wg-accent-color);outline-offset:-2px}.wg__pagination-label{font-size:var(--wg-font-size-sm);color:var(--wg-text-color-3)}.wg__pagination--left{justify-content:flex-start}.wg__pagination--right{justify-content:flex-end}.wg__pagination--top{border-top:none;border-bottom:var(--wg-pagination-border)}.wg__summary{display:flex;align-items:center;padding:var(--wg-pagination-padding);border-top:var(--wg-pagination-border);background:var(--wg-pagination-bg);font-size:var(--wg-font-size-base);color:var(--wg-cell-color)}.wg__summary--left{justify-content:flex-start}.wg__summary--right{justify-content:flex-end}.wg__summary--top{border-top:none;border-bottom:var(--wg-pagination-border)}.wg__footer{display:flex;align-items:center;justify-content:space-between;border-top:var(--wg-pagination-border);background:var(--wg-pagination-bg)}.wg__footer--top{border-top:none;border-bottom:var(--wg-pagination-border)}.wg__footer .wg__summary,.wg__footer .wg__pagination{border:none}.wg__footer .wg__summary{flex:0 0 auto}.wg__footer .wg__pagination{flex:0 0 auto;margin-left:auto}.wg__toolbar-container{position:fixed;z-index:var(--wg-z-toolbar, 1000)}.wg__toolbar{display:flex;flex-direction:column-reverse;gap:0;padding:0;background:var(--wg-toolbar-bg);border:var(--wg-toolbar-border);border-radius:var(--wg-toolbar-border-radius);box-shadow:var(--wg-toolbar-shadow)}.wg__toolbar-row{display:flex;gap:2px;align-items:center;height:var(--wg-toolbar-row-height);padding:0 4px}.wg__toolbar-row+.wg__toolbar-row{border-top:1px solid var(--wg-toolbar-divider-color)}.wg__toolbar-divider{width:1px;height:16px;background:var(--wg-toolbar-divider-color);margin:0 4px;flex-shrink:0}.wg__toolbar-btn{min-width:var(--wg-toolbar-btn-min-width);height:100%;border:none;border-radius:var(--wg-toolbar-btn-border-radius);background:transparent;color:var(--wg-toolbar-btn-color);cursor:pointer;display:flex;align-items:center;justify-content:center;gap:4px;font-family:inherit;font-size:var(--wg-font-size-base);font-weight:500;padding:var(--wg-toolbar-btn-padding);transition:background .1s ease}.wg__toolbar-btn:hover{background:var(--wg-toolbar-btn-bg-hover)}.wg__toolbar-btn:active{background:var(--wg-toolbar-btn-bg-active)}.wg__toolbar-btn:disabled{opacity:.5;cursor:not-allowed}.wg__toolbar-btn:disabled:hover{background:transparent}.wg__toolbar-btn--danger:hover{background:var(--wg-danger-bg-light);color:var(--wg-danger-color)}.wg__toolbar-label{font-size:12px;white-space:nowrap}.wg__actions-column{width:24px;min-width:24px;max-width:24px;padding:0!important;text-align:center}.wg__header .wg__actions-column{background:var(--wg-header-bg)}.wg__filter-row .wg__actions-column{background:var(--wg-filter-bg)}.wg__toolbar-trigger{position:relative;padding:0;background:transparent;border:none;border-radius:var(--wg-border-radius-sm);cursor:pointer;font-size:var(--wg-font-size-base);line-height:1;color:var(--wg-toolbar-trigger-color)}.wg__toolbar-trigger:before{content:"";position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);width:var(--wg-dropdown-toggle-hitbox);height:48px}.wg__toolbar-trigger:hover,.wg__toolbar-trigger--active{color:var(--wg-toolbar-trigger-color-hover);background:var(--wg-toolbar-trigger-bg-hover)}.wg__inline-actions-header,.wg__inline-actions-cell{width:1%;white-space:nowrap;text-align:center;padding:var(--wg-spacing-xs) var(--wg-spacing-sm)}.wg__inline-actions-header{background:var(--wg-header-bg)}.wg__inline-actions-wrap{display:flex;flex-direction:column;gap:2px;align-items:center}.wg__inline-actions-row{display:flex;gap:2px;align-items:center;justify-content:center}.wg__inline-action-btn{min-width:var(--wg-toolbar-btn-min-width);height:calc(2.4 * var(--wg-rem));border:none;border-radius:var(--wg-toolbar-btn-border-radius);background:transparent;color:var(--wg-toolbar-btn-color);cursor:pointer;display:flex;align-items:center;justify-content:center;padding:0 var(--wg-spacing-xs);font-family:inherit;font-size:var(--wg-font-size-base);transition:background var(--wg-transition-fast)}.wg__inline-action-btn:hover{background:var(--wg-toolbar-btn-bg-hover)}.wg__inline-action-btn:active{background:var(--wg-toolbar-btn-bg-active)}.wg__inline-action-btn:disabled,.wg__inline-action-btn--disabled{opacity:.5;cursor:not-allowed}.wg__inline-action-btn:disabled:hover,.wg__inline-action-btn--disabled:hover{background:transparent}.wg__inline-action-btn--danger:hover{background:var(--wg-danger-bg-light);color:var(--wg-danger-color)}.wg__shortcuts-help{position:absolute;top:var(--wg-spacing-xs);right:var(--wg-spacing-sm);z-index:5}.wg__shortcuts-help--left{right:auto;left:var(--wg-spacing-sm)}.wg__shortcuts-help-icon{display:flex;align-items:center;justify-content:center;width:24px;height:24px;padding:0;border:none;border-radius:50%;background:var(--wg-surface-1);color:var(--wg-text-color-2);cursor:pointer;opacity:.7}.wg__shortcuts-help-icon:hover{opacity:1;background:var(--wg-surface-2)}.wg__shortcuts-help-icon svg{width:16px;height:16px}.wg__shortcuts-help-overlay{display:none;position:absolute;top:100%;right:0;margin-top:var(--wg-spacing-xs);padding:var(--wg-spacing-md);background:var(--wg-surface-1);border:1px solid var(--wg-border-color);border-radius:var(--wg-border-radius-md);box-shadow:0 4px 16px #00000026;min-width:200px;max-width:300px;z-index:100}.wg__shortcuts-help--left .wg__shortcuts-help-overlay{right:auto;left:0}.wg__shortcuts-help:hover .wg__shortcuts-help-overlay,.wg__shortcuts-help:focus-within .wg__shortcuts-help-overlay{display:block}.wg__shortcuts-help-title{font-weight:var(--wg-font-weight-semibold);font-size:var(--wg-font-size-base);color:var(--wg-text-color-1);margin-bottom:var(--wg-spacing-sm);padding-bottom:var(--wg-spacing-xs);border-bottom:1px solid var(--wg-border-color)}.wg__shortcuts-help-custom{margin-bottom:var(--wg-spacing-sm);padding-bottom:var(--wg-spacing-sm);border-bottom:1px solid var(--wg-border-color);font-size:var(--wg-font-size-sm);color:var(--wg-text-color-2)}.wg__shortcuts-help-list{display:flex;flex-direction:column;gap:var(--wg-spacing-xs)}.wg__shortcuts-help-item{display:flex;align-items:center;gap:var(--wg-spacing-md)}.wg__shortcuts-help-key{display:inline-flex;align-items:center;justify-content:center;min-width:28px;padding:2px 6px;font-family:var(--wg-font-family-mono);font-size:var(--wg-font-size-xs);font-weight:var(--wg-font-weight-semibold);color:var(--wg-text-color-1);background:var(--wg-surface-2);border:1px solid var(--wg-border-color);border-radius:var(--wg-border-radius-sm)}.wg__shortcuts-help-label{flex:1;font-size:var(--wg-font-size-sm);color:var(--wg-text-color-2)}.wg--striped tbody tr:nth-child(2n){background:var(--wg-row-bg-even)}.wg--hoverable tbody tr:hover{background:var(--wg-row-bg-hover)}.wg__empty{text-align:center;padding:var(--wg-empty-padding);color:var(--wg-empty-color);font-style:italic}.wg__loading-more{text-align:center;padding:var(--wg-cell-padding);color:var(--wg-text-color-2);font-size:var(--wg-font-size-sm)}.wg__tooltip{position:fixed;z-index:var(--wg-z-tooltip);max-width:300px;padding:6px 10px;background:var(--wg-tooltip-bg, #333);color:var(--wg-tooltip-color, #fff);font-size:var(--wg-font-size-sm);line-height:1.4;border-radius:var(--wg-border-radius-sm);box-shadow:0 2px 8px #0003;pointer-events:none;opacity:0;transition:opacity var(--wg-transition-fast)}.wg__tooltip--visible{opacity:1}.wg__tooltip-arrow{position:absolute;width:8px;height:8px;background:var(--wg-tooltip-bg, #333);transform:rotate(45deg)}.wg__tooltip[data-placement^=top] .wg__tooltip-arrow{bottom:-4px}.wg__tooltip[data-placement^=bottom] .wg__tooltip-arrow{top:-4px}.wg__tooltip[data-placement^=left] .wg__tooltip-arrow{right:-4px}.wg__tooltip[data-placement^=right] .wg__tooltip-arrow{left:-4px}.wg__tooltip-title{font-weight:600}.wg__tooltip-desc{opacity:.85;margin-top:2px}.wg__tooltip-shortcut{margin-top:4px;opacity:.7;font-size:.9em}.wg__goto-overlay{position:fixed;top:0;right:0;bottom:0;left:0;background:#0006;display:flex;align-items:center;justify-content:center;z-index:1000}.wg__goto-dialog{background:var(--wg-surface-1);border-radius:var(--wg-border-radius-md);padding:var(--wg-spacing-lg);box-shadow:0 4px 20px #00000026;min-width:250px}.wg__goto-label{display:block;margin-bottom:var(--wg-spacing-sm);font-size:var(--wg-font-size-base);color:var(--wg-text-color-1)}.wg__goto-input{width:100%;padding:var(--wg-spacing-sm) var(--wg-spacing-md);border:1px solid var(--wg-border-color);border-radius:var(--wg-border-radius-sm);font-family:inherit;font-size:var(--wg-font-size-base);margin-bottom:var(--wg-spacing-md);box-sizing:border-box}.wg__goto-input:focus{outline:none;border-color:var(--wg-accent-color);box-shadow:0 0 0 2px #0078d433}.wg__goto-buttons{display:flex;gap:var(--wg-spacing-sm);justify-content:flex-end}.wg__goto-btn{padding:var(--wg-spacing-sm) var(--wg-spacing-md);border:1px solid var(--wg-border-color);border-radius:var(--wg-border-radius-sm);font-family:inherit;font-size:var(--wg-font-size-sm);cursor:pointer;background:var(--wg-surface-1);color:var(--wg-text-color-1)}.wg__goto-btn:hover{background:var(--wg-surface-2)}.wg__goto-btn--go{background:var(--wg-accent-color);border-color:var(--wg-accent-color);color:#fff}.wg__goto-btn--go:hover{background:var(--wg-accent-color-hover, #106ebe)}.wg__spacer-top td,.wg__spacer-bottom td{padding:0;border:none;background:transparent;height:inherit;line-height:0}@media (prefers-color-scheme: dark){:host{--wg-surface-1: #1f1f1f;--wg-surface-2: #2b2b2b;--wg-surface-3: #333333;--wg-surface-floating: #2b2b2b;--wg-text-color-1: #e0e0e0;--wg-text-color-2: #c0c0c0;--wg-text-color-3: #a0a0a0;--wg-border-color: #3d3d3d;--wg-border-color-hover: #5a5a5a;--wg-input-bg: #1f1f1f;--wg-input-border: 1px solid #5a5a5a;--wg-hover-bg: #3a3a3a;--wg-active-bg: #4a4a4a;--wg-danger-bg-light: #442726;--wg-danger-color: #f87c86}}:host([data-theme="dark"]),[data-theme=dark] :host,:host([data-bs-theme="dark"]),[data-bs-theme=dark] :host,.dark :host{--wg-surface-1: #1f1f1f;--wg-surface-2: #2b2b2b;--wg-surface-3: #333333;--wg-surface-floating: #2b2b2b;--wg-text-color-1: #e0e0e0;--wg-text-color-2: #c0c0c0;--wg-text-color-3: #a0a0a0;--wg-border-color: #3d3d3d;--wg-border-color-hover: #5a5a5a;--wg-input-bg: #1f1f1f;--wg-input-border: 1px solid #5a5a5a;--wg-hover-bg: #3a3a3a;--wg-active-bg: #4a4a4a;--wg-danger-bg-light: #442726;--wg-danger-color: #f87c86}';function Yt(e,o,t){const i=t.valueMember||"value",r=t.displayMember||"label",n=o.find(s=>s[i]===e);return n?String(n[r]??""):e!=null?String(e):""}function kt(e,o){if(o.getDisplayCallback)return o.getDisplayCallback(e);const t=o.displayMember||"label";return String(e[t]??e.label??"")}function gt(e,o){if(o.getValueCallback)return o.getValueCallback(e);const t=o.valueMember||"value";return e[t]??e.value}function no(e,o){return o.getIconCallback?o.getIconCallback(e):o.iconMember&&e[o.iconMember]||null}function so(e,o){return o.getSubtitleCallback?o.getSubtitleCallback(e):o.subtitleMember&&e[o.subtitleMember]||null}function xt(e,o){return o.getDisabledCallback?o.getDisabledCallback(e):o.disabledMember?!!e[o.disabledMember]:!1}const st=Math.min,q=Math.max,Rt=Math.round,At=Math.floor,Z=e=>({x:e,y:e}),ao={left:"right",right:"left",bottom:"top",top:"bottom"},lo={start:"end",end:"start"};function Nt(e,o,t){return q(e,st(o,t))}function wt(e,o){return typeof e=="function"?e(o):e}function at(e){return e.split("-")[0]}function mt(e){return e.split("-")[1]}function ye(e){return e==="x"?"y":"x"}function Bt(e){return e==="y"?"height":"width"}const co=new Set(["top","bottom"]);function rt(e){return co.has(at(e))?"y":"x"}function Ut(e){return ye(rt(e))}function go(e,o,t){t===void 0&&(t=!1);const i=mt(e),r=Ut(e),n=Bt(r);let s=r==="x"?i===(t?"end":"start")?"right":"left":i==="start"?"bottom":"top";return o.reference[n]>o.floating[n]&&(s=It(s)),[s,It(s)]}function uo(e){const o=It(e);return[jt(e),o,jt(o)]}function jt(e){return e.replace(/start|end/g,o=>lo[o])}const Ce=["left","right"],Se=["right","left"],ho=["top","bottom"],po=["bottom","top"];function fo(e,o,t){switch(e){case"top":case"bottom":return t?o?Se:Ce:o?Ce:Se;case"left":case"right":return o?ho:po;default:return[]}}function wo(e,o,t,i){const r=mt(e);let n=fo(at(e),t==="start",i);return r&&(n=n.map(s=>s+"-"+r),o&&(n=n.concat(n.map(jt)))),n}function It(e){return e.replace(/left|right|bottom|top/g,o=>ao[o])}function mo(e){return{top:0,right:0,bottom:0,left:0,...e}}function ke(e){return typeof e!="number"?mo(e):{top:e,right:e,bottom:e,left:e}}function Lt(e){const{x:o,y:t,width:i,height:r}=e;return{width:i,height:r,top:t,left:o,right:o+i,bottom:t+r,x:o,y:t}}function xe(e,o,t){let{reference:i,floating:r}=e;const n=rt(o),s=Ut(o),c=Bt(s),a=at(o),l=n==="y",g=i.x+i.width/2-r.width/2,d=i.y+i.height/2-r.height/2,h=i[c]/2-r[c]/2;let u;switch(a){case"top":u={x:g,y:i.y-r.height};break;case"bottom":u={x:g,y:i.y+i.height};break;case"right":u={x:i.x+i.width,y:d};break;case"left":u={x:i.x-r.width,y:d};break;default:u={x:i.x,y:i.y}}switch(mt(o)){case"start":u[s]-=h*(t&&l?-1:1);break;case"end":u[s]+=h*(t&&l?-1:1);break}return u}const bo=async(e,o,t)=>{const{placement:i="bottom",strategy:r="absolute",middleware:n=[],platform:s}=t,c=n.filter(Boolean),a=await(s.isRTL==null?void 0:s.isRTL(o));let l=await s.getElementRects({reference:e,floating:o,strategy:r}),{x:g,y:d}=xe(l,i,a),h=i,u={},p=0;for(let b=0;b<c.length;b++){const{name:v,fn:w}=c[b],{x:_,y:m,data:C,reset:y}=await w({x:g,y:d,initialPlacement:i,placement:h,strategy:r,middlewareData:u,rects:l,platform:s,elements:{reference:e,floating:o}});g=_??g,d=m??d,u={...u,[v]:{...u[v],...C}},y&&p<=50&&(p++,typeof y=="object"&&(y.placement&&(h=y.placement),y.rects&&(l=y.rects===!0?await s.getElementRects({reference:e,floating:o,strategy:r}):y.rects),{x:g,y:d}=xe(l,h,a)),b=-1)}return{x:g,y:d,placement:h,strategy:r,middlewareData:u}};async function Kt(e,o){var t;o===void 0&&(o={});const{x:i,y:r,platform:n,rects:s,elements:c,strategy:a}=e,{boundary:l="clippingAncestors",rootBoundary:g="viewport",elementContext:d="floating",altBoundary:h=!1,padding:u=0}=wt(o,e),p=ke(u),v=c[h?d==="floating"?"reference":"floating":d],w=Lt(await n.getClippingRect({element:(t=await(n.isElement==null?void 0:n.isElement(v)))==null||t?v:v.contextElement||await(n.getDocumentElement==null?void 0:n.getDocumentElement(c.floating)),boundary:l,rootBoundary:g,strategy:a})),_=d==="floating"?{x:i,y:r,width:s.floating.width,height:s.floating.height}:s.reference,m=await(n.getOffsetParent==null?void 0:n.getOffsetParent(c.floating)),C=await(n.isElement==null?void 0:n.isElement(m))?await(n.getScale==null?void 0:n.getScale(m))||{x:1,y:1}:{x:1,y:1},y=Lt(n.convertOffsetParentRelativeRectToViewportRelativeRect?await n.convertOffsetParentRelativeRectToViewportRelativeRect({elements:c,rect:_,offsetParent:m,strategy:a}):_);return{top:(w.top-y.top+p.top)/C.y,bottom:(y.bottom-w.bottom+p.bottom)/C.y,left:(w.left-y.left+p.left)/C.x,right:(y.right-w.right+p.right)/C.x}}const vo=e=>({name:"arrow",options:e,async fn(o){const{x:t,y:i,placement:r,rects:n,platform:s,elements:c,middlewareData:a}=o,{element:l,padding:g=0}=wt(e,o)||{};if(l==null)return{};const d=ke(g),h={x:t,y:i},u=Ut(r),p=Bt(u),b=await s.getDimensions(l),v=u==="y",w=v?"top":"left",_=v?"bottom":"right",m=v?"clientHeight":"clientWidth",C=n.reference[p]+n.reference[u]-h[u]-n.floating[p],y=h[u]-n.reference[u],S=await(s.getOffsetParent==null?void 0:s.getOffsetParent(l));let k=S?S[m]:0;(!k||!await(s.isElement==null?void 0:s.isElement(S)))&&(k=c.floating[m]||n.floating[p]);const x=C/2-y/2,E=k/2-b[p]/2-1,$=st(d[w],E),R=st(d[_],E),L=$,D=k-b[p]-R,T=k/2-b[p]/2+x,M=Nt(L,T,D),F=!a.arrow&&mt(r)!=null&&T!==M&&n.reference[p]/2-(T<L?$:R)-b[p]/2<0,P=F?T<L?T-L:T-D:0;return{[u]:h[u]+P,data:{[u]:M,centerOffset:T-M-P,...F&&{alignmentOffset:P}},reset:F}}}),_o=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(o){var t,i;const{placement:r,middlewareData:n,rects:s,initialPlacement:c,platform:a,elements:l}=o,{mainAxis:g=!0,crossAxis:d=!0,fallbackPlacements:h,fallbackStrategy:u="bestFit",fallbackAxisSideDirection:p="none",flipAlignment:b=!0,...v}=wt(e,o);if((t=n.arrow)!=null&&t.alignmentOffset)return{};const w=at(r),_=rt(c),m=at(c)===c,C=await(a.isRTL==null?void 0:a.isRTL(l.floating)),y=h||(m||!b?[It(c)]:uo(c)),S=p!=="none";!h&&S&&y.push(...wo(c,b,p,C));const k=[c,...y],x=await Kt(o,v),E=[];let $=((i=n.flip)==null?void 0:i.overflows)||[];if(g&&E.push(x[w]),d){const T=go(r,s,C);E.push(x[T[0]],x[T[1]])}if($=[...$,{placement:r,overflows:E}],!E.every(T=>T<=0)){var R,L;const T=(((R=n.flip)==null?void 0:R.index)||0)+1,M=k[T];if(M&&(!(d==="alignment"?_!==rt(M):!1)||$.every(j=>rt(j.placement)===_?j.overflows[0]>0:!0)))return{data:{index:T,overflows:$},reset:{placement:M}};let F=(L=$.filter(P=>P.overflows[0]<=0).sort((P,j)=>P.overflows[1]-j.overflows[1])[0])==null?void 0:L.placement;if(!F)switch(u){case"bestFit":{var D;const P=(D=$.filter(j=>{if(S){const ot=rt(j.placement);return ot===_||ot==="y"}return!0}).map(j=>[j.placement,j.overflows.filter(ot=>ot>0).reduce((ot,it)=>ot+it,0)]).sort((j,ot)=>j[1]-ot[1])[0])==null?void 0:D[0];P&&(F=P);break}case"initialPlacement":F=c;break}if(r!==F)return{reset:{placement:F}}}return{}}}},yo=new Set(["left","top"]);async function Co(e,o){const{placement:t,platform:i,elements:r}=e,n=await(i.isRTL==null?void 0:i.isRTL(r.floating)),s=at(t),c=mt(t),a=rt(t)==="y",l=yo.has(s)?-1:1,g=n&&a?-1:1,d=wt(o,e);let{mainAxis:h,crossAxis:u,alignmentAxis:p}=typeof d=="number"?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return c&&typeof p=="number"&&(u=c==="end"?p*-1:p),a?{x:u*g,y:h*l}:{x:h*l,y:u*g}}const So=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(o){var t,i;const{x:r,y:n,placement:s,middlewareData:c}=o,a=await Co(o,e);return s===((t=c.offset)==null?void 0:t.placement)&&(i=c.arrow)!=null&&i.alignmentOffset?{}:{x:r+a.x,y:n+a.y,data:{...a,placement:s}}}}},ko=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(o){const{x:t,y:i,placement:r}=o,{mainAxis:n=!0,crossAxis:s=!1,limiter:c={fn:v=>{let{x:w,y:_}=v;return{x:w,y:_}}},...a}=wt(e,o),l={x:t,y:i},g=await Kt(o,a),d=rt(at(r)),h=ye(d);let u=l[h],p=l[d];if(n){const v=h==="y"?"top":"left",w=h==="y"?"bottom":"right",_=u+g[v],m=u-g[w];u=Nt(_,u,m)}if(s){const v=d==="y"?"top":"left",w=d==="y"?"bottom":"right",_=p+g[v],m=p-g[w];p=Nt(_,p,m)}const b=c.fn({...o,[h]:u,[d]:p});return{...b,data:{x:b.x-t,y:b.y-i,enabled:{[h]:n,[d]:s}}}}}},xo=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(o){var t,i;const{placement:r,rects:n,platform:s,elements:c}=o,{apply:a=()=>{},...l}=wt(e,o),g=await Kt(o,l),d=at(r),h=mt(r),u=rt(r)==="y",{width:p,height:b}=n.floating;let v,w;d==="top"||d==="bottom"?(v=d,w=h===(await(s.isRTL==null?void 0:s.isRTL(c.floating))?"start":"end")?"left":"right"):(w=d,v=h==="end"?"top":"bottom");const _=b-g.top-g.bottom,m=p-g.left-g.right,C=st(b-g[v],_),y=st(p-g[w],m),S=!o.middlewareData.shift;let k=C,x=y;if((t=o.middlewareData.shift)!=null&&t.enabled.x&&(x=m),(i=o.middlewareData.shift)!=null&&i.enabled.y&&(k=_),S&&!h){const $=q(g.left,0),R=q(g.right,0),L=q(g.top,0),D=q(g.bottom,0);u?x=p-2*($!==0||R!==0?$+R:q(g.left,g.right)):k=b-2*(L!==0||D!==0?L+D:q(g.top,g.bottom))}await a({...o,availableWidth:x,availableHeight:k});const E=await s.getDimensions(c.floating);return p!==E.width||b!==E.height?{reset:{rects:!0}}:{}}}};function Ot(){return typeof window<"u"}function bt(e){return De(e)?(e.nodeName||"").toLowerCase():"#document"}function Y(e){var o;return(e==null||(o=e.ownerDocument)==null?void 0:o.defaultView)||window}function tt(e){var o;return(o=(De(e)?e.ownerDocument:e.document)||window.document)==null?void 0:o.documentElement}function De(e){return Ot()?e instanceof Node||e instanceof Y(e).Node:!1}function X(e){return Ot()?e instanceof Element||e instanceof Y(e).Element:!1}function et(e){return Ot()?e instanceof HTMLElement||e instanceof Y(e).HTMLElement:!1}function Te(e){return!Ot()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Y(e).ShadowRoot}const Do=new Set(["inline","contents"]);function Dt(e){const{overflow:o,overflowX:t,overflowY:i,display:r}=Q(e);return/auto|scroll|overlay|hidden|clip/.test(o+i+t)&&!Do.has(r)}const To=new Set(["table","td","th"]);function Eo(e){return To.has(bt(e))}const $o=[":popover-open",":modal"];function Ht(e){return $o.some(o=>{try{return e.matches(o)}catch{return!1}})}const Mo=["transform","translate","scale","rotate","perspective"],Ro=["transform","translate","scale","rotate","perspective","filter"],Ao=["paint","layout","strict","content"];function Wt(e){const o=Xt(),t=X(e)?Q(e):e;return Mo.some(i=>t[i]?t[i]!=="none":!1)||(t.containerType?t.containerType!=="normal":!1)||!o&&(t.backdropFilter?t.backdropFilter!=="none":!1)||!o&&(t.filter?t.filter!=="none":!1)||Ro.some(i=>(t.willChange||"").includes(i))||Ao.some(i=>(t.contain||"").includes(i))}function Io(e){let o=lt(e);for(;et(o)&&!vt(o);){if(Wt(o))return o;if(Ht(o))return null;o=lt(o)}return null}function Xt(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const Lo=new Set(["html","body","#document"]);function vt(e){return Lo.has(bt(e))}function Q(e){return Y(e).getComputedStyle(e)}function Pt(e){return X(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function lt(e){if(bt(e)==="html")return e;const o=e.assignedSlot||e.parentNode||Te(e)&&e.host||tt(e);return Te(o)?o.host:o}function Ee(e){const o=lt(e);return vt(o)?e.ownerDocument?e.ownerDocument.body:e.body:et(o)&&Dt(o)?o:Ee(o)}function Tt(e,o,t){var i;o===void 0&&(o=[]),t===void 0&&(t=!0);const r=Ee(e),n=r===((i=e.ownerDocument)==null?void 0:i.body),s=Y(r);if(n){const c=Qt(s);return o.concat(s,s.visualViewport||[],Dt(r)?r:[],c&&t?Tt(c):[])}return o.concat(r,Tt(r,[],t))}function Qt(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function $e(e){const o=Q(e);let t=parseFloat(o.width)||0,i=parseFloat(o.height)||0;const r=et(e),n=r?e.offsetWidth:t,s=r?e.offsetHeight:i,c=Rt(t)!==n||Rt(i)!==s;return c&&(t=n,i=s),{width:t,height:i,$:c}}function Gt(e){return X(e)?e:e.contextElement}function _t(e){const o=Gt(e);if(!et(o))return Z(1);const t=o.getBoundingClientRect(),{width:i,height:r,$:n}=$e(o);let s=(n?Rt(t.width):t.width)/i,c=(n?Rt(t.height):t.height)/r;return(!s||!Number.isFinite(s))&&(s=1),(!c||!Number.isFinite(c))&&(c=1),{x:s,y:c}}const Oo=Z(0);function Me(e){const o=Y(e);return!Xt()||!o.visualViewport?Oo:{x:o.visualViewport.offsetLeft,y:o.visualViewport.offsetTop}}function Ho(e,o,t){return o===void 0&&(o=!1),!t||o&&t!==Y(e)?!1:o}function ut(e,o,t,i){o===void 0&&(o=!1),t===void 0&&(t=!1);const r=e.getBoundingClientRect(),n=Gt(e);let s=Z(1);o&&(i?X(i)&&(s=_t(i)):s=_t(e));const c=Ho(n,t,i)?Me(n):Z(0);let a=(r.left+c.x)/s.x,l=(r.top+c.y)/s.y,g=r.width/s.x,d=r.height/s.y;if(n){const h=Y(n),u=i&&X(i)?Y(i):i;let p=h,b=Qt(p);for(;b&&i&&u!==p;){const v=_t(b),w=b.getBoundingClientRect(),_=Q(b),m=w.left+(b.clientLeft+parseFloat(_.paddingLeft))*v.x,C=w.top+(b.clientTop+parseFloat(_.paddingTop))*v.y;a*=v.x,l*=v.y,g*=v.x,d*=v.y,a+=m,l+=C,p=Y(b),b=Qt(p)}}return Lt({width:g,height:d,x:a,y:l})}function Vt(e,o){const t=Pt(e).scrollLeft;return o?o.left+t:ut(tt(e)).left+t}function Re(e,o){const t=e.getBoundingClientRect(),i=t.left+o.scrollLeft-Vt(e,t),r=t.top+o.scrollTop;return{x:i,y:r}}function Po(e){let{elements:o,rect:t,offsetParent:i,strategy:r}=e;const n=r==="fixed",s=tt(i),c=o?Ht(o.floating):!1;if(i===s||c&&n)return t;let a={scrollLeft:0,scrollTop:0},l=Z(1);const g=Z(0),d=et(i);if((d||!d&&!n)&&((bt(i)!=="body"||Dt(s))&&(a=Pt(i)),et(i))){const u=ut(i);l=_t(i),g.x=u.x+i.clientLeft,g.y=u.y+i.clientTop}const h=s&&!d&&!n?Re(s,a):Z(0);return{width:t.width*l.x,height:t.height*l.y,x:t.x*l.x-a.scrollLeft*l.x+g.x+h.x,y:t.y*l.y-a.scrollTop*l.y+g.y+h.y}}function Vo(e){return Array.from(e.getClientRects())}function zo(e){const o=tt(e),t=Pt(e),i=e.ownerDocument.body,r=q(o.scrollWidth,o.clientWidth,i.scrollWidth,i.clientWidth),n=q(o.scrollHeight,o.clientHeight,i.scrollHeight,i.clientHeight);let s=-t.scrollLeft+Vt(e);const c=-t.scrollTop;return Q(i).direction==="rtl"&&(s+=q(o.clientWidth,i.clientWidth)-r),{width:r,height:n,x:s,y:c}}const Ae=25;function Fo(e,o){const t=Y(e),i=tt(e),r=t.visualViewport;let n=i.clientWidth,s=i.clientHeight,c=0,a=0;if(r){n=r.width,s=r.height;const g=Xt();(!g||g&&o==="fixed")&&(c=r.offsetLeft,a=r.offsetTop)}const l=Vt(i);if(l<=0){const g=i.ownerDocument,d=g.body,h=getComputedStyle(d),u=g.compatMode==="CSS1Compat"&&parseFloat(h.marginLeft)+parseFloat(h.marginRight)||0,p=Math.abs(i.clientWidth-d.clientWidth-u);p<=Ae&&(n-=p)}else l<=Ae&&(n+=l);return{width:n,height:s,x:c,y:a}}const qo=new Set(["absolute","fixed"]);function Yo(e,o){const t=ut(e,!0,o==="fixed"),i=t.top+e.clientTop,r=t.left+e.clientLeft,n=et(e)?_t(e):Z(1),s=e.clientWidth*n.x,c=e.clientHeight*n.y,a=r*n.x,l=i*n.y;return{width:s,height:c,x:a,y:l}}function Ie(e,o,t){let i;if(o==="viewport")i=Fo(e,t);else if(o==="document")i=zo(tt(e));else if(X(o))i=Yo(o,t);else{const r=Me(e);i={x:o.x-r.x,y:o.y-r.y,width:o.width,height:o.height}}return Lt(i)}function Le(e,o){const t=lt(e);return t===o||!X(t)||vt(t)?!1:Q(t).position==="fixed"||Le(t,o)}function No(e,o){const t=o.get(e);if(t)return t;let i=Tt(e,[],!1).filter(c=>X(c)&&bt(c)!=="body"),r=null;const n=Q(e).position==="fixed";let s=n?lt(e):e;for(;X(s)&&!vt(s);){const c=Q(s),a=Wt(s);!a&&c.position==="fixed"&&(r=null),(n?!a&&!r:!a&&c.position==="static"&&!!r&&qo.has(r.position)||Dt(s)&&!a&&Le(e,s))?i=i.filter(g=>g!==s):r=c,s=lt(s)}return o.set(e,i),i}function Bo(e){let{element:o,boundary:t,rootBoundary:i,strategy:r}=e;const s=[...t==="clippingAncestors"?Ht(o)?[]:No(o,this._c):[].concat(t),i],c=s[0],a=s.reduce((l,g)=>{const d=Ie(o,g,r);return l.top=q(d.top,l.top),l.right=st(d.right,l.right),l.bottom=st(d.bottom,l.bottom),l.left=q(d.left,l.left),l},Ie(o,c,r));return{width:a.right-a.left,height:a.bottom-a.top,x:a.left,y:a.top}}function Uo(e){const{width:o,height:t}=$e(e);return{width:o,height:t}}function jo(e,o,t){const i=et(o),r=tt(o),n=t==="fixed",s=ut(e,!0,n,o);let c={scrollLeft:0,scrollTop:0};const a=Z(0);function l(){a.x=Vt(r)}if(i||!i&&!n)if((bt(o)!=="body"||Dt(r))&&(c=Pt(o)),i){const u=ut(o,!0,n,o);a.x=u.x+o.clientLeft,a.y=u.y+o.clientTop}else r&&l();n&&!i&&r&&l();const g=r&&!i&&!n?Re(r,c):Z(0),d=s.left+c.scrollLeft-a.x-g.x,h=s.top+c.scrollTop-a.y-g.y;return{x:d,y:h,width:s.width,height:s.height}}function Jt(e){return Q(e).position==="static"}function Oe(e,o){if(!et(e)||Q(e).position==="fixed")return null;if(o)return o(e);let t=e.offsetParent;return tt(e)===t&&(t=t.ownerDocument.body),t}function He(e,o){const t=Y(e);if(Ht(e))return t;if(!et(e)){let r=lt(e);for(;r&&!vt(r);){if(X(r)&&!Jt(r))return r;r=lt(r)}return t}let i=Oe(e,o);for(;i&&Eo(i)&&Jt(i);)i=Oe(i,o);return i&&vt(i)&&Jt(i)&&!Wt(i)?t:i||Io(e)||t}const Ko=async function(e){const o=this.getOffsetParent||He,t=this.getDimensions,i=await t(e.floating);return{reference:jo(e.reference,await o(e.floating),e.strategy),floating:{x:0,y:0,width:i.width,height:i.height}}};function Wo(e){return Q(e).direction==="rtl"}const Xo={convertOffsetParentRelativeRectToViewportRelativeRect:Po,getDocumentElement:tt,getClippingRect:Bo,getOffsetParent:He,getElementRects:Ko,getClientRects:Vo,getDimensions:Uo,getScale:_t,isElement:X,isRTL:Wo};function Pe(e,o){return e.x===o.x&&e.y===o.y&&e.width===o.width&&e.height===o.height}function Qo(e,o){let t=null,i;const r=tt(e);function n(){var c;clearTimeout(i),(c=t)==null||c.disconnect(),t=null}function s(c,a){c===void 0&&(c=!1),a===void 0&&(a=1),n();const l=e.getBoundingClientRect(),{left:g,top:d,width:h,height:u}=l;if(c||o(),!h||!u)return;const p=At(d),b=At(r.clientWidth-(g+h)),v=At(r.clientHeight-(d+u)),w=At(g),m={rootMargin:-p+"px "+-b+"px "+-v+"px "+-w+"px",threshold:q(0,st(1,a))||1};let C=!0;function y(S){const k=S[0].intersectionRatio;if(k!==a){if(!C)return s();k?s(!1,k):i=setTimeout(()=>{s(!1,1e-7)},1e3)}k===1&&!Pe(l,e.getBoundingClientRect())&&s(),C=!1}try{t=new IntersectionObserver(y,{...m,root:r.ownerDocument})}catch{t=new IntersectionObserver(y,m)}t.observe(e)}return s(!0),n}function Go(e,o,t,i){i===void 0&&(i={});const{ancestorScroll:r=!0,ancestorResize:n=!0,elementResize:s=typeof ResizeObserver=="function",layoutShift:c=typeof IntersectionObserver=="function",animationFrame:a=!1}=i,l=Gt(e),g=r||n?[...l?Tt(l):[],...Tt(o)]:[];g.forEach(w=>{r&&w.addEventListener("scroll",t,{passive:!0}),n&&w.addEventListener("resize",t)});const d=l&&c?Qo(l,t):null;let h=-1,u=null;s&&(u=new ResizeObserver(w=>{let[_]=w;_&&_.target===l&&u&&(u.unobserve(o),cancelAnimationFrame(h),h=requestAnimationFrame(()=>{var m;(m=u)==null||m.observe(o)})),t()}),l&&!a&&u.observe(l),u.observe(o));let p,b=a?ut(e):null;a&&v();function v(){const w=ut(e);b&&!Pe(b,w)&&t(),b=w,p=requestAnimationFrame(v)}return t(),()=>{var w;g.forEach(_=>{r&&_.removeEventListener("scroll",t),n&&_.removeEventListener("resize",t)}),d==null||d(),(w=u)==null||w.disconnect(),u=null,a&&cancelAnimationFrame(p)}}const Zt=So,te=ko,Et=_o,Jo=xo,Zo=vo,$t=(e,o,t)=>{const i=new Map,r={platform:Xo,...t},n={...r.platform,_c:i};return bo(e,o,{...r,platform:n})};function ht(e,o,t,i){var n;O(e);const r=document.createElement("div");if(r.className="wg__dropdown",r.style.cssText=`
1
+ (function(B,U){typeof exports=="object"&&typeof module<"u"?U(exports):typeof define=="function"&&define.amd?define(["exports"],U):(B=typeof globalThis<"u"?globalThis:B||self,U(B.WebGrid={}))})(this,function(B){"use strict";var Rn=Object.defineProperty;var En=(B,U,yt)=>U in B?Rn(B,U,{enumerable:!0,configurable:!0,writable:!0,value:yt}):B[U]=yt;var w=(B,U,yt)=>En(B,typeof U!="symbol"?U+"":U,yt);const U={rowActions:"Row actions",inlineActionsHeader:"Actions",keyboardShortcuts:"Keyboard shortcuts",paginationFirst:"⏮",paginationPrevious:"◀",paginationNext:"▶",paginationLast:"⏭",paginationPageInfo:"Page {current} of {total}",paginationItemCount:"{count} items",paginationPerPage:"per page",dropdownNoOptions:"No options",dropdownSearching:"Searching..."};class yt{constructor(){w(this,"_items",[]);w(this,"_columns",[]);w(this,"_sortMode","none");w(this,"_filterable",!1);w(this,"_pageable",!1);w(this,"_pageSize",10);w(this,"_pageSizes",[10,25,50,100]);w(this,"_striped",!0);w(this,"_hoverable",!0);w(this,"_editable",!1);w(this,"_editTrigger","dblclick");w(this,"_editStartSelection","mousePosition");w(this,"_mode","excel");w(this,"_dropdownToggleVisibility","always");w(this,"_dropdownShowOnFocus",!0);w(this,"_openDropdownOnEnter",!1);w(this,"_checkboxAlwaysEditable",!1);w(this,"_showRowNumbers",!1);w(this,"_stickyRowNumbers",!1);w(this,"_freezeColumns",0);w(this,"_invalidCells",[]);w(this,"_showRowToolbar",!1);w(this,"_rowToolbar",["add","delete","duplicate"]);w(this,"_toolbarVerticalAlign","bottom");w(this,"_toolbarHorizontalAlign","center");w(this,"_toolbarTrigger","hover");w(this,"_toolbarPosition","auto");w(this,"_inlineActionsTitle","");w(this,"_contextMenu");w(this,"_contextMenuXOffset",8);w(this,"_contextMenuYOffset",0);w(this,"_rowShortcuts");w(this,"_showShortcutsHelp",!1);w(this,"_shortcutsHelpPosition","top-right");w(this,"_shortcutsHelpContentCallback");w(this,"_idValueMember");w(this,"_idValueCallback");w(this,"_rowLocking");w(this,"_externalLocks",new Map);w(this,"_onrowlockchange");w(this,"_gridName",null);w(this,"_persistColumnWidths",!1);w(this,"_columnWidths",new Map);w(this,"_oncolumnresize");w(this,"_allowColumnReorder",!1);w(this,"_persistColumnOrder",!1);w(this,"_columnOrder",new Map);w(this,"_oncolumnreorder");w(this,"_fillDirection","vertical");w(this,"_onfilldrag");w(this,"_onrowchange");w(this,"_onroweditstart");w(this,"_onroweditcancel");w(this,"_onvalidationerror");w(this,"_validationTooltipCallback");w(this,"_ontoolbarclick");w(this,"_onrowaction");w(this,"_oncontextmenuopen");w(this,"_ondatarequest");w(this,"_onrowdelete");w(this,"_sort",[]);w(this,"_filters",{});w(this,"_currentPage",1);w(this,"_totalItems",null);w(this,"_showPagination",!0);w(this,"_paginationPosition","bottom-center");w(this,"_paginationLabelsCallback");w(this,"_paginationLayout","pageSize|previous|pageInfo|next");w(this,"_summaryPosition");w(this,"_summaryContentCallback");w(this,"_summaryMetadata");w(this,"_summaryInline",!0);w(this,"_customStylesCallback");w(this,"_rowClassCallback");w(this,"_labels",{...U});w(this,"_virtualScroll",!1);w(this,"_virtualScrollThreshold",100);w(this,"_virtualScrollRowHeight",38);w(this,"_virtualScrollBuffer",10);w(this,"_infiniteScroll",!1);w(this,"_infiniteScrollThreshold",100);w(this,"_hasMoreItems",!0);w(this,"_isLoadingMore",!1);w(this,"_editingCell",null);w(this,"_currentCellError",null);w(this,"_isValidating",!1);w(this,"_draftRows",new Map);w(this,"_focusedCell",null);w(this,"_isCommittingFromKeyboard",!1);w(this,"_skipNextDropdownAutoEdit",!1);w(this,"_hoveredRowIndex",null);w(this,"_onInteractionChange",null);w(this,"_selectedRows",new Set);w(this,"_lastSelectedRowIndex",null);w(this,"_rangeShortcuts",[])}get items(){return this._items}set items(t){this._items=t,this.requestUpdate()}get columns(){return this._columns}set columns(t){this._columns=t,this.requestUpdate()}get sortMode(){return this._sortMode}set sortMode(t){this._sortMode=t,this.requestUpdate()}get filterable(){return this._filterable}set filterable(t){this._filterable=t,this.requestUpdate()}get pageable(){return this._pageable}set pageable(t){this._pageable=t,this.requestUpdate()}get pageSize(){return this._pageSize}set pageSize(t){this._pageSize=t,this.requestUpdate()}get pageSizes(){return this._pageSizes}set pageSizes(t){this._pageSizes=t,this.requestUpdate()}get striped(){return this._striped}set striped(t){this._striped=t,this.requestUpdate()}get hoverable(){return this._hoverable}set hoverable(t){this._hoverable=t,this.requestUpdate()}get editable(){return this._editable}set editable(t){this._editable=t,this.requestUpdate()}get editTrigger(){return this._editTrigger}set editTrigger(t){this._editTrigger=t,this.requestUpdate()}get editStartSelection(){return this._editStartSelection}set editStartSelection(t){this._editStartSelection=t}get mode(){return this._mode}set mode(t){this._mode=t,this.applyModeDefaults(),this.requestUpdate()}get dropdownToggleVisibility(){return this._dropdownToggleVisibility}set dropdownToggleVisibility(t){this._dropdownToggleVisibility=t,this.requestUpdate()}getEffectiveToggleVisibility(t){return t.dropdownToggleVisibility??this._dropdownToggleVisibility}get dropdownShowOnFocus(){return this._dropdownShowOnFocus}set dropdownShowOnFocus(t){this._dropdownShowOnFocus=t}get openDropdownOnEnter(){return this._openDropdownOnEnter}set openDropdownOnEnter(t){this._openDropdownOnEnter=t}getEffectiveOpenDropdownOnEnter(t){return t.openDropdownOnEnter??this._openDropdownOnEnter}get checkboxAlwaysEditable(){return this._checkboxAlwaysEditable}set checkboxAlwaysEditable(t){this._checkboxAlwaysEditable=t,this.requestUpdate()}get showRowNumbers(){return this._showRowNumbers}set showRowNumbers(t){this._showRowNumbers=t,this.requestUpdate()}get stickyRowNumbers(){return this._stickyRowNumbers}set stickyRowNumbers(t){this._stickyRowNumbers=t,this.requestUpdate()}get freezeColumns(){return this._freezeColumns}set freezeColumns(t){this._freezeColumns=Math.max(0,Math.floor(t)),this.requestUpdate()}get visualColumns(){const t=[],e=[];this._columns.filter(n=>n.frozen).length,this._columns.forEach((n,s)=>{const a={column:n,originalIndex:s};n.frozen?t.push(a):e.push(a)});const i=[],r=[];return e.forEach((n,s)=>{s<this._freezeColumns?i.push(n):r.push(n)}),this._columnOrder.size>0&&r.sort((n,s)=>{const a=String(n.column.field),l=String(s.column.field),d=this._columnOrder.get(a)??n.originalIndex,c=this._columnOrder.get(l)??s.originalIndex;return d-c}),[...t,...i,...r]}get totalFrozenColumns(){return this._columns.filter(e=>e.frozen).length+this._freezeColumns}isColumnFrozen(t){return t<this.totalFrozenColumns}get invalidCells(){return this._invalidCells}set invalidCells(t){this._invalidCells=t,this.requestUpdate()}get editingCell(){return this._editingCell}get isValidating(){return this._isValidating}get currentCellError(){return this._currentCellError}get hoveredRowIndex(){return this._hoveredRowIndex}get showRowToolbar(){return this._showRowToolbar}set showRowToolbar(t){this._showRowToolbar=t,this.requestUpdate()}get rowToolbar(){return this._rowToolbar}set rowToolbar(t){this._rowToolbar=t,this.requestUpdate()}get toolbarVerticalAlign(){return this._toolbarVerticalAlign}set toolbarVerticalAlign(t){this._toolbarVerticalAlign=t,this.requestUpdate()}get toolbarHorizontalAlign(){return this._toolbarHorizontalAlign}set toolbarHorizontalAlign(t){this._toolbarHorizontalAlign=t,this.requestUpdate()}get toolbarAlign(){return this._toolbarVerticalAlign}set toolbarAlign(t){this.toolbarVerticalAlign=t}get toolbarTopPosition(){return this._toolbarHorizontalAlign}set toolbarTopPosition(t){this.toolbarHorizontalAlign=t}get toolbarTrigger(){return this._toolbarTrigger}set toolbarTrigger(t){this._toolbarTrigger=t,this.requestUpdate()}get toolbarPosition(){return this._toolbarPosition}set toolbarPosition(t){this._toolbarPosition=t,this.requestUpdate()}get inlineActionsTitle(){return this._inlineActionsTitle}set inlineActionsTitle(t){this._inlineActionsTitle=t,this.requestUpdate()}get contextMenu(){return this._contextMenu}set contextMenu(t){this._contextMenu=t,this.requestUpdate()}get contextMenuXOffset(){return this._contextMenuXOffset}set contextMenuXOffset(t){this._contextMenuXOffset=t}get contextMenuYOffset(){return this._contextMenuYOffset}set contextMenuYOffset(t){this._contextMenuYOffset=t}get rowShortcuts(){return this._rowShortcuts}set rowShortcuts(t){this._rowShortcuts=t,this.requestUpdate()}get showShortcutsHelp(){return this._showShortcutsHelp}set showShortcutsHelp(t){this._showShortcutsHelp=t,this.requestUpdate()}get shortcutsHelpPosition(){return this._shortcutsHelpPosition}set shortcutsHelpPosition(t){this._shortcutsHelpPosition=t,this.requestUpdate()}get shortcutsHelpContentCallback(){return this._shortcutsHelpContentCallback}set shortcutsHelpContentCallback(t){this._shortcutsHelpContentCallback=t,this.requestUpdate()}get sort(){return this._sort}set sort(t){this._sort=t,this.requestUpdate()}get currentPage(){return this._currentPage}set currentPage(t){this._currentPage=t,this.requestUpdate()}get totalItems(){return this._totalItems}set totalItems(t){this._totalItems=t,this.requestUpdate()}get showPagination(){return this._showPagination}set showPagination(t){this._showPagination=t,this.requestUpdate()}get paginationPosition(){return this._paginationPosition}set paginationPosition(t){this._paginationPosition=t,this.requestUpdate()}get paginationLabelsCallback(){return this._paginationLabelsCallback}set paginationLabelsCallback(t){this._paginationLabelsCallback=t,this.requestUpdate()}get paginationLayout(){return this._paginationLayout}set paginationLayout(t){this._paginationLayout=t,this.requestUpdate()}get summaryPosition(){return this._summaryPosition}set summaryPosition(t){this._summaryPosition=t,this.requestUpdate()}get summaryContentCallback(){return this._summaryContentCallback}set summaryContentCallback(t){this._summaryContentCallback=t,this.requestUpdate()}get summaryMetadata(){return this._summaryMetadata}set summaryMetadata(t){this._summaryMetadata=t,this.requestUpdate()}get summaryInline(){return this._summaryInline}set summaryInline(t){this._summaryInline=t,this.requestUpdate()}get customStylesCallback(){return this._customStylesCallback}set customStylesCallback(t){this._customStylesCallback=t}get rowClassCallback(){return this._rowClassCallback}set rowClassCallback(t){this._rowClassCallback=t,this.requestUpdate()}get labels(){return this._labels}set labels(t){this._labels={...U,...t},this.requestUpdate()}get virtualScroll(){return this._virtualScroll}set virtualScroll(t){this._virtualScroll=t,this.requestUpdate()}get virtualScrollThreshold(){return this._virtualScrollThreshold}set virtualScrollThreshold(t){this._virtualScrollThreshold=t,this.requestUpdate()}get virtualScrollRowHeight(){return this._virtualScrollRowHeight}set virtualScrollRowHeight(t){this._virtualScrollRowHeight=t,this.requestUpdate()}get virtualScrollBuffer(){return this._virtualScrollBuffer}set virtualScrollBuffer(t){this._virtualScrollBuffer=t,this.requestUpdate()}get infiniteScroll(){return this._infiniteScroll}set infiniteScroll(t){this._infiniteScroll=t,this.requestUpdate()}get infiniteScrollThreshold(){return this._infiniteScrollThreshold}set infiniteScrollThreshold(t){this._infiniteScrollThreshold=t}get hasMoreItems(){return this._hasMoreItems}set hasMoreItems(t){this._hasMoreItems=t}get isLoadingMore(){return this._isLoadingMore}set isLoadingMore(t){this._isLoadingMore=t}shouldUseVirtualScroll(){return this._virtualScroll===!1?!1:this._virtualScroll===!0?!0:this.displayItems.length>=this._virtualScrollThreshold}get showRowActions(){return this._showRowToolbar}set showRowActions(t){this.showRowToolbar=t}get rowActions(){return this._rowToolbar}set rowActions(t){this.rowToolbar=t}set onrowchange(t){this._onrowchange=t}set onroweditstart(t){this._onroweditstart=t}set onroweditcancel(t){this._onroweditcancel=t}set onvalidationerror(t){this._onvalidationerror=t}get validationTooltipCallback(){return this._validationTooltipCallback}set validationTooltipCallback(t){this._validationTooltipCallback=t}get ontoolbarclick(){return this._ontoolbarclick}set ontoolbarclick(t){this._ontoolbarclick=t}set onrowaction(t){this._onrowaction=t}set oncontextmenuopen(t){this._oncontextmenuopen=t}get ondatarequest(){return this._ondatarequest}set ondatarequest(t){this._ondatarequest=t}get onrowdelete(){return this._onrowdelete}set onrowdelete(t){this._onrowdelete=t}get idValueMember(){return this._idValueMember}set idValueMember(t){this._idValueMember=t}get idValueCallback(){return this._idValueCallback}set idValueCallback(t){this._idValueCallback=t}get rowLocking(){return this._rowLocking}set rowLocking(t){this._rowLocking=t,this.requestUpdate()}get onrowlockchange(){return this._onrowlockchange}set onrowlockchange(t){this._onrowlockchange=t}get gridName(){return this._gridName}set gridName(t){this._gridName=t}get persistColumnWidths(){return this._persistColumnWidths}set persistColumnWidths(t){this._persistColumnWidths=t}get oncolumnresize(){return this._oncolumnresize}set oncolumnresize(t){this._oncolumnresize=t}get allowColumnReorder(){return this._allowColumnReorder}set allowColumnReorder(t){this._allowColumnReorder=t}get persistColumnOrder(){return this._persistColumnOrder}set persistColumnOrder(t){this._persistColumnOrder=t}get oncolumnreorder(){return this._oncolumnreorder}set oncolumnreorder(t){this._oncolumnreorder=t}get fillDirection(){return this._fillDirection}set fillDirection(t){this._fillDirection=t}get onfilldrag(){return this._onfilldrag}set onfilldrag(t){this._onfilldrag=t}get selectedRows(){return Array.from(this._selectedRows).sort((t,e)=>t-e)}get rangeShortcuts(){return this._rangeShortcuts}set rangeShortcuts(t){this._rangeShortcuts=t}isRowSelected(t){return this._selectedRows.has(t)}selectRow(t,e="replace"){switch(e){case"replace":this._selectedRows.clear(),this._selectedRows.add(t),this._lastSelectedRowIndex=t;break;case"toggle":this._selectedRows.has(t)?this._selectedRows.delete(t):this._selectedRows.add(t),this._lastSelectedRowIndex=t;break;case"range":if(this._lastSelectedRowIndex!==null){const i=Math.min(this._lastSelectedRowIndex,t),r=Math.max(this._lastSelectedRowIndex,t);for(let n=i;n<=r;n++)this._selectedRows.add(n)}else this._selectedRows.add(t),this._lastSelectedRowIndex=t;break}this.requestUpdate()}selectRowRange(t,e){this._selectedRows.clear();const i=Math.min(t,e),r=Math.max(t,e);for(let n=i;n<=r;n++)this._selectedRows.add(n);this._lastSelectedRowIndex=e,this.requestUpdate()}clearSelection(){this._selectedRows.size>0&&(this._selectedRows.clear(),this._lastSelectedRowIndex=null,this.requestUpdate())}getSelectedRowsData(){return this.selectedRows.map(t=>this.displayItems[t]).filter(Boolean)}get isNavigateMode(){return this._editTrigger==="navigate"||this._columns.some(t=>t.editTrigger==="navigate")}get filteredItems(){return!this._filterable||Object.keys(this._filters).length===0?this._items:this._items.filter(t=>Object.entries(this._filters).every(([e,i])=>i?String(t[e]??"").toLowerCase().includes(i.toLowerCase()):!0))}get sortedItems(){return this._sort.length===0?this.filteredItems:[...this.filteredItems].sort((t,e)=>{for(const i of this._sort){const r=t[i.column],n=e[i.column];if(r===n)continue;let s=0;return typeof r=="string"&&typeof n=="string"?s=r.localeCompare(n):typeof r=="number"&&typeof n=="number"?s=r-n:s=String(r??"").localeCompare(String(n??"")),i.direction==="asc"?s:-s}return 0})}get paginatedItems(){if(!this._pageable)return this.sortedItems;const t=(this._currentPage-1)*this._pageSize,e=t+this._pageSize;return this.sortedItems.slice(t,e)}get totalPages(){const t=this._totalItems!==null?this._totalItems:this.sortedItems.length;return Math.max(1,Math.ceil(t/this._pageSize))}get displayItems(){return this.paginatedItems}fireDataRequest(t){if(this._ondatarequest){const e=t==="loadMore"?this._items.length:(this._currentPage-1)*this._pageSize,i={sort:[...this._sort],page:this._currentPage,pageSize:this._pageSize,trigger:t,mode:t==="loadMore"?"append":"replace",skip:e};this._ondatarequest(i)}}getColumnSortState(t){return this._sort.find(e=>e.column===t)}getColumnSortPriority(t){const e=this._sort.findIndex(i=>i.column===t);return e>=0?e+1:0}applyModeDefaults(){switch(this._mode){case"read-only":this._editable=!1,this._dropdownToggleVisibility="on-focus";break;case"excel":this._editable=!0,this._editTrigger="navigate",this._dropdownToggleVisibility="always",this._dropdownShowOnFocus=!1;break;case"input-matrix":this._editable=!0,this._editTrigger="always",this._dropdownToggleVisibility="always",this._dropdownShowOnFocus=!0;break}}requestUpdate(){}getRowDraft(t){return this._draftRows.get(t)}hasRowDraft(t){return this._draftRows.has(t)}discardRowDraft(t){this._draftRows.delete(t),this._invalidCells=this._invalidCells.filter(e=>e.rowIndex!==t),this.requestUpdate()}getDraftRowIndices(){return Array.from(this._draftRows.keys())}discardAllDrafts(){this._draftRows.clear(),this._invalidCells=[],this.requestUpdate()}getCellRawValue(t,e,i){const r=this._draftRows.get(e);return r?r[i]:t[i]}getCellValue(t,e,i){if(e.templateCallback)return e.templateCallback(t);const r=i!==void 0?this.getCellRawValue(t,i,String(e.field)):t[String(e.field)];return e.formatCallback?e.formatCallback(r,t):String(r??"")}isCellInvalid(t,e){return this._invalidCells.some(i=>i.rowIndex===t&&i.field===e)}getCellValidationError(t,e){const i=this._invalidCells.find(r=>r.rowIndex===t&&r.field===e);return(i==null?void 0:i.error)||null}addInvalidCell(t,e,i){const r=this._invalidCells.findIndex(n=>n.rowIndex===t&&n.field===e);r>=0?this._invalidCells[r]={rowIndex:t,field:e,error:i}:this._invalidCells=[...this._invalidCells,{rowIndex:t,field:e,error:i}]}removeInvalidCell(t,e){this._invalidCells=this._invalidCells.filter(i=>!(i.rowIndex===t&&i.field===e))}isEditing(t,e){var i,r;return((i=this._editingCell)==null?void 0:i.rowIndex)===t&&((r=this._editingCell)==null?void 0:r.field)===e}startEdit(t,e,i){var s,a;if(!this.canEditCell(t,e))return;const r=this.displayItems[t];if(!r)return;this._draftRows.has(t)||this._draftRows.set(t,{...r});const n=this._editingCell;this._editingCell={rowIndex:t,field:e,initialSearchQuery:i==null?void 0:i.initialSearchQuery,cursorPosition:i==null?void 0:i.cursorPosition},(s=this._onInteractionChange)==null||s.call(this,"editingCell",{prev:n,current:this._editingCell}),this._currentCellError=null,(a=this._onroweditstart)==null||a.call(this,{row:r,rowIndex:t,field:e})}cancelEdit(){var t,e;if(this._editingCell){const i=this._editingCell,{rowIndex:r,field:n}=i,s=this.displayItems[r];s&&((t=this._onroweditcancel)==null||t.call(this,{row:s,rowIndex:r,field:n})),this._editingCell=null,(e=this._onInteractionChange)==null||e.call(this,"editingCell",{prev:i,current:null}),this._currentCellError=null}}normalizeValidationResult(t,e){return t==null||t===!0?{valid:!0,finalValue:e}:t===!1?{valid:!1,message:"Validation failed",finalValue:e}:typeof t=="string"?{valid:!1,message:t,finalValue:e}:{valid:t.valid,message:t.message,finalValue:t.transformedValue!==void 0?t.transformedValue:e}}async commitEdit(t,e,i){var g,h,f;const r=this._columns.find(m=>String(m.field)===e);if(!r)return;const n=this.displayItems[t];if(!n)return;const s=n[e];let a=i,l=null,d=!0;this._isValidating=!0;try{if(r.beforeCommitCallback){const m={value:i,oldValue:s,row:n,rowIndex:t,field:e},v=await Promise.resolve(r.beforeCommitCallback(m)),p=this.normalizeValidationResult(v,i);d=p.valid,l=p.message||null,a=p.finalValue}else if(r.validateCallback){const m=await Promise.resolve(r.validateCallback(i,n));m&&(d=!1,l=m)}}catch(m){d=!1,l=m instanceof Error?m.message:"Validation failed"}this._isValidating=!1;let c=this._draftRows.get(t);c||(c={...n},this._draftRows.set(t,c)),c[e]=a,d?(this.removeInvalidCell(t,e),this._currentCellError=null):(this.addInvalidCell(t,e,l||"Invalid value"),this._currentCellError=l,(g=this._onvalidationerror)==null||g.call(this,{row:n,rowIndex:t,field:e,error:l||"Invalid value"})),(h=this._onrowchange)==null||h.call(this,{row:n,draftRow:c,rowIndex:t,field:e,oldValue:s,newValue:a,isValid:d,validationError:l});const u=this._editingCell;this._editingCell=null,(f=this._onInteractionChange)==null||f.call(this,"editingCell",{prev:u,current:null})}isCellEditable(t){return t.editable===!1?!1:this._editable||t.editor!==void 0}getEditableColumns(){return this._columns.map((t,e)=>({index:e,column:t})).filter(({column:t})=>this.isCellEditable(t))}isCellFocused(t,e){var i,r;return((i=this._focusedCell)==null?void 0:i.rowIndex)===t&&((r=this._focusedCell)==null?void 0:r.colIndex)===e}get focusedCell(){return this._focusedCell}setFocusedCell(t,e){var n;const i=this._focusedCell,r={rowIndex:t,colIndex:e};(i==null?void 0:i.rowIndex)===r.rowIndex&&(i==null?void 0:i.colIndex)===r.colIndex||(this._focusedCell=r,(n=this._onInteractionChange)==null||n.call(this,"focusedCell",{prev:i,current:r}))}clearFocusedCell(){var e;const t=this._focusedCell;t!==null&&(this._focusedCell=null,(e=this._onInteractionChange)==null||e.call(this,"focusedCell",{prev:t,current:null}))}setHoveredRow(t){var i;if(this._hoveredRowIndex===t)return;const e=this._hoveredRowIndex;this._hoveredRowIndex=t,(i=this._onInteractionChange)==null||i.call(this,"hoveredRow",{prev:e,current:t})}getRowId(t){if(this._idValueCallback)return this._idValueCallback(t);if(this._idValueMember)return t[String(this._idValueMember)]}findRowById(t){const e=this._items.findIndex(i=>this.getRowId(i)===t);return e===-1?null:{row:this._items[e],index:e}}getRowLockInfo(t){let e,i,r=-1;if(typeof t=="object"&&t!==null)e=t,i=this.getRowId(e),r=this._items.indexOf(e),r===-1&&(r=this.displayItems.indexOf(e));else{i=t;const s=this.findRowById(i);s&&(e=s.row,r=s.index)}if(i!==void 0&&this._externalLocks.has(i))return this._externalLocks.get(i);if(!e)return null;const n=this._rowLocking;if(!n)return null;if(n.getLockInfoCallback){const s=n.getLockInfoCallback(e,r);if(s!=null&&s.isLocked)return s}if(n.isLockedCallback&&n.isLockedCallback(e,r))return{isLocked:!0};if(n.lockInfoMember){const s=e[String(n.lockInfoMember)];if(s!=null&&s.isLocked)return s}return n.lockedMember&&e[String(n.lockedMember)]?{isLocked:!0}:null}isRowLocked(t){const e=this.getRowLockInfo(t);return(e==null?void 0:e.isLocked)===!0}lockRowById(t,e){var n;const i={isLocked:!0,lockedBy:e==null?void 0:e.lockedBy,lockedAt:(e==null?void 0:e.lockedAt)??new Date,reason:e==null?void 0:e.reason,...e};this._externalLocks.set(t,i);const r=this.findRowById(t);return r&&this._editingCell&&this._editingCell.rowIndex===r.index&&this.cancelEdit(),this.requestUpdate(),(n=this._onrowlockchange)==null||n.call(this,{rowId:t,row:(r==null?void 0:r.row)??null,rowIndex:(r==null?void 0:r.index)??-1,lockInfo:i,source:"external"}),!0}unlockRowById(t){var i;const e=this._externalLocks.has(t);if(this._externalLocks.delete(t),e){this.requestUpdate();const r=this.findRowById(t);(i=this._onrowlockchange)==null||i.call(this,{rowId:t,row:(r==null?void 0:r.row)??null,rowIndex:(r==null?void 0:r.index)??-1,lockInfo:null,source:"external"})}return e}getExternalLocks(){return new Map(this._externalLocks)}clearExternalLocks(){this._externalLocks.clear(),this.requestUpdate()}updateRowById(t,e){const i=this.findRowById(t);if(!i)return!1;Object.assign(this._items[i.index],e);const r=this._draftRows.get(i.index);return r&&Object.assign(r,e),this.requestUpdate(),!0}replaceRowById(t,e){const i=this.findRowById(t);return i?(this._items[i.index]=e,this._draftRows.delete(i.index),this.requestUpdate(),!0):!1}canEditCell(t,e){var l;const i=this._columns.find(d=>String(d.field)===e);if(!i||!this.isCellEditable(i))return!1;const r=this.displayItems[t];if(!r)return!1;const n=this.getRowLockInfo(r);if(!(n!=null&&n.isLocked))return!0;const s=this._rowLocking;switch((s==null?void 0:s.lockedEditBehavior)??"block"){case"allow":return!0;case"callback":return((l=s==null?void 0:s.canEditLockedCallback)==null?void 0:l.call(s,r,n))??!1;case"block":default:return!1}}getColumnWidth(t){return this._columnWidths.get(t)}setColumnWidth(t,e){this._columnWidths.set(t,e),this.requestUpdate()}setColumnWidths(t){for(const{field:e,width:i}of t)e&&i&&this._columnWidths.set(e,i);this.requestUpdate()}getColumnWidthsState(){return this._columns.map(t=>{const e=String(t.field),i=this._columnWidths.get(e)||t.width||"";return{field:e,width:i}}).filter(t=>t.width)}loadPersistedWidths(){this.loadPersistedState()}savePersistedWidths(){this.savePersistedState()}loadPersistedState(){if(!(!this._gridName||typeof localStorage>"u"))try{const t=`wg-${this._gridName}-state`,e=localStorage.getItem(t);if(!e)return;const i=JSON.parse(e),r=new Set(this._columns.map(s=>String(s.field)));let n=!1;if(i.columnWidths){this._columnWidths.clear();for(const s of i.columnWidths)r.has(s.field)?this._columnWidths.set(s.field,s.width):n=!0}if(i.columnOrder){this._columnOrder.clear();for(const s of i.columnOrder)r.has(s.field)?this._columnOrder.set(s.field,s.order):n=!0}n&&this.savePersistedState()}catch(t){console.warn("WebGrid: Failed to load persisted state",t)}}savePersistedState(){if(!(!this._gridName||typeof localStorage>"u"))try{const t=`wg-${this._gridName}-state`,e={};this._persistColumnWidths&&(e.columnWidths=this.getColumnWidthsState()),this._persistColumnOrder&&(e.columnOrder=this.getColumnOrderState()),localStorage.setItem(t,JSON.stringify(e))}catch(t){console.warn("WebGrid: Failed to save persisted state",t)}}getColumnOrder(t){return this._columnOrder.get(t)}setColumnOrder(t){this._columnOrder.clear();for(const{field:e,order:i}of t)e!==void 0&&i!==void 0&&this._columnOrder.set(e,i);this.requestUpdate()}getColumnOrderState(){const t=this.visualColumns,e=this.totalFrozenColumns;return t.slice(e).map((i,r)=>({field:String(i.column.field),order:r}))}moveColumn(t,e){const i=this.visualColumns,r=this.totalFrozenColumns,n=i.slice(r),s=n.findIndex(d=>String(d.column.field)===t);if(s===-1||s===e)return;this._columnOrder.clear();const a=[...n],[l]=a.splice(s,1);a.splice(e,0,l),a.forEach((d,c)=>{this._columnOrder.set(String(d.column.field),c)}),this.requestUpdate()}}const Ho=':host{--wg-rem: 10px;font-family:var(--wg-font-family);display:block;--wg-accent-color: var(--base-accent-color, #0078d4);--wg-accent-color-hover: var(--base-accent-color-hover, #106ebe);--wg-accent-color-active: var(--base-accent-color-active, #005a9e);--wg-accent-color-light: var(--base-accent-color-light, #e6f2ff);--wg-text-color-1: var(--base-text-color-1, #242424);--wg-text-color-2: var(--base-text-color-2, #424242);--wg-text-color-3: var(--base-text-color-3, #707070);--wg-text-on-accent: var(--base-text-color-on-accent, #ffffff);--wg-surface-1: var(--base-main-bg, #ffffff);--wg-surface-2: var(--base-elevated-bg, #f5f5f5);--wg-surface-3: var(--base-hover-bg, #ebebeb);--wg-surface-floating: var(--base-dropdown-bg, var(--base-main-bg, #ffffff));--wg-border-color: var(--base-border-color, #e0e0e0);--wg-border-color-hover: var(--base-border-color, #d1d1d1);--wg-input-bg: var(--base-input-bg, #ffffff);--wg-input-color: var(--base-input-color, var(--wg-text-color-1));--wg-input-border: var(--base-input-border, 1px solid #d1d1d1);--wg-input-border-hover: var(--base-input-border-hover, 1px solid #0078d4);--wg-input-border-focus: var(--base-input-border-focus, 1px solid #0078d4);--wg-input-placeholder-color: var(--base-input-placeholder-color, #707070);--wg-danger-color: var(--base-danger-color, #d13438);--wg-danger-bg-light: var(--base-danger-bg-light, #fde7e9);--wg-hover-bg: var(--base-hover-bg, #f0f0f0);--wg-active-bg: var(--base-hover-bg, #e0e0e0);--wg-font-size-base: calc(var(--base-font-size-sm, 1.4) * var(--wg-rem));--wg-font-size-sm: calc(var(--base-font-size-xs, 1.2) * var(--wg-rem));--wg-font-size-xs: calc(var(--base-font-size-2xs, 1.1) * var(--wg-rem));--wg-font-size-lg: calc(var(--base-font-size-base, 1.6) * var(--wg-rem));--wg-font-family: var(--base-font-family, inherit);--wg-line-height-base: var(--base-line-height-normal, 1.5);--wg-font-weight-normal: var(--base-font-weight-normal, 400);--wg-font-weight-semibold: var(--base-font-weight-semibold, 600);--wg-font-family-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;--wg-border-radius-sm: calc(var(--base-border-radius-sm, .4) * var(--wg-rem));--wg-border-radius-md: calc(var(--base-border-radius-md, .6) * var(--wg-rem));--wg-border-radius-lg: calc(var(--base-border-radius-lg, .8) * var(--wg-rem));--wg-spacing-xs: calc(.4 * var(--wg-rem));--wg-spacing-sm: calc(.8 * var(--wg-rem));--wg-spacing-md: calc(1.2 * var(--wg-rem));--wg-spacing-lg: calc(1.6 * var(--wg-rem));--wg-spacing-xl: calc(2.4 * var(--wg-rem));--wg-table-bg: var(--wg-surface-1);--wg-table-border: 1px solid var(--wg-border-color);--wg-header-bg: var(--wg-surface-2);--wg-header-bg-hover: var(--wg-surface-3);--wg-header-bg-sorted: var(--wg-surface-3);--wg-header-color: var(--wg-text-color-1);--wg-header-border: 2px solid var(--wg-border-color);--wg-header-separator: 1px solid var(--wg-border-color);--wg-header-padding: var(--wg-spacing-sm) var(--wg-spacing-md);--wg-header-font-weight: var(--wg-font-weight-semibold);--wg-cell-padding: var(--wg-spacing-sm) var(--wg-spacing-md);--wg-cell-padding-block: var(--wg-spacing-sm);--wg-cell-padding-inline: var(--wg-spacing-md);--wg-cell-color: var(--wg-text-color-1);--wg-cell-border: 1px solid var(--wg-border-color);--wg-cell-bg-hover: var(--wg-hover-bg);--wg-cell-bg-editing: var(--wg-surface-1);--wg-cell-readonly-bg: var(--base-disabled-bg, var(--wg-surface-2));--wg-row-border: 1px solid var(--wg-border-color);--wg-row-bg-even: var(--wg-surface-2);--wg-row-bg-hover: var(--wg-surface-3);--wg-filter-bg: var(--wg-surface-1);--wg-filter-border: 1px solid var(--wg-border-color);--wg-filter-padding: var(--wg-spacing-xs) var(--wg-spacing-sm);--wg-filter-input-padding: calc(.4 * var(--wg-rem)) calc(.8 * var(--wg-rem));--wg-filter-input-bg: var(--wg-input-bg);--wg-filter-input-border: var(--wg-input-border);--wg-filter-input-border-focus: var(--wg-input-border-focus);--wg-filter-input-border-radius: var(--wg-border-radius-sm);--wg-filter-input-font-size: var(--wg-font-size-sm);--wg-sort-indicator-size: calc(1.4 * var(--wg-rem));--wg-sort-indicator-opacity: .9;--wg-sort-placeholder-opacity: .3;--wg-sort-priority-size: calc(1.1 * var(--wg-rem));--wg-pagination-padding: var(--wg-spacing-md);--wg-pagination-gap: calc(1.6 * var(--wg-rem));--wg-pagination-bg: var(--wg-surface-1);--wg-pagination-border: 1px solid var(--wg-border-color);--wg-pagination-btn-padding: calc(.6 * var(--wg-rem)) calc(1.6 * var(--wg-rem));--wg-pagination-btn-bg: var(--wg-surface-1);--wg-pagination-btn-bg-hover: var(--wg-surface-2);--wg-pagination-btn-bg-active: var(--wg-surface-3);--wg-pagination-btn-border: 1px solid var(--wg-border-color);--wg-pagination-btn-border-hover: 1px solid var(--wg-border-color-hover);--wg-pagination-btn-border-radius: var(--wg-border-radius-sm);--wg-pagination-btn-disabled-opacity: .4;--wg-empty-padding: var(--wg-spacing-xl);--wg-empty-color: var(--wg-text-color-3);--wg-error-cell-bg: var(--wg-danger-bg-light);--wg-error-cell-border: 1px solid var(--wg-danger-color);--wg-error-message-color: var(--wg-danger-color);--wg-error-message-font-size: var(--wg-font-size-xs);--wg-error-indicator-color: var(--wg-danger-color);--wg-editor-bg: var(--wg-surface-1);--wg-editor-outline: 2px solid var(--wg-accent-color);--wg-editor-outline-offset: -2px;--wg-editor-validating-opacity: .7;--wg-dropdown-toggle-right: var(--wg-spacing-md);--wg-dropdown-toggle-size: calc(1.2 * var(--wg-rem));--wg-dropdown-toggle-hitbox: calc(2.4 * var(--wg-rem));--wg-date-trigger-size: calc(2.8 * var(--wg-rem));--wg-toolbar-bg: var(--wg-surface-floating);--wg-toolbar-border: 1px solid var(--wg-border-color);--wg-toolbar-border-radius: var(--wg-border-radius-sm);--wg-toolbar-shadow: var(--base-dropdown-box-shadow, 0 2px 8px rgba(0, 0, 0, .15));--wg-toolbar-divider-color: var(--wg-border-color);--wg-toolbar-row-height: calc(3.7 * var(--wg-rem));--wg-toolbar-btn-min-width: calc(2.4 * var(--wg-rem));--wg-toolbar-btn-padding: 0 calc(.4 * var(--wg-rem));--wg-toolbar-btn-border-radius: var(--wg-border-radius-sm);--wg-toolbar-btn-bg-hover: var(--wg-hover-bg);--wg-toolbar-btn-bg-active: var(--wg-active-bg);--wg-toolbar-btn-color: var(--wg-text-color-1);--wg-toolbar-trigger-color: var(--wg-text-color-3);--wg-toolbar-trigger-color-hover: var(--wg-text-color-1);--wg-toolbar-trigger-bg-hover: var(--wg-hover-bg);--wg-tooltip-bg: var(--base-tooltip-bg, #333);--wg-tooltip-color: var(--base-tooltip-color, #fff);--wg-context-menu-z-index: 1001;--wg-context-menu-min-width: calc(16 * var(--wg-rem));--wg-focus-outline: 2px solid var(--wg-accent-color);--wg-focus-outline-offset: -2px;--wg-focus-bg: var(--wg-hover-bg);--wg-transition-fast: .1s ease;--wg-transition-normal: .15s ease;--wg-z-dropdown: 9999;--wg-z-toolbar: 1000;--wg-z-context-menu: 1001;--wg-z-tooltip: 10000;--wg-frozen-column-bg: var(--wg-surface-1);--wg-frozen-header-bg: var(--wg-header-bg);--wg-frozen-column-shadow: 2px 0 4px rgba(0, 0, 0, .1);--wg-frozen-column-shadow-active: 6px 0 12px rgba(0, 0, 0, .25);--wg-frozen-column-border: 2px solid var(--wg-border-color);--wg-resize-handle-width: 8px;--wg-resize-handle-offset: -4px;--wg-resize-handle-line-width: 2px;--wg-resize-handle-color: var(--wg-border-color);--wg-resize-handle-active-color: var(--wg-accent-color);--wg-fill-handle-size: 8px;--wg-fill-handle-bg: var(--wg-background);--wg-fill-handle-border-color: var(--wg-accent-color);--wg-fill-handle-border-width: 2px;--wg-fill-range-bg: color-mix(in srgb, var(--wg-accent-color) 15%, transparent);--wg-fill-range-border-color: var(--wg-accent-color);--wg-selection-bg: color-mix(in srgb, var(--wg-accent-color) 15%, transparent);--wg-selection-row-number-bg: var(--wg-accent-color);--wg-selection-row-number-color: var(--base-text-inverted, #fff)}web-grid:not(:defined){display:block;min-height:calc(10 * var(--wg-rem));color:transparent!important;background:transparent}.wg{position:relative;width:100%;max-height:inherit;overflow:auto;overscroll-behavior:contain;border:var(--wg-table-border)}.wg__table{width:max-content;min-width:max-content;border-collapse:collapse;table-layout:fixed;background:var(--wg-table-bg);font-size:var(--wg-font-size-base);line-height:var(--wg-line-height-base)}.wg__table tbody tr{border-bottom:var(--wg-row-border)}.wg__row-number-header,.wg__row-number{width:40px;min-width:40px;max-width:40px;box-sizing:border-box;text-align:center;color:var(--wg-text-color-2);background:var(--wg-header-bg);-webkit-user-select:none;user-select:none;font-size:var(--wg-font-size-sm)}.wg__row-number{box-shadow:inset -1px 0 0 var(--wg-border-color)}.wg__actions-column{width:32px;min-width:32px;max-width:32px;padding:0!important;text-align:center}thead .wg__actions-column{background:var(--wg-header-bg);border-bottom:var(--wg-header-border)}.wg__filter-row .wg__actions-column{background:var(--wg-filter-bg);border-bottom:var(--wg-filter-border)}.wg__header{position:sticky;top:0;z-index:1;background:var(--wg-header-bg);color:var(--wg-header-color);font-weight:var(--wg-header-font-weight);padding:var(--wg-header-padding);border-bottom:var(--wg-header-border);border-right:var(--wg-header-separator);box-sizing:border-box;text-align:left;-webkit-user-select:none;user-select:none}.wg__header:last-child{border-right:none}.wg__header--sortable{cursor:pointer}.wg__header--sortable:hover{background:var(--wg-header-bg-hover)}.wg__header--sorted{background:var(--wg-header-bg-sorted)}.wg__header-content{display:flex;align-items:center;gap:4px;justify-content:space-between}.wg__header-title{flex:1}.wg__sort-indicator{font-size:var(--wg-sort-indicator-size);opacity:var(--wg-sort-indicator-opacity);min-width:16px;text-align:center;display:inline-flex;align-items:center}.wg__sort-placeholder{opacity:var(--wg-sort-placeholder-opacity)}.wg__sort-priority{font-size:var(--wg-sort-priority-size);font-weight:600;margin-left:2px;vertical-align:super;line-height:1}.wg__header-info{display:inline-flex;align-items:center;color:var(--wg-accent-color);cursor:help;opacity:.7;margin-left:4px;vertical-align:middle}.wg__header-info:hover{opacity:1}.wg__filter-row th{padding:var(--wg-filter-padding);background:var(--wg-filter-bg);border-bottom:var(--wg-filter-border)}.wg__filter-input{width:100%;padding:var(--wg-filter-input-padding);border:var(--wg-filter-input-border);border-radius:var(--wg-filter-input-border-radius);background:var(--wg-surface-1);color:var(--wg-text-color-1);font-family:inherit;font-size:var(--wg-filter-input-font-size);box-sizing:border-box}.wg__filter-input:focus{outline:none;border:var(--wg-filter-input-border-focus);box-shadow:0 0 0 1px var(--wg-accent-color)}.wg__header{position:relative}.wg__resize-handle{position:absolute;top:0;right:var(--wg-resize-handle-offset);bottom:0;width:var(--wg-resize-handle-width);cursor:col-resize;z-index:2;opacity:0;transition:opacity .1s ease}.wg__header:hover .wg__resize-handle{opacity:1}.wg__resize-handle:after{content:"";position:absolute;top:25%;bottom:25%;left:50%;width:var(--wg-resize-handle-line-width);background:var(--wg-resize-handle-color);transform:translate(-50%);border-radius:1px}.wg__resize-handle:hover:after{background:var(--wg-resize-handle-active-color);top:15%;bottom:15%}.wg__resize-handle--active:after{background:var(--wg-resize-handle-active-color);top:0;bottom:0}.wg--resizing .wg__resize-handle{opacity:1}.wg--resizing{-webkit-user-select:none;user-select:none;cursor:col-resize}.wg--resizing .wg__cell,.wg--resizing .wg__header{cursor:col-resize}.wg--resizing .wg__table{min-width:0!important}.wg__header--dragging{opacity:.5}.wg__reorder-ghost{position:absolute;z-index:1000;background:var(--wg-header-bg);border:2px solid var(--wg-accent-color);border-radius:var(--wg-border-radius-sm);padding:.4em .8em;font-size:var(--wg-font-size-sm);font-weight:var(--wg-header-font-weight);color:var(--wg-header-color);box-shadow:0 4px 12px #00000026;opacity:.95;pointer-events:none;white-space:nowrap}.wg__drop-indicator{position:absolute;top:0;bottom:0;width:3px;background:var(--wg-accent-color);z-index:999;pointer-events:none;display:none}.wg__drop-indicator:before{content:"";position:absolute;top:0;left:50%;transform:translate(-50%);border-left:6px solid transparent;border-right:6px solid transparent;border-top:8px solid var(--wg-accent-color)}.wg--reordering{cursor:grabbing;-webkit-user-select:none;user-select:none}.wg--reordering .wg__cell,.wg--reordering .wg__header{cursor:grabbing}.wg--reorderable .wg__header:not(.wg__header--frozen):hover{cursor:grab}.wg__header--frozen{cursor:default}.wg__fill-handle{position:absolute;width:var(--wg-fill-handle-size);height:var(--wg-fill-handle-size);background:var(--wg-fill-handle-bg);border:var(--wg-fill-handle-border-width) solid var(--wg-fill-handle-border-color);cursor:crosshair;z-index:10;pointer-events:auto;box-sizing:border-box}.wg__fill-handle:hover{transform:scale(1.2)}.wg__fill-range{position:absolute;background:var(--wg-fill-range-bg);border:1px dashed var(--wg-fill-range-border-color);pointer-events:none;z-index:5;box-sizing:border-box}.wg--filling{cursor:crosshair;-webkit-user-select:none;user-select:none}.wg--filling .wg__cell,.wg--filling .wg__header{cursor:crosshair}.wg__cell--editing .wg__fill-handle{display:none}.wg__row--selected>.wg__cell{background:var(--wg-selection-bg)}.wg__row--selected>.wg__row-number{background:var(--wg-selection-row-number-bg);color:var(--wg-selection-row-number-color)}.wg__row-number[data-row-number]{cursor:pointer;-webkit-user-select:none;user-select:none}.wg__row-number[data-row-number]:hover{background:var(--wg-hover-bg)}.wg__row--selected>.wg__row-number:hover{background:var(--wg-selection-row-number-bg)}.wg--selecting{cursor:default;-webkit-user-select:none;user-select:none}.wg--selecting *{-webkit-user-select:none;user-select:none}.wg:focus{outline:none}.wg__header--frozen{background:var(--wg-frozen-header-bg, var(--wg-header-bg));box-shadow:var(--wg-frozen-column-shadow, 2px 0 4px rgba(0, 0, 0, .1))}.wg__row-number-header.wg__header--frozen{z-index:4!important}.wg__cell--frozen{background:var(--wg-frozen-column-bg, var(--wg-surface-1));box-shadow:var(--wg-frozen-column-shadow, 2px 0 4px rgba(0, 0, 0, .1))}.wg__row-number.wg__cell--frozen{background:var(--wg-header-bg);z-index:2!important;box-shadow:inset -1px 0 0 var(--wg-border-color),var(--wg-frozen-column-shadow, 2px 0 4px rgba(0, 0, 0, .1))}.wg--striped tbody tr:nth-child(2n) .wg__cell--frozen{background:var(--wg-row-bg-even)}.wg--hoverable tbody tr:hover .wg__cell--frozen{background:var(--wg-row-bg-hover)}.wg__row--focused .wg__cell--frozen{background:var(--wg-focus-bg)}.wg__header.wg__header--frozen-last,.wg__cell.wg__cell--frozen-last{overflow:visible}.wg--scrolled-horizontal .wg__header--frozen-last:after,.wg--scrolled-horizontal .wg__cell--frozen-last:after{content:"";position:absolute;top:0;right:-8px;bottom:0;width:8px;background:linear-gradient(to right,rgba(0,0,0,.15),transparent);pointer-events:none}.wg__cell{padding:var(--wg-cell-padding);color:var(--wg-cell-color);box-sizing:border-box;scroll-margin-top:3rem;scroll-margin-bottom:.5rem;-webkit-user-select:none;user-select:none;overflow:hidden}.wg__cell-text{-webkit-user-select:none;user-select:none}.wg__cell--ellipsis{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.wg__cell--editable{cursor:pointer;position:relative}.wg__cell--editable:hover{background:var(--wg-cell-bg-hover)}.wg__cell--editable:hover:after{content:"";position:absolute;top:2px;right:2px;bottom:2px;left:2px;border:1px dashed var(--wg-border-color);border-radius:2px;pointer-events:none}.wg__cell--editing{position:relative;background:var(--wg-surface-1);outline:2px solid var(--wg-accent-color);outline-offset:-2px}.wg__cell--editing:after{display:none}.wg__cell--invalid{background:var(--wg-danger-bg-light, #fee);box-shadow:inset 0 0 0 2px var(--wg-danger-color, #c00)}.wg--navigate-mode .wg__cell:not(.wg__cell--editable){background:var(--wg-cell-readonly-bg, #f5f5f5)}:host{--wg-row-locked-bg: var(--base-disabled-bg, #f5f5f5);--wg-row-locked-opacity: .7}.wg__row--locked{background:var(--wg-row-locked-bg)!important}.wg__row--locked .wg__cell{opacity:var(--wg-row-locked-opacity)}.wg__row--locked .wg__cell--editable{cursor:not-allowed}.wg__row--locked .wg__cell--editable:hover{background:inherit}.wg__row--locked .wg__cell--editable:hover:after{display:none}.wg__row-number--locked{opacity:1!important;cursor:help}.wg__editor{position:absolute;top:0;left:0;right:0;width:100%;padding:var(--wg-cell-padding);border:none;background:transparent;color:var(--wg-text-color-1);font-size:var(--wg-font-size-base);font-family:inherit;line-height:inherit;box-sizing:border-box}.wg__editor:focus,.wg__editor:focus-visible{outline:none;box-shadow:none}.wg__editor--text{text-align:inherit}.wg__editor--number{text-align:right}.wg__editor--date{position:absolute;top:0;right:0;bottom:0;left:0;display:flex;align-items:center;background:var(--wg-editor-bg);padding:var(--wg-cell-padding)}.wg__date-input{flex:1;min-width:0;height:100%;border:none;background:transparent;font:inherit;padding:0;outline:none;color:inherit}.wg__date-trigger{width:var(--wg-date-trigger-size, 28px);height:100%;display:flex;align-items:center;justify-content:center;border:none;background:transparent;color:var(--wg-text-color-3);cursor:pointer;padding:0;flex-shrink:0}.wg__date-trigger:hover{color:var(--wg-accent-color, #0078d4);background:var(--wg-hover-bg, rgba(0, 0, 0, .05))}.wg__editor--checkbox{width:auto;height:auto;margin:0 auto}.wg__editor--custom{position:absolute;top:0;right:0;bottom:0;left:0;display:flex;align-items:center;background:var(--wg-editor-bg);padding:var(--wg-cell-padding-block) var(--wg-cell-padding-inline);cursor:pointer}.wg__editor--custom:focus{outline:none}.wg__custom-value{flex:1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;display:block;cursor:pointer}.wg__editor--combobox,.wg__editor--autocomplete{position:absolute;top:0;right:0;bottom:0;left:0;display:flex;align-items:center;padding:var(--wg-cell-padding);padding-right:0;background:transparent;box-sizing:border-box}.wg__combobox-input,.wg__autocomplete-input{flex:1;width:100%;height:100%;padding:0 24px 0 0;border:none;background:transparent;color:var(--wg-text-color-1);font-size:var(--wg-font-size-base);font-family:inherit;line-height:var(--wg-line-height-base);outline:none;box-sizing:border-box;margin:0;-webkit-appearance:none;-moz-appearance:none;appearance:none}.wg__combobox-input:focus,.wg__autocomplete-input:focus{outline:none}.wg__combobox-toggle{position:absolute;right:var(--wg-dropdown-toggle-right);top:50%;transform:translateY(-50%);font-size:var(--wg-dropdown-toggle-size);color:var(--wg-text-color-2);pointer-events:auto;cursor:pointer}.wg__combobox-toggle:before{content:"";position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);width:var(--wg-dropdown-toggle-hitbox);height:48px}.wg__loading-indicator{position:absolute;right:var(--wg-dropdown-toggle-right);top:50%;transform:translateY(-50%);font-size:12px;animation:wg-pulse 1s infinite}@keyframes wg-pulse{0%,to{opacity:1}50%{opacity:.4}}.wg__select-trigger{display:flex;align-items:center;justify-content:space-between;cursor:pointer;background:transparent}.wg__select-trigger:focus,.wg__select-trigger:focus-visible{outline:none;box-shadow:none}.wg__select-value{flex:1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.wg__select-toggle{position:relative;font-size:var(--wg-dropdown-toggle-size);opacity:.6;margin-left:4px;flex-shrink:0;pointer-events:auto;cursor:pointer}.wg__select-toggle:before{content:"";position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);width:var(--wg-dropdown-toggle-hitbox);height:48px}.wg__cell-dropdown-display{display:flex;align-items:center;justify-content:space-between;width:100%;cursor:pointer}.wg__cell-dropdown-display--toggle-on-focus .wg__select-toggle{opacity:0}.wg__cell:hover .wg__cell-dropdown-display--toggle-on-focus .wg__select-toggle,.wg__cell--focused .wg__cell-dropdown-display--toggle-on-focus .wg__select-toggle{opacity:.6}.wg__cell-date-display{display:flex;align-items:center;justify-content:space-between;width:100%;cursor:pointer}.wg__cell-date-display .wg__date-trigger{position:relative;background:none;border:none;padding:0;margin:0;cursor:pointer;opacity:.6;display:flex;align-items:center;justify-content:center;color:inherit}.wg__cell-date-display .wg__date-trigger:before{content:"";position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);width:var(--wg-dropdown-toggle-hitbox);height:48px}.wg__cell-date-display--toggle-on-focus .wg__date-trigger{opacity:0}.wg__cell:hover .wg__cell-date-display--toggle-on-focus .wg__date-trigger,.wg__cell--focused .wg__cell-date-display--toggle-on-focus .wg__date-trigger{opacity:.6}.wg__dropdown{background:var(--wg-surface-floating, #fff);border:1px solid var(--wg-border-color, #d1d1d1);border-radius:4px;box-shadow:var(--wg-toolbar-shadow);max-height:200px;overflow-y:auto;font-size:var(--wg-font-size-base);font-family:inherit;line-height:var(--wg-line-height-base)}.wg__dropdown-option{display:flex;align-items:center;gap:var(--wg-spacing-sm);padding:6px 12px;cursor:pointer;color:var(--wg-text-color-1)}.wg__dropdown-option:hover,.wg__dropdown-option--highlighted{background:var(--wg-hover-bg, #f0f0f0)}.wg__dropdown-option--selected{background:var(--wg-accent-color-light, #e6f2ff)}.wg__dropdown-option--disabled{opacity:.5;cursor:not-allowed;pointer-events:none}.wg__dropdown-option-icon{flex-shrink:0;width:1.5em;text-align:center}.wg__dropdown-option-content{flex:1;min-width:0;overflow:hidden}.wg__dropdown-option-label{display:block;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.wg__dropdown-option-subtitle{display:block;font-size:var(--wg-font-size-sm);color:var(--wg-text-color-2);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.wg__dropdown-empty{padding:8px 12px;color:var(--wg-text-color-2);font-style:italic;text-align:center}.wg--navigate-mode .wg__cell{cursor:cell}.wg--navigate-mode .wg__cell:focus{outline:none}.wg--navigate-mode .wg__cell.wg__cell--focused{outline:var(--wg-focus-outline);outline-offset:-2px}.wg__cell--focused:after{display:none}.wg__pagination{display:flex;align-items:center;justify-content:center;gap:var(--wg-pagination-gap);padding:var(--wg-pagination-padding);border-top:var(--wg-pagination-border);background:var(--wg-pagination-bg)}.wg__pagination-btn{padding:var(--wg-pagination-btn-padding);background:var(--wg-pagination-btn-bg);border:var(--wg-pagination-btn-border);border-radius:var(--wg-pagination-btn-border-radius);color:var(--wg-cell-color);font-family:inherit;font-size:var(--wg-font-size-base);cursor:pointer;transition:all var(--wg-transition-fast)}.wg__pagination-btn:hover:not(:disabled){background:var(--wg-pagination-btn-bg-hover);border:var(--wg-pagination-btn-border-hover)}.wg__pagination-btn:active:not(:disabled){background:var(--wg-pagination-btn-bg-active)}.wg__pagination-btn:disabled{opacity:var(--wg-pagination-btn-disabled-opacity);cursor:not-allowed}.wg__pagination-info{font-size:var(--wg-font-size-base);color:var(--wg-cell-color)}.wg__pagination-count{font-size:var(--wg-font-size-sm);color:var(--wg-text-color-3);margin-left:4px}.wg__pagination-pagesize{display:flex;align-items:center;gap:6px}.wg__pagination-select{padding:4px 8px;background:var(--wg-pagination-btn-bg);border:var(--wg-pagination-btn-border);border-radius:var(--wg-pagination-btn-border-radius);color:var(--wg-cell-color);font-family:inherit;font-size:var(--wg-font-size-base);cursor:pointer}.wg__pagination-select:hover{background:var(--wg-pagination-btn-bg-hover);border:var(--wg-pagination-btn-border-hover)}.wg__pagination-select:focus{outline:2px solid var(--wg-accent-color);outline-offset:-2px}.wg__pagination-label{font-size:var(--wg-font-size-sm);color:var(--wg-text-color-3)}.wg__pagination--left{justify-content:flex-start}.wg__pagination--right{justify-content:flex-end}.wg__pagination--top{border-top:none;border-bottom:var(--wg-pagination-border)}.wg__summary{display:flex;align-items:center;padding:var(--wg-pagination-padding);border-top:var(--wg-pagination-border);background:var(--wg-pagination-bg);font-size:var(--wg-font-size-base);color:var(--wg-cell-color)}.wg__summary--left{justify-content:flex-start}.wg__summary--right{justify-content:flex-end}.wg__summary--top{border-top:none;border-bottom:var(--wg-pagination-border)}.wg__footer{display:flex;align-items:center;justify-content:space-between;border-top:var(--wg-pagination-border);background:var(--wg-pagination-bg)}.wg__footer--top{border-top:none;border-bottom:var(--wg-pagination-border)}.wg__footer .wg__summary,.wg__footer .wg__pagination{border:none}.wg__footer .wg__summary{flex:0 0 auto}.wg__footer .wg__pagination{flex:0 0 auto;margin-left:auto}.wg__toolbar-container{position:fixed;z-index:var(--wg-z-toolbar, 1000)}.wg__toolbar{display:flex;flex-direction:column-reverse;gap:0;padding:0;background:var(--wg-toolbar-bg);border:var(--wg-toolbar-border);border-radius:var(--wg-toolbar-border-radius);box-shadow:var(--wg-toolbar-shadow)}.wg__toolbar-row{display:flex;gap:2px;align-items:center;height:var(--wg-toolbar-row-height);padding:0 4px}.wg__toolbar-row+.wg__toolbar-row{border-top:1px solid var(--wg-toolbar-divider-color)}.wg__toolbar-divider{width:1px;height:16px;background:var(--wg-toolbar-divider-color);margin:0 4px;flex-shrink:0}.wg__toolbar-btn{min-width:var(--wg-toolbar-btn-min-width);height:100%;border:none;border-radius:var(--wg-toolbar-btn-border-radius);background:transparent;color:var(--wg-toolbar-btn-color);cursor:pointer;display:flex;align-items:center;justify-content:center;gap:4px;font-family:inherit;font-size:var(--wg-font-size-base);font-weight:500;padding:var(--wg-toolbar-btn-padding);transition:background .1s ease}.wg__toolbar-btn:hover{background:var(--wg-toolbar-btn-bg-hover)}.wg__toolbar-btn:active{background:var(--wg-toolbar-btn-bg-active)}.wg__toolbar-btn:disabled{opacity:.5;cursor:not-allowed}.wg__toolbar-btn:disabled:hover{background:transparent}.wg__toolbar-btn--danger:hover{background:var(--wg-danger-bg-light);color:var(--wg-danger-color)}.wg__toolbar-label{font-size:12px;white-space:nowrap}.wg__actions-column{width:24px;min-width:24px;max-width:24px;padding:0!important;text-align:center}.wg__header .wg__actions-column{background:var(--wg-header-bg)}.wg__filter-row .wg__actions-column{background:var(--wg-filter-bg)}.wg__toolbar-trigger{position:relative;padding:0;background:transparent;border:none;border-radius:var(--wg-border-radius-sm);cursor:pointer;font-size:var(--wg-font-size-base);line-height:1;color:var(--wg-toolbar-trigger-color)}.wg__toolbar-trigger:before{content:"";position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);width:var(--wg-dropdown-toggle-hitbox);height:48px}.wg__toolbar-trigger:hover,.wg__toolbar-trigger--active{color:var(--wg-toolbar-trigger-color-hover);background:var(--wg-toolbar-trigger-bg-hover)}.wg__inline-actions-header,.wg__inline-actions-cell{width:1%;white-space:nowrap;text-align:center;padding:var(--wg-spacing-xs) var(--wg-spacing-sm)}.wg__inline-actions-header{background:var(--wg-header-bg)}.wg__inline-actions-wrap{display:flex;flex-direction:column;gap:2px;align-items:center}.wg__inline-actions-row{display:flex;gap:2px;align-items:center;justify-content:center}.wg__inline-action-btn{min-width:var(--wg-toolbar-btn-min-width);height:calc(2.4 * var(--wg-rem));border:none;border-radius:var(--wg-toolbar-btn-border-radius);background:transparent;color:var(--wg-toolbar-btn-color);cursor:pointer;display:flex;align-items:center;justify-content:center;padding:0 var(--wg-spacing-xs);font-family:inherit;font-size:var(--wg-font-size-base);transition:background var(--wg-transition-fast)}.wg__inline-action-btn:hover{background:var(--wg-toolbar-btn-bg-hover)}.wg__inline-action-btn:active{background:var(--wg-toolbar-btn-bg-active)}.wg__inline-action-btn:disabled,.wg__inline-action-btn--disabled{opacity:.5;cursor:not-allowed}.wg__inline-action-btn:disabled:hover,.wg__inline-action-btn--disabled:hover{background:transparent}.wg__inline-action-btn--danger:hover{background:var(--wg-danger-bg-light);color:var(--wg-danger-color)}.wg__shortcuts-help{position:absolute;top:var(--wg-spacing-xs);right:var(--wg-spacing-sm);z-index:5}.wg__shortcuts-help--left{right:auto;left:var(--wg-spacing-sm)}.wg__shortcuts-help-icon{display:flex;align-items:center;justify-content:center;width:24px;height:24px;padding:0;border:none;border-radius:50%;background:var(--wg-surface-1);color:var(--wg-text-color-2);cursor:pointer;opacity:.7}.wg__shortcuts-help-icon:hover{opacity:1;background:var(--wg-surface-2)}.wg__shortcuts-help-icon svg{width:16px;height:16px}.wg__shortcuts-help-overlay{display:none;position:absolute;top:100%;right:0;margin-top:var(--wg-spacing-xs);padding:var(--wg-spacing-md);background:var(--wg-surface-1);border:1px solid var(--wg-border-color);border-radius:var(--wg-border-radius-md);box-shadow:0 4px 16px #00000026;min-width:200px;max-width:300px;z-index:100}.wg__shortcuts-help--left .wg__shortcuts-help-overlay{right:auto;left:0}.wg__shortcuts-help:hover .wg__shortcuts-help-overlay,.wg__shortcuts-help:focus-within .wg__shortcuts-help-overlay{display:block}.wg__shortcuts-help-title{font-weight:var(--wg-font-weight-semibold);font-size:var(--wg-font-size-base);color:var(--wg-text-color-1);margin-bottom:var(--wg-spacing-sm);padding-bottom:var(--wg-spacing-xs);border-bottom:1px solid var(--wg-border-color)}.wg__shortcuts-help-custom{margin-bottom:var(--wg-spacing-sm);padding-bottom:var(--wg-spacing-sm);border-bottom:1px solid var(--wg-border-color);font-size:var(--wg-font-size-sm);color:var(--wg-text-color-2)}.wg__shortcuts-help-list{display:flex;flex-direction:column;gap:var(--wg-spacing-xs)}.wg__shortcuts-help-item{display:flex;align-items:center;gap:var(--wg-spacing-md)}.wg__shortcuts-help-key{display:inline-flex;align-items:center;justify-content:center;min-width:28px;padding:2px 6px;font-family:var(--wg-font-family-mono);font-size:var(--wg-font-size-xs);font-weight:var(--wg-font-weight-semibold);color:var(--wg-text-color-1);background:var(--wg-surface-2);border:1px solid var(--wg-border-color);border-radius:var(--wg-border-radius-sm)}.wg__shortcuts-help-label{flex:1;font-size:var(--wg-font-size-sm);color:var(--wg-text-color-2)}.wg--striped tbody tr:nth-child(2n){background:var(--wg-row-bg-even)}.wg--hoverable tbody tr:hover{background:var(--wg-row-bg-hover)}.wg__empty{text-align:center;padding:var(--wg-empty-padding);color:var(--wg-empty-color);font-style:italic}.wg__loading-more{text-align:center;padding:var(--wg-cell-padding);color:var(--wg-text-color-2);font-size:var(--wg-font-size-sm)}.wg__tooltip{position:fixed;z-index:var(--wg-z-tooltip);max-width:300px;padding:6px 10px;background:var(--wg-tooltip-bg, #333);color:var(--wg-tooltip-color, #fff);font-size:var(--wg-font-size-sm);line-height:1.4;border-radius:var(--wg-border-radius-sm);box-shadow:0 2px 8px #0003;pointer-events:none;opacity:0;transition:opacity var(--wg-transition-fast)}.wg__tooltip--visible{opacity:1}.wg__tooltip-arrow{position:absolute;width:8px;height:8px;background:var(--wg-tooltip-bg, #333);transform:rotate(45deg)}.wg__tooltip[data-placement^=top] .wg__tooltip-arrow{bottom:-4px}.wg__tooltip[data-placement^=bottom] .wg__tooltip-arrow{top:-4px}.wg__tooltip[data-placement^=left] .wg__tooltip-arrow{right:-4px}.wg__tooltip[data-placement^=right] .wg__tooltip-arrow{left:-4px}.wg__tooltip-title{font-weight:600}.wg__tooltip-desc{opacity:.85;margin-top:2px}.wg__tooltip-shortcut{margin-top:4px;opacity:.7;font-size:.9em}.wg__goto-overlay{position:fixed;top:0;right:0;bottom:0;left:0;background:#0006;display:flex;align-items:center;justify-content:center;z-index:1000}.wg__goto-dialog{background:var(--wg-surface-1);border-radius:var(--wg-border-radius-md);padding:var(--wg-spacing-lg);box-shadow:0 4px 20px #00000026;min-width:250px}.wg__goto-label{display:block;margin-bottom:var(--wg-spacing-sm);font-size:var(--wg-font-size-base);color:var(--wg-text-color-1)}.wg__goto-input{width:100%;padding:var(--wg-spacing-sm) var(--wg-spacing-md);border:1px solid var(--wg-border-color);border-radius:var(--wg-border-radius-sm);font-family:inherit;font-size:var(--wg-font-size-base);margin-bottom:var(--wg-spacing-md);box-sizing:border-box}.wg__goto-input:focus{outline:none;border-color:var(--wg-accent-color);box-shadow:0 0 0 2px #0078d433}.wg__goto-buttons{display:flex;gap:var(--wg-spacing-sm);justify-content:flex-end}.wg__goto-btn{padding:var(--wg-spacing-sm) var(--wg-spacing-md);border:1px solid var(--wg-border-color);border-radius:var(--wg-border-radius-sm);font-family:inherit;font-size:var(--wg-font-size-sm);cursor:pointer;background:var(--wg-surface-1);color:var(--wg-text-color-1)}.wg__goto-btn:hover{background:var(--wg-surface-2)}.wg__goto-btn--go{background:var(--wg-accent-color);border-color:var(--wg-accent-color);color:#fff}.wg__goto-btn--go:hover{background:var(--wg-accent-color-hover, #106ebe)}.wg__spacer-top td,.wg__spacer-bottom td{padding:0;border:none;background:transparent;height:inherit;line-height:0}@media (prefers-color-scheme: dark){:host{--wg-surface-1: #1f1f1f;--wg-surface-2: #2b2b2b;--wg-surface-3: #333333;--wg-surface-floating: #2b2b2b;--wg-text-color-1: #e0e0e0;--wg-text-color-2: #c0c0c0;--wg-text-color-3: #a0a0a0;--wg-border-color: #3d3d3d;--wg-border-color-hover: #5a5a5a;--wg-input-bg: #1f1f1f;--wg-input-border: 1px solid #5a5a5a;--wg-hover-bg: #3a3a3a;--wg-active-bg: #4a4a4a;--wg-danger-bg-light: #442726;--wg-danger-color: #f87c86}}:host([data-theme="dark"]),[data-theme=dark] :host,:host([data-bs-theme="dark"]),[data-bs-theme=dark] :host,.dark :host{--wg-surface-1: #1f1f1f;--wg-surface-2: #2b2b2b;--wg-surface-3: #333333;--wg-surface-floating: #2b2b2b;--wg-text-color-1: #e0e0e0;--wg-text-color-2: #c0c0c0;--wg-text-color-3: #a0a0a0;--wg-border-color: #3d3d3d;--wg-border-color-hover: #5a5a5a;--wg-input-bg: #1f1f1f;--wg-input-border: 1px solid #5a5a5a;--wg-hover-bg: #3a3a3a;--wg-active-bg: #4a4a4a;--wg-danger-bg-light: #442726;--wg-danger-color: #f87c86}';function oe(o,t,e){const i=e.valueMember||"value",r=e.displayMember||"label",n=t.find(s=>s[i]===o);return n?String(n[r]??""):o!=null?String(o):""}function Ot(o,t){if(t.getDisplayCallback)return t.getDisplayCallback(o);const e=t.displayMember||"label";return String(o[e]??o.label??"")}function Ct(o,t){if(t.getValueCallback)return t.getValueCallback(o);const e=t.valueMember||"value";return o[e]??o.value}function Fo(o,t){return t.getIconCallback?t.getIconCallback(o):t.iconMember&&o[t.iconMember]||null}function qo(o,t){return t.getSubtitleCallback?t.getSubtitleCallback(o):t.subtitleMember&&o[t.subtitleMember]||null}function At(o,t){return t.getDisabledCallback?t.getDisabledCallback(o):t.disabledMember?!!o[t.disabledMember]:!1}const wt=Math.min,K=Math.max,Bt=Math.round,Ut=Math.floor,lt=o=>({x:o,y:o}),Vo={left:"right",right:"left",bottom:"top",top:"bottom"},No={start:"end",end:"start"};function ie(o,t,e){return K(o,wt(t,e))}function Rt(o,t){return typeof o=="function"?o(t):o}function pt(o){return o.split("-")[0]}function Et(o){return o.split("-")[1]}function Fe(o){return o==="x"?"y":"x"}function re(o){return o==="y"?"height":"width"}const Yo=new Set(["top","bottom"]);function ct(o){return Yo.has(pt(o))?"y":"x"}function ne(o){return Fe(ct(o))}function Wo(o,t,e){e===void 0&&(e=!1);const i=Et(o),r=ne(o),n=re(r);let s=r==="x"?i===(e?"end":"start")?"right":"left":i==="start"?"bottom":"top";return t.reference[n]>t.floating[n]&&(s=jt(s)),[s,jt(s)]}function Bo(o){const t=jt(o);return[se(o),t,se(t)]}function se(o){return o.replace(/start|end/g,t=>No[t])}const qe=["left","right"],Ve=["right","left"],Uo=["top","bottom"],jo=["bottom","top"];function Ko(o,t,e){switch(o){case"top":case"bottom":return e?t?Ve:qe:t?qe:Ve;case"left":case"right":return t?Uo:jo;default:return[]}}function Xo(o,t,e,i){const r=Et(o);let n=Ko(pt(o),e==="start",i);return r&&(n=n.map(s=>s+"-"+r),t&&(n=n.concat(n.map(se)))),n}function jt(o){return o.replace(/left|right|bottom|top/g,t=>Vo[t])}function Go(o){return{top:0,right:0,bottom:0,left:0,...o}}function Ne(o){return typeof o!="number"?Go(o):{top:o,right:o,bottom:o,left:o}}function Kt(o){const{x:t,y:e,width:i,height:r}=o;return{width:i,height:r,top:e,left:t,right:t+i,bottom:e+r,x:t,y:e}}function Ye(o,t,e){let{reference:i,floating:r}=o;const n=ct(t),s=ne(t),a=re(s),l=pt(t),d=n==="y",c=i.x+i.width/2-r.width/2,u=i.y+i.height/2-r.height/2,g=i[a]/2-r[a]/2;let h;switch(l){case"top":h={x:c,y:i.y-r.height};break;case"bottom":h={x:c,y:i.y+i.height};break;case"right":h={x:i.x+i.width,y:u};break;case"left":h={x:i.x-r.width,y:u};break;default:h={x:i.x,y:i.y}}switch(Et(t)){case"start":h[s]-=g*(e&&d?-1:1);break;case"end":h[s]+=g*(e&&d?-1:1);break}return h}const Qo=async(o,t,e)=>{const{placement:i="bottom",strategy:r="absolute",middleware:n=[],platform:s}=e,a=n.filter(Boolean),l=await(s.isRTL==null?void 0:s.isRTL(t));let d=await s.getElementRects({reference:o,floating:t,strategy:r}),{x:c,y:u}=Ye(d,i,l),g=i,h={},f=0;for(let m=0;m<a.length;m++){const{name:v,fn:p}=a[m],{x:C,y:_,data:S,reset:b}=await p({x:c,y:u,initialPlacement:i,placement:g,strategy:r,middlewareData:h,rects:d,platform:s,elements:{reference:o,floating:t}});c=C??c,u=_??u,h={...h,[v]:{...h[v],...S}},b&&f<=50&&(f++,typeof b=="object"&&(b.placement&&(g=b.placement),b.rects&&(d=b.rects===!0?await s.getElementRects({reference:o,floating:t,strategy:r}):b.rects),{x:c,y:u}=Ye(d,g,l)),m=-1)}return{x:c,y:u,placement:g,strategy:r,middlewareData:h}};async function le(o,t){var e;t===void 0&&(t={});const{x:i,y:r,platform:n,rects:s,elements:a,strategy:l}=o,{boundary:d="clippingAncestors",rootBoundary:c="viewport",elementContext:u="floating",altBoundary:g=!1,padding:h=0}=Rt(t,o),f=Ne(h),v=a[g?u==="floating"?"reference":"floating":u],p=Kt(await n.getClippingRect({element:(e=await(n.isElement==null?void 0:n.isElement(v)))==null||e?v:v.contextElement||await(n.getDocumentElement==null?void 0:n.getDocumentElement(a.floating)),boundary:d,rootBoundary:c,strategy:l})),C=u==="floating"?{x:i,y:r,width:s.floating.width,height:s.floating.height}:s.reference,_=await(n.getOffsetParent==null?void 0:n.getOffsetParent(a.floating)),S=await(n.isElement==null?void 0:n.isElement(_))?await(n.getScale==null?void 0:n.getScale(_))||{x:1,y:1}:{x:1,y:1},b=Kt(n.convertOffsetParentRelativeRectToViewportRelativeRect?await n.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:C,offsetParent:_,strategy:l}):C);return{top:(p.top-b.top+f.top)/S.y,bottom:(b.bottom-p.bottom+f.bottom)/S.y,left:(p.left-b.left+f.left)/S.x,right:(b.right-p.right+f.right)/S.x}}const Jo=o=>({name:"arrow",options:o,async fn(t){const{x:e,y:i,placement:r,rects:n,platform:s,elements:a,middlewareData:l}=t,{element:d,padding:c=0}=Rt(o,t)||{};if(d==null)return{};const u=Ne(c),g={x:e,y:i},h=ne(r),f=re(h),m=await s.getDimensions(d),v=h==="y",p=v?"top":"left",C=v?"bottom":"right",_=v?"clientHeight":"clientWidth",S=n.reference[f]+n.reference[h]-g[h]-n.floating[f],b=g[h]-n.reference[h],y=await(s.getOffsetParent==null?void 0:s.getOffsetParent(d));let k=y?y[_]:0;(!k||!await(s.isElement==null?void 0:s.isElement(y)))&&(k=a.floating[_]||n.floating[f]);const x=S/2-b/2,M=k/2-m[f]/2-1,R=wt(u[p],M),T=wt(u[C],M),H=R,A=k-m[f]-T,z=k/2-m[f]/2+x,L=ie(H,z,A),D=!l.arrow&&Et(r)!=null&&z!==L&&n.reference[f]/2-(z<H?R:T)-m[f]/2<0,F=D?z<H?z-H:z-A:0;return{[h]:g[h]+F,data:{[h]:L,centerOffset:z-L-F,...D&&{alignmentOffset:F}},reset:D}}}),Zo=function(o){return o===void 0&&(o={}),{name:"flip",options:o,async fn(t){var e,i;const{placement:r,middlewareData:n,rects:s,initialPlacement:a,platform:l,elements:d}=t,{mainAxis:c=!0,crossAxis:u=!0,fallbackPlacements:g,fallbackStrategy:h="bestFit",fallbackAxisSideDirection:f="none",flipAlignment:m=!0,...v}=Rt(o,t);if((e=n.arrow)!=null&&e.alignmentOffset)return{};const p=pt(r),C=ct(a),_=pt(a)===a,S=await(l.isRTL==null?void 0:l.isRTL(d.floating)),b=g||(_||!m?[jt(a)]:Bo(a)),y=f!=="none";!g&&y&&b.push(...Xo(a,m,f,S));const k=[a,...b],x=await le(t,v),M=[];let R=((i=n.flip)==null?void 0:i.overflows)||[];if(c&&M.push(x[p]),u){const z=Wo(r,s,S);M.push(x[z[0]],x[z[1]])}if(R=[...R,{placement:r,overflows:M}],!M.every(z=>z<=0)){var T,H;const z=(((T=n.flip)==null?void 0:T.index)||0)+1,L=k[z];if(L&&(!(u==="alignment"?C!==ct(L):!1)||R.every(q=>ct(q.placement)===C?q.overflows[0]>0:!0)))return{data:{index:z,overflows:R},reset:{placement:L}};let D=(H=R.filter(F=>F.overflows[0]<=0).sort((F,q)=>F.overflows[1]-q.overflows[1])[0])==null?void 0:H.placement;if(!D)switch(h){case"bestFit":{var A;const F=(A=R.filter(q=>{if(y){const O=ct(q.placement);return O===C||O==="y"}return!0}).map(q=>[q.placement,q.overflows.filter(O=>O>0).reduce((O,Wt)=>O+Wt,0)]).sort((q,O)=>q[1]-O[1])[0])==null?void 0:A[0];F&&(D=F);break}case"initialPlacement":D=a;break}if(r!==D)return{reset:{placement:D}}}return{}}}},ti=new Set(["left","top"]);async function ei(o,t){const{placement:e,platform:i,elements:r}=o,n=await(i.isRTL==null?void 0:i.isRTL(r.floating)),s=pt(e),a=Et(e),l=ct(e)==="y",d=ti.has(s)?-1:1,c=n&&l?-1:1,u=Rt(t,o);let{mainAxis:g,crossAxis:h,alignmentAxis:f}=typeof u=="number"?{mainAxis:u,crossAxis:0,alignmentAxis:null}:{mainAxis:u.mainAxis||0,crossAxis:u.crossAxis||0,alignmentAxis:u.alignmentAxis};return a&&typeof f=="number"&&(h=a==="end"?f*-1:f),l?{x:h*c,y:g*d}:{x:g*d,y:h*c}}const oi=function(o){return o===void 0&&(o=0),{name:"offset",options:o,async fn(t){var e,i;const{x:r,y:n,placement:s,middlewareData:a}=t,l=await ei(t,o);return s===((e=a.offset)==null?void 0:e.placement)&&(i=a.arrow)!=null&&i.alignmentOffset?{}:{x:r+l.x,y:n+l.y,data:{...l,placement:s}}}}},ii=function(o){return o===void 0&&(o={}),{name:"shift",options:o,async fn(t){const{x:e,y:i,placement:r}=t,{mainAxis:n=!0,crossAxis:s=!1,limiter:a={fn:v=>{let{x:p,y:C}=v;return{x:p,y:C}}},...l}=Rt(o,t),d={x:e,y:i},c=await le(t,l),u=ct(pt(r)),g=Fe(u);let h=d[g],f=d[u];if(n){const v=g==="y"?"top":"left",p=g==="y"?"bottom":"right",C=h+c[v],_=h-c[p];h=ie(C,h,_)}if(s){const v=u==="y"?"top":"left",p=u==="y"?"bottom":"right",C=f+c[v],_=f-c[p];f=ie(C,f,_)}const m=a.fn({...t,[g]:h,[u]:f});return{...m,data:{x:m.x-e,y:m.y-i,enabled:{[g]:n,[u]:s}}}}}},ri=function(o){return o===void 0&&(o={}),{name:"size",options:o,async fn(t){var e,i;const{placement:r,rects:n,platform:s,elements:a}=t,{apply:l=()=>{},...d}=Rt(o,t),c=await le(t,d),u=pt(r),g=Et(r),h=ct(r)==="y",{width:f,height:m}=n.floating;let v,p;u==="top"||u==="bottom"?(v=u,p=g===(await(s.isRTL==null?void 0:s.isRTL(a.floating))?"start":"end")?"left":"right"):(p=u,v=g==="end"?"top":"bottom");const C=m-c.top-c.bottom,_=f-c.left-c.right,S=wt(m-c[v],C),b=wt(f-c[p],_),y=!t.middlewareData.shift;let k=S,x=b;if((e=t.middlewareData.shift)!=null&&e.enabled.x&&(x=_),(i=t.middlewareData.shift)!=null&&i.enabled.y&&(k=C),y&&!g){const R=K(c.left,0),T=K(c.right,0),H=K(c.top,0),A=K(c.bottom,0);h?x=f-2*(R!==0||T!==0?R+T:K(c.left,c.right)):k=m-2*(H!==0||A!==0?H+A:K(c.top,c.bottom))}await l({...t,availableWidth:x,availableHeight:k});const M=await s.getDimensions(a.floating);return f!==M.width||m!==M.height?{reset:{rects:!0}}:{}}}};function Xt(){return typeof window<"u"}function $t(o){return We(o)?(o.nodeName||"").toLowerCase():"#document"}function X(o){var t;return(o==null||(t=o.ownerDocument)==null?void 0:t.defaultView)||window}function at(o){var t;return(t=(We(o)?o.ownerDocument:o.document)||window.document)==null?void 0:t.documentElement}function We(o){return Xt()?o instanceof Node||o instanceof X(o).Node:!1}function ot(o){return Xt()?o instanceof Element||o instanceof X(o).Element:!1}function dt(o){return Xt()?o instanceof HTMLElement||o instanceof X(o).HTMLElement:!1}function Be(o){return!Xt()||typeof ShadowRoot>"u"?!1:o instanceof ShadowRoot||o instanceof X(o).ShadowRoot}const ni=new Set(["inline","contents"]);function Pt(o){const{overflow:t,overflowX:e,overflowY:i,display:r}=it(o);return/auto|scroll|overlay|hidden|clip/.test(t+i+e)&&!ni.has(r)}const si=new Set(["table","td","th"]);function li(o){return si.has($t(o))}const ai=[":popover-open",":modal"];function Gt(o){return ai.some(t=>{try{return o.matches(t)}catch{return!1}})}const di=["transform","translate","scale","rotate","perspective"],ci=["transform","translate","scale","rotate","perspective","filter"],gi=["paint","layout","strict","content"];function ae(o){const t=de(),e=ot(o)?it(o):o;return di.some(i=>e[i]?e[i]!=="none":!1)||(e.containerType?e.containerType!=="normal":!1)||!t&&(e.backdropFilter?e.backdropFilter!=="none":!1)||!t&&(e.filter?e.filter!=="none":!1)||ci.some(i=>(e.willChange||"").includes(i))||gi.some(i=>(e.contain||"").includes(i))}function ui(o){let t=mt(o);for(;dt(t)&&!Tt(t);){if(ae(t))return t;if(Gt(t))return null;t=mt(t)}return null}function de(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const hi=new Set(["html","body","#document"]);function Tt(o){return hi.has($t(o))}function it(o){return X(o).getComputedStyle(o)}function Qt(o){return ot(o)?{scrollLeft:o.scrollLeft,scrollTop:o.scrollTop}:{scrollLeft:o.scrollX,scrollTop:o.scrollY}}function mt(o){if($t(o)==="html")return o;const t=o.assignedSlot||o.parentNode||Be(o)&&o.host||at(o);return Be(t)?t.host:t}function Ue(o){const t=mt(o);return Tt(t)?o.ownerDocument?o.ownerDocument.body:o.body:dt(t)&&Pt(t)?t:Ue(t)}function Ht(o,t,e){var i;t===void 0&&(t=[]),e===void 0&&(e=!0);const r=Ue(o),n=r===((i=o.ownerDocument)==null?void 0:i.body),s=X(r);if(n){const a=ce(s);return t.concat(s,s.visualViewport||[],Pt(r)?r:[],a&&e?Ht(a):[])}return t.concat(r,Ht(r,[],e))}function ce(o){return o.parent&&Object.getPrototypeOf(o.parent)?o.frameElement:null}function je(o){const t=it(o);let e=parseFloat(t.width)||0,i=parseFloat(t.height)||0;const r=dt(o),n=r?o.offsetWidth:e,s=r?o.offsetHeight:i,a=Bt(e)!==n||Bt(i)!==s;return a&&(e=n,i=s),{width:e,height:i,$:a}}function ge(o){return ot(o)?o:o.contextElement}function Mt(o){const t=ge(o);if(!dt(t))return lt(1);const e=t.getBoundingClientRect(),{width:i,height:r,$:n}=je(t);let s=(n?Bt(e.width):e.width)/i,a=(n?Bt(e.height):e.height)/r;return(!s||!Number.isFinite(s))&&(s=1),(!a||!Number.isFinite(a))&&(a=1),{x:s,y:a}}const fi=lt(0);function Ke(o){const t=X(o);return!de()||!t.visualViewport?fi:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function wi(o,t,e){return t===void 0&&(t=!1),!e||t&&e!==X(o)?!1:t}function St(o,t,e,i){t===void 0&&(t=!1),e===void 0&&(e=!1);const r=o.getBoundingClientRect(),n=ge(o);let s=lt(1);t&&(i?ot(i)&&(s=Mt(i)):s=Mt(o));const a=wi(n,e,i)?Ke(n):lt(0);let l=(r.left+a.x)/s.x,d=(r.top+a.y)/s.y,c=r.width/s.x,u=r.height/s.y;if(n){const g=X(n),h=i&&ot(i)?X(i):i;let f=g,m=ce(f);for(;m&&i&&h!==f;){const v=Mt(m),p=m.getBoundingClientRect(),C=it(m),_=p.left+(m.clientLeft+parseFloat(C.paddingLeft))*v.x,S=p.top+(m.clientTop+parseFloat(C.paddingTop))*v.y;l*=v.x,d*=v.y,c*=v.x,u*=v.y,l+=_,d+=S,f=X(m),m=ce(f)}}return Kt({width:c,height:u,x:l,y:d})}function Jt(o,t){const e=Qt(o).scrollLeft;return t?t.left+e:St(at(o)).left+e}function Xe(o,t){const e=o.getBoundingClientRect(),i=e.left+t.scrollLeft-Jt(o,e),r=e.top+t.scrollTop;return{x:i,y:r}}function pi(o){let{elements:t,rect:e,offsetParent:i,strategy:r}=o;const n=r==="fixed",s=at(i),a=t?Gt(t.floating):!1;if(i===s||a&&n)return e;let l={scrollLeft:0,scrollTop:0},d=lt(1);const c=lt(0),u=dt(i);if((u||!u&&!n)&&(($t(i)!=="body"||Pt(s))&&(l=Qt(i)),dt(i))){const h=St(i);d=Mt(i),c.x=h.x+i.clientLeft,c.y=h.y+i.clientTop}const g=s&&!u&&!n?Xe(s,l):lt(0);return{width:e.width*d.x,height:e.height*d.y,x:e.x*d.x-l.scrollLeft*d.x+c.x+g.x,y:e.y*d.y-l.scrollTop*d.y+c.y+g.y}}function mi(o){return Array.from(o.getClientRects())}function bi(o){const t=at(o),e=Qt(o),i=o.ownerDocument.body,r=K(t.scrollWidth,t.clientWidth,i.scrollWidth,i.clientWidth),n=K(t.scrollHeight,t.clientHeight,i.scrollHeight,i.clientHeight);let s=-e.scrollLeft+Jt(o);const a=-e.scrollTop;return it(i).direction==="rtl"&&(s+=K(t.clientWidth,i.clientWidth)-r),{width:r,height:n,x:s,y:a}}const Ge=25;function _i(o,t){const e=X(o),i=at(o),r=e.visualViewport;let n=i.clientWidth,s=i.clientHeight,a=0,l=0;if(r){n=r.width,s=r.height;const c=de();(!c||c&&t==="fixed")&&(a=r.offsetLeft,l=r.offsetTop)}const d=Jt(i);if(d<=0){const c=i.ownerDocument,u=c.body,g=getComputedStyle(u),h=c.compatMode==="CSS1Compat"&&parseFloat(g.marginLeft)+parseFloat(g.marginRight)||0,f=Math.abs(i.clientWidth-u.clientWidth-h);f<=Ge&&(n-=f)}else d<=Ge&&(n+=d);return{width:n,height:s,x:a,y:l}}const vi=new Set(["absolute","fixed"]);function yi(o,t){const e=St(o,!0,t==="fixed"),i=e.top+o.clientTop,r=e.left+o.clientLeft,n=dt(o)?Mt(o):lt(1),s=o.clientWidth*n.x,a=o.clientHeight*n.y,l=r*n.x,d=i*n.y;return{width:s,height:a,x:l,y:d}}function Qe(o,t,e){let i;if(t==="viewport")i=_i(o,e);else if(t==="document")i=bi(at(o));else if(ot(t))i=yi(t,e);else{const r=Ke(o);i={x:t.x-r.x,y:t.y-r.y,width:t.width,height:t.height}}return Kt(i)}function Je(o,t){const e=mt(o);return e===t||!ot(e)||Tt(e)?!1:it(e).position==="fixed"||Je(e,t)}function Ci(o,t){const e=t.get(o);if(e)return e;let i=Ht(o,[],!1).filter(a=>ot(a)&&$t(a)!=="body"),r=null;const n=it(o).position==="fixed";let s=n?mt(o):o;for(;ot(s)&&!Tt(s);){const a=it(s),l=ae(s);!l&&a.position==="fixed"&&(r=null),(n?!l&&!r:!l&&a.position==="static"&&!!r&&vi.has(r.position)||Pt(s)&&!l&&Je(o,s))?i=i.filter(c=>c!==s):r=a,s=mt(s)}return t.set(o,i),i}function Si(o){let{element:t,boundary:e,rootBoundary:i,strategy:r}=o;const s=[...e==="clippingAncestors"?Gt(t)?[]:Ci(t,this._c):[].concat(e),i],a=s[0],l=s.reduce((d,c)=>{const u=Qe(t,c,r);return d.top=K(u.top,d.top),d.right=wt(u.right,d.right),d.bottom=wt(u.bottom,d.bottom),d.left=K(u.left,d.left),d},Qe(t,a,r));return{width:l.right-l.left,height:l.bottom-l.top,x:l.left,y:l.top}}function ki(o){const{width:t,height:e}=je(o);return{width:t,height:e}}function xi(o,t,e){const i=dt(t),r=at(t),n=e==="fixed",s=St(o,!0,n,t);let a={scrollLeft:0,scrollTop:0};const l=lt(0);function d(){l.x=Jt(r)}if(i||!i&&!n)if(($t(t)!=="body"||Pt(r))&&(a=Qt(t)),i){const h=St(t,!0,n,t);l.x=h.x+t.clientLeft,l.y=h.y+t.clientTop}else r&&d();n&&!i&&r&&d();const c=r&&!i&&!n?Xe(r,a):lt(0),u=s.left+a.scrollLeft-l.x-c.x,g=s.top+a.scrollTop-l.y-c.y;return{x:u,y:g,width:s.width,height:s.height}}function ue(o){return it(o).position==="static"}function Ze(o,t){if(!dt(o)||it(o).position==="fixed")return null;if(t)return t(o);let e=o.offsetParent;return at(o)===e&&(e=e.ownerDocument.body),e}function to(o,t){const e=X(o);if(Gt(o))return e;if(!dt(o)){let r=mt(o);for(;r&&!Tt(r);){if(ot(r)&&!ue(r))return r;r=mt(r)}return e}let i=Ze(o,t);for(;i&&li(i)&&ue(i);)i=Ze(i,t);return i&&Tt(i)&&ue(i)&&!ae(i)?e:i||ui(o)||e}const Di=async function(o){const t=this.getOffsetParent||to,e=this.getDimensions,i=await e(o.floating);return{reference:xi(o.reference,await t(o.floating),o.strategy),floating:{x:0,y:0,width:i.width,height:i.height}}};function Ri(o){return it(o).direction==="rtl"}const Ei={convertOffsetParentRelativeRectToViewportRelativeRect:pi,getDocumentElement:at,getClippingRect:Si,getOffsetParent:to,getElementRects:Di,getClientRects:mi,getDimensions:ki,getScale:Mt,isElement:ot,isRTL:Ri};function eo(o,t){return o.x===t.x&&o.y===t.y&&o.width===t.width&&o.height===t.height}function $i(o,t){let e=null,i;const r=at(o);function n(){var a;clearTimeout(i),(a=e)==null||a.disconnect(),e=null}function s(a,l){a===void 0&&(a=!1),l===void 0&&(l=1),n();const d=o.getBoundingClientRect(),{left:c,top:u,width:g,height:h}=d;if(a||t(),!g||!h)return;const f=Ut(u),m=Ut(r.clientWidth-(c+g)),v=Ut(r.clientHeight-(u+h)),p=Ut(c),_={rootMargin:-f+"px "+-m+"px "+-v+"px "+-p+"px",threshold:K(0,wt(1,l))||1};let S=!0;function b(y){const k=y[0].intersectionRatio;if(k!==l){if(!S)return s();k?s(!1,k):i=setTimeout(()=>{s(!1,1e-7)},1e3)}k===1&&!eo(d,o.getBoundingClientRect())&&s(),S=!1}try{e=new IntersectionObserver(b,{..._,root:r.ownerDocument})}catch{e=new IntersectionObserver(b,_)}e.observe(o)}return s(!0),n}function Ti(o,t,e,i){i===void 0&&(i={});const{ancestorScroll:r=!0,ancestorResize:n=!0,elementResize:s=typeof ResizeObserver=="function",layoutShift:a=typeof IntersectionObserver=="function",animationFrame:l=!1}=i,d=ge(o),c=r||n?[...d?Ht(d):[],...Ht(t)]:[];c.forEach(p=>{r&&p.addEventListener("scroll",e,{passive:!0}),n&&p.addEventListener("resize",e)});const u=d&&a?$i(d,e):null;let g=-1,h=null;s&&(h=new ResizeObserver(p=>{let[C]=p;C&&C.target===d&&h&&(h.unobserve(t),cancelAnimationFrame(g),g=requestAnimationFrame(()=>{var _;(_=h)==null||_.observe(t)})),e()}),d&&!l&&h.observe(d),h.observe(t));let f,m=l?St(o):null;l&&v();function v(){const p=St(o);m&&!eo(m,p)&&e(),m=p,f=requestAnimationFrame(v)}return e(),()=>{var p;c.forEach(C=>{r&&C.removeEventListener("scroll",e),n&&C.removeEventListener("resize",e)}),u==null||u(),(p=h)==null||p.disconnect(),h=null,l&&cancelAnimationFrame(f)}}const he=oi,fe=ii,Ft=Zo,Mi=ri,Ii=Jo,qt=(o,t,e)=>{const i=new Map,r={platform:Ei,...e},n={...r.platform,_c:i};return Qo(o,t,{...r,platform:n})};function kt(o,t,e,i){var n;N(o);const r=document.createElement("div");if(r.className="wg__dropdown",r.style.cssText=`
2
2
  position: fixed;
3
3
  top: 0;
4
4
  left: 0;
5
5
  max-height: 200px;
6
6
  overflow-y: auto;
7
7
  z-index: 1000;
8
- `,t.length===0){const s=e.isSearching?i.searchingText||e.grid.labels.dropdownSearching:i.noOptionsText||e.grid.labels.dropdownNoOptions;r.innerHTML=`<div class="wg__dropdown-empty">${e.escapeHtml(s)}</div>`}else{const s=e.grid.editingCell,c=s?(n=e.grid.displayItems[s.rowIndex])==null?void 0:n[s.field]:void 0;r.innerHTML=t.map((a,l)=>{const g=l===e.highlightedIndex,d=gt(a,i)===c,h=xt(a,i);if(i.renderOptionCallback){const m={index:l,isHighlighted:g,isSelected:d,isDisabled:h};return i.renderOptionCallback(a,m)}const u=kt(a,i),p=no(a,i),b=so(a,i),v=["wg__dropdown-option"];g&&v.push("wg__dropdown-option--highlighted"),d&&v.push("wg__dropdown-option--selected"),h&&v.push("wg__dropdown-option--disabled");const w=p?`<span class="wg__dropdown-option-icon">${e.escapeHtml(p)}</span>`:"",_=b?`<span class="wg__dropdown-option-subtitle">${e.escapeHtml(b)}</span>`:"";return`<div class="${v.join(" ")}" data-index="${l}" ${h?'data-disabled="true"':""}>
9
- ${w}
8
+ `,e.length===0){const s=o.isSearching?i.searchingText||o.grid.labels.dropdownSearching:i.noOptionsText||o.grid.labels.dropdownNoOptions;r.innerHTML=`<div class="wg__dropdown-empty">${o.escapeHtml(s)}</div>`}else{const s=o.grid.editingCell,a=s?(n=o.grid.displayItems[s.rowIndex])==null?void 0:n[s.field]:void 0;r.innerHTML=e.map((l,d)=>{const c=d===o.highlightedIndex,u=Ct(l,i)===a,g=At(l,i);if(i.renderOptionCallback){const _={index:d,isHighlighted:c,isSelected:u,isDisabled:g};return i.renderOptionCallback(l,_)}const h=Ot(l,i),f=Fo(l,i),m=qo(l,i),v=["wg__dropdown-option"];c&&v.push("wg__dropdown-option--highlighted"),u&&v.push("wg__dropdown-option--selected"),g&&v.push("wg__dropdown-option--disabled");const p=f?`<span class="wg__dropdown-option-icon">${o.escapeHtml(f)}</span>`:"",C=m?`<span class="wg__dropdown-option-subtitle">${o.escapeHtml(m)}</span>`:"";return`<div class="${v.join(" ")}" data-index="${d}" ${g?'data-disabled="true"':""}>
9
+ ${p}
10
10
  <div class="wg__dropdown-option-content">
11
- <span class="wg__dropdown-option-label">${e.escapeHtml(u)}</span>
12
- ${_}
11
+ <span class="wg__dropdown-option-label">${o.escapeHtml(h)}</span>
12
+ ${C}
13
13
  </div>
14
- </div>`}).join("")}return e.shadow.appendChild(r),e.dropdownOpen=!0,$t(o,r,{strategy:"fixed",placement:"bottom-start",middleware:[Zt(1),Et({fallbackPlacements:["top-start"]}),Jo({apply({rects:s}){Object.assign(r.style,{width:`${s.reference.width}px`})}})]}).then(({x:s,y:c})=>{Object.assign(r.style,{left:`${s}px`,top:`${c}px`})}),r}function O(e){const o=e.shadow.querySelector(".wg__dropdown");o==null||o.remove(),e.dropdownOpen=!1,e.highlightedIndex=-1,e.filterText=""}function ti(e,o,t){if(e.grid.shouldUseVirtualScroll()){ei(e,o);const s=e.shadow.querySelector(`[data-row="${o}"][data-col="${t}"]`);s&&s.focus({preventScroll:!0});return}const i=e.shadow.querySelector(`[data-row="${o}"][data-col="${t}"]`);if(!i)return;i.focus({preventScroll:!0}),i.scrollIntoView({block:"nearest",inline:"nearest"});const r=e.shadow.querySelector(".wg__header"),n=e.shadow.querySelector(".wg");if(r&&n){const s=r.getBoundingClientRect(),c=i.getBoundingClientRect();if(c.top<s.bottom){const a=c.top-s.bottom-4;n.scrollBy({top:a,behavior:"instant"})}}}function ei(e,o){const t=e.shadow.querySelector(".wg");if(!t)return;const i=e.grid.virtualScrollRowHeight,r=t.scrollTop,n=t.clientHeight,s=e.shadow.querySelector(".wg__header"),c=(s==null?void 0:s.offsetHeight)||0,a=o*i,l=a+i,g=r+c,d=r+n;a<g?t.scrollTop=a-c:l>d&&(t.scrollTop=l-n)}let Ve=0;const oi=100;function K(e,o,t){const i=o&&t&&o.rowIndex===t.rowIndex&&o.colIndex===t.colIndex,r=Date.now();if(i&&r-Ve<oi)return;Ve=r;const n=e.grid.editingCell;o&&(n&&n.rowIndex===o.rowIndex&&e.grid.columns.findIndex(c=>String(c.field)===n.field)===o.colIndex||B(e,o.rowIndex,o.colIndex)),t&&(n&&n.rowIndex===t.rowIndex&&e.grid.columns.findIndex(c=>String(c.field)===n.field)===t.colIndex||B(e,t.rowIndex,t.colIndex))}function N(e){const o=e.grid.editingCell;if(o){const t=e.grid.columns.findIndex(r=>String(r.field)===o.field),i=e.shadow.querySelector(`[data-row="${o.rowIndex}"][data-col="${t}"]`);i&&i.classList.remove("wg__cell--editing")}}let ze=0;const ii=50;function ri(e,o,t){if(!e.grid.isNavigateMode)return;const i=Date.now();if(i-ze<ii){e.grid.setFocusedCell(o,t);return}ze=i;const r=e.grid.focusedCell,n={rowIndex:o,colIndex:t};e.grid.setFocusedCell(o,t),K(e,r,n)}function A(e,o,t){const i=e.grid.focusedCell,r={rowIndex:o,colIndex:t};e.grid.setFocusedCell(o,t),K(e,i,r),ti(e,o,t)}function W(e,o,t,i){const r=e.grid.columns[t];if(!r||!e.grid.isCellEditable(r))return;const n=String(r.field);e.dropdownOpen&&O(e);const s=e.grid.focusedCell;s&&(s.rowIndex!==o||s.colIndex!==t)&&(e.grid.clearFocusedCell(),B(e,s.rowIndex,s.colIndex)),e.grid.startEdit(o,n,i),B(e,o,t,{focusEditor:!0,cursorPosition:i==null?void 0:i.cursorPosition,initialSearchQuery:i==null?void 0:i.initialSearchQuery})}function ee(e,o){const t=o.querySelector(".wg__cell-text");if(!t)return null;const i=t.textContent||"";if(!i.length)return 0;const r=e.clientX,n=t.getBoundingClientRect();if(r<=n.left)return 0;if(r>=n.right)return i.length;const s=t.firstChild;if(!s||s.nodeType!==Node.TEXT_NODE)return null;const c=document.createRange();let a=0,l=i.length;try{for(;a<l;){const g=Math.floor((a+l)/2);c.setStart(s,0),c.setEnd(s,g),c.getBoundingClientRect().right<r?a=g+1:l=g}if(a>0&&a<i.length){c.setStart(s,a-1),c.setEnd(s,a);const g=c.getBoundingClientRect(),d=g.left+g.width/2;r<d&&a--}}catch{return i.length}return a}function ni(e,o){const t=o.relatedTarget,i=e.shadow.querySelector(".wg__table");if(!t||!(i!=null&&i.contains(t))){const r=e.grid.focusedCell;e.grid.clearFocusedCell(),K(e,r,null)}}function si(e,o){if(!e)return null;const[t,i,r]=e.split("-").map(Number),n=new Date(t,i-1,r);if(isNaN(n.getTime()))return null;switch(o){case"date":return n;case"timestamp":return n.getTime();case"iso":default:return e}}function oe(e,o,t){B(e,o,t)}function zt(e,o){const t=parseInt(o.dataset.row||"0",10),i=o.dataset.field||"";let r;if(o instanceof HTMLInputElement)if(o.type==="checkbox"){const n=JSON.parse(o.dataset.trueValue||"true"),s=JSON.parse(o.dataset.falseValue||"false");r=o.checked?n:s}else o.classList.contains("wg__editor--number")?r=o.value===""?null:parseFloat(o.value):o.type==="date"?r=si(o.value,o.dataset.outputFormat||"iso"):r=o.value;else o instanceof HTMLSelectElement&&(r=o.value);e.grid.commitEdit(t,i,r)}function ai(e,o){zt(e,o)}function li(e,o,t){const i=e.grid.columns[t];if(!i)return;const r=String(i.field),n=e.grid.displayItems[o];if(!n)return;const s=i.editorOptions||{},c=s.trueValue??!0,a=s.falseValue??!1,g=n[r]===c?a:c;e.grid.commitEdit(o,r,g),B(e,o,t);const d=e.grid.displayItems;o<d.length-1&&requestAnimationFrame(()=>{A(e,o+1,t)})}function di(e,o){if(!e.isCommittingFromKeyboard&&e.grid.editingCell){const t=parseInt(o.dataset.row||"0",10),i=o.dataset.field||"",r=e.grid.columns.findIndex(n=>String(n.field)===i);zt(e,o),r>=0&&oe(e,t,r)}}function ie(e,o,t,i){const n=e.grid.columns.findIndex(l=>String(l.field)===t),s=e.grid.displayItems;let c=o,a=n;if(i==="down")c=Math.min(o+1,s.length-1);else if(i==="up")c=Math.max(o-1,0);else{const l=e.grid.getEditableColumns(),g=l.findIndex(d=>d.index===n);i==="next"?g>=0&&g<l.length-1?a=l[g+1].index:o<s.length-1&&(c=o+1,a=l[0].index):g>0?a=l[g-1].index:o>0&&(c=o-1,a=l[l.length-1].index)}oe(e,o,n),A(e,c,a),e.isCommittingFromKeyboard=!1}function ci(e,o,t){const r=e.grid.columns.findIndex(n=>String(n.field)===t);r>=0&&(oe(e,o,r),A(e,o,r),e.isCommittingFromKeyboard=!1)}function Ft(e,o,t,i){const r=String(i.field),n=e.grid.displayItems[o],s=e.grid.getCellRawValue(n,o,r);switch(i.editor||"text"){case"checkbox":return fi(e,o,r,s,i);case"number":return ui(e,o,r,s,i);case"date":return hi(e,o,r,s,i);case"select":return wi(e,o,r,s,i);case"combobox":return mi(e,o,r,s,i);case"autocomplete":return bi(e,o,r,s,i);case"custom":return vi(e,o,r,s,i);case"text":default:return gi(e,o,r,s,i)}}function gi(e,o,t,i,r){var a;const n=r.editorOptions||{},s=(a=e.grid.editingCell)==null?void 0:a.initialSearchQuery,c=s!==void 0?s:i!=null?String(i):"";return`
14
+ </div>`}).join("")}return o.shadow.appendChild(r),o.dropdownOpen=!0,qt(t,r,{strategy:"fixed",placement:"bottom-start",middleware:[he(1),Ft({fallbackPlacements:["top-start"]}),Mi({apply({rects:s}){Object.assign(r.style,{width:`${s.reference.width}px`})}})]}).then(({x:s,y:a})=>{Object.assign(r.style,{left:`${s}px`,top:`${a}px`})}),r}function N(o){const t=o.shadow.querySelector(".wg__dropdown");t==null||t.remove(),o.dropdownOpen=!1,o.highlightedIndex=-1,o.filterText=""}function zi(o,t,e){if(o.grid.shouldUseVirtualScroll()){Li(o,t);const s=o.shadow.querySelector(`[data-row="${t}"][data-col="${e}"]`);s&&s.focus({preventScroll:!0});return}const i=o.shadow.querySelector(`[data-row="${t}"][data-col="${e}"]`);if(!i)return;i.focus({preventScroll:!0}),i.scrollIntoView({block:"nearest",inline:"nearest"});const r=o.shadow.querySelector(".wg__header"),n=o.shadow.querySelector(".wg");if(r&&n){const s=r.getBoundingClientRect(),a=i.getBoundingClientRect();if(a.top<s.bottom){const l=a.top-s.bottom-4;n.scrollBy({top:l,behavior:"instant"})}}}function Li(o,t){const e=o.shadow.querySelector(".wg");if(!e)return;const i=o.grid.virtualScrollRowHeight,r=e.scrollTop,n=e.clientHeight,s=o.shadow.querySelector(".wg__header"),a=(s==null?void 0:s.offsetHeight)||0,l=t*i,d=l+i,c=r+a,u=r+n;l<c?e.scrollTop=l-a:d>u&&(e.scrollTop=d-n)}let oo=0;const Oi=100;function tt(o,t,e){const i=t&&e&&t.rowIndex===e.rowIndex&&t.colIndex===e.colIndex,r=Date.now();if(i&&r-oo<Oi)return;oo=r;const n=o.grid.editingCell;t&&(n&&n.rowIndex===t.rowIndex&&o.grid.columns.findIndex(a=>String(a.field)===n.field)===t.colIndex||j(o,t.rowIndex,t.colIndex)),e&&(n&&n.rowIndex===e.rowIndex&&o.grid.columns.findIndex(a=>String(a.field)===n.field)===e.colIndex||j(o,e.rowIndex,e.colIndex))}function G(o){const t=o.grid.editingCell;if(t){const e=o.grid.columns.findIndex(r=>String(r.field)===t.field),i=o.shadow.querySelector(`[data-row="${t.rowIndex}"][data-col="${e}"]`);i&&i.classList.remove("wg__cell--editing")}}let io=0;const Ai=50;function Pi(o,t,e){if(!o.grid.isNavigateMode)return;const i=Date.now();if(i-io<Ai){o.grid.setFocusedCell(t,e);return}io=i;const r=o.grid.focusedCell,n={rowIndex:t,colIndex:e};o.grid.setFocusedCell(t,e),tt(o,r,n)}function I(o,t,e){const i=o.grid.focusedCell,r={rowIndex:t,colIndex:e};o.grid.setFocusedCell(t,e),tt(o,i,r),zi(o,t,e)}function et(o,t,e,i){const r=o.grid.columns[e];if(!r||!o.grid.isCellEditable(r))return;const n=String(r.field);o.dropdownOpen&&N(o);const s=o.grid.focusedCell;s&&(s.rowIndex!==t||s.colIndex!==e)&&(o.grid.clearFocusedCell(),j(o,s.rowIndex,s.colIndex)),o.grid.startEdit(t,n,i),j(o,t,e,{focusEditor:!0,cursorPosition:i==null?void 0:i.cursorPosition,initialSearchQuery:i==null?void 0:i.initialSearchQuery})}function we(o,t){const e=t.querySelector(".wg__cell-text");if(!e)return null;const i=e.textContent||"";if(!i.length)return 0;const r=o.clientX,n=e.getBoundingClientRect();if(r<=n.left)return 0;if(r>=n.right)return i.length;const s=e.firstChild;if(!s||s.nodeType!==Node.TEXT_NODE)return null;const a=document.createRange();let l=0,d=i.length;try{for(;l<d;){const c=Math.floor((l+d)/2);a.setStart(s,0),a.setEnd(s,c),a.getBoundingClientRect().right<r?l=c+1:d=c}if(l>0&&l<i.length){a.setStart(s,l-1),a.setEnd(s,l);const c=a.getBoundingClientRect(),u=c.left+c.width/2;r<u&&l--}}catch{return i.length}return l}function Hi(o,t){const e=t.relatedTarget,i=o.shadow.querySelector(".wg__table");if(!e||!(i!=null&&i.contains(e))){const r=o.grid.focusedCell;o.grid.clearFocusedCell(),tt(o,r,null)}}function Fi(o,t){if(!o)return null;const[e,i,r]=o.split("-").map(Number),n=new Date(e,i-1,r);if(isNaN(n.getTime()))return null;switch(t){case"date":return n;case"timestamp":return n.getTime();case"iso":default:return o}}function pe(o,t,e){j(o,t,e)}function Zt(o,t){const e=parseInt(t.dataset.row||"0",10),i=t.dataset.field||"";let r;if(t instanceof HTMLInputElement)if(t.type==="checkbox"){const n=JSON.parse(t.dataset.trueValue||"true"),s=JSON.parse(t.dataset.falseValue||"false");r=t.checked?n:s}else t.classList.contains("wg__editor--number")?r=t.value===""?null:parseFloat(t.value):t.type==="date"?r=Fi(t.value,t.dataset.outputFormat||"iso"):r=t.value;else t instanceof HTMLSelectElement&&(r=t.value);o.grid.commitEdit(e,i,r)}function qi(o,t){Zt(o,t)}function Vi(o,t,e){const i=o.grid.columns[e];if(!i)return;const r=String(i.field),n=o.grid.displayItems[t];if(!n)return;const s=i.editorOptions||{},a=s.trueValue??!0,l=s.falseValue??!1,c=n[r]===a?l:a;o.grid.commitEdit(t,r,c),j(o,t,e);const u=o.grid.displayItems;t<u.length-1&&requestAnimationFrame(()=>{I(o,t+1,e)})}function Ni(o,t){if(!o.isCommittingFromKeyboard&&o.grid.editingCell){const e=parseInt(t.dataset.row||"0",10),i=t.dataset.field||"",r=o.grid.columns.findIndex(n=>String(n.field)===i);Zt(o,t),r>=0&&pe(o,e,r)}}function me(o,t,e,i){const n=o.grid.columns.findIndex(d=>String(d.field)===e),s=o.grid.displayItems;let a=t,l=n;if(i==="down")a=Math.min(t+1,s.length-1);else if(i==="up")a=Math.max(t-1,0);else{const d=o.grid.getEditableColumns(),c=d.findIndex(u=>u.index===n);i==="next"?c>=0&&c<d.length-1?l=d[c+1].index:t<s.length-1&&(a=t+1,l=d[0].index):c>0?l=d[c-1].index:t>0&&(a=t-1,l=d[d.length-1].index)}pe(o,t,n),I(o,a,l),o.isCommittingFromKeyboard=!1}function Yi(o,t,e){const r=o.grid.columns.findIndex(n=>String(n.field)===e);r>=0&&(pe(o,t,r),I(o,t,r),o.isCommittingFromKeyboard=!1)}function te(o,t,e,i){const r=String(i.field),n=o.grid.displayItems[t],s=o.grid.getCellRawValue(n,t,r);switch(i.editor||"text"){case"checkbox":return Ki(o,t,r,s,i);case"number":return Bi(o,t,r,s,i);case"date":return Ui(o,t,r,s,i);case"select":return Xi(o,t,r,s,i);case"combobox":return Gi(o,t,r,s,i);case"autocomplete":return Qi(o,t,r,s,i);case"custom":return Ji(o,t,r,s,i);case"text":default:return Wi(o,t,r,s,i)}}function Wi(o,t,e,i,r){var l;const n=r.editorOptions||{},s=(l=o.grid.editingCell)==null?void 0:l.initialSearchQuery,a=s!==void 0?s:i!=null?String(i):"";return`
15
15
  <input
16
16
  type="text"
17
17
  class="wg__editor wg__editor--text"
18
- value="${e.escapeHtml(c)}"
19
- data-row="${o}"
20
- data-field="${t}"
18
+ value="${o.escapeHtml(a)}"
19
+ data-row="${t}"
20
+ data-field="${e}"
21
21
  ${n.maxLength?`maxlength="${n.maxLength}"`:""}
22
- ${n.placeholder?`placeholder="${e.escapeHtml(n.placeholder)}"`:""}
23
- ${n.pattern?`pattern="${e.escapeHtml(n.pattern)}"`:""}
22
+ ${n.placeholder?`placeholder="${o.escapeHtml(n.placeholder)}"`:""}
23
+ ${n.pattern?`pattern="${o.escapeHtml(n.pattern)}"`:""}
24
24
  />
25
- `}function ui(e,o,t,i,r){var c;r.editorOptions;const n=(c=e.grid.editingCell)==null?void 0:c.initialSearchQuery;return`
25
+ `}function Bi(o,t,e,i,r){var a;r.editorOptions;const n=(a=o.grid.editingCell)==null?void 0:a.initialSearchQuery;return`
26
26
  <input
27
27
  type="text"
28
28
  inputmode="numeric"
29
29
  class="wg__editor wg__editor--number"
30
30
  value="${n!==void 0?n:i!=null?String(i):""}"
31
- data-row="${o}"
32
- data-field="${t}"
31
+ data-row="${t}"
32
+ data-field="${e}"
33
33
  />
34
- `}function hi(e,o,t,i,r){var l;const n=r.editorOptions||{},s=(l=e.grid.editingCell)==null?void 0:l.initialSearchQuery,c=re(i),a=s!==void 0?s:pi(i,n.dateFormat);return`
35
- <div class="wg__editor wg__editor--date" data-row="${o}" data-field="${t}">
34
+ `}function Ui(o,t,e,i,r){var d;const n=r.editorOptions||{},s=(d=o.grid.editingCell)==null?void 0:d.initialSearchQuery,a=be(i),l=s!==void 0?s:ji(i,n.dateFormat);return`
35
+ <div class="wg__editor wg__editor--date" data-row="${t}" data-field="${e}">
36
36
  <input
37
37
  type="text"
38
38
  class="wg__date-input"
39
- value="${e.escapeHtml(a)}"
40
- data-row="${o}"
41
- data-field="${t}"
42
- data-date-value="${c}"
39
+ value="${o.escapeHtml(l)}"
40
+ data-row="${t}"
41
+ data-field="${e}"
42
+ data-date-value="${a}"
43
43
  data-output-format="${n.outputFormat||"iso"}"
44
44
  data-date-format="${n.dateFormat||"YYYY-MM-DD"}"
45
- ${n.minDate?`data-min-date="${re(n.minDate)}"`:""}
46
- ${n.maxDate?`data-max-date="${re(n.maxDate)}"`:""}
47
- placeholder="${e.escapeHtml(n.dateFormat||"YYYY-MM-DD")}"
45
+ ${n.minDate?`data-min-date="${be(n.minDate)}"`:""}
46
+ ${n.maxDate?`data-max-date="${be(n.maxDate)}"`:""}
47
+ placeholder="${o.escapeHtml(n.dateFormat||"YYYY-MM-DD")}"
48
48
  />
49
49
  <button type="button" class="wg__date-trigger" tabindex="-1">
50
50
  <svg viewBox="0 0 24 24" width="14" height="14"><path fill="currentColor" d="M19 3h-1V1h-2v2H8V1H6v2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm0 16H5V8h14v11zM9 10H7v2h2v-2zm4 0h-2v2h2v-2zm4 0h-2v2h2v-2zm-8 4H7v2h2v-2zm4 0h-2v2h2v-2zm4 0h-2v2h2v-2z"/></svg>
51
51
  </button>
52
52
  </div>
53
- `}function pi(e,o){if(!e)return"";let t=null;if(e instanceof Date?t=e:typeof e=="number"?t=new Date(e):typeof e=="string"&&(t=new Date(e)),!t||isNaN(t.getTime()))return"";const i=o||"YYYY-MM-DD",r=t.getFullYear(),n=String(t.getMonth()+1).padStart(2,"0"),s=String(t.getDate()).padStart(2,"0");return i.replace("YYYY",String(r)).replace("YY",String(r).slice(-2)).replace("MM",n).replace("DD",s)}function re(e){if(!e)return"";let o=null;if(e instanceof Date?o=e:typeof e=="number"?o=new Date(e):typeof e=="string"&&(o=new Date(e)),!o||isNaN(o.getTime()))return"";const t=o.getFullYear(),i=String(o.getMonth()+1).padStart(2,"0"),r=String(o.getDate()).padStart(2,"0");return`${t}-${i}-${r}`}function fi(e,o,t,i,r){const n=r.editorOptions||{},s=n.trueValue!==void 0?n.trueValue:!0;return`
53
+ `}function ji(o,t){if(!o)return"";let e=null;if(o instanceof Date?e=o:typeof o=="number"?e=new Date(o):typeof o=="string"&&(e=new Date(o)),!e||isNaN(e.getTime()))return"";const i=t||"YYYY-MM-DD",r=e.getFullYear(),n=String(e.getMonth()+1).padStart(2,"0"),s=String(e.getDate()).padStart(2,"0");return i.replace("YYYY",String(r)).replace("YY",String(r).slice(-2)).replace("MM",n).replace("DD",s)}function be(o){if(!o)return"";let t=null;if(o instanceof Date?t=o:typeof o=="number"?t=new Date(o):typeof o=="string"&&(t=new Date(o)),!t||isNaN(t.getTime()))return"";const e=t.getFullYear(),i=String(t.getMonth()+1).padStart(2,"0"),r=String(t.getDate()).padStart(2,"0");return`${e}-${i}-${r}`}function Ki(o,t,e,i,r){const n=r.editorOptions||{},s=n.trueValue!==void 0?n.trueValue:!0;return`
54
54
  <input
55
55
  type="checkbox"
56
56
  class="wg__editor wg__editor--checkbox"
57
57
  ${i===s?"checked":""}
58
- data-row="${o}"
59
- data-field="${t}"
60
- data-true-value="${e.escapeHtml(JSON.stringify(n.trueValue??!0))}"
61
- data-false-value="${e.escapeHtml(JSON.stringify(n.falseValue??!1))}"
58
+ data-row="${t}"
59
+ data-field="${e}"
60
+ data-true-value="${o.escapeHtml(JSON.stringify(n.trueValue??!0))}"
61
+ data-false-value="${o.escapeHtml(JSON.stringify(n.falseValue??!1))}"
62
62
  />
63
- `}function wi(e,o,t,i,r){var l;const n=r.editorOptions||{},s=n.options||[],c=Yt(i,s,n),a=(l=e.grid.editingCell)==null?void 0:l.initialSearchQuery;return e.dropdownOptions=s,e.filterText=a||"",e.highlightedIndex=s.findIndex(g=>gt(g,n)===i),e.highlightedIndex<0&&s.length>0&&(e.highlightedIndex=0),`
63
+ `}function Xi(o,t,e,i,r){var d;const n=r.editorOptions||{},s=n.options||[],a=oe(i,s,n),l=(d=o.grid.editingCell)==null?void 0:d.initialSearchQuery;return o.dropdownOptions=s,o.filterText=l||"",o.highlightedIndex=s.findIndex(c=>Ct(c,n)===i),o.highlightedIndex<0&&s.length>0&&(o.highlightedIndex=0),`
64
64
  <div
65
65
  class="wg__editor wg__editor--select wg__select-trigger"
66
66
  tabindex="0"
67
67
  role="combobox"
68
68
  aria-haspopup="listbox"
69
- data-row="${o}"
70
- data-field="${t}"
69
+ data-row="${t}"
70
+ data-field="${e}"
71
71
  >
72
- <span class="wg__select-value">${e.escapeHtml(c)}</span>
72
+ <span class="wg__select-value">${o.escapeHtml(a)}</span>
73
73
  <span class="wg__select-toggle">▼</span>
74
74
  </div>
75
- `}function mi(e,o,t,i,r){var g;const n=r.editorOptions||{},s=n.options||[],c=Yt(i,s,n),a=(g=e.grid.editingCell)==null?void 0:g.initialSearchQuery,l=a!==void 0?a:c;return e.dropdownOptions=s,e.filterText=l,e.highlightedIndex=s.length>0?0:-1,`
76
- <div class="wg__editor wg__editor--combobox" data-row="${o}" data-field="${t}">
75
+ `}function Gi(o,t,e,i,r){var c;const n=r.editorOptions||{},s=n.options||[],a=oe(i,s,n),l=(c=o.grid.editingCell)==null?void 0:c.initialSearchQuery,d=l!==void 0?l:a;return o.dropdownOptions=s,o.filterText=d,o.highlightedIndex=s.length>0?0:-1,`
76
+ <div class="wg__editor wg__editor--combobox" data-row="${t}" data-field="${e}">
77
77
  <input
78
78
  type="text"
79
79
  class="wg__combobox-input"
80
- value="${e.escapeHtml(l)}"
81
- data-row="${o}"
82
- data-field="${t}"
80
+ value="${o.escapeHtml(d)}"
81
+ data-row="${t}"
82
+ data-field="${e}"
83
83
  />
84
84
  <span class="wg__combobox-toggle">▼</span>
85
85
  </div>
86
- `}function bi(e,o,t,i,r){var g;const n=r.editorOptions||{},s=n.initialOptions||n.options||[],c=Yt(i,s,n),a=(g=e.grid.editingCell)==null?void 0:g.initialSearchQuery,l=a!==void 0?a:c;return e.dropdownOptions=s,e.filterText=l,e.highlightedIndex=s.length>0?0:-1,`
87
- <div class="wg__editor wg__editor--autocomplete" data-row="${o}" data-field="${t}">
86
+ `}function Qi(o,t,e,i,r){var c;const n=r.editorOptions||{},s=n.initialOptions||n.options||[],a=oe(i,s,n),l=(c=o.grid.editingCell)==null?void 0:c.initialSearchQuery,d=l!==void 0?l:a;return o.dropdownOptions=s,o.filterText=d,o.highlightedIndex=s.length>0?0:-1,`
87
+ <div class="wg__editor wg__editor--autocomplete" data-row="${t}" data-field="${e}">
88
88
  <input
89
89
  type="text"
90
90
  class="wg__autocomplete-input"
91
- value="${e.escapeHtml(l)}"
92
- placeholder="${e.escapeHtml(n.placeholder||"")}"
93
- data-row="${o}"
94
- data-field="${t}"
91
+ value="${o.escapeHtml(d)}"
92
+ placeholder="${o.escapeHtml(n.placeholder||"")}"
93
+ data-row="${t}"
94
+ data-field="${e}"
95
95
  />
96
96
  <span class="wg__combobox-toggle">▼</span>
97
97
  <span class="wg__loading-indicator" style="display: none;">⏳</span>
98
98
  </div>
99
- `}function vi(e,o,t,i,r){const n=r.formatCallback?r.formatCallback(i,e.grid.displayItems[o]):i!=null?String(i):"";return`
99
+ `}function Ji(o,t,e,i,r){const n=r.formatCallback?r.formatCallback(i,o.grid.displayItems[t]):i!=null?String(i):"";return`
100
100
  <div
101
101
  class="wg__editor wg__editor--custom"
102
102
  tabindex="0"
103
- data-row="${o}"
104
- data-field="${t}"
103
+ data-row="${t}"
104
+ data-field="${e}"
105
105
  >
106
- <span class="wg__custom-value">${e.escapeHtml(n)}</span>
106
+ <span class="wg__custom-value">${o.escapeHtml(n)}</span>
107
107
  </div>
108
- `}function ne(e,o,t,i,r,n){const s=i.editor==="select"||i.editor==="combobox"||i.editor==="autocomplete",c=i.editor==="date",a=String(i.field);return s?`
109
- <div class="wg__cell-dropdown-display ${e.grid.getEffectiveToggleVisibility(i)==="on-focus"?"wg__cell-dropdown-display--toggle-on-focus":""}" data-row="${o}" data-field="${a}">
110
- <span class="wg__select-value">${e.escapeHtml(r)}</span>
108
+ `}function _e(o,t,e,i,r,n){const s=i.editor==="select"||i.editor==="combobox"||i.editor==="autocomplete",a=i.editor==="date",l=String(i.field);return s?`
109
+ <div class="wg__cell-dropdown-display ${o.grid.getEffectiveToggleVisibility(i)==="on-focus"?"wg__cell-dropdown-display--toggle-on-focus":""}" data-row="${t}" data-field="${l}">
110
+ <span class="wg__select-value">${o.escapeHtml(r)}</span>
111
111
  <span class="wg__select-toggle">▼</span>
112
112
  </div>
113
- `:c?`
114
- <div class="wg__cell-date-display ${e.grid.getEffectiveToggleVisibility(i)==="on-focus"?"wg__cell-date-display--toggle-on-focus":""}" data-row="${o}" data-field="${a}">
115
- <span class="wg__date-value">${e.escapeHtml(r)}</span>
113
+ `:a?`
114
+ <div class="wg__cell-date-display ${o.grid.getEffectiveToggleVisibility(i)==="on-focus"?"wg__cell-date-display--toggle-on-focus":""}" data-row="${t}" data-field="${l}">
115
+ <span class="wg__date-value">${o.escapeHtml(r)}</span>
116
116
  <button type="button" class="wg__date-trigger" tabindex="-1">
117
117
  <svg viewBox="0 0 24 24" width="14" height="14"><path fill="currentColor" d="M19 3h-1V1h-2v2H8V1H6v2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm0 16H5V8h14v11zM9 10H7v2h2v-2zm4 0h-2v2h2v-2zm4 0h-2v2h2v-2zm-8 4H7v2h2v-2zm4 0h-2v2h2v-2zm4 0h-2v2h2v-2z"/></svg>
118
118
  </button>
119
119
  </div>
120
- `:i.templateCallback?`<span class="wg__cell-text">${r}</span>`:`<span class="wg__cell-text">${e.escapeHtml(r)}</span>`}let H={path:null,arrowPos:null,arrowDir:"right"};const _i={add:{icon:"+",title:"Add row"},delete:{icon:"−",title:"Delete row",danger:!0},duplicate:{icon:"⧉",title:"Duplicate row"},moveUp:{icon:"↑",title:"Move up"},moveDown:{icon:"↓",title:"Move down"}};function se(e){return e.map((o,t)=>{if(typeof o=="string"){const i=_i[o];return i?{id:o,icon:i.icon,title:i.title,row:1,group:1,type:o,danger:i.danger}:(console.warn(`Unknown predefined toolbar action: ${o}`),null)}return{id:o.id||`toolbar-item-${t}`,icon:o.icon,title:o.title,label:o.label,row:o.row??1,group:o.group??1,type:o.type,danger:o.danger,disabled:o.disabled,hidden:o.hidden,onclick:o.onclick,tooltip:o.tooltip,tooltipCallback:o.tooltipCallback}}).filter(o=>o!==null)}function yi(e){const o=new Map;for(const r of e){const n=r.row;o.has(n)||o.set(n,[]),o.get(n).push(r)}const t=[],i=[...o.keys()].sort((r,n)=>r-n);for(const r of i){const n=o.get(r),s=new Map;for(const a of n){const l=a.group;s.has(l)||s.set(l,[]),s.get(l).push(a)}const c=[...s.keys()].sort((a,l)=>a-l);t.push({rowNum:r,groups:c.map(a=>({groupNum:a,items:s.get(a)}))})}return t}function Ci(e){return e.replace(/\+/g," + ")}function Si(e,o){var r,n;const t=[];t.push(`<span class="wg__tooltip-title">${e.title}</span>`),(r=e.tooltip)!=null&&r.description&&t.push(`<div class="wg__tooltip-desc">${e.tooltip.description}</div>`);const i=((n=e.tooltip)==null?void 0:n.shortcut)||o;return i&&t.push(`<div class="wg__tooltip-shortcut">${Ci(i)}</div>`),t.join("")}function ki(e,o,t,i=!1){let r=yi(e);return i&&(r=r.reverse()),`<div class="wg__toolbar">${r.map(({groups:s})=>`<div class="wg__toolbar-row">${s.map(({items:a},l)=>{const g=l>0?'<div class="wg__toolbar-divider"></div>':"",d=a.map(h=>{const u=typeof h.disabled=="function"?h.disabled(o,t):h.disabled,p=["wg__toolbar-btn",h.danger?"wg__toolbar-btn--danger":""].filter(Boolean).join(" "),b=h.label?`<span class="wg__toolbar-label">${h.label}</span>`:"";return`<button
121
- class="${p}"
122
- data-toolbar-item="${h.id}"
123
- title="${h.title}"
124
- ${u?"disabled":""}
125
- >${h.icon}${b}</button>`}).join("");return g+d}).join("")}</div>`).join("")}</div>`}let I=null;function xi(e,o,t,i,r,n,s){qt();const c=e.grid.toolbarVerticalAlign!=="top",a=ki(i,r,t,c),l=document.createElement("div");l.className="wg__toolbar-container",l.innerHTML=a,e.shadow.appendChild(l);const g=l.querySelector(".wg__toolbar");let d="left";g.style.position="fixed",g.style.visibility="hidden",requestAnimationFrame(()=>{const u=e.shadow.querySelector(`tr[data-row-index="${t}"]`);if(!u){qt();return}const p=e.grid.toolbarPosition,b=e.grid.toolbarVerticalAlign,v=e.grid.toolbarHorizontalAlign;let w,_,m="";b==="top"?m="-end":b==="bottom"&&(m="-start");const C=()=>v==="start"?"top-start":v==="end"?"top-end":"top";p==="left"?(w=`left${m}`,_=[`right${m}`,C()]):p==="right"?(w=`right${m}`,_=[`left${m}`,C()]):p==="top"?(w=C(),_=[`left${m}`,`right${m}`]):(w=`left${m}`,_=[`right${m}`,C()]);let y=u;if(v==="cursor"&&s!==void 0&&p==="top"){const S=u.getBoundingClientRect();y={getBoundingClientRect:()=>({x:s,y:S.top,top:S.top,left:s,bottom:S.bottom,right:s,width:0,height:S.height,toJSON:()=>({})})}}$t(y,g,{strategy:"fixed",placement:w,middleware:[Et({fallbackPlacements:_}),te({padding:8})]}).then(({x:S,y:k,placement:x})=>{Object.assign(g.style,{left:`${S}px`,top:`${k}px`,visibility:"visible"}),d=x.split("-")[0],I&&(I.position=d)}).catch(()=>{g.style.visibility="visible"})});const h=u=>{const p=u.target.closest(".wg__toolbar-btn");if(p&&!p.disabled){const b=p.dataset.toolbarItem||"",v=i.find(w=>w.id===b);v&&n(v)}};l.addEventListener("click",h),I={container:l,toolbar:g,rowIndex:t,rowItem:r,position:d,hasRowMoved:!1,cursorX:s,cleanup:()=>{l.removeEventListener("click",h),l.remove()}},H={path:null,arrowPos:null,arrowDir:"right"}}function qt(){I&&(I.cleanup(),I=null),H={path:null,arrowPos:null,arrowDir:"right"}}function yt(){return(I==null?void 0:I.rowIndex)??null}function Fe(e){return(I==null?void 0:I.container.getRootNode())===e}function ae(e){return(I==null?void 0:I.rowIndex)===e}function Di(){return H}function qe(e,o){if(!I){H={path:null,arrowPos:null,arrowDir:"right"};return}const{toolbar:t,rowItem:i,position:r}=I,n=o.findIndex(y=>y===i);if(n===-1){H={path:null,arrowPos:null,arrowDir:"right"};return}const s=e.shadow.querySelector(`tr[data-row-index="${n}"]`);if(!s){H={path:null,arrowPos:null,arrowDir:"right"};return}if(n===I.rowIndex||(I.hasRowMoved=!0),!I.hasRowMoved){H={path:null,arrowPos:null,arrowDir:"right"};return}const a=t.getBoundingClientRect(),l=s.getBoundingClientRect(),g=e.shadow.querySelector(".wg__table"),d=g==null?void 0:g.getBoundingClientRect(),h=e.shadow.querySelector(".wg"),u=h==null?void 0:h.getBoundingClientRect();if(!d||!u){H={path:null,arrowPos:null,arrowDir:"right"};return}const p=document.dir==="rtl"||document.documentElement.dir==="rtl",b=l.top+l.height/2,v=l.bottom<=u.top,w=l.top>=u.bottom,_=!v&&!w;let m,C="right";if(v?(m=u.top+8,C="up"):w?(m=u.bottom-8,C="down"):m=b,r==="left"){const y=a.right,S=a.top+a.height/2,k=p?u.right+15:u.left-15;if(!_){H={path:`M ${y} ${S} H ${k} V ${m}`,arrowPos:{x:k,y:m},arrowDir:C};return}const x=p?u.right-8:u.left+8;C=p?"left":"right",H={path:`M ${y} ${S} H ${k} V ${m} H ${x}`,arrowPos:{x,y:m},arrowDir:C};return}else if(r==="right"){const y=a.left,S=a.top+a.height/2,k=p?u.left-15:u.right+15;if(!_){H={path:`M ${y} ${S} H ${k} V ${m}`,arrowPos:{x:k,y:m},arrowDir:C};return}const x=p?u.left+8:u.right-8;C=p?"right":"left",H={path:`M ${y} ${S} H ${k} V ${m} H ${x}`,arrowPos:{x,y:m},arrowDir:C};return}else{const S=a.right,k=a.top+a.height/2,x=S+48,E=n-I.rowIndex,$=8;if(E===0){let R=l.top-$;w&&(R=u.bottom-$),H={path:`M ${S} ${k} H ${x} V ${R}`,arrowPos:{x,y:R},arrowDir:"down"};return}else if(E===-1){const L=a.top+a.height*.25,D=a.top+a.height*.75,T=a.right+24,M=a.right+$;H={path:`M ${a.right} ${L} H ${T} V ${D} H ${M}`,arrowPos:{x:M,y:D},arrowDir:"left"};return}else if(E<0){let R=l.bottom+$;v&&(R=u.top+$),H={path:`M ${S} ${k} H ${x} V ${R}`,arrowPos:{x,y:R},arrowDir:"up"};return}else{let R=l.top-$;w&&(R=u.bottom-$),H={path:`M ${S} ${k} H ${x} V ${R}`,arrowPos:{x,y:R},arrowDir:"down"};return}}}function Ye(e,o,t="Row actions"){return`<button
126
- class="wg__toolbar-trigger ${o?"wg__toolbar-trigger--active":""}"
127
- data-toolbar-trigger="${e}"
128
- title="${t}"
129
- >⋮</button>`}function Ti(e){const o=["wg"];return e.grid.striped&&o.push("wg--striped"),e.grid.hoverable&&o.push("wg--hoverable"),e.grid.editable&&o.push("wg--editable"),e.grid.isNavigateMode&&o.push("wg--navigate-mode"),o.join(" ")}function Ei(e){const o=e.grid.columns;if(o.length===0)return"";const t=e.grid.showRowNumbers?'<th class="wg__header wg__row-number-header">#</th>':"",r=e.grid.showRowToolbar&&e.grid.toolbarPosition==="inline"?`<th class="wg__header wg__inline-actions-header">${e.escapeHtml(e.grid.inlineActionsTitle||e.grid.labels.inlineActionsHeader)}</th>`:"",s=e.grid.showRowToolbar&&e.grid.toolbarTrigger==="button"&&e.grid.toolbarPosition!=="inline"?'<th class="wg__header wg__actions-column"></th>':"",c=o.map(a=>{const l=String(a.field),g=a.sortable!==!1&&e.grid.sortMode!=="none",d=e.grid.getColumnSortState(l),h=e.grid.getColumnSortPriority(l),u=d!==void 0,p=["wg__header"];g&&p.push("wg__header--sortable"),u&&p.push("wg__header--sorted");const b=a.width||a.maxWidth,w=`style="${[b?`width: ${b}`:"",a.minWidth?`min-width: ${a.minWidth}`:"",`text-align: ${a.align||"left"}`].filter(Boolean).join("; ")}"`;let _="";if(g)if(u){const C=d.direction==="asc"?"▲":"▼",y=e.grid.sort.length>1?`<sup class="wg__sort-priority">${h}</sup>`:"";_=`<span class="wg__sort-indicator">${C}${y}</span>`}else _='<span class="wg__sort-indicator wg__sort-placeholder">⬍</span>';let m="";return a.headerInfo&&(m=`<span class="wg__header-info" data-tooltip="${e.escapeHtml(a.headerInfo)}"><svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"/><path d="M12 16v-4"/><path d="M12 8h.01"/></svg></span>`),`
130
- <th class="${p.join(" ")}" ${w} data-field="${l}">
120
+ `:i.templateCallback?`<span class="wg__cell-text">${r}</span>`:`<span class="wg__cell-text">${o.escapeHtml(r)}</span>`}let Y={path:null,arrowPos:null,arrowDir:"right"};const Zi={add:{icon:"+",title:"Add row"},delete:{icon:"−",title:"Delete row",danger:!0},duplicate:{icon:"⧉",title:"Duplicate row"},moveUp:{icon:"↑",title:"Move up"},moveDown:{icon:"↓",title:"Move down"}};function ve(o){return o.map((t,e)=>{if(typeof t=="string"){const i=Zi[t];return i?{id:t,icon:i.icon,title:i.title,row:1,group:1,type:t,danger:i.danger}:(console.warn(`Unknown predefined toolbar action: ${t}`),null)}return{id:t.id||`toolbar-item-${e}`,icon:t.icon,title:t.title,label:t.label,row:t.row??1,group:t.group??1,type:t.type,danger:t.danger,disabled:t.disabled,hidden:t.hidden,onclick:t.onclick,tooltip:t.tooltip,tooltipCallback:t.tooltipCallback}}).filter(t=>t!==null)}function tr(o){const t=new Map;for(const r of o){const n=r.row;t.has(n)||t.set(n,[]),t.get(n).push(r)}const e=[],i=[...t.keys()].sort((r,n)=>r-n);for(const r of i){const n=t.get(r),s=new Map;for(const l of n){const d=l.group;s.has(d)||s.set(d,[]),s.get(d).push(l)}const a=[...s.keys()].sort((l,d)=>l-d);e.push({rowNum:r,groups:a.map(l=>({groupNum:l,items:s.get(l)}))})}return e}function er(o){return o.replace(/\+/g," + ")}function or(o,t){var r,n;const e=[];e.push(`<span class="wg__tooltip-title">${o.title}</span>`),(r=o.tooltip)!=null&&r.description&&e.push(`<div class="wg__tooltip-desc">${o.tooltip.description}</div>`);const i=((n=o.tooltip)==null?void 0:n.shortcut)||t;return i&&e.push(`<div class="wg__tooltip-shortcut">${er(i)}</div>`),e.join("")}function ir(o,t,e,i=!1){let r=tr(o);return i&&(r=r.reverse()),`<div class="wg__toolbar">${r.map(({groups:s})=>`<div class="wg__toolbar-row">${s.map(({items:l},d)=>{const c=d>0?'<div class="wg__toolbar-divider"></div>':"",u=l.map(g=>{const h=typeof g.disabled=="function"?g.disabled(t,e):g.disabled,f=["wg__toolbar-btn",g.danger?"wg__toolbar-btn--danger":""].filter(Boolean).join(" "),m=g.label?`<span class="wg__toolbar-label">${g.label}</span>`:"";return`<button
121
+ class="${f}"
122
+ data-toolbar-item="${g.id}"
123
+ title="${g.title}"
124
+ ${h?"disabled":""}
125
+ >${g.icon}${m}</button>`}).join("");return c+u}).join("")}</div>`).join("")}</div>`}let P=null;function rr(o,t,e,i,r,n,s){ee();const a=o.grid.toolbarVerticalAlign!=="top",l=ir(i,r,e,a),d=document.createElement("div");d.className="wg__toolbar-container",d.innerHTML=l,o.shadow.appendChild(d);const c=d.querySelector(".wg__toolbar");let u="left";c.style.position="fixed",c.style.visibility="hidden",requestAnimationFrame(()=>{const h=o.shadow.querySelector(`tr[data-row-index="${e}"]`);if(!h){ee();return}const f=o.grid.toolbarPosition,m=o.grid.toolbarVerticalAlign,v=o.grid.toolbarHorizontalAlign;let p,C,_="";m==="top"?_="-end":m==="bottom"&&(_="-start");const S=()=>v==="start"?"top-start":v==="end"?"top-end":"top";f==="left"?(p=`left${_}`,C=[`right${_}`,S()]):f==="right"?(p=`right${_}`,C=[`left${_}`,S()]):f==="top"?(p=S(),C=[`left${_}`,`right${_}`]):(p=`left${_}`,C=[`right${_}`,S()]);let b=h;if(v==="cursor"&&s!==void 0&&f==="top"){const y=h.getBoundingClientRect();b={getBoundingClientRect:()=>({x:s,y:y.top,top:y.top,left:s,bottom:y.bottom,right:s,width:0,height:y.height,toJSON:()=>({})})}}qt(b,c,{strategy:"fixed",placement:p,middleware:[Ft({fallbackPlacements:C}),fe({padding:8})]}).then(({x:y,y:k,placement:x})=>{Object.assign(c.style,{left:`${y}px`,top:`${k}px`,visibility:"visible"}),u=x.split("-")[0],P&&(P.position=u)}).catch(()=>{c.style.visibility="visible"})});const g=h=>{const f=h.target.closest(".wg__toolbar-btn");if(f&&!f.disabled){const m=f.dataset.toolbarItem||"",v=i.find(p=>p.id===m);v&&n(v)}};d.addEventListener("click",g),P={container:d,toolbar:c,rowIndex:e,rowItem:r,position:u,hasRowMoved:!1,cursorX:s,cleanup:()=>{d.removeEventListener("click",g),d.remove()}},Y={path:null,arrowPos:null,arrowDir:"right"}}function ee(){P&&(P.cleanup(),P=null),Y={path:null,arrowPos:null,arrowDir:"right"}}function It(){return(P==null?void 0:P.rowIndex)??null}function ro(o){return(P==null?void 0:P.container.getRootNode())===o}function ye(o){return(P==null?void 0:P.rowIndex)===o}function nr(){return Y}function no(o,t){if(!P){Y={path:null,arrowPos:null,arrowDir:"right"};return}const{toolbar:e,rowItem:i,position:r}=P,n=t.findIndex(b=>b===i);if(n===-1){Y={path:null,arrowPos:null,arrowDir:"right"};return}const s=o.shadow.querySelector(`tr[data-row-index="${n}"]`);if(!s){Y={path:null,arrowPos:null,arrowDir:"right"};return}if(n===P.rowIndex||(P.hasRowMoved=!0),!P.hasRowMoved){Y={path:null,arrowPos:null,arrowDir:"right"};return}const l=e.getBoundingClientRect(),d=s.getBoundingClientRect(),c=o.shadow.querySelector(".wg__table"),u=c==null?void 0:c.getBoundingClientRect(),g=o.shadow.querySelector(".wg"),h=g==null?void 0:g.getBoundingClientRect();if(!u||!h){Y={path:null,arrowPos:null,arrowDir:"right"};return}const f=document.dir==="rtl"||document.documentElement.dir==="rtl",m=d.top+d.height/2,v=d.bottom<=h.top,p=d.top>=h.bottom,C=!v&&!p;let _,S="right";if(v?(_=h.top+8,S="up"):p?(_=h.bottom-8,S="down"):_=m,r==="left"){const b=l.right,y=l.top+l.height/2,k=f?h.right+15:h.left-15;if(!C){Y={path:`M ${b} ${y} H ${k} V ${_}`,arrowPos:{x:k,y:_},arrowDir:S};return}const x=f?h.right-8:h.left+8;S=f?"left":"right",Y={path:`M ${b} ${y} H ${k} V ${_} H ${x}`,arrowPos:{x,y:_},arrowDir:S};return}else if(r==="right"){const b=l.left,y=l.top+l.height/2,k=f?h.left-15:h.right+15;if(!C){Y={path:`M ${b} ${y} H ${k} V ${_}`,arrowPos:{x:k,y:_},arrowDir:S};return}const x=f?h.left+8:h.right-8;S=f?"right":"left",Y={path:`M ${b} ${y} H ${k} V ${_} H ${x}`,arrowPos:{x,y:_},arrowDir:S};return}else{const y=l.right,k=l.top+l.height/2,x=y+48,M=n-P.rowIndex,R=8;if(M===0){let T=d.top-R;p&&(T=h.bottom-R),Y={path:`M ${y} ${k} H ${x} V ${T}`,arrowPos:{x,y:T},arrowDir:"down"};return}else if(M===-1){const H=l.top+l.height*.25,A=l.top+l.height*.75,z=l.right+24,L=l.right+R;Y={path:`M ${l.right} ${H} H ${z} V ${A} H ${L}`,arrowPos:{x:L,y:A},arrowDir:"left"};return}else if(M<0){let T=d.bottom+R;v&&(T=h.top+R),Y={path:`M ${y} ${k} H ${x} V ${T}`,arrowPos:{x,y:T},arrowDir:"up"};return}else{let T=d.top-R;p&&(T=h.bottom-R),Y={path:`M ${y} ${k} H ${x} V ${T}`,arrowPos:{x,y:T},arrowDir:"down"};return}}}function so(o,t,e="Row actions"){return`<button
126
+ class="wg__toolbar-trigger ${t?"wg__toolbar-trigger--active":""}"
127
+ data-toolbar-trigger="${o}"
128
+ title="${e}"
129
+ >⋮</button>`}const Ce=40;function Se(o){if(!o||o==="auto")return 150;const t=o.match(/^([\d.]+)(px|em|rem|%)?$/);if(!t)return 150;const e=parseFloat(t[1]);switch(t[2]||"px"){case"px":return e;case"em":return e*16;case"rem":return e*10;case"%":return 150;default:return e}}function sr(o){const t=["wg"];return o.grid.striped&&t.push("wg--striped"),o.grid.hoverable&&t.push("wg--hoverable"),o.grid.editable&&t.push("wg--editable"),o.grid.isNavigateMode&&t.push("wg--navigate-mode"),o.grid.allowColumnReorder&&t.push("wg--reorderable"),t.join(" ")}function lr(o){const t=o.grid.visualColumns;if(t.length===0)return"";let e=0,i="";if(o.grid.showRowNumbers){const d=o.grid.stickyRowNumbers;i=`<th class="wg__header wg__row-number-header${d?" wg__header--frozen":""}" style="${d?"position: sticky; left: 0; z-index: 4;":""}">#</th>`,e+=Ce}const n=o.grid.showRowToolbar&&o.grid.toolbarPosition==="inline"?`<th class="wg__header wg__inline-actions-header">${o.escapeHtml(o.grid.inlineActionsTitle||o.grid.labels.inlineActionsHeader)}</th>`:"",a=o.grid.showRowToolbar&&o.grid.toolbarTrigger==="button"&&o.grid.toolbarPosition!=="inline"?'<th class="wg__header wg__actions-column"></th>':"",l=t.map(({column:d,originalIndex:c},u)=>{const g=String(d.field),h=d.sortable!==!1&&o.grid.sortMode!=="none",f=o.grid.getColumnSortState(g),m=o.grid.getColumnSortPriority(g),v=f!==void 0,p=o.grid.isColumnFrozen(u),C=p&&u===o.grid.totalFrozenColumns-1,_=["wg__header"];h&&_.push("wg__header--sortable"),v&&_.push("wg__header--sorted"),p&&_.push("wg__header--frozen"),C&&_.push("wg__header--frozen-last");const b=o.grid.getColumnWidth(g)||d.width||d.maxWidth,y=Se(b),k=d.minWidth,M=`style="${[p?"position: sticky":"",p?`left: ${e}px`:"",p?"z-index: 2":"",b?`width: ${b}`:"",k?`min-width: ${k}`:"",`text-align: ${d.align||"left"}`].filter(Boolean).join("; ")}"`;p&&(e+=y);let R="";if(h)if(v){const z=f.direction==="asc"?"▲":"▼",L=o.grid.sort.length>1?`<sup class="wg__sort-priority">${m}</sup>`:"";R=`<span class="wg__sort-indicator">${z}${L}</span>`}else R='<span class="wg__sort-indicator wg__sort-placeholder">⬍</span>';let T="";d.headerInfo&&(T=`<span class="wg__header-info" data-tooltip="${o.escapeHtml(d.headerInfo)}"><svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"/><path d="M12 16v-4"/><path d="M12 8h.01"/></svg></span>`);const A=d.resizable!==!1?`<div class="wg__resize-handle" data-field="${g}"></div>`:"";return`
130
+ <th class="${_.join(" ")}" ${M} data-field="${g}">
131
131
  <div class="wg__header-content">
132
- <span class="wg__header-title">${e.escapeHtml(a.title)}</span>
133
- ${m}
134
- ${_}
132
+ <span class="wg__header-title">${o.escapeHtml(d.title)}</span>
133
+ ${T}
134
+ ${R}
135
135
  </div>
136
+ ${A}
136
137
  </th>
137
- `}).join("");return`<tr>${t}${r}${s}${c}</tr>`}function $i(e){const o=e.grid.displayItems,t=e.grid.columns,i=e.grid.showRowNumbers,r=e.grid.showRowToolbar&&e.grid.toolbarPosition==="inline",n=e.grid.showRowToolbar&&e.grid.toolbarTrigger==="button"&&e.grid.toolbarPosition!=="inline",s=t.length+(n?1:0)+(i?1:0)+(r?1:0);if(o.length===0)return`
138
+ `}).join("");return`<tr>${i}${n}${a}${l}</tr>`}function ar(o){const t=o.grid.displayItems,e=o.grid.visualColumns,i=o.grid.showRowNumbers,r=o.grid.stickyRowNumbers,n=o.grid.showRowToolbar&&o.grid.toolbarPosition==="inline",s=o.grid.showRowToolbar&&o.grid.toolbarTrigger==="button"&&o.grid.toolbarPosition!=="inline",a=e.length+(s?1:0)+(i?1:0)+(n?1:0);if(t.length===0)return`
138
139
  <tr>
139
- <td class="wg__empty" colspan="${s}">
140
+ <td class="wg__empty" colspan="${a}">
140
141
  No items to display
141
142
  </td>
142
143
  </tr>
143
- `;const c=yt();return o.map((a,l)=>{const g=e.grid.getRowLockInfo(a),d=(g==null?void 0:g.isLocked)===!0;let h="";if(i)if(d){const _=g!=null&&g.lockedBy?`Locked by ${g.lockedBy}`:"This row is locked";h=`<td class="wg__cell wg__row-number wg__row-number--locked" data-tooltip="${e.escapeHtml(_)}">🔒</td>`}else h=`<td class="wg__cell wg__row-number">${l+1}</td>`;const u=r?Ne(e,a,l):"";let p="";n&&(p=`
144
+ `;const l=It(),d=e.map(({column:c})=>Se(c.width||c.maxWidth));return t.map((c,u)=>{const g=o.grid.getRowLockInfo(c),h=(g==null?void 0:g.isLocked)===!0;let f=0,m="";if(i){const b=r?"position: sticky; left: 0; z-index: 2;":"",y=r?" wg__cell--frozen":"";if(h){const k=g!=null&&g.lockedBy?`Locked by ${g.lockedBy}`:"This row is locked";m=`<td class="wg__cell wg__row-number wg__row-number--locked${y}" style="${b}" data-tooltip="${o.escapeHtml(k)}" data-row-number="${u}">🔒</td>`}else m=`<td class="wg__cell wg__row-number${y}" style="${b}" data-row-number="${u}">${u+1}</td>`;f+=Ce}const v=n?lo(o,c,u):"";let p="";s&&(p=`
144
145
  <td class="wg__cell wg__actions-column">
145
- ${Ye(l,c===l,e.grid.labels.rowActions)}
146
+ ${so(u,l===u,o.grid.labels.rowActions)}
146
147
  </td>
147
- `);const b=t.map((_,m)=>{const C=String(_.field),y=e.grid.getCellValue(a,_,l),S=_.align||"left",k=e.grid.isCellEditable(_),x=e.grid.isCellFocused(l,m),E=["wg__cell"],$=e.grid.isEditing(l,C);if(k&&E.push("wg__cell--editable"),x&&!$&&E.push("wg__cell--focused"),_.textOverflow==="ellipsis"&&E.push("wg__cell--ellipsis"),$&&E.push("wg__cell--editing"),e.grid.isCellInvalid(l,C)&&E.push("wg__cell--invalid"),_.cellClass&&E.push(_.cellClass),_.cellClassCallback){const T=e.grid.getCellRawValue(a,l,C),M=_.cellClassCallback(T,a);M&&E.push(M)}const R=[`text-align: ${S}`,_.width?`width: ${_.width}`:"",_.minWidth?`min-width: ${_.minWidth}`:"",_.maxWidth?`max-width: ${_.maxWidth}`:""].filter(Boolean).join("; "),L=e.grid.isNavigateMode?'tabindex="0"':"";let D="";if(_.tooltipCallback){const T=e.grid.getCellRawValue(a,l,C),M=_.tooltipCallback(T,a);M&&(D=`data-tooltip="${e.escapeHtml(M)}"`)}else if(_.tooltipMember){const T=a[_.tooltipMember];T&&typeof T=="string"&&(D=`data-tooltip="${e.escapeHtml(T)}"`)}if(!D&&e.grid.isCellInvalid(l,C)){const T=e.grid.getCellValidationError(l,C);if(T){const M=_.validationTooltipCallback||e.grid.validationTooltipCallback;if(M){const F=e.grid.getCellRawValue(a,l,C),P=M({field:C,error:T,value:F,row:a,rowIndex:l});P&&(D=`data-tooltip-html="${e.escapeHtml(P)}"`)}D||(D=`data-tooltip="${e.escapeHtml(T)}"`)}}return`
148
+ `);const C=e.map(({column:b,originalIndex:y},k)=>{const x=String(b.field),M=o.grid.getCellValue(c,b,u),R=b.align||"left",T=o.grid.isCellEditable(b),H=o.grid.isCellFocused(u,y),A=o.grid.isColumnFrozen(k),z=A&&k===o.grid.totalFrozenColumns-1,L=["wg__cell"],D=o.grid.isEditing(u,x);if(T&&L.push("wg__cell--editable"),H&&!D&&L.push("wg__cell--focused"),b.textOverflow==="ellipsis"&&L.push("wg__cell--ellipsis"),D&&L.push("wg__cell--editing"),o.grid.isCellInvalid(u,x)&&L.push("wg__cell--invalid"),A&&L.push("wg__cell--frozen"),z&&L.push("wg__cell--frozen-last"),b.cellClass&&L.push(b.cellClass),b.cellClassCallback){const J=o.grid.getCellRawValue(c,u,x),W=b.cellClassCallback(J,c);W&&L.push(W)}const q=o.grid.getColumnWidth(x)||b.width,O=b.minWidth,Wt=[A?"position: sticky":"",A?`left: ${f}px`:"",A?"z-index: 1":"",`text-align: ${R}`,q?`width: ${q}`:"",O?`min-width: ${O}`:"",b.maxWidth?`max-width: ${b.maxWidth}`:""].filter(Boolean).join("; ");A&&(f+=d[k]);const Pe=o.grid.isNavigateMode?'tabindex="0"':"";let ft="";if(b.tooltipCallback){const J=o.grid.getCellRawValue(c,u,x),W=b.tooltipCallback(J,c);W&&(ft=`data-tooltip="${o.escapeHtml(W)}"`)}else if(b.tooltipMember){const J=c[b.tooltipMember];J&&typeof J=="string"&&(ft=`data-tooltip="${o.escapeHtml(J)}"`)}if(!ft&&o.grid.isCellInvalid(u,x)){const J=o.grid.getCellValidationError(u,x);if(J){const W=b.validationTooltipCallback||o.grid.validationTooltipCallback;if(W){const He=o.grid.getCellRawValue(c,u,x),Z=W({field:x,error:J,value:He,row:c,rowIndex:u});Z&&(ft=`data-tooltip-html="${o.escapeHtml(Z)}"`)}ft||(ft=`data-tooltip="${o.escapeHtml(J)}"`)}}return`
148
149
  <td
149
- class="${E.join(" ")}"
150
- style="${R}"
151
- data-row="${l}"
152
- data-col="${m}"
153
- data-field="${C}"
154
- ${L}
155
- ${D}
150
+ class="${L.join(" ")}"
151
+ style="${Wt}"
152
+ data-row="${u}"
153
+ data-col="${y}"
154
+ data-field="${x}"
155
+ ${Pe}
156
+ ${ft}
156
157
  >
157
- ${e.grid.isEditing(l,C)?Ft(e,l,m,_):ne(e,l,m,_,y)}
158
+ ${o.grid.isEditing(u,x)?te(o,u,y,b):_e(o,u,y,b,M)}
158
159
  </td>
159
- `}).join(""),v=["wg__row"];if(d&&v.push("wg__row--locked"),e.grid.rowClassCallback){const _=e.grid.rowClassCallback(a,l);_&&v.push(_)}const w=d&&!i?`data-tooltip="${e.escapeHtml(g!=null&&g.lockedBy?`Locked by ${g.lockedBy}`:"This row is locked")}"`:"";return`<tr class="${v.join(" ")}" data-row-index="${l}" ${w}>${h}${u}${p}${b}</tr>`}).join("")}function Ne(e,o,t){const r=se(e.grid.rowToolbar).filter(a=>typeof a.hidden=="function"?!a.hidden(o,t):!a.hidden),n=new Map;for(const a of r){const l=a.row??1;n.has(l)||n.set(l,[]),n.get(l).push(a)}return`<td class="wg__cell wg__inline-actions-cell"><div class="wg__inline-actions-wrap">${[...n.keys()].sort((a,l)=>a-l).map(a=>`<div class="wg__inline-actions-row">${n.get(a).map(d=>{const h=typeof d.disabled=="function"?d.disabled(o,t):d.disabled,u=["wg__inline-action-btn",d.danger?"wg__inline-action-btn--danger":"",h?"wg__inline-action-btn--disabled":""].filter(Boolean).join(" "),p=h?"disabled":"";return`<button class="${u}" data-action-id="${d.id}" data-row="${t}" title="${e.escapeHtml(d.title)}" ${p}>${d.icon}</button>`}).join("")}</div>`).join("")}</div></td>`}function Be(e,o){const t=e.grid.displayItems,i=e.grid.columns,{startIndex:r,endIndex:n,rowHeight:s,totalItems:c}=o,a=e.grid.showRowNumbers,l=e.grid.showRowToolbar&&e.grid.toolbarPosition==="inline",g=e.grid.showRowToolbar&&e.grid.toolbarTrigger==="button"&&e.grid.toolbarPosition!=="inline",d=i.length+(g?1:0)+(a?1:0)+(l?1:0);if(t.length===0)return`
160
+ `}).join(""),_=["wg__row"];if(h&&_.push("wg__row--locked"),o.grid.isRowSelected(u)&&_.push("wg__row--selected"),o.grid.rowClassCallback){const b=o.grid.rowClassCallback(c,u);b&&_.push(b)}const S=h&&!i?`data-tooltip="${o.escapeHtml(g!=null&&g.lockedBy?`Locked by ${g.lockedBy}`:"This row is locked")}"`:"";return`<tr class="${_.join(" ")}" data-row-index="${u}" ${S}>${m}${v}${p}${C}</tr>`}).join("")}function lo(o,t,e){const r=ve(o.grid.rowToolbar).filter(l=>typeof l.hidden=="function"?!l.hidden(t,e):!l.hidden),n=new Map;for(const l of r){const d=l.row??1;n.has(d)||n.set(d,[]),n.get(d).push(l)}return`<td class="wg__cell wg__inline-actions-cell"><div class="wg__inline-actions-wrap">${[...n.keys()].sort((l,d)=>l-d).map(l=>`<div class="wg__inline-actions-row">${n.get(l).map(u=>{const g=typeof u.disabled=="function"?u.disabled(t,e):u.disabled,h=["wg__inline-action-btn",u.danger?"wg__inline-action-btn--danger":"",g?"wg__inline-action-btn--disabled":""].filter(Boolean).join(" "),f=g?"disabled":"";return`<button class="${h}" data-action-id="${u.id}" data-row="${e}" title="${o.escapeHtml(u.title)}" ${f}>${u.icon}</button>`}).join("")}</div>`).join("")}</div></td>`}function ao(o,t){const e=o.grid.displayItems,i=o.grid.visualColumns,{startIndex:r,endIndex:n,rowHeight:s,totalItems:a}=t,l=o.grid.showRowNumbers,d=o.grid.stickyRowNumbers,c=o.grid.showRowToolbar&&o.grid.toolbarPosition==="inline",u=o.grid.showRowToolbar&&o.grid.toolbarTrigger==="button"&&o.grid.toolbarPosition!=="inline",g=i.length+(u?1:0)+(l?1:0)+(c?1:0);if(e.length===0)return`
160
161
  <tr>
161
- <td class="wg__empty" colspan="${d}">
162
+ <td class="wg__empty" colspan="${g}">
162
163
  No items to display
163
164
  </td>
164
165
  </tr>
165
- `;const h=yt(),u=r*s,p=(c-n)*s,b=u>0?`<tr class="wg__spacer-top"><td colspan="${d}" style="height: ${u}px"></td></tr>`:"",v=[];for(let _=r;_<n&&_<t.length;_++){const m=t[_],C=_,y=e.grid.getRowLockInfo(m),S=(y==null?void 0:y.isLocked)===!0;let k="";if(a)if(S){const D=y!=null&&y.lockedBy?`Locked by ${y.lockedBy}`:"This row is locked";k=`<td class="wg__cell wg__row-number wg__row-number--locked" data-tooltip="${e.escapeHtml(D)}">🔒</td>`}else k=`<td class="wg__cell wg__row-number">${C+1}</td>`;const x=l?Ne(e,m,C):"";let E="";g&&(E=`
166
+ `;const h=It(),f=i.map(({column:S})=>Se(S.width||S.maxWidth)),m=r*s,v=(a-n)*s,p=m>0?`<tr class="wg__spacer-top"><td colspan="${g}" style="height: ${m}px"></td></tr>`:"",C=[];for(let S=r;S<n&&S<e.length;S++){const b=e[S],y=S,k=o.grid.getRowLockInfo(b),x=(k==null?void 0:k.isLocked)===!0;let M=0,R="";if(l){const D=d?"position: sticky; left: 0; z-index: 2;":"",F=d?" wg__cell--frozen":"";if(x){const q=k!=null&&k.lockedBy?`Locked by ${k.lockedBy}`:"This row is locked";R=`<td class="wg__cell wg__row-number wg__row-number--locked${F}" style="${D}" data-tooltip="${o.escapeHtml(q)}" data-row-number="${y}">🔒</td>`}else R=`<td class="wg__cell wg__row-number${F}" style="${D}" data-row-number="${y}">${y+1}</td>`;M+=Ce}const T=c?lo(o,b,y):"";let H="";u&&(H=`
166
167
  <td class="wg__cell wg__actions-column">
167
- ${Ye(C,h===C,e.grid.labels.rowActions)}
168
+ ${so(y,h===y,o.grid.labels.rowActions)}
168
169
  </td>
169
- `);const $=i.map((D,T)=>{const M=String(D.field),F=e.grid.getCellValue(m,D,C),P=D.align||"left",j=e.grid.isCellEditable(D),ot=e.grid.isCellFocused(C,T),it=["wg__cell"],oo=e.grid.isEditing(C,M);if(j&&it.push("wg__cell--editable"),ot&&!oo&&it.push("wg__cell--focused"),D.textOverflow==="ellipsis"&&it.push("wg__cell--ellipsis"),oo&&it.push("wg__cell--editing"),e.grid.isCellInvalid(C,M)&&it.push("wg__cell--invalid"),D.cellClass&&it.push(D.cellClass),D.cellClassCallback){const J=e.grid.getCellRawValue(m,C,M),dt=D.cellClassCallback(J,m);dt&&it.push(dt)}const pr=[`text-align: ${P}`,D.width?`width: ${D.width}`:"",D.minWidth?`min-width: ${D.minWidth}`:"",D.maxWidth?`max-width: ${D.maxWidth}`:""].filter(Boolean).join("; "),fr=e.grid.isNavigateMode?'tabindex="0"':"";let ft="";if(D.tooltipCallback){const J=e.grid.getCellRawValue(m,C,M),dt=D.tooltipCallback(J,m);dt&&(ft=`data-tooltip="${e.escapeHtml(dt)}"`)}else if(D.tooltipMember){const J=m[D.tooltipMember];J&&typeof J=="string"&&(ft=`data-tooltip="${e.escapeHtml(J)}"`)}if(!ft&&e.grid.isCellInvalid(C,M)){const J=e.grid.getCellValidationError(C,M);if(J){const dt=D.validationTooltipCallback||e.grid.validationTooltipCallback;if(dt){const wr=e.grid.getCellRawValue(m,C,M),io=dt({field:M,error:J,value:wr,row:m,rowIndex:C});io&&(ft=`data-tooltip-html="${e.escapeHtml(io)}"`)}ft||(ft=`data-tooltip="${e.escapeHtml(J)}"`)}}return`
170
+ `);const A=i.map(({column:D,originalIndex:F},q)=>{const O=String(D.field),Wt=o.grid.getCellValue(b,D,y),Pe=D.align||"left",ft=o.grid.isCellEditable(D),J=o.grid.isCellFocused(y,F),W=o.grid.isColumnFrozen(q),He=W&&q===o.grid.totalFrozenColumns-1,Z=["wg__cell"],Lo=o.grid.isEditing(y,O);if(ft&&Z.push("wg__cell--editable"),J&&!Lo&&Z.push("wg__cell--focused"),D.textOverflow==="ellipsis"&&Z.push("wg__cell--ellipsis"),Lo&&Z.push("wg__cell--editing"),o.grid.isCellInvalid(y,O)&&Z.push("wg__cell--invalid"),W&&Z.push("wg__cell--frozen"),He&&Z.push("wg__cell--frozen-last"),D.cellClass&&Z.push(D.cellClass),D.cellClassCallback){const st=o.grid.getCellRawValue(b,y,O),vt=D.cellClassCallback(st,b);vt&&Z.push(vt)}const Oo=o.grid.getColumnWidth(O)||D.width,Ao=D.minWidth,kn=[W?"position: sticky":"",W?`left: ${M}px`:"",W?"z-index: 1":"",`text-align: ${Pe}`,Oo?`width: ${Oo}`:"",Ao?`min-width: ${Ao}`:"",D.maxWidth?`max-width: ${D.maxWidth}`:""].filter(Boolean).join("; ");W&&(M+=f[q]);const xn=o.grid.isNavigateMode?'tabindex="0"':"";let Dt="";if(D.tooltipCallback){const st=o.grid.getCellRawValue(b,y,O),vt=D.tooltipCallback(st,b);vt&&(Dt=`data-tooltip="${o.escapeHtml(vt)}"`)}else if(D.tooltipMember){const st=b[D.tooltipMember];st&&typeof st=="string"&&(Dt=`data-tooltip="${o.escapeHtml(st)}"`)}if(!Dt&&o.grid.isCellInvalid(y,O)){const st=o.grid.getCellValidationError(y,O);if(st){const vt=D.validationTooltipCallback||o.grid.validationTooltipCallback;if(vt){const Dn=o.grid.getCellRawValue(b,y,O),Po=vt({field:O,error:st,value:Dn,row:b,rowIndex:y});Po&&(Dt=`data-tooltip-html="${o.escapeHtml(Po)}"`)}Dt||(Dt=`data-tooltip="${o.escapeHtml(st)}"`)}}return`
170
171
  <td
171
- class="${it.join(" ")}"
172
- style="${pr}"
173
- data-row="${C}"
174
- data-col="${T}"
175
- data-field="${M}"
176
- ${fr}
177
- ${ft}
172
+ class="${Z.join(" ")}"
173
+ style="${kn}"
174
+ data-row="${y}"
175
+ data-col="${F}"
176
+ data-field="${O}"
177
+ ${xn}
178
+ ${Dt}
178
179
  >
179
- ${e.grid.isEditing(C,M)?Ft(e,C,T,D):ne(e,C,T,D,F)}
180
+ ${o.grid.isEditing(y,O)?te(o,y,F,D):_e(o,y,F,D,Wt)}
180
181
  </td>
181
- `}).join(""),R=["wg__row"];if(S&&R.push("wg__row--locked"),e.grid.rowClassCallback){const D=e.grid.rowClassCallback(m,C);D&&R.push(D)}const L=S&&!a?`data-tooltip="${e.escapeHtml(y!=null&&y.lockedBy?`Locked by ${y.lockedBy}`:"This row is locked")}"`:"";v.push(`<tr class="${R.join(" ")}" data-row-index="${C}" ${L}>${k}${x}${E}${$}</tr>`)}const w=p>0?`<tr class="wg__spacer-bottom"><td colspan="${d}" style="height: ${p}px"></td></tr>`:"";return b+v.join("")+w}function le(e,o="bottom-center"){const t=e.grid.showPagination;if(!e.grid.pageable||t===!1||t==="auto"&&e.grid.totalPages<=1)return"";const i=e.grid.currentPage,r=e.grid.totalPages,n=e.grid.pageSize,s=e.grid.pageSizes,c=e.grid.totalItems!==null?e.grid.totalItems:e.grid.sortedItems.length,a=e.grid.labels,l={first:a.paginationFirst,previous:a.paginationPrevious,next:a.paginationNext,last:a.paginationLast,pageInfo:a.paginationPageInfo.replace("{current}",String(i)).replace("{total}",String(r)),itemCount:a.paginationItemCount.replace("{count}",String(c)),perPage:a.paginationPerPage},g=e.grid.paginationLabelsCallback,d=g?g({currentPage:i,totalPages:r,totalItems:c,pageSize:n}):{},h={...l,...d},u=o.startsWith("top-"),p=o.replace("top-","").replace("bottom-",""),b=["wg__pagination"];p==="left"?b.push("wg__pagination--left"):p==="right"&&b.push("wg__pagination--right"),u&&b.push("wg__pagination--top");const v={first:`
182
+ `}).join(""),z=["wg__row"];if(x&&z.push("wg__row--locked"),o.grid.isRowSelected(y)&&z.push("wg__row--selected"),o.grid.rowClassCallback){const D=o.grid.rowClassCallback(b,y);D&&z.push(D)}const L=x&&!l?`data-tooltip="${o.escapeHtml(k!=null&&k.lockedBy?`Locked by ${k.lockedBy}`:"This row is locked")}"`:"";C.push(`<tr class="${z.join(" ")}" data-row-index="${y}" ${L}>${R}${T}${H}${A}</tr>`)}const _=v>0?`<tr class="wg__spacer-bottom"><td colspan="${g}" style="height: ${v}px"></td></tr>`:"";return p+C.join("")+_}function ke(o,t="bottom-center"){const e=o.grid.showPagination;if(!o.grid.pageable||e===!1||e==="auto"&&o.grid.totalPages<=1)return"";const i=o.grid.currentPage,r=o.grid.totalPages,n=o.grid.pageSize,s=o.grid.pageSizes,a=o.grid.totalItems!==null?o.grid.totalItems:o.grid.sortedItems.length,l=o.grid.labels,d={first:l.paginationFirst,previous:l.paginationPrevious,next:l.paginationNext,last:l.paginationLast,pageInfo:l.paginationPageInfo.replace("{current}",String(i)).replace("{total}",String(r)),itemCount:l.paginationItemCount.replace("{count}",String(a)),perPage:l.paginationPerPage},c=o.grid.paginationLabelsCallback,u=c?c({currentPage:i,totalPages:r,totalItems:a,pageSize:n}):{},g={...d,...u},h=t.startsWith("top-"),f=t.replace("top-","").replace("bottom-",""),m=["wg__pagination"];f==="left"?m.push("wg__pagination--left"):f==="right"&&m.push("wg__pagination--right"),h&&m.push("wg__pagination--top");const v={first:`
182
183
  <button class="wg__pagination-btn" data-action="first" ${i===1?"disabled":""}>
183
- ${h.first}
184
+ ${g.first}
184
185
  </button>
185
186
  `,previous:`
186
187
  <button class="wg__pagination-btn" data-action="prev" ${i===1?"disabled":""}>
187
- ${h.previous}
188
+ ${g.previous}
188
189
  </button>
189
190
  `,next:`
190
191
  <button class="wg__pagination-btn" data-action="next" ${i===r?"disabled":""}>
191
- ${h.next}
192
+ ${g.next}
192
193
  </button>
193
194
  `,last:`
194
195
  <button class="wg__pagination-btn" data-action="last" ${i===r?"disabled":""}>
195
- ${h.last}
196
+ ${g.last}
196
197
  </button>
197
198
  `,pageInfo:`
198
199
  <div class="wg__pagination-info">
199
- ${h.pageInfo}
200
- <span class="wg__pagination-count">${h.itemCount}</span>
200
+ ${g.pageInfo}
201
+ <span class="wg__pagination-count">${g.itemCount}</span>
201
202
  </div>
202
203
  `,pageSize:s.length>0?`
203
204
  <div class="wg__pagination-pagesize">
204
205
  <select class="wg__pagination-select" data-action="pagesize">
205
- ${s.map(m=>`<option value="${m}" ${m===n?"selected":""}>${m}</option>`).join("")}
206
+ ${s.map(_=>`<option value="${_}" ${_===n?"selected":""}>${_}</option>`).join("")}
206
207
  </select>
207
- <span class="wg__pagination-label">${h.perPage}</span>
208
+ <span class="wg__pagination-label">${g.perPage}</span>
208
209
  </div>
209
- `:""},_=e.grid.paginationLayout.split("|").map(m=>m.trim()).map(m=>v[m]||"").join("");return`<div class="${b.join(" ")}">${_}</div>`}function de(e,o){const t=e.grid.summaryContentCallback;if(!t)return"";const i=e.grid.currentPage,r=e.grid.pageSize,n=e.grid.sortedItems,s=e.grid.displayItems,c=e.grid.totalItems!==null?e.grid.totalItems:n.length,a=t({items:s,allItems:n,totalItems:c,currentPage:i,pageSize:r,metadata:e.grid.summaryMetadata}),l=o.startsWith("top-"),g=o.replace("top-","").replace("bottom-",""),d=["wg__summary"];return g==="left"?d.push("wg__summary--left"):g==="right"&&d.push("wg__summary--right"),l&&d.push("wg__summary--top"),`<div class="${d.join(" ")}">${a}</div>`}function B(e,o,t,i={}){const r=e.grid.columns[t];if(!r)return;const n=e.shadow.querySelector(`td[data-row="${o}"][data-col="${t}"]`);if(!n)return;const s=String(r.field),c=e.grid.displayItems[o];if(!c)return;const a=e.grid.isEditing(o,s),l=e.grid.isCellFocused(o,t),g=e.grid.isCellEditable(r),d=e.grid.isCellInvalid(o,s),h=["wg__cell"];if(g&&h.push("wg__cell--editable"),l&&!a&&h.push("wg__cell--focused"),r.textOverflow==="ellipsis"&&h.push("wg__cell--ellipsis"),a&&h.push("wg__cell--editing"),d&&h.push("wg__cell--invalid"),r.cellClass&&h.push(r.cellClass),r.cellClassCallback){const u=e.grid.getCellRawValue(c,o,s),p=r.cellClassCallback(u,c);p&&h.push(p)}if(n.className=h.join(" "),a)n.innerHTML=Ft(e,o,t,r),i.focusEditor&&Mi(e,n,r,i);else{const u=e.grid.getCellValue(c,r,o);n.innerHTML=ne(e,o,t,r,u)}}function Mi(e,o,t,i){var n;let r=o.querySelector(".wg__combobox-input, .wg__autocomplete-input, .wg__select-trigger, .wg__date-input");if(r||(r=o.querySelector(".wg__editor")),!!r&&(r.focus(),r instanceof HTMLInputElement&&r.type==="text")){const s=i.cursorPosition,c=((n=t.editorOptions)==null?void 0:n.editStartSelection)||e.grid.editStartSelection;if(i.initialSearchQuery!==void 0){const a=r.value.length;r.setSelectionRange(a,a)}else switch(c){case"mousePosition":if(s!==void 0){const a=Math.min(s,r.value.length);r.setSelectionRange(a,a)}else r.setSelectionRange(r.value.length,r.value.length);break;case"cursorAtStart":r.setSelectionRange(0,0);break;case"cursorAtEnd":r.setSelectionRange(r.value.length,r.value.length);break;case"selectAll":default:r.select();break}}}function Ue(e,o,t=!0){const i=e.dropdownOptions[o];if(!i)return;const r=e.grid.editingCell;if(!r)return;const n=e.getCurrentEditorOptions();if(xt(i,n))return;const s=gt(i,n),c=e.grid.columns.findIndex(l=>String(l.field)===r.field),a=e.grid.displayItems[r.rowIndex];n.onselect&&a&&n.onselect(i,a),e.justSelected=!0,e.isCommittingFromKeyboard=!0,O(e),e.grid.commitEdit(r.rowIndex,r.field,s),t?e.moveFocusAfterCommit(r.rowIndex,r.field,"down"):B(e,r.rowIndex,c),requestAnimationFrame(()=>{e.justSelected=!1})}function nt(e){const o=e.shadow.querySelector(".wg__dropdown");if(!o)return;o.querySelectorAll(".wg__dropdown-option").forEach((i,r)=>{i.classList.toggle("wg__dropdown-option--highlighted",r===e.highlightedIndex)})}function je(e){const o=e.shadow.querySelector(".wg__dropdown-option--highlighted");o==null||o.scrollIntoView({block:"nearest"})}function ce(e,o){const t=e.shadow.querySelector(".wg__loading-indicator");t&&(t.style.display=o?"inline":"none");const i=e.shadow.querySelector(".wg__editor--autocomplete .wg__combobox-toggle");i&&(i.style.display=o?"none":"inline")}function G(e){if(e.justSelected)return;const o=e.getCurrentEditingColumn();if(!o)return;const t=o.editorOptions||{},i=o.editor;let r=0;if(i==="select"){const l=t.options||[];if(e.filterText){const g=e.filterText.toLowerCase();e.dropdownOptions=l.filter(d=>kt(d,t).toLowerCase().includes(g)),r=e.dropdownOptions.length>0?0:-1}else{e.dropdownOptions=l;const g=e.grid.editingCell;if(g){const d=e.grid.displayItems[g.rowIndex],h=d?d[g.field]:void 0,u=e.dropdownOptions.findIndex(p=>gt(p,t)===h);r=u>=0?u:0}else r=e.dropdownOptions.length>0?0:-1}}else if(i==="combobox"||i==="autocomplete"){const l=i==="autocomplete"?t.initialOptions||t.options||[]:t.options||[],g=e.grid.editingCell;let d;if(g){const u=e.grid.displayItems[g.rowIndex];d=u?u[g.field]:void 0}const h=l.findIndex(u=>gt(u,t)===d);if(h>=0)e.dropdownOptions=l,r=h;else if(d!=null&&d!==""){const u=t.valueMember||"value",p=t.displayMember||"label",b=String(d),v={value:d,label:b,[u]:d,[p]:b};e.dropdownOptions=[v,...l],r=0}else e.dropdownOptions=l,r=l.length>0?0:-1}const n=e.grid.editingCell;if(!n)return;const{rowIndex:s,field:c}=n,a=e.shadow.querySelector(`.wg__editor--select[data-row="${s}"][data-field="${c}"],
210
- .wg__editor--combobox[data-row="${s}"][data-field="${c}"],
211
- .wg__editor--autocomplete[data-row="${s}"][data-field="${c}"]`);if(a&&e.dropdownOptions.length>0){const l=e.filterText;e.isOpeningDropdown=!0;const g=ht(e,a,e.dropdownOptions,t);pt(e,g),e.filterText=l,e.highlightedIndex=r,nt(e);const d=e.shadow.querySelector(`.wg__select-trigger[data-row="${s}"][data-field="${c}"]`),h=e.shadow.querySelector(`.wg__combobox-input[data-row="${s}"][data-field="${c}"],
212
- .wg__autocomplete-input[data-row="${s}"][data-field="${c}"]`),u=d||h;u&&u.focus(),requestAnimationFrame(()=>{e.isOpeningDropdown=!1})}}function Ke(e){e.dropdownOpen?O(e):G(e)}function pt(e,o){o.addEventListener("mousedown",t=>{t.preventDefault();const i=t.target.closest(".wg__dropdown-option");if(i&&!i.hasAttribute("data-disabled")){const r=parseInt(i.getAttribute("data-index")||"0",10);Ue(e,r,!1)}}),o.addEventListener("mouseover",t=>{const i=t.target.closest(".wg__dropdown-option");i&&!i.hasAttribute("data-disabled")&&(e.highlightedIndex=parseInt(i.getAttribute("data-index")||"0",10),nt(e))})}function We(e,o){const t=o.options||[],i=e.filterText.toLowerCase(),r=e.filterText;e.dropdownOptions=t.filter(s=>kt(s,o).toLowerCase().includes(i)),e.highlightedIndex=e.dropdownOptions.length>0?0:-1;const n=e.shadow.querySelector(".wg__editor--select");if(n){const s=ht(e,n,e.dropdownOptions,o);pt(e,s),e.filterText=r,e.dropdownOptions.length>0&&(e.highlightedIndex=0,nt(e))}}function Ri(e,o){const t=o.target;e.filterText=t.value,e.isUserFiltering=!0;const i=e.getCurrentEditingColumn();if(!i)return;const r=i.editorOptions||{},n=r.options||[];if(e.filterText.trim()){const c=e.filterText.toLowerCase();e.dropdownOptions=n.filter(a=>kt(a,r).toLowerCase().includes(c))}else e.dropdownOptions=n;e.highlightedIndex=e.dropdownOptions.length>0?0:-1;const s=t.closest(".wg__editor--combobox");if(s){const c=ht(e,s,e.dropdownOptions,r);pt(e,c),e.highlightedIndex=e.dropdownOptions.length>0?0:-1,nt(e)}}function Ai(e,o){const t=o.target;e.filterText=t.value;const i=e.getCurrentEditingColumn();if(!i)return;const r=i.editorOptions||{},n=r.debounceMs??300,s=r.minSearchLength??1;e.searchDebounceTimer&&clearTimeout(e.searchDebounceTimer);const c=t.closest(".wg__editor--autocomplete");if(!e.dropdownOpen&&c){e.dropdownOptions=r.initialOptions||[];const a=ht(e,c,e.dropdownOptions,r);pt(e,a),e.highlightedIndex=e.dropdownOptions.length>0?0:-1,nt(e)}if(e.filterText.length<s){if(e.dropdownOptions=r.initialOptions||[],c){const a=ht(e,c,e.dropdownOptions,r);pt(e,a),e.highlightedIndex=e.dropdownOptions.length>0?0:-1,nt(e)}return}e.searchDebounceTimer=setTimeout(()=>{Ii(e,e.filterText,i)},n)}async function Ii(e,o,t){const i=t.editorOptions||{};if(!i.onSearchCallback)return;e.searchAbortController&&e.searchAbortController.abort(),e.searchAbortController=new AbortController;const r=e.searchAbortController.signal;e.isSearching=!0,ce(e,!0);try{const n=e.grid.editingCell;if(!n)return;const s=e.grid.displayItems[n.rowIndex],c=await i.onSearchCallback(o,s,r);if(!r.aborted){e.isSearching=!1,ce(e,!1),e.dropdownOptions=c;const{rowIndex:a,field:l}=n,g=e.shadow.querySelector(`.wg__editor--autocomplete[data-row="${a}"][data-field="${l}"]`);if(g){const d=ht(e,g,e.dropdownOptions,i);pt(e,d),e.highlightedIndex=c.length>0?0:-1,nt(e)}}}catch(n){if(n instanceof Error&&n.name==="AbortError")return;console.error("Autocomplete search failed:",n),e.isSearching=!1,ce(e,!1),e.dropdownOptions=[];const s=e.grid.editingCell;if(s){const{rowIndex:c,field:a}=s,l=e.shadow.querySelector(`.wg__editor--autocomplete[data-row="${c}"][data-field="${a}"]`);if(l){const g=ht(e,l,e.dropdownOptions,i);pt(e,g)}}}}function ge(e,o,t,i,r){const n=i??e.tooltipShowDelay;e.tooltipHideTimer&&(clearTimeout(e.tooltipHideTimer),e.tooltipHideTimer=null),!(e.tooltipElement&&e.tooltipAnchor===o)&&(e.tooltipShowTimer&&clearTimeout(e.tooltipShowTimer),e.tooltipShowTimer=setTimeout(()=>{Li(e,o,t,r)},n))}function Xe(e,o){const t=o??e.tooltipHideDelay;e.tooltipShowTimer&&(clearTimeout(e.tooltipShowTimer),e.tooltipShowTimer=null),e.tooltipElement&&(e.tooltipHideTimer=setTimeout(()=>{e.tooltipElement&&(e.tooltipElement.classList.remove("wg__tooltip--visible"),setTimeout(()=>{var i;(i=e.tooltipElement)==null||i.remove(),e.tooltipElement=null,e.tooltipArrowElement=null,e.tooltipAnchor=null},100))},t))}function Li(e,o,t,i){var c;(c=e.tooltipElement)==null||c.remove();const r=document.createElement("div");r.className="wg__tooltip";const n=document.createElement("div");n.className="wg__tooltip-content",i?n.innerHTML=t:n.textContent=t,r.appendChild(n);const s=document.createElement("div");s.className="wg__tooltip-arrow",r.appendChild(s),e.shadow.appendChild(r),e.tooltipElement=r,e.tooltipArrowElement=s,e.tooltipAnchor=o,$t(o,r,{strategy:"fixed",placement:"top",middleware:[Zt(8),Et({fallbackPlacements:["bottom","left","right"]}),Zo({element:s})]}).then(({x:a,y:l,placement:g,middlewareData:d})=>{if(r.style.left=`${a}px`,r.style.top=`${l}px`,r.setAttribute("data-placement",g),d.arrow){const{x:h,y:u}=d.arrow;h!=null&&(s.style.left=`${h}px`),u!=null&&(s.style.top=`${u}px`)}requestAnimationFrame(()=>{r.classList.add("wg__tooltip--visible")})})}const Qe={today:"Today",clear:"Clear",monthNames:["January","February","March","April","May","June","July","August","September","October","November","December"],monthNamesShort:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],weekdayNames:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],weekdayNamesShort:["Su","Mo","Tu","We","Th","Fr","Sa"]};function ue(e){const o={};let t="";return e.includes("-")?t="-":e.includes("/")?t="/":e.includes(".")&&(t="."),e.split(t).forEach((r,n)=>{r==="YYYY"||r==="YY"?o.year={index:n,length:r.length}:r==="MM"||r==="M"?o.month={index:n,length:2}:(r==="DD"||r==="D")&&(o.day={index:n,length:2})}),{format:e,separator:t,parts:o,maxLength:e.length}}function Ge(e,o){if(!e||isNaN(e.getTime()))return"";const t=e.getFullYear(),i=String(e.getMonth()+1).padStart(2,"0"),r=String(e.getDate()).padStart(2,"0"),{separator:n,parts:s}=o,c=[];for(let a=0;a<3;a++)s.year&&s.year.index===a?c.push(s.year.length===2?String(t).slice(-2):t):s.month&&s.month.index===a?c.push(i):s.day&&s.day.index===a&&c.push(r);return c.join(n)}function Oi(e,o){if(!e)return null;const{separator:t,parts:i}=o,r=e.split(t);let n=null,s=null,c=null;if(r.forEach((l,g)=>{if(l){if(i.year&&i.year.index===g){const d=parseInt(l,10);i.year.length===4&&l.length===4?n=d:i.year.length===2&&l.length===2&&(n=d<100?d+2e3:d)}else if(i.month&&i.month.index===g){const d=parseInt(l,10);l.length===2&&d>=1&&d<=12&&(s=d)}else if(i.day&&i.day.index===g){const d=parseInt(l,10);l.length===2&&d>=1&&d<=31&&(c=d)}}}),n===null||s===null||c===null)return null;const a=new Date(n,s-1,c);return a.getMonth()!==s-1||a.getDate()!==c?null:a}function U(e){if(!e)return null;let o;if(typeof e=="string"){const[t,i,r]=e.split("-").map(Number);!t||!i||!r?o=new Date(e):o=new Date(t,i-1,r)}else o=new Date(e);return o.setHours(0,0,0,0),isNaN(o.getTime())?null:o}function he(e){const o=e.getFullYear(),t=String(e.getMonth()+1).padStart(2,"0"),i=String(e.getDate()).padStart(2,"0");return`${o}-${t}-${i}`}function Mt(e,o){return!e||!o?!1:e.getFullYear()===o.getFullYear()&&e.getMonth()===o.getMonth()&&e.getDate()===o.getDate()}function Hi(e){return Mt(e,new Date)}function Ct(e,o){return new Date(e,o+1,0).getDate()}function Pi(e,o){return new Date(e,o,1).getDay()}function Vi(e,o){if(!e)return{min:o-10,max:o+10};if(e.includes("-")){const[i,r]=e.split("-");return{min:parseInt(i,10),max:parseInt(r,10)}}const t=parseInt(e,10);return{min:t,max:t}}function zi(e,o,t=Qe){const i=Fi(e,t),r=qi(e,o,t),n=Yi(e,o,t),s=o.showTodayButton!==!1?Ui(t):"";return`
210
+ `:""},C=o.grid.paginationLayout.split("|").map(_=>_.trim()).map(_=>v[_]||"").join("");return`<div class="${m.join(" ")}">${C}</div>`}function xe(o,t){const e=o.grid.summaryContentCallback;if(!e)return"";const i=o.grid.currentPage,r=o.grid.pageSize,n=o.grid.sortedItems,s=o.grid.displayItems,a=o.grid.totalItems!==null?o.grid.totalItems:n.length,l=e({items:s,allItems:n,totalItems:a,currentPage:i,pageSize:r,metadata:o.grid.summaryMetadata}),d=t.startsWith("top-"),c=t.replace("top-","").replace("bottom-",""),u=["wg__summary"];return c==="left"?u.push("wg__summary--left"):c==="right"&&u.push("wg__summary--right"),d&&u.push("wg__summary--top"),`<div class="${u.join(" ")}">${l}</div>`}function j(o,t,e,i={}){const r=o.grid.columns[e];if(!r)return;const n=o.shadow.querySelector(`td[data-row="${t}"][data-col="${e}"]`);if(!n)return;const s=String(r.field),a=o.grid.displayItems[t];if(!a)return;const l=o.grid.isEditing(t,s),d=o.grid.isCellFocused(t,e),c=o.grid.isCellEditable(r),u=o.grid.isCellInvalid(t,s),g=["wg__cell"];if(c&&g.push("wg__cell--editable"),d&&!l&&g.push("wg__cell--focused"),r.textOverflow==="ellipsis"&&g.push("wg__cell--ellipsis"),l&&g.push("wg__cell--editing"),u&&g.push("wg__cell--invalid"),r.cellClass&&g.push(r.cellClass),r.cellClassCallback){const h=o.grid.getCellRawValue(a,t,s),f=r.cellClassCallback(h,a);f&&g.push(f)}if(n.className=g.join(" "),l)n.innerHTML=te(o,t,e,r),i.focusEditor&&dr(o,n,r,i);else{const h=o.grid.getCellValue(a,r,t);n.innerHTML=_e(o,t,e,r,h)}}function dr(o,t,e,i){var n;let r=t.querySelector(".wg__combobox-input, .wg__autocomplete-input, .wg__select-trigger, .wg__date-input");if(r||(r=t.querySelector(".wg__editor")),!!r&&(r.focus(),r instanceof HTMLInputElement&&r.type==="text")){const s=i.cursorPosition,a=((n=e.editorOptions)==null?void 0:n.editStartSelection)||o.grid.editStartSelection;if(i.initialSearchQuery!==void 0){const l=r.value.length;r.setSelectionRange(l,l)}else switch(a){case"mousePosition":if(s!==void 0){const l=Math.min(s,r.value.length);r.setSelectionRange(l,l)}else r.setSelectionRange(r.value.length,r.value.length);break;case"cursorAtStart":r.setSelectionRange(0,0);break;case"cursorAtEnd":r.setSelectionRange(r.value.length,r.value.length);break;case"selectAll":default:r.select();break}}}function co(o,t,e=!0){const i=o.dropdownOptions[t];if(!i)return;const r=o.grid.editingCell;if(!r)return;const n=o.getCurrentEditorOptions();if(At(i,n))return;const s=Ct(i,n),a=o.grid.columns.findIndex(d=>String(d.field)===r.field),l=o.grid.displayItems[r.rowIndex];n.onselect&&l&&n.onselect(i,l),o.justSelected=!0,o.isCommittingFromKeyboard=!0,N(o),o.grid.commitEdit(r.rowIndex,r.field,s),e?o.moveFocusAfterCommit(r.rowIndex,r.field,"down"):j(o,r.rowIndex,a),requestAnimationFrame(()=>{o.justSelected=!1})}function gt(o){const t=o.shadow.querySelector(".wg__dropdown");if(!t)return;t.querySelectorAll(".wg__dropdown-option").forEach((i,r)=>{i.classList.toggle("wg__dropdown-option--highlighted",r===o.highlightedIndex)})}function go(o){const t=o.shadow.querySelector(".wg__dropdown-option--highlighted");t==null||t.scrollIntoView({block:"nearest"})}function De(o,t){const e=o.shadow.querySelector(".wg__loading-indicator");e&&(e.style.display=t?"inline":"none");const i=o.shadow.querySelector(".wg__editor--autocomplete .wg__combobox-toggle");i&&(i.style.display=t?"none":"inline")}function rt(o){if(o.justSelected)return;const t=o.getCurrentEditingColumn();if(!t)return;const e=t.editorOptions||{},i=t.editor;let r=0;if(i==="select"){const d=e.options||[];if(o.filterText){const c=o.filterText.toLowerCase();o.dropdownOptions=d.filter(u=>Ot(u,e).toLowerCase().includes(c)),r=o.dropdownOptions.length>0?0:-1}else{o.dropdownOptions=d;const c=o.grid.editingCell;if(c){const u=o.grid.displayItems[c.rowIndex],g=u?u[c.field]:void 0,h=o.dropdownOptions.findIndex(f=>Ct(f,e)===g);r=h>=0?h:0}else r=o.dropdownOptions.length>0?0:-1}}else if(i==="combobox"||i==="autocomplete"){const d=i==="autocomplete"?e.initialOptions||e.options||[]:e.options||[],c=o.grid.editingCell;let u;if(c){const h=o.grid.displayItems[c.rowIndex];u=h?h[c.field]:void 0}const g=d.findIndex(h=>Ct(h,e)===u);if(g>=0)o.dropdownOptions=d,r=g;else if(u!=null&&u!==""){const h=e.valueMember||"value",f=e.displayMember||"label",m=String(u),v={value:u,label:m,[h]:u,[f]:m};o.dropdownOptions=[v,...d],r=0}else o.dropdownOptions=d,r=d.length>0?0:-1}const n=o.grid.editingCell;if(!n)return;const{rowIndex:s,field:a}=n,l=o.shadow.querySelector(`.wg__editor--select[data-row="${s}"][data-field="${a}"],
211
+ .wg__editor--combobox[data-row="${s}"][data-field="${a}"],
212
+ .wg__editor--autocomplete[data-row="${s}"][data-field="${a}"]`);if(l&&o.dropdownOptions.length>0){const d=o.filterText;o.isOpeningDropdown=!0;const c=kt(o,l,o.dropdownOptions,e);xt(o,c),o.filterText=d,o.highlightedIndex=r,gt(o);const u=o.shadow.querySelector(`.wg__select-trigger[data-row="${s}"][data-field="${a}"]`),g=o.shadow.querySelector(`.wg__combobox-input[data-row="${s}"][data-field="${a}"],
213
+ .wg__autocomplete-input[data-row="${s}"][data-field="${a}"]`),h=u||g;h&&h.focus(),requestAnimationFrame(()=>{o.isOpeningDropdown=!1})}}function uo(o){o.dropdownOpen?N(o):rt(o)}function xt(o,t){t.addEventListener("mousedown",e=>{e.preventDefault();const i=e.target.closest(".wg__dropdown-option");if(i&&!i.hasAttribute("data-disabled")){const r=parseInt(i.getAttribute("data-index")||"0",10);co(o,r,!1)}}),t.addEventListener("mouseover",e=>{const i=e.target.closest(".wg__dropdown-option");i&&!i.hasAttribute("data-disabled")&&(o.highlightedIndex=parseInt(i.getAttribute("data-index")||"0",10),gt(o))})}function ho(o,t){const e=t.options||[],i=o.filterText.toLowerCase(),r=o.filterText;o.dropdownOptions=e.filter(s=>Ot(s,t).toLowerCase().includes(i)),o.highlightedIndex=o.dropdownOptions.length>0?0:-1;const n=o.shadow.querySelector(".wg__editor--select");if(n){const s=kt(o,n,o.dropdownOptions,t);xt(o,s),o.filterText=r,o.dropdownOptions.length>0&&(o.highlightedIndex=0,gt(o))}}function cr(o,t){const e=t.target;o.filterText=e.value,o.isUserFiltering=!0;const i=o.getCurrentEditingColumn();if(!i)return;const r=i.editorOptions||{},n=r.options||[];if(o.filterText.trim()){const a=o.filterText.toLowerCase();o.dropdownOptions=n.filter(l=>Ot(l,r).toLowerCase().includes(a))}else o.dropdownOptions=n;o.highlightedIndex=o.dropdownOptions.length>0?0:-1;const s=e.closest(".wg__editor--combobox");if(s){const a=kt(o,s,o.dropdownOptions,r);xt(o,a),o.highlightedIndex=o.dropdownOptions.length>0?0:-1,gt(o)}}function gr(o,t){const e=t.target;o.filterText=e.value;const i=o.getCurrentEditingColumn();if(!i)return;const r=i.editorOptions||{},n=r.debounceMs??300,s=r.minSearchLength??1;o.searchDebounceTimer&&clearTimeout(o.searchDebounceTimer);const a=e.closest(".wg__editor--autocomplete");if(!o.dropdownOpen&&a){o.dropdownOptions=r.initialOptions||[];const l=kt(o,a,o.dropdownOptions,r);xt(o,l),o.highlightedIndex=o.dropdownOptions.length>0?0:-1,gt(o)}if(o.filterText.length<s){if(o.dropdownOptions=r.initialOptions||[],a){const l=kt(o,a,o.dropdownOptions,r);xt(o,l),o.highlightedIndex=o.dropdownOptions.length>0?0:-1,gt(o)}return}o.searchDebounceTimer=setTimeout(()=>{ur(o,o.filterText,i)},n)}async function ur(o,t,e){const i=e.editorOptions||{};if(!i.onSearchCallback)return;o.searchAbortController&&o.searchAbortController.abort(),o.searchAbortController=new AbortController;const r=o.searchAbortController.signal;o.isSearching=!0,De(o,!0);try{const n=o.grid.editingCell;if(!n)return;const s=o.grid.displayItems[n.rowIndex],a=await i.onSearchCallback(t,s,r);if(!r.aborted){o.isSearching=!1,De(o,!1),o.dropdownOptions=a;const{rowIndex:l,field:d}=n,c=o.shadow.querySelector(`.wg__editor--autocomplete[data-row="${l}"][data-field="${d}"]`);if(c){const u=kt(o,c,o.dropdownOptions,i);xt(o,u),o.highlightedIndex=a.length>0?0:-1,gt(o)}}}catch(n){if(n instanceof Error&&n.name==="AbortError")return;console.error("Autocomplete search failed:",n),o.isSearching=!1,De(o,!1),o.dropdownOptions=[];const s=o.grid.editingCell;if(s){const{rowIndex:a,field:l}=s,d=o.shadow.querySelector(`.wg__editor--autocomplete[data-row="${a}"][data-field="${l}"]`);if(d){const c=kt(o,d,o.dropdownOptions,i);xt(o,c)}}}}function Re(o,t,e,i,r){const n=i??o.tooltipShowDelay;o.tooltipHideTimer&&(clearTimeout(o.tooltipHideTimer),o.tooltipHideTimer=null),!(o.tooltipElement&&o.tooltipAnchor===t)&&(o.tooltipShowTimer&&clearTimeout(o.tooltipShowTimer),o.tooltipShowTimer=setTimeout(()=>{hr(o,t,e,r)},n))}function fo(o,t){const e=t??o.tooltipHideDelay;o.tooltipShowTimer&&(clearTimeout(o.tooltipShowTimer),o.tooltipShowTimer=null),o.tooltipElement&&(o.tooltipHideTimer=setTimeout(()=>{o.tooltipElement&&(o.tooltipElement.classList.remove("wg__tooltip--visible"),setTimeout(()=>{var i;(i=o.tooltipElement)==null||i.remove(),o.tooltipElement=null,o.tooltipArrowElement=null,o.tooltipAnchor=null},100))},e))}function hr(o,t,e,i){var a;(a=o.tooltipElement)==null||a.remove();const r=document.createElement("div");r.className="wg__tooltip";const n=document.createElement("div");n.className="wg__tooltip-content",i?n.innerHTML=e:n.textContent=e,r.appendChild(n);const s=document.createElement("div");s.className="wg__tooltip-arrow",r.appendChild(s),o.shadow.appendChild(r),o.tooltipElement=r,o.tooltipArrowElement=s,o.tooltipAnchor=t,qt(t,r,{strategy:"fixed",placement:"top",middleware:[he(8),Ft({fallbackPlacements:["bottom","left","right"]}),Ii({element:s})]}).then(({x:l,y:d,placement:c,middlewareData:u})=>{if(r.style.left=`${l}px`,r.style.top=`${d}px`,r.setAttribute("data-placement",c),u.arrow){const{x:g,y:h}=u.arrow;g!=null&&(s.style.left=`${g}px`),h!=null&&(s.style.top=`${h}px`)}requestAnimationFrame(()=>{r.classList.add("wg__tooltip--visible")})})}const wo={today:"Today",clear:"Clear",monthNames:["January","February","March","April","May","June","July","August","September","October","November","December"],monthNamesShort:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],weekdayNames:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],weekdayNamesShort:["Su","Mo","Tu","We","Th","Fr","Sa"]};function Ee(o){const t={};let e="";return o.includes("-")?e="-":o.includes("/")?e="/":o.includes(".")&&(e="."),o.split(e).forEach((r,n)=>{r==="YYYY"||r==="YY"?t.year={index:n,length:r.length}:r==="MM"||r==="M"?t.month={index:n,length:2}:(r==="DD"||r==="D")&&(t.day={index:n,length:2})}),{format:o,separator:e,parts:t,maxLength:o.length}}function po(o,t){if(!o||isNaN(o.getTime()))return"";const e=o.getFullYear(),i=String(o.getMonth()+1).padStart(2,"0"),r=String(o.getDate()).padStart(2,"0"),{separator:n,parts:s}=t,a=[];for(let l=0;l<3;l++)s.year&&s.year.index===l?a.push(s.year.length===2?String(e).slice(-2):e):s.month&&s.month.index===l?a.push(i):s.day&&s.day.index===l&&a.push(r);return a.join(n)}function fr(o,t){if(!o)return null;const{separator:e,parts:i}=t,r=o.split(e);let n=null,s=null,a=null;if(r.forEach((d,c)=>{if(d){if(i.year&&i.year.index===c){const u=parseInt(d,10);i.year.length===4&&d.length===4?n=u:i.year.length===2&&d.length===2&&(n=u<100?u+2e3:u)}else if(i.month&&i.month.index===c){const u=parseInt(d,10);d.length===2&&u>=1&&u<=12&&(s=u)}else if(i.day&&i.day.index===c){const u=parseInt(d,10);d.length===2&&u>=1&&u<=31&&(a=u)}}}),n===null||s===null||a===null)return null;const l=new Date(n,s-1,a);return l.getMonth()!==s-1||l.getDate()!==a?null:l}function Q(o){if(!o)return null;let t;if(typeof o=="string"){const[e,i,r]=o.split("-").map(Number);!e||!i||!r?t=new Date(o):t=new Date(e,i-1,r)}else t=new Date(o);return t.setHours(0,0,0,0),isNaN(t.getTime())?null:t}function $e(o){const t=o.getFullYear(),e=String(o.getMonth()+1).padStart(2,"0"),i=String(o.getDate()).padStart(2,"0");return`${t}-${e}-${i}`}function Vt(o,t){return!o||!t?!1:o.getFullYear()===t.getFullYear()&&o.getMonth()===t.getMonth()&&o.getDate()===t.getDate()}function wr(o){return Vt(o,new Date)}function zt(o,t){return new Date(o,t+1,0).getDate()}function pr(o,t){return new Date(o,t,1).getDay()}function mr(o,t){if(!o)return{min:t-10,max:t+10};if(o.includes("-")){const[i,r]=o.split("-");return{min:parseInt(i,10),max:parseInt(r,10)}}const e=parseInt(o,10);return{min:e,max:e}}function br(o,t,e=wo){const i=_r(o,e),r=vr(o,t,e),n=yr(o,t,e),s=t.showTodayButton!==!1?kr(e):"";return`
213
214
  <div class="wg-datepicker">
214
215
  <div class="wg-datepicker__header">
215
216
  ${i}
216
217
  </div>
217
- <div class="wg-datepicker__rolling-selector${e.rollingSelectorOpen?" wg-datepicker__rolling-selector--visible":""}">
218
+ <div class="wg-datepicker__rolling-selector${o.rollingSelectorOpen?" wg-datepicker__rolling-selector--visible":""}">
218
219
  ${r}
219
220
  </div>
220
- <div class="wg-datepicker__calendar${e.rollingSelectorOpen?" wg-datepicker__calendar--hidden":""}">
221
+ <div class="wg-datepicker__calendar${o.rollingSelectorOpen?" wg-datepicker__calendar--hidden":""}">
221
222
  ${n}
222
223
  </div>
223
224
  ${s}
224
225
  </div>
225
- `}function Fi(e,o){return`
226
+ `}function _r(o,t){return`
226
227
  <button type="button" class="wg-datepicker__nav wg-datepicker__nav--prev" data-action="prev-month">
227
228
  <svg viewBox="0 0 24 24" width="16" height="16"><path fill="currentColor" d="M15.41 7.41L14 6l-6 6 6 6 1.41-1.41L10.83 12z"/></svg>
228
229
  </button>
229
230
  <button type="button" class="wg-datepicker__month-year" data-action="toggle-rolling">
230
- ${o.monthNames[e.viewMonth]} ${e.viewYear}
231
+ ${t.monthNames[o.viewMonth]} ${o.viewYear}
231
232
  </button>
232
233
  <button type="button" class="wg-datepicker__nav wg-datepicker__nav--next" data-action="next-month">
233
234
  <svg viewBox="0 0 24 24" width="16" height="16"><path fill="currentColor" d="M8.59 16.59L10 18l6-6-6-6-1.41 1.41L13.17 12z"/></svg>
234
235
  </button>
235
- `}function qi(e,o,t){const i=Vi(o.rollingYearRange,new Date().getFullYear());let r="";for(let s=i.min;s<=i.max;s++){const c=s===e.viewYear?" wg-datepicker__rolling-item--selected":"";r+=`<div class="wg-datepicker__rolling-item${c}" data-year="${s}">${s}</div>`}let n="";for(let s=0;s<12;s++){const c=s===e.viewMonth?" wg-datepicker__rolling-item--selected":"";n+=`<div class="wg-datepicker__rolling-item${c}" data-month="${s}">${t.monthNamesShort[s]}</div>`}return`
236
+ `}function vr(o,t,e){const i=mr(t.rollingYearRange,new Date().getFullYear());let r="";for(let s=i.min;s<=i.max;s++){const a=s===o.viewYear?" wg-datepicker__rolling-item--selected":"";r+=`<div class="wg-datepicker__rolling-item${a}" data-year="${s}">${s}</div>`}let n="";for(let s=0;s<12;s++){const a=s===o.viewMonth?" wg-datepicker__rolling-item--selected":"";n+=`<div class="wg-datepicker__rolling-item${a}" data-month="${s}">${e.monthNamesShort[s]}</div>`}return`
236
237
  <div class="wg-datepicker__rolling-lists">
237
238
  <div class="wg-datepicker__rolling-list" data-list="months">
238
239
  ${n}
@@ -241,20 +242,20 @@
241
242
  ${r}
242
243
  </div>
243
244
  </div>
244
- `}function Yi(e,o,t){const i=Ni(t),r=Je(e,o);return`
245
+ `}function yr(o,t,e){const i=Cr(e),r=mo(o,t);return`
245
246
  <div class="wg-datepicker__weekdays">
246
247
  ${i}
247
248
  </div>
248
249
  <div class="wg-datepicker__days">
249
250
  ${r}
250
251
  </div>
251
- `}function Ni(e){return e.weekdayNamesShort.map(o=>`<div class="wg-datepicker__weekday">${o}</div>`).join("")}function Je(e,o){const{viewYear:t,viewMonth:i,selectedDate:r,focusedDate:n}=e,s=o.minDate?U(o.minDate):null,c=o.maxDate?U(o.maxDate):null,a=Pi(t,i),l=Ct(t,i),g=Ct(t,i-1),d=new Date(t,i-1,1),h=d.getFullYear(),u=d.getMonth(),p=new Date(t,i+1,1),b=p.getFullYear(),v=p.getMonth(),w=[];for(let y=a-1;y>=0;y--){const S=g-y;w.push({date:new Date(h,u,S),day:S,isOtherMonth:!0})}for(let y=1;y<=l;y++)w.push({date:new Date(t,i,y),day:y,isOtherMonth:!1});const m=Math.ceil((a+l)/7)*7-w.length;for(let y=1;y<=m;y++)w.push({date:new Date(b,v,y),day:y,isOtherMonth:!0});let C="";for(const y of w){const S=["wg-datepicker__day"];y.isOtherMonth&&S.push("wg-datepicker__day--other-month"),Bi(y.date,s,c)&&S.push("wg-datepicker__day--disabled"),Hi(y.date)&&S.push("wg-datepicker__day--today"),Mt(y.date,r)&&S.push("wg-datepicker__day--selected"),Mt(y.date,n)&&S.push("wg-datepicker__day--focused");const x=he(y.date);C+=`<div class="${S.join(" ")}" data-date="${x}">${y.day}</div>`}return C}function Bi(e,o,t){return!!(o&&e<o||t&&e>t)}function Ui(e){return`
252
+ `}function Cr(o){return o.weekdayNamesShort.map(t=>`<div class="wg-datepicker__weekday">${t}</div>`).join("")}function mo(o,t){const{viewYear:e,viewMonth:i,selectedDate:r,focusedDate:n}=o,s=t.minDate?Q(t.minDate):null,a=t.maxDate?Q(t.maxDate):null,l=pr(e,i),d=zt(e,i),c=zt(e,i-1),u=new Date(e,i-1,1),g=u.getFullYear(),h=u.getMonth(),f=new Date(e,i+1,1),m=f.getFullYear(),v=f.getMonth(),p=[];for(let b=l-1;b>=0;b--){const y=c-b;p.push({date:new Date(g,h,y),day:y,isOtherMonth:!0})}for(let b=1;b<=d;b++)p.push({date:new Date(e,i,b),day:b,isOtherMonth:!1});const _=Math.ceil((l+d)/7)*7-p.length;for(let b=1;b<=_;b++)p.push({date:new Date(m,v,b),day:b,isOtherMonth:!0});let S="";for(const b of p){const y=["wg-datepicker__day"];b.isOtherMonth&&y.push("wg-datepicker__day--other-month"),Sr(b.date,s,a)&&y.push("wg-datepicker__day--disabled"),wr(b.date)&&y.push("wg-datepicker__day--today"),Vt(b.date,r)&&y.push("wg-datepicker__day--selected"),Vt(b.date,n)&&y.push("wg-datepicker__day--focused");const x=$e(b.date);S+=`<div class="${y.join(" ")}" data-date="${x}">${b.day}</div>`}return S}function Sr(o,t,e){return!!(t&&o<t||e&&o>e)}function kr(o){return`
252
253
  <div class="wg-datepicker__footer">
253
254
  <button type="button" class="wg-datepicker__today-btn" data-action="today">
254
- ${e.today}
255
+ ${o.today}
255
256
  </button>
256
257
  </div>
257
- `}function ji(e,o,t){const i=e.querySelector(".wg-datepicker__days");i&&(i.innerHTML=Je(o,t))}function Ki(e,o,t){const i=e.querySelector(".wg-datepicker__month-year");if(i){const r=t.monthNames[o.viewMonth];i.textContent=`${r} ${o.viewYear}`}}function Wi(e,o){const t=e.querySelector(".wg-datepicker__rolling-selector"),i=e.querySelector(".wg-datepicker__calendar");t&&t.classList.toggle("wg-datepicker__rolling-selector--visible",o),i&&i.classList.toggle("wg-datepicker__calendar--hidden",o)}function Xi(e,o){e.querySelectorAll("[data-year]").forEach(r=>{const n=parseInt(r.dataset.year||"0",10);r.classList.toggle("wg-datepicker__rolling-item--selected",n===o.viewYear)}),e.querySelectorAll("[data-month]").forEach(r=>{const n=parseInt(r.dataset.month||"0",10);r.classList.toggle("wg-datepicker__rolling-item--selected",n===o.viewMonth)})}function Ze(e){const o=e.querySelector("[data-year].wg-datepicker__rolling-item--selected"),t=e.querySelector("[data-month].wg-datepicker__rolling-item--selected");if(o){const i=o.parentElement;if(i){const r=o.offsetTop-i.clientHeight/2+o.clientHeight/2;i.scrollTop=r}}if(t){const i=t.parentElement;if(i){const r=t.offsetTop-i.clientHeight/2+t.clientHeight/2;i.scrollTop=r}}}function pe(e){e.viewMonth===0?(e.viewMonth=11,e.viewYear--):e.viewMonth--}function fe(e){e.viewMonth===11?(e.viewMonth=0,e.viewYear++):e.viewMonth++}function Qi(e,o,t,i){var n,s,c,a;const{key:r}=e;if(r==="Escape")return(n=i.onClose)==null||n.call(i),!0;if(o.rollingSelectorOpen)return Ji(e,o);if((r==="ArrowLeft"||r==="ArrowRight")&&(e.ctrlKey||e.metaKey)){if(e.preventDefault(),r==="ArrowLeft"?pe(o):fe(o),o.focusedDate){const l=Math.min(o.focusedDate.getDate(),Ct(o.viewYear,o.viewMonth));o.focusedDate=new Date(o.viewYear,o.viewMonth,l)}return!0}if(["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"].includes(r))return e.preventDefault(),Gi(o,r,t),!0;if(r==="Enter")return e.preventDefault(),e.stopPropagation(),o.focusedDate&&((s=i.onSelect)==null||s.call(i,o.focusedDate,"down")),!0;if(r==="Tab")return o.focusedDate?(c=i.onSelect)==null||c.call(i,o.focusedDate,"next"):(a=i.onClose)==null||a.call(i),!1;if(r==="Home"){if(e.preventDefault(),e.ctrlKey||e.metaKey){let l=o.viewYear;const g=new Date(l,0,1);if(o.focusedDate&&Mt(o.focusedDate,g)&&l--,t.minDate){const d=U(t.minDate);d&&l<d.getFullYear()&&(l=d.getFullYear())}o.viewMonth=0,o.viewYear=l,o.focusedDate=new Date(l,0,1)}else o.focusedDate=new Date(o.viewYear,o.viewMonth,1);return!0}if(r==="End"){if(e.preventDefault(),e.ctrlKey||e.metaKey){let l=o.viewYear;const g=new Date(l,11,31);if(o.focusedDate&&Mt(o.focusedDate,g)&&l++,t.maxDate){const d=U(t.maxDate);d&&l>d.getFullYear()&&(l=d.getFullYear())}o.viewMonth=11,o.viewYear=l,o.focusedDate=new Date(l,11,31)}else{const l=Ct(o.viewYear,o.viewMonth);o.focusedDate=new Date(o.viewYear,o.viewMonth,l)}return!0}if(r==="PageUp"){if(e.preventDefault(),pe(o),o.focusedDate){const l=Math.min(o.focusedDate.getDate(),Ct(o.viewYear,o.viewMonth));o.focusedDate=new Date(o.viewYear,o.viewMonth,l)}return!0}if(r==="PageDown"){if(e.preventDefault(),fe(o),o.focusedDate){const l=Math.min(o.focusedDate.getDate(),Ct(o.viewYear,o.viewMonth));o.focusedDate=new Date(o.viewYear,o.viewMonth,l)}return!0}return!1}function Gi(e,o,t){if(!e.focusedDate){e.focusedDate=e.selectedDate?new Date(e.selectedDate):new Date(e.viewYear,e.viewMonth,1);return}const i=new Date(e.focusedDate),r=t.minDate?U(t.minDate):null,n=t.maxDate?U(t.maxDate):null;switch(o){case"ArrowLeft":i.setDate(i.getDate()-1);break;case"ArrowRight":i.setDate(i.getDate()+1);break;case"ArrowUp":i.setDate(i.getDate()-7);break;case"ArrowDown":i.setDate(i.getDate()+7);break}r&&i<r||n&&i>n||(e.focusedDate=i,(i.getMonth()!==e.viewMonth||i.getFullYear()!==e.viewYear)&&(e.viewMonth=i.getMonth(),e.viewYear=i.getFullYear()))}function Ji(e,o){const{key:t}=e;if(t==="ArrowUp"||t==="ArrowDown"){e.preventDefault();const i=t==="ArrowUp"?-1:1;if(o.rollingSelectorMode==="month"){const r=o.viewMonth+i;r>=0&&r<=11&&(o.viewMonth=r)}else o.viewYear+=i;return!0}return t==="ArrowLeft"||t==="ArrowRight"?(e.preventDefault(),o.rollingSelectorMode=o.rollingSelectorMode==="month"?"year":"month",!0):t==="Enter"||t==="Escape"?(e.preventDefault(),o.rollingSelectorOpen=!1,!0):!1}function Zi(e){if(e.selectedDate)e.focusedDate=new Date(e.selectedDate),e.viewYear=e.selectedDate.getFullYear(),e.viewMonth=e.selectedDate.getMonth();else{const o=new Date;e.focusedDate=new Date(e.viewYear,e.viewMonth,o.getDate())}}function tr(e,o,t){const i=e.dataset.date;if(!i||e.classList.contains("wg-datepicker__day--disabled"))return null;const[r,n,s]=i.split("-").map(Number),c=new Date(r,n-1,s),a=t.minDate?U(t.minDate):null,l=t.maxDate?U(t.maxDate):null;return a&&c<a||l&&c>l?null:(o.selectedDate=c,o.focusedDate=c,c)}function er(e,o){const t=new Date;t.setHours(0,0,0,0);const i=o.minDate?U(o.minDate):null,r=o.maxDate?U(o.maxDate):null;return i&&t<i||r&&t>r?null:(e.selectedDate=t,e.focusedDate=t,e.viewYear=t.getFullYear(),e.viewMonth=t.getMonth(),t)}function or(e,o){const t=e.dataset.month;t!==void 0&&(o.viewMonth=parseInt(t,10))}function ir(e,o){const t=e.dataset.year;t!==void 0&&(o.viewYear=parseInt(t,10))}function we(e,o){var d,h,u,p;const{separator:t,parts:i,maxLength:r}=o,n=t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),s=e.replace(new RegExp(n,"g"),""),c=((d=i.year)==null?void 0:d.length)??4,a=[{type:"year",pos:((h=i.year)==null?void 0:h.index)??0,length:c},{type:"month",pos:((u=i.month)==null?void 0:u.index)??1,length:2},{type:"day",pos:((p=i.day)==null?void 0:p.index)??2,length:2}].sort((b,v)=>b.pos-v.pos);let l="",g=0;for(let b=0;b<a.length;b++){const v=a[b],w=s.substring(g,g+v.length);if(!w)break;l+=w,g+=w.length,b<a.length-1&&w.length===v.length&&(l+=t)}return l.substring(0,r)}function rr(e,o,t){const i=e.value,r=e.selectionStart||0,n=i.length<t.length,{separator:s}=o,c=s.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),a=i.replace(new RegExp(`[^0-9${c}]`,"g"),""),l=we(a,o);if(l!==i){e.value=l;let g=r;if(n)g=r;else if(l.length>i.length&&l[r]===s)g=r+1;else if(l.length>i.length){const d=s.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),h=(i.substring(0,r).match(new RegExp(d,"g"))||[]).length,p=(l.substring(0,r).match(new RegExp(d,"g"))||[]).length-h;g=r+p}e.setSelectionRange(g,g)}return l}function nr(e,o){const{key:t,ctrlKey:i,metaKey:r}=e,{separator:n}=o;if(["Backspace","Delete","Tab","Escape","Enter","ArrowLeft","ArrowRight","ArrowUp","ArrowDown","Home","End"].includes(t)||i||r)return!1;if(t===n){const c=e.target,a=c.selectionStart||0,l=c.value;let g=0;for(let h=a-1;h>=0;h--)if(l[h]===n){g=h+1;break}const d=l.substring(g,a);if(/^\d$/.test(d)){e.preventDefault();const h=l.substring(0,g)+"0"+d+n+l.substring(a);c.value=h;const u=g+2+n.length;return c.setSelectionRange(u,u),!0}}return!/^\d$/.test(t)&&t!==n?(e.preventDefault(),!0):!1}function sr(e,o,t){var u;e.preventDefault();const i=((u=e.clipboardData)==null?void 0:u.getData("text"))||"",{separator:r}=t,n=r.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),s=i.replace(new RegExp(`[^0-9${n}]`,"g"),""),c=we(s,t),a=o.selectionStart||0,l=o.selectionEnd||0,g=o.value,d=g.substring(0,a)+c+g.substring(l);o.value=we(d,t);const h=a+c.length;o.setSelectionRange(h,h)}function ar(e,o,t,i){if(!e||e.length<o.maxLength)return!1;const r=Oi(e,o);if(!r)return!1;const n=i.minDate?U(i.minDate):null,s=i.maxDate?U(i.maxDate):null;return n&&r<n||s&&r>s?!1:(t.selectedDate=r,t.focusedDate=r,t.viewYear=r.getFullYear(),t.viewMonth=r.getMonth(),!0)}const lr=`
258
+ `}function xr(o,t,e){const i=o.querySelector(".wg-datepicker__days");i&&(i.innerHTML=mo(t,e))}function Dr(o,t,e){const i=o.querySelector(".wg-datepicker__month-year");if(i){const r=e.monthNames[t.viewMonth];i.textContent=`${r} ${t.viewYear}`}}function Rr(o,t){const e=o.querySelector(".wg-datepicker__rolling-selector"),i=o.querySelector(".wg-datepicker__calendar");e&&e.classList.toggle("wg-datepicker__rolling-selector--visible",t),i&&i.classList.toggle("wg-datepicker__calendar--hidden",t)}function Er(o,t){o.querySelectorAll("[data-year]").forEach(r=>{const n=parseInt(r.dataset.year||"0",10);r.classList.toggle("wg-datepicker__rolling-item--selected",n===t.viewYear)}),o.querySelectorAll("[data-month]").forEach(r=>{const n=parseInt(r.dataset.month||"0",10);r.classList.toggle("wg-datepicker__rolling-item--selected",n===t.viewMonth)})}function bo(o){const t=o.querySelector("[data-year].wg-datepicker__rolling-item--selected"),e=o.querySelector("[data-month].wg-datepicker__rolling-item--selected");if(t){const i=t.parentElement;if(i){const r=t.offsetTop-i.clientHeight/2+t.clientHeight/2;i.scrollTop=r}}if(e){const i=e.parentElement;if(i){const r=e.offsetTop-i.clientHeight/2+e.clientHeight/2;i.scrollTop=r}}}function Te(o){o.viewMonth===0?(o.viewMonth=11,o.viewYear--):o.viewMonth--}function Me(o){o.viewMonth===11?(o.viewMonth=0,o.viewYear++):o.viewMonth++}function $r(o,t,e,i){var n,s,a,l;const{key:r}=o;if(r==="Escape")return(n=i.onClose)==null||n.call(i),!0;if(t.rollingSelectorOpen)return Mr(o,t);if((r==="ArrowLeft"||r==="ArrowRight")&&(o.ctrlKey||o.metaKey)){if(o.preventDefault(),r==="ArrowLeft"?Te(t):Me(t),t.focusedDate){const d=Math.min(t.focusedDate.getDate(),zt(t.viewYear,t.viewMonth));t.focusedDate=new Date(t.viewYear,t.viewMonth,d)}return!0}if(["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"].includes(r))return o.preventDefault(),Tr(t,r,e),!0;if(r==="Enter")return o.preventDefault(),o.stopPropagation(),t.focusedDate&&((s=i.onSelect)==null||s.call(i,t.focusedDate,"down")),!0;if(r==="Tab")return t.focusedDate?(a=i.onSelect)==null||a.call(i,t.focusedDate,"next"):(l=i.onClose)==null||l.call(i),!1;if(r==="Home"){if(o.preventDefault(),o.ctrlKey||o.metaKey){let d=t.viewYear;const c=new Date(d,0,1);if(t.focusedDate&&Vt(t.focusedDate,c)&&d--,e.minDate){const u=Q(e.minDate);u&&d<u.getFullYear()&&(d=u.getFullYear())}t.viewMonth=0,t.viewYear=d,t.focusedDate=new Date(d,0,1)}else t.focusedDate=new Date(t.viewYear,t.viewMonth,1);return!0}if(r==="End"){if(o.preventDefault(),o.ctrlKey||o.metaKey){let d=t.viewYear;const c=new Date(d,11,31);if(t.focusedDate&&Vt(t.focusedDate,c)&&d++,e.maxDate){const u=Q(e.maxDate);u&&d>u.getFullYear()&&(d=u.getFullYear())}t.viewMonth=11,t.viewYear=d,t.focusedDate=new Date(d,11,31)}else{const d=zt(t.viewYear,t.viewMonth);t.focusedDate=new Date(t.viewYear,t.viewMonth,d)}return!0}if(r==="PageUp"){if(o.preventDefault(),Te(t),t.focusedDate){const d=Math.min(t.focusedDate.getDate(),zt(t.viewYear,t.viewMonth));t.focusedDate=new Date(t.viewYear,t.viewMonth,d)}return!0}if(r==="PageDown"){if(o.preventDefault(),Me(t),t.focusedDate){const d=Math.min(t.focusedDate.getDate(),zt(t.viewYear,t.viewMonth));t.focusedDate=new Date(t.viewYear,t.viewMonth,d)}return!0}return!1}function Tr(o,t,e){if(!o.focusedDate){o.focusedDate=o.selectedDate?new Date(o.selectedDate):new Date(o.viewYear,o.viewMonth,1);return}const i=new Date(o.focusedDate),r=e.minDate?Q(e.minDate):null,n=e.maxDate?Q(e.maxDate):null;switch(t){case"ArrowLeft":i.setDate(i.getDate()-1);break;case"ArrowRight":i.setDate(i.getDate()+1);break;case"ArrowUp":i.setDate(i.getDate()-7);break;case"ArrowDown":i.setDate(i.getDate()+7);break}r&&i<r||n&&i>n||(o.focusedDate=i,(i.getMonth()!==o.viewMonth||i.getFullYear()!==o.viewYear)&&(o.viewMonth=i.getMonth(),o.viewYear=i.getFullYear()))}function Mr(o,t){const{key:e}=o;if(e==="ArrowUp"||e==="ArrowDown"){o.preventDefault();const i=e==="ArrowUp"?-1:1;if(t.rollingSelectorMode==="month"){const r=t.viewMonth+i;r>=0&&r<=11&&(t.viewMonth=r)}else t.viewYear+=i;return!0}return e==="ArrowLeft"||e==="ArrowRight"?(o.preventDefault(),t.rollingSelectorMode=t.rollingSelectorMode==="month"?"year":"month",!0):e==="Enter"||e==="Escape"?(o.preventDefault(),t.rollingSelectorOpen=!1,!0):!1}function Ir(o){if(o.selectedDate)o.focusedDate=new Date(o.selectedDate),o.viewYear=o.selectedDate.getFullYear(),o.viewMonth=o.selectedDate.getMonth();else{const t=new Date;o.focusedDate=new Date(o.viewYear,o.viewMonth,t.getDate())}}function zr(o,t,e){const i=o.dataset.date;if(!i||o.classList.contains("wg-datepicker__day--disabled"))return null;const[r,n,s]=i.split("-").map(Number),a=new Date(r,n-1,s),l=e.minDate?Q(e.minDate):null,d=e.maxDate?Q(e.maxDate):null;return l&&a<l||d&&a>d?null:(t.selectedDate=a,t.focusedDate=a,a)}function Lr(o,t){const e=new Date;e.setHours(0,0,0,0);const i=t.minDate?Q(t.minDate):null,r=t.maxDate?Q(t.maxDate):null;return i&&e<i||r&&e>r?null:(o.selectedDate=e,o.focusedDate=e,o.viewYear=e.getFullYear(),o.viewMonth=e.getMonth(),e)}function Or(o,t){const e=o.dataset.month;e!==void 0&&(t.viewMonth=parseInt(e,10))}function Ar(o,t){const e=o.dataset.year;e!==void 0&&(t.viewYear=parseInt(e,10))}function Ie(o,t){var u,g,h,f;const{separator:e,parts:i,maxLength:r}=t,n=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),s=o.replace(new RegExp(n,"g"),""),a=((u=i.year)==null?void 0:u.length)??4,l=[{type:"year",pos:((g=i.year)==null?void 0:g.index)??0,length:a},{type:"month",pos:((h=i.month)==null?void 0:h.index)??1,length:2},{type:"day",pos:((f=i.day)==null?void 0:f.index)??2,length:2}].sort((m,v)=>m.pos-v.pos);let d="",c=0;for(let m=0;m<l.length;m++){const v=l[m],p=s.substring(c,c+v.length);if(!p)break;d+=p,c+=p.length,m<l.length-1&&p.length===v.length&&(d+=e)}return d.substring(0,r)}function Pr(o,t,e){const i=o.value,r=o.selectionStart||0,n=i.length<e.length,{separator:s}=t,a=s.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),l=i.replace(new RegExp(`[^0-9${a}]`,"g"),""),d=Ie(l,t);if(d!==i){o.value=d;let c=r;if(n)c=r;else if(d.length>i.length&&d[r]===s)c=r+1;else if(d.length>i.length){const u=s.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),g=(i.substring(0,r).match(new RegExp(u,"g"))||[]).length,f=(d.substring(0,r).match(new RegExp(u,"g"))||[]).length-g;c=r+f}o.setSelectionRange(c,c)}return d}function Hr(o,t){const{key:e,ctrlKey:i,metaKey:r}=o,{separator:n}=t;if(["Backspace","Delete","Tab","Escape","Enter","ArrowLeft","ArrowRight","ArrowUp","ArrowDown","Home","End"].includes(e)||i||r)return!1;if(e===n){const a=o.target,l=a.selectionStart||0,d=a.value;let c=0;for(let g=l-1;g>=0;g--)if(d[g]===n){c=g+1;break}const u=d.substring(c,l);if(/^\d$/.test(u)){o.preventDefault();const g=d.substring(0,c)+"0"+u+n+d.substring(l);a.value=g;const h=c+2+n.length;return a.setSelectionRange(h,h),!0}}return!/^\d$/.test(e)&&e!==n?(o.preventDefault(),!0):!1}function Fr(o,t,e){var h;o.preventDefault();const i=((h=o.clipboardData)==null?void 0:h.getData("text"))||"",{separator:r}=e,n=r.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),s=i.replace(new RegExp(`[^0-9${n}]`,"g"),""),a=Ie(s,e),l=t.selectionStart||0,d=t.selectionEnd||0,c=t.value,u=c.substring(0,l)+a+c.substring(d);t.value=Ie(u,e);const g=l+a.length;t.setSelectionRange(g,g)}function qr(o,t,e,i){if(!o||o.length<t.maxLength)return!1;const r=fr(o,t);if(!r)return!1;const n=i.minDate?Q(i.minDate):null,s=i.maxDate?Q(i.maxDate):null;return n&&r<n||s&&r>s?!1:(e.selectedDate=r,e.focusedDate=r,e.viewYear=r.getFullYear(),e.viewMonth=r.getMonth(),!0)}const Vr=`
258
259
  .wg-datepicker-container {
259
260
  position: fixed;
260
261
  z-index: var(--wg-dp-z-index, 9999);
@@ -504,7 +505,7 @@
504
505
  .wg-datepicker__today-btn:hover {
505
506
  background-color: color-mix(in srgb, var(--wg-dp-accent-color) 10%, transparent);
506
507
  }
507
- `;let to=!1;class me{constructor(o={}){f(this,"options");f(this,"state");f(this,"localeStrings");f(this,"formatInfo");f(this,"element",null);f(this,"anchor",null);f(this,"input",null);f(this,"cleanupAutoUpdate",null);f(this,"previousInputValue","");f(this,"boundHandleClickOutside");f(this,"boundHandleKeyDown");this.options={dateFormat:"YYYY-MM-DD",showTodayButton:!0,...o};const t=new Date;this.state={viewMonth:t.getMonth(),viewYear:t.getFullYear(),selectedDate:null,isOpen:!1,rollingSelectorOpen:!1,rollingSelectorMode:"month",focusedDate:null},this.localeStrings=this.initLocaleStrings(o.locale),this.formatInfo=ue(this.options.dateFormat||"YYYY-MM-DD"),this.boundHandleClickOutside=this.handleClickOutside.bind(this),this.boundHandleKeyDown=this.handleKeyDown.bind(this)}initLocaleStrings(o){const t=o||navigator.language||"en";try{const i=new Intl.DateTimeFormat(t,{month:"long"}),r=new Intl.DateTimeFormat(t,{month:"short"}),n=new Intl.DateTimeFormat(t,{weekday:"long"}),s=new Intl.DateTimeFormat(t,{weekday:"short"}),c=[],a=[];for(let d=0;d<12;d++){const h=new Date(2024,d,1);c.push(i.format(h)),a.push(r.format(h))}const l=[],g=[];for(let d=0;d<7;d++){const h=new Date(2024,0,7+d);l.push(n.format(h));const u=s.format(h);g.push(u.substring(0,2))}return{today:"Today",clear:"Clear",monthNames:c,monthNamesShort:a,weekdayNames:l,weekdayNamesShort:g}}catch{return Qe}}static injectStyles(){if(to)return;const o=document.createElement("style");o.id="wg-datepicker-styles",o.textContent=lr,document.head.appendChild(o),to=!0}open(o,t=null){me.injectStyles(),this.state.isOpen&&this.close(),this.anchor=o;const i=U(t);if(i)this.state.selectedDate=i,this.state.viewYear=i.getFullYear(),this.state.viewMonth=i.getMonth();else{const r=new Date;this.state.viewYear=r.getFullYear(),this.state.viewMonth=r.getMonth()}Zi(this.state),this.element=document.createElement("div"),this.element.className="wg-datepicker-container",this.element.innerHTML=zi(this.state,this.options,this.localeStrings),document.body.appendChild(this.element),this.position(),this.attachListeners(),this.state.isOpen=!0,this.state.rollingSelectorOpen&&Ze(this.element)}close(o=!1){var t,i;this.state.isOpen&&(this.cleanupAutoUpdate&&(this.cleanupAutoUpdate(),this.cleanupAutoUpdate=null),document.removeEventListener("mousedown",this.boundHandleClickOutside),document.removeEventListener("keydown",this.boundHandleKeyDown),this.element&&(this.element.remove(),this.element=null),this.state.isOpen=!1,this.state.rollingSelectorOpen=!1,o||(i=(t=this.options).onClose)==null||i.call(t))}destroy(){this.close(),this.anchor=null,this.input=null}getSelectedDate(){return this.state.selectedDate}getFormattedValue(){return Ge(this.state.selectedDate,this.formatInfo)}position(){if(!this.element||!this.anchor)return;const o=this.element.querySelector(".wg-datepicker");o&&(this.cleanupAutoUpdate=Go(this.anchor,o,()=>{if(!this.anchor.isConnected){this.close(!0);return}$t(this.anchor,o,{placement:"bottom-start",middleware:[Zt(4),Et({fallbackPlacements:["top-start","bottom-end","top-end"]}),te({padding:8})]}).then(({x:t,y:i})=>{Object.assign(o.style,{left:`${t}px`,top:`${i}px`})})}))}attachListeners(){this.element&&(this.element.addEventListener("click",o=>this.handleClick(o)),setTimeout(()=>{document.addEventListener("mousedown",this.boundHandleClickOutside)},0),document.addEventListener("keydown",this.boundHandleKeyDown))}handleClick(o){var c;const t=o.target,i=(c=t.closest("[data-action]"))==null?void 0:c.getAttribute("data-action");if(i==="prev-month"){o.preventDefault(),pe(this.state),this.render();return}if(i==="next-month"){o.preventDefault(),fe(this.state),this.render();return}if(i==="toggle-rolling"){o.preventDefault(),this.state.rollingSelectorOpen=!this.state.rollingSelectorOpen,this.render(),this.state.rollingSelectorOpen&&this.element&&Ze(this.element);return}if(i==="today"){o.preventDefault();const a=er(this.state,this.options);a&&this.selectDate(a);return}const r=t.closest(".wg-datepicker__day");if(r){o.preventDefault();const a=tr(r,this.state,this.options);a&&this.selectDate(a);return}const n=t.closest("[data-month]");if(n&&this.state.rollingSelectorOpen){o.preventDefault(),or(n,this.state),this.render();return}const s=t.closest("[data-year]");if(s&&this.state.rollingSelectorOpen){o.preventDefault(),ir(s,this.state),this.render();return}}handleClickOutside(o){if(!this.element||!this.anchor)return;const t=o.target;!this.element.contains(t)&&!this.anchor.contains(t)&&this.close()}handleKeyDown(o){Qi(o,this.state,this.options,{onSelect:(i,r)=>this.selectDate(i,r),onClose:()=>this.close()})&&this.render()}selectDate(o,t){var i,r;this.state.selectedDate=o,(r=(i=this.options).onSelect)==null||r.call(i,o,t),this.close(!0)}render(){if(!this.element)return;const o=this.element.querySelector(".wg-datepicker");o&&(Ki(o,this.state,this.localeStrings),Wi(o,this.state.rollingSelectorOpen),this.state.rollingSelectorOpen?Xi(o,this.state):ji(o,this.state,this.options))}connectInput(o){this.input=o,this.previousInputValue=o.value,o.addEventListener("input",()=>{this.previousInputValue=rr(o,this.formatInfo,this.previousInputValue),ar(o.value,this.formatInfo,this.state,this.options)}),o.addEventListener("keydown",t=>{nr(t,this.formatInfo)}),o.addEventListener("paste",t=>{sr(t,o,this.formatInfo)}),o.addEventListener("focus",()=>{!this.state.isOpen&&this.anchor&&this.open(this.anchor,o.value)})}}const dr=`
508
+ `;let _o=!1;class ze{constructor(t={}){w(this,"options");w(this,"state");w(this,"localeStrings");w(this,"formatInfo");w(this,"element",null);w(this,"anchor",null);w(this,"input",null);w(this,"cleanupAutoUpdate",null);w(this,"previousInputValue","");w(this,"boundHandleClickOutside");w(this,"boundHandleKeyDown");this.options={dateFormat:"YYYY-MM-DD",showTodayButton:!0,...t};const e=new Date;this.state={viewMonth:e.getMonth(),viewYear:e.getFullYear(),selectedDate:null,isOpen:!1,rollingSelectorOpen:!1,rollingSelectorMode:"month",focusedDate:null},this.localeStrings=this.initLocaleStrings(t.locale),this.formatInfo=Ee(this.options.dateFormat||"YYYY-MM-DD"),this.boundHandleClickOutside=this.handleClickOutside.bind(this),this.boundHandleKeyDown=this.handleKeyDown.bind(this)}initLocaleStrings(t){const e=t||navigator.language||"en";try{const i=new Intl.DateTimeFormat(e,{month:"long"}),r=new Intl.DateTimeFormat(e,{month:"short"}),n=new Intl.DateTimeFormat(e,{weekday:"long"}),s=new Intl.DateTimeFormat(e,{weekday:"short"}),a=[],l=[];for(let u=0;u<12;u++){const g=new Date(2024,u,1);a.push(i.format(g)),l.push(r.format(g))}const d=[],c=[];for(let u=0;u<7;u++){const g=new Date(2024,0,7+u);d.push(n.format(g));const h=s.format(g);c.push(h.substring(0,2))}return{today:"Today",clear:"Clear",monthNames:a,monthNamesShort:l,weekdayNames:d,weekdayNamesShort:c}}catch{return wo}}static injectStyles(){if(_o)return;const t=document.createElement("style");t.id="wg-datepicker-styles",t.textContent=Vr,document.head.appendChild(t),_o=!0}open(t,e=null){ze.injectStyles(),this.state.isOpen&&this.close(),this.anchor=t;const i=Q(e);if(i)this.state.selectedDate=i,this.state.viewYear=i.getFullYear(),this.state.viewMonth=i.getMonth();else{const r=new Date;this.state.viewYear=r.getFullYear(),this.state.viewMonth=r.getMonth()}Ir(this.state),this.element=document.createElement("div"),this.element.className="wg-datepicker-container",this.element.innerHTML=br(this.state,this.options,this.localeStrings),document.body.appendChild(this.element),this.position(),this.attachListeners(),this.state.isOpen=!0,this.state.rollingSelectorOpen&&bo(this.element)}close(t=!1){var e,i;this.state.isOpen&&(this.cleanupAutoUpdate&&(this.cleanupAutoUpdate(),this.cleanupAutoUpdate=null),document.removeEventListener("mousedown",this.boundHandleClickOutside),document.removeEventListener("keydown",this.boundHandleKeyDown),this.element&&(this.element.remove(),this.element=null),this.state.isOpen=!1,this.state.rollingSelectorOpen=!1,t||(i=(e=this.options).onClose)==null||i.call(e))}destroy(){this.close(),this.anchor=null,this.input=null}getSelectedDate(){return this.state.selectedDate}getFormattedValue(){return po(this.state.selectedDate,this.formatInfo)}position(){if(!this.element||!this.anchor)return;const t=this.element.querySelector(".wg-datepicker");t&&(this.cleanupAutoUpdate=Ti(this.anchor,t,()=>{if(!this.anchor.isConnected){this.close(!0);return}qt(this.anchor,t,{placement:"bottom-start",middleware:[he(4),Ft({fallbackPlacements:["top-start","bottom-end","top-end"]}),fe({padding:8})]}).then(({x:e,y:i})=>{Object.assign(t.style,{left:`${e}px`,top:`${i}px`})})}))}attachListeners(){this.element&&(this.element.addEventListener("click",t=>this.handleClick(t)),setTimeout(()=>{document.addEventListener("mousedown",this.boundHandleClickOutside)},0),document.addEventListener("keydown",this.boundHandleKeyDown))}handleClick(t){var a;const e=t.target,i=(a=e.closest("[data-action]"))==null?void 0:a.getAttribute("data-action");if(i==="prev-month"){t.preventDefault(),Te(this.state),this.render();return}if(i==="next-month"){t.preventDefault(),Me(this.state),this.render();return}if(i==="toggle-rolling"){t.preventDefault(),this.state.rollingSelectorOpen=!this.state.rollingSelectorOpen,this.render(),this.state.rollingSelectorOpen&&this.element&&bo(this.element);return}if(i==="today"){t.preventDefault();const l=Lr(this.state,this.options);l&&this.selectDate(l);return}const r=e.closest(".wg-datepicker__day");if(r){t.preventDefault();const l=zr(r,this.state,this.options);l&&this.selectDate(l);return}const n=e.closest("[data-month]");if(n&&this.state.rollingSelectorOpen){t.preventDefault(),Or(n,this.state),this.render();return}const s=e.closest("[data-year]");if(s&&this.state.rollingSelectorOpen){t.preventDefault(),Ar(s,this.state),this.render();return}}handleClickOutside(t){if(!this.element||!this.anchor)return;const e=t.target;!this.element.contains(e)&&!this.anchor.contains(e)&&this.close()}handleKeyDown(t){$r(t,this.state,this.options,{onSelect:(i,r)=>this.selectDate(i,r),onClose:()=>this.close()})&&this.render()}selectDate(t,e){var i,r;this.state.selectedDate=t,(r=(i=this.options).onSelect)==null||r.call(i,t,e),this.close(!0)}render(){if(!this.element)return;const t=this.element.querySelector(".wg-datepicker");t&&(Dr(t,this.state,this.localeStrings),Rr(t,this.state.rollingSelectorOpen),this.state.rollingSelectorOpen?Er(t,this.state):xr(t,this.state,this.options))}connectInput(t){this.input=t,this.previousInputValue=t.value,t.addEventListener("input",()=>{this.previousInputValue=Pr(t,this.formatInfo,this.previousInputValue),qr(t.value,this.formatInfo,this.state,this.options)}),t.addEventListener("keydown",e=>{Hr(e,this.formatInfo)}),t.addEventListener("paste",e=>{Fr(e,t,this.formatInfo)}),t.addEventListener("focus",()=>{!this.state.isOpen&&this.anchor&&this.open(this.anchor,t.value)})}}const Nr=`
508
509
  .wg-context-menu-container {
509
510
  position: fixed;
510
511
  z-index: var(--wg-cm-z-index, 10000);
@@ -599,10 +600,10 @@
599
600
  background: var(--wg-cm-border-color);
600
601
  margin: var(--wg-cm-padding) 0;
601
602
  }
602
- `;let eo=!1;function cr(){if(eo)return;const e=document.createElement("style");e.id="wg-context-menu-styles",e.textContent=dr,document.head.appendChild(e),eo=!0}function gr(e,o){const t=e.filter(r=>r.visible===void 0?!0:typeof r.visible=="function"?r.visible(o):r.visible);return t.length===0?"":`<div class="wg-context-menu">${t.map((r,n)=>{const s=typeof r.label=="function"?r.label(o):r.label,c=typeof r.icon=="function"?r.icon(o):r.icon,a=r.shortcut,l=typeof r.disabled=="function"?r.disabled(o):r.disabled,g=r.danger===!0,d=["wg-context-menu__item",l?"wg-context-menu__item--disabled":"",g?"wg-context-menu__item--danger":""].filter(Boolean).join(" "),h=r.dividerBefore&&n>0?'<div class="wg-context-menu__divider"></div>':"",u=c?`<span class="wg-context-menu__icon">${c}</span>`:"",p=a?`<span class="wg-context-menu__shortcut">${a}</span>`:"";return`${h}<div class="${d}" data-item-id="${r.id}" data-disabled="${l?"true":"false"}" data-shortcut="${a||""}">${u}<span class="wg-context-menu__label">${s}</span>${p}</div>`}).join("")}</div>`}function ur(e,o,t,i,r,n,s,c,a){cr();const l=gr(n,s);if(!l)return null;const g=document.createElement("div");g.className="wg-context-menu-container",g.innerHTML=l,document.body.appendChild(g);const d=g.querySelector(".wg-context-menu"),h=o+i,u=t+r;$t({getBoundingClientRect:()=>({width:0,height:0,x:h,y:u,top:u,left:h,right:h,bottom:u})},d,{placement:"bottom-start",middleware:[Et({fallbackPlacements:["top-start","bottom-end","top-end"]}),te({padding:8})]}).then(({x:w,y:_})=>{Object.assign(d.style,{left:`${w}px`,top:`${_}px`})}),g.addEventListener("click",w=>{const _=w.target.closest(".wg-context-menu__item");if(_&&_.dataset.disabled!=="true"){const m=_.dataset.itemId||"";c(m)}});const b=w=>{g.contains(w.target)||(St(g,b,v),a())},v=w=>{if(w.key==="Escape"){w.preventDefault(),St(g,b,v),a();return}const _=w.key.toLowerCase(),m=g.querySelectorAll(".wg-context-menu__item");for(const C of m){const y=C.dataset.shortcut;if(C.dataset.disabled==="true"||!y)continue;if(y.toLowerCase()===_||y===w.key){w.preventDefault();const x=C.dataset.itemId||"";c(x),St(g,b,v),a();return}}};return setTimeout(()=>{document.addEventListener("mousedown",b),document.addEventListener("keydown",v)},0),g._cleanup={handleOutsideClick:b,handleKeyDown:v},g}function St(e,o,t){o&&document.removeEventListener("mousedown",o),t&&document.removeEventListener("keydown",t);const i=e._cleanup;i&&(i.handleOutsideClick&&document.removeEventListener("mousedown",i.handleOutsideClick),i.handleKeyDown&&document.removeEventListener("keydown",i.handleKeyDown)),e.remove()}function be(e){const o=e.split("+").map(i=>i.trim()),t={key:"",ctrl:!1,shift:!1,alt:!1,meta:!1};for(const i of o){const r=i.toLowerCase();r==="ctrl"||r==="control"?t.ctrl=!0:r==="shift"?t.shift=!0:r==="alt"?t.alt=!0:r==="meta"||r==="cmd"||r==="command"?t.meta=!0:t.key=i}return t}function ve(e,o){if(o.ctrl!==e.ctrlKey||o.shift!==e.shiftKey||o.alt!==e.altKey||o.meta!==e.metaKey)return!1;const t=e.key.toLowerCase(),i=o.key.toLowerCase();return t===i}function hr(e){return e.split("+").map(o=>{const t=o.trim();return["ctrl","control","shift","alt","meta","cmd","command"].includes(t.toLowerCase())?t.charAt(0).toUpperCase()+t.slice(1).toLowerCase():t}).join("+")}class _e extends HTMLElement{constructor(){super();f(this,"grid");f(this,"shadow");f(this,"styleElement");f(this,"customStyleElement",null);f(this,"updatePending",!1);f(this,"isCommittingFromKeyboard",!1);f(this,"isTransitioningCells",!1);f(this,"wheelListenerAdded",!1);f(this,"toolbarOutsideClickAdded",!1);f(this,"toolbarScrollListenerAdded",!1);f(this,"toolbarMoveInProgress",!1);f(this,"toolbarHideTimeout",null);f(this,"toolbarHovered",!1);f(this,"toolbarShortcutHandler",null);f(this,"inlineShortcutHandler",null);f(this,"dropdownOpen",!1);f(this,"dropdownOptions",[]);f(this,"highlightedIndex",-1);f(this,"filterText","");f(this,"isUserFiltering",!1);f(this,"justSelected",!1);f(this,"isOpeningDropdown",!1);f(this,"isProgrammaticScroll",!1);f(this,"searchDebounceTimer",null);f(this,"searchAbortController",null);f(this,"isSearching",!1);f(this,"tooltipElement",null);f(this,"tooltipArrowElement",null);f(this,"tooltipAnchor",null);f(this,"tooltipShowTimer",null);f(this,"tooltipHideTimer",null);f(this,"_tooltipShowDelay",400);f(this,"_tooltipHideDelay",100);f(this,"datepicker",null);f(this,"contextMenuElement",null);f(this,"virtualScrollStart",0);f(this,"virtualScrollEnd",0);f(this,"scrollListenerAdded",!1);f(this,"isLoadingMoreItems",!1);f(this,"handlePaste",t=>{var l;if(!this.grid.isNavigateMode||this.grid.editingCell||!this.grid.focusedCell)return;const{rowIndex:i,colIndex:r}=this.grid.focusedCell,n=this.grid.columns[r],s=this.grid.displayItems[i];if(!n||!s||!this.grid.isCellEditable(n))return;t.preventDefault();let c=((l=t.clipboardData)==null?void 0:l.getData("text"))||"";if(n.beforePasteCallback){const g=n.beforePasteCallback(c,s);c=g!=null?String(g):""}const a=String(n.field);this.grid.commitEdit(i,a,c),this.render()});this.shadow=this.attachShadow({mode:"open"}),this.grid=new ct,this.styleElement=document.createElement("style"),this.styleElement.textContent=ro,this.shadow.appendChild(this.styleElement),this.grid.requestUpdate=()=>this.requestUpdate(),this.grid._onInteractionChange=(t,i)=>{t==="editingCell"&&i.current===null&&O(this)}}get tooltipShowDelay(){return this._tooltipShowDelay}set tooltipShowDelay(t){this._tooltipShowDelay=t}get tooltipHideDelay(){return this._tooltipHideDelay}set tooltipHideDelay(t){this._tooltipHideDelay=t}connectedCallback(){this.render(),this.addEventListener("paste",this.handlePaste)}disconnectedCallback(){this.removeEventListener("paste",this.handlePaste),this.datepicker&&(this.datepicker.destroy(),this.datepicker=null),this.contextMenuElement&&(St(this.contextMenuElement),this.contextMenuElement=null),qt(),this.removeInlineShortcuts()}get items(){return this.grid.items}set items(t){this.grid.items=t,this.isLoadingMoreItems=!1}get columns(){return this.grid.columns}set columns(t){this.grid.columns=t}get filterable(){return this.grid.filterable}set filterable(t){this.grid.filterable=t}get pageable(){return this.grid.pageable}set pageable(t){this.grid.pageable=t}get pageSize(){return this.grid.pageSize}set pageSize(t){this.grid.pageSize=t}get pageSizes(){return this.grid.pageSizes}set pageSizes(t){this.grid.pageSizes=t}get striped(){return this.grid.striped}set striped(t){this.grid.striped=t}get hoverable(){return this.grid.hoverable}set hoverable(t){this.grid.hoverable=t}get editable(){return this.grid.editable}set editable(t){this.grid.editable=t}get editTrigger(){return this.grid.editTrigger}set editTrigger(t){this.grid.editTrigger=t}get editStartSelection(){return this.grid.editStartSelection}set editStartSelection(t){this.grid.editStartSelection=t}get mode(){return this.grid.mode}set mode(t){this.grid.mode=t}get dropdownToggleVisibility(){return this.grid.dropdownToggleVisibility}set dropdownToggleVisibility(t){this.grid.dropdownToggleVisibility=t}get dropdownShowOnFocus(){return this.grid.dropdownShowOnFocus}set dropdownShowOnFocus(t){this.grid.dropdownShowOnFocus=t}get openDropdownOnEnter(){return this.grid.openDropdownOnEnter}set openDropdownOnEnter(t){this.grid.openDropdownOnEnter=t}get checkboxAlwaysEditable(){return this.grid.checkboxAlwaysEditable}set checkboxAlwaysEditable(t){this.grid.checkboxAlwaysEditable=t}get showRowNumbers(){return this.grid.showRowNumbers}set showRowNumbers(t){this.grid.showRowNumbers=t}get invalidCells(){return this.grid.invalidCells}set invalidCells(t){this.grid.invalidCells=t}get showRowToolbar(){return this.grid.showRowToolbar}set showRowToolbar(t){this.grid.showRowToolbar=t}get rowToolbar(){return this.grid.rowToolbar}set rowToolbar(t){this.grid.rowToolbar=t}get toolbarVerticalAlign(){return this.grid.toolbarVerticalAlign}set toolbarVerticalAlign(t){this.grid.toolbarVerticalAlign=t}get toolbarHorizontalAlign(){return this.grid.toolbarHorizontalAlign}set toolbarHorizontalAlign(t){this.grid.toolbarHorizontalAlign=t}get toolbarAlign(){return this.grid.toolbarVerticalAlign}set toolbarAlign(t){this.grid.toolbarVerticalAlign=t}get toolbarTopPosition(){return this.grid.toolbarHorizontalAlign}set toolbarTopPosition(t){this.grid.toolbarHorizontalAlign=t}get toolbarTrigger(){return this.grid.toolbarTrigger}set toolbarTrigger(t){this.grid.toolbarTrigger=t}get toolbarPosition(){return this.grid.toolbarPosition}set toolbarPosition(t){this.grid.toolbarPosition=t}get inlineActionsTitle(){return this.grid.inlineActionsTitle}set inlineActionsTitle(t){this.grid.inlineActionsTitle=t}get contextMenu(){return this.grid.contextMenu}set contextMenu(t){this.grid.contextMenu=t}get contextMenuXOffset(){return this.grid.contextMenuXOffset}set contextMenuXOffset(t){this.grid.contextMenuXOffset=t}get contextMenuYOffset(){return this.grid.contextMenuYOffset}set contextMenuYOffset(t){this.grid.contextMenuYOffset=t}get rowShortcuts(){return this.grid.rowShortcuts}set rowShortcuts(t){this.grid.rowShortcuts=t}get showShortcutsHelp(){return this.grid.showShortcutsHelp}set showShortcutsHelp(t){this.grid.showShortcutsHelp=t}get shortcutsHelpPosition(){return this.grid.shortcutsHelpPosition}set shortcutsHelpPosition(t){this.grid.shortcutsHelpPosition=t}get shortcutsHelpContentCallback(){return this.grid.shortcutsHelpContentCallback}set shortcutsHelpContentCallback(t){this.grid.shortcutsHelpContentCallback=t}get showRowActions(){return this.grid.showRowActions}set showRowActions(t){this.grid.showRowActions=t}get rowActions(){return this.grid.rowActions}set rowActions(t){this.grid.rowActions=t}set onrowchange(t){this.grid.onrowchange=t}set onroweditstart(t){this.grid.onroweditstart=t}set onroweditcancel(t){this.grid.onroweditcancel=t}set onvalidationerror(t){this.grid.onvalidationerror=t}get validationTooltipCallback(){return this.grid.validationTooltipCallback}set validationTooltipCallback(t){this.grid.validationTooltipCallback=t}set ontoolbarclick(t){this.grid.ontoolbarclick=t}set onrowaction(t){this.grid.onrowaction=t}set oncontextmenuopen(t){this.grid.oncontextmenuopen=t}get ondatarequest(){return this.grid.ondatarequest}set ondatarequest(t){this.grid.ondatarequest=t}get onrowdelete(){return this.grid.onrowdelete}set onrowdelete(t){this.grid.onrowdelete=t}get sort(){return this.grid.sort}set sort(t){this.grid.sort=t}get sortMode(){return this.grid.sortMode}set sortMode(t){this.grid.sortMode=t}get currentPage(){return this.grid.currentPage}set currentPage(t){this.grid.currentPage=t}get totalItems(){return this.grid.totalItems}set totalItems(t){this.grid.totalItems=t}get showPagination(){return this.grid.showPagination}set showPagination(t){this.grid.showPagination=t}get paginationPosition(){return this.grid.paginationPosition}set paginationPosition(t){this.grid.paginationPosition=t}get paginationLabelsCallback(){return this.grid.paginationLabelsCallback}set paginationLabelsCallback(t){this.grid.paginationLabelsCallback=t}get paginationLayout(){return this.grid.paginationLayout}set paginationLayout(t){this.grid.paginationLayout=t}get summaryPosition(){return this.grid.summaryPosition}set summaryPosition(t){this.grid.summaryPosition=t}get summaryContentCallback(){return this.grid.summaryContentCallback}set summaryContentCallback(t){this.grid.summaryContentCallback=t}get customStylesCallback(){return this.grid.customStylesCallback}set customStylesCallback(t){this.grid.customStylesCallback=t,this.updateCustomStyles()}get rowClassCallback(){return this.grid.rowClassCallback}set rowClassCallback(t){this.grid.rowClassCallback=t}get labels(){return this.grid.labels}set labels(t){this.grid.labels=t}get summaryMetadata(){return this.grid.summaryMetadata}set summaryMetadata(t){this.grid.summaryMetadata=t}get summaryInline(){return this.grid.summaryInline}set summaryInline(t){this.grid.summaryInline=t}get idValueMember(){return this.grid.idValueMember}set idValueMember(t){this.grid.idValueMember=t}get idValueCallback(){return this.grid.idValueCallback}set idValueCallback(t){this.grid.idValueCallback=t}get rowLocking(){return this.grid.rowLocking}set rowLocking(t){this.grid.rowLocking=t}get onrowlockchange(){return this.grid.onrowlockchange}set onrowlockchange(t){this.grid.onrowlockchange=t}get virtualScroll(){return this.grid.virtualScroll}set virtualScroll(t){this.grid.virtualScroll=t}get virtualScrollThreshold(){return this.grid.virtualScrollThreshold}set virtualScrollThreshold(t){this.grid.virtualScrollThreshold=t}get virtualScrollRowHeight(){return this.grid.virtualScrollRowHeight}set virtualScrollRowHeight(t){this.grid.virtualScrollRowHeight=t}get virtualScrollBuffer(){return this.grid.virtualScrollBuffer}set virtualScrollBuffer(t){this.grid.virtualScrollBuffer=t}get infiniteScroll(){return this.grid.infiniteScroll}set infiniteScroll(t){this.grid.infiniteScroll=t}get infiniteScrollThreshold(){return this.grid.infiniteScrollThreshold}set infiniteScrollThreshold(t){this.grid.infiniteScrollThreshold=t}get hasMoreItems(){return this.grid.hasMoreItems}set hasMoreItems(t){this.grid.hasMoreItems=t}get displayItems(){return this.grid.displayItems}get totalPages(){return this.grid.totalPages}get isNavigateMode(){return this.grid.isNavigateMode}getRowDraft(t){return this.grid.getRowDraft(t)}hasRowDraft(t){return this.grid.hasRowDraft(t)}discardRowDraft(t){this.grid.discardRowDraft(t)}getDraftRowIndices(){return this.grid.getDraftRowIndices()}discardAllDrafts(){this.grid.discardAllDrafts()}isCellInvalid(t,i){return this.grid.isCellInvalid(t,i)}getCellValidationError(t,i){return this.grid.getCellValidationError(t,i)}getRowId(t){return this.grid.getRowId(t)}findRowById(t){return this.grid.findRowById(t)}isRowLocked(t){return this.grid.isRowLocked(t)}getRowLockInfo(t){return this.grid.getRowLockInfo(t)}lockRowById(t,i){return this.grid.lockRowById(t,i)}unlockRowById(t){return this.grid.unlockRowById(t)}getExternalLocks(){return this.grid.getExternalLocks()}clearExternalLocks(){this.grid.clearExternalLocks()}updateRowById(t,i){return this.grid.updateRowById(t,i)}replaceRowById(t,i){return this.grid.replaceRowById(t,i)}canEditCell(t,i){return this.grid.canEditCell(t,i)}focusCell(t,i){const r=this.grid.columns,n=this.grid.displayItems;t<0||t>=n.length||i<0||i>=r.length||(this.grid.setFocusedCell(t,i),requestAnimationFrame(()=>{A(this,t,i)}))}startEditing(t,i){const r=this.grid.columns;if(i<0||i>=r.length)return;const n=r[i],s=String(n.field);this.grid.startEdit(t,s);const c=this.shadow.querySelector(`td[data-row="${t}"][data-col="${i}"]`);c&&(c.classList.remove("wg__cell--focused"),c.classList.add("wg__cell--editing"),c.innerHTML=Ft(this,t,i,n))}escapeHtml(t){const i=document.createElement("div");return i.textContent=t,i.innerHTML}getCurrentEditingColumn(){const t=this.grid.editingCell;return t&&this.grid.columns.find(i=>String(i.field)===t.field)||null}getCurrentEditorOptions(){const t=this.getCurrentEditingColumn();return(t==null?void 0:t.editorOptions)||{}}moveFocusAfterCommit(t,i,r){ie(this,t,i,r)}requestUpdate(){this.updatePending||(this.updatePending=!0,queueMicrotask(()=>{this.updatePending=!1,this.render()}))}updateCustomStyles(){const t=this.grid.customStylesCallback;if(t){const i=t();this.customStyleElement||(this.customStyleElement=document.createElement("style"),this.shadow.appendChild(this.customStyleElement)),this.customStyleElement.textContent=i}else this.customStyleElement&&(this.customStyleElement.remove(),this.customStyleElement=null)}handleCellKeyDown(t,i,r){var g;if(!this.grid.isNavigateMode)return;const n=this.grid.columns,s=this.grid.displayItems,c=this.grid.getEditableColumns(),a=c.findIndex(d=>d.index===r);if((t.ctrlKey||t.metaKey)&&t.key==="c"){const d=n[r],h=s[i];if(d&&h){let u=this.grid.getCellRawValue(h,i,String(d.field));d.beforeCopyCallback&&(u=d.beforeCopyCallback(u,h));const p=u!=null?String(u):"";navigator.clipboard.writeText(p)}return}const l=this.grid.rowShortcuts;if(l&&l.length>0){const d=n[r],h=s[i];if(d&&h)for(const u of l){const p=be(u.key);if(ve(t,p)){const b={row:h,rowIndex:i,colIndex:r,column:d,cellValue:this.grid.getCellRawValue(h,i,String(d.field))};if(!(typeof u.disabled=="function"?u.disabled(b):u.disabled===!0)){t.preventDefault(),u.action(b);return}}}}switch(t.key){case"ArrowUp":t.preventDefault(),i>0&&A(this,i-1,r);break;case"ArrowDown":t.preventDefault(),i<s.length-1&&A(this,i+1,r);break;case"ArrowLeft":t.preventDefault(),r>0&&A(this,i,r-1);break;case"ArrowRight":t.preventDefault(),r<n.length-1&&A(this,i,r+1);break;case"Tab":if(t.preventDefault(),t.shiftKey){if(a>0){const d=c[a-1].index;A(this,i,d)}else if(i>0){const d=c[c.length-1].index;A(this,i-1,d)}}else if(a>=0&&a<c.length-1){const d=c[a+1].index;A(this,i,d)}else if(a===-1&&c.length>0)A(this,i,c[0].index);else if(i<s.length-1){const d=c[0].index;A(this,i+1,d)}break;case"Home":if(t.preventDefault(),t.ctrlKey)if(this.grid.shouldUseVirtualScroll()){const d=this.grid.focusedCell;this.grid.setFocusedCell(0,0),this.scrollToRowProgrammatically(0);const h=this.shadow.querySelector('td[data-row="0"][data-col="0"]');h&&(h.focus({preventScroll:!0}),K(this,d,{rowIndex:0,colIndex:0}))}else A(this,0,0);else A(this,i,0);break;case"End":if(t.preventDefault(),t.ctrlKey){const d=s.length-1,h=n.length-1;if(this.grid.shouldUseVirtualScroll()){const u=this.grid.focusedCell;this.grid.setFocusedCell(d,h),this.scrollToRowProgrammatically(d);const p=this.shadow.querySelector(`td[data-row="${d}"][data-col="${h}"]`);p&&(p.focus({preventScroll:!0}),K(this,u,{rowIndex:d,colIndex:h}))}else A(this,d,h)}else A(this,i,n.length-1);break;case"PageUp":if(t.preventDefault(),t.ctrlKey)if(this.grid.shouldUseVirtualScroll()){const d=this.grid.focusedCell;this.grid.setFocusedCell(0,r),this.scrollToRowProgrammatically(0);const h=this.shadow.querySelector(`td[data-row="0"][data-col="${r}"]`);h&&(h.focus({preventScroll:!0}),K(this,d,{rowIndex:0,colIndex:r}))}else A(this,0,r);else{const d=Math.max(0,i-10);if(this.grid.shouldUseVirtualScroll()){const h=this.grid.focusedCell;this.grid.setFocusedCell(d,r),this.scrollToRowProgrammatically(d);const u=this.shadow.querySelector(`td[data-row="${d}"][data-col="${r}"]`);u&&(u.focus({preventScroll:!0}),K(this,h,{rowIndex:d,colIndex:r}))}else A(this,d,r)}break;case"PageDown":if(t.preventDefault(),t.ctrlKey){const d=s.length-1;if(this.grid.shouldUseVirtualScroll()){const h=this.grid.focusedCell;this.grid.setFocusedCell(d,r),this.scrollToRowProgrammatically(d);const u=this.shadow.querySelector(`td[data-row="${d}"][data-col="${r}"]`);u&&(u.focus({preventScroll:!0}),K(this,h,{rowIndex:d,colIndex:r}))}else A(this,d,r)}else{const d=Math.min(s.length-1,i+10);if(this.grid.shouldUseVirtualScroll()){const h=this.grid.focusedCell;this.grid.setFocusedCell(d,r),this.scrollToRowProgrammatically(d);const u=this.shadow.querySelector(`td[data-row="${d}"][data-col="${r}"]`);u&&(u.focus({preventScroll:!0}),K(this,h,{rowIndex:d,colIndex:r}))}else A(this,d,r)}break;case"g":case"G":t.ctrlKey&&(t.preventDefault(),this.showGoToRowDialog(r));break;case"Enter":{t.preventDefault();const d=n[r];((d==null?void 0:d.editor)==="select"||(d==null?void 0:d.editor)==="combobox"||(d==null?void 0:d.editor)==="autocomplete")&&this.grid.getEffectiveOpenDropdownOnEnter(d)?(W(this,i,r),requestAnimationFrame(()=>{this.dropdownOpen||G(this)})):i<s.length-1&&A(this,i+1,r);break}case"F2":{t.preventDefault();const d=n[r],h=(d==null?void 0:d.editor)==="select"||(d==null?void 0:d.editor)==="combobox"||(d==null?void 0:d.editor)==="autocomplete",u=(d==null?void 0:d.editor)==="custom";W(this,i,r),h?requestAnimationFrame(()=>{this.dropdownOpen||G(this)}):u&&requestAnimationFrame(()=>{this.openCustomEditor(i,r)});break}case" ":{t.preventDefault();const d=n[r],h=(d==null?void 0:d.editor)==="checkbox",u=(d==null?void 0:d.editor)==="select"||(d==null?void 0:d.editor)==="combobox"||(d==null?void 0:d.editor)==="autocomplete",p=(d==null?void 0:d.editor)==="date",b=(d==null?void 0:d.editor)==="custom";h?li(this,i,r):u?(W(this,i,r),requestAnimationFrame(()=>{this.dropdownOpen||G(this)})):p?(W(this,i,r),requestAnimationFrame(()=>{var m;const v=(m=this.shadowRoot)==null?void 0:m.querySelector(`.wg__cell[data-row="${i}"][data-col="${r}"]`),w=v==null?void 0:v.querySelector(".wg__date-input"),_=v==null?void 0:v.querySelector(".wg__editor--date");w&&_&&this.openDatePicker(w,_)})):b&&(W(this,i,r),requestAnimationFrame(()=>{this.openCustomEditor(i,r)}));break}case"Escape":if(t.preventDefault(),this.grid.editingCell)N(this),this.grid.cancelEdit();else{const d=this.grid.focusedCell;this.grid.clearFocusedCell(),K(this,d,null),(g=t.target)==null||g.blur()}break;case"Delete":{t.preventDefault();const d=n[r],h=s[i];if(t.ctrlKey){if(h){const u={rowIndex:i,row:h};this.grid.onrowdelete&&this.grid.onrowdelete(u),this.dispatchEvent(new CustomEvent("rowdelete",{detail:u}))}}else d&&this.grid.isCellEditable(d)&&(this.grid.commitEdit(i,String(d.field),null),this.render(),requestAnimationFrame(()=>{const u=this.shadow.querySelector(`td[data-row="${i}"][data-col="${r}"]`);u==null||u.focus()}));break}default:if(t.key.length===1&&!t.ctrlKey&&!t.altKey&&!t.metaKey){const d=n[r];if((d==null?void 0:d.editor)==="number"&&!/[\d.\-]/.test(t.key))return;W(this,i,r,{initialSearchQuery:t.key}),t.preventDefault()}break}}handleEditorKeyDown(t,i){const r=parseInt(i.dataset.row||"0",10),n=i.dataset.field||"",s=this.grid.columns.find(g=>g.field===n),c=(s==null?void 0:s.editor)||"text",a=c==="select"||c==="combobox"||c==="autocomplete",l=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight","PageUp","PageDown","Home","End"];if(a&&!this.dropdownOpen&&l.includes(t.key)){t.preventDefault(),t.stopPropagation();const g=this.grid.columns.findIndex(w=>w.field===n),d=this.grid.columns.map((w,_)=>({index:_,column:w})).filter(w=>w.column.editable!==!1),h=d.findIndex(w=>w.index===g),u=this.grid.displayItems;let p=r,b=g,v=!1;switch(t.key){case"ArrowUp":r>0&&(p=r-1,v=!0);break;case"ArrowDown":r<u.length-1&&(p=r+1,v=!0);break;case"ArrowLeft":h>0&&(b=d[h-1].index,v=!0);break;case"ArrowRight":h<d.length-1&&(b=d[h+1].index,v=!0);break;case"PageUp":p=Math.max(0,r-10),v=!0;break;case"PageDown":p=Math.min(u.length-1,r+10),v=!0;break;case"Home":t.ctrlKey&&(p=0),b=0,v=!0;break;case"End":t.ctrlKey?(p=u.length-1,b=this.grid.columns.length-1):b=this.grid.columns.length-1,v=!0;break}v&&(N(this),this.grid.cancelEdit(),queueMicrotask(()=>{A(this,p,b)}));return}switch(t.key){case"ArrowDown":if(this.dropdownOpen){t.preventDefault(),t.stopPropagation();const g=this.getCurrentEditorOptions();let d=this.highlightedIndex+1;for(;d<this.dropdownOptions.length&&xt(this.dropdownOptions[d],g);)d++;d<this.dropdownOptions.length&&(this.highlightedIndex=d,nt(this),je(this))}break;case"ArrowUp":if(this.dropdownOpen){t.preventDefault(),t.stopPropagation();const g=this.getCurrentEditorOptions();let d=this.highlightedIndex-1;for(;d>=0&&xt(this.dropdownOptions[d],g);)d--;d>=0&&(this.highlightedIndex=d,nt(this),je(this))}break;case"Enter":if(this.datepicker)return;t.preventDefault(),t.stopPropagation(),this.dropdownOpen&&this.highlightedIndex>=0?Ue(this,this.highlightedIndex):a&&!this.dropdownOpen?G(this):(this.isCommittingFromKeyboard=!0,O(this),c==="date"&&i instanceof HTMLInputElement?this.commitDateEditor(i):zt(this,i),ie(this,r,n,"down"));break;case"Tab":if(this.datepicker)return;if(t.preventDefault(),t.stopPropagation(),this.isCommittingFromKeyboard=!0,this.dropdownOpen&&this.highlightedIndex>=0&&a){const g=this.dropdownOptions[this.highlightedIndex],d=this.getCurrentEditorOptions();if(g&&!xt(g,d)){const h=gt(g,d);this.grid.commitEdit(r,n,h)}O(this)}else O(this),c==="date"&&i instanceof HTMLInputElement?this.commitDateEditor(i):a||zt(this,i);ie(this,r,n,t.shiftKey?"prev":"next");break;case"Escape":t.preventDefault(),t.stopPropagation(),this.dropdownOpen&&O(this),this.datepicker&&(this.datepicker.close(!0),this.datepicker=null),this.isCommittingFromKeyboard=!0,N(this),this.grid.cancelEdit(),ci(this,r,n);break;case"F2":t.preventDefault(),t.stopPropagation(),a&&!this.dropdownOpen&&G(this);break;case"Backspace":c==="select"&&(t.preventDefault(),t.stopPropagation(),this.filterText.length>0&&(this.filterText=this.filterText.slice(0,-1),We(this,s.editorOptions||{})));break;default:c==="select"&&t.key.length===1&&!t.ctrlKey&&!t.altKey&&!t.metaKey&&(t.preventDefault(),t.stopPropagation(),this.filterText+=t.key,We(this,s.editorOptions||{}));break}}attachEventListeners(){const t=this.shadow.querySelector(".wg__table");if(!t)return;t.addEventListener("focus",n=>{var c;const s=n.target;if(s.matches(".wg__cell")){const a=parseInt(s.dataset.row||"0",10),l=parseInt(s.dataset.col||"0",10);ri(this,a,l)}if(s.matches(".wg__select-trigger, .wg__combobox-input, .wg__autocomplete-input")&&!this.justSelected&&!this.dropdownOpen){const a=s.dataset.field||"",l=this.grid.columns.find(h=>h.field===a),g=(l==null?void 0:l.editorOptions)||{};(((c=this.grid.editingCell)==null?void 0:c.initialSearchQuery)!==void 0||g.showOnFocus!==!1)&&G(this)}},!0),t.addEventListener("keydown",n=>{const s=n.target;if(s.matches(".wg__editor, .wg__combobox-input, .wg__autocomplete-input, .wg__date-input")){this.handleEditorKeyDown(n,s);return}if(s.matches(".wg__cell")){const c=parseInt(s.dataset.row||"0",10),a=parseInt(s.dataset.col||"0",10);this.handleCellKeyDown(n,c,a)}}),t.addEventListener("focusout",n=>{ni(this,n)}),t.addEventListener("dblclick",n=>{n.preventDefault();const c=n.target.closest(".wg__cell");if(c){const a=parseInt(c.dataset.row||"0",10),l=parseInt(c.dataset.col||"0",10),g=this.grid.columns[l];if(g){const d=g.editTrigger||this.grid.editTrigger;if(d==="dblclick"||d==="navigate"){const h=ee(n,c);W(this,a,l,{cursorPosition:h??void 0});const u=g.editor;u==="select"||u==="combobox"||u==="autocomplete"?requestAnimationFrame(()=>{this.dropdownOpen||G(this)}):u==="custom"&&requestAnimationFrame(()=>{this.openCustomEditor(a,l)})}}}}),t.addEventListener("click",n=>{const c=n.target.closest(".wg__cell");if(c&&!c.classList.contains("wg__cell--editing")){const a=parseInt(c.dataset.row||"0",10),l=parseInt(c.dataset.col||"0",10),g=this.grid.columns[l];if(g&&(g.editTrigger||this.grid.editTrigger)==="click"){n.preventDefault();const h=ee(n,c);W(this,a,l,{cursorPosition:h??void 0});const u=g.editor;u==="select"||u==="combobox"||u==="autocomplete"?requestAnimationFrame(()=>{this.dropdownOpen||G(this)}):u==="custom"&&requestAnimationFrame(()=>{this.openCustomEditor(a,l)})}}}),t.addEventListener("mousedown",n=>{const s=n.target;if(s.closest(".wg__date-trigger")){n.preventDefault(),n.stopPropagation();const a=s.closest(".wg__cell-date-display"),l=s.closest(".wg__editor--date");if(l){const g=l.querySelector(".wg__date-input");g&&this.openDatePicker(g,l)}else if(a){const g=parseInt(a.dataset.row||"0",10),d=a.dataset.field||"",h=this.grid.columns.findIndex(u=>String(u.field)===d);if(h>=0){if(this.isTransitioningCells=!0,this.grid.editingCell){const u=this.grid.editingCell,p=this.grid.columns.findIndex(b=>String(b.field)===u.field);O(this),N(this),this.grid.cancelEdit(),p>=0&&B(this,u.rowIndex,p)}W(this,g,h),requestAnimationFrame(()=>{var v;this.isTransitioningCells=!1;const u=(v=this.shadowRoot)==null?void 0:v.querySelector(`.wg__cell[data-row="${g}"][data-field="${d}"]`),p=u==null?void 0:u.querySelector(".wg__date-input"),b=u==null?void 0:u.querySelector(".wg__editor--date");p&&b&&this.openDatePicker(p,b)})}}return}if(this.dropdownOpen||this.grid.editingCell){const a=s.closest(".wg__cell");if(a&&!s.closest(".wg__editor--select, .wg__editor--combobox, .wg__editor--autocomplete, .wg__editor--date")){const l=parseInt(a.dataset.row||"0",10),g=parseInt(a.dataset.col||"0",10),d=this.grid.editingCell,h=s.matches(".wg__combobox-toggle, .wg__select-toggle, .wg__date-trigger");if(d&&!h){const u=this.grid.columns.findIndex(p=>String(p.field)===d.field);if(l!==d.rowIndex||g!==u){n.preventDefault(),this.isTransitioningCells=!0;const p=d.rowIndex,b=u;O(this),N(this),this.grid.cancelEdit(),b>=0&&B(this,p,b);const v=this.grid.columns[g],w=(v==null?void 0:v.editTrigger)||this.grid.editTrigger,m=n.clientX;requestAnimationFrame(()=>{if(this.isTransitioningCells=!1,w==="click"&&v&&this.grid.isCellEditable(v)){const C=this.shadow.querySelector(`td[data-row="${l}"][data-col="${g}"]`),y=C?ee({clientX:m},C):void 0;W(this,l,g,{cursorPosition:y??void 0})}else A(this,l,g)});return}}}}if(s.matches(".wg__combobox-toggle, .wg__select-toggle")){n.preventDefault(),n.stopPropagation();const a=s.closest(".wg__cell-dropdown-display");if(s.closest(".wg__editor--select, .wg__editor--combobox, .wg__editor--autocomplete"))Ke(this);else if(a){const g=parseInt(a.dataset.row||"0",10),d=a.dataset.field||"",h=this.grid.columns.findIndex(u=>String(u.field)===d);if(h>=0){this.isTransitioningCells=!0;const u=this.grid.editingCell,p=u?this.grid.columns.findIndex(b=>String(b.field)===u.field):-1;u&&(O(this),N(this),this.grid.cancelEdit(),p>=0&&B(this,u.rowIndex,p)),W(this,g,h),requestAnimationFrame(()=>{this.isTransitioningCells=!1,this.dropdownOpen||G(this)})}}}if(s.matches(".wg__cell-dropdown-display")){n.preventDefault(),n.stopPropagation();const a=s.closest(".wg__cell-dropdown-display");if(a){const l=parseInt(a.dataset.row||"0",10),g=a.dataset.field||"",d=this.grid.columns.findIndex(h=>String(h.field)===g);if(d>=0){this.isTransitioningCells=!0;const h=this.grid.editingCell,u=h?this.grid.columns.findIndex(p=>String(p.field)===h.field):-1;h&&(O(this),N(this),this.grid.cancelEdit(),u>=0&&B(this,h.rowIndex,u)),W(this,l,d),requestAnimationFrame(()=>{this.isTransitioningCells=!1,this.dropdownOpen||G(this)})}}}}),t.addEventListener("click",n=>{n.target.matches(".wg__select-trigger, .wg__select-value")&&(n.preventDefault(),n.stopPropagation(),Ke(this))}),t.addEventListener("click",n=>{const s=n,a=s.target.closest(".wg__header--sortable");if(a){const l=a.dataset.field;if(!l)return;const g=[...this.grid.sort],d=g.findIndex(u=>u.column===l);(s.ctrlKey||s.metaKey)&&this.grid.sortMode==="multi"?d>=0?g[d].direction==="asc"?g[d]={column:l,direction:"desc"}:g.splice(d,1):g.push({column:l,direction:"asc"}):d>=0&&g.length===1?g[0].direction==="asc"?g[0]={column:l,direction:"desc"}:g.length=0:(g.length=0,g.push({column:l,direction:"asc"})),this.grid.sort=g,this.grid.pageable&&(this.grid.currentPage=1),this.grid.fireDataRequest("sort"),this.render()}}),t.addEventListener("contextmenu",n=>{this.handleContextMenu(n)}),t.addEventListener("change",n=>{const s=n.target;s.matches(".wg__editor--checkbox")&&ai(this,s)}),t.addEventListener("input",n=>{const s=n.target;s.matches(".wg__combobox-input")?Ri(this,n):s.matches(".wg__autocomplete-input")&&Ai(this,n)}),t.addEventListener("blur",n=>{const s=n.target;if(s.matches(".wg__editor--text, .wg__editor--number")&&di(this,s),s.matches(".wg__date-input")&&!this.datepicker&&!this.isCommittingFromKeyboard&&!this.isTransitioningCells&&this.commitDateEditor(s),s.matches(".wg__select-trigger")&&!this.isCommittingFromKeyboard&&!this.isTransitioningCells&&!this.dropdownOpen&&!this.isOpeningDropdown&&(O(this),N(this),this.grid.cancelEdit()),s.matches(".wg__combobox-input, .wg__autocomplete-input")){if(this.isCommittingFromKeyboard||this.isTransitioningCells)return;if(O(this),this.grid.editingCell){const c=s,a=this.getCurrentEditingColumn();if(a){const l=a.editorOptions||{},d=(l.options||l.initialOptions||[]).find(h=>kt(h,l).toLowerCase()===c.value.toLowerCase());d?this.grid.commitEdit(this.grid.editingCell.rowIndex,this.grid.editingCell.field,gt(d,l)):this.grid.commitEdit(this.grid.editingCell.rowIndex,this.grid.editingCell.field,c.value)}}}},!0);const i=this.shadow.querySelector(".wg");i&&i.addEventListener("scroll",()=>{if(this.dropdownOpen&&!this.isTransitioningCells&&!this.isOpeningDropdown){const n=this.grid.editingCell,s=n?this.grid.columns.findIndex(c=>String(c.field)===n.field):-1;O(this),N(this),this.grid.cancelEdit(),n&&s>=0&&B(this,n.rowIndex,s)}this.grid.shouldUseVirtualScroll()&&this.handleVirtualScroll(i),this.grid.infiniteScroll&&this.grid.hasMoreItems&&!this.isLoadingMoreItems&&this.handleInfiniteScroll(i),yt()!==null&&(qe(this,this.grid.displayItems),this.renderConnector())}),this.wheelListenerAdded||(this.wheelListenerAdded=!0,window.addEventListener("scroll",()=>{if(this.dropdownOpen&&!this.isTransitioningCells){const n=this.grid.editingCell,s=n?this.grid.columns.findIndex(c=>String(c.field)===n.field):-1;O(this),N(this),this.grid.cancelEdit(),n&&s>=0&&B(this,n.rowIndex,s)}},{passive:!0,capture:!0})),t.addEventListener("mouseenter",n=>{const s=n.target,c=s.closest("[data-tooltip-html]");if(c){const l=c.getAttribute("data-tooltip-html");ge(this,c,l,this._tooltipShowDelay,!0);return}const a=s.closest("[data-tooltip]");if(a){const l=a.getAttribute("data-tooltip");ge(this,a,l,this._tooltipShowDelay,!1)}},!0),t.addEventListener("mouseleave",n=>{const s=n,c=s.target,a=s.relatedTarget,l=c.closest("[data-tooltip], [data-tooltip-html]");l&&(a==null?void 0:a.closest("[data-tooltip], [data-tooltip-html]"))===l||l&&Xe(this,this._tooltipHideDelay)},!0),t.addEventListener("click",n=>{const c=n.target.closest(".wg__toolbar-trigger");if(c&&this.grid.toolbarTrigger==="button"){n.preventDefault(),n.stopPropagation();const a=parseInt(c.dataset.toolbarTrigger||"0",10),l=t.querySelector(`tr[data-row-index="${a}"]`);l&&(ae(a)?this.closeToolbarAndReset():this.showToolbarForRow(l,a))}}),t.addEventListener("click",n=>{if(this.grid.toolbarPosition!=="inline")return;const c=n.target.closest(".wg__inline-action-btn");if(c&&!c.disabled){n.preventDefault(),n.stopPropagation();const a=c.dataset.actionId,l=parseInt(c.dataset.row||"0",10);this.handleInlineActionClick(a,l)}}),t.addEventListener("mouseenter",n=>{const s=n,a=s.target.closest(".wg__row");if(a){const l=parseInt(a.dataset.rowIndex||"0",10);this.grid.setHoveredRow(l),this.grid.toolbarPosition==="inline"&&this.setupInlineShortcuts(),this.grid.toolbarTrigger==="hover"&&this.grid.toolbarPosition!=="inline"&&(this.toolbarHideTimeout&&(clearTimeout(this.toolbarHideTimeout),this.toolbarHideTimeout=null),ae(l)||this.showToolbarForRow(a,l,s.clientX))}},!0),t.addEventListener("mouseleave",n=>{if(n.target.closest(".wg__row")&&(this.grid.toolbarPosition==="inline"&&setTimeout(()=>{t.matches(":hover")||(this.grid.setHoveredRow(null),this.removeInlineShortcuts())},50),this.grid.toolbarTrigger==="hover"&&this.grid.toolbarPosition!=="inline")){if(this.toolbarMoveInProgress)return;this.toolbarHideTimeout&&clearTimeout(this.toolbarHideTimeout),this.toolbarHideTimeout=setTimeout(()=>{const l=this.shadow.querySelector(".wg__toolbar-container"),g=l==null?void 0:l.matches(":hover"),d=t.matches(":hover");!g&&!d&&(this.grid.setHoveredRow(null),this.closeToolbarAndReset())},150)}},!0),t.addEventListener("click",n=>{if(this.grid.toolbarTrigger!=="click")return;const s=n,c=s.target,a=c.closest(".wg__row");if(a&&!c.closest(".wg__cell--editing")){const l=parseInt(a.dataset.rowIndex||"0",10);ae(l)?this.closeToolbarAndReset():this.showToolbarForRow(a,l,s.clientX)}}),this.toolbarOutsideClickAdded||(this.toolbarOutsideClickAdded=!0,document.addEventListener("click",n=>{if(!Fe(this.shadow))return;const s=n.composedPath(),c=s.some(g=>{var d;return(d=g.classList)==null?void 0:d.contains("wg__toolbar-container")}),a=s.some(g=>{var d;return(d=g.classList)==null?void 0:d.contains("wg__toolbar-trigger")});c||a||s.includes(this)&&(this.grid.toolbarTrigger==="hover"||this.grid.toolbarTrigger==="click")||yt()!==null&&this.closeToolbarAndReset()})),this.toolbarScrollListenerAdded||(this.toolbarScrollListenerAdded=!0,window.addEventListener("scroll",()=>{yt()!==null&&this.closeToolbarAndReset()},!0)),this.shadow.querySelectorAll(".wg__pagination").forEach(n=>{n.addEventListener("click",c=>{const l=c.target.closest(".wg__pagination-btn");if(!l||l.hasAttribute("disabled"))return;const g=l.dataset.action;let d=!1;g==="first"&&this.grid.currentPage!==1?(this.grid.currentPage=1,d=!0):g==="prev"&&this.grid.currentPage>1?(this.grid.currentPage--,d=!0):g==="next"&&this.grid.currentPage<this.grid.totalPages?(this.grid.currentPage++,d=!0):g==="last"&&this.grid.currentPage!==this.grid.totalPages&&(this.grid.currentPage=this.grid.totalPages,d=!0),d&&(this.grid.fireDataRequest("page"),this.render())});const s=n.querySelector(".wg__pagination-select");s&&s.addEventListener("change",()=>{const c=parseInt(s.value,10);c!==this.grid.pageSize&&(this.grid.pageSize=c,this.grid.currentPage=1,this.grid.fireDataRequest("pageSize"),this.render())})})}scrollToRowProgrammatically(t){const i=this.shadow.querySelector(".wg");if(!i)return;const r=this.grid.displayItems,n=this.grid.virtualScrollRowHeight,s=this.grid.virtualScrollBuffer,c=i.clientHeight,a=Math.max(0,(t-1)*n),l=Math.max(0,i.scrollHeight-i.clientHeight),g=Math.min(a,l);let d=Math.max(0,Math.floor(g/n)-s);const h=Math.ceil(c/n)+s*2;let u=Math.min(r.length,d+h);t<d&&(d=t),t>=u&&(u=t+1),(d!==this.virtualScrollStart||u!==this.virtualScrollEnd)&&(this.virtualScrollStart=d,this.virtualScrollEnd=u,this.renderVirtualRows(i)),this.isProgrammaticScroll=!0,i.scrollTop=g,queueMicrotask(()=>{this.isProgrammaticScroll=!1})}handleVirtualScroll(t){if(this.isProgrammaticScroll)return;const i=this.grid.displayItems,r=this.grid.virtualScrollRowHeight,n=this.grid.virtualScrollBuffer,s=t.scrollTop,c=t.clientHeight;let a=Math.max(0,Math.floor(s/r)-n);const l=Math.ceil(c/r)+n*2;let g=Math.min(i.length,a+l);const d=this.grid.editingCell;if(d){const h=d.rowIndex;h<a&&(a=h),h>=g&&(g=h+1)}(a!==this.virtualScrollStart||g!==this.virtualScrollEnd)&&(this.virtualScrollStart=a,this.virtualScrollEnd=g,this.renderVirtualRows(t))}renderVirtualRows(t){const i=t.querySelector("tbody");if(!i)return;const r=this.grid.displayItems,n={startIndex:this.virtualScrollStart,endIndex:this.virtualScrollEnd,rowHeight:this.grid.virtualScrollRowHeight,totalItems:r.length},s=this.grid.focusedCell;if(i.innerHTML=Be(this,n),s){this.grid.setFocusedCell(s.rowIndex,s.colIndex);const c=i.querySelector(`td[data-row="${s.rowIndex}"][data-col="${s.colIndex}"]`);c&&(c.focus({preventScroll:!0}),K(this,null,s))}}handleInfiniteScroll(t){const i=t.scrollTop,r=t.scrollHeight,n=t.clientHeight,s=this.grid.infiniteScrollThreshold;r-(i+n)<=s&&(this.isLoadingMoreItems=!0,this.grid.fireDataRequest("loadMore"))}renderShortcutsHelpIcon(){var s,c,a;if(!this.grid.showShortcutsHelp||!((s=this.grid.rowShortcuts)!=null&&s.length))return"";const i=this.grid.shortcutsHelpPosition==="top-left"?"wg__shortcuts-help--left":"",r=this.grid.rowShortcuts.map(l=>`<div class="wg__shortcuts-help-item">
603
- <span class="wg__shortcuts-help-key">${hr(l.key)}</span>
604
- <span class="wg__shortcuts-help-label">${l.label}</span>
605
- </div>`).join(""),n=((a=(c=this.grid).shortcutsHelpContentCallback)==null?void 0:a.call(c))||"";return`
603
+ `;let vo=!1;function Yr(){if(vo)return;const o=document.createElement("style");o.id="wg-context-menu-styles",o.textContent=Nr,document.head.appendChild(o),vo=!0}function Wr(o,t){const e=o.filter(r=>r.visible===void 0?!0:typeof r.visible=="function"?r.visible(t):r.visible);return e.length===0?"":`<div class="wg-context-menu">${e.map((r,n)=>{const s=typeof r.label=="function"?r.label(t):r.label,a=typeof r.icon=="function"?r.icon(t):r.icon,l=r.shortcut,d=typeof r.disabled=="function"?r.disabled(t):r.disabled,c=r.danger===!0,u=["wg-context-menu__item",d?"wg-context-menu__item--disabled":"",c?"wg-context-menu__item--danger":""].filter(Boolean).join(" "),g=r.dividerBefore&&n>0?'<div class="wg-context-menu__divider"></div>':"",h=a?`<span class="wg-context-menu__icon">${a}</span>`:"",f=l?`<span class="wg-context-menu__shortcut">${l}</span>`:"";return`${g}<div class="${u}" data-item-id="${r.id}" data-disabled="${d?"true":"false"}" data-shortcut="${l||""}">${h}<span class="wg-context-menu__label">${s}</span>${f}</div>`}).join("")}</div>`}function Br(o,t,e,i,r,n,s,a,l){Yr();const d=Wr(n,s);if(!d)return null;const c=document.createElement("div");c.className="wg-context-menu-container",c.innerHTML=d,document.body.appendChild(c);const u=c.querySelector(".wg-context-menu"),g=t+i,h=e+r;qt({getBoundingClientRect:()=>({width:0,height:0,x:g,y:h,top:h,left:g,right:g,bottom:h})},u,{placement:"bottom-start",middleware:[Ft({fallbackPlacements:["top-start","bottom-end","top-end"]}),fe({padding:8})]}).then(({x:p,y:C})=>{Object.assign(u.style,{left:`${p}px`,top:`${C}px`})}),c.addEventListener("click",p=>{const C=p.target.closest(".wg-context-menu__item");if(C&&C.dataset.disabled!=="true"){const _=C.dataset.itemId||"";a(_)}});const m=p=>{c.contains(p.target)||(Lt(c,m,v),l())},v=p=>{if(p.key==="Escape"){p.preventDefault(),Lt(c,m,v),l();return}const C=p.key.toLowerCase(),_=c.querySelectorAll(".wg-context-menu__item");for(const S of _){const b=S.dataset.shortcut;if(S.dataset.disabled==="true"||!b)continue;if(b.toLowerCase()===C||b===p.key){p.preventDefault();const x=S.dataset.itemId||"";a(x),Lt(c,m,v),l();return}}};return setTimeout(()=>{document.addEventListener("mousedown",m),document.addEventListener("keydown",v)},0),c._cleanup={handleOutsideClick:m,handleKeyDown:v},c}function Lt(o,t,e){t&&document.removeEventListener("mousedown",t),e&&document.removeEventListener("keydown",e);const i=o._cleanup;i&&(i.handleOutsideClick&&document.removeEventListener("mousedown",i.handleOutsideClick),i.handleKeyDown&&document.removeEventListener("keydown",i.handleKeyDown)),o.remove()}function Nt(o){const t=o.split("+").map(i=>i.trim()),e={key:"",ctrl:!1,shift:!1,alt:!1,meta:!1};for(const i of t){const r=i.toLowerCase();r==="ctrl"||r==="control"?e.ctrl=!0:r==="shift"?e.shift=!0:r==="alt"?e.alt=!0:r==="meta"||r==="cmd"||r==="command"?e.meta=!0:e.key=i}return e}function Yt(o,t){if(t.ctrl!==o.ctrlKey||t.shift!==o.shiftKey||t.alt!==o.altKey||t.meta!==o.metaKey)return!1;const e=o.key.toLowerCase(),i=t.key.toLowerCase();return e===i}function Ur(o){return o.split("+").map(t=>{const e=t.trim();return["ctrl","control","shift","alt","meta","cmd","command"].includes(e.toLowerCase())?e.charAt(0).toUpperCase()+e.slice(1).toLowerCase():e}).join("+")}function jr(o){const{scrollTop:t,viewportHeight:e,rowHeight:i,buffer:r,totalItems:n,editingRowIndex:s}=o;let a=Math.max(0,Math.floor(t/i)-r);const l=Math.ceil(e/i)+r*2;let d=Math.min(n,a+l);return s!==void 0&&(s<a&&(a=s),s>=d&&(d=s+1)),{startIndex:a,endIndex:d}}function Kr(o){const{targetRow:t,rowHeight:e,buffer:i,totalItems:r,viewportHeight:n,scrollHeight:s,clientHeight:a}=o,l=Math.max(0,(t-1)*e),d=Math.max(0,s-a),c=Math.min(l,d);let u=Math.max(0,Math.floor(c/e)-i);const g=Math.ceil(n/e)+i*2;let h=Math.min(r,u+g);return t<u&&(u=t),t>=h&&(h=t+1),{scrollTop:c,startIndex:u,endIndex:h}}function Xr(o,t,e,i){return t-(o+e)<=i}function Gr(o,t){const i=t.target.closest(".wg__header--sortable");if(!i)return;const r=i.dataset.field;if(!r)return;const n=[...o.grid.sort],s=n.findIndex(l=>l.column===r);(t.ctrlKey||t.metaKey)&&o.grid.sortMode==="multi"?s>=0?n[s].direction==="asc"?n[s]={column:r,direction:"desc"}:n.splice(s,1):n.push({column:r,direction:"asc"}):s>=0&&n.length===1?n[0].direction==="asc"?n[0]={column:r,direction:"desc"}:n.length=0:(n.length=0,n.push({column:r,direction:"asc"})),o.grid.sort=n,o.grid.pageable&&(o.grid.currentPage=1),o.grid.fireDataRequest("sort")}function Qr(o,t){const i=t.target.closest(".wg__pagination-btn");if(!i||i.hasAttribute("disabled"))return!1;const r=i.dataset.action;let n=!1;return r==="first"&&o.grid.currentPage!==1?(o.grid.currentPage=1,n=!0):r==="prev"&&o.grid.currentPage>1?(o.grid.currentPage--,n=!0):r==="next"&&o.grid.currentPage<o.grid.totalPages?(o.grid.currentPage++,n=!0):r==="last"&&o.grid.currentPage!==o.grid.totalPages&&(o.grid.currentPage=o.grid.totalPages,n=!0),n&&o.grid.fireDataRequest("page"),n}function Jr(o,t){const e=parseInt(t.value,10);return e!==o.grid.pageSize?(o.grid.pageSize=e,o.grid.currentPage=1,o.grid.fireDataRequest("pageSize"),!0):!1}let V={isResizing:!1,startX:0,startWidth:0,field:"",headerCell:null,minWidth:30,maxWidth:null},ut=null;function yo(o,t){if(!o)return t;const e=parseFloat(o);return isNaN(e)?t:e}function Zr(o,t,e){const i=t.target,r=i.closest(".wg__header");if(!r)return;const n=o.grid.columns.find(l=>String(l.field)===e);if(!n||n.resizable===!1)return;const s=r.getBoundingClientRect().width;V={isResizing:!0,startX:t.clientX,startWidth:s,field:e,headerCell:r,minWidth:yo(n.minWidth,30),maxWidth:n.maxWidth?yo(n.maxWidth,1/0):null},ut=o,r.style.minWidth="";const a=o.shadow.querySelector(".wg");a==null||a.classList.add("wg--resizing"),i.classList.add("wg__resize-handle--active"),document.addEventListener("mousemove",Co),document.addEventListener("mouseup",So),t.preventDefault()}function Co(o){if(!V.isResizing||!ut)return;const t=o.clientX-V.startX;let e=V.startWidth+t;e=Math.max(e,V.minWidth),V.maxWidth!==null&&(e=Math.min(e,V.maxWidth)),V.headerCell&&(V.headerCell.style.width=`${e}px`),tn(ut,V.field,`${e}px`),(ut.grid.freezeColumns>0||ut.grid.stickyRowNumbers)&&on(ut)}function So(o){if(!V.isResizing||!ut)return;const t=ut,e=V.field,i=`${V.startWidth}px`,r=o.clientX-V.startX;let n=V.startWidth+r;n=Math.max(n,V.minWidth),V.maxWidth!==null&&(n=Math.min(n,V.maxWidth));const s=`${n}px`;t.grid.setColumnWidth(e,s);const a=t.shadow.querySelector(".wg");a==null||a.classList.remove("wg--resizing");const l=t.shadow.querySelector(".wg__resize-handle--active");l==null||l.classList.remove("wg__resize-handle--active"),t.grid.oncolumnresize&&t.grid.oncolumnresize({field:e,oldWidth:i,newWidth:s,allWidths:t.grid.getColumnWidthsState()}),t.grid.persistColumnWidths&&t.grid.gridName&&t.grid.savePersistedWidths(),document.removeEventListener("mousemove",Co),document.removeEventListener("mouseup",So),V={isResizing:!1,startX:0,startWidth:0,field:"",headerCell:null,minWidth:30,maxWidth:null},ut=null}function tn(o,t,e){o.shadow.querySelectorAll(`td[data-field="${t}"]`).forEach(r=>{r.style.width=e})}const en=40;function on(o){const t=o.grid.freezeColumns;let i=o.grid.showRowNumbers&&o.grid.stickyRowNumbers?en:0;const r=o.grid.visualColumns;for(let n=0;n<t&&n<r.length;n++){const{column:s}=r[n],a=String(s.field),l=o.shadow.querySelector(`th[data-field="${a}"]`);l&&(l.style.left=`${i}px`,o.shadow.querySelectorAll(`td[data-field="${a}"]`).forEach(c=>{c.style.left=`${i}px`}),i+=l.getBoundingClientRect().width)}}const rn=5;let $={isPending:!1,isReordering:!1,field:"",startX:0,startY:0,headerCell:null,ghost:null,dropIndicator:null,fromIndex:-1,currentDropIndex:-1},ht=null,Le=!1;function nn(){return Le?(Le=!1,!0):$.isReordering}function sn(o,t,e){const i=t.target,r=i.closest(".wg__header");if(!r||i.classList.contains("wg__resize-handle"))return;const n=o.grid.visualColumns,s=o.grid.totalFrozenColumns,a=n.findIndex(d=>String(d.column.field)===e);if(a<s)return;const l=a-s;$={isPending:!0,isReordering:!1,field:e,startX:t.clientX,startY:t.clientY,headerCell:r,ghost:null,dropIndicator:null,fromIndex:l,currentDropIndex:l},ht=o,document.addEventListener("mousemove",ko),document.addEventListener("mouseup",xo),t.preventDefault()}function ln(o,t,e){var n,s,a;const i=document.createElement("div");i.className="wg__reorder-ghost",i.textContent=((n=t.querySelector(".wg__header-title"))==null?void 0:n.textContent)||"";const r=(s=o.shadow.querySelector(".wg"))==null?void 0:s.getBoundingClientRect();r&&(i.style.left=`${e.clientX-r.left+10}px`,i.style.top=`${e.clientY-r.top-10}px`),(a=o.shadow.querySelector(".wg"))==null||a.appendChild(i),$.ghost=i}function an(o){var e;const t=document.createElement("div");t.className="wg__drop-indicator",(e=o.shadow.querySelector(".wg"))==null||e.appendChild(t),$.dropIndicator=t}function dn(o,t){$.isPending=!1,$.isReordering=!0;const e=o.shadow.querySelector(".wg");e==null||e.classList.add("wg--reordering"),$.headerCell&&$.headerCell.classList.add("wg__header--dragging"),$.headerCell&&ln(o,$.headerCell,t),an(o)}function ko(o){if(!ht)return;if($.isPending){const i=o.clientX-$.startX,r=o.clientY-$.startY;Math.sqrt(i*i+r*r)>=rn&&dn(ht,o);return}if(!$.isReordering)return;const t=ht.shadow.querySelector(".wg");if(!t)return;if($.ghost){const i=t.getBoundingClientRect();$.ghost.style.left=`${o.clientX-i.left+10}px`,$.ghost.style.top=`${o.clientY-i.top-10}px`}const e=cn(ht,o.clientX);e!==$.currentDropIndex&&($.currentDropIndex=e,gn(ht,e))}function cn(o,t){const e=o.grid.visualColumns,i=o.grid.totalFrozenColumns,r=e.slice(i);if(r.length===0)return 0;const n=String(r[0].column.field),s=o.shadow.querySelector(`th[data-field="${n}"]`);if(s){const a=s.getBoundingClientRect();if(t<a.left)return 0}for(let a=0;a<r.length;a++){const l=String(r[a].column.field),d=o.shadow.querySelector(`th[data-field="${l}"]`);if(d){const c=d.getBoundingClientRect(),u=c.left+c.width/2;if(t<u)return a}}return r.length}function gn(o,t){const e=$.dropIndicator;if(!e)return;const i=o.grid.visualColumns,r=o.grid.totalFrozenColumns,n=i.slice(r),s=o.shadow.querySelector(".wg"),a=s==null?void 0:s.getBoundingClientRect();if(!a)return;let l;if(t>=n.length){const d=String(n[n.length-1].column.field),c=o.shadow.querySelector(`th[data-field="${d}"]`);if(c)l=c.getBoundingClientRect().right-a.left;else return}else{const d=String(n[t].column.field),c=o.shadow.querySelector(`th[data-field="${d}"]`);if(c)l=c.getBoundingClientRect().left-a.left;else return}e.style.left=`${l}px`,e.style.display="block"}function xo(o){if(!ht)return;const t=ht;if($.isPending){Do(t);return}if(!$.isReordering)return;const e=$.field,i=$.fromIndex,r=$.currentDropIndex;if(i!==r&&r!==i+1){const n=r>i?r-1:r;t.grid.moveColumn(e,n),t.grid.oncolumnreorder&&t.grid.oncolumnreorder({field:e,fromIndex:i,toIndex:n,allOrder:t.grid.getColumnOrderState()}),t.grid.persistColumnOrder&&t.grid.gridName&&t.grid.savePersistedState()}Le=!0,Do(t)}function Do(o){$.ghost&&$.ghost.remove(),$.dropIndicator&&$.dropIndicator.remove();const t=o.shadow.querySelector(".wg");t==null||t.classList.remove("wg--reordering"),$.headerCell&&$.headerCell.classList.remove("wg__header--dragging"),document.removeEventListener("mousemove",ko),document.removeEventListener("mouseup",xo),$={isPending:!1,isReordering:!1,field:"",startX:0,startY:0,headerCell:null,ghost:null,dropIndicator:null,fromIndex:-1,currentDropIndex:-1},ht=null}const un=5;function hn(o,t){var i,r;switch(t.editor||"text"){case"number":return typeof o=="number"&&!isNaN(o);case"select":case"combobox":{const n=(i=t.editorOptions)==null?void 0:i.options;if(!n||n.length===0)return!0;const s=((r=t.editorOptions)==null?void 0:r.valueMember)||"value";return n.some(a=>a[s]===o)}case"date":{if(o==null||o==="")return!0;if(o instanceof Date)return!isNaN(o.getTime());if(typeof o=="string"){if(!/\d{4}[-/]\d{1,2}[-/]\d{1,2}/.test(o)&&!/\d{1,2}[-/.]\d{1,2}[-/.]\d{2,4}/.test(o))return!1;const n=new Date(o);return!isNaN(n.getTime())}if(typeof o=="number"){const n=new Date("2000-01-01").getTime(),s=new Date("2100-01-01").getTime();if(o<n||o>s)return!1;const a=new Date(o);return!isNaN(a.getTime())}return!1}case"text":case"autocomplete":case"checkbox":case"custom":default:return!0}}let E={isPending:!1,isDragging:!1,startRowIndex:-1,startColIndex:-1,startField:"",startX:0,startY:0,currentRowIndex:-1,currentColIndex:-1,handleElement:null,rangeElement:null},bt=null;function Oe(o){const t=o.grid.focusedCell;if(!t||o.grid.editingCell){Ro();return}const{rowIndex:e,colIndex:i}=t,r=o.shadow.querySelector(`[data-row="${e}"][data-col="${i}"]`);if(!r){Ro();return}const n=o.shadow.querySelector(".wg");if(!n)return;if(!E.handleElement){const h=document.createElement("div");h.className="wg__fill-handle",n.appendChild(h),E.handleElement=h,h.addEventListener("mousedown",f=>fn(o,f))}const s=n.getBoundingClientRect(),a=r.getBoundingClientRect(),l=n.scrollLeft,d=n.scrollTop,c=8,u=a.right-s.left+l-c/2,g=a.bottom-s.top+d-c/2;E.handleElement.style.left=`${u}px`,E.handleElement.style.top=`${g}px`}function Ro(){E.handleElement&&(E.handleElement.remove(),E.handleElement=null)}function fn(o,t){var a;t.preventDefault(),t.stopPropagation();const e=o.grid.focusedCell;if(!e)return;const{rowIndex:i,colIndex:r}=e,s=(a=o.grid.visualColumns[r])==null?void 0:a.column;s&&(E={...E,isPending:!0,isDragging:!1,startRowIndex:i,startColIndex:r,startField:String(s.field),startX:t.clientX,startY:t.clientY,currentRowIndex:i,currentColIndex:r},bt=o,document.addEventListener("mousemove",Eo),document.addEventListener("mouseup",To))}function Eo(o){if(!bt)return;if(E.isPending){const e=o.clientX-E.startX,i=o.clientY-E.startY;Math.sqrt(e*e+i*i)>=un&&wn(bt);return}if(!E.isDragging)return;const t=mn(bt,o.clientX,o.clientY);t&&(t.rowIndex!==E.currentRowIndex||t.colIndex!==E.currentColIndex)&&(E.currentRowIndex=t.rowIndex,E.currentColIndex=t.colIndex,$o(bt))}function wn(o){E.isPending=!1,E.isDragging=!0;const t=o.shadow.querySelector(".wg");t==null||t.classList.add("wg--filling"),pn(o)}function pn(o){const t=o.shadow.querySelector(".wg");if(!t)return;const e=document.createElement("div");e.className="wg__fill-range",t.appendChild(e),E.rangeElement=e,$o(o)}function $o(o){if(!E.rangeElement)return;const t=o.shadow.querySelector(".wg");if(!t)return;const{startRowIndex:e,startColIndex:i,currentRowIndex:r,currentColIndex:n}=E,s=Math.min(e,r),a=Math.max(e,r),l=Math.min(i,n),d=Math.max(i,n),c=o.shadow.querySelector(`[data-row="${s}"][data-col="${l}"]`),u=o.shadow.querySelector(`[data-row="${a}"][data-col="${d}"]`);if(!c||!u)return;const g=t.getBoundingClientRect(),h=c.getBoundingClientRect(),f=u.getBoundingClientRect(),m=t.scrollLeft,v=t.scrollTop,p=h.left-g.left+m,C=h.top-g.top+v,_=f.right-h.left,S=f.bottom-h.top;E.rangeElement.style.left=`${p}px`,E.rangeElement.style.top=`${C}px`,E.rangeElement.style.width=`${_}px`,E.rangeElement.style.height=`${S}px`}function To(o){if(!bt)return;const t=bt;if(E.isPending){Mo(t);return}E.isDragging&&(_n(t),Mo(t))}function mn(o,t,e){if(!o.shadow.querySelector(".wg"))return null;const r=o.shadow.querySelectorAll(".wg__cell[data-row][data-col]");for(const n of r){const s=n.getBoundingClientRect();if(t>=s.left&&t<=s.right&&e>=s.top&&e<=s.bottom){const a=parseInt(n.dataset.row||"-1",10),l=parseInt(n.dataset.col||"-1",10);if(a>=0&&l>=0)return{rowIndex:a,colIndex:l}}}return null}function bn(o,t,e,i){const r=e-o,n=i-t;return r===0&&n===0?"down":Math.abs(r)>=Math.abs(n)?r>0?"down":"up":n>0?"right":"left"}async function _n(o){var C,_;const{startRowIndex:t,startColIndex:e,currentRowIndex:i,currentColIndex:r,startField:n}=E,s=o.grid.visualColumns,a=(C=s[e])==null?void 0:C.column;if(!a)return;const l=o.grid.getRowDraft(t)??o.grid.displayItems[t];if(!l)return;const d=l[n],c=bn(t,e,i,r),u=a.fillDirection??o.grid.fillDirection,g=[],h=Math.min(t,i),f=Math.max(t,i),m=u==="vertical"?e:Math.min(e,r),v=u==="vertical"?e:Math.max(e,r);for(let S=h;S<=f;S++)for(let b=m;b<=v;b++){if(S===t&&b===e)continue;const y=(_=s[b])==null?void 0:_.column;if(!y)continue;const k=String(y.field);!o.grid.displayItems[S]||!(y.editable!==!1&&o.grid.editable)||hn(d,y)&&g.push({rowIndex:S,colIndex:b,field:k})}if(g.length===0)return;const p={sourceCell:{rowIndex:t,colIndex:e,field:n,value:d},targetCells:g,direction:c};if(!(o.grid.onfilldrag&&o.grid.onfilldrag(p)===!1))for(const S of g)await o.grid.commitEdit(S.rowIndex,S.field,d),j(o,S.rowIndex,S.colIndex)}function Mo(o){E.rangeElement&&(E.rangeElement.remove(),E.rangeElement=null);const t=o.shadow.querySelector(".wg");t==null||t.classList.remove("wg--filling"),document.removeEventListener("mousemove",Eo),document.removeEventListener("mouseup",To),E={isPending:!1,isDragging:!1,startRowIndex:-1,startColIndex:-1,startField:"",startX:0,startY:0,currentRowIndex:-1,currentColIndex:-1,handleElement:E.handleElement,rangeElement:null},bt=null}const vn=5;let nt={isPending:!1,isDragging:!1,startRowIndex:-1,startX:0,startY:0,currentRowIndex:-1},_t=null;function yn(o,t,e){if(e.preventDefault(),e.stopPropagation(),e.ctrlKey||e.metaKey){o.grid.selectRow(t,"toggle"),requestAnimationFrame(()=>{const i=o.shadow.querySelector(".wg");i==null||i.focus()});return}if(e.shiftKey){o.grid.selectRow(t,"range"),requestAnimationFrame(()=>{const i=o.shadow.querySelector(".wg");i==null||i.focus()});return}nt={isPending:!0,isDragging:!1,startRowIndex:t,startX:e.clientX,startY:e.clientY,currentRowIndex:t},_t=o,o.grid.selectRow(t,"replace"),document.addEventListener("mousemove",Io),document.addEventListener("mouseup",zo)}function Io(o){if(!_t)return;if(nt.isPending){const e=o.clientX-nt.startX,i=o.clientY-nt.startY;Math.sqrt(e*e+i*i)>=vn&&Cn(_t);return}if(!nt.isDragging)return;const t=Sn(_t,o.clientY);t!==null&&t!==nt.currentRowIndex&&(nt.currentRowIndex=t,_t.grid.selectRowRange(nt.startRowIndex,t))}function Cn(o){nt.isPending=!1,nt.isDragging=!0;const t=o.shadow.querySelector(".wg");t==null||t.classList.add("wg--selecting")}function zo(){if(!_t)return;const o=_t,t=o.shadow.querySelector(".wg");t==null||t.classList.remove("wg--selecting"),requestAnimationFrame(()=>{const e=o.shadow.querySelector(".wg");e==null||e.focus()}),document.removeEventListener("mousemove",Io),document.removeEventListener("mouseup",zo),nt={isPending:!1,isDragging:!1,startRowIndex:-1,startX:0,startY:0,currentRowIndex:-1},_t=null}function Sn(o,t){const e=o.shadow.querySelectorAll(".wg__row[data-row-index]");for(const i of e){const r=i.getBoundingClientRect();if(t>=r.top&&t<=r.bottom){const n=parseInt(i.dataset.rowIndex||"-1",10);if(n>=0)return n}}if(e.length>0){const i=e[0],r=e[e.length-1],n=i.getBoundingClientRect(),s=r.getBoundingClientRect();if(t<n.top)return parseInt(i.dataset.rowIndex||"0",10);if(t>s.bottom)return parseInt(r.dataset.rowIndex||"0",10)}return null}class Ae extends HTMLElement{constructor(){super();w(this,"grid");w(this,"shadow");w(this,"styleElement");w(this,"customStyleElement",null);w(this,"updatePending",!1);w(this,"isCommittingFromKeyboard",!1);w(this,"isTransitioningCells",!1);w(this,"wheelListenerAdded",!1);w(this,"toolbarOutsideClickAdded",!1);w(this,"toolbarScrollListenerAdded",!1);w(this,"toolbarMoveInProgress",!1);w(this,"toolbarHideTimeout",null);w(this,"toolbarHovered",!1);w(this,"toolbarShortcutHandler",null);w(this,"inlineShortcutHandler",null);w(this,"dropdownOpen",!1);w(this,"dropdownOptions",[]);w(this,"highlightedIndex",-1);w(this,"filterText","");w(this,"isUserFiltering",!1);w(this,"justSelected",!1);w(this,"isOpeningDropdown",!1);w(this,"isProgrammaticScroll",!1);w(this,"searchDebounceTimer",null);w(this,"searchAbortController",null);w(this,"isSearching",!1);w(this,"tooltipElement",null);w(this,"tooltipArrowElement",null);w(this,"tooltipAnchor",null);w(this,"tooltipShowTimer",null);w(this,"tooltipHideTimer",null);w(this,"_tooltipShowDelay",400);w(this,"_tooltipHideDelay",100);w(this,"datepicker",null);w(this,"contextMenuElement",null);w(this,"virtualScrollStart",0);w(this,"virtualScrollEnd",0);w(this,"scrollListenerAdded",!1);w(this,"isLoadingMoreItems",!1);w(this,"handlePaste",e=>{var d;if(!this.grid.isNavigateMode||this.grid.editingCell||!this.grid.focusedCell)return;const{rowIndex:i,colIndex:r}=this.grid.focusedCell,n=this.grid.columns[r],s=this.grid.displayItems[i];if(!n||!s||!this.grid.isCellEditable(n))return;e.preventDefault();let a=((d=e.clipboardData)==null?void 0:d.getData("text"))||"";if(n.beforePasteCallback){const c=n.beforePasteCallback(a,s);a=c!=null?String(c):""}const l=String(n.field);this.grid.commitEdit(i,l,a),this.render()});this.shadow=this.attachShadow({mode:"open"}),this.grid=new yt,this.styleElement=document.createElement("style"),this.styleElement.textContent=Ho,this.shadow.appendChild(this.styleElement),this.grid.requestUpdate=()=>this.requestUpdate(),this.grid._onInteractionChange=(e,i)=>{e==="editingCell"&&i.current===null&&N(this)}}get tooltipShowDelay(){return this._tooltipShowDelay}set tooltipShowDelay(e){this._tooltipShowDelay=e}get tooltipHideDelay(){return this._tooltipHideDelay}set tooltipHideDelay(e){this._tooltipHideDelay=e}connectedCallback(){this.grid.gridName&&this.grid.persistColumnWidths&&this.grid.loadPersistedWidths(),this.render(),this.addEventListener("paste",this.handlePaste)}disconnectedCallback(){this.removeEventListener("paste",this.handlePaste),this.datepicker&&(this.datepicker.destroy(),this.datepicker=null),this.contextMenuElement&&(Lt(this.contextMenuElement),this.contextMenuElement=null),ee(),this.removeInlineShortcuts()}get items(){return this.grid.items}set items(e){this.grid.items=e,this.isLoadingMoreItems=!1}get columns(){return this.grid.columns}set columns(e){this.grid.columns=e}get filterable(){return this.grid.filterable}set filterable(e){this.grid.filterable=e}get pageable(){return this.grid.pageable}set pageable(e){this.grid.pageable=e}get pageSize(){return this.grid.pageSize}set pageSize(e){this.grid.pageSize=e}get pageSizes(){return this.grid.pageSizes}set pageSizes(e){this.grid.pageSizes=e}get striped(){return this.grid.striped}set striped(e){this.grid.striped=e}get hoverable(){return this.grid.hoverable}set hoverable(e){this.grid.hoverable=e}get editable(){return this.grid.editable}set editable(e){this.grid.editable=e}get editTrigger(){return this.grid.editTrigger}set editTrigger(e){this.grid.editTrigger=e}get editStartSelection(){return this.grid.editStartSelection}set editStartSelection(e){this.grid.editStartSelection=e}get mode(){return this.grid.mode}set mode(e){this.grid.mode=e}get dropdownToggleVisibility(){return this.grid.dropdownToggleVisibility}set dropdownToggleVisibility(e){this.grid.dropdownToggleVisibility=e}get dropdownShowOnFocus(){return this.grid.dropdownShowOnFocus}set dropdownShowOnFocus(e){this.grid.dropdownShowOnFocus=e}get openDropdownOnEnter(){return this.grid.openDropdownOnEnter}set openDropdownOnEnter(e){this.grid.openDropdownOnEnter=e}get checkboxAlwaysEditable(){return this.grid.checkboxAlwaysEditable}set checkboxAlwaysEditable(e){this.grid.checkboxAlwaysEditable=e}get showRowNumbers(){return this.grid.showRowNumbers}set showRowNumbers(e){this.grid.showRowNumbers=e}get stickyRowNumbers(){return this.grid.stickyRowNumbers}set stickyRowNumbers(e){this.grid.stickyRowNumbers=e}get freezeColumns(){return this.grid.freezeColumns}set freezeColumns(e){this.grid.freezeColumns=e}get invalidCells(){return this.grid.invalidCells}set invalidCells(e){this.grid.invalidCells=e}get showRowToolbar(){return this.grid.showRowToolbar}set showRowToolbar(e){this.grid.showRowToolbar=e}get rowToolbar(){return this.grid.rowToolbar}set rowToolbar(e){this.grid.rowToolbar=e}get toolbarVerticalAlign(){return this.grid.toolbarVerticalAlign}set toolbarVerticalAlign(e){this.grid.toolbarVerticalAlign=e}get toolbarHorizontalAlign(){return this.grid.toolbarHorizontalAlign}set toolbarHorizontalAlign(e){this.grid.toolbarHorizontalAlign=e}get toolbarAlign(){return this.grid.toolbarVerticalAlign}set toolbarAlign(e){this.grid.toolbarVerticalAlign=e}get toolbarTopPosition(){return this.grid.toolbarHorizontalAlign}set toolbarTopPosition(e){this.grid.toolbarHorizontalAlign=e}get toolbarTrigger(){return this.grid.toolbarTrigger}set toolbarTrigger(e){this.grid.toolbarTrigger=e}get toolbarPosition(){return this.grid.toolbarPosition}set toolbarPosition(e){this.grid.toolbarPosition=e}get inlineActionsTitle(){return this.grid.inlineActionsTitle}set inlineActionsTitle(e){this.grid.inlineActionsTitle=e}get contextMenu(){return this.grid.contextMenu}set contextMenu(e){this.grid.contextMenu=e}get contextMenuXOffset(){return this.grid.contextMenuXOffset}set contextMenuXOffset(e){this.grid.contextMenuXOffset=e}get contextMenuYOffset(){return this.grid.contextMenuYOffset}set contextMenuYOffset(e){this.grid.contextMenuYOffset=e}get rowShortcuts(){return this.grid.rowShortcuts}set rowShortcuts(e){this.grid.rowShortcuts=e}get rangeShortcuts(){return this.grid.rangeShortcuts}set rangeShortcuts(e){this.grid.rangeShortcuts=e}get selectedRows(){return this.grid.selectedRows}selectRow(e,i="replace"){this.grid.selectRow(e,i)}selectRowRange(e,i){this.grid.selectRowRange(e,i)}clearSelection(){this.grid.clearSelection()}isRowSelected(e){return this.grid.isRowSelected(e)}getSelectedRowsData(){return this.grid.getSelectedRowsData()}get showShortcutsHelp(){return this.grid.showShortcutsHelp}set showShortcutsHelp(e){this.grid.showShortcutsHelp=e}get shortcutsHelpPosition(){return this.grid.shortcutsHelpPosition}set shortcutsHelpPosition(e){this.grid.shortcutsHelpPosition=e}get shortcutsHelpContentCallback(){return this.grid.shortcutsHelpContentCallback}set shortcutsHelpContentCallback(e){this.grid.shortcutsHelpContentCallback=e}get showRowActions(){return this.grid.showRowActions}set showRowActions(e){this.grid.showRowActions=e}get rowActions(){return this.grid.rowActions}set rowActions(e){this.grid.rowActions=e}set onrowchange(e){this.grid.onrowchange=e}set onroweditstart(e){this.grid.onroweditstart=e}set onroweditcancel(e){this.grid.onroweditcancel=e}set onvalidationerror(e){this.grid.onvalidationerror=e}get validationTooltipCallback(){return this.grid.validationTooltipCallback}set validationTooltipCallback(e){this.grid.validationTooltipCallback=e}set ontoolbarclick(e){this.grid.ontoolbarclick=e}set onrowaction(e){this.grid.onrowaction=e}set oncontextmenuopen(e){this.grid.oncontextmenuopen=e}get ondatarequest(){return this.grid.ondatarequest}set ondatarequest(e){this.grid.ondatarequest=e}get onrowdelete(){return this.grid.onrowdelete}set onrowdelete(e){this.grid.onrowdelete=e}get sort(){return this.grid.sort}set sort(e){this.grid.sort=e}get sortMode(){return this.grid.sortMode}set sortMode(e){this.grid.sortMode=e}get currentPage(){return this.grid.currentPage}set currentPage(e){this.grid.currentPage=e}get totalItems(){return this.grid.totalItems}set totalItems(e){this.grid.totalItems=e}get showPagination(){return this.grid.showPagination}set showPagination(e){this.grid.showPagination=e}get paginationPosition(){return this.grid.paginationPosition}set paginationPosition(e){this.grid.paginationPosition=e}get paginationLabelsCallback(){return this.grid.paginationLabelsCallback}set paginationLabelsCallback(e){this.grid.paginationLabelsCallback=e}get paginationLayout(){return this.grid.paginationLayout}set paginationLayout(e){this.grid.paginationLayout=e}get summaryPosition(){return this.grid.summaryPosition}set summaryPosition(e){this.grid.summaryPosition=e}get summaryContentCallback(){return this.grid.summaryContentCallback}set summaryContentCallback(e){this.grid.summaryContentCallback=e}get customStylesCallback(){return this.grid.customStylesCallback}set customStylesCallback(e){this.grid.customStylesCallback=e,this.updateCustomStyles()}get rowClassCallback(){return this.grid.rowClassCallback}set rowClassCallback(e){this.grid.rowClassCallback=e}get labels(){return this.grid.labels}set labels(e){this.grid.labels=e}get summaryMetadata(){return this.grid.summaryMetadata}set summaryMetadata(e){this.grid.summaryMetadata=e}get summaryInline(){return this.grid.summaryInline}set summaryInline(e){this.grid.summaryInline=e}get idValueMember(){return this.grid.idValueMember}set idValueMember(e){this.grid.idValueMember=e}get idValueCallback(){return this.grid.idValueCallback}set idValueCallback(e){this.grid.idValueCallback=e}get rowLocking(){return this.grid.rowLocking}set rowLocking(e){this.grid.rowLocking=e}get onrowlockchange(){return this.grid.onrowlockchange}set onrowlockchange(e){this.grid.onrowlockchange=e}get gridName(){return this.grid.gridName}set gridName(e){this.grid.gridName=e,this.tryLoadPersistedWidths()}get persistColumnWidths(){return this.grid.persistColumnWidths}set persistColumnWidths(e){this.grid.persistColumnWidths=e,this.tryLoadPersistedState()}get allowColumnReorder(){return this.grid.allowColumnReorder}set allowColumnReorder(e){this.grid.allowColumnReorder=e}get persistColumnOrder(){return this.grid.persistColumnOrder}set persistColumnOrder(e){this.grid.persistColumnOrder=e,this.tryLoadPersistedState()}tryLoadPersistedState(){this.grid.gridName&&(this.grid.persistColumnWidths||this.grid.persistColumnOrder)&&(this.grid.loadPersistedState(),this.isConnected&&this.render())}tryLoadPersistedWidths(){this.tryLoadPersistedState()}get oncolumnresize(){return this.grid.oncolumnresize}set oncolumnresize(e){this.grid.oncolumnresize=e}get oncolumnreorder(){return this.grid.oncolumnreorder}set oncolumnreorder(e){this.grid.oncolumnreorder=e}get onfilldrag(){return this.grid.onfilldrag}set onfilldrag(e){this.grid.onfilldrag=e}get virtualScroll(){return this.grid.virtualScroll}set virtualScroll(e){this.grid.virtualScroll=e}get virtualScrollThreshold(){return this.grid.virtualScrollThreshold}set virtualScrollThreshold(e){this.grid.virtualScrollThreshold=e}get virtualScrollRowHeight(){return this.grid.virtualScrollRowHeight}set virtualScrollRowHeight(e){this.grid.virtualScrollRowHeight=e}get virtualScrollBuffer(){return this.grid.virtualScrollBuffer}set virtualScrollBuffer(e){this.grid.virtualScrollBuffer=e}get infiniteScroll(){return this.grid.infiniteScroll}set infiniteScroll(e){this.grid.infiniteScroll=e}get infiniteScrollThreshold(){return this.grid.infiniteScrollThreshold}set infiniteScrollThreshold(e){this.grid.infiniteScrollThreshold=e}get hasMoreItems(){return this.grid.hasMoreItems}set hasMoreItems(e){this.grid.hasMoreItems=e}get displayItems(){return this.grid.displayItems}get totalPages(){return this.grid.totalPages}get isNavigateMode(){return this.grid.isNavigateMode}getRowDraft(e){return this.grid.getRowDraft(e)}hasRowDraft(e){return this.grid.hasRowDraft(e)}discardRowDraft(e){this.grid.discardRowDraft(e)}getDraftRowIndices(){return this.grid.getDraftRowIndices()}discardAllDrafts(){this.grid.discardAllDrafts()}isCellInvalid(e,i){return this.grid.isCellInvalid(e,i)}getCellValidationError(e,i){return this.grid.getCellValidationError(e,i)}getRowId(e){return this.grid.getRowId(e)}findRowById(e){return this.grid.findRowById(e)}isRowLocked(e){return this.grid.isRowLocked(e)}getRowLockInfo(e){return this.grid.getRowLockInfo(e)}lockRowById(e,i){return this.grid.lockRowById(e,i)}unlockRowById(e){return this.grid.unlockRowById(e)}getExternalLocks(){return this.grid.getExternalLocks()}clearExternalLocks(){this.grid.clearExternalLocks()}updateRowById(e,i){return this.grid.updateRowById(e,i)}replaceRowById(e,i){return this.grid.replaceRowById(e,i)}canEditCell(e,i){return this.grid.canEditCell(e,i)}setColumnWidth(e,i){this.grid.setColumnWidth(e,i)}setColumnWidths(e){this.grid.setColumnWidths(e)}getColumnWidthsState(){return this.grid.getColumnWidthsState()}setColumnOrder(e){this.grid.setColumnOrder(e)}getColumnOrderState(){return this.grid.getColumnOrderState()}focusCell(e,i){const r=this.grid.columns,n=this.grid.displayItems;e<0||e>=n.length||i<0||i>=r.length||(this.grid.setFocusedCell(e,i),requestAnimationFrame(()=>{I(this,e,i)}))}startEditing(e,i){const r=this.grid.columns;if(i<0||i>=r.length)return;const n=r[i],s=String(n.field);this.grid.startEdit(e,s);const a=this.shadow.querySelector(`td[data-row="${e}"][data-col="${i}"]`);a&&(a.classList.remove("wg__cell--focused"),a.classList.add("wg__cell--editing"),a.innerHTML=te(this,e,i,n))}escapeHtml(e){const i=document.createElement("div");return i.textContent=e,i.innerHTML}getCurrentEditingColumn(){const e=this.grid.editingCell;return e&&this.grid.columns.find(i=>String(i.field)===e.field)||null}getCurrentEditorOptions(){const e=this.getCurrentEditingColumn();return(e==null?void 0:e.editorOptions)||{}}moveFocusAfterCommit(e,i,r){me(this,e,i,r)}requestUpdate(){this.updatePending||(this.updatePending=!0,queueMicrotask(()=>{this.updatePending=!1,this.render()}))}updateCustomStyles(){const e=this.grid.customStylesCallback;if(e){const i=e();this.customStyleElement||(this.customStyleElement=document.createElement("style"),this.shadow.appendChild(this.customStyleElement)),this.customStyleElement.textContent=i}else this.customStyleElement&&(this.customStyleElement.remove(),this.customStyleElement=null)}handleCellKeyDown(e,i,r){var u;if(!this.grid.isNavigateMode)return;const n=this.grid.columns,s=this.grid.displayItems,a=this.grid.getEditableColumns(),l=a.findIndex(g=>g.index===r);if((e.ctrlKey||e.metaKey)&&e.key==="c"){const g=n[r],h=s[i];if(g&&h){let f=this.grid.getCellRawValue(h,i,String(g.field));g.beforeCopyCallback&&(f=g.beforeCopyCallback(f,h));const m=f!=null?String(f):"";navigator.clipboard.writeText(m)}return}const d=this.grid.selectedRows;if(d.length>0){const g=this.grid.rangeShortcuts;if(g&&g.length>0)for(const h of g){const f=Nt(h.key);if(Yt(e,f)){const m={rows:this.grid.getSelectedRowsData(),rowIndices:d};if(!(typeof h.disabled=="function"?h.disabled(m):h.disabled===!0)){e.preventDefault(),h.action(m);return}}}}const c=this.grid.rowShortcuts;if(c&&c.length>0){const g=n[r],h=s[i];if(g&&h)for(const f of c){const m=Nt(f.key);if(Yt(e,m)){const v={row:h,rowIndex:i,colIndex:r,column:g,cellValue:this.grid.getCellRawValue(h,i,String(g.field))};if(!(typeof f.disabled=="function"?f.disabled(v):f.disabled===!0)){e.preventDefault(),f.action(v);return}}}}switch(e.key){case"ArrowUp":e.preventDefault(),i>0&&I(this,i-1,r);break;case"ArrowDown":e.preventDefault(),i<s.length-1&&I(this,i+1,r);break;case"ArrowLeft":e.preventDefault(),r>0&&I(this,i,r-1);break;case"ArrowRight":e.preventDefault(),r<n.length-1&&I(this,i,r+1);break;case"Tab":if(e.preventDefault(),e.shiftKey){if(l>0){const g=a[l-1].index;I(this,i,g)}else if(i>0){const g=a[a.length-1].index;I(this,i-1,g)}}else if(l>=0&&l<a.length-1){const g=a[l+1].index;I(this,i,g)}else if(l===-1&&a.length>0)I(this,i,a[0].index);else if(i<s.length-1){const g=a[0].index;I(this,i+1,g)}break;case"Home":if(e.preventDefault(),e.ctrlKey)if(this.grid.shouldUseVirtualScroll()){const g=this.grid.focusedCell;this.grid.setFocusedCell(0,0),this.scrollToRowProgrammatically(0);const h=this.shadow.querySelector('td[data-row="0"][data-col="0"]');h&&(h.focus({preventScroll:!0}),tt(this,g,{rowIndex:0,colIndex:0}))}else I(this,0,0);else I(this,i,0);break;case"End":if(e.preventDefault(),e.ctrlKey){const g=s.length-1,h=n.length-1;if(this.grid.shouldUseVirtualScroll()){const f=this.grid.focusedCell;this.grid.setFocusedCell(g,h),this.scrollToRowProgrammatically(g);const m=this.shadow.querySelector(`td[data-row="${g}"][data-col="${h}"]`);m&&(m.focus({preventScroll:!0}),tt(this,f,{rowIndex:g,colIndex:h}))}else I(this,g,h)}else I(this,i,n.length-1);break;case"PageUp":if(e.preventDefault(),e.ctrlKey)if(this.grid.shouldUseVirtualScroll()){const g=this.grid.focusedCell;this.grid.setFocusedCell(0,r),this.scrollToRowProgrammatically(0);const h=this.shadow.querySelector(`td[data-row="0"][data-col="${r}"]`);h&&(h.focus({preventScroll:!0}),tt(this,g,{rowIndex:0,colIndex:r}))}else I(this,0,r);else{const g=Math.max(0,i-10);if(this.grid.shouldUseVirtualScroll()){const h=this.grid.focusedCell;this.grid.setFocusedCell(g,r),this.scrollToRowProgrammatically(g);const f=this.shadow.querySelector(`td[data-row="${g}"][data-col="${r}"]`);f&&(f.focus({preventScroll:!0}),tt(this,h,{rowIndex:g,colIndex:r}))}else I(this,g,r)}break;case"PageDown":if(e.preventDefault(),e.ctrlKey){const g=s.length-1;if(this.grid.shouldUseVirtualScroll()){const h=this.grid.focusedCell;this.grid.setFocusedCell(g,r),this.scrollToRowProgrammatically(g);const f=this.shadow.querySelector(`td[data-row="${g}"][data-col="${r}"]`);f&&(f.focus({preventScroll:!0}),tt(this,h,{rowIndex:g,colIndex:r}))}else I(this,g,r)}else{const g=Math.min(s.length-1,i+10);if(this.grid.shouldUseVirtualScroll()){const h=this.grid.focusedCell;this.grid.setFocusedCell(g,r),this.scrollToRowProgrammatically(g);const f=this.shadow.querySelector(`td[data-row="${g}"][data-col="${r}"]`);f&&(f.focus({preventScroll:!0}),tt(this,h,{rowIndex:g,colIndex:r}))}else I(this,g,r)}break;case"g":case"G":e.ctrlKey&&(e.preventDefault(),this.showGoToRowDialog(r));break;case"Enter":{e.preventDefault();const g=n[r];((g==null?void 0:g.editor)==="select"||(g==null?void 0:g.editor)==="combobox"||(g==null?void 0:g.editor)==="autocomplete")&&this.grid.getEffectiveOpenDropdownOnEnter(g)?(et(this,i,r),requestAnimationFrame(()=>{this.dropdownOpen||rt(this)})):i<s.length-1&&I(this,i+1,r);break}case"F2":{e.preventDefault();const g=n[r],h=(g==null?void 0:g.editor)==="select"||(g==null?void 0:g.editor)==="combobox"||(g==null?void 0:g.editor)==="autocomplete",f=(g==null?void 0:g.editor)==="custom";et(this,i,r),h?requestAnimationFrame(()=>{this.dropdownOpen||rt(this)}):f&&requestAnimationFrame(()=>{this.openCustomEditor(i,r)});break}case" ":{e.preventDefault();const g=n[r],h=(g==null?void 0:g.editor)==="checkbox",f=(g==null?void 0:g.editor)==="select"||(g==null?void 0:g.editor)==="combobox"||(g==null?void 0:g.editor)==="autocomplete",m=(g==null?void 0:g.editor)==="date",v=(g==null?void 0:g.editor)==="custom";h?Vi(this,i,r):f?(et(this,i,r),requestAnimationFrame(()=>{this.dropdownOpen||rt(this)})):m?(et(this,i,r),requestAnimationFrame(()=>{var S;const p=(S=this.shadowRoot)==null?void 0:S.querySelector(`.wg__cell[data-row="${i}"][data-col="${r}"]`),C=p==null?void 0:p.querySelector(".wg__date-input"),_=p==null?void 0:p.querySelector(".wg__editor--date");C&&_&&this.openDatePicker(C,_)})):v&&(et(this,i,r),requestAnimationFrame(()=>{this.openCustomEditor(i,r)}));break}case"Escape":if(e.preventDefault(),this.grid.editingCell)G(this),this.grid.cancelEdit();else if(this.grid.selectedRows.length>0)this.grid.clearSelection();else{const g=this.grid.focusedCell;this.grid.clearFocusedCell(),tt(this,g,null),(u=e.target)==null||u.blur()}break;case"Delete":{e.preventDefault();const g=n[r],h=s[i];if(e.ctrlKey){if(h){const f={rowIndex:i,row:h};this.grid.onrowdelete&&this.grid.onrowdelete(f),this.dispatchEvent(new CustomEvent("rowdelete",{detail:f}))}}else g&&this.grid.isCellEditable(g)&&(this.grid.commitEdit(i,String(g.field),null),this.render(),requestAnimationFrame(()=>{const f=this.shadow.querySelector(`td[data-row="${i}"][data-col="${r}"]`);f==null||f.focus()}));break}default:if(e.key.length===1&&!e.ctrlKey&&!e.altKey&&!e.metaKey){const g=n[r];if((g==null?void 0:g.editor)==="number"&&!/[\d.\-]/.test(e.key))return;et(this,i,r,{initialSearchQuery:e.key}),e.preventDefault()}break}}handleEditorKeyDown(e,i){const r=parseInt(i.dataset.row||"0",10),n=i.dataset.field||"",s=this.grid.columns.find(c=>c.field===n),a=(s==null?void 0:s.editor)||"text",l=a==="select"||a==="combobox"||a==="autocomplete",d=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight","PageUp","PageDown","Home","End"];if(l&&!this.dropdownOpen&&d.includes(e.key)){e.preventDefault(),e.stopPropagation();const c=this.grid.columns.findIndex(p=>p.field===n),u=this.grid.columns.map((p,C)=>({index:C,column:p})).filter(p=>p.column.editable!==!1),g=u.findIndex(p=>p.index===c),h=this.grid.displayItems;let f=r,m=c,v=!1;switch(e.key){case"ArrowUp":r>0&&(f=r-1,v=!0);break;case"ArrowDown":r<h.length-1&&(f=r+1,v=!0);break;case"ArrowLeft":g>0&&(m=u[g-1].index,v=!0);break;case"ArrowRight":g<u.length-1&&(m=u[g+1].index,v=!0);break;case"PageUp":f=Math.max(0,r-10),v=!0;break;case"PageDown":f=Math.min(h.length-1,r+10),v=!0;break;case"Home":e.ctrlKey&&(f=0),m=0,v=!0;break;case"End":e.ctrlKey?(f=h.length-1,m=this.grid.columns.length-1):m=this.grid.columns.length-1,v=!0;break}v&&(G(this),this.grid.cancelEdit(),queueMicrotask(()=>{I(this,f,m)}));return}switch(e.key){case"ArrowDown":if(this.dropdownOpen){e.preventDefault(),e.stopPropagation();const c=this.getCurrentEditorOptions();let u=this.highlightedIndex+1;for(;u<this.dropdownOptions.length&&At(this.dropdownOptions[u],c);)u++;u<this.dropdownOptions.length&&(this.highlightedIndex=u,gt(this),go(this))}break;case"ArrowUp":if(this.dropdownOpen){e.preventDefault(),e.stopPropagation();const c=this.getCurrentEditorOptions();let u=this.highlightedIndex-1;for(;u>=0&&At(this.dropdownOptions[u],c);)u--;u>=0&&(this.highlightedIndex=u,gt(this),go(this))}break;case"Enter":if(this.datepicker)return;e.preventDefault(),e.stopPropagation(),this.dropdownOpen&&this.highlightedIndex>=0?co(this,this.highlightedIndex):l&&!this.dropdownOpen?rt(this):(this.isCommittingFromKeyboard=!0,N(this),a==="date"&&i instanceof HTMLInputElement?this.commitDateEditor(i):Zt(this,i),me(this,r,n,"down"));break;case"Tab":if(this.datepicker)return;if(e.preventDefault(),e.stopPropagation(),this.isCommittingFromKeyboard=!0,this.dropdownOpen&&this.highlightedIndex>=0&&l){const c=this.dropdownOptions[this.highlightedIndex],u=this.getCurrentEditorOptions();if(c&&!At(c,u)){const g=Ct(c,u);this.grid.commitEdit(r,n,g)}N(this)}else N(this),a==="date"&&i instanceof HTMLInputElement?this.commitDateEditor(i):l||Zt(this,i);me(this,r,n,e.shiftKey?"prev":"next");break;case"Escape":e.preventDefault(),e.stopPropagation(),this.dropdownOpen&&N(this),this.datepicker&&(this.datepicker.close(!0),this.datepicker=null),this.isCommittingFromKeyboard=!0,G(this),this.grid.cancelEdit(),Yi(this,r,n);break;case"F2":e.preventDefault(),e.stopPropagation(),l&&!this.dropdownOpen&&rt(this);break;case"Backspace":a==="select"&&(e.preventDefault(),e.stopPropagation(),this.filterText.length>0&&(this.filterText=this.filterText.slice(0,-1),ho(this,s.editorOptions||{})));break;default:a==="select"&&e.key.length===1&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&(e.preventDefault(),e.stopPropagation(),this.filterText+=e.key,ho(this,s.editorOptions||{}));break}}attachEventListeners(){const e=this.shadow.querySelector(".wg__table");if(!e)return;e.addEventListener("focus",n=>{var a;const s=n.target;if(s.matches(".wg__cell")){const l=parseInt(s.dataset.row||"0",10),d=parseInt(s.dataset.col||"0",10);Pi(this,l,d),Oe(this)}if(s.matches(".wg__select-trigger, .wg__combobox-input, .wg__autocomplete-input")&&!this.justSelected&&!this.dropdownOpen){const l=s.dataset.field||"",d=this.grid.columns.find(g=>g.field===l),c=(d==null?void 0:d.editorOptions)||{};(((a=this.grid.editingCell)==null?void 0:a.initialSearchQuery)!==void 0||c.showOnFocus!==!1)&&rt(this)}},!0),e.addEventListener("keydown",n=>{const s=n.target;if(s.matches(".wg__editor, .wg__combobox-input, .wg__autocomplete-input, .wg__date-input")){this.handleEditorKeyDown(n,s);return}if(s.matches(".wg__cell")){const a=parseInt(s.dataset.row||"0",10),l=parseInt(s.dataset.col||"0",10);this.handleCellKeyDown(n,a,l)}}),e.addEventListener("focusout",n=>{Hi(this,n)}),e.addEventListener("dblclick",n=>{n.preventDefault();const a=n.target.closest(".wg__cell");if(a){const l=parseInt(a.dataset.row||"0",10),d=parseInt(a.dataset.col||"0",10),c=this.grid.columns[d];if(c){const u=c.editTrigger||this.grid.editTrigger;if(u==="dblclick"||u==="navigate"){const g=we(n,a);et(this,l,d,{cursorPosition:g??void 0});const h=c.editor;h==="select"||h==="combobox"||h==="autocomplete"?requestAnimationFrame(()=>{this.dropdownOpen||rt(this)}):h==="custom"&&requestAnimationFrame(()=>{this.openCustomEditor(l,d)})}}}}),e.addEventListener("click",n=>{const a=n.target.closest(".wg__cell");if(a&&!a.classList.contains("wg__cell--editing")){const l=parseInt(a.dataset.row||"0",10),d=parseInt(a.dataset.col||"0",10),c=this.grid.columns[d];if(c&&(c.editTrigger||this.grid.editTrigger)==="click"){n.preventDefault();const g=we(n,a);et(this,l,d,{cursorPosition:g??void 0});const h=c.editor;h==="select"||h==="combobox"||h==="autocomplete"?requestAnimationFrame(()=>{this.dropdownOpen||rt(this)}):h==="custom"&&requestAnimationFrame(()=>{this.openCustomEditor(l,d)})}}}),e.addEventListener("mousedown",n=>{const s=n.target;if(s.closest(".wg__date-trigger")){n.preventDefault(),n.stopPropagation();const l=s.closest(".wg__cell-date-display"),d=s.closest(".wg__editor--date");if(d){const c=d.querySelector(".wg__date-input");c&&this.openDatePicker(c,d)}else if(l){const c=parseInt(l.dataset.row||"0",10),u=l.dataset.field||"",g=this.grid.columns.findIndex(h=>String(h.field)===u);if(g>=0){if(this.isTransitioningCells=!0,this.grid.editingCell){const h=this.grid.editingCell,f=this.grid.columns.findIndex(m=>String(m.field)===h.field);N(this),G(this),this.grid.cancelEdit(),f>=0&&j(this,h.rowIndex,f)}et(this,c,g),requestAnimationFrame(()=>{var v;this.isTransitioningCells=!1;const h=(v=this.shadowRoot)==null?void 0:v.querySelector(`.wg__cell[data-row="${c}"][data-field="${u}"]`),f=h==null?void 0:h.querySelector(".wg__date-input"),m=h==null?void 0:h.querySelector(".wg__editor--date");f&&m&&this.openDatePicker(f,m)})}}return}if(this.dropdownOpen||this.grid.editingCell){const l=s.closest(".wg__cell");if(l&&!s.closest(".wg__editor--select, .wg__editor--combobox, .wg__editor--autocomplete, .wg__editor--date")){const d=parseInt(l.dataset.row||"0",10),c=parseInt(l.dataset.col||"0",10),u=this.grid.editingCell,g=s.matches(".wg__combobox-toggle, .wg__select-toggle, .wg__date-trigger");if(u&&!g){const h=this.grid.columns.findIndex(f=>String(f.field)===u.field);if(d!==u.rowIndex||c!==h){n.preventDefault(),this.isTransitioningCells=!0;const f=u.rowIndex,m=h;N(this),G(this),this.grid.cancelEdit(),m>=0&&j(this,f,m);const v=this.grid.columns[c],p=(v==null?void 0:v.editTrigger)||this.grid.editTrigger,_=n.clientX;requestAnimationFrame(()=>{if(this.isTransitioningCells=!1,p==="click"&&v&&this.grid.isCellEditable(v)){const S=this.shadow.querySelector(`td[data-row="${d}"][data-col="${c}"]`),b=S?we({clientX:_},S):void 0;et(this,d,c,{cursorPosition:b??void 0})}else I(this,d,c)});return}}}}if(s.matches(".wg__combobox-toggle, .wg__select-toggle")){n.preventDefault(),n.stopPropagation();const l=s.closest(".wg__cell-dropdown-display");if(s.closest(".wg__editor--select, .wg__editor--combobox, .wg__editor--autocomplete"))uo(this);else if(l){const c=parseInt(l.dataset.row||"0",10),u=l.dataset.field||"",g=this.grid.columns.findIndex(h=>String(h.field)===u);if(g>=0){this.isTransitioningCells=!0;const h=this.grid.editingCell,f=h?this.grid.columns.findIndex(m=>String(m.field)===h.field):-1;h&&(N(this),G(this),this.grid.cancelEdit(),f>=0&&j(this,h.rowIndex,f)),et(this,c,g),requestAnimationFrame(()=>{this.isTransitioningCells=!1,this.dropdownOpen||rt(this)})}}}if(s.matches(".wg__cell-dropdown-display")){n.preventDefault(),n.stopPropagation();const l=s.closest(".wg__cell-dropdown-display");if(l){const d=parseInt(l.dataset.row||"0",10),c=l.dataset.field||"",u=this.grid.columns.findIndex(g=>String(g.field)===c);if(u>=0){this.isTransitioningCells=!0;const g=this.grid.editingCell,h=g?this.grid.columns.findIndex(f=>String(f.field)===g.field):-1;g&&(N(this),G(this),this.grid.cancelEdit(),h>=0&&j(this,g.rowIndex,h)),et(this,d,u),requestAnimationFrame(()=>{this.isTransitioningCells=!1,this.dropdownOpen||rt(this)})}}}}),e.addEventListener("click",n=>{n.target.matches(".wg__select-trigger, .wg__select-value")&&(n.preventDefault(),n.stopPropagation(),uo(this))}),e.addEventListener("mousedown",n=>{const s=n.target,a=s.closest(".wg__resize-handle");if(a){n.preventDefault(),n.stopPropagation();const d=a.dataset.field;d&&Zr(this,n,d);return}if(this.grid.allowColumnReorder){const d=s.closest(".wg__header");if(d&&!d.classList.contains("wg__header--frozen")&&!d.classList.contains("wg__row-number-header")){const c=d.dataset.field;c&&sn(this,n,c)}}const l=s.closest(".wg__row-number[data-row-number]");if(l){const d=parseInt(l.dataset.rowNumber||"-1",10);d>=0&&yn(this,d,n)}}),e.addEventListener("click",n=>{const s=n,a=s.target;if(a.closest(".wg__resize-handle")||nn())return;a.closest(".wg__header--sortable")&&(Gr(this,s),this.render())}),e.addEventListener("contextmenu",n=>{this.handleContextMenu(n)}),e.addEventListener("change",n=>{const s=n.target;s.matches(".wg__editor--checkbox")&&qi(this,s)}),e.addEventListener("input",n=>{const s=n.target;s.matches(".wg__combobox-input")?cr(this,n):s.matches(".wg__autocomplete-input")&&gr(this,n)}),e.addEventListener("blur",n=>{const s=n.target;if(s.matches(".wg__editor--text, .wg__editor--number")&&Ni(this,s),s.matches(".wg__date-input")&&!this.datepicker&&!this.isCommittingFromKeyboard&&!this.isTransitioningCells&&this.commitDateEditor(s),s.matches(".wg__select-trigger")&&!this.isCommittingFromKeyboard&&!this.isTransitioningCells&&!this.dropdownOpen&&!this.isOpeningDropdown&&(N(this),G(this),this.grid.cancelEdit()),s.matches(".wg__combobox-input, .wg__autocomplete-input")){if(this.isCommittingFromKeyboard||this.isTransitioningCells)return;if(N(this),this.grid.editingCell){const a=s,l=this.getCurrentEditingColumn();if(l){const d=l.editorOptions||{},u=(d.options||d.initialOptions||[]).find(g=>Ot(g,d).toLowerCase()===a.value.toLowerCase());u?this.grid.commitEdit(this.grid.editingCell.rowIndex,this.grid.editingCell.field,Ct(u,d)):this.grid.commitEdit(this.grid.editingCell.rowIndex,this.grid.editingCell.field,a.value)}}}},!0);const i=this.shadow.querySelector(".wg");i&&(i.setAttribute("tabindex","-1"),i.addEventListener("keydown",n=>{const s=this.grid.selectedRows;if(s.length===0||n.target.matches('input, textarea, select, [contenteditable="true"]'))return;if(n.key==="Escape"){n.preventDefault(),this.grid.clearSelection();return}const l=this.grid.rangeShortcuts;if(l!=null&&l.length)for(const d of l){const c=Nt(d.key);if(Yt(n,c)){const u={rows:this.grid.getSelectedRowsData(),rowIndices:s};if(!(typeof d.disabled=="function"?d.disabled(u):d.disabled===!0)){n.preventDefault(),d.action(u);return}}}}),i.addEventListener("scroll",()=>{const n=i.scrollLeft>0;if(i.classList.toggle("wg--scrolled-horizontal",n),this.dropdownOpen&&!this.isTransitioningCells&&!this.isOpeningDropdown){const s=this.grid.editingCell,a=s?this.grid.columns.findIndex(l=>String(l.field)===s.field):-1;N(this),G(this),this.grid.cancelEdit(),s&&a>=0&&j(this,s.rowIndex,a)}this.grid.shouldUseVirtualScroll()&&this.handleVirtualScroll(i),this.grid.infiniteScroll&&this.grid.hasMoreItems&&!this.isLoadingMoreItems&&this.handleInfiniteScroll(i),It()!==null&&(no(this,this.grid.displayItems),this.renderConnector()),Oe(this)})),this.wheelListenerAdded||(this.wheelListenerAdded=!0,window.addEventListener("scroll",()=>{if(this.dropdownOpen&&!this.isTransitioningCells){const n=this.grid.editingCell,s=n?this.grid.columns.findIndex(a=>String(a.field)===n.field):-1;N(this),G(this),this.grid.cancelEdit(),n&&s>=0&&j(this,n.rowIndex,s)}},{passive:!0,capture:!0})),e.addEventListener("mouseenter",n=>{const s=n.target,a=s.closest("[data-tooltip-html]");if(a){const d=a.getAttribute("data-tooltip-html");Re(this,a,d,this._tooltipShowDelay,!0);return}const l=s.closest("[data-tooltip]");if(l){const d=l.getAttribute("data-tooltip");Re(this,l,d,this._tooltipShowDelay,!1)}},!0),e.addEventListener("mouseleave",n=>{const s=n,a=s.target,l=s.relatedTarget,d=a.closest("[data-tooltip], [data-tooltip-html]");d&&(l==null?void 0:l.closest("[data-tooltip], [data-tooltip-html]"))===d||d&&fo(this,this._tooltipHideDelay)},!0),e.addEventListener("click",n=>{const a=n.target.closest(".wg__toolbar-trigger");if(a&&this.grid.toolbarTrigger==="button"){n.preventDefault(),n.stopPropagation();const l=parseInt(a.dataset.toolbarTrigger||"0",10),d=e.querySelector(`tr[data-row-index="${l}"]`);d&&(ye(l)?this.closeToolbarAndReset():this.showToolbarForRow(d,l))}}),e.addEventListener("click",n=>{if(this.grid.toolbarPosition!=="inline")return;const a=n.target.closest(".wg__inline-action-btn");if(a&&!a.disabled){n.preventDefault(),n.stopPropagation();const l=a.dataset.actionId,d=parseInt(a.dataset.row||"0",10);this.handleInlineActionClick(l,d)}}),e.addEventListener("mouseenter",n=>{const s=n,l=s.target.closest(".wg__row");if(l){const d=parseInt(l.dataset.rowIndex||"0",10);this.grid.setHoveredRow(d),this.grid.toolbarPosition==="inline"&&this.setupInlineShortcuts(),this.grid.toolbarTrigger==="hover"&&this.grid.toolbarPosition!=="inline"&&(this.toolbarHideTimeout&&(clearTimeout(this.toolbarHideTimeout),this.toolbarHideTimeout=null),ye(d)||this.showToolbarForRow(l,d,s.clientX))}},!0),e.addEventListener("mouseleave",n=>{if(n.target.closest(".wg__row")&&(this.grid.toolbarPosition==="inline"&&setTimeout(()=>{e.matches(":hover")||(this.grid.setHoveredRow(null),this.removeInlineShortcuts())},50),this.grid.toolbarTrigger==="hover"&&this.grid.toolbarPosition!=="inline")){if(this.toolbarMoveInProgress)return;this.toolbarHideTimeout&&clearTimeout(this.toolbarHideTimeout),this.toolbarHideTimeout=setTimeout(()=>{const d=this.shadow.querySelector(".wg__toolbar-container"),c=d==null?void 0:d.matches(":hover"),u=e.matches(":hover");!c&&!u&&(this.grid.setHoveredRow(null),this.closeToolbarAndReset())},150)}},!0),e.addEventListener("click",n=>{if(this.grid.toolbarTrigger!=="click")return;const s=n,a=s.target,l=a.closest(".wg__row");if(l&&!a.closest(".wg__cell--editing")){const d=parseInt(l.dataset.rowIndex||"0",10);ye(d)?this.closeToolbarAndReset():this.showToolbarForRow(l,d,s.clientX)}}),this.toolbarOutsideClickAdded||(this.toolbarOutsideClickAdded=!0,document.addEventListener("click",n=>{if(!ro(this.shadow))return;const s=n.composedPath(),a=s.some(c=>{var u;return(u=c.classList)==null?void 0:u.contains("wg__toolbar-container")}),l=s.some(c=>{var u;return(u=c.classList)==null?void 0:u.contains("wg__toolbar-trigger")});a||l||s.includes(this)&&(this.grid.toolbarTrigger==="hover"||this.grid.toolbarTrigger==="click")||It()!==null&&this.closeToolbarAndReset()})),this.toolbarScrollListenerAdded||(this.toolbarScrollListenerAdded=!0,window.addEventListener("scroll",()=>{It()!==null&&this.closeToolbarAndReset()},!0)),this.shadow.querySelectorAll(".wg__pagination").forEach(n=>{n.addEventListener("click",a=>{Qr(this,a)&&this.render()});const s=n.querySelector(".wg__pagination-select");s&&s.addEventListener("change",()=>{Jr(this,s)&&this.render()})})}scrollToRowProgrammatically(e){const i=this.shadow.querySelector(".wg");if(!i)return;const{scrollTop:r,startIndex:n,endIndex:s}=Kr({targetRow:e,rowHeight:this.grid.virtualScrollRowHeight,buffer:this.grid.virtualScrollBuffer,totalItems:this.grid.displayItems.length,viewportHeight:i.clientHeight,scrollHeight:i.scrollHeight,clientHeight:i.clientHeight});(n!==this.virtualScrollStart||s!==this.virtualScrollEnd)&&(this.virtualScrollStart=n,this.virtualScrollEnd=s,this.renderVirtualRows(i)),this.isProgrammaticScroll=!0,i.scrollTop=r,queueMicrotask(()=>{this.isProgrammaticScroll=!1})}handleVirtualScroll(e){var n;if(this.isProgrammaticScroll)return;const{startIndex:i,endIndex:r}=jr({scrollTop:e.scrollTop,viewportHeight:e.clientHeight,rowHeight:this.grid.virtualScrollRowHeight,buffer:this.grid.virtualScrollBuffer,totalItems:this.grid.displayItems.length,editingRowIndex:(n=this.grid.editingCell)==null?void 0:n.rowIndex});(i!==this.virtualScrollStart||r!==this.virtualScrollEnd)&&(this.virtualScrollStart=i,this.virtualScrollEnd=r,this.renderVirtualRows(e))}renderVirtualRows(e){const i=e.querySelector("tbody");if(!i)return;const r=this.grid.displayItems,n={startIndex:this.virtualScrollStart,endIndex:this.virtualScrollEnd,rowHeight:this.grid.virtualScrollRowHeight,totalItems:r.length},s=this.grid.focusedCell;if(i.innerHTML=ao(this,n),s){this.grid.setFocusedCell(s.rowIndex,s.colIndex);const a=i.querySelector(`td[data-row="${s.rowIndex}"][data-col="${s.colIndex}"]`);a&&(a.focus({preventScroll:!0}),tt(this,null,s))}}handleInfiniteScroll(e){Xr(e.scrollTop,e.scrollHeight,e.clientHeight,this.grid.infiniteScrollThreshold)&&(this.isLoadingMoreItems=!0,this.grid.fireDataRequest("loadMore"))}renderShortcutsHelpIcon(){var s,a,l;if(!this.grid.showShortcutsHelp||!((s=this.grid.rowShortcuts)!=null&&s.length))return"";const i=this.grid.shortcutsHelpPosition==="top-left"?"wg__shortcuts-help--left":"",r=this.grid.rowShortcuts.map(d=>`<div class="wg__shortcuts-help-item">
604
+ <span class="wg__shortcuts-help-key">${Ur(d.key)}</span>
605
+ <span class="wg__shortcuts-help-label">${d.label}</span>
606
+ </div>`).join(""),n=((l=(a=this.grid).shortcutsHelpContentCallback)==null?void 0:l.call(a))||"";return`
606
607
  <div class="wg__shortcuts-help ${i}">
607
608
  <button class="wg__shortcuts-help-icon" type="button" title="${this.grid.labels.keyboardShortcuts}">
608
609
  <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
@@ -619,28 +620,28 @@
619
620
  </div>
620
621
  </div>
621
622
  </div>
622
- `}render(){var v;const t=this.shadow.querySelector(".wg"),i=(t==null?void 0:t.scrollTop)||0,r=(t==null?void 0:t.scrollLeft)||0,n=this.grid.focusedCell;t&&t.remove();const s=document.createElement("div");s.className=Ti(this);const c=this.grid.paginationPosition.split("|").map(w=>w.trim()),a=this.grid.summaryPosition?this.grid.summaryPosition.split("|").map(w=>w.trim()):[],l=(w,_)=>{const m=c.filter(x=>_?x.startsWith("top-"):x.startsWith("bottom-")),C=a.filter(x=>_?x.startsWith("top-"):x.startsWith("bottom-")),y=m.length>0,S=C.length>0;return!y&&!S?"":S&&y&&this.grid.summaryInline?`<div class="wg__footer${_?" wg__footer--top":""}">
623
- ${de(this,C[0])}
624
- ${le(this,m[0])}
625
- </div>`:[...new Set([...m,...C])].map(x=>{const E=m.includes(x),$=C.includes(x);return $&&E?`<div class="wg__footer${_?" wg__footer--top":""}">
626
- ${de(this,x)}
627
- ${le(this,x)}
628
- </div>`:$?de(this,x):le(this,x)}).join("")},g=l(c,!0),d=l(c,!1),h=this.grid.shouldUseVirtualScroll();let u;if(h){const w=this.grid.displayItems,_=this.grid.virtualScrollRowHeight,m=this.grid.virtualScrollBuffer,C=(t==null?void 0:t.clientHeight)||400,y=Math.max(0,Math.floor(i/_)-m),S=Math.ceil(C/_)+m*2,k=Math.min(w.length,y+S);this.virtualScrollStart=y,this.virtualScrollEnd=k;const x={startIndex:y,endIndex:k,rowHeight:_,totalItems:w.length};u=Be(this,x)}else u=$i(this);h&&s.classList.add("wg--virtual-scroll");const b=`
623
+ `}render(){var v;const e=this.shadow.querySelector(".wg"),i=(e==null?void 0:e.scrollTop)||0,r=(e==null?void 0:e.scrollLeft)||0,n=this.grid.focusedCell;e&&e.remove();const s=document.createElement("div");s.className=sr(this);const a=this.grid.paginationPosition.split("|").map(p=>p.trim()),l=this.grid.summaryPosition?this.grid.summaryPosition.split("|").map(p=>p.trim()):[],d=(p,C)=>{const _=a.filter(x=>C?x.startsWith("top-"):x.startsWith("bottom-")),S=l.filter(x=>C?x.startsWith("top-"):x.startsWith("bottom-")),b=_.length>0,y=S.length>0;return!b&&!y?"":y&&b&&this.grid.summaryInline?`<div class="wg__footer${C?" wg__footer--top":""}">
624
+ ${xe(this,S[0])}
625
+ ${ke(this,_[0])}
626
+ </div>`:[...new Set([..._,...S])].map(x=>{const M=_.includes(x),R=S.includes(x);return R&&M?`<div class="wg__footer${C?" wg__footer--top":""}">
627
+ ${xe(this,x)}
628
+ ${ke(this,x)}
629
+ </div>`:R?xe(this,x):ke(this,x)}).join("")},c=d(a,!0),u=d(a,!1),g=this.grid.shouldUseVirtualScroll();let h;if(g){const p=this.grid.displayItems,C=this.grid.virtualScrollRowHeight,_=this.grid.virtualScrollBuffer,S=(e==null?void 0:e.clientHeight)||400,b=Math.max(0,Math.floor(i/C)-_),y=Math.ceil(S/C)+_*2,k=Math.min(p.length,b+y);this.virtualScrollStart=b,this.virtualScrollEnd=k;const x={startIndex:b,endIndex:k,rowHeight:C,totalItems:p.length};h=ao(this,x)}else h=ar(this);g&&s.classList.add("wg--virtual-scroll");const m=`
629
630
  ${this.renderShortcutsHelpIcon()}
630
- ${g}
631
+ ${c}
631
632
  <table class="wg__table">
632
633
  <thead>
633
- ${Ei(this)}
634
+ ${lr(this)}
634
635
  </thead>
635
636
  <tbody>
636
- ${u}
637
+ ${h}
637
638
  </tbody>
638
639
  </table>
639
- ${d}
640
- `;if(s.innerHTML=b,this.shadow.appendChild(s),h){const w=Math.max(0,this.grid.displayItems.length*this.grid.virtualScrollRowHeight-s.clientHeight);s.scrollTop=Math.min(i,w)}else s.scrollTop=i;if(s.scrollLeft=r,this.attachEventListeners(),this.grid.editingCell){const{rowIndex:w,field:_}=this.grid.editingCell;let m=this.shadow.querySelector(`.wg__combobox-input[data-row="${w}"][data-field="${_}"],
641
- .wg__autocomplete-input[data-row="${w}"][data-field="${_}"],
642
- .wg__select-trigger[data-row="${w}"][data-field="${_}"],
643
- .wg__date-input[data-row="${w}"][data-field="${_}"]`);if(m||(m=this.shadow.querySelector(`.wg__editor[data-row="${w}"][data-field="${_}"]`)),m&&(m.focus(),m instanceof HTMLInputElement&&m.type==="text")){const C=this.grid.editingCell.cursorPosition,y=this.getCurrentEditingColumn(),S=((v=y==null?void 0:y.editorOptions)==null?void 0:v.editStartSelection)||this.grid.editStartSelection;if(this.grid.editingCell.initialSearchQuery!==void 0){const k=m.value.length;m.setSelectionRange(k,k)}else switch(S){case"mousePosition":if(C!==void 0){const k=Math.min(C,m.value.length);m.setSelectionRange(k,k)}else m.setSelectionRange(m.value.length,m.value.length);break;case"cursorAtStart":m.setSelectionRange(0,0);break;case"cursorAtEnd":m.setSelectionRange(m.value.length,m.value.length);break;case"selectAll":default:m.select();break}}}else if(n&&!this.grid.editingCell){const w=s.querySelector(`td[data-row="${n.rowIndex}"][data-col="${n.colIndex}"]`);w&&setTimeout(()=>w.focus(),0)}h&&requestAnimationFrame(()=>{s.style.pointerEvents="none",requestAnimationFrame(()=>{s.style.pointerEvents=""})}),this.renderConnector()}renderConnector(){const t=this.shadow.querySelector(".wg__connector");t&&t.remove();const i=Di();if(!i.path||!i.arrowPos)return;const r=document.createElementNS("http://www.w3.org/2000/svg","svg");r.setAttribute("class","wg__connector"),r.setAttribute("style","position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; pointer-events: none; z-index: 999;");const n=document.createElementNS("http://www.w3.org/2000/svg","path");n.setAttribute("d",i.path),n.setAttribute("stroke","var(--wg-accent-color, #0078d4)"),n.setAttribute("stroke-width","2"),n.setAttribute("fill","none"),r.appendChild(n);const s=document.createElementNS("http://www.w3.org/2000/svg","polygon"),c=i.arrowDir==="down"?"-4,0 4,0 0,8":i.arrowDir==="up"?"-4,0 4,0 0,-8":i.arrowDir==="left"?"0,-4 -8,0 0,4":"0,-4 8,0 0,4";s.setAttribute("points",c),s.setAttribute("fill","var(--wg-accent-color, #0078d4)"),s.setAttribute("transform",`translate(${i.arrowPos.x}, ${i.arrowPos.y})`),r.appendChild(s),this.shadow.appendChild(r)}openDatePicker(t,i){this.datepicker&&(this.datepicker.close(!0),this.datepicker=null);const r=t.dataset.dateFormat||"YYYY-MM-DD",n=t.dataset.minDate,s=t.dataset.maxDate,c=t.dataset.dateValue||"";this.datepicker=new me({dateFormat:r,minDate:n||void 0,maxDate:s||void 0,onSelect:(a,l)=>{this.handleDatePickerSelect(t,a,l)},onClose:()=>{this.datepicker=null,N(this),this.grid.cancelEdit()}}),this.datepicker.open(i,c||null)}handleDatePickerSelect(t,i,r){const n=t.dataset.dateFormat||"YYYY-MM-DD",s=ue(n);t.value=Ge(i,s),t.dataset.dateValue=he(i),this.datepicker=null,this.isCommittingFromKeyboard=!0,this.commitDateEditor(t);const c=parseInt(t.dataset.row||"0",10),a=t.dataset.field||"";this.moveFocusAfterCommit(c,a,r||"down")}commitDateEditor(t){if(!this.grid.editingCell)return;const i=parseInt(t.dataset.row||"0",10),r=t.dataset.field||"",n=t.dataset.outputFormat||"iso",s=t.dataset.dateFormat||"YYYY-MM-DD",c=ue(s),a=t.value?this.parseDateInput(t.value,c):null;let l=null;if(a)switch(n){case"date":l=a;break;case"timestamp":l=a.getTime();break;case"iso":default:l=he(a);break}this.grid.commitEdit(i,r,l)}parseDateInput(t,i){if(!t)return null;const r=t.split(i.separator);let n=null,s=null,c=null;if(r.forEach((l,g)=>{var h,u,p;if(!l)return;const d=parseInt(l,10);((h=i.parts.year)==null?void 0:h.index)===g?n=d<100?d+2e3:d:((u=i.parts.month)==null?void 0:u.index)===g?s=d:((p=i.parts.day)==null?void 0:p.index)===g&&(c=d)}),n===null||s===null||c===null)return null;const a=new Date(n,s-1,c);return a.getMonth()!==s-1||a.getDate()!==c?null:a}showGoToRowDialog(t){const i=this.grid.displayItems;if(i.length===0)return;const r=document.createElement("div");r.className="wg__goto-overlay",r.innerHTML=`
640
+ ${u}
641
+ `;if(s.innerHTML=m,this.shadow.appendChild(s),g){const p=Math.max(0,this.grid.displayItems.length*this.grid.virtualScrollRowHeight-s.clientHeight);s.scrollTop=Math.min(i,p)}else s.scrollTop=i;if(s.scrollLeft=r,this.attachEventListeners(),this.grid.editingCell){const{rowIndex:p,field:C}=this.grid.editingCell;let _=this.shadow.querySelector(`.wg__combobox-input[data-row="${p}"][data-field="${C}"],
642
+ .wg__autocomplete-input[data-row="${p}"][data-field="${C}"],
643
+ .wg__select-trigger[data-row="${p}"][data-field="${C}"],
644
+ .wg__date-input[data-row="${p}"][data-field="${C}"]`);if(_||(_=this.shadow.querySelector(`.wg__editor[data-row="${p}"][data-field="${C}"]`)),_&&(_.focus(),_ instanceof HTMLInputElement&&_.type==="text")){const S=this.grid.editingCell.cursorPosition,b=this.getCurrentEditingColumn(),y=((v=b==null?void 0:b.editorOptions)==null?void 0:v.editStartSelection)||this.grid.editStartSelection;if(this.grid.editingCell.initialSearchQuery!==void 0){const k=_.value.length;_.setSelectionRange(k,k)}else switch(y){case"mousePosition":if(S!==void 0){const k=Math.min(S,_.value.length);_.setSelectionRange(k,k)}else _.setSelectionRange(_.value.length,_.value.length);break;case"cursorAtStart":_.setSelectionRange(0,0);break;case"cursorAtEnd":_.setSelectionRange(_.value.length,_.value.length);break;case"selectAll":default:_.select();break}}}else if(n&&!this.grid.editingCell){const p=s.querySelector(`td[data-row="${n.rowIndex}"][data-col="${n.colIndex}"]`);p&&setTimeout(()=>p.focus(),0)}g&&requestAnimationFrame(()=>{s.style.pointerEvents="none",requestAnimationFrame(()=>{s.style.pointerEvents=""})}),this.renderConnector(),Oe(this)}renderConnector(){const e=this.shadow.querySelector(".wg__connector");e&&e.remove();const i=nr();if(!i.path||!i.arrowPos)return;const r=document.createElementNS("http://www.w3.org/2000/svg","svg");r.setAttribute("class","wg__connector"),r.setAttribute("style","position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; pointer-events: none; z-index: 999;");const n=document.createElementNS("http://www.w3.org/2000/svg","path");n.setAttribute("d",i.path),n.setAttribute("stroke","var(--wg-accent-color, #0078d4)"),n.setAttribute("stroke-width","2"),n.setAttribute("fill","none"),r.appendChild(n);const s=document.createElementNS("http://www.w3.org/2000/svg","polygon"),a=i.arrowDir==="down"?"-4,0 4,0 0,8":i.arrowDir==="up"?"-4,0 4,0 0,-8":i.arrowDir==="left"?"0,-4 -8,0 0,4":"0,-4 8,0 0,4";s.setAttribute("points",a),s.setAttribute("fill","var(--wg-accent-color, #0078d4)"),s.setAttribute("transform",`translate(${i.arrowPos.x}, ${i.arrowPos.y})`),r.appendChild(s),this.shadow.appendChild(r)}openDatePicker(e,i){this.datepicker&&(this.datepicker.close(!0),this.datepicker=null);const r=e.dataset.dateFormat||"YYYY-MM-DD",n=e.dataset.minDate,s=e.dataset.maxDate,a=e.dataset.dateValue||"";this.datepicker=new ze({dateFormat:r,minDate:n||void 0,maxDate:s||void 0,onSelect:(l,d)=>{this.handleDatePickerSelect(e,l,d)},onClose:()=>{this.datepicker=null,G(this),this.grid.cancelEdit()}}),this.datepicker.open(i,a||null)}handleDatePickerSelect(e,i,r){const n=e.dataset.dateFormat||"YYYY-MM-DD",s=Ee(n);e.value=po(i,s),e.dataset.dateValue=$e(i),this.datepicker=null,this.isCommittingFromKeyboard=!0,this.commitDateEditor(e);const a=parseInt(e.dataset.row||"0",10),l=e.dataset.field||"";this.moveFocusAfterCommit(a,l,r||"down")}commitDateEditor(e){if(!this.grid.editingCell)return;const i=parseInt(e.dataset.row||"0",10),r=e.dataset.field||"",n=e.dataset.outputFormat||"iso",s=e.dataset.dateFormat||"YYYY-MM-DD",a=Ee(s),l=e.value?this.parseDateInput(e.value,a):null;let d=null;if(l)switch(n){case"date":d=l;break;case"timestamp":d=l.getTime();break;case"iso":default:d=$e(l);break}this.grid.commitEdit(i,r,d)}parseDateInput(e,i){if(!e)return null;const r=e.split(i.separator);let n=null,s=null,a=null;if(r.forEach((d,c)=>{var g,h,f;if(!d)return;const u=parseInt(d,10);((g=i.parts.year)==null?void 0:g.index)===c?n=u<100?u+2e3:u:((h=i.parts.month)==null?void 0:h.index)===c?s=u:((f=i.parts.day)==null?void 0:f.index)===c&&(a=u)}),n===null||s===null||a===null)return null;const l=new Date(n,s-1,a);return l.getMonth()!==s-1||l.getDate()!==a?null:l}showGoToRowDialog(e){const i=this.grid.displayItems;if(i.length===0)return;const r=document.createElement("div");r.className="wg__goto-overlay",r.innerHTML=`
644
645
  <div class="wg__goto-dialog">
645
646
  <label class="wg__goto-label">Go to row (1-${i.length}):</label>
646
647
  <input type="number" class="wg__goto-input" min="1" max="${i.length}" value="1" />
@@ -649,4 +650,4 @@
649
650
  <button type="button" class="wg__goto-btn wg__goto-btn--go">Go</button>
650
651
  </div>
651
652
  </div>
652
- `;const n=r.querySelector(".wg__goto-input"),s=r.querySelector(".wg__goto-btn--go"),c=r.querySelector(".wg__goto-btn--cancel"),a=()=>{r.remove()},l=()=>{const g=parseInt(n.value,10);if(isNaN(g)||g<1||g>i.length){n.focus(),n.select();return}a();const d=g-1,h=this.grid.focusedCell;if(this.grid.setFocusedCell(d,t),this.grid.shouldUseVirtualScroll())this.scrollToRowProgrammatically(d),requestAnimationFrame(()=>{requestAnimationFrame(()=>{const u=this.shadow.querySelector(`td[data-row="${d}"][data-col="${t}"]`);u==null||u.focus()})});else{const u=this.shadow.querySelector(`td[data-row="${d}"][data-col="${t}"]`);u&&(u.scrollIntoView({block:"nearest",behavior:"auto"}),u.focus(),K(this,h,{rowIndex:d,colIndex:t}))}};s.addEventListener("click",l),c.addEventListener("click",a),r.addEventListener("click",g=>{g.target===r&&a()}),n.addEventListener("keydown",g=>{g.key==="Enter"?(g.preventDefault(),l()):g.key==="Escape"&&(g.preventDefault(),a())}),this.shadow.appendChild(r),n.focus(),n.select()}openCustomEditor(t,i){const r=this.grid.columns[i];if(!r||r.editor!=="custom"||!r.cellEditCallback)return;const n=String(r.field),s=this.grid.displayItems[t];if(!s)return;const a={value:this.grid.getCellRawValue(s,t,n),row:s,rowIndex:t,field:n,commit:l=>{this.grid.commitEdit(t,n,l),N(this),requestAnimationFrame(()=>{A(this,t,i)})},cancel:()=>{N(this),this.grid.cancelEdit(),requestAnimationFrame(()=>{A(this,t,i)})}};r.cellEditCallback(a)}handleContextMenu(t){const i=this.grid.contextMenu;if(!i||i.length===0)return;const n=t.target.closest(".wg__cell");if(!n)return;t.preventDefault(),this.contextMenuElement&&(St(this.contextMenuElement),this.contextMenuElement=null);const s=parseInt(n.dataset.row||"0",10),c=parseInt(n.dataset.col||"0",10),a=this.grid.columns[c];if(!a)return;const l=this.grid.displayItems[s];if(!l)return;const g=String(a.field),d=this.grid.getCellRawValue(l,s,g),h={row:l,rowIndex:s,colIndex:c,column:a,cellValue:d};this.grid.oncontextmenuopen&&this.grid.oncontextmenuopen(h);const u=Object.getOwnPropertyDescriptor(this,"contextMenuXOffset"),p=Object.getOwnPropertyDescriptor(this,"contextMenuYOffset");u&&"value"in u&&(this.grid.contextMenuXOffset=u.value,delete this.contextMenuXOffset),p&&"value"in p&&(this.grid.contextMenuYOffset=p.value,delete this.contextMenuYOffset),this.contextMenuElement=ur(this,t.clientX,t.clientY,this.grid.contextMenuXOffset,this.grid.contextMenuYOffset,i,h,b=>{const v=i.find(w=>w.id===b);v!=null&&v.onclick&&v.onclick(h),this.contextMenuElement&&(St(this.contextMenuElement),this.contextMenuElement=null)},()=>{this.contextMenuElement=null})}setupToolbarShortcuts(){this.toolbarShortcutHandler&&document.removeEventListener("keydown",this.toolbarShortcutHandler);const t=this.grid.rowShortcuts;t!=null&&t.length&&(this.toolbarShortcutHandler=i=>{if(i.target.matches('input, textarea, select, [contenteditable="true"]'))return;const n=yt();if(n===null||!Fe(this.shadow))return;const s=this.grid.displayItems[n];if(!s)return;const c=this.grid.columns;for(const a of t){const l=be(a.key);if(ve(i,l)){const g={row:s,rowIndex:n,colIndex:0,column:c[0],cellValue:null};if(!(typeof a.disabled=="function"?a.disabled(g):a.disabled===!0)){i.preventDefault(),i.stopPropagation(),a.action(g);return}}}},document.addEventListener("keydown",this.toolbarShortcutHandler))}setupInlineShortcuts(){this.removeInlineShortcuts();const t=this.grid.rowShortcuts;!(t!=null&&t.length)||this.grid.hoveredRowIndex===null||(this.inlineShortcutHandler=i=>{if(i.target.matches('input, textarea, select, [contenteditable="true"]'))return;const n=this.grid.hoveredRowIndex;if(n===null)return;const s=this.grid.displayItems[n];if(!s)return;const c=this.grid.columns;for(const a of t){const l=be(a.key);if(ve(i,l)){const g={row:s,rowIndex:n,colIndex:0,column:c[0],cellValue:null};if(!(typeof a.disabled=="function"?a.disabled(g):a.disabled===!0)){i.preventDefault(),i.stopPropagation(),a.action(g);return}}}},document.addEventListener("keydown",this.inlineShortcutHandler))}removeInlineShortcuts(){this.inlineShortcutHandler&&(document.removeEventListener("keydown",this.inlineShortcutHandler),this.inlineShortcutHandler=null)}setupToolbarTooltips(t,i,r){const n=this.shadow.querySelector(".wg__toolbar-container");if(!n)return;n.querySelectorAll(".wg__toolbar-btn").forEach(c=>{var h;const a=c,l=a.dataset.toolbarItem,g=t.find(u=>u.id===l);if(!g)return;const d=(h=this.grid.rowShortcuts)==null?void 0:h.find(u=>u.id===g.id);a.addEventListener("mouseenter",()=>{const u=g.tooltipCallback?g.tooltipCallback(i,r):Si(g,d==null?void 0:d.key);ge(this,a,u,0,!0)}),a.addEventListener("mouseleave",()=>{Xe(this)})})}showToolbarForRow(t,i,r){if(this.grid.toolbarPosition==="inline"||!this.grid.showRowToolbar||!this.grid.rowToolbar.length)return;const n=se(this.grid.rowToolbar),s=this.grid.displayItems[i];if(!s)return;if(this.toolbarHideTimeout&&(clearTimeout(this.toolbarHideTimeout),this.toolbarHideTimeout=null),xi(this,t,i,n,s,a=>{this.handleToolbarItemClick(a,i,s)},r),this.setupToolbarShortcuts(),this.renderConnector(),this.setupToolbarTooltips(n,s,i),this.grid.toolbarTrigger==="hover"){const a=this.shadow.querySelector(".wg__toolbar-container");a&&(a.addEventListener("mouseenter",()=>{this.toolbarHovered=!0,this.toolbarHideTimeout&&(clearTimeout(this.toolbarHideTimeout),this.toolbarHideTimeout=null)}),a.addEventListener("mouseleave",()=>{this.toolbarHovered=!1,!this.toolbarMoveInProgress&&(this.toolbarHideTimeout=setTimeout(()=>{const l=this.shadow.querySelector(".wg__table"),g=l==null?void 0:l.matches(":hover"),d=a.matches(":hover");!g&&!d&&this.closeToolbarAndReset()},150))}))}const c=this.shadow.querySelector(`[data-toolbar-trigger="${i}"]`);c&&(this.shadow.querySelectorAll(".wg__toolbar-trigger--active").forEach(a=>{a.classList.remove("wg__toolbar-trigger--active")}),c.classList.add("wg__toolbar-trigger--active"))}closeToolbarAndReset(){this.toolbarMoveInProgress=!1,this.toolbarHovered=!1,this.toolbarHideTimeout&&(clearTimeout(this.toolbarHideTimeout),this.toolbarHideTimeout=null),this.toolbarShortcutHandler&&(document.removeEventListener("keydown",this.toolbarShortcutHandler),this.toolbarShortcutHandler=null),qt()}handleToolbarItemClick(t,i,r){const n=this.grid.displayItems.findIndex(c=>c===r);if(n===-1){this.closeToolbarAndReset();return}const s=t.id==="moveUp"||t.id==="moveDown";if(s&&(this.toolbarMoveInProgress=!0),t.onclick&&t.onclick({row:r,rowIndex:n}),this.grid.ontoolbarclick&&this.grid.ontoolbarclick({item:t,rowIndex:n,row:r}),t.id==="delete"){this.closeToolbarAndReset();return}s?(this.render(),qe(this,this.grid.displayItems),this.renderConnector()):this.render()}handleInlineActionClick(t,i){if(!t)return;const n=se(this.grid.rowToolbar).find(c=>c.id===t),s=this.grid.displayItems[i];!n||!s||(n.onclick&&n.onclick({row:s,rowIndex:i}),this.grid.ontoolbarclick&&this.grid.ontoolbarclick({item:n,rowIndex:i,row:s}),this.render())}}typeof customElements<"u"&&!customElements.get("web-grid")&&customElements.define("web-grid",_e),V.GridElement=_e,V.WebGrid=ct,V.default=_e,Object.defineProperties(V,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
653
+ `;const n=r.querySelector(".wg__goto-input"),s=r.querySelector(".wg__goto-btn--go"),a=r.querySelector(".wg__goto-btn--cancel"),l=()=>{r.remove()},d=()=>{const c=parseInt(n.value,10);if(isNaN(c)||c<1||c>i.length){n.focus(),n.select();return}l();const u=c-1,g=this.grid.focusedCell;if(this.grid.setFocusedCell(u,e),this.grid.shouldUseVirtualScroll())this.scrollToRowProgrammatically(u),requestAnimationFrame(()=>{requestAnimationFrame(()=>{const h=this.shadow.querySelector(`td[data-row="${u}"][data-col="${e}"]`);h==null||h.focus()})});else{const h=this.shadow.querySelector(`td[data-row="${u}"][data-col="${e}"]`);h&&(h.scrollIntoView({block:"nearest",behavior:"auto"}),h.focus(),tt(this,g,{rowIndex:u,colIndex:e}))}};s.addEventListener("click",d),a.addEventListener("click",l),r.addEventListener("click",c=>{c.target===r&&l()}),n.addEventListener("keydown",c=>{c.key==="Enter"?(c.preventDefault(),d()):c.key==="Escape"&&(c.preventDefault(),l())}),this.shadow.appendChild(r),n.focus(),n.select()}openCustomEditor(e,i){const r=this.grid.columns[i];if(!r||r.editor!=="custom"||!r.cellEditCallback)return;const n=String(r.field),s=this.grid.displayItems[e];if(!s)return;const l={value:this.grid.getCellRawValue(s,e,n),row:s,rowIndex:e,field:n,commit:d=>{this.grid.commitEdit(e,n,d),G(this),requestAnimationFrame(()=>{I(this,e,i)})},cancel:()=>{G(this),this.grid.cancelEdit(),requestAnimationFrame(()=>{I(this,e,i)})}};r.cellEditCallback(l)}handleContextMenu(e){const i=this.grid.contextMenu;if(!i||i.length===0)return;const n=e.target.closest(".wg__cell");if(!n)return;e.preventDefault(),this.contextMenuElement&&(Lt(this.contextMenuElement),this.contextMenuElement=null);const s=parseInt(n.dataset.row||"0",10),a=parseInt(n.dataset.col||"0",10),l=this.grid.columns[a];if(!l)return;const d=this.grid.displayItems[s];if(!d)return;const c=String(l.field),u=this.grid.getCellRawValue(d,s,c),g={row:d,rowIndex:s,colIndex:a,column:l,cellValue:u};this.grid.oncontextmenuopen&&this.grid.oncontextmenuopen(g);const h=Object.getOwnPropertyDescriptor(this,"contextMenuXOffset"),f=Object.getOwnPropertyDescriptor(this,"contextMenuYOffset");h&&"value"in h&&(this.grid.contextMenuXOffset=h.value,delete this.contextMenuXOffset),f&&"value"in f&&(this.grid.contextMenuYOffset=f.value,delete this.contextMenuYOffset),this.contextMenuElement=Br(this,e.clientX,e.clientY,this.grid.contextMenuXOffset,this.grid.contextMenuYOffset,i,g,m=>{const v=i.find(p=>p.id===m);v!=null&&v.onclick&&v.onclick(g),this.contextMenuElement&&(Lt(this.contextMenuElement),this.contextMenuElement=null)},()=>{this.contextMenuElement=null})}setupToolbarShortcuts(){this.toolbarShortcutHandler&&document.removeEventListener("keydown",this.toolbarShortcutHandler);const e=this.grid.rowShortcuts;e!=null&&e.length&&(this.toolbarShortcutHandler=i=>{if(i.target.matches('input, textarea, select, [contenteditable="true"]'))return;const n=It();if(n===null||!ro(this.shadow))return;const s=this.grid.displayItems[n];if(!s)return;const a=this.grid.columns;for(const l of e){const d=Nt(l.key);if(Yt(i,d)){const c={row:s,rowIndex:n,colIndex:0,column:a[0],cellValue:null};if(!(typeof l.disabled=="function"?l.disabled(c):l.disabled===!0)){i.preventDefault(),i.stopPropagation(),l.action(c);return}}}},document.addEventListener("keydown",this.toolbarShortcutHandler))}setupInlineShortcuts(){this.removeInlineShortcuts();const e=this.grid.rowShortcuts;!(e!=null&&e.length)||this.grid.hoveredRowIndex===null||(this.inlineShortcutHandler=i=>{if(i.target.matches('input, textarea, select, [contenteditable="true"]'))return;const n=this.grid.hoveredRowIndex;if(n===null)return;const s=this.grid.displayItems[n];if(!s)return;const a=this.grid.columns;for(const l of e){const d=Nt(l.key);if(Yt(i,d)){const c={row:s,rowIndex:n,colIndex:0,column:a[0],cellValue:null};if(!(typeof l.disabled=="function"?l.disabled(c):l.disabled===!0)){i.preventDefault(),i.stopPropagation(),l.action(c);return}}}},document.addEventListener("keydown",this.inlineShortcutHandler))}removeInlineShortcuts(){this.inlineShortcutHandler&&(document.removeEventListener("keydown",this.inlineShortcutHandler),this.inlineShortcutHandler=null)}setupToolbarTooltips(e,i,r){const n=this.shadow.querySelector(".wg__toolbar-container");if(!n)return;n.querySelectorAll(".wg__toolbar-btn").forEach(a=>{var g;const l=a,d=l.dataset.toolbarItem,c=e.find(h=>h.id===d);if(!c)return;const u=(g=this.grid.rowShortcuts)==null?void 0:g.find(h=>h.id===c.id);l.addEventListener("mouseenter",()=>{const h=c.tooltipCallback?c.tooltipCallback(i,r):or(c,u==null?void 0:u.key);Re(this,l,h,0,!0)}),l.addEventListener("mouseleave",()=>{fo(this)})})}showToolbarForRow(e,i,r){if(this.grid.toolbarPosition==="inline"||!this.grid.showRowToolbar||!this.grid.rowToolbar.length)return;const n=ve(this.grid.rowToolbar),s=this.grid.displayItems[i];if(!s)return;if(this.toolbarHideTimeout&&(clearTimeout(this.toolbarHideTimeout),this.toolbarHideTimeout=null),rr(this,e,i,n,s,l=>{this.handleToolbarItemClick(l,i,s)},r),this.setupToolbarShortcuts(),this.renderConnector(),this.setupToolbarTooltips(n,s,i),this.grid.toolbarTrigger==="hover"){const l=this.shadow.querySelector(".wg__toolbar-container");l&&(l.addEventListener("mouseenter",()=>{this.toolbarHovered=!0,this.toolbarHideTimeout&&(clearTimeout(this.toolbarHideTimeout),this.toolbarHideTimeout=null)}),l.addEventListener("mouseleave",()=>{this.toolbarHovered=!1,!this.toolbarMoveInProgress&&(this.toolbarHideTimeout=setTimeout(()=>{const d=this.shadow.querySelector(".wg__table"),c=d==null?void 0:d.matches(":hover"),u=l.matches(":hover");!c&&!u&&this.closeToolbarAndReset()},150))}))}const a=this.shadow.querySelector(`[data-toolbar-trigger="${i}"]`);a&&(this.shadow.querySelectorAll(".wg__toolbar-trigger--active").forEach(l=>{l.classList.remove("wg__toolbar-trigger--active")}),a.classList.add("wg__toolbar-trigger--active"))}closeToolbarAndReset(){this.toolbarMoveInProgress=!1,this.toolbarHovered=!1,this.toolbarHideTimeout&&(clearTimeout(this.toolbarHideTimeout),this.toolbarHideTimeout=null),this.toolbarShortcutHandler&&(document.removeEventListener("keydown",this.toolbarShortcutHandler),this.toolbarShortcutHandler=null),ee()}handleToolbarItemClick(e,i,r){const n=this.grid.displayItems.findIndex(a=>a===r);if(n===-1){this.closeToolbarAndReset();return}const s=e.id==="moveUp"||e.id==="moveDown";if(s&&(this.toolbarMoveInProgress=!0),e.onclick&&e.onclick({row:r,rowIndex:n}),this.grid.ontoolbarclick&&this.grid.ontoolbarclick({item:e,rowIndex:n,row:r}),e.id==="delete"){this.closeToolbarAndReset();return}s?(this.render(),no(this,this.grid.displayItems),this.renderConnector()):this.render()}handleInlineActionClick(e,i){if(!e)return;const n=ve(this.grid.rowToolbar).find(a=>a.id===e),s=this.grid.displayItems[i];!n||!s||(n.onclick&&n.onclick({row:s,rowIndex:i}),this.grid.ontoolbarclick&&this.grid.ontoolbarclick({item:n,rowIndex:i,row:s}),this.render())}}typeof customElements<"u"&&!customElements.get("web-grid")&&customElements.define("web-grid",Ae),B.GridElement=Ae,B.WebGrid=yt,B.default=Ae,Object.defineProperties(B,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});