@gp-grid/core 0.23.0 → 0.23.1
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.
- package/dist/index.d.ts +51 -17
- package/dist/index.js +4 -4
- package/dist/styles.css +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -331,8 +331,6 @@ interface TextFilterCondition {
|
|
|
331
331
|
selectedValues?: Set<CellValue>;
|
|
332
332
|
/** Include blank values */
|
|
333
333
|
includeBlank?: boolean;
|
|
334
|
-
/** Operator connecting this condition to the next. Defaults to ColumnFilterModel.combination */
|
|
335
|
-
nextOperator?: FilterCombination;
|
|
336
334
|
}
|
|
337
335
|
/** Number filter condition */
|
|
338
336
|
interface NumberFilterCondition {
|
|
@@ -341,8 +339,6 @@ interface NumberFilterCondition {
|
|
|
341
339
|
value?: number;
|
|
342
340
|
/** Second value for "between" operator */
|
|
343
341
|
valueTo?: number;
|
|
344
|
-
/** Operator connecting this condition to the next. Defaults to ColumnFilterModel.combination */
|
|
345
|
-
nextOperator?: FilterCombination;
|
|
346
342
|
}
|
|
347
343
|
/** Date filter condition */
|
|
348
344
|
interface DateFilterCondition {
|
|
@@ -351,16 +347,34 @@ interface DateFilterCondition {
|
|
|
351
347
|
value?: Date | string;
|
|
352
348
|
/** Second value for "between" operator */
|
|
353
349
|
valueTo?: Date | string;
|
|
354
|
-
/** Operator connecting this condition to the next. Defaults to ColumnFilterModel.combination */
|
|
355
|
-
nextOperator?: FilterCombination;
|
|
356
350
|
}
|
|
357
351
|
/** Union of filter condition types */
|
|
358
352
|
type FilterCondition = TextFilterCondition | NumberFilterCondition | DateFilterCondition;
|
|
359
|
-
/**
|
|
360
|
-
interface
|
|
353
|
+
/** A visibly grouped set of conditions joined by one operator. */
|
|
354
|
+
interface FilterConditionGroup {
|
|
361
355
|
conditions: FilterCondition[];
|
|
362
356
|
combination: FilterCombination;
|
|
363
357
|
}
|
|
358
|
+
/** Column filter model with one explicit level of condition groups. */
|
|
359
|
+
interface ColumnFilterModel {
|
|
360
|
+
groups: FilterConditionGroup[];
|
|
361
|
+
combination: FilterCombination;
|
|
362
|
+
}
|
|
363
|
+
/**
|
|
364
|
+
* Condition shape accepted when restoring a filter created before grouped
|
|
365
|
+
* composition was introduced.
|
|
366
|
+
*/
|
|
367
|
+
type LegacyFilterCondition = FilterCondition & {
|
|
368
|
+
/** Operator connecting this condition to the next. */
|
|
369
|
+
nextOperator?: FilterCombination;
|
|
370
|
+
};
|
|
371
|
+
/** Legacy left-to-right column filter model accepted as migration input. */
|
|
372
|
+
interface LegacyColumnFilterModel {
|
|
373
|
+
conditions: LegacyFilterCondition[];
|
|
374
|
+
combination: FilterCombination;
|
|
375
|
+
}
|
|
376
|
+
/** Canonical or legacy input accepted by the imperative filter API. */
|
|
377
|
+
type ColumnFilterInput = ColumnFilterModel | LegacyColumnFilterModel;
|
|
364
378
|
/** Filter model type - maps column ID to filter */
|
|
365
379
|
type FilterModel = Record<string, ColumnFilterModel>;
|
|
366
380
|
//#endregion
|
|
@@ -1217,7 +1231,7 @@ declare class SortFilterManager<TData = Record<string, unknown>> {
|
|
|
1217
1231
|
constructor(options: SortFilterManagerOptions<TData>);
|
|
1218
1232
|
setSort(colId: string, direction: SortDirection | null, addToExisting?: boolean): Promise<void>;
|
|
1219
1233
|
getSortModel(): SortModel[];
|
|
1220
|
-
setFilter(colId: string, filter:
|
|
1234
|
+
setFilter(colId: string, filter: ColumnFilterInput | string | null): Promise<void>;
|
|
1221
1235
|
/**
|
|
1222
1236
|
* Lint for hand-constructed filter models: values-mode `selectedValues`
|
|
1223
1237
|
* match by strict raw identity (`"5"` never matches `5`, an ISO string
|
|
@@ -1399,12 +1413,12 @@ declare function evaluateNumberCondition(cellValue: CellValue, condition: Number
|
|
|
1399
1413
|
*/
|
|
1400
1414
|
declare function evaluateDateCondition(cellValue: CellValue, condition: DateFilterCondition): boolean;
|
|
1401
1415
|
/**
|
|
1402
|
-
* Evaluate a column filter model against a cell value.
|
|
1403
|
-
*
|
|
1404
|
-
*
|
|
1405
|
-
*
|
|
1416
|
+
* Evaluate a column filter model against a cell value. Conditions are joined
|
|
1417
|
+
* inside their explicit group, then groups are joined at the model level.
|
|
1418
|
+
* Legacy flat inputs retain their historical left-to-right truth table by
|
|
1419
|
+
* first normalizing to an equivalent grouped model.
|
|
1406
1420
|
*/
|
|
1407
|
-
declare function evaluateColumnFilter(cellValue: CellValue, filter:
|
|
1421
|
+
declare function evaluateColumnFilter(cellValue: CellValue, filter: ColumnFilterInput, formatter?: (v: CellValue) => string): boolean;
|
|
1408
1422
|
/**
|
|
1409
1423
|
* Check if a row passes all filters in a filter model.
|
|
1410
1424
|
* `getValueFormatter` — when provided — lets free-text condition operators
|
|
@@ -1538,7 +1552,7 @@ declare class GridCore<TData = unknown> {
|
|
|
1538
1552
|
*/
|
|
1539
1553
|
setViewport(scrollTop: number, scrollLeft: number, width: number, height: number): void;
|
|
1540
1554
|
setSort(colId: string, direction: SortDirection | null, addToExisting?: boolean): Promise<void>;
|
|
1541
|
-
setFilter(colId: string, filter:
|
|
1555
|
+
setFilter(colId: string, filter: ColumnFilterInput | string | null): Promise<void>;
|
|
1542
1556
|
hasActiveFilter(colId: string): boolean;
|
|
1543
1557
|
/**
|
|
1544
1558
|
* Open a column filter popup.
|
|
@@ -1770,6 +1784,15 @@ interface MutableClientDataSourceOptions<TData> {
|
|
|
1770
1784
|
*/
|
|
1771
1785
|
declare function createMutableClientDataSource<TData = unknown>(data: TData[], options: MutableClientDataSourceOptions<TData>): MutableDataSource<TData>;
|
|
1772
1786
|
//#endregion
|
|
1787
|
+
//#region src/filtering/normalize.d.ts
|
|
1788
|
+
/** Check whether a filter still uses the legacy flat condition list. */
|
|
1789
|
+
declare const isLegacyColumnFilterModel: (filter: ColumnFilterInput) => filter is LegacyColumnFilterModel;
|
|
1790
|
+
/**
|
|
1791
|
+
* Convert a legacy left-to-right filter into the canonical one-level grouped
|
|
1792
|
+
* representation. Canonical inputs are returned unchanged.
|
|
1793
|
+
*/
|
|
1794
|
+
declare const normalizeColumnFilterModel: (filter: ColumnFilterInput) => ColumnFilterModel;
|
|
1795
|
+
//#endregion
|
|
1773
1796
|
//#region src/filtering/distinct-entries.d.ts
|
|
1774
1797
|
/** One checkbox row in the values-mode filter popup. */
|
|
1775
1798
|
interface DistinctValueEntry {
|
|
@@ -2115,6 +2138,10 @@ interface GridLabels {
|
|
|
2115
2138
|
addCondition: string;
|
|
2116
2139
|
/** Remove-condition button glyph */
|
|
2117
2140
|
removeCondition: string;
|
|
2141
|
+
/** "+ Add group" button */
|
|
2142
|
+
addGroup: string;
|
|
2143
|
+
/** Remove-group button glyph */
|
|
2144
|
+
removeGroup: string;
|
|
2118
2145
|
/** Clear button */
|
|
2119
2146
|
clear: string;
|
|
2120
2147
|
/** Apply button */
|
|
@@ -2140,6 +2167,13 @@ interface GridLabels {
|
|
|
2140
2167
|
/** Filter operator labels */
|
|
2141
2168
|
operators: GridFilterOperatorLabels;
|
|
2142
2169
|
}
|
|
2170
|
+
/**
|
|
2171
|
+
* Consumer overrides for grid labels. Every top-level label and every nested
|
|
2172
|
+
* operator label can be changed independently.
|
|
2173
|
+
*/
|
|
2174
|
+
type GridLabelOverrides = Omit<Partial<GridLabels>, "operators"> & {
|
|
2175
|
+
operators?: Partial<GridFilterOperatorLabels>;
|
|
2176
|
+
};
|
|
2143
2177
|
/** English defaults for every grid label. */
|
|
2144
2178
|
declare const defaultGridLabels: GridLabels;
|
|
2145
2179
|
/**
|
|
@@ -2147,7 +2181,7 @@ declare const defaultGridLabels: GridLabels;
|
|
|
2147
2181
|
* `GridLabels`. Top-level keys are shallow-merged and `operators` is merged
|
|
2148
2182
|
* one level deep; the defaults are never mutated.
|
|
2149
2183
|
*/
|
|
2150
|
-
declare const resolveGridLabels: (overrides?:
|
|
2184
|
+
declare const resolveGridLabels: (overrides?: GridLabelOverrides) => GridLabels;
|
|
2151
2185
|
/**
|
|
2152
2186
|
* Interpolate `{token}` placeholders in a label template. Unknown tokens are
|
|
2153
2187
|
* left untouched and missing params are skipped, so this never throws.
|
|
@@ -2470,4 +2504,4 @@ declare class InputEventAdapter<TData = unknown> {
|
|
|
2470
2504
|
private dispatchCellDragStart;
|
|
2471
2505
|
}
|
|
2472
2506
|
//#endregion
|
|
2473
|
-
export { type AssignSlotInstruction, AutoScrollDriver, type BatchChangeSetters, type BatchInstructionListener, type CalculateFillHandlePositionParams, type CancelFillInstruction, type CellDataType, type CellPointerAction, type CellPosition, type CellRange, type CellRendererParams, type CellValue, type CellValueChangedEvent, type CloseFilterPopupInstruction, type ColumnDefinition, type ColumnFilterModel, type ColumnMoveDragState, type ColumnResizeDragState, type ColumnScrollGeometry, type ColumnsChangedInstruction, type CommitEditInstruction, type CommitFillInstruction, type ContainerBounds, type CreateSlotInstruction, type DataChangeListener, type DataErrorInstruction, type DataLoadedInstruction, type DataLoadingInstruction, type DataSource, type DataSourceLoadMode, DataSourceOwner, type DataSourceRange, type DataSourceRequest, type DataSourceResponse, type DateFilterCondition, type DateFilterOperator, type DestroySlotInstruction, type Direction, type DistinctValueEntry, type DragEndResult, type DragMoveResult, type DragState, type EditRendererParams, type EditState, type FillHandlePosition, type FillHandleState, type FillPointerAction, type FilterCombination, type FilterCondition, type FilterModel, type FilterOperatorOption, type FilterPopupState, GridCore, type GridCoreOptions, type GridFilterOperatorLabels, type GridInstruction, type GridLabels, type GridState, type HeaderData, type HeaderRendererParams, type HighlightContext, type HighlightingOptions, IndexedDataStore, type IndexedDataStoreOptions, type InitialStateArgs, InputEventAdapter, type InputEventAdapterDeps, InputHandler, type InputHandlerDeps, type InputResult, type InstructionListener, type KeyEventData, type KeyboardResult, type MoveSlotInstruction, type MutableClientDataSourceOptions, type MutableDataSource, type NumberFilterCondition, type NumberFilterOperator, type OpenFilterPopupInstruction, type ParallelSortOptions, PendingCellTapController, type PendingCellTapDeps, PendingRowDragController, type PendingRowDragDeps, type PointerEventData, type PopupPosition, ROW_DRAG_HOLD_MS, type RowCacheEviction, type RowCacheOptions, type RowDragState, type RowId, type RowLoadingMode, type RowLoadingOptions, type SelectionState, type ServerDataSourceOptions, type SetActiveCellInstruction, type SetContentSizeInstruction, type SetHoverPositionInstruction, type SetSelectionRangeInstruction, type SlotData, type SlotState, type SortDirection, type SortModel, type StartEditInstruction, type StartFillInstruction, type StartPeekInstruction, type StopEditInstruction, type StopPeekInstruction, TAP_SLOP_PX, type TextFilterCondition, type TextFilterOperator, TouchScrollController, type TouchScrollDeps, type Transaction, TransactionManager, type TransactionManagerOptions, type TransactionResult, type UpdateFillInstruction, type UpdateHeaderInstruction, type VisibleColumnInfo, applyBatchInstructions, applyInstruction, bindPeekSelectAll, buildCellClasses, calculateColumnPositions, calculateFillHandlePosition, calculateFilterPopupPosition, calculateScaledColumnPositions, createClientDataSource, createDataSourceFromArray, createInitialState, createMutableClientDataSource, createServerDataSource, defaultGridLabels, evaluateColumnFilter, evaluateDateCondition, evaluateNumberCondition, evaluateTextCondition, findColumnAtX, formatCellValue, formatLabel, getDateOperatorOptions, getFieldValue, getNumberOperatorOptions, getTextOperatorOptions, getTotalWidth, groupDistinctValues, isBlankCellValue, isCellActive, isCellEditing, isCellInFillPreview, isCellSelected, isRowVisible, isSameDay, labelsForSelectedValues, rawValueKey, rawValuesForLabels, resolveGridLabels, rowPassesFilter, scrollCellIntoView, setFieldValue, toPointerEventData };
|
|
2507
|
+
export { type AssignSlotInstruction, AutoScrollDriver, type BatchChangeSetters, type BatchInstructionListener, type CalculateFillHandlePositionParams, type CancelFillInstruction, type CellDataType, type CellPointerAction, type CellPosition, type CellRange, type CellRendererParams, type CellValue, type CellValueChangedEvent, type CloseFilterPopupInstruction, type ColumnDefinition, type ColumnFilterInput, type ColumnFilterModel, type ColumnMoveDragState, type ColumnResizeDragState, type ColumnScrollGeometry, type ColumnsChangedInstruction, type CommitEditInstruction, type CommitFillInstruction, type ContainerBounds, type CreateSlotInstruction, type DataChangeListener, type DataErrorInstruction, type DataLoadedInstruction, type DataLoadingInstruction, type DataSource, type DataSourceLoadMode, DataSourceOwner, type DataSourceRange, type DataSourceRequest, type DataSourceResponse, type DateFilterCondition, type DateFilterOperator, type DestroySlotInstruction, type Direction, type DistinctValueEntry, type DragEndResult, type DragMoveResult, type DragState, type EditRendererParams, type EditState, type FillHandlePosition, type FillHandleState, type FillPointerAction, type FilterCombination, type FilterCondition, type FilterConditionGroup, type FilterModel, type FilterOperatorOption, type FilterPopupState, GridCore, type GridCoreOptions, type GridFilterOperatorLabels, type GridInstruction, type GridLabelOverrides, type GridLabels, type GridState, type HeaderData, type HeaderRendererParams, type HighlightContext, type HighlightingOptions, IndexedDataStore, type IndexedDataStoreOptions, type InitialStateArgs, InputEventAdapter, type InputEventAdapterDeps, InputHandler, type InputHandlerDeps, type InputResult, type InstructionListener, type KeyEventData, type KeyboardResult, type LegacyColumnFilterModel, type LegacyFilterCondition, type MoveSlotInstruction, type MutableClientDataSourceOptions, type MutableDataSource, type NumberFilterCondition, type NumberFilterOperator, type OpenFilterPopupInstruction, type ParallelSortOptions, PendingCellTapController, type PendingCellTapDeps, PendingRowDragController, type PendingRowDragDeps, type PointerEventData, type PopupPosition, ROW_DRAG_HOLD_MS, type RowCacheEviction, type RowCacheOptions, type RowDragState, type RowId, type RowLoadingMode, type RowLoadingOptions, type SelectionState, type ServerDataSourceOptions, type SetActiveCellInstruction, type SetContentSizeInstruction, type SetHoverPositionInstruction, type SetSelectionRangeInstruction, type SlotData, type SlotState, type SortDirection, type SortModel, type StartEditInstruction, type StartFillInstruction, type StartPeekInstruction, type StopEditInstruction, type StopPeekInstruction, TAP_SLOP_PX, type TextFilterCondition, type TextFilterOperator, TouchScrollController, type TouchScrollDeps, type Transaction, TransactionManager, type TransactionManagerOptions, type TransactionResult, type UpdateFillInstruction, type UpdateHeaderInstruction, type VisibleColumnInfo, applyBatchInstructions, applyInstruction, bindPeekSelectAll, buildCellClasses, calculateColumnPositions, calculateFillHandlePosition, calculateFilterPopupPosition, calculateScaledColumnPositions, createClientDataSource, createDataSourceFromArray, createInitialState, createMutableClientDataSource, createServerDataSource, defaultGridLabels, evaluateColumnFilter, evaluateDateCondition, evaluateNumberCondition, evaluateTextCondition, findColumnAtX, formatCellValue, formatLabel, getDateOperatorOptions, getFieldValue, getNumberOperatorOptions, getTextOperatorOptions, getTotalWidth, groupDistinctValues, isBlankCellValue, isCellActive, isCellEditing, isCellInFillPreview, isCellSelected, isLegacyColumnFilterModel, isRowVisible, isSameDay, labelsForSelectedValues, normalizeColumnFilterModel, rawValueKey, rawValuesForLabels, resolveGridLabels, rowPassesFilter, scrollCellIntoView, setFieldValue, toPointerEventData };
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
const e=(e,t,n,r,i)=>{let a=0,o=0;return e<40+i?o=-10:e>n-40&&(o=10),t<40?a=-10:t>r-40&&(a=10),a!==0||o!==0?{dx:a,dy:o}:null};var t=class{active=!1;colIndex=-1;startX=0;initialWidth=0;currentWidth=0;core;constructor(e){this.core=e}get isActive(){return this.active}start(e,t,n){return n.button!==0||this.core.getColumns()[e]?.resizable===!1?{preventDefault:!1,stopPropagation:!1}:(this.active=!0,this.colIndex=e,this.startX=n.clientX,this.initialWidth=t,this.currentWidth=t,{preventDefault:!0,stopPropagation:!0,startDrag:`column-resize`})}move(e,t){let n=this.core.getColumns()[this.colIndex],r=n?.minWidth??50,i=n?.maxWidth,a=this.initialWidth+(e.clientX-this.startX);a=Math.max(r,a),i!==void 0&&(a=Math.min(i,a)),this.currentWidth=a;let o=e.clientX-t.left>t.width-40?10:0,s=o===0?null:{dx:o,dy:0};return{targetRow:0,targetCol:this.colIndex,autoScroll:s}}end(){this.active&&this.core.setColumnWidth(this.colIndex,this.currentWidth),this.active=!1,this.colIndex=-1}getState(){return this.active===!1?null:{colIndex:this.colIndex,initialWidth:this.initialWidth,currentWidth:this.currentWidth}}};const n=e=>{let t=[0],n=0;for(let r of e)n+=r.width,t.push(n);return t},r=e=>e.at(-1)??0,i=(e,t)=>{let i=n(e),a=r(i);if(t<=a||a===0)return{positions:i,widths:e.map(e=>e.width)};let o=t/a,s=e.map(e=>e.width*o),c=[0],l=0;for(let e of s)l+=e,c.push(l);return{positions:c,widths:s}},a=(e,t)=>{for(let n=0;n<t.length-1;n++)if(e>=t[n]&&e<t[n+1])return n;return e>=t.at(-1)?t.length-2:0},o=e=>({minRow:Math.min(e.startRow,e.endRow),maxRow:Math.max(e.startRow,e.endRow),minCol:Math.min(e.startCol,e.endCol),maxCol:Math.max(e.startCol,e.endCol)}),s=(e,t,n)=>e>=n.minRow&&e<=n.maxRow&&t>=n.minCol&&t<=n.maxCol,c=(e,t,n)=>{if(!n)return!1;let r=o(n);return s(e,t,r)},l=(e,t,n)=>n?.row===e&&n?.col===t,u=(e,t)=>!t||t.end<0||t.start>t.end||e>=t.start&&e<=t.end,d=(e,t,n)=>n?.row===e&&n?.col===t,f=(e,t,n,r,i)=>{if(!n||!r||!i)return!1;let{minRow:a,maxRow:s,minCol:c,maxCol:l}=o(r),u=i.row>s,d=i.row<a;return u?e>s&&e<=i.row&&t>=c&&t<=l:d?e<a&&e>=i.row&&t>=c&&t<=l:!1},p=(e,t,n,r)=>{let i=[`gp-grid-cell`];return e&&i.push(`gp-grid-cell--active`),t&&!e&&i.push(`gp-grid-cell--selected`),n&&i.push(`gp-grid-cell--editing`),r&&i.push(`gp-grid-cell--fill-preview`),i.join(` `)},m=(e,t)=>{if(!t)return!1;let{minRow:n,maxRow:r}=o(t);return e>=n&&e<=r},h=(e,t)=>{if(!t)return!1;let{minCol:n,maxCol:r}=o(t);return e>=n&&e<=r};function g(e,t){let n=t.split(`.`),r=e;for(let e of n){if(typeof r!=`object`||!r)return null;r=r[e]}return r}function _(e,t,n){let r=t.split(`.`),i=e;for(let e=0;e<r.length-1;e++){let t=r[e];if(typeof i!=`object`||!i)return;i=i[t]}typeof i==`object`&&i&&(i[r.at(-1)]=n)}const v=()=>{let e=[];return{onInstruction:t=>(e.push(t),()=>{e=e.filter(e=>e!==t)}),emit:t=>{for(let n of e)n(t)},clearListeners:()=>{e=[]}}},y=()=>{let e=v(),t=[];return{onInstruction:e.onInstruction,onBatchInstruction:e=>(t.push(e),()=>{t=t.filter(t=>t!==e)}),emit:n=>{e.emit(n);for(let e of t)e([n])},emitBatch:n=>{if(n.length!==0){for(let e of t)e(n);for(let t of n)e.emit(t)}},clearListeners:()=>{e.clearListeners(),t=[]}}},b=(e,t)=>{for(let n of e.values())if(n.rowIndex===t)return n;return null},ee=(e,t,n,r,i,a)=>{let o=b(i,n);if(!o){t.scrollTop=e.getScrollTopForRow(n);return}let s=a+o.translateY-t.scrollTop,c=s+r;if(s<0)t.scrollTop=e.getScrollTopForRow(n);else if(c>t.clientHeight){let i=Math.floor(t.clientHeight/r),a=Math.max(0,n-i+1);t.scrollTop=e.getScrollTopForRow(a)}},te=(e,t)=>{let n=t.visibleColumns.findIndex(e=>e.originalIndex===t.colIndex),r=t.columnPositions[n],i=t.columnWidths[n];if(n<0||r===void 0||i===void 0)return;if(r<e.scrollLeft){e.scrollLeft=r;return}let a=r+i;a>e.scrollLeft+e.clientWidth&&(e.scrollLeft=a-e.clientWidth)},ne=(e,t,n,r,i,a=0,o)=>{ee(e,t,n,r,i,a),o!==void 0&&te(t,o)},x=(e,t)=>e==null?``:t?t(e):Array.isArray(e)?e.join(`, `):typeof e==`object`?e instanceof Date?String(e):JSON.stringify(e):String(e),re=e=>{let{activeCell:t,selectionRange:n,slots:r,columns:i,visibleColumnsWithIndices:a,columnPositions:o,columnWidths:s,rowHeight:c}=e;if(!t&&!n)return null;let l,u,d,f;if(n)l=Math.max(n.startRow,n.endRow),u=Math.max(n.startCol,n.endCol),d=Math.min(n.startCol,n.endCol),f=Math.max(n.startCol,n.endCol);else if(t)l=t.row,u=t.col,d=u,f=u;else return null;for(let e=d;e<=f;e++){let t=i[e];if(!(!t||t.hidden)&&t.editable!==!0)return null}let p=a.findIndex(e=>e.originalIndex===u);if(p===-1)return null;let m=null;for(let e of r.values())if(e.rowIndex===l){m=e.translateY;break}if(m===null)return null;let h=o[p]??0,g=s[p]??0;return{top:m+c-5,left:h+g-20}},ie=(e,t,n=8)=>{let r=e.getBoundingClientRect(),i=t.getBoundingClientRect(),a=r.bottom+4,o=r.left,s=Math.max(200,r.width);return o+i.width>window.innerWidth-n&&(o=window.innerWidth-i.width-n),o=Math.max(n,o),a+i.height>window.innerHeight-n&&(a=r.top-i.height-4),a=Math.max(n,a),{top:a,left:o,minWidth:s}},ae=e=>{if(typeof document>`u`)return()=>{};let t=t=>{if(t.key!==`a`&&t.key!==`A`||!(t.ctrlKey||t.metaKey))return;t.preventDefault();let n=globalThis.getSelection();if(!n)return;n.removeAllRanges();let r=document.createRange();r.selectNodeContents(e),n.addRange(r)};return document.addEventListener(`keydown`,t),()=>document.removeEventListener(`keydown`,t)},oe=e=>{if(!e||e.length===0)return;let t={};for(let n of e)n.valueFormatter&&(t[n.colId??n.field]=n.valueFormatter);return Object.keys(t).length>0?t:void 0},S=e=>({range:e.range,sort:e.sortModel.length>0?e.sortModel:void 0,filter:Object.keys(e.filterModel).length>0?e.filterModel:void 0,valueFormatters:oe(e.columns)}),se=(e,t,n)=>{let r=e.get(t);if(r!==void 0){if(t<n){let i=n-1;for(let n=t;n<i;n++){let t=e.get(n+1);t===void 0?e.delete(n):e.set(n,t)}e.set(i,r);return}for(let r=t;r>n;r--){let t=e.get(r-1);t===void 0?e.delete(r):e.set(r,t)}e.set(n,r)}},ce=e=>{let t=[0],n=0;for(let r of e)r.hidden||(n+=r.width,t.push(n));return t},le=(e,t,n,r)=>{let i=e.get(n);if(!i)return null;let a=t[r];return a?g(i,a.field):null},ue=(e,t,n,r,i,a)=>{let o=e.get(n);if(!o||typeof o!=`object`)return;let s=t[r];if(!s)return;let c=a.onCellValueChanged!==void 0,l=c?g(o,s.field):void 0;_(o,s.field,i),c&&a.onCellValueChanged({rowId:a.getRowId(o),colIndex:r,field:s.field,oldValue:l,newValue:i,rowData:o})};var C=class{active=!1;thresholdMet=!1;startX=0;startY=0;currentX=0;currentY=0;dropTargetIndex=null;get isDraggingForDisplay(){return this.active&&this.thresholdMet}begin(e,t){this.active=!0,this.startX=e,this.startY=t,this.thresholdMet=!1,this.currentX=e,this.currentY=t,this.dropTargetIndex=null}track(e){if(this.thresholdMet===!1){let t=e.clientX-this.startX,n=e.clientY-this.startY;if(!(Math.abs(t)>5||Math.abs(n)>5))return!1;this.thresholdMet=!0}return this.currentX=e.clientX,this.currentY=e.clientY,!0}reset(){this.active=!1,this.thresholdMet=!1,this.dropTargetIndex=null}},de=class{gesture=new C;sourceColIndex=-1;shiftKey=!1;ghostWidth=0;ghostHeight=0;core;deps;constructor(e,t){this.core=e,this.deps=t}updateDeps(e){this.deps=e}get isActive(){return this.gesture.active}get isDraggingForDisplay(){return this.gesture.isDraggingForDisplay}start(e,t,n,r){return r.button!==0||this.core.getColumns()[e]?.movable===!1?{preventDefault:!1,stopPropagation:!1}:(this.sourceColIndex=e,this.shiftKey=r.shiftKey,this.ghostWidth=t,this.ghostHeight=n,this.gesture.begin(r.clientX,r.clientY),{preventDefault:!0,stopPropagation:!0,startDrag:`column-move`})}move(e,t){if(this.gesture.track(e)===!1)return null;let{left:n,width:r,scrollLeft:i}=t,o=e.clientX-n+i,s=this.deps.getColumnPositions(),c=this.deps.getColumnCount(),l=Math.max(0,Math.min(a(o,s),c));this.gesture.dropTargetIndex=l;let u=e.clientX-n,d=0;return u<40?d=-10:u>r-40&&(d=10),{targetRow:0,targetCol:l,autoScroll:d===0?null:{dx:d,dy:0}}}end(e){this.gesture.thresholdMet?this.commitMove():this.treatAsHeaderClick(e),this.reset()}commitMove(){let{dropTargetIndex:e}=this.gesture;if(e===null)return;let t=this.sourceColIndex,n=this.deps.getOriginalColumnIndex?this.deps.getOriginalColumnIndex(Math.min(e,this.deps.getColumnCount()-1)):e;t!==n&&this.core.moveColumn(t,n)}treatAsHeaderClick(e){let t=this.core.getColumns()[this.sourceColIndex];if(!t)return;let n=t.colId??t.field,r=this.core.getSortModel().find(e=>e.colId===n)?.direction;this.core.setSort(n,e(r),this.shiftKey)}reset(){this.sourceColIndex=-1,this.shiftKey=!1,this.gesture.reset()}getState(){if(this.gesture.active===!1)return null;let{currentX:e,currentY:t,dropTargetIndex:n}=this.gesture;return{sourceColIndex:this.sourceColIndex,currentX:e,currentY:t,dropTargetIndex:n,ghostWidth:this.ghostWidth,ghostHeight:this.ghostHeight}}},fe=class{gesture=new C;sourceRowIndex=-1;core;deps;constructor(e,t){this.core=e,this.deps=t}updateDeps(e){this.deps=e}get isActive(){return this.gesture.active}get isDraggingForDisplay(){return this.gesture.isDraggingForDisplay}start(e,t,n){this.sourceRowIndex=e,this.gesture.begin(t,n)}move(t,n){if(this.gesture.track(t)===!1)return null;let{top:r,left:i,height:a,width:o,scrollTop:s}=n,c=this.deps.getHeaderHeight(),l=t.clientY-r,u=this.core.getRowCount(),d=Math.max(0,Math.min(this.core.getRowIndexAtDisplayY(l,s),u));return this.gesture.dropTargetIndex=d,{targetRow:d,targetCol:0,autoScroll:e(t.clientY-r,t.clientX-i,a,o,c)}}end(){let{thresholdMet:e,dropTargetIndex:t}=this.gesture;e&&t!==null&&t!==this.sourceRowIndex&&this.core.commitRowDrag(this.sourceRowIndex,t),this.sourceRowIndex=-1,this.gesture.reset()}getState(){if(this.gesture.active===!1)return null;let{currentX:e,currentY:t,dropTargetIndex:n}=this.gesture;return{sourceRowIndex:this.sourceRowIndex,currentX:e,currentY:t,dropTargetIndex:n,dropIndicatorY:n===null?0:this.core.getRowTranslateY(n)}}},pe=class{active=!1;core;constructor(e){this.core=e}get isActive(){return this.active}start(){this.active=!0}moveToTarget(e,t){this.active!==!1&&this.core.selection.startSelection({row:e,col:t},{shift:!0})}end(){this.active=!1}},me=class{active=!1;sourceRange=null;target=null;core;constructor(e){this.core=e}get isActive(){return this.active}get stateSnapshot(){return{sourceRange:this.sourceRange,target:this.target}}start(e,t){if(!e&&!t)return{preventDefault:!1,stopPropagation:!1};let n=t??{startRow:e.row,startCol:e.col,endRow:e.row,endCol:e.col};return this.core.fill.startFillDrag(n),this.sourceRange=n,this.target={row:Math.max(n.startRow,n.endRow),col:Math.max(n.startCol,n.endCol)},this.active=!0,{preventDefault:!0,stopPropagation:!0,startDrag:`fill`}}moveToTarget(e,t){this.active!==!1&&(this.core.fill.updateFillDrag(e,t),this.target={row:e,col:t})}end(){this.active&&(this.core.fill.commitFillDrag(),this.core.refreshSlotData()),this.active=!1,this.sourceRange=null,this.target=null}},he=class{record=null;set(e){this.record=e}clear(){this.record=null}consume(){let e=this.record;return this.record=null,e}},ge=class{record=null;set(e){this.record=e}clear(){this.record=null}consume(){let e=this.record;return this.record=null,e}};const _e=10,ve=300,ye=new Map([[`ArrowUp`,`up`],[`ArrowDown`,`down`],[`ArrowLeft`,`left`],[`ArrowRight`,`right`]]);var be=class{core;constructor(e){this.core=e}handle(e,t,n,r){if(r)return{preventDefault:!1};if(this.core.getPeekState()!==null)return e.key===`Escape`?(this.core.stopPeek(),{preventDefault:!0}):{preventDefault:!1};if(n!==null&&e.key!==`Enter`&&e.key!==`Escape`&&e.key!==`Tab`)return{preventDefault:!1};let i=ye.get(e.key);if(i)return this.moveFocus(i,e.shiftKey);let a=e.ctrlKey||e.metaKey;return this.handleAction(e.key,t,n,e.shiftKey,a)}moveFocus(e,t){this.core.stopPeek();let{selection:n}=this.core;return n.moveFocus(e,t),{preventDefault:!0,scrollToCell:n.getActiveCell()??void 0}}handleAction(e,t,n,r,i){switch(e){case`Enter`:return this.handleEnter(t,n);case`Escape`:return this.handleEscape(n);case`Tab`:return this.handleTab(n,r);default:return this.handleNonSpecialKey(e,t,n,i)}}handleEnter(e,t){return t?this.core.commitEdit():e&&this.core.startEdit(e.row,e.col),{preventDefault:!0}}handleEscape(e){return e?this.core.cancelEdit():this.core.getPeekState()?this.core.stopPeek():this.core.selection.clearSelection(),{preventDefault:!0}}handleTab(e,t){return e&&this.core.commitEdit(),this.core.selection.moveFocus(t?`left`:`right`,!1),{preventDefault:!0}}handleNonSpecialKey(e,t,n,r){let{selection:i}=this.core;return e===`a`&&r?(i.selectAll(),{preventDefault:!0}):e===`c`&&r?(i.copySelectionToClipboard(),{preventDefault:!0}):e===`F2`?(t&&!n&&this.core.startEdit(t.row,t.col),{preventDefault:!0}):e===`Delete`||e===`Backspace`?t&&!n?(this.core.startEdit(t.row,t.col),{preventDefault:!0}):{preventDefault:!1}:(t&&!n&&!r&&e.length===1&&this.core.startEdit(t.row,t.col),{preventDefault:!1})}};const xe=(t,n,r,i)=>{let{top:o,left:s,width:c,height:l,scrollTop:u,scrollLeft:d}=i,f=n.getColumnPositions(),p=n.getColumnCount(),m=r.clientY-o,h=r.clientX-s+d,g=Math.max(0,Math.min(t.getRowIndexAtDisplayY(m,u),t.getRowCount()-1)),_=Math.max(0,Math.min(a(h,f),p-1));return{row:g,col:n.getOriginalColumnIndex?n.getOriginalColumnIndex(_):_,autoScroll:e(r.clientY-o,r.clientX-s,l,c,n.getHeaderHeight())}},Se=e=>e==null?`asc`:e===`asc`?`desc`:null;var Ce=class{core;deps;columnResize;columnMove;rowDrag;selectionDrag;fillDrag;pendingRowDrag=new he;pendingCellTap=new ge;keyboard;constructor(e,n){this.core=e,this.deps=n,this.columnResize=new t(e),this.columnMove=new de(e,n),this.rowDrag=new fe(e,n),this.selectionDrag=new pe(e),this.fillDrag=new me(e),this.keyboard=new be(e)}updateDeps(e){this.deps={...this.deps,...e},this.columnMove.updateDeps(this.deps),this.rowDrag.updateDeps(this.deps)}getDragState(){let e=this.getDragType(),t=this.fillDrag.stateSnapshot;return{isDragging:e!==null,dragType:e,fillSourceRange:t.sourceRange,fillTarget:t.target,columnResize:this.columnResize.getState(),columnMove:this.columnMove.getState(),rowDrag:this.rowDrag.getState()}}getDragType(){return this.fillDrag.isActive?`fill`:this.columnResize.isActive?`column-resize`:this.columnMove.isDraggingForDisplay?`column-move`:this.rowDrag.isDraggingForDisplay?`row-drag`:this.selectionDrag.isActive?`selection`:null}handleHeaderMouseDown(e,t,n,r){return this.columnMove.start(e,t,n,r)}handleHeaderResizeMouseDown(e,t,n){return this.columnResize.start(e,t,n)}handleCellMouseDown(e,t,n){if(n.button!==0||this.core.getEditState()!==null)return we;this.core.stopPeek();let r=(this.core.getColumns()[t]?.rowDrag===!0||this.core.isRowDragEntireRow())&&!n.shiftKey;return r&&n.pointerType===`touch`?this.startPendingRowDrag(e,t,n):r?this.startRowDrag(e,t,n):this.startSelectionClick(e,t,n)}startPendingRowDrag(e,t,n){return this.pendingRowDrag.set({rowIndex:e,colIndex:t,clientX:n.clientX,clientY:n.clientY}),this.pendingCellTap.set({rowIndex:e,colIndex:t}),{preventDefault:!1,stopPropagation:!1,focusContainer:!1,startDrag:`row-drag-pending`,startTap:!0}}startRowDrag(e,t,n){return this.rowDrag.start(e,n.clientX,n.clientY),this.core.selection.startSelection({row:e,col:t},{shift:!1,ctrl:!1}),{preventDefault:!0,stopPropagation:!0,focusContainer:!0,startDrag:`row-drag`}}startSelectionClick(e,t,n){return n.pointerType===`touch`?(this.pendingCellTap.set({rowIndex:e,colIndex:t}),{preventDefault:!1,stopPropagation:!1,focusContainer:!1,startTap:!0}):(this.core.selection.startSelection({row:e,col:t},{shift:n.shiftKey,ctrl:n.ctrlKey||n.metaKey}),{preventDefault:!1,stopPropagation:!1,focusContainer:!0,startDrag:n.shiftKey?void 0:`selection`})}handleCellDoubleClick(e,t){if(this.core.getColumns()[t]?.editable){this.core.startEdit(e,t);return}this.core.startPeek(e,t)}handleCellMouseEnter(e,t){this.core.highlight?.setHoverPosition({row:e,col:t})}handleCellMouseLeave(){this.core.highlight?.setHoverPosition(null)}handleFillHandleMouseDown(e,t,n){return this.fillDrag.start(e,t)}handleHeaderClick(e,t){let n=this.core.getSortModel().find(t=>t.colId===e)?.direction;this.core.setSort(e,Se(n),t)}startSelectionDrag(){this.selectionDrag.start()}confirmPendingRowDrag(){let e=this.pendingRowDrag.consume();return e===null?!1:(this.pendingCellTap.clear(),this.rowDrag.start(e.rowIndex,e.clientX,e.clientY),this.core.selection.startSelection({row:e.rowIndex,col:e.colIndex},{shift:!1,ctrl:!1}),!0)}cancelPendingRowDrag(){this.pendingRowDrag.clear()}confirmPendingCellTap(){let e=this.pendingCellTap.consume();return e===null?!1:(this.core.selection.startSelection({row:e.rowIndex,col:e.colIndex},{shift:!1,ctrl:!1}),!0)}cancelPendingCellTap(){this.pendingCellTap.clear()}handleDragMove(e,t){return this.columnResize.isActive?this.columnResize.move(e,t):this.columnMove.isActive?this.columnMove.move(e,t):this.rowDrag.isActive?this.rowDrag.move(e,t):this.selectionFillMove(e,t)}selectionFillMove(e,t){if((this.selectionDrag.isActive||this.fillDrag.isActive)===!1)return null;let n=xe(this.core,this.deps,e,t);return this.selectionDrag.moveToTarget(n.row,n.col),this.fillDrag.moveToTarget(n.row,n.col),{targetRow:n.row,targetCol:n.col,autoScroll:n.autoScroll}}handleDragEnd(){if(this.columnResize.isActive)return this.columnResize.end();if(this.columnMove.isActive)return this.columnMove.end(Se);if(this.rowDrag.isActive)return this.rowDrag.end();this.selectionDrag.end(),this.fillDrag.end()}handleWheel(e,t,n){return this.core.isScalingActive()?{dy:e*n,dx:t*n}:null}handleKeyDown(e,t,n,r){return this.keyboard.handle(e,t,n,r)}};const we={preventDefault:!1,stopPropagation:!1};var Te=class{options;highlightingOptions;hoverPosition=null;emitter=v();onInstruction=this.emitter.onInstruction;emit=this.emitter.emit;rowClassCache=new Map;columnClassCache=new Map;cellClassCache=new Map;constructor(e,t={}){this.options=e,this.highlightingOptions=t}isEnabled(){return!!(this.highlightingOptions.computeRowClasses||this.highlightingOptions.computeColumnClasses||this.highlightingOptions.computeCellClasses)}updateOptions(e){this.highlightingOptions=e,this.clearAllCaches()}setHoverPosition(e){this.isEnabled()&&(this.hoverPosition?.row!==e?.row||this.hoverPosition?.col!==e?.col)&&(this.rowClassCache.clear(),this.columnClassCache.clear(),this.cellClassCache.clear(),this.hoverPosition=e,this.emit({type:`SET_HOVER_POSITION`,position:e}))}getHoverPosition(){return this.hoverPosition}onSelectionChange(){this.clearAllCaches()}buildRowContext(e,t){let n=this.options.getActiveCell(),r=this.options.getSelectionRange();return{rowIndex:e,colIndex:null,column:void 0,rowData:t,hoverPosition:this.hoverPosition,activeCell:n,selectionRange:r,isHovered:this.hoverPosition?.row===e,isActive:n?.row===e,isSelected:m(e,r)}}buildColumnContext(e,t){let n=this.options.getActiveCell(),r=this.options.getSelectionRange();return{rowIndex:null,colIndex:e,column:t,rowData:void 0,hoverPosition:this.hoverPosition,activeCell:n,selectionRange:r,isHovered:this.hoverPosition?.col===e,isActive:n?.col===e,isSelected:h(e,r)}}buildCellContext(e,t,n,r){let i=this.options.getActiveCell(),a=this.options.getSelectionRange(),s=this.hoverPosition?.row===e&&this.hoverPosition?.col===t,c=!1;if(a){let{minRow:n,maxRow:r,minCol:i,maxCol:s}=o(a);c=e>=n&&e<=r&&t>=i&&t<=s}return{rowIndex:e,colIndex:t,column:n,rowData:r,hoverPosition:this.hoverPosition,activeCell:i,selectionRange:a,isHovered:s,isActive:i?.row===e&&i?.col===t,isSelected:c}}computeRowClasses(e,t){let n=this.highlightingOptions.computeRowClasses;if(!n)return[];let r=this.rowClassCache.get(e);if(r!==void 0)return r;let i=n(this.buildRowContext(e,t));return this.rowClassCache.set(e,i),i}computeColumnClasses(e,t){let n=this.columnClassCache.get(e);if(n!==void 0)return n;let r=this.buildColumnContext(e,t),i;if(t.computeColumnClasses)i=t.computeColumnClasses(r);else if(this.highlightingOptions.computeColumnClasses)i=this.highlightingOptions.computeColumnClasses(r);else return[];return this.columnClassCache.set(e,i),i}computeCellClasses(e,t,n,r){let i=`${e},${t}`,a=this.cellClassCache.get(i);if(a!==void 0)return a;let o=this.buildCellContext(e,t,n,r),s;if(n.computeCellClasses)s=n.computeCellClasses(o);else if(this.highlightingOptions.computeCellClasses)s=this.highlightingOptions.computeCellClasses(o);else return[];return this.cellClassCache.set(i,s),s}computeCombinedCellClasses(e,t,n,r){let i=this.computeColumnClasses(t,n),a=this.computeCellClasses(e,t,n,r);return[...i,...a]}clearAllCaches(){this.rowClassCache.clear(),this.columnClassCache.clear(),this.cellClassCache.clear()}destroy(){this.emitter.clearListeners(),this.clearAllCaches(),this.hoverPosition=null}};const Ee={aggressive:{prefetchPages:0,maxPages:1},balanced:{prefetchPages:1,maxPages:5},conservative:{prefetchPages:2,maxPages:10}},De=(e,t)=>e===void 0?t:Number.isFinite(e)&&e>0?Math.floor(e):t,Oe=(e,t)=>e===void 0?t:Number.isFinite(e)&&e>=0?Math.floor(e):t,w=e=>{let t=Ee[e?.eviction??`balanced`];return{pageSize:De(e?.pageSize,100),prefetchPages:Oe(e?.prefetchPages,t.prefetchPages),maxPages:De(e?.maxPages,t.maxPages)}};var ke=class{options;cacheOptions;generation=0;hasKnownTotal=!1;loadedBlocks=new Set;pendingBlocks=new Map;constructor(e,t){this.options=e,this.cacheOptions=w(t)}configure(e){this.cacheOptions=w(e)}getPageSize(){return this.cacheOptions.pageSize}reset(){this.generation+=1,this.hasKnownTotal=!1,this.loadedBlocks.clear(),this.pendingBlocks.clear(),this.options.getCachedRows().clear()}hasMissingRows(e){if(e.endRow<=e.startRow)return!1;let t=this.options.getTotalRows();if(this.hasKnownTotal&&t===0||this.hasKnownTotal&&e.startRow>=t)return!1;let n=this.hasKnownTotal?Math.min(e.endRow,t):e.endRow,r=this.options.getCachedRows();for(let t=e.startRow;t<n;t+=1)if(!r.has(t))return!0;return!1}async loadRange(e,t=!1){t&&this.reset();let n=this.generation,r=this.options.getTotalRows(),i=this.getBlocksForRange(e).map(e=>this.getOrCreateBlockRequest(e,n)).filter(e=>e!==null);return i.length>0&&await Promise.all(i),n===this.generation?(this.evictAround(e),{applied:!0,loadedBlockCount:i.length,totalRowsChanged:r!==this.options.getTotalRows()}):{applied:!1,loadedBlockCount:0,totalRowsChanged:!1}}getOrCreateBlockRequest(e,t){if(this.loadedBlocks.has(e))return null;let n=this.pendingBlocks.get(e);if(n)return n;let r=this.fetchBlock(e,t);return this.pendingBlocks.set(e,r),r.then(()=>this.deletePendingBlock(e,r),()=>this.deletePendingBlock(e,r)),r}deletePendingBlock(e,t){this.pendingBlocks.get(e)===t&&this.pendingBlocks.delete(e)}async fetchBlock(e,t){let n=e*this.cacheOptions.pageSize,r=this.getBlockEndRow(e),i;try{i=await this.options.getDataSource().query(S({range:{startRow:n,endRow:r},sortModel:this.options.getSortModel(),filterModel:this.options.getFilterModel(),columns:this.options.getColumns()}))}catch(e){if(t===this.generation)throw e;return}t===this.generation&&this.applyBlockResponse(e,i.rows,i.totalRows)}applyBlockResponse(e,t,n){let r=this.options.getCachedRows(),i=this.options.getTotalRows();this.deleteRowsForBlock(e);let a=e*this.cacheOptions.pageSize;t.forEach((e,t)=>{e!==void 0&&r.set(a+t,e)}),this.options.setTotalRows(n),this.hasKnownTotal=!0,this.loadedBlocks.add(e),n<i&&this.deleteRowsAfterTotal(n)}getBlocksForRange(e){if(e.endRow<=e.startRow)return[];let t=this.options.getTotalRows();if(this.hasKnownTotal&&t===0||this.hasKnownTotal&&e.startRow>=t)return[];let n=this.hasKnownTotal?Math.min(e.endRow,t):e.endRow,r=this.cacheOptions.pageSize,i=Math.floor(e.startRow/r),a=Math.floor((n-1)/r),o=Math.max(0,i-this.cacheOptions.prefetchPages),s=this.getLastPrefetchBlock(a),c=[];for(let e=o;e<=s;e+=1)c.push(e);return c}getLastPrefetchBlock(e){let t=this.options.getTotalRows(),n=e+this.cacheOptions.prefetchPages;if(this.hasKnownTotal&&t>0){let e=Math.floor((t-1)/this.cacheOptions.pageSize);return Math.min(n,e)}return n}getBlockEndRow(e){let t=e*this.cacheOptions.pageSize+this.cacheOptions.pageSize,n=this.options.getTotalRows();return this.hasKnownTotal&&n>0?Math.min(t,n):t}evictAround(e){if(this.loadedBlocks.size<=this.cacheOptions.maxPages)return;let t=new Set(this.getBlocksForRange(e)),n=Math.floor(e.startRow/this.cacheOptions.pageSize),r=[...this.loadedBlocks].filter(e=>t.has(e)===!1).sort((e,t)=>Math.abs(t-n)-Math.abs(e-n));for(let e of r){if(this.loadedBlocks.size<=this.cacheOptions.maxPages)return;this.loadedBlocks.delete(e),this.deleteRowsForBlock(e)}}deleteRowsForBlock(e){let t=this.options.getCachedRows(),n=e*this.cacheOptions.pageSize,r=n+this.cacheOptions.pageSize;for(let e=n;e<r;e+=1)t.delete(e)}deleteRowsAfterTotal(e){let t=this.options.getCachedRows();for(let n of t.keys())n>=e&&t.delete(n)}};const Ae=(e,t,n,r)=>{if(n<=0)return t;let i=0;for(let t=0;t<r.length;t++){if(t===e)continue;let n=r[t];!n||n.hidden||(i+=n.width)}return i<=0||t+i>=n?t:t*i/(n-t)},je=(e,t,n,r)=>{let i=r.columns[e];return i===void 0?!1:(i.width=i.hidden?t:Ae(e,t,n,r.columns),r.computeColumnPositions(),r.view.syncColumnLayout(`geometry`),!0)},Me=(e,t,n)=>{if(e===t||e<0||e>=n.columns.length)return null;let r=t>e?t-1:t;if(r<0||r>=n.columns.length||e===r)return null;let[i]=n.columns.splice(e,1);return n.columns.splice(r,0,i),n.computeColumnPositions(),n.view.syncColumnLayout(`order`),r},Ne=(e,t,n)=>{let r=n.dataSource;if(!r.moveRow)return;r.moveRow(e,t),se(n.cachedRows,e,t),n.highlight?.clearAllCaches();let i=Math.min(e,t),a=Math.max(e,t);for(let e=i;e<=a;e++)n.slotPool.updateSlot(e)},Pe=async e=>{let t=await e.dataSource.query(S({range:{startRow:0,endRow:2**53-1},sortModel:e.sortModel,filterModel:e.filterModel,columns:e.getColumns()}));e.cachedRows.clear();for(let n=0;n<t.rows.length;n++){let r=t.rows[n];r!==void 0&&e.cachedRows.set(n,r)}return e.setTotalRows(t.totalRows),{totalRows:t.totalRows}};var Fe=class{dataSource;options;rowLoading;rowWindowLoader;cachedRows=new Map;totalRows=0;isDataLoading=!1;constructor(e){this.options=e,this.dataSource=e.dataSource,this.rowLoading=e.rowLoading??{},this.rowWindowLoader=new ke({getDataSource:()=>this.dataSource,getCachedRows:()=>this.cachedRows,getTotalRows:()=>this.totalRows,setTotalRows:e=>{this.totalRows=e},getSortModel:e.getSortModel,getFilterModel:e.getFilterModel,getColumns:e.getColumns},this.rowLoading.cache)}getCachedRows(){return this.cachedRows}setCachedRows(e){this.cachedRows=e}getTotalRows(){return this.totalRows}setTotalRows(e){this.totalRows=e}getDataSource(){return this.dataSource}getRowData(e){return this.cachedRows.get(e)}isLoading(){return this.isDataLoading}getCellValue(e,t){return le(this.cachedRows,this.options.getColumns(),e,t)}setCellValue(e,t,n){ue(this.cachedRows,this.options.getColumns(),e,t,n,{onCellValueChanged:this.options.onCellValueChanged,getRowId:this.options.getRowId})}async loadInitial(){if(this.isPaginatedLoading()){await this.fetchPaginatedData({range:this.getInitialPaginatedRange(),resetCache:!0,showLoading:!0,notifyRowsLoaded:!1});return}await this.fetchAllData()}requestVisibleRows(){if(this.isPaginatedLoading()===!1)return;let e=this.getPaginatedLoadRange(!0);if(e.endRow<=e.startRow)return;let t=this.getPaginatedLoadRange(!1),n=this.rowWindowLoader.hasMissingRows(t);this.fetchPaginatedData({range:e,resetCache:!1,showLoading:n,notifyRowsLoaded:!0})}async refreshFromTransaction(){if(this.isPaginatedLoading()){await this.fetchPaginatedData({range:this.getPaginatedLoadRange(!0),resetCache:!0,showLoading:!1,notifyRowsLoaded:!1});return}await Pe({dataSource:this.dataSource,sortModel:this.options.getSortModel(),filterModel:this.options.getFilterModel(),cachedRows:this.cachedRows,setTotalRows:e=>{this.totalRows=e},getColumns:this.options.getColumns})}setDataSource(e){this.dataSource=e,this.rowWindowLoader.reset(),this.totalRows=0}destroy(){this.rowWindowLoader.reset(),this.cachedRows.clear(),this.totalRows=0,this.isDataLoading=!1}async fetchAllData(){this.isDataLoading=!0,this.options.batcher.emit({type:`DATA_LOADING`});try{let e=S({range:{startRow:0,endRow:2**53-1},sortModel:this.options.getSortModel(),filterModel:this.options.getFilterModel(),columns:this.options.getColumns()}),t=await this.dataSource.query(e);this.cachedRows.clear(),t.rows.forEach((e,t)=>{this.cachedRows.set(t,e)}),this.totalRows=t.totalRows,this.options.batcher.emit({type:`DATA_LOADED`,totalRows:this.totalRows})}catch(e){this.emitDataError(e)}finally{this.isDataLoading=!1}}async fetchPaginatedData(e){e.showLoading&&(this.isDataLoading=!0,this.options.batcher.emit({type:`DATA_LOADING`}));try{let t=await this.rowWindowLoader.loadRange(e.range,e.resetCache);if(t.applied===!1)return;(e.showLoading||t.totalRowsChanged)&&this.options.batcher.emit({type:`DATA_LOADED`,totalRows:this.totalRows}),e.notifyRowsLoaded&&this.options.onRowsLoaded(t.totalRowsChanged)}catch(e){this.emitDataError(e)}finally{e.showLoading&&(this.isDataLoading=!1)}}emitDataError(e){this.options.batcher.emit({type:`DATA_ERROR`,error:e instanceof Error?e.message:String(e)})}isPaginatedLoading(){let e=this.rowLoading.mode??`auto`;return e===`paginated`||e!==`all`&&this.dataSource.loadMode===`paginated`}getInitialPaginatedRange(){let e=this.getPaginatedLoadRange(!0);return{startRow:0,endRow:Math.max(this.rowWindowLoader.getPageSize(),e.endRow)}}getPaginatedLoadRange(e){let t=this.options.getRowHeight(),n=this.options.getViewportHeight(),r=this.options.getScrollTop(),i=e?this.options.getOverscan():0,a=Math.max(0,Math.floor(r/t)-i),o=Math.ceil((r+n)/t)+i+1,s=this.totalRows>0?Math.min(this.totalRows,o):o;return{startRow:a,endRow:Math.max(a,s)}}};const T=1e7;var Ie=class{naturalContentHeight=0;virtualContentHeight=0;scrollRatio=1;options;constructor(e){this.options=e}updateContentSize(){let e=this.options.getTotalRows(),t=this.options.getRowHeight(),n=this.options.getHeaderHeight(),r=this.options.getViewportHeight(),i=e*t;if(this.naturalContentHeight=i+n,this.naturalContentHeight>T){this.virtualContentHeight=T;let e=this.virtualContentHeight-n-r,a=Math.ceil((i-r)/t)*t;this.scrollRatio=a>0?e/a:1}else this.virtualContentHeight=this.naturalContentHeight,this.scrollRatio=1;return{naturalHeight:this.naturalContentHeight,virtualHeight:this.virtualContentHeight,scrollRatio:this.scrollRatio}}isScalingActive(){return this.scrollRatio<1}getNaturalHeight(){let e=this.options.getTotalRows(),t=this.options.getRowHeight(),n=this.options.getHeaderHeight();return this.naturalContentHeight||e*t+n}getVirtualHeight(){let e=this.options.getTotalRows(),t=this.options.getRowHeight(),n=this.options.getHeaderHeight();return this.virtualContentHeight||e*t+n}getScrollRatio(){return this.scrollRatio}getVisibleRowRange(){let e=this.options.getViewportHeight(),t=this.options.getScrollTop(),n=this.options.getRowHeight(),r=this.options.getTotalRows(),i=e,a=Math.max(0,Math.floor(t/n)),o=Math.min(r-1,Math.ceil((t+i)/n)-1);return{start:a,end:Math.max(a,o)}}getScrollTopForRow(e){return e*this.options.getRowHeight()*this.scrollRatio}getRowIndexAtDisplayY(e,t){let n=this.options.getRowHeight(),r=e+(this.scrollRatio<1?t/this.scrollRatio:t);return Math.floor(r/n)}getVirtualContentHeight(){return this.virtualContentHeight}};const E=e=>e.map(e=>({item:e,key:D(e)})).sort((e,t)=>e.key===t.key?0:e.key<t.key?-1:1).map(e=>e.item),D=e=>e==null?`x:null`:typeof e==`string`?`s:${e}`:typeof e==`number`?`n:${String(e)}`:typeof e==`boolean`?`b:${String(e)}`:e instanceof Date?`d:${String(e.getTime())}`:Array.isArray(e)?`a:${JSON.stringify(E(e))}`:`o:${JSON.stringify(e)}`,O=e=>e==null||e===``||Array.isArray(e)&&e.length===0,Le=(e,t)=>{let n=Number.parseFloat(e),r=Number.parseFloat(t);return Number.isNaN(n)===!1&&Number.isNaN(r)===!1?n-r:e.localeCompare(t,void 0,{numeric:!0,sensitivity:`base`})},Re=(e,t)=>{let n=new Map;for(let r of e){if(O(r))continue;let e=Array.isArray(r)?E(r):r,i=D(e),a=x(e,t),o=n.get(a);o===void 0&&(o={entry:{label:a,values:[]},seen:new Set},n.set(a,o)),!o.seen.has(i)&&(o.seen.add(i),o.entry.values.push(e))}let r=Array.from(n.values(),e=>e.entry);return r.sort((e,t)=>Le(e.label,t.label)),r},ze=(e,t)=>{let n=new Set;for(let e of t)n.add(D(e));let r=new Set;for(let t of e)t.values.some(e=>n.has(D(e)))&&r.add(t.label);return r},Be=(e,t)=>{let n=new Set;for(let r of e)if(t.has(r.label)!==!1)for(let e of r.values)n.add(e);return n};var Ve=class{options;emitter=v();sortModel=[];filterModel={};openFilterColIndex=null;scanWarnedCols=new Set;truncationWarnedCols=new Set;typeMismatchWarnedCols=new Set;onInstruction=this.emitter.onInstruction;emit=this.emitter.emit;constructor(e){this.options=e}async setSort(e,t,n=!1){if(!this.options.isSortingEnabled()||this.options.getColumns().find(t=>(t.colId??t.field)===e)?.sortable===!1)return;let r=this.sortModel.findIndex(t=>t.colId===e);n?t===null&&r>=0?this.sortModel.splice(r,1):r>=0?this.sortModel[r].direction=t:this.sortModel.push({colId:e,direction:t}):this.sortModel=t===null?[]:[{colId:e,direction:t}],await this.options.onSortFilterChange(),this.options.onDataRefreshed()}getSortModel(){return[...this.sortModel]}async setFilter(e,t){let n=this.options.getColumns().find(t=>(t.colId??t.field)===e);n?.filterable!==!1&&(t===null||typeof t==`string`&&t.trim()===``||typeof t==`object`&&t.conditions?.length===0?delete this.filterModel[e]:typeof t==`string`?this.filterModel[e]={conditions:[{type:`text`,operator:`contains`,value:t}],combination:`and`}:(this.warnTypeMismatchedSelectedValues(e,n,t),this.filterModel[e]=t),await this.options.onSortFilterChange(),this.options.onDataRefreshed())}warnTypeMismatchedSelectedValues(e,t,n){let r=t?.cellDataType;(r===`number`||r===`boolean`||r===`date`||r===`dateTime`)&&(this.typeMismatchWarnedCols.has(e)||n.conditions.some(e=>e.type===`text`&&e.selectedValues!==void 0&&e.selectedValues.size>0&&[...e.selectedValues].every(e=>typeof e==`string`))!==!1&&(this.typeMismatchWarnedCols.add(e),console.warn(`[gp-grid] Filter on column "${e}" (cellDataType "${r}") has selectedValues containing only strings. Values-mode filters match raw values by strict identity, so this selection will likely match nothing. If this model was restored from JSON or URL params, revive the values to their raw types (e.g. Number(v), new Date(v)) before applying it.`)))}getFilterModel(){return{...this.filterModel}}hasActiveFilter(e){let t=this.filterModel[e];return t?t.conditions.length>0:!1}isColumnSortable(e){return this.options.isSortingEnabled()?this.options.getColumns()[e]?.sortable!==!1:!1}isColumnFilterable(e){return this.options.getColumns()[e]?.filterable!==!1}getDistinctValuesForColumn(e,t=500){let n=this.options.getColumns().find(t=>(t.colId??t.field)===e);if(!n)return[];let r=n.valueFormatter,i=n.distinctValues??this.scanDistinctValues(n,t),a=new Map;for(let n of i){if(a.size>=t){this.warnTruncatedFormattedDomain(e,r);break}let[i,o]=this.normalizeDistinctValue(n);a.has(i)||a.set(i,o)}let o=Array.from(a.values());return o.sort((e,t)=>{let n=x(e,r),i=x(t,r);return n.localeCompare(i,void 0,{numeric:!0,sensitivity:`base`})}),o}scanDistinctValues(e,t){let n=this.options.getCachedRows(),r=n.size,i=e.colId??e.field;r>1e4&&!this.scanWarnedCols.has(i)&&(this.scanWarnedCols.add(i),console.warn(`[gp-grid] Scanning ${r} rows to compute distinct values for column "${i}". Pre-supply ColumnDefinition.distinctValues to skip this scan.`));let a=new Map;for(let o=0;o<r;o++){let r=n.get(o);if(r===void 0)continue;if(a.size>=t){this.warnTruncatedFormattedDomain(i,e.valueFormatter);break}let s=g(r,e.field),[c,l]=this.normalizeDistinctValue(s);a.has(c)||a.set(c,l)}return Array.from(a.values())}normalizeDistinctValue(e){if(Array.isArray(e)){let t=[...e].sort((e,t)=>{let n=String(e),r=String(t);return n===r?0:n<r?-1:1});return[D(t),t]}return[D(e),e]}warnTruncatedFormattedDomain(e,t){t!==void 0&&(this.truncationWarnedCols.has(e)||(this.truncationWarnedCols.add(e),console.warn(`[gp-grid] Distinct values for column "${e}" were truncated at the cap, and the column has a valueFormatter. Values-mode filters match raw values, so selecting a label may miss rows whose raw values were not scanned. Pre-supply ColumnDefinition.distinctValues with the full raw domain.`)))}openFilterPopup(e,t,n=!0){if(this.openFilterColIndex===e){this.closeFilterPopup();return}let r=this.options.getColumns()[e];if(!r||!this.isColumnFilterable(e))return;let i=r.colId??r.field,a=[];n&&(a=this.getDistinctValuesForColumn(i)),this.openFilterColIndex=e,this.emit({type:`OPEN_FILTER_POPUP`,colIndex:e,column:r,anchorRect:t,distinctValues:a,currentFilter:this.filterModel[i]})}closeFilterPopup(){this.openFilterColIndex=null,this.emit({type:`CLOSE_FILTER_POPUP`})}getSortInfoMap(){let e=new Map;return this.sortModel.forEach((t,n)=>{e.set(t.colId,{direction:t.direction,index:n+1})}),e}destroy(){this.emitter.clearListeners(),this.sortModel=[],this.filterModel={},this.openFilterColIndex=null}},He=class{queue=[];debounceTimer=null;pendingPromise=null;options;constructor(e){this.options=e}add(e){e.length!==0&&(this.queue.push({type:`ADD`,rows:e}),this.scheduleProcessing())}remove(e){e.length!==0&&(this.queue.push({type:`REMOVE`,rowIds:e}),this.scheduleProcessing())}updateCell(e,t,n){this.queue.push({type:`UPDATE_CELL`,rowId:e,field:t,value:n}),this.scheduleProcessing()}updateRow(e,t){Object.keys(t).length!==0&&(this.queue.push({type:`UPDATE_ROW`,rowId:e,data:t}),this.scheduleProcessing())}flush(){return this.queue.length===0?Promise.resolve():(this.debounceTimer!==null&&(clearTimeout(this.debounceTimer),this.debounceTimer=null),this.pendingPromise?new Promise((e,t)=>{let n=this.pendingPromise,r=n.resolve,i=n.reject;n.resolve=()=>{r(),e()},n.reject=e=>{i(e),t(e)}}):new Promise((e,t)=>{this.pendingPromise={resolve:e,reject:t},this.processQueue()}))}hasPending(){return this.queue.length>0}getPendingCount(){return this.queue.length}clear(){this.queue=[],this.debounceTimer!==null&&(clearTimeout(this.debounceTimer),this.debounceTimer=null),this.pendingPromise&&=(this.pendingPromise.resolve(),null)}scheduleProcessing(){if(this.options.debounceMs===0){this.processQueue();return}this.debounceTimer===null&&(this.debounceTimer=setTimeout(()=>{this.debounceTimer=null,this.processQueue()},this.options.debounceMs))}processQueue(){if(this.queue.length===0){this.pendingPromise&&=(this.pendingPromise.resolve(),null);return}let e=this.queue;this.queue=[];let t={added:0,removed:0,updated:0};try{for(let n of e)switch(n.type){case`ADD`:this.options.store.addRows(n.rows),t.added+=n.rows.length;break;case`REMOVE`:t.removed+=this.options.store.removeRows(n.rowIds);break;case`UPDATE_CELL`:this.options.store.updateCell(n.rowId,n.field,n.value),t.updated++;break;case`UPDATE_ROW`:this.options.store.updateRow(n.rowId,n.data),t.updated++;break}this.options.onProcessed&&this.options.onProcessed(t),this.pendingPromise&&=(this.pendingPromise.resolve(),null)}catch(e){this.pendingPromise&&=(this.pendingPromise.reject(e instanceof Error?e:Error(String(e))),null)}}},Ue=class{listeners=[];buffer=null;depth=0;subscribe(e){return this.listeners.push(e),()=>{this.listeners=this.listeners.filter(t=>t!==e)}}start(){this.depth===0&&(this.buffer=[]),this.depth+=1}flush(){if(this.depth===0||(--this.depth,this.depth>0))return;let e=this.buffer;if(this.buffer=null,e!==null&&e.length>0)for(let t of this.listeners)t(e)}emit(e){if(this.buffer!==null){this.buffer.push(e);return}this.notify([e])}emitBatch(e){if(e.length!==0){if(this.buffer!==null){this.buffer.push(...e);return}this.notify(e)}}clearListeners(){this.listeners=[]}notify(e){for(let t of this.listeners)t(e)}},We=class{scrollTop=0;scrollLeft=0;viewportWidth=800;viewportHeight=600;getScrollRatio;constructor(e){this.getScrollRatio=e}getScrollTop(){return this.scrollTop}getScrollLeft(){return this.scrollLeft}getViewportWidth(){return this.viewportWidth}getViewportHeight(){return this.viewportHeight}resetScrollTop(){this.scrollTop=0}update(e,t,n,r){let i=this.getScrollRatio(),a=i<1?e/i:e,o=this.viewportWidth!==n||this.viewportHeight!==r,s=this.scrollTop!==a||this.scrollLeft!==t||o;return s&&(this.scrollTop=a,this.scrollLeft=t,this.viewportWidth=n,this.viewportHeight=r),{changed:s,viewportSizeChanged:o}}};const Ge=e=>{if(e.onCellValueChanged&&e.getRowId===void 0)throw Error(`getRowId is required when onCellValueChanged is provided`);return{dataSource:e.dataSource,rowHeight:e.rowHeight,rowLoading:e.rowLoading,getRowId:e.getRowId,highlighting:e.highlighting,onCellValueChanged:e.onCellValueChanged,onRowDragEnd:e.onRowDragEnd,onColumnResized:e.onColumnResized,onColumnMoved:e.onColumnMoved,headerHeight:e.headerHeight??e.rowHeight,overscan:e.overscan??3,maxFlingVelocity:e.maxFlingVelocity??2e4*e.rowHeight/1e3,sortingEnabled:e.sortingEnabled??!0,rowDragEntireRow:e.rowDragEntireRow??!1}},k=e=>e.replaceAll(`\r
|
|
1
|
+
const e=(e,t,n,r,i)=>{let a=0,o=0;return e<40+i?o=-10:e>n-40&&(o=10),t<40?a=-10:t>r-40&&(a=10),a!==0||o!==0?{dx:a,dy:o}:null};var t=class{active=!1;colIndex=-1;startX=0;initialWidth=0;currentWidth=0;core;constructor(e){this.core=e}get isActive(){return this.active}start(e,t,n){return n.button!==0||this.core.getColumns()[e]?.resizable===!1?{preventDefault:!1,stopPropagation:!1}:(this.active=!0,this.colIndex=e,this.startX=n.clientX,this.initialWidth=t,this.currentWidth=t,{preventDefault:!0,stopPropagation:!0,startDrag:`column-resize`})}move(e,t){let n=this.core.getColumns()[this.colIndex],r=n?.minWidth??50,i=n?.maxWidth,a=this.initialWidth+(e.clientX-this.startX);a=Math.max(r,a),i!==void 0&&(a=Math.min(i,a)),this.currentWidth=a;let o=e.clientX-t.left>t.width-40?10:0,s=o===0?null:{dx:o,dy:0};return{targetRow:0,targetCol:this.colIndex,autoScroll:s}}end(){this.active&&this.core.setColumnWidth(this.colIndex,this.currentWidth),this.active=!1,this.colIndex=-1}getState(){return this.active===!1?null:{colIndex:this.colIndex,initialWidth:this.initialWidth,currentWidth:this.currentWidth}}};const n=e=>{let t=[0],n=0;for(let r of e)n+=r.width,t.push(n);return t},r=e=>e.at(-1)??0,i=(e,t)=>{let i=n(e),a=r(i);if(t<=a||a===0)return{positions:i,widths:e.map(e=>e.width)};let o=t/a,s=e.map(e=>e.width*o),c=[0],l=0;for(let e of s)l+=e,c.push(l);return{positions:c,widths:s}},a=(e,t)=>{for(let n=0;n<t.length-1;n++)if(e>=t[n]&&e<t[n+1])return n;return e>=t.at(-1)?t.length-2:0},o=e=>({minRow:Math.min(e.startRow,e.endRow),maxRow:Math.max(e.startRow,e.endRow),minCol:Math.min(e.startCol,e.endCol),maxCol:Math.max(e.startCol,e.endCol)}),s=(e,t,n)=>e>=n.minRow&&e<=n.maxRow&&t>=n.minCol&&t<=n.maxCol,c=(e,t,n)=>{if(!n)return!1;let r=o(n);return s(e,t,r)},l=(e,t,n)=>n?.row===e&&n?.col===t,u=(e,t)=>!t||t.end<0||t.start>t.end||e>=t.start&&e<=t.end,d=(e,t,n)=>n?.row===e&&n?.col===t,f=(e,t,n,r,i)=>{if(!n||!r||!i)return!1;let{minRow:a,maxRow:s,minCol:c,maxCol:l}=o(r),u=i.row>s,d=i.row<a;return u?e>s&&e<=i.row&&t>=c&&t<=l:d?e<a&&e>=i.row&&t>=c&&t<=l:!1},p=(e,t,n,r)=>{let i=[`gp-grid-cell`];return e&&i.push(`gp-grid-cell--active`),t&&!e&&i.push(`gp-grid-cell--selected`),n&&i.push(`gp-grid-cell--editing`),r&&i.push(`gp-grid-cell--fill-preview`),i.join(` `)},m=(e,t)=>{if(!t)return!1;let{minRow:n,maxRow:r}=o(t);return e>=n&&e<=r},h=(e,t)=>{if(!t)return!1;let{minCol:n,maxCol:r}=o(t);return e>=n&&e<=r};function g(e,t){let n=t.split(`.`),r=e;for(let e of n){if(typeof r!=`object`||!r)return null;r=r[e]}return r}function _(e,t,n){let r=t.split(`.`),i=e;for(let e=0;e<r.length-1;e++){let t=r[e];if(typeof i!=`object`||!i)return;i=i[t]}typeof i==`object`&&i&&(i[r.at(-1)]=n)}const v=()=>{let e=[];return{onInstruction:t=>(e.push(t),()=>{e=e.filter(e=>e!==t)}),emit:t=>{for(let n of e)n(t)},clearListeners:()=>{e=[]}}},y=()=>{let e=v(),t=[];return{onInstruction:e.onInstruction,onBatchInstruction:e=>(t.push(e),()=>{t=t.filter(t=>t!==e)}),emit:n=>{e.emit(n);for(let e of t)e([n])},emitBatch:n=>{if(n.length!==0){for(let e of t)e(n);for(let t of n)e.emit(t)}},clearListeners:()=>{e.clearListeners(),t=[]}}},b=(e,t)=>{for(let n of e.values())if(n.rowIndex===t)return n;return null},ee=(e,t,n,r,i,a)=>{let o=b(i,n);if(!o){t.scrollTop=e.getScrollTopForRow(n);return}let s=a+o.translateY-t.scrollTop,c=s+r;if(s<0)t.scrollTop=e.getScrollTopForRow(n);else if(c>t.clientHeight){let i=Math.floor(t.clientHeight/r),a=Math.max(0,n-i+1);t.scrollTop=e.getScrollTopForRow(a)}},te=(e,t)=>{let n=t.visibleColumns.findIndex(e=>e.originalIndex===t.colIndex),r=t.columnPositions[n],i=t.columnWidths[n];if(n<0||r===void 0||i===void 0)return;if(r<e.scrollLeft){e.scrollLeft=r;return}let a=r+i;a>e.scrollLeft+e.clientWidth&&(e.scrollLeft=a-e.clientWidth)},ne=(e,t,n,r,i,a=0,o)=>{ee(e,t,n,r,i,a),o!==void 0&&te(t,o)},x=(e,t)=>e==null?``:t?t(e):Array.isArray(e)?e.join(`, `):typeof e==`object`?e instanceof Date?String(e):JSON.stringify(e):String(e),re=e=>{let{activeCell:t,selectionRange:n,slots:r,columns:i,visibleColumnsWithIndices:a,columnPositions:o,columnWidths:s,rowHeight:c}=e;if(!t&&!n)return null;let l,u,d,f;if(n)l=Math.max(n.startRow,n.endRow),u=Math.max(n.startCol,n.endCol),d=Math.min(n.startCol,n.endCol),f=Math.max(n.startCol,n.endCol);else if(t)l=t.row,u=t.col,d=u,f=u;else return null;for(let e=d;e<=f;e++){let t=i[e];if(!(!t||t.hidden)&&t.editable!==!0)return null}let p=a.findIndex(e=>e.originalIndex===u);if(p===-1)return null;let m=null;for(let e of r.values())if(e.rowIndex===l){m=e.translateY;break}if(m===null)return null;let h=o[p]??0,g=s[p]??0;return{top:m+c-5,left:h+g-20}},ie=(e,t,n=8)=>{let r=e.getBoundingClientRect(),i=t.getBoundingClientRect(),a=r.bottom+4,o=r.left,s=Math.max(200,r.width);return o+i.width>window.innerWidth-n&&(o=window.innerWidth-i.width-n),o=Math.max(n,o),a+i.height>window.innerHeight-n&&(a=r.top-i.height-4),a=Math.max(n,a),{top:a,left:o,minWidth:s}},ae=e=>{if(typeof document>`u`)return()=>{};let t=t=>{if(t.key!==`a`&&t.key!==`A`||!(t.ctrlKey||t.metaKey))return;t.preventDefault();let n=globalThis.getSelection();if(!n)return;n.removeAllRanges();let r=document.createRange();r.selectNodeContents(e),n.addRange(r)};return document.addEventListener(`keydown`,t),()=>document.removeEventListener(`keydown`,t)},oe=e=>{if(!e||e.length===0)return;let t={};for(let n of e)n.valueFormatter&&(t[n.colId??n.field]=n.valueFormatter);return Object.keys(t).length>0?t:void 0},S=e=>({range:e.range,sort:e.sortModel.length>0?e.sortModel:void 0,filter:Object.keys(e.filterModel).length>0?e.filterModel:void 0,valueFormatters:oe(e.columns)}),se=(e,t,n)=>{let r=e.get(t);if(r!==void 0){if(t<n){let i=n-1;for(let n=t;n<i;n++){let t=e.get(n+1);t===void 0?e.delete(n):e.set(n,t)}e.set(i,r);return}for(let r=t;r>n;r--){let t=e.get(r-1);t===void 0?e.delete(r):e.set(r,t)}e.set(n,r)}},ce=e=>{let t=[0],n=0;for(let r of e)r.hidden||(n+=r.width,t.push(n));return t},le=(e,t,n,r)=>{let i=e.get(n);if(!i)return null;let a=t[r];return a?g(i,a.field):null},ue=(e,t,n,r,i,a)=>{let o=e.get(n);if(!o||typeof o!=`object`)return;let s=t[r];if(!s)return;let c=a.onCellValueChanged!==void 0,l=c?g(o,s.field):void 0;_(o,s.field,i),c&&a.onCellValueChanged({rowId:a.getRowId(o),colIndex:r,field:s.field,oldValue:l,newValue:i,rowData:o})};var de=class{active=!1;thresholdMet=!1;startX=0;startY=0;currentX=0;currentY=0;dropTargetIndex=null;get isDraggingForDisplay(){return this.active&&this.thresholdMet}begin(e,t){this.active=!0,this.startX=e,this.startY=t,this.thresholdMet=!1,this.currentX=e,this.currentY=t,this.dropTargetIndex=null}track(e){if(this.thresholdMet===!1){let t=e.clientX-this.startX,n=e.clientY-this.startY;if(!(Math.abs(t)>5||Math.abs(n)>5))return!1;this.thresholdMet=!0}return this.currentX=e.clientX,this.currentY=e.clientY,!0}reset(){this.active=!1,this.thresholdMet=!1,this.dropTargetIndex=null}},fe=class{gesture=new de;sourceColIndex=-1;shiftKey=!1;ghostWidth=0;ghostHeight=0;core;deps;constructor(e,t){this.core=e,this.deps=t}updateDeps(e){this.deps=e}get isActive(){return this.gesture.active}get isDraggingForDisplay(){return this.gesture.isDraggingForDisplay}start(e,t,n,r){return r.button!==0||this.core.getColumns()[e]?.movable===!1?{preventDefault:!1,stopPropagation:!1}:(this.sourceColIndex=e,this.shiftKey=r.shiftKey,this.ghostWidth=t,this.ghostHeight=n,this.gesture.begin(r.clientX,r.clientY),{preventDefault:!0,stopPropagation:!0,startDrag:`column-move`})}move(e,t){if(this.gesture.track(e)===!1)return null;let{left:n,width:r,scrollLeft:i}=t,o=e.clientX-n+i,s=this.deps.getColumnPositions(),c=this.deps.getColumnCount(),l=Math.max(0,Math.min(a(o,s),c));this.gesture.dropTargetIndex=l;let u=e.clientX-n,d=0;return u<40?d=-10:u>r-40&&(d=10),{targetRow:0,targetCol:l,autoScroll:d===0?null:{dx:d,dy:0}}}end(e){this.gesture.thresholdMet?this.commitMove():this.treatAsHeaderClick(e),this.reset()}commitMove(){let{dropTargetIndex:e}=this.gesture;if(e===null)return;let t=this.sourceColIndex,n=this.deps.getOriginalColumnIndex?this.deps.getOriginalColumnIndex(Math.min(e,this.deps.getColumnCount()-1)):e;t!==n&&this.core.moveColumn(t,n)}treatAsHeaderClick(e){let t=this.core.getColumns()[this.sourceColIndex];if(!t)return;let n=t.colId??t.field,r=this.core.getSortModel().find(e=>e.colId===n)?.direction;this.core.setSort(n,e(r),this.shiftKey)}reset(){this.sourceColIndex=-1,this.shiftKey=!1,this.gesture.reset()}getState(){if(this.gesture.active===!1)return null;let{currentX:e,currentY:t,dropTargetIndex:n}=this.gesture;return{sourceColIndex:this.sourceColIndex,currentX:e,currentY:t,dropTargetIndex:n,ghostWidth:this.ghostWidth,ghostHeight:this.ghostHeight}}},pe=class{gesture=new de;sourceRowIndex=-1;core;deps;constructor(e,t){this.core=e,this.deps=t}updateDeps(e){this.deps=e}get isActive(){return this.gesture.active}get isDraggingForDisplay(){return this.gesture.isDraggingForDisplay}start(e,t,n){this.sourceRowIndex=e,this.gesture.begin(t,n)}move(t,n){if(this.gesture.track(t)===!1)return null;let{top:r,left:i,height:a,width:o,scrollTop:s}=n,c=this.deps.getHeaderHeight(),l=t.clientY-r,u=this.core.getRowCount(),d=Math.max(0,Math.min(this.core.getRowIndexAtDisplayY(l,s),u));return this.gesture.dropTargetIndex=d,{targetRow:d,targetCol:0,autoScroll:e(t.clientY-r,t.clientX-i,a,o,c)}}end(){let{thresholdMet:e,dropTargetIndex:t}=this.gesture;e&&t!==null&&t!==this.sourceRowIndex&&this.core.commitRowDrag(this.sourceRowIndex,t),this.sourceRowIndex=-1,this.gesture.reset()}getState(){if(this.gesture.active===!1)return null;let{currentX:e,currentY:t,dropTargetIndex:n}=this.gesture;return{sourceRowIndex:this.sourceRowIndex,currentX:e,currentY:t,dropTargetIndex:n,dropIndicatorY:n===null?0:this.core.getRowTranslateY(n)}}},me=class{active=!1;core;constructor(e){this.core=e}get isActive(){return this.active}start(){this.active=!0}moveToTarget(e,t){this.active!==!1&&this.core.selection.startSelection({row:e,col:t},{shift:!0})}end(){this.active=!1}},he=class{active=!1;sourceRange=null;target=null;core;constructor(e){this.core=e}get isActive(){return this.active}get stateSnapshot(){return{sourceRange:this.sourceRange,target:this.target}}start(e,t){if(!e&&!t)return{preventDefault:!1,stopPropagation:!1};let n=t??{startRow:e.row,startCol:e.col,endRow:e.row,endCol:e.col};return this.core.fill.startFillDrag(n),this.sourceRange=n,this.target={row:Math.max(n.startRow,n.endRow),col:Math.max(n.startCol,n.endCol)},this.active=!0,{preventDefault:!0,stopPropagation:!0,startDrag:`fill`}}moveToTarget(e,t){this.active!==!1&&(this.core.fill.updateFillDrag(e,t),this.target={row:e,col:t})}end(){this.active&&(this.core.fill.commitFillDrag(),this.core.refreshSlotData()),this.active=!1,this.sourceRange=null,this.target=null}},ge=class{record=null;set(e){this.record=e}clear(){this.record=null}consume(){let e=this.record;return this.record=null,e}},_e=class{record=null;set(e){this.record=e}clear(){this.record=null}consume(){let e=this.record;return this.record=null,e}};const ve=10,ye=300,be=new Map([[`ArrowUp`,`up`],[`ArrowDown`,`down`],[`ArrowLeft`,`left`],[`ArrowRight`,`right`]]);var xe=class{core;constructor(e){this.core=e}handle(e,t,n,r){if(r)return{preventDefault:!1};if(this.core.getPeekState()!==null)return e.key===`Escape`?(this.core.stopPeek(),{preventDefault:!0}):{preventDefault:!1};if(n!==null&&e.key!==`Enter`&&e.key!==`Escape`&&e.key!==`Tab`)return{preventDefault:!1};let i=be.get(e.key);if(i)return this.moveFocus(i,e.shiftKey);let a=e.ctrlKey||e.metaKey;return this.handleAction(e.key,t,n,e.shiftKey,a)}moveFocus(e,t){this.core.stopPeek();let{selection:n}=this.core;return n.moveFocus(e,t),{preventDefault:!0,scrollToCell:n.getActiveCell()??void 0}}handleAction(e,t,n,r,i){switch(e){case`Enter`:return this.handleEnter(t,n);case`Escape`:return this.handleEscape(n);case`Tab`:return this.handleTab(n,r);default:return this.handleNonSpecialKey(e,t,n,i)}}handleEnter(e,t){return t?this.core.commitEdit():e&&this.core.startEdit(e.row,e.col),{preventDefault:!0}}handleEscape(e){return e?this.core.cancelEdit():this.core.getPeekState()?this.core.stopPeek():this.core.selection.clearSelection(),{preventDefault:!0}}handleTab(e,t){return e&&this.core.commitEdit(),this.core.selection.moveFocus(t?`left`:`right`,!1),{preventDefault:!0}}handleNonSpecialKey(e,t,n,r){let{selection:i}=this.core;return e===`a`&&r?(i.selectAll(),{preventDefault:!0}):e===`c`&&r?(i.copySelectionToClipboard(),{preventDefault:!0}):e===`F2`?(t&&!n&&this.core.startEdit(t.row,t.col),{preventDefault:!0}):e===`Delete`||e===`Backspace`?t&&!n?(this.core.startEdit(t.row,t.col),{preventDefault:!0}):{preventDefault:!1}:(t&&!n&&!r&&e.length===1&&this.core.startEdit(t.row,t.col),{preventDefault:!1})}};const Se=(t,n,r,i)=>{let{top:o,left:s,width:c,height:l,scrollTop:u,scrollLeft:d}=i,f=n.getColumnPositions(),p=n.getColumnCount(),m=r.clientY-o,h=r.clientX-s+d,g=Math.max(0,Math.min(t.getRowIndexAtDisplayY(m,u),t.getRowCount()-1)),_=Math.max(0,Math.min(a(h,f),p-1));return{row:g,col:n.getOriginalColumnIndex?n.getOriginalColumnIndex(_):_,autoScroll:e(r.clientY-o,r.clientX-s,l,c,n.getHeaderHeight())}},C=e=>e==null?`asc`:e===`asc`?`desc`:null;var w=class{core;deps;columnResize;columnMove;rowDrag;selectionDrag;fillDrag;pendingRowDrag=new ge;pendingCellTap=new _e;keyboard;constructor(e,n){this.core=e,this.deps=n,this.columnResize=new t(e),this.columnMove=new fe(e,n),this.rowDrag=new pe(e,n),this.selectionDrag=new me(e),this.fillDrag=new he(e),this.keyboard=new xe(e)}updateDeps(e){this.deps={...this.deps,...e},this.columnMove.updateDeps(this.deps),this.rowDrag.updateDeps(this.deps)}getDragState(){let e=this.getDragType(),t=this.fillDrag.stateSnapshot;return{isDragging:e!==null,dragType:e,fillSourceRange:t.sourceRange,fillTarget:t.target,columnResize:this.columnResize.getState(),columnMove:this.columnMove.getState(),rowDrag:this.rowDrag.getState()}}getDragType(){return this.fillDrag.isActive?`fill`:this.columnResize.isActive?`column-resize`:this.columnMove.isDraggingForDisplay?`column-move`:this.rowDrag.isDraggingForDisplay?`row-drag`:this.selectionDrag.isActive?`selection`:null}handleHeaderMouseDown(e,t,n,r){return this.columnMove.start(e,t,n,r)}handleHeaderResizeMouseDown(e,t,n){return this.columnResize.start(e,t,n)}handleCellMouseDown(e,t,n){if(n.button!==0||this.core.getEditState()!==null)return Ce;this.core.stopPeek();let r=(this.core.getColumns()[t]?.rowDrag===!0||this.core.isRowDragEntireRow())&&!n.shiftKey;return r&&n.pointerType===`touch`?this.startPendingRowDrag(e,t,n):r?this.startRowDrag(e,t,n):this.startSelectionClick(e,t,n)}startPendingRowDrag(e,t,n){return this.pendingRowDrag.set({rowIndex:e,colIndex:t,clientX:n.clientX,clientY:n.clientY}),this.pendingCellTap.set({rowIndex:e,colIndex:t}),{preventDefault:!1,stopPropagation:!1,focusContainer:!1,startDrag:`row-drag-pending`,startTap:!0}}startRowDrag(e,t,n){return this.rowDrag.start(e,n.clientX,n.clientY),this.core.selection.startSelection({row:e,col:t},{shift:!1,ctrl:!1}),{preventDefault:!0,stopPropagation:!0,focusContainer:!0,startDrag:`row-drag`}}startSelectionClick(e,t,n){return n.pointerType===`touch`?(this.pendingCellTap.set({rowIndex:e,colIndex:t}),{preventDefault:!1,stopPropagation:!1,focusContainer:!1,startTap:!0}):(this.core.selection.startSelection({row:e,col:t},{shift:n.shiftKey,ctrl:n.ctrlKey||n.metaKey}),{preventDefault:!1,stopPropagation:!1,focusContainer:!0,startDrag:n.shiftKey?void 0:`selection`})}handleCellDoubleClick(e,t){if(this.core.getColumns()[t]?.editable){this.core.startEdit(e,t);return}this.core.startPeek(e,t)}handleCellMouseEnter(e,t){this.core.highlight?.setHoverPosition({row:e,col:t})}handleCellMouseLeave(){this.core.highlight?.setHoverPosition(null)}handleFillHandleMouseDown(e,t,n){return this.fillDrag.start(e,t)}handleHeaderClick(e,t){let n=this.core.getSortModel().find(t=>t.colId===e)?.direction;this.core.setSort(e,C(n),t)}startSelectionDrag(){this.selectionDrag.start()}confirmPendingRowDrag(){let e=this.pendingRowDrag.consume();return e===null?!1:(this.pendingCellTap.clear(),this.rowDrag.start(e.rowIndex,e.clientX,e.clientY),this.core.selection.startSelection({row:e.rowIndex,col:e.colIndex},{shift:!1,ctrl:!1}),!0)}cancelPendingRowDrag(){this.pendingRowDrag.clear()}confirmPendingCellTap(){let e=this.pendingCellTap.consume();return e===null?!1:(this.core.selection.startSelection({row:e.rowIndex,col:e.colIndex},{shift:!1,ctrl:!1}),!0)}cancelPendingCellTap(){this.pendingCellTap.clear()}handleDragMove(e,t){return this.columnResize.isActive?this.columnResize.move(e,t):this.columnMove.isActive?this.columnMove.move(e,t):this.rowDrag.isActive?this.rowDrag.move(e,t):this.selectionFillMove(e,t)}selectionFillMove(e,t){if((this.selectionDrag.isActive||this.fillDrag.isActive)===!1)return null;let n=Se(this.core,this.deps,e,t);return this.selectionDrag.moveToTarget(n.row,n.col),this.fillDrag.moveToTarget(n.row,n.col),{targetRow:n.row,targetCol:n.col,autoScroll:n.autoScroll}}handleDragEnd(){if(this.columnResize.isActive)return this.columnResize.end();if(this.columnMove.isActive)return this.columnMove.end(C);if(this.rowDrag.isActive)return this.rowDrag.end();this.selectionDrag.end(),this.fillDrag.end()}handleWheel(e,t,n){return this.core.isScalingActive()?{dy:e*n,dx:t*n}:null}handleKeyDown(e,t,n,r){return this.keyboard.handle(e,t,n,r)}};const Ce={preventDefault:!1,stopPropagation:!1};var we=class{options;highlightingOptions;hoverPosition=null;emitter=v();onInstruction=this.emitter.onInstruction;emit=this.emitter.emit;rowClassCache=new Map;columnClassCache=new Map;cellClassCache=new Map;constructor(e,t={}){this.options=e,this.highlightingOptions=t}isEnabled(){return!!(this.highlightingOptions.computeRowClasses||this.highlightingOptions.computeColumnClasses||this.highlightingOptions.computeCellClasses)}updateOptions(e){this.highlightingOptions=e,this.clearAllCaches()}setHoverPosition(e){this.isEnabled()&&(this.hoverPosition?.row!==e?.row||this.hoverPosition?.col!==e?.col)&&(this.rowClassCache.clear(),this.columnClassCache.clear(),this.cellClassCache.clear(),this.hoverPosition=e,this.emit({type:`SET_HOVER_POSITION`,position:e}))}getHoverPosition(){return this.hoverPosition}onSelectionChange(){this.clearAllCaches()}buildRowContext(e,t){let n=this.options.getActiveCell(),r=this.options.getSelectionRange();return{rowIndex:e,colIndex:null,column:void 0,rowData:t,hoverPosition:this.hoverPosition,activeCell:n,selectionRange:r,isHovered:this.hoverPosition?.row===e,isActive:n?.row===e,isSelected:m(e,r)}}buildColumnContext(e,t){let n=this.options.getActiveCell(),r=this.options.getSelectionRange();return{rowIndex:null,colIndex:e,column:t,rowData:void 0,hoverPosition:this.hoverPosition,activeCell:n,selectionRange:r,isHovered:this.hoverPosition?.col===e,isActive:n?.col===e,isSelected:h(e,r)}}buildCellContext(e,t,n,r){let i=this.options.getActiveCell(),a=this.options.getSelectionRange(),s=this.hoverPosition?.row===e&&this.hoverPosition?.col===t,c=!1;if(a){let{minRow:n,maxRow:r,minCol:i,maxCol:s}=o(a);c=e>=n&&e<=r&&t>=i&&t<=s}return{rowIndex:e,colIndex:t,column:n,rowData:r,hoverPosition:this.hoverPosition,activeCell:i,selectionRange:a,isHovered:s,isActive:i?.row===e&&i?.col===t,isSelected:c}}computeRowClasses(e,t){let n=this.highlightingOptions.computeRowClasses;if(!n)return[];let r=this.rowClassCache.get(e);if(r!==void 0)return r;let i=n(this.buildRowContext(e,t));return this.rowClassCache.set(e,i),i}computeColumnClasses(e,t){let n=this.columnClassCache.get(e);if(n!==void 0)return n;let r=this.buildColumnContext(e,t),i;if(t.computeColumnClasses)i=t.computeColumnClasses(r);else if(this.highlightingOptions.computeColumnClasses)i=this.highlightingOptions.computeColumnClasses(r);else return[];return this.columnClassCache.set(e,i),i}computeCellClasses(e,t,n,r){let i=`${e},${t}`,a=this.cellClassCache.get(i);if(a!==void 0)return a;let o=this.buildCellContext(e,t,n,r),s;if(n.computeCellClasses)s=n.computeCellClasses(o);else if(this.highlightingOptions.computeCellClasses)s=this.highlightingOptions.computeCellClasses(o);else return[];return this.cellClassCache.set(i,s),s}computeCombinedCellClasses(e,t,n,r){let i=this.computeColumnClasses(t,n),a=this.computeCellClasses(e,t,n,r);return[...i,...a]}clearAllCaches(){this.rowClassCache.clear(),this.columnClassCache.clear(),this.cellClassCache.clear()}destroy(){this.emitter.clearListeners(),this.clearAllCaches(),this.hoverPosition=null}};const Te={aggressive:{prefetchPages:0,maxPages:1},balanced:{prefetchPages:1,maxPages:5},conservative:{prefetchPages:2,maxPages:10}},T=(e,t)=>e===void 0?t:Number.isFinite(e)&&e>0?Math.floor(e):t,Ee=(e,t)=>e===void 0?t:Number.isFinite(e)&&e>=0?Math.floor(e):t,E=e=>{let t=Te[e?.eviction??`balanced`];return{pageSize:T(e?.pageSize,100),prefetchPages:Ee(e?.prefetchPages,t.prefetchPages),maxPages:T(e?.maxPages,t.maxPages)}};var De=class{options;cacheOptions;generation=0;hasKnownTotal=!1;loadedBlocks=new Set;pendingBlocks=new Map;constructor(e,t){this.options=e,this.cacheOptions=E(t)}configure(e){this.cacheOptions=E(e)}getPageSize(){return this.cacheOptions.pageSize}reset(){this.generation+=1,this.hasKnownTotal=!1,this.loadedBlocks.clear(),this.pendingBlocks.clear(),this.options.getCachedRows().clear()}hasMissingRows(e){if(e.endRow<=e.startRow)return!1;let t=this.options.getTotalRows();if(this.hasKnownTotal&&t===0||this.hasKnownTotal&&e.startRow>=t)return!1;let n=this.hasKnownTotal?Math.min(e.endRow,t):e.endRow,r=this.options.getCachedRows();for(let t=e.startRow;t<n;t+=1)if(!r.has(t))return!0;return!1}async loadRange(e,t=!1){t&&this.reset();let n=this.generation,r=this.options.getTotalRows(),i=this.getBlocksForRange(e).map(e=>this.getOrCreateBlockRequest(e,n)).filter(e=>e!==null);return i.length>0&&await Promise.all(i),n===this.generation?(this.evictAround(e),{applied:!0,loadedBlockCount:i.length,totalRowsChanged:r!==this.options.getTotalRows()}):{applied:!1,loadedBlockCount:0,totalRowsChanged:!1}}getOrCreateBlockRequest(e,t){if(this.loadedBlocks.has(e))return null;let n=this.pendingBlocks.get(e);if(n)return n;let r=this.fetchBlock(e,t);return this.pendingBlocks.set(e,r),r.then(()=>this.deletePendingBlock(e,r),()=>this.deletePendingBlock(e,r)),r}deletePendingBlock(e,t){this.pendingBlocks.get(e)===t&&this.pendingBlocks.delete(e)}async fetchBlock(e,t){let n=e*this.cacheOptions.pageSize,r=this.getBlockEndRow(e),i;try{i=await this.options.getDataSource().query(S({range:{startRow:n,endRow:r},sortModel:this.options.getSortModel(),filterModel:this.options.getFilterModel(),columns:this.options.getColumns()}))}catch(e){if(t===this.generation)throw e;return}t===this.generation&&this.applyBlockResponse(e,i.rows,i.totalRows)}applyBlockResponse(e,t,n){let r=this.options.getCachedRows(),i=this.options.getTotalRows();this.deleteRowsForBlock(e);let a=e*this.cacheOptions.pageSize;t.forEach((e,t)=>{e!==void 0&&r.set(a+t,e)}),this.options.setTotalRows(n),this.hasKnownTotal=!0,this.loadedBlocks.add(e),n<i&&this.deleteRowsAfterTotal(n)}getBlocksForRange(e){if(e.endRow<=e.startRow)return[];let t=this.options.getTotalRows();if(this.hasKnownTotal&&t===0||this.hasKnownTotal&&e.startRow>=t)return[];let n=this.hasKnownTotal?Math.min(e.endRow,t):e.endRow,r=this.cacheOptions.pageSize,i=Math.floor(e.startRow/r),a=Math.floor((n-1)/r),o=Math.max(0,i-this.cacheOptions.prefetchPages),s=this.getLastPrefetchBlock(a),c=[];for(let e=o;e<=s;e+=1)c.push(e);return c}getLastPrefetchBlock(e){let t=this.options.getTotalRows(),n=e+this.cacheOptions.prefetchPages;if(this.hasKnownTotal&&t>0){let e=Math.floor((t-1)/this.cacheOptions.pageSize);return Math.min(n,e)}return n}getBlockEndRow(e){let t=e*this.cacheOptions.pageSize+this.cacheOptions.pageSize,n=this.options.getTotalRows();return this.hasKnownTotal&&n>0?Math.min(t,n):t}evictAround(e){if(this.loadedBlocks.size<=this.cacheOptions.maxPages)return;let t=new Set(this.getBlocksForRange(e)),n=Math.floor(e.startRow/this.cacheOptions.pageSize),r=[...this.loadedBlocks].filter(e=>t.has(e)===!1).sort((e,t)=>Math.abs(t-n)-Math.abs(e-n));for(let e of r){if(this.loadedBlocks.size<=this.cacheOptions.maxPages)return;this.loadedBlocks.delete(e),this.deleteRowsForBlock(e)}}deleteRowsForBlock(e){let t=this.options.getCachedRows(),n=e*this.cacheOptions.pageSize,r=n+this.cacheOptions.pageSize;for(let e=n;e<r;e+=1)t.delete(e)}deleteRowsAfterTotal(e){let t=this.options.getCachedRows();for(let n of t.keys())n>=e&&t.delete(n)}};const Oe=(e,t,n,r)=>{if(n<=0)return t;let i=0;for(let t=0;t<r.length;t++){if(t===e)continue;let n=r[t];!n||n.hidden||(i+=n.width)}return i<=0||t+i>=n?t:t*i/(n-t)},ke=(e,t,n,r)=>{let i=r.columns[e];return i===void 0?!1:(i.width=i.hidden?t:Oe(e,t,n,r.columns),r.computeColumnPositions(),r.view.syncColumnLayout(`geometry`),!0)},Ae=(e,t,n)=>{if(e===t||e<0||e>=n.columns.length)return null;let r=t>e?t-1:t;if(r<0||r>=n.columns.length||e===r)return null;let[i]=n.columns.splice(e,1);return n.columns.splice(r,0,i),n.computeColumnPositions(),n.view.syncColumnLayout(`order`),r},je=(e,t,n)=>{let r=n.dataSource;if(!r.moveRow)return;r.moveRow(e,t),se(n.cachedRows,e,t),n.highlight?.clearAllCaches();let i=Math.min(e,t),a=Math.max(e,t);for(let e=i;e<=a;e++)n.slotPool.updateSlot(e)},Me=async e=>{let t=await e.dataSource.query(S({range:{startRow:0,endRow:2**53-1},sortModel:e.sortModel,filterModel:e.filterModel,columns:e.getColumns()}));e.cachedRows.clear();for(let n=0;n<t.rows.length;n++){let r=t.rows[n];r!==void 0&&e.cachedRows.set(n,r)}return e.setTotalRows(t.totalRows),{totalRows:t.totalRows}};var Ne=class{dataSource;options;rowLoading;rowWindowLoader;cachedRows=new Map;totalRows=0;isDataLoading=!1;constructor(e){this.options=e,this.dataSource=e.dataSource,this.rowLoading=e.rowLoading??{},this.rowWindowLoader=new De({getDataSource:()=>this.dataSource,getCachedRows:()=>this.cachedRows,getTotalRows:()=>this.totalRows,setTotalRows:e=>{this.totalRows=e},getSortModel:e.getSortModel,getFilterModel:e.getFilterModel,getColumns:e.getColumns},this.rowLoading.cache)}getCachedRows(){return this.cachedRows}setCachedRows(e){this.cachedRows=e}getTotalRows(){return this.totalRows}setTotalRows(e){this.totalRows=e}getDataSource(){return this.dataSource}getRowData(e){return this.cachedRows.get(e)}isLoading(){return this.isDataLoading}getCellValue(e,t){return le(this.cachedRows,this.options.getColumns(),e,t)}setCellValue(e,t,n){ue(this.cachedRows,this.options.getColumns(),e,t,n,{onCellValueChanged:this.options.onCellValueChanged,getRowId:this.options.getRowId})}async loadInitial(){if(this.isPaginatedLoading()){await this.fetchPaginatedData({range:this.getInitialPaginatedRange(),resetCache:!0,showLoading:!0,notifyRowsLoaded:!1});return}await this.fetchAllData()}requestVisibleRows(){if(this.isPaginatedLoading()===!1)return;let e=this.getPaginatedLoadRange(!0);if(e.endRow<=e.startRow)return;let t=this.getPaginatedLoadRange(!1),n=this.rowWindowLoader.hasMissingRows(t);this.fetchPaginatedData({range:e,resetCache:!1,showLoading:n,notifyRowsLoaded:!0})}async refreshFromTransaction(){if(this.isPaginatedLoading()){await this.fetchPaginatedData({range:this.getPaginatedLoadRange(!0),resetCache:!0,showLoading:!1,notifyRowsLoaded:!1});return}await Me({dataSource:this.dataSource,sortModel:this.options.getSortModel(),filterModel:this.options.getFilterModel(),cachedRows:this.cachedRows,setTotalRows:e=>{this.totalRows=e},getColumns:this.options.getColumns})}setDataSource(e){this.dataSource=e,this.rowWindowLoader.reset(),this.totalRows=0}destroy(){this.rowWindowLoader.reset(),this.cachedRows.clear(),this.totalRows=0,this.isDataLoading=!1}async fetchAllData(){this.isDataLoading=!0,this.options.batcher.emit({type:`DATA_LOADING`});try{let e=S({range:{startRow:0,endRow:2**53-1},sortModel:this.options.getSortModel(),filterModel:this.options.getFilterModel(),columns:this.options.getColumns()}),t=await this.dataSource.query(e);this.cachedRows.clear(),t.rows.forEach((e,t)=>{this.cachedRows.set(t,e)}),this.totalRows=t.totalRows,this.options.batcher.emit({type:`DATA_LOADED`,totalRows:this.totalRows})}catch(e){this.emitDataError(e)}finally{this.isDataLoading=!1}}async fetchPaginatedData(e){e.showLoading&&(this.isDataLoading=!0,this.options.batcher.emit({type:`DATA_LOADING`}));try{let t=await this.rowWindowLoader.loadRange(e.range,e.resetCache);if(t.applied===!1)return;(e.showLoading||t.totalRowsChanged)&&this.options.batcher.emit({type:`DATA_LOADED`,totalRows:this.totalRows}),e.notifyRowsLoaded&&this.options.onRowsLoaded(t.totalRowsChanged)}catch(e){this.emitDataError(e)}finally{e.showLoading&&(this.isDataLoading=!1)}}emitDataError(e){this.options.batcher.emit({type:`DATA_ERROR`,error:e instanceof Error?e.message:String(e)})}isPaginatedLoading(){let e=this.rowLoading.mode??`auto`;return e===`paginated`||e!==`all`&&this.dataSource.loadMode===`paginated`}getInitialPaginatedRange(){let e=this.getPaginatedLoadRange(!0);return{startRow:0,endRow:Math.max(this.rowWindowLoader.getPageSize(),e.endRow)}}getPaginatedLoadRange(e){let t=this.options.getRowHeight(),n=this.options.getViewportHeight(),r=this.options.getScrollTop(),i=e?this.options.getOverscan():0,a=Math.max(0,Math.floor(r/t)-i),o=Math.ceil((r+n)/t)+i+1,s=this.totalRows>0?Math.min(this.totalRows,o):o;return{startRow:a,endRow:Math.max(a,s)}}};const D=1e7;var Pe=class{naturalContentHeight=0;virtualContentHeight=0;scrollRatio=1;options;constructor(e){this.options=e}updateContentSize(){let e=this.options.getTotalRows(),t=this.options.getRowHeight(),n=this.options.getHeaderHeight(),r=this.options.getViewportHeight(),i=e*t;if(this.naturalContentHeight=i+n,this.naturalContentHeight>D){this.virtualContentHeight=D;let e=this.virtualContentHeight-n-r,a=Math.ceil((i-r)/t)*t;this.scrollRatio=a>0?e/a:1}else this.virtualContentHeight=this.naturalContentHeight,this.scrollRatio=1;return{naturalHeight:this.naturalContentHeight,virtualHeight:this.virtualContentHeight,scrollRatio:this.scrollRatio}}isScalingActive(){return this.scrollRatio<1}getNaturalHeight(){let e=this.options.getTotalRows(),t=this.options.getRowHeight(),n=this.options.getHeaderHeight();return this.naturalContentHeight||e*t+n}getVirtualHeight(){let e=this.options.getTotalRows(),t=this.options.getRowHeight(),n=this.options.getHeaderHeight();return this.virtualContentHeight||e*t+n}getScrollRatio(){return this.scrollRatio}getVisibleRowRange(){let e=this.options.getViewportHeight(),t=this.options.getScrollTop(),n=this.options.getRowHeight(),r=this.options.getTotalRows(),i=e,a=Math.max(0,Math.floor(t/n)),o=Math.min(r-1,Math.ceil((t+i)/n)-1);return{start:a,end:Math.max(a,o)}}getScrollTopForRow(e){return e*this.options.getRowHeight()*this.scrollRatio}getRowIndexAtDisplayY(e,t){let n=this.options.getRowHeight(),r=e+(this.scrollRatio<1?t/this.scrollRatio:t);return Math.floor(r/n)}getVirtualContentHeight(){return this.virtualContentHeight}};const O=e=>e.map(e=>({item:e,key:k(e)})).sort((e,t)=>e.key===t.key?0:e.key<t.key?-1:1).map(e=>e.item),k=e=>e==null?`x:null`:typeof e==`string`?`s:${e}`:typeof e==`number`?`n:${String(e)}`:typeof e==`boolean`?`b:${String(e)}`:e instanceof Date?`d:${String(e.getTime())}`:Array.isArray(e)?`a:${JSON.stringify(O(e))}`:`o:${JSON.stringify(e)}`,A=e=>e==null||e===``||Array.isArray(e)&&e.length===0,Fe=(e,t)=>{let n=Number.parseFloat(e),r=Number.parseFloat(t);return Number.isNaN(n)===!1&&Number.isNaN(r)===!1?n-r:e.localeCompare(t,void 0,{numeric:!0,sensitivity:`base`})},Ie=(e,t)=>{let n=new Map;for(let r of e){if(A(r))continue;let e=Array.isArray(r)?O(r):r,i=k(e),a=x(e,t),o=n.get(a);o===void 0&&(o={entry:{label:a,values:[]},seen:new Set},n.set(a,o)),!o.seen.has(i)&&(o.seen.add(i),o.entry.values.push(e))}let r=Array.from(n.values(),e=>e.entry);return r.sort((e,t)=>Fe(e.label,t.label)),r},Le=(e,t)=>{let n=new Set;for(let e of t)n.add(k(e));let r=new Set;for(let t of e)t.values.some(e=>n.has(k(e)))&&r.add(t.label);return r},Re=(e,t)=>{let n=new Set;for(let r of e)if(t.has(r.label)!==!1)for(let e of r.values)n.add(e);return n},j=e=>`conditions`in e,ze=e=>{let t={...e};return delete t.nextOperator,t},M=(e,t,n)=>{let r=n===`and`?`or`:`and`,i=[[e[0]]];for(let[n,a]of e.entries())if(n!==0){if(t[n-1]===r){i.push([a]);continue}i=i.map(e=>[...e,a])}let a=i.map(e=>({conditions:e,combination:n})),o=a.reduce((e,t)=>e+t.conditions.length,0);return{model:{groups:a,combination:r},conditionCount:o}},Be=(e,t)=>e.conditionCount<t.conditionCount?e.model:t.conditionCount<e.conditionCount?t.model:e.model.groups.length<=t.model.groups.length?e.model:t.model,Ve=e=>{if(e.conditions.length===0)return{groups:[],combination:`and`};let t=e.conditions.map(ze);if(t.length===1)return{groups:[{conditions:t,combination:`and`}],combination:`and`};let n=e.conditions.slice(0,-1).map(t=>t.nextOperator??e.combination),r=M(t,n,`and`),i=M(t,n,`or`);return Be(r,i)},N=e=>j(e)?Ve(e):e;var He=class{options;emitter=v();sortModel=[];filterModel={};openFilterColIndex=null;scanWarnedCols=new Set;truncationWarnedCols=new Set;typeMismatchWarnedCols=new Set;onInstruction=this.emitter.onInstruction;emit=this.emitter.emit;constructor(e){this.options=e}async setSort(e,t,n=!1){if(!this.options.isSortingEnabled()||this.options.getColumns().find(t=>(t.colId??t.field)===e)?.sortable===!1)return;let r=this.sortModel.findIndex(t=>t.colId===e);n?t===null&&r>=0?this.sortModel.splice(r,1):r>=0?this.sortModel[r].direction=t:this.sortModel.push({colId:e,direction:t}):this.sortModel=t===null?[]:[{colId:e,direction:t}],await this.options.onSortFilterChange(),this.options.onDataRefreshed()}getSortModel(){return[...this.sortModel]}async setFilter(e,t){let n=this.options.getColumns().find(t=>(t.colId??t.field)===e);if(n?.filterable!==!1){if(t===null||typeof t==`string`&&t.trim()===``)delete this.filterModel[e];else if(typeof t==`string`)this.filterModel[e]={groups:[{conditions:[{type:`text`,operator:`contains`,value:t}],combination:`and`}],combination:`and`};else{let r=N(t);r.groups.some(e=>e.conditions.length>0)===!1?delete this.filterModel[e]:(this.warnTypeMismatchedSelectedValues(e,n,r),this.filterModel[e]=r)}await this.options.onSortFilterChange(),this.options.onDataRefreshed()}}warnTypeMismatchedSelectedValues(e,t,n){let r=t?.cellDataType;(r===`number`||r===`boolean`||r===`date`||r===`dateTime`)&&(this.typeMismatchWarnedCols.has(e)||n.groups.some(e=>e.conditions.some(e=>e.type===`text`&&e.selectedValues!==void 0&&e.selectedValues.size>0&&[...e.selectedValues].every(e=>typeof e==`string`)))!==!1&&(this.typeMismatchWarnedCols.add(e),console.warn(`[gp-grid] Filter on column "${e}" (cellDataType "${r}") has selectedValues containing only strings. Values-mode filters match raw values by strict identity, so this selection will likely match nothing. If this model was restored from JSON or URL params, revive the values to their raw types (e.g. Number(v), new Date(v)) before applying it.`)))}getFilterModel(){return{...this.filterModel}}hasActiveFilter(e){let t=this.filterModel[e];return t?t.groups.some(e=>e.conditions.length>0):!1}isColumnSortable(e){return this.options.isSortingEnabled()?this.options.getColumns()[e]?.sortable!==!1:!1}isColumnFilterable(e){return this.options.getColumns()[e]?.filterable!==!1}getDistinctValuesForColumn(e,t=500){let n=this.options.getColumns().find(t=>(t.colId??t.field)===e);if(!n)return[];let r=n.valueFormatter,i=n.distinctValues??this.scanDistinctValues(n,t),a=new Map;for(let n of i){if(a.size>=t){this.warnTruncatedFormattedDomain(e,r);break}let[i,o]=this.normalizeDistinctValue(n);a.has(i)||a.set(i,o)}let o=Array.from(a.values());return o.sort((e,t)=>{let n=x(e,r),i=x(t,r);return n.localeCompare(i,void 0,{numeric:!0,sensitivity:`base`})}),o}scanDistinctValues(e,t){let n=this.options.getCachedRows(),r=n.size,i=e.colId??e.field;r>1e4&&!this.scanWarnedCols.has(i)&&(this.scanWarnedCols.add(i),console.warn(`[gp-grid] Scanning ${r} rows to compute distinct values for column "${i}". Pre-supply ColumnDefinition.distinctValues to skip this scan.`));let a=new Map;for(let o=0;o<r;o++){let r=n.get(o);if(r===void 0)continue;if(a.size>=t){this.warnTruncatedFormattedDomain(i,e.valueFormatter);break}let s=g(r,e.field),[c,l]=this.normalizeDistinctValue(s);a.has(c)||a.set(c,l)}return Array.from(a.values())}normalizeDistinctValue(e){if(Array.isArray(e)){let t=[...e].sort((e,t)=>{let n=String(e),r=String(t);return n===r?0:n<r?-1:1});return[k(t),t]}return[k(e),e]}warnTruncatedFormattedDomain(e,t){t!==void 0&&(this.truncationWarnedCols.has(e)||(this.truncationWarnedCols.add(e),console.warn(`[gp-grid] Distinct values for column "${e}" were truncated at the cap, and the column has a valueFormatter. Values-mode filters match raw values, so selecting a label may miss rows whose raw values were not scanned. Pre-supply ColumnDefinition.distinctValues with the full raw domain.`)))}openFilterPopup(e,t,n=!0){if(this.openFilterColIndex===e){this.closeFilterPopup();return}let r=this.options.getColumns()[e];if(!r||!this.isColumnFilterable(e))return;let i=r.colId??r.field,a=[];n&&(a=this.getDistinctValuesForColumn(i)),this.openFilterColIndex=e,this.emit({type:`OPEN_FILTER_POPUP`,colIndex:e,column:r,anchorRect:t,distinctValues:a,currentFilter:this.filterModel[i]})}closeFilterPopup(){this.openFilterColIndex=null,this.emit({type:`CLOSE_FILTER_POPUP`})}getSortInfoMap(){let e=new Map;return this.sortModel.forEach((t,n)=>{e.set(t.colId,{direction:t.direction,index:n+1})}),e}destroy(){this.emitter.clearListeners(),this.sortModel=[],this.filterModel={},this.openFilterColIndex=null}},P=class{queue=[];debounceTimer=null;pendingPromise=null;options;constructor(e){this.options=e}add(e){e.length!==0&&(this.queue.push({type:`ADD`,rows:e}),this.scheduleProcessing())}remove(e){e.length!==0&&(this.queue.push({type:`REMOVE`,rowIds:e}),this.scheduleProcessing())}updateCell(e,t,n){this.queue.push({type:`UPDATE_CELL`,rowId:e,field:t,value:n}),this.scheduleProcessing()}updateRow(e,t){Object.keys(t).length!==0&&(this.queue.push({type:`UPDATE_ROW`,rowId:e,data:t}),this.scheduleProcessing())}flush(){return this.queue.length===0?Promise.resolve():(this.debounceTimer!==null&&(clearTimeout(this.debounceTimer),this.debounceTimer=null),this.pendingPromise?new Promise((e,t)=>{let n=this.pendingPromise,r=n.resolve,i=n.reject;n.resolve=()=>{r(),e()},n.reject=e=>{i(e),t(e)}}):new Promise((e,t)=>{this.pendingPromise={resolve:e,reject:t},this.processQueue()}))}hasPending(){return this.queue.length>0}getPendingCount(){return this.queue.length}clear(){this.queue=[],this.debounceTimer!==null&&(clearTimeout(this.debounceTimer),this.debounceTimer=null),this.pendingPromise&&=(this.pendingPromise.resolve(),null)}scheduleProcessing(){if(this.options.debounceMs===0){this.processQueue();return}this.debounceTimer===null&&(this.debounceTimer=setTimeout(()=>{this.debounceTimer=null,this.processQueue()},this.options.debounceMs))}processQueue(){if(this.queue.length===0){this.pendingPromise&&=(this.pendingPromise.resolve(),null);return}let e=this.queue;this.queue=[];let t={added:0,removed:0,updated:0};try{for(let n of e)switch(n.type){case`ADD`:this.options.store.addRows(n.rows),t.added+=n.rows.length;break;case`REMOVE`:t.removed+=this.options.store.removeRows(n.rowIds);break;case`UPDATE_CELL`:this.options.store.updateCell(n.rowId,n.field,n.value),t.updated++;break;case`UPDATE_ROW`:this.options.store.updateRow(n.rowId,n.data),t.updated++;break}this.options.onProcessed&&this.options.onProcessed(t),this.pendingPromise&&=(this.pendingPromise.resolve(),null)}catch(e){this.pendingPromise&&=(this.pendingPromise.reject(e instanceof Error?e:Error(String(e))),null)}}},Ue=class{listeners=[];buffer=null;depth=0;subscribe(e){return this.listeners.push(e),()=>{this.listeners=this.listeners.filter(t=>t!==e)}}start(){this.depth===0&&(this.buffer=[]),this.depth+=1}flush(){if(this.depth===0||(--this.depth,this.depth>0))return;let e=this.buffer;if(this.buffer=null,e!==null&&e.length>0)for(let t of this.listeners)t(e)}emit(e){if(this.buffer!==null){this.buffer.push(e);return}this.notify([e])}emitBatch(e){if(e.length!==0){if(this.buffer!==null){this.buffer.push(...e);return}this.notify(e)}}clearListeners(){this.listeners=[]}notify(e){for(let t of this.listeners)t(e)}},We=class{scrollTop=0;scrollLeft=0;viewportWidth=800;viewportHeight=600;getScrollRatio;constructor(e){this.getScrollRatio=e}getScrollTop(){return this.scrollTop}getScrollLeft(){return this.scrollLeft}getViewportWidth(){return this.viewportWidth}getViewportHeight(){return this.viewportHeight}resetScrollTop(){this.scrollTop=0}update(e,t,n,r){let i=this.getScrollRatio(),a=i<1?e/i:e,o=this.viewportWidth!==n||this.viewportHeight!==r,s=this.scrollTop!==a||this.scrollLeft!==t||o;return s&&(this.scrollTop=a,this.scrollLeft=t,this.viewportWidth=n,this.viewportHeight=r),{changed:s,viewportSizeChanged:o}}};const Ge=e=>{if(e.onCellValueChanged&&e.getRowId===void 0)throw Error(`getRowId is required when onCellValueChanged is provided`);return{dataSource:e.dataSource,rowHeight:e.rowHeight,rowLoading:e.rowLoading,getRowId:e.getRowId,highlighting:e.highlighting,onCellValueChanged:e.onCellValueChanged,onRowDragEnd:e.onRowDragEnd,onColumnResized:e.onColumnResized,onColumnMoved:e.onColumnMoved,headerHeight:e.headerHeight??e.rowHeight,overscan:e.overscan??3,maxFlingVelocity:e.maxFlingVelocity??2e4*e.rowHeight/1e3,sortingEnabled:e.sortingEnabled??!0,rowDragEntireRow:e.rowDragEntireRow??!1}},F=e=>e.replaceAll(`\r
|
|
2
2
|
`,`
|
|
3
3
|
`).replaceAll(`\r`,`
|
|
4
|
-
`),Ke=e=>{let t=
|
|
5
|
-
`);return t.length>1&&t.at(-1)===``&&t.pop(),t.map(e=>e.split(` `).map(e=>({value:e,text:e})))},qe=(e,t)=>{if(e.value===null)return{ok:!0,value:null};let n=e.text,r=n.trim();if(r.length===0)return Je(t);switch(t.cellDataType){case`text`:return{ok:!0,value:n};case`number`:return Ye(e.value,r);case`boolean`:return Xe(e.value,r);case`date`:case`dateTime`:return Ze(e.value,r);case`dateString`:case`dateTimeString`:return Qe(r,n);case`object`:return $e(e.value,r)}},Je=e=>e.cellDataType===`text`?{ok:!0,value:``}:{ok:!0,value:null},Ye=(e,t)=>{if(typeof e==`number`&&Number.isFinite(e))return{ok:!0,value:e};let n=Number(t);return Number.isFinite(n)?{ok:!0,value:n}:{ok:!1}},Xe=(e,t)=>{if(typeof e==`boolean`)return{ok:!0,value:e};let n=t.toLowerCase();return n===`true`?{ok:!0,value:!0}:n===`false`?{ok:!0,value:!1}:{ok:!1}},Ze=(e,t)=>{if(e instanceof Date&&
|
|
6
|
-
`)}}getPasteSourceCells(e){let t=this.clipboardSnapshot;return t&&k(t.text)===k(e)?t.cells:Ke(e)}applyPasteSource(e,t,n){let r=[],{minRow:i,maxRow:a,minCol:s,maxCol:c}=o(t),l=this.isSingleSourceCell(e),u=l?a:i+e.length-1,d=l?c:s+this.getMaxSourceColumnCount(e)-1,f=n?Math.min(u,a):u,p=n?Math.min(d,c):d,m=this.options.getRowCount(),h=this.options.getColumnCount(),g=Math.min(f,m-1),_=Math.min(p,h-1);for(let t=i;t<=g;t++)for(let n=s;n<=_;n++){let a=this.getSourceCellForTarget(e,t-i,n-s,l);a&&this.applyPasteCell(t,n,a,r)}return r}applyPasteCell(e,t,n,r){let i=this.options.getColumn(t);if(i===void 0||i.hidden===!0||i.editable!==!0)return;let a=qe(n,i);a.ok!==!1&&(this.options.setCellValue(e,t,a.value),r.push({row:e,col:t,value:a.value}))}getSourceCellForTarget(e,t,n,r){return r?e[0]?.[0]??null:e[t]?.[n]??null}isSingleSourceCell(e){return e.length===1&&e[0]?.length===1}getMaxSourceColumnCount(e){return e.reduce((e,t)=>Math.max(e,t.length),0)}},tt=class{state=null;options;emitter=v();onInstruction=this.emitter.onInstruction;emit=this.emitter.emit;constructor(e){this.options=e}getState(){return this.state?{...this.state}:null}isActive(){return this.state!==null}startFillDrag(e){this.state={sourceRange:e,targetRow:e.endRow,targetCol:e.endCol},this.emit({type:`START_FILL`,sourceRange:e})}updateFillDrag(e,t){if(!this.state)return;let n=this.options.getRowCount(),r=this.options.getColumnCount();e=Math.max(0,Math.min(e,n-1)),t=Math.max(0,Math.min(t,r-1)),this.state.targetRow=e,this.state.targetCol=t,this.emit({type:`UPDATE_FILL`,targetRow:e,targetCol:t})}commitFillDrag(){if(!this.state)return;let{sourceRange:e,targetRow:t}=this.state,n=this.calculateFilledCells(e,t);for(let{row:e,col:t,value:r}of n)this.options.setCellValue(e,t,r);this.emit({type:`COMMIT_FILL`,filledCells:n}),this.state=null}cancelFillDrag(){this.state&&(this.state=null,this.emit({type:`CANCEL_FILL`}))}destroy(){this.emitter.clearListeners(),this.state=null}calculateFilledCells(e,t){let n=[],{minRow:r,maxRow:i,minCol:a,maxCol:s}=o(e),c=t>i,l=t<r;if(c||l)for(let e=a;e<=s;e++){let a=this.getSourceColumnValues(r,i,e),o=this.detectPattern(a);if(c)for(let r=i+1;r<=t;r++){let t=r-i-1,s=this.applyPattern(o,a,t);n.push({row:r,col:e,value:s})}else if(l)for(let i=r-1;i>=t;i--){let t=r-i-1,s=this.applyPattern(o,a,t,!0);n.push({row:i,col:e,value:s})}}return n}getSourceColumnValues(e,t,n){let r=[];for(let i=e;i<=t;i++)r.push(this.options.getCellValue(i,n));return r}detectPattern(e){if(e.length===0)return{type:`constant`,value:null};if(e.length===1)return{type:`constant`,value:e[0]??null};let t=e.map(e=>typeof e==`number`?e:Number(e));if(t.every(e=>!Number.isNaN(e))){let e=[];for(let n=1;n<t.length;n++)e.push(t[n]-t[n-1]);if(e.every(t=>t===e[0])&&e[0]!==void 0)return{type:`arithmetic`,start:t[0],step:e[0]}}return{type:`repeat`,values:e}}applyPattern(e,t,n,r=!1){switch(e.type){case`constant`:return e.value;case`arithmetic`:{let i=r?-(n+1):n+1;return(r?e.start:e.start+e.step*(t.length-1))+e.step*i}case`repeat`:{let t=e.values.length;if(t===0)return null;if(r){let r=(t-1-n%t+t)%t;return e.values[r]??null}return e.values[n%t]??null}}}},nt=class{state={slots:new Map,rowToSlot:new Map,nextSlotId:0};options;emitter=y();isDestroyed=!1;onInstruction=this.emitter.onInstruction;onBatchInstruction=this.emitter.onBatchInstruction;emit=this.emitter.emit;emitBatch=this.emitter.emitBatch;constructor(e){this.options=e}getSlotForRow(e){return this.state.rowToSlot.get(e)}getSlots(){return this.state.slots}syncSlots(){let e=this.options.getScrollTop(),t=this.options.getRowHeight(),n=this.options.getViewportHeight(),r=this.options.getTotalRows(),i=this.options.getOverscan(),a=n,o=Math.max(0,Math.floor(e/t)-i),s=Math.min(r-1,Math.ceil((e+a)/t)+i);if(r===0||s<o){this.destroyAllSlots();return}let c=new Set;for(let e=o;e<=s;e++)c.add(e);let l=[],u=this.partitionSlots(c),d=0;for(let e of c){let t=this.options.getRowData(e);if(t===void 0)continue;let n=d<u.length?u[d++]:void 0;this.assignSlotToRow(e,t,n,l)}for(let e=d;e<u.length;e++){let t=u[e];this.state.slots.delete(t),l.push({type:`DESTROY_SLOT`,slotId:t})}this.updateSlotPositions(l),this.emitBatch(l)}partitionSlots(e){let t=[];for(let[n,r]of this.state.slots)e.has(r.rowIndex)?e.delete(r.rowIndex):(t.push(n),this.state.rowToSlot.delete(r.rowIndex));return t}assignSlotToRow(e,t,n,r){let i;if(n===void 0)i=`slot-${this.state.nextSlotId++}`,this.state.slots.set(i,{slotId:i,rowIndex:e,rowData:t,translateY:this.getRowTranslateY(e)}),r.push({type:`CREATE_SLOT`,slotId:i});else{i=n;let r=this.state.slots.get(i);r.rowIndex=e,r.rowData=t,r.translateY=this.getRowTranslateY(e)}this.state.rowToSlot.set(e,i),r.push({type:`ASSIGN_SLOT`,slotId:i,rowIndex:e,rowData:t},{type:`MOVE_SLOT`,slotId:i,translateY:this.getRowTranslateY(e)})}updateSlotPositions(e){for(let[t,n]of this.state.slots){let r=this.getRowTranslateY(n.rowIndex);n.translateY!==r&&(n.translateY=r,e.push({type:`MOVE_SLOT`,slotId:t,translateY:r}))}}destroyAllSlots(){let e=[];for(let t of this.state.slots.keys())e.push({type:`DESTROY_SLOT`,slotId:t});this.state.slots.clear(),this.state.rowToSlot.clear(),this.emitBatch(e)}destroy(){this.isDestroyed||(this.isDestroyed=!0,this.state.slots.clear(),this.state.rowToSlot.clear(),this.emitter.clearListeners())}refreshAllSlots(){let e=[],t=this.options.getTotalRows();for(let[n,r]of this.state.slots)if(r.rowIndex>=0&&r.rowIndex<t){let t=this.options.getRowData(r.rowIndex);if(t===void 0)continue;let i=this.getRowTranslateY(r.rowIndex);r.rowData=t,r.translateY=i,e.push({type:`ASSIGN_SLOT`,slotId:n,rowIndex:r.rowIndex,rowData:t},{type:`MOVE_SLOT`,slotId:n,translateY:i})}this.emitBatch(e),this.syncSlots()}updateSlot(e){let t=this.state.rowToSlot.get(e);if(t){let n=this.options.getRowData(e);n&&this.emit({type:`ASSIGN_SLOT`,slotId:t,rowIndex:e,rowData:n})}}getRowTranslateY(e){let t=this.options.getRowHeight(),n=this.options.getScrollRatio(),r=this.options.getScrollTop(),i=e*t;return n>=1?i:i-Math.floor(r/t)*t}getRowTranslateYForIndex(e){return this.getRowTranslateY(e)}getRowsWrapperOffset(){let e=this.options.getScrollRatio(),t=this.options.getScrollTop(),n=this.options.getRowHeight();if(e>=1)return 0;let r=t%n;return t*e-r}},rt=class{editState=null;peekState=null;options;emitter=v();onInstruction=this.emitter.onInstruction;emit=this.emitter.emit;constructor(e){this.options=e}getState(){return this.editState?{...this.editState}:null}isEditing(){return this.editState!==null}isEditingCell(e,t){return this.editState!==null&&this.editState.row===e&&this.editState.col===t}startEdit(e,t){if(!this.options.getColumn(t)?.editable)return!1;this.peekState!==null&&this.stopPeek();let n=this.options.getCellValue(e,t);return this.editState={row:e,col:t,initialValue:n,currentValue:n},this.emit({type:`START_EDIT`,row:e,col:t,initialValue:n}),!0}getPeekState(){return this.peekState?{...this.peekState}:null}startPeek(e,t){return this.editState===null?(this.peekState={row:e,col:t},this.emit({type:`START_PEEK`,row:e,col:t}),!0):!1}stopPeek(){this.peekState!==null&&(this.peekState=null,this.emit({type:`STOP_PEEK`}))}updateValue(e){this.editState&&(this.editState.currentValue=e)}commit(){if(!this.editState)return;let{row:e,col:t,currentValue:n}=this.editState;this.options.setCellValue(e,t,n),this.emit({type:`COMMIT_EDIT`,row:e,col:t,value:n}),this.editState=null,this.emit({type:`STOP_EDIT`}),this.options.onCommit?.(e,t,n)}cancel(){this.editState=null,this.emit({type:`STOP_EDIT`})}destroy(){this.emitter.clearListeners(),this.editState=null,this.peekState=null}},it=class{deps;hasWarnedAboutScaledOverscan=!1;constructor(e){this.deps=e}reconcile(){let{batcher:e,highlight:t,slotPool:n}=this.deps;e.start();try{t?.clearAllCaches(),this.emitContentSize(),n.refreshAllSlots(),this.emitHeaders(),this.emitVisibleRange()}finally{e.flush()}}syncVisibleRows(e){let{batcher:t,slotPool:n}=this.deps;t.start();try{e&&this.emitContentSize(),n.syncSlots(),this.emitVisibleRange()}finally{t.flush()}}syncColumnLayout(e){let{batcher:t,highlight:n,slotPool:r}=this.deps;t.start();try{this.emitContentSize(),this.emitHeaders(),t.emit({type:`COLUMNS_CHANGED`,columns:[...this.deps.getColumns()]}),e===`order`?(n?.clearAllCaches(),r.refreshAllSlots()):r.syncSlots()}finally{t.flush()}}emitContentSize(){let{batcher:e,scrollVirtualization:t,slotPool:n,viewport:r}=this.deps,i=this.deps.getColumnPositions().at(-1)??0;t.updateContentSize(),e.emit({type:`SET_CONTENT_SIZE`,width:i,height:t.getVirtualHeight(),viewportWidth:r.getViewportWidth(),viewportHeight:r.getViewportHeight(),rowsWrapperOffset:n.getRowsWrapperOffset()}),this.warnIfOverscanTooLowForScaling()}emitHeaders(){let{batcher:e,sortFilter:t}=this.deps,n=t.getSortInfoMap();for(let[r,i]of this.deps.getColumns().entries()){let a=i.colId??i.field,o=n.get(a);e.emit({type:`UPDATE_HEADER`,colIndex:r,column:i,sortDirection:o?.direction,sortIndex:o?.index,hasFilter:t.hasActiveFilter(a)})}}emitVisibleRange(){let{batcher:e,scrollVirtualization:t,slotPool:n}=this.deps,r=t.getVisibleRowRange();e.emit({type:`UPDATE_VISIBLE_RANGE`,start:r.start,end:r.end,rowsWrapperOffset:n.getRowsWrapperOffset()})}warnIfOverscanTooLowForScaling(){if(this.hasWarnedAboutScaledOverscan||this.deps.scrollVirtualization.isScalingActive()===!1)return;this.hasWarnedAboutScaledOverscan=!0;let{overscan:e}=this.deps;if(e>=10)return;let t=this.deps.getTotalRows().toLocaleString();console.warn(`[gp-grid] Scroll virtualization is active (${t} rows) but overscan is ${e}. Fast momentum scrolling can outrun rendering and show blank rows at this scale — set the overscan option to 10–12.`)}};const at=e=>{let{batcher:t,config:n,getColumns:r}=e,i=()=>n.rowHeight,a=()=>n.headerHeight,o=()=>n.overscan,s,c,l=()=>c.getTotalRows(),u=()=>c.getCachedRows(),d=(e,t)=>c.getCellValue(e,t),f=(e,t,n)=>{c.setCellValue(e,t,n)},p=new Ie({getRowHeight:i,getHeaderHeight:a,getTotalRows:l,getScrollTop:()=>s.getScrollTop(),getViewportHeight:()=>s.getViewportHeight()});s=new We(()=>p.getScrollRatio());let m=null,h=new et({getRowCount:l,getColumnCount:()=>r().length,getCellValue:d,getRowData:e=>u().get(e),getColumn:e=>r()[e],setCellValue:f});h.onInstruction(e=>{t.emit(e),m?.onSelectionChange()}),n.highlighting&&(m=new Te({getActiveCell:()=>h.getActiveCell(),getSelectionRange:()=>h.getSelectionRange(),getColumn:e=>r()[e]},n.highlighting),m.onInstruction(e=>t.emit(e)));let g=new tt({getRowCount:l,getColumnCount:()=>r().length,getCellValue:d,getColumn:e=>r()[e],setCellValue:f});g.onInstruction(e=>t.emit(e));let _=new nt({getRowHeight:i,getHeaderHeight:a,getOverscan:o,getScrollTop:()=>s.getScrollTop(),getViewportHeight:()=>s.getViewportHeight(),getTotalRows:l,getScrollRatio:()=>p.getScrollRatio(),getVirtualContentHeight:()=>p.getVirtualContentHeight(),getRowData:e=>u().get(e)});_.onBatchInstruction(e=>t.emitBatch(e));let v=new rt({getColumn:e=>r()[e],getCellValue:d,setCellValue:f,onCommit:e=>_.updateSlot(e)});v.onInstruction(e=>t.emit(e));let y=new Ve({getColumns:r,isSortingEnabled:()=>n.sortingEnabled,getCachedRows:u,onSortFilterChange:async()=>{await c.loadInitial(),s.resetScrollTop(),t.start();try{t.emit({type:`SCROLL_TO`,scrollTop:0}),b.reconcile()}finally{t.flush()}},onDataRefreshed:()=>{}});y.onInstruction(e=>t.emit(e));let b=new it({batcher:t,scrollVirtualization:p,slotPool:_,viewport:s,sortFilter:y,highlight:m,overscan:n.overscan,getColumns:r,getColumnPositions:e.getColumnPositions,getTotalRows:l});return c=new Fe({dataSource:n.dataSource,rowLoading:n.rowLoading,batcher:t,getColumns:r,getSortModel:()=>y.getSortModel(),getFilterModel:()=>y.getFilterModel(),getRowHeight:i,getOverscan:o,getScrollTop:()=>s.getScrollTop(),getViewportHeight:()=>s.getViewportHeight(),onCellValueChanged:n.onCellValueChanged,getRowId:n.getRowId,onRowsLoaded:e=>b.syncVisibleRows(e)}),{rowData:c,selection:h,highlight:m,fill:g,scrollVirtualization:p,viewport:s,slotPool:_,editManager:v,sortFilter:y,view:b}};var ot=class{config;columns;columnPositions=[];batcher=new Ue;viewport;scrollTopOverride=null;rowData;selection;fill;input;highlight;sortFilter;slotPool;editManager;scrollVirtualization;view;isDestroyed=!1;constructor(e){this.config=Ge(e),this.columns=e.columns,this.computeColumnPositions();let t=at({batcher:this.batcher,config:this.config,getColumns:()=>this.columns,getColumnPositions:()=>this.columnPositions});this.rowData=t.rowData,this.selection=t.selection,this.highlight=t.highlight,this.fill=t.fill,this.scrollVirtualization=t.scrollVirtualization,this.viewport=t.viewport,this.slotPool=t.slotPool,this.editManager=t.editManager,this.sortFilter=t.sortFilter,this.view=t.view,this.input=new Ce(this,{getHeaderHeight:()=>this.config.headerHeight,getRowHeight:()=>this.config.rowHeight,getColumnPositions:()=>this.columnPositions,getColumnCount:()=>this.columns.length})}onBatchInstruction(e){return this.batcher.subscribe(e)}async initialize(){await this.rowData.loadInitial(),this.view.reconcile()}setViewport(e,t,n,r){let{changed:i,viewportSizeChanged:a}=this.viewport.update(this.scrollTopOverride??e,t,n,r);i&&(this.rowData.requestVisibleRows(),this.view.syncVisibleRows(a))}async setSort(e,t,n=!1){if(!this.rowData.isLoading())return this.sortFilter.setSort(e,t,n)}async setFilter(e,t){if(!this.rowData.isLoading())return this.sortFilter.setFilter(e,t)}hasActiveFilter(e){return this.sortFilter.hasActiveFilter(e)}openFilterPopup(e,t,n=!0){this.rowData.isLoading()||this.sortFilter.openFilterPopup(e,t,n)}closeFilterPopup(){this.sortFilter.closeFilterPopup()}getSortModel(){return this.sortFilter.getSortModel()}getFilterModel(){return this.sortFilter.getFilterModel()}startEdit(e,t){this.editManager.startEdit(e,t)}startPeek(e,t){let n=this.columns[t];return!n||n.peekable===!1?!1:this.editManager.startPeek(e,t)}stopPeek(){this.editManager.stopPeek()}getPeekState(){return this.editManager.getPeekState()}updateEditValue(e){this.editManager.updateValue(e)}commitEdit(){this.editManager.commit()}cancelEdit(){this.editManager.cancel()}pasteClipboardText(e){if(this.editManager.getState())return!1;let t=this.selection.pasteClipboardText(e);return t.changedCells.length>0&&this.refreshSlotData(),t.handled}getEditState(){return this.editManager.getState()}getCellValue(e,t){return this.rowData.getCellValue(e,t)}setCellValue(e,t,n){this.rowData.setCellValue(e,t,n)}clearSelectionIfInvalid(e){let t=this.selection.getActiveCell();t&&t.row>=e&&this.selection.clearSelection()}computeColumnPositions(){this.columnPositions=ce(this.columns)}columnOperationDeps(){return{columns:this.columns,computeColumnPositions:()=>this.computeColumnPositions(),view:this.view}}setColumnWidth(e,t){je(e,t,this.viewport.getViewportWidth(),this.columnOperationDeps())&&this.config.onColumnResized?.(e,t)}moveColumn(e,t){let n=Me(e,t,this.columnOperationDeps());n!==null&&this.config.onColumnMoved?.(e,n)}commitRowDrag(e,t){Ne(e,t,{dataSource:this.rowData.getDataSource(),cachedRows:this.rowData.getCachedRows(),slotPool:this.slotPool,highlight:this.highlight}),this.config.onRowDragEnd?.(e,t)}isRowDragEntireRow(){return this.config.rowDragEntireRow}getColumns(){return this.columns}getColumnPositions(){return[...this.columnPositions]}getRowCount(){return this.rowData.getTotalRows()}getRowHeight(){return this.config.rowHeight}getHeaderHeight(){return this.config.headerHeight}getTotalWidth(){return this.columnPositions.at(-1)??0}getTotalHeight(){return this.scrollVirtualization.getVirtualHeight()}isScalingActive(){return this.scrollVirtualization.isScalingActive()}getMaxFlingVelocity(){return this.config.maxFlingVelocity}setScrollTopOverride(e){this.scrollTopOverride=e}getScrollRatio(){return this.scrollVirtualization.getScrollRatio()}getVisibleRowRange(){return this.scrollVirtualization.getVisibleRowRange()}getScrollTopForRow(e){return this.scrollVirtualization.getScrollTopForRow(e)}getRowIndexAtDisplayY(e,t){return this.scrollVirtualization.getRowIndexAtDisplayY(e,t)}getRowTranslateY(e){return this.slotPool.getRowTranslateYForIndex(e)}getRowData(e){return this.rowData.getRowData(e)}async refresh(){await this.rowData.loadInitial(),this.view.reconcile()}async refreshFromTransaction(){await this.rowData.refreshFromTransaction(),this.view.reconcile()}refreshSlotData(){this.slotPool.refreshAllSlots()}async setDataSource(e){this.editManager.getState()&&this.editManager.cancel(),this.rowData.setDataSource(e),await this.refresh(),this.clearSelectionIfInvalid(this.rowData.getTotalRows())}setColumns(e){this.columns=e,this.computeColumnPositions(),this.view.reconcile()}destroy(){this.isDestroyed||(this.isDestroyed=!0,this.slotPool.destroy(),this.highlight?.destroy(),this.sortFilter.destroy(),this.rowData.destroy(),this.batcher.clearListeners())}},st=class{workerCode;maxWorkers;workers=[];workerUrl=null;nextRequestId=0;isTerminated=!1;constructor(e,t={}){this.workerCode=e;let n=typeof navigator>`u`?4:navigator.hardwareConcurrency;this.maxWorkers=Math.max(1,t.maxWorkers??n??4),t.preWarm&&this.preWarmWorkers()}getPoolSize(){return this.workers.length}getMaxWorkers(){return this.maxWorkers}isAvailable(){return!this.isTerminated&&typeof Worker<`u`}async execute(e,t){if(this.isTerminated)throw Error(`WorkerPool has been terminated`);if(typeof Worker>`u`)throw TypeError(`Web Workers are not available in this environment`);let n=this.getAvailableWorker(),r=this.nextRequestId++,i={...e,id:r};return new Promise((e,a)=>{n.pendingRequests.set(r,{resolve:e,reject:a}),n.busy=!0,t&&t.length>0?n.worker.postMessage(i,t):n.worker.postMessage(i)})}async executeParallel(e){if(this.isTerminated)throw Error(`WorkerPool has been terminated`);if(e.length===0)return[];let t=Math.min(e.length,this.maxWorkers);this.ensureWorkers(t);let n=e.map((e,t)=>{let n=t%this.workers.length,r=this.workers[n],i=this.nextRequestId++,a={...e.request,id:i};return new Promise((t,n)=>{r.pendingRequests.set(i,{resolve:t,reject:n}),r.busy=!0,e.transferables&&e.transferables.length>0?r.worker.postMessage(a,e.transferables):r.worker.postMessage(a)})});return Promise.all(n)}terminate(){for(let e of this.workers){e.worker.terminate();for(let[,t]of e.pendingRequests)t.reject(Error(`Worker pool terminated`));e.pendingRequests.clear()}this.workers=[],this.workerUrl&&=(URL.revokeObjectURL(this.workerUrl),null),this.isTerminated=!0}preWarmWorkers(){this.ensureWorkers(this.maxWorkers)}ensureWorkers(e){let t=Math.min(e,this.maxWorkers)-this.workers.length;for(let e=0;e<t;e++)this.createWorker()}getAvailableWorker(){return this.workers.find(e=>!e.busy)||(this.workers.length<this.maxWorkers?this.createWorker():this.workers.reduce((e,t)=>t.pendingRequests.size<e.pendingRequests.size?t:e,this.workers[0]))}createWorker(){if(!this.workerUrl){let e=new Blob([this.workerCode],{type:`application/javascript`});this.workerUrl=URL.createObjectURL(e)}let e=new Worker(this.workerUrl),t={worker:e,busy:!1,pendingRequests:new Map};return e.onmessage=e=>{let{id:n}=e.data,r=t.pendingRequests.get(n);r&&(t.pendingRequests.delete(n),t.pendingRequests.size===0&&(t.busy=!1),e.data.type===`error`?r.reject(Error(e.data.error)):r.resolve(e.data))},e.onerror=e=>{for(let[,n]of t.pendingRequests)n.reject(Error(`Worker error: ${e.message}`));t.pendingRequests.clear(),t.busy=!1,this.respawnWorker(t)},this.workers.push(t),t}respawnWorker(e){let t=this.workers.indexOf(e);if(t!==-1){try{e.worker.terminate()}catch{}this.workers.splice(t,1),this.workers.length<this.maxWorkers&&!this.isTerminated&&this.createWorker()}}},ct=class{heap=[];compare;constructor(e){this.compare=e}push(e){this.heap.push(e),this.bubbleUp(this.heap.length-1)}pop(){if(this.heap.length===0)return;let e=this.heap[0],t=this.heap.pop();return this.heap.length>0&&t&&(this.heap[0]=t,this.bubbleDown(0)),e}size(){return this.heap.length}bubbleUp(e){for(;e>0;){let t=Math.floor((e-1)/2);if(this.compare(this.heap[e],this.heap[t])>=0)break;this.swap(e,t),e=t}}bubbleDown(e){let t=this.heap.length;for(;;){let n=2*e+1,r=2*e+2,i=e;if(n<t&&this.compare(this.heap[n],this.heap[i])<0&&(i=n),r<t&&this.compare(this.heap[r],this.heap[i])<0&&(i=r),i===e)break;this.swap(e,i),e=i}}swap(e,t){let n=this.heap[e];this.heap[e]=this.heap[t],this.heap[t]=n}};const lt=(e,t,n)=>{let r=[];for(let i=0;i<n;i++)r.push(e.columns[i][t]);return r},ut=e=>{let t=new Uint32Array(e.indices.length);for(let n=0;n<e.indices.length;n++)t[n]=e.indices[n]+e.offset;return t},dt=e=>{let t=0;for(let n of e)t+=n.indices.length;return t},j=(e,t,n)=>{let r=new Uint32Array(dt(e)),i=new ct((e,t)=>{let r=n(e.payload,t.payload);return r===0?e.globalIndex-t.globalIndex:r}),a=(n,r)=>{let a=e[n];i.push({chunkIndex:n,positionInChunk:r,payload:t(a,r),globalIndex:a.indices[r]+a.offset})};for(let t=0;t<e.length;t++)e[t].indices.length>0&&a(t,0);let o=0;for(;i.size()>0;){let t=i.pop();r[o++]=t.globalIndex;let n=t.positionInChunk+1;n<e[t.chunkIndex].indices.length&&a(t.chunkIndex,n)}return r};function M(e,t){if(e.length===0)return new Uint32Array;if(e.length===1)return ut(e[0]);let n=t===`asc`?1:-1;return j(e,(e,t)=>e.values[t],(e,t)=>(e-t)*n)}function ft(e){if(e.length===0)return new Uint32Array;if(e.length===1)return ut(e[0]);let t=e[0].directions,n=t.length;return j(e,(e,t)=>lt(e,t,n),(e,r)=>{for(let i=0;i<n;i++){let n=(e[i]-r[i])*t[i];if(n!==0)return n}return 0})}const pt=(e,t,n)=>{let r=Math.max(n,Math.ceil(e/t)),i=[];for(let t=0;t<e;t+=r)i.push({offset:t,length:Math.min(r,e-t)});return i},mt=e=>{if(e.length<=1)return[];let t=[],n=0;for(let r=0;r<e.length-1;r++){let i=e[r],a=e[r+1];if(i.indices.length===0||a.indices.length===0){n+=i.indices.length;continue}let o=i.values[i.indices.length-1],s=a.values[0];if(o===s){let e=i.indices.length-1;for(;e>0&&i.values[e-1]===o;)e--;let r=0;for(;r<a.indices.length-1&&a.values[r+1]===s;)r++;t.push(n+e,n+i.indices.length+r+1)}n+=i.indices.length}return t},N=(e,t,n,r)=>{let i=r===`asc`?1:-1;for(let r=0;r<t.length;r+=2){let a=t[r],o=t[r+1];o<=a||o>e.length||ht(e,a,o,n,i)}},ht=(e,t,n,r,i)=>{let a=Array.from(e.slice(t,n));if(!gt(a,r)){a.sort((e,t)=>i*r[e].localeCompare(r[t]));for(let n=0;n<a.length;n++)e[t+n]=a[n]}},gt=(e,t)=>{let n=t[e[0]];for(let r=1;r<e.length;r++)if(t[e[r]]!==n)return!1;return!0};var P=class{pool;parallelThreshold;minChunkSize;isTerminated=!1;constructor(e={}){let t=e.maxWorkers??(navigator===void 0?4:navigator.hardwareConcurrency)??4;this.pool=new st("(function(){let e=(e,t)=>{let n=e;for(let e of t.split(`.`)){if(typeof n!=`object`||!n)return null;n=n[e]}return n??null},t=e=>e==null?``:Array.isArray(e)?e.join(`, `):typeof e==`object`&&!(e instanceof Date)?JSON.stringify(e):String(e),n=(e,n)=>{if(e==null&&n==null)return 0;if(e==null)return 1;if(n==null)return-1;let r=Number(e),i=Number(n);return!Number.isNaN(r)&&!Number.isNaN(i)?r-i:e instanceof Date&&n instanceof Date?e.getTime()-n.getTime():t(e).localeCompare(t(n))},r=(t,r)=>[...t].sort((t,i)=>{for(let{colId:a,direction:o}of r){let r=n(e(t,a),e(i,a));if(r!==0)return o===`asc`?r:-r}return 0}),i=e=>{let t=new Uint32Array(e);for(let n=0;n<e;n++)t[n]=n;return t},a=(e,t)=>{let n=new Float64Array(t.length);for(let r=0;r<t.length;r++)n[r]=e[t[r]];return n},o=(e,t,n)=>e.some(e=>e[t]!==e[n]),s=(e,t)=>{let n=e.length,r=[],i=0;for(let a=1;a<=n;a++)(a===n||o(t,e[a-1],e[a]))&&(a-i>1&&r.push(i,a),i=a);return new Uint32Array(r)},c=(e,t)=>{let n=i(e.length),r=t===`asc`?1:-1;return n.sort((t,n)=>{let i=e[t],a=e[n];return i<a?-1*r:i>a?1*r:t-n}),n},l=(e,t)=>{let n=e.length,r=i(e[0].length);return r.sort((r,i)=>{for(let a=0;a<n;a++){let n=e[a][r],o=e[a][i];if(n<o)return-1*t[a];if(n>o)return 1*t[a]}return r-i}),r},u=(e,t)=>{let n=e.length,r=i(e[0].length),a=t===`asc`?1:-1;return r.sort((t,r)=>{for(let i=0;i<n;i++){let n=e[i][t],o=e[i][r];if(n<o)return-1*a;if(n>o)return 1*a}return t-r}),{indices:r,collisionRuns:s(r,e)}},d={sort:e=>({type:`sorted`,payload:{data:r(e.data,e.sortModel)},transfer:[]}),sortIndices:e=>{let t=c(e.values,e.direction);return{type:`sortedIndices`,payload:{indices:t},transfer:[t.buffer]}},sortMultiColumn:e=>{let t=l(e.columns,e.directions);return{type:`sortedMultiColumn`,payload:{indices:t},transfer:[t.buffer]}},sortStringHashes:e=>{let t=u(e.hashChunks,e.direction);return{type:`sortedStringHashes`,payload:{indices:t.indices,collisionRuns:t.collisionRuns},transfer:[t.indices.buffer,t.collisionRuns.buffer]}},sortChunk:e=>{let t=c(e.values,e.direction),n=a(e.values,t);return{type:`sortedChunk`,payload:{indices:t,sortedValues:n,chunkOffset:e.chunkOffset},transfer:[t.buffer,n.buffer]}},sortStringChunk:e=>{let t=u(e.hashChunks,e.direction),n=a(e.hashChunks[0],t.indices);return{type:`sortedStringChunk`,payload:{indices:t.indices,sortedHashes:n,collisionRuns:t.collisionRuns,chunkOffset:e.chunkOffset},transfer:[t.indices.buffer,n.buffer,t.collisionRuns.buffer]}},sortMultiColumnChunk:e=>{let t=l(e.columns,e.directions),n=e.columns.map(e=>a(e,t));return{type:`sortedMultiColumnChunk`,payload:{indices:t,sortedColumns:n,chunkOffset:e.chunkOffset},transfer:[t.buffer,...n.map(e=>e.buffer)]}}},f=self;f.onmessage=e=>{let t=e.data,n=d[t.type];if(n)try{let e=n(t);f.postMessage({type:e.type,id:t.id,...e.payload},e.transfer)}catch(e){f.postMessage({type:`error`,id:t.id,error:String(e)})}}})();",{maxWorkers:t}),this.parallelThreshold=e.parallelThreshold??4e5,this.minChunkSize=e.minChunkSize??5e4}isAvailable(){return!this.isTerminated&&this.pool.isAvailable()}terminate(){this.pool.terminate(),this.isTerminated=!0}async sortIndices(e,t){return this.assertNotTerminated(),e.length<this.parallelThreshold?this.sortIndicesSingle(e,t):this.sortIndicesParallel(e,t)}async sortStringHashes(e,t,n){return this.assertNotTerminated(),(e[0]?.length??0)<this.parallelThreshold?this.sortStringHashesSingle(e,t,n):this.sortStringHashesParallel(e,t,n)}async sortMultiColumn(e,t){return this.assertNotTerminated(),(e[0]?.length??0)<this.parallelThreshold?this.sortMultiColumnSingle(e,t):this.sortMultiColumnParallel(e,t)}assertNotTerminated(){if(this.isTerminated)throw Error(`ParallelSortManager has been terminated`)}async sortIndicesSingle(e,t){let n=new Float64Array(e),r={type:`sortIndices`,id:0,values:n,direction:t};return(await this.pool.execute(r,[n.buffer])).indices}async sortStringHashesSingle(e,t,n){let r={type:`sortStringHashes`,id:0,hashChunks:e,direction:t},i=e.map(e=>e.buffer),a=await this.pool.execute(r,i);return a.collisionRuns.length>0&&N(a.indices,a.collisionRuns,n,t),a.indices}async sortMultiColumnSingle(e,t){let n=e.map(e=>new Float64Array(e)),r=new Int8Array(t.map(e=>e===`asc`?1:-1)),i={type:`sortMultiColumn`,id:0,columns:n,directions:r},a=[...n.map(e=>e.buffer),r.buffer];return(await this.pool.execute(i,a)).indices}boundariesFor(e){return pt(e,this.pool.getMaxWorkers(),this.minChunkSize)}async runChunks(e){let t=await this.pool.executeParallel(e);return t.sort((e,t)=>e.chunkOffset-t.chunkOffset),t}async sortIndicesParallel(e,t){let n=this.boundariesFor(e.length).map(n=>{let r=new Float64Array(e.slice(n.offset,n.offset+n.length));return{request:{type:`sortChunk`,id:0,values:r,direction:t,chunkOffset:n.offset},transferables:[r.buffer]}});return M((await this.runChunks(n)).map(e=>({indices:e.indices,values:e.sortedValues,offset:e.chunkOffset})),t)}async sortStringHashesParallel(e,t,n){let r=this.boundariesFor(e[0].length).map(n=>{let r=e.map(e=>{let t=new Float64Array(n.length);return t.set(new Float64Array(e.buffer,n.offset*8,n.length)),t});return{request:{type:`sortStringChunk`,id:0,hashChunks:r,direction:t,chunkOffset:n.offset},transferables:r.map(e=>e.buffer)}}),i=await this.runChunks(r),a=i.map(e=>({indices:e.indices,values:e.sortedHashes,offset:e.chunkOffset})),o=_t(i),s=M(a,t),c=mt(a),l=new Uint32Array([...o,...c]);return l.length>0&&N(s,l,n,t),s}async sortMultiColumnParallel(e,t){let n=this.boundariesFor(e[0].length),r=new Int8Array(t.map(e=>e===`asc`?1:-1)),i=n.map(t=>{let n=e.map(e=>{let n=new Float64Array(t.length);for(let r=0;r<t.length;r++)n[r]=e[t.offset+r];return n}),i=new Int8Array(r);return{request:{type:`sortMultiColumnChunk`,id:0,columns:n,directions:i,chunkOffset:t.offset},transferables:[...n.map(e=>e.buffer),i.buffer]}});return ft((await this.runChunks(i)).map(e=>({indices:e.indices,columns:e.sortedColumns,directions:r,offset:e.chunkOffset})))}};const _t=e=>{let t=[];for(let n of e)for(let e=0;e<n.collisionRuns.length;e+=2)t.push(n.collisionRuns[e]+n.chunkOffset,n.collisionRuns[e+1]+n.chunkOffset);return t},vt=e=>e>=97&&e<=122?e-97:e>=48&&e<=57?e-48+26:0,F=(e,t)=>{let n=0;for(let r=0;r<10;r++){let i=t+r,a=i<e.length?e.codePointAt(i)??200:0;n=n*36+vt(a)}return n},I=e=>F(e.toLowerCase(),0);function yt(e,t){let n=e==null||Array.isArray(e)&&e.length===0,r=t==null||Array.isArray(t)&&t.length===0;if(n&&r)return 0;if(n)return 1;if(r)return-1;if(Array.isArray(e)||Array.isArray(t)){let n=Array.isArray(e)?e.join(`, `):x(e),r=Array.isArray(t)?t.join(`, `):x(t);return n.localeCompare(r)}let i=Number(e),a=Number(t);return!Number.isNaN(i)&&!Number.isNaN(a)?i-a:e instanceof Date&&t instanceof Date?e.getTime()-t.getTime():x(e).localeCompare(x(t))}function L(e){if(e==null)return Number.MAX_VALUE;if(typeof e==`number`)return e;if(e instanceof Date)return e.getTime();if(typeof e==`string`)return I(e);if(Array.isArray(e))return e.length===0?Number.MAX_VALUE:I(e.join(`, `));if(typeof e==`object`)return I(JSON.stringify(e));let t=Number(e);return Number.isNaN(t)?0:t}function bt(e){let t=e.toLowerCase(),n=[];for(let e=0;e<3;e++)n.push(F(t,e*10));return n}function R(e,t,n){return[...e].sort((e,r)=>{for(let{colId:i,direction:a}of t){let t=yt(n(e,i),n(r,i));if(t!==0)return a===`asc`?t:-t}return 0})}const xt=(e,t,n)=>{for(let r of e){let e=n(r,t);if(e!=null)return typeof e==`string`||Array.isArray(e)||typeof e==`object`&&!(e instanceof Date)?`string`:`numeric`}return`numeric`},St=(e,t,n)=>{let r=[],i=Array.from({length:3},()=>[]);for(let a of e){let e=x(n(a,t));r.push(e);let o=bt(e);for(let e=0;e<3;e++)i[e].push(o[e])}return{originalStrings:r,hashChunkArrays:i.map(e=>new Float64Array(e))}},Ct=(e,t,n)=>e.map(e=>L(n(e,t))),wt=(e,t,n)=>{let r=[],i=[];for(let{colId:a,direction:o}of t)r.push(e.map(e=>L(n(e,a)))),i.push(o??`asc`);return{columnValues:r,directions:i}},Tt=(e,t)=>{let n=Array(e.length);for(let r=0;r<t.length;r++)n[r]=e[t[r]];return n},Et=async(e,t,n,r)=>{let{colId:i,direction:a}=t,o=a??`asc`;if(xt(e,i,r)===`string`){let{originalStrings:t,hashChunkArrays:a}=St(e,i,r);return n.sortStringHashes(a,o,t)}let s=Ct(e,i,r);return n.sortIndices(s,o)},Dt=async(e,t,n,r)=>{let{columnValues:i,directions:a}=wt(e,t,r);return n.sortMultiColumn(i,a)},z=async(e,t,n,r)=>{let i=t.length===1?await Et(e,t[0],n,r):await Dt(e,t,n,r);return Tt(e,i)};function B(e,t){return e.getFullYear()===t.getFullYear()&&e.getMonth()===t.getMonth()&&e.getDate()===t.getDate()}const Ot={contains:(e,t)=>e.includes(t),notContains:(e,t)=>!e.includes(t),equals:(e,t)=>e===t,notEquals:(e,t)=>e!==t,startsWith:(e,t)=>e.startsWith(t),endsWith:(e,t)=>e.endsWith(t),blank:(e,t,n)=>n,notBlank:(e,t,n)=>!n},V=new WeakMap,kt=e=>{let t=V.get(e);if(t?.size===e.size)return t.keys;let n=new Set;for(let t of e)n.add(D(t));return V.set(e,{size:e.size,keys:n}),n};function H(e,t,n){let r=O(e);if(t.selectedValues!==void 0)return r?t.includeBlank===!0:kt(t.selectedValues).has(D(e));let i=x(e,n).toLowerCase(),a=String(t.value??``).toLowerCase();return Ot[t.operator](i,a,r)}const At={"=":(e,t)=>e===t,"!=":(e,t)=>e!==t,">":(e,t)=>e>t,"<":(e,t)=>e<t,">=":(e,t)=>e>=t,"<=":(e,t)=>e<=t,between:(e,t,n)=>e>=t&&e<=n};function U(e,t){let n=e==null||e===``;if(t.operator===`blank`)return n;if(t.operator===`notBlank`)return!n;if(n)return!1;let r=typeof e==`number`?e:Number(e);if(Number.isNaN(r))return!1;let i=t.value??0,a=t.valueTo??0;return At[t.operator](r,i,a)}const jt={"=":(e,t)=>B(e,t),"!=":(e,t)=>!B(e,t),">":(e,t)=>e.getTime()>t.getTime(),"<":(e,t)=>e.getTime()<t.getTime(),between:(e,t,n)=>{let r=e.getTime();return r>=t.getTime()&&r<=n.getTime()}};function W(e,t){let n=e==null||e===``;if(t.operator===`blank`)return n;if(t.operator===`notBlank`)return!n;if(n)return!1;let r=e instanceof Date?e:new Date(x(e));if(Number.isNaN(r.getTime()))return!1;let i=t.value instanceof Date?t.value:new Date(String(t.value??``)),a=t.valueTo instanceof Date?t.valueTo:new Date(String(t.valueTo??``));return jt[t.operator](r,i,a)}function G(e,t,n){switch(t.type){case`text`:return H(e,t,n);case`number`:return U(e,t);case`date`:return W(e,t);default:return!0}}function K(e,t,n){if(!t.conditions||t.conditions.length===0)return!0;let r=t.conditions[0];if(!r)return!0;let i=G(e,r,n);for(let r=1;r<t.conditions.length;r++){let a=t.conditions[r-1],o=t.conditions[r],s=a.nextOperator??t.combination,c=G(e,o,n);s===`and`?i&&=c:i||=c}return i}function Mt(e,t,n,r){let i=Object.entries(t).filter(([,e])=>e!=null);if(i.length===0)return!0;for(let[t,a]of i){let i=n(e,t),o=r?.(t);if(!K(i,a,o))return!1}return!0}function q(e,t,n,r){let i=Object.entries(t).filter(([,e])=>typeof e==`string`?e.trim()!==``:e.conditions&&e.conditions.length>0);return i.length===0?e:e.filter(e=>{for(let[t,a]of i){let i=n(e,t),o=r?.(t);if(typeof a==`string`){if(!x(i,o).toLowerCase().includes(a.toLowerCase()))return!1;continue}if(!K(i,a,o))return!1}return!0})}function J(e,t={}){let{getFieldValue:n=g,getValueFormatter:r,useWorker:i=!0,parallelSort:a}=t,o=e,s=!1,c=i?new P(a===!1?{maxWorkers:1}:a):null;return{loadMode:`all`,async query(e){let t=o?[...o]:[];if(e.filter&&Object.keys(e.filter).length>0){let i=e.valueFormatters===null?r:t=>e.valueFormatters?.[t];t=q(t,e.filter,n,i)}e.sort&&e.sort.length>0&&(t=c&&c.isAvailable()&&t.length>=2e5?await z(t,e.sort,c,n):R(t,e.sort,n));let i=t.length;return{rows:t.slice(e.range.startRow,e.range.endRow),totalRows:i}},destroy(){s||(s=!0,o=null,c&&c.terminate())},moveRow(e,t){if(!o||e===t||e<0||e>=o.length||t<0||t>=o.length)return;let[n]=o.splice(e,1),r=t>e?t-1:t;o.splice(r,0,n)}}}function Y(e){return J(e)}function Nt(e,t={}){return{loadMode:t.loadMode??`paginated`,async query(t){return e(t)}}}var Pt=class{countsByField=new Map;clear(){this.countsByField.clear()}get(e){let t=this.countsByField.get(e);return t?Array.from(t.keys()):[]}rebuild(e){this.clear();for(let t of e)this.addRow(t)}addRow(e){Ft(e,(e,t)=>this.add(e,t))}removeRow(e){Ft(e,(e,t)=>this.remove(e,t))}replace(e,t,n){t!=null&&this.remove(e,t),n!=null&&this.add(e,n)}add(e,t){let n=this.countsByField.get(e);n||(n=new Map,this.countsByField.set(e,n)),It(t,e=>Lt(n,e))}remove(e,t){let n=this.countsByField.get(e);n!==void 0&&It(t,e=>Rt(n,e))}};const Ft=(e,t)=>{if(!(typeof e!=`object`||!e))for(let[n,r]of Object.entries(e))r!=null&&t(n,r)},It=(e,t)=>{if(Array.isArray(e)){for(let n of e)n!=null&&t(n);return}t(e)},Lt=(e,t)=>{e.set(t,(e.get(t)??0)+1)},Rt=(e,t)=>{let n=e.get(t);if(n!==void 0){if(n<=1){e.delete(t);return}e.set(t,n-1)}};var zt=class{rows=[];rowById=new Map;distinctValues=new Pt;options;constructor(e,t=[]){this.options={getRowId:e.getRowId,getFieldValue:e.getFieldValue??g},this.setData(t)}clear(){this.rows=[],this.rowById.clear(),this.distinctValues.clear()}setData(e){this.rows=[...e],this.rebuildIdIndex(),this.distinctValues.rebuild(this.rows)}getRowById(e){let t=this.rowById.get(e);return t===void 0?void 0:this.rows[t]}getTotalRowCount(){return this.rows.length}getAllRows(){return[...this.rows]}getDistinctValues(e){return this.distinctValues.get(e)}addRows(e){for(let t of e)this.addRow(t)}addRow(e){let t=this.options.getRowId(e);if(this.rowById.has(t)){console.warn(`Row with ID ${t} already exists. Skipping.`);return}this.rowById.set(t,this.rows.length),this.rows.push(e),this.distinctValues.addRow(e)}removeRows(e){let t=new Set;for(let n of e){let e=this.rowById.get(n);e!==void 0&&t.add(e)}if(t.size===0)return 0;let n=[];for(let e=0;e<this.rows.length;e++){let r=this.rows[e];if(t.has(e)){this.distinctValues.removeRow(r);continue}n.push(r)}return this.rows=n,this.rebuildIdIndex(),t.size}updateCell(e,t,n){let r=this.getRowById(e);if(r===void 0){console.warn(`Row with ID ${e} not found.`);return}let i=this.options.getFieldValue(r,t);_(r,t,n),this.distinctValues.replace(t,i,n)}updateRow(e,t){for(let[n,r]of Object.entries(t))this.updateCell(e,n,r)}moveRow(e,t){if(e===t||e<0||e>=this.rows.length||t<0||t>=this.rows.length)return;let[n]=this.rows.splice(e,1),r=t>e?t-1:t;this.rows.splice(r,0,n),this.rebuildIdIndex()}rebuildIdIndex(){this.rowById.clear();for(let e=0;e<this.rows.length;e++)this.rowById.set(this.options.getRowId(this.rows[e]),e)}};function Bt(e,t){let{getRowId:n,getFieldValue:r,getValueFormatter:i,debounceMs:a=50,onTransactionProcessed:o,useWorker:s=!0,parallelSort:c}=t,l=new zt({getRowId:n,getFieldValue:r??g},e),u=new Set,d=v().emit,f=s&&c!==!1?new P(c):null,p=new He({debounceMs:a,store:l,onProcessed:e=>{o?.(e);for(let t of u)t(e)}});return{loadMode:`all`,async query(e){if(p.hasPending()){d({type:`DATA_LOADING`});try{await p.flush()}finally{d({type:`DATA_LOADED`,totalRows:l.getTotalRowCount()})}}let t=l.getAllRows(),n=r??g;if(e.filter&&Object.keys(e.filter).length>0){let r=e.valueFormatters===null?i:t=>e.valueFormatters?.[t];t=q(t,e.filter,n,r)}if(e.sort&&e.sort.length>0)if(f&&f.isAvailable()&&t.length>=2e5){d({type:`DATA_LOADING`});try{t=await z(t,e.sort,f,n)}finally{d({type:`DATA_LOADED`,totalRows:t.length})}}else t=R(t,e.sort,n);let a=t.length;return{rows:t.slice(e.range.startRow,e.range.endRow),totalRows:a}},addRows(e){p.add(e)},removeRows(e){p.remove(e)},updateCell(e,t,n){p.updateCell(e,t,n)},updateRow(e,t){p.updateRow(e,t)},async flushTransactions(){await p.flush()},hasPendingTransactions(){return p.hasPending()},getDistinctValues(e){return l.getDistinctValues(e)},getRowById(e){return l.getRowById(e)},getTotalRowCount(){return l.getTotalRowCount()},subscribe(e){return u.add(e),()=>{u.delete(e)}},clear(){let e=l.getTotalRowCount();l.clear();let t={added:0,removed:e,updated:0};o?.(t);for(let e of u)e(t)},moveRow(e,t){l.moveRow(e,t)}}}const Vt=e=>({slots:new Map,activeCell:null,selectionRange:null,editingCell:null,peekCell:null,contentWidth:0,contentHeight:e?.initialHeight??0,viewportWidth:e?.initialWidth??0,viewportHeight:e?.initialHeight??0,rowsWrapperOffset:0,headers:new Map,filterPopup:null,isLoading:!1,error:null,totalRows:0,visibleRowRange:null,hoverPosition:null,columns:null,pendingScrollTop:null}),Ht=(e,t,n)=>{switch(e.type){case`CREATE_SLOT`:return t.set(e.slotId,{slotId:e.slotId,rowIndex:-1,rowData:{},translateY:0}),null;case`DESTROY_SLOT`:return t.delete(e.slotId),null;case`ASSIGN_SLOT`:{let n=t.get(e.slotId);return n&&t.set(e.slotId,{...n,rowIndex:e.rowIndex,rowData:e.rowData}),null}case`MOVE_SLOT`:{let n=t.get(e.slotId);return n&&t.set(e.slotId,{...n,translateY:e.translateY}),null}case`SCROLL_TO`:return{pendingScrollTop:e.scrollTop};case`SET_ACTIVE_CELL`:return{activeCell:e.position};case`SET_SELECTION_RANGE`:return{selectionRange:e.range};case`UPDATE_VISIBLE_RANGE`:return{visibleRowRange:{start:e.start,end:e.end},rowsWrapperOffset:e.rowsWrapperOffset};case`SET_HOVER_POSITION`:return{hoverPosition:e.position};case`START_EDIT`:return{editingCell:{row:e.row,col:e.col,initialValue:e.initialValue}};case`STOP_EDIT`:return{editingCell:null};case`START_PEEK`:return{peekCell:{row:e.row,col:e.col}};case`STOP_PEEK`:return{peekCell:null};case`SET_CONTENT_SIZE`:return{contentWidth:e.width,contentHeight:e.height,viewportWidth:e.viewportWidth,viewportHeight:e.viewportHeight,rowsWrapperOffset:e.rowsWrapperOffset};case`UPDATE_HEADER`:return n.set(e.colIndex,{column:e.column,sortDirection:e.sortDirection,sortIndex:e.sortIndex,hasFilter:e.hasFilter}),null;case`OPEN_FILTER_POPUP`:return{filterPopup:{isOpen:!0,colIndex:e.colIndex,column:e.column,anchorRect:e.anchorRect,distinctValues:e.distinctValues,currentFilter:e.currentFilter}};case`CLOSE_FILTER_POPUP`:return{filterPopup:null};case`DATA_LOADING`:return{isLoading:!0,error:null};case`DATA_LOADED`:return{isLoading:!1,totalRows:e.totalRows};case`DATA_ERROR`:return{isLoading:!1,error:e.error};case`COLUMNS_CHANGED`:return{columns:e.columns};default:return null}},X={filterTitle:`Filter: {column}`,and:`AND`,or:`OR`,valuePlaceholder:`Value`,betweenSeparator:`to`,addCondition:`+ Add condition`,removeCondition:`×`,clear:`Clear`,apply:`Apply`,valuesMode:`Values`,conditionMode:`Condition`,searchPlaceholder:`Search...`,selectAll:`Select All`,deselectAll:`Deselect All`,blanks:`(Blanks)`,tooManyValues:`Too many unique values ({count}). Use conditions to filter.`,emptyState:`No data to display`,errorPrefix:`Error: {message}`,operators:{contains:`Contains`,notContains:`Does not contain`,startsWith:`Starts with`,endsWith:`Ends with`,equals:`Equals`,notEquals:`Does not equal`,greaterThan:`Greater than`,lessThan:`Less than`,greaterThanOrEqual:`Greater than or equal`,lessThanOrEqual:`Less than or equal`,between:`Between`,blank:`Is blank`,notBlank:`Is not blank`}},Ut=e=>({...X,...e,operators:{...X.operators,...e?.operators}}),Wt=(e,t={})=>e.replace(/\{(\w+)\}/g,(e,n)=>{let r=t[n];return r===void 0?e:String(r)}),Gt=e=>{let t=e.operators;return[{value:`contains`,label:t.contains},{value:`notContains`,label:t.notContains},{value:`equals`,label:t.equals},{value:`notEquals`,label:t.notEquals},{value:`startsWith`,label:t.startsWith},{value:`endsWith`,label:t.endsWith},{value:`blank`,label:t.blank},{value:`notBlank`,label:t.notBlank}]},Kt=e=>{let t=e.operators;return[{value:`=`,label:t.equals},{value:`!=`,label:t.notEquals},{value:`>`,label:t.greaterThan},{value:`<`,label:t.lessThan},{value:`>=`,label:t.greaterThanOrEqual},{value:`<=`,label:t.lessThanOrEqual},{value:`between`,label:t.between},{value:`blank`,label:t.blank},{value:`notBlank`,label:t.notBlank}]},qt=e=>{let t=e.operators;return[{value:`=`,label:t.equals},{value:`!=`,label:t.notEquals},{value:`>`,label:t.greaterThan},{value:`<`,label:t.lessThan},{value:`between`,label:t.between},{value:`blank`,label:t.blank},{value:`notBlank`,label:t.notBlank}]},Z=e=>({clientX:e.clientX,clientY:e.clientY,button:e.button,shiftKey:e.shiftKey,ctrlKey:e.ctrlKey,metaKey:e.metaKey,pointerId:e.pointerId,pointerType:e.pointerType});var Jt=class{intervalId=null;lastPointerEvent=null;getBodyEl;onTick;constructor(e,t){this.getBodyEl=e,this.onTick=t}recordPointer(e){this.lastPointerEvent=e}clearPointer(){this.lastPointerEvent=null}start(e,t){this.stop(),this.intervalId=setInterval(()=>{let n=this.getBodyEl();if(!n)return;n.scrollTop+=t,n.scrollLeft+=e;let r=this.lastPointerEvent;r&&this.onTick(r)},16)}stop(){this.intervalId!==null&&(clearInterval(this.intervalId),this.intervalId=null)}},Yt=class{timer=null;capture=null;savedContainerOverflow=null;blockTouchMove=e=>e.preventDefault();deps;constructor(e){this.deps=e}start(e){this.reset(),this.capture={pointerId:e.pointerId,target:e.currentTarget};let t=e.clientX,n=e.clientY,r=e=>{let r=e.clientX-t,i=e.clientY-n;(Math.abs(r)>10||Math.abs(i)>10)&&(this.cancel(),a())},i=()=>{this.cancel(),a()},a=()=>{document.removeEventListener(`pointermove`,r),document.removeEventListener(`pointerup`,i),document.removeEventListener(`pointercancel`,i)};document.addEventListener(`pointermove`,r),document.addEventListener(`pointerup`,i,{once:!0}),document.addEventListener(`pointercancel`,i,{once:!0}),this.timer=setTimeout(()=>{this.timer=null,a(),this.confirm()},300)}cancel(){this.reset(),this.deps.getCore()?.input.cancelPendingRowDrag()}reset(){this.timer!==null&&(clearTimeout(this.timer),this.timer=null),this.capture=null}releaseLocks(){if(!this.deps.isBrowser)return;let e=this.deps.getContainer();this.savedContainerOverflow!==null&&e&&(e.style.overflow=this.savedContainerOverflow),this.savedContainerOverflow=null,document.removeEventListener(`touchmove`,this.blockTouchMove)}confirm(){let e=this.deps.getCore(),t=this.capture;this.capture=null,e!==null&&e.input.confirmPendingRowDrag()&&(this.lockContainer(),document.addEventListener(`touchmove`,this.blockTouchMove,{passive:!1}),this.applyPointerCapture(t),this.deps.onDragConfirmed(e.input.getDragState()))}lockContainer(){let e=this.deps.getContainer();e&&(this.savedContainerOverflow=e.style.overflow,e.style.overflow=`hidden`)}applyPointerCapture(e){e&&Xt(e.target,e.pointerId)}};const Xt=(e,t)=>{try{return e.setPointerCapture(t),!0}catch{return!1}};var Zt=class{cleanup=null;deps;constructor(e){this.deps=e}start(e){if(!this.deps.isBrowser)return;this.detachListeners();let t=e.clientX,n=e.clientY,r=e=>{let r=e.clientX-t,i=e.clientY-n;(Math.abs(r)>10||Math.abs(i)>10)&&this.cancel()},i=()=>{this.cancel()},a=()=>{this.detachListeners(),this.deps.getCore()?.input.confirmPendingCellTap()&&this.deps.onTapConfirmed()};document.addEventListener(`pointermove`,r),document.addEventListener(`pointerup`,a,{once:!0}),document.addEventListener(`pointercancel`,i,{once:!0}),this.cleanup=()=>{document.removeEventListener(`pointermove`,r),document.removeEventListener(`pointerup`,a),document.removeEventListener(`pointercancel`,i)}}cancel(){this.detachListeners(),this.deps.getCore()?.input.cancelPendingCellTap()}detachListeners(){this.cleanup!==null&&(this.cleanup(),this.cleanup=null)}};const Qt=e=>150*e/1e3,Q=(e,t)=>e.filter(e=>t-e.time<=100),$t=(e,t=640)=>{let n=e[0],r=e.at(-1);if(n===void 0||r===void 0||n===r)return 0;let i=r.time-n.time;if(i<=0)return 0;let a=(r.position-n.position)/i,o=Math.min(2.4,t);return Math.max(-o,Math.min(o,a))},en=(e,t,n=640)=>{let r=e*t>0?e+t*4:e;return Math.max(-n,Math.min(n,r))},tn=(e,t)=>{if(t>1500)return e;if(e===null)return t;let n=t>e?.5:.15;return e+(t-e)*n},nn=(e,t=640)=>{if(e===null||e<=0)return t;let n=Math.max(250,t*17)/e;return Math.max(.25,Math.min(t,n))},rn=(e,t)=>({position:e.position+e.velocity*Math.min(t,64),velocity:e.velocity*Math.exp(-t/1200)}),an=e=>Math.abs(e)<.01;var on=class{overrideActive=!1;lastPipelineRunMs=null;pipelineIntervalEmaMs=null;getCore;getEl;constructor(e,t){this.getCore=e,this.getEl=t}get pipelineIntervalMs(){return this.pipelineIntervalEmaMs}get lastRunMs(){return this.lastPipelineRunMs}apply(e,t,n,r){r!==null&&this.lastPipelineRunMs!==null&&(this.pipelineIntervalEmaMs=tn(this.pipelineIntervalEmaMs,r-this.lastPipelineRunMs)),this.lastPipelineRunMs=r,this.overrideActive=!0,e.setScrollTopOverride(n),t.scrollTop=n,e.setViewport(n,t.scrollLeft,t.clientWidth,t.clientHeight)}release(){if(this.overrideActive===!1)return;this.overrideActive=!1;let e=this.getCore();if(e===null)return;e.setScrollTopOverride(null);let t=this.getEl();t!==null&&e.setViewport(t.scrollTop,t.scrollLeft,t.clientWidth,t.clientHeight)}};const $=(e,t,n)=>Math.min(Math.max(e,t),Math.max(t,n)),sn=e=>(e!==null&&globalThis.cancelAnimationFrame?.(e),null);var cn=class{frame=null;velocity=0;throttled=!1;frameIntervalEmaMs=null;scroll;constructor(e){this.scroll=e}get currentVelocity(){return this.frame===null?0:this.velocity}stop(){this.frame=sn(this.frame)}start(e,t,n){let r=globalThis.requestAnimationFrame;if(r===void 0)return;let i=e.getMaxFlingVelocity(),a=Qt(e.getRowHeight()),o=e.getScrollRatio(),s=()=>nn(this.scroll.pipelineIntervalMs,i),c=s(),l={position:t.scrollTop/o,velocity:$(n,-c,c)},u=null;this.velocity=l.velocity,this.throttled=!1;let d=n=>{this.frame=null;let i=this.measureFrame(n,u);u=n,l=rn(l,i);let c=s();l={...l,velocity:$(l.velocity,-c,c)},this.velocity=l.velocity,this.updateThrottle(l.velocity,a);let f=l.position*o,p=$(f,0,t.scrollHeight-t.clientHeight),m=p!==f,h=an(l.velocity)||m;if(h||this.isPipelineDue(n)?this.scroll.apply(e,t,p,n):t.scrollTop=p,h){this.scroll.release();return}this.frame=r(d)};this.frame=r(d)}measureFrame(e,t){if(t===null)return 16;let n=e-t;return this.frameIntervalEmaMs=tn(this.frameIntervalEmaMs,n),n}updateThrottle(e,t){if(Math.abs(e)<=t){this.throttled=!1;return}let n=this.frameIntervalEmaMs;n!==null&&n>28&&(this.throttled=!0)}isPipelineDue(e){if(this.throttled===!1)return!0;let t=this.scroll.lastRunMs;return t===null||e-t>=100}};const ln=(e,t,n,r)=>({touchId:e.identifier,startClientX:e.clientX,startClientY:e.clientY,baseScrollTop:t.scrollTop,baseScrollLeft:t.scrollLeft,engaged:!1,slopOffsetX:0,slopOffsetY:0,samples:[{time:n,position:0}],carriedVelocity:r,expectedScrollTop:t.scrollTop,expectedScrollLeft:t.scrollLeft}),un=(e,t)=>Array.from(t.changedTouches).find(t=>t?.identifier===e.touchId)??null,dn=(e,t)=>{let n=Math.abs(t.scrollTop-e.expectedScrollTop),r=Math.abs(t.scrollLeft-e.expectedScrollLeft);return n>4||r>4},fn=(e,t,n)=>e.engaged?!0:Math.abs(t)<=10&&Math.abs(n)<=10?!1:(e.engaged=!0,e.slopOffsetX=t,e.slopOffsetY=n,!0),pn=(e,t,n,r,i)=>({top:$(e.baseScrollTop+(i-e.slopOffsetY)*n,0,t.scrollHeight-t.clientHeight),left:$(e.baseScrollLeft+(r-e.slopOffsetX),0,t.scrollWidth-t.clientWidth)});var mn=class{savedOverscrollBehavior;savedTouchAction;subscribedCore=null;unsubscribe=null;el;getCore;constructor(e,t){this.el=e,this.getCore=t,this.savedOverscrollBehavior=e.style.overscrollBehavior,this.savedTouchAction=e.style.touchAction}sync(){this.syncSubscription(),this.apply()}dispose(){this.unsubscribe?.(),this.unsubscribe=null,this.subscribedCore=null,this.el.style.overscrollBehavior=this.savedOverscrollBehavior,this.el.style.touchAction=this.savedTouchAction}syncSubscription(){let e=this.getCore();e!==this.subscribedCore&&(this.unsubscribe?.(),this.unsubscribe=null,this.subscribedCore=e,e!==null&&(this.unsubscribe=e.onBatchInstruction(e=>{e.some(e=>e.type===`SET_CONTENT_SIZE`)&&this.apply()})))}apply(){let e=this.getCore()?.isScalingActive()===!0,t=e?`none`:this.savedTouchAction,n=e?`contain`:this.savedOverscrollBehavior,r=this.el.style;r.touchAction!==t&&(r.touchAction=t),r.overscrollBehavior!==n&&(r.overscrollBehavior=n)}},hn=class{deps;scroll;fling;attachedEl=null;policy=null;gesture=null;gestureCleanup=null;dragFrame=null;pendingDragTarget=null;constructor(e){this.deps=e,this.scroll=new on(e.getCore,()=>this.attachedEl),this.fling=new cn(this.scroll)}attach(){if(this.deps.isBrowser===!1||this.attachedEl!==null)return;let e=this.deps.getScrollEl();e!==null&&(this.attachedEl=e,this.policy=new mn(e,this.deps.getCore),this.policy.sync(),e.addEventListener(`touchstart`,this.onTouchStart,{passive:!0}),e.addEventListener(`wheel`,this.onWheel,{passive:!0}))}detach(){this.stop(),this.clearGesture();let e=this.attachedEl;e!==null&&(this.attachedEl=null,e.removeEventListener(`touchstart`,this.onTouchStart),e.removeEventListener(`wheel`,this.onWheel),this.policy?.dispose(),this.policy=null)}syncCore(){this.policy?.sync()}stop(){this.fling.stop(),this.scroll.release()}resolveContext(){let e=this.deps.getCore(),t=this.attachedEl;return e===null||t===null?null:{core:e,el:t}}onWheel=()=>{this.stop(),this.syncCore()};onTouchStart=e=>{this.syncCore(),this.gesture===null&&this.startTouchGesture(e)};startTouchGesture(e){let t=this.fling.currentVelocity;this.stop();let n=this.resolveContext();if(n===null||n.core.isScalingActive()===!1||e.target?.closest(`.gp-grid-fill-handle, .gp-grid-cell--row-drag-handle`))return;let r=e.changedTouches[0];r!==void 0&&(this.gesture=ln(r,n.el,e.timeStamp,t),this.attachGestureListeners(n.el))}attachGestureListeners(e){e.addEventListener(`touchmove`,this.onTouchMove,{passive:!1}),e.addEventListener(`touchend`,this.onTouchEnd,{passive:!0}),e.addEventListener(`touchcancel`,this.onTouchCancel,{passive:!0}),this.gestureCleanup=()=>{e.removeEventListener(`touchmove`,this.onTouchMove),e.removeEventListener(`touchend`,this.onTouchEnd),e.removeEventListener(`touchcancel`,this.onTouchCancel)}}clearGesture(){this.gesture=null,this.gestureCleanup?.(),this.gestureCleanup=null,this.dragFrame=sn(this.dragFrame),this.pendingDragTarget=null}abandonGesture(){this.clearGesture(),this.scroll.release()}trackedTouch(e){return this.gesture===null?null:un(this.gesture,e)}onTouchMove=e=>{let t=this.gesture,n=this.trackedTouch(e),r=this.resolveContext();if(t===null||n===null||r===null)return;if(r.core.input.getDragState().isDragging){this.abandonGesture();return}if(dn(t,r.el)){this.abandonGesture();return}e.cancelable&&e.preventDefault();let i=t.startClientX-n.clientX,a=t.startClientY-n.clientY;t.samples.push({time:e.timeStamp,position:a}),t.samples=Q(t.samples,e.timeStamp),fn(t,i,a)!==!1&&(this.pendingDragTarget=pn(t,r.el,r.core.getScrollRatio(),i,a),this.scheduleDragApply(r))};scheduleDragApply(e){if(this.dragFrame!==null)return;let t=globalThis.requestAnimationFrame;if(t===void 0){this.flushPendingDrag(e,null);return}this.dragFrame=t(t=>{this.dragFrame=null,this.flushPendingDrag(e,t)})}flushPendingDrag(e,t){let n=this.pendingDragTarget;n!==null&&(this.pendingDragTarget=null,this.applyDragTarget(e,n,t))}applyDragTarget(e,t,n){e.el.scrollLeft=t.left,this.gesture!==null&&(this.gesture.expectedScrollTop=t.top,this.gesture.expectedScrollLeft=t.left),this.scroll.apply(e.core,e.el,t.top,n)}onTouchEnd=e=>{let t=this.gesture;if(t===null||this.trackedTouch(e)===null)return;let n=this.pendingDragTarget;this.clearGesture();let r=this.resolveContext();if(r===null){this.scroll.release();return}if(n!==null&&this.applyDragTarget(r,n,e.timeStamp),t.engaged===!1)return;let i=r.core.getMaxFlingVelocity(),a=$t(Q(t.samples,e.timeStamp),i);if(Math.abs(a)<.25){this.scroll.release();return}let o=en(a,t.carriedVelocity,i);this.fling.start(r.core,r.el,o)};onTouchCancel=e=>{this.trackedTouch(e)!==null&&this.abandonGesture()}};const gn=(e,t,n,r)=>{let i={slots:new Map(t),headers:new Map(n)};for(let t of e){let e=Ht(t,i.slots,i.headers);e!==null&&_n(e,i,r)}return i},_n=(e,t,n)=>{e.slots!==void 0&&yn(t.slots,e.slots),e.headers!==void 0&&yn(t.headers,e.headers),vn(e,n),e.columns!==void 0&&e.columns!==null&&n.setColumnsOverride(e.columns),e.filterPopup!==void 0&&n.onFilterPopupChange(e.filterPopup)},vn=(e,t)=>{e.contentWidth!==void 0&&t.setContentWidth(e.contentWidth),e.contentHeight!==void 0&&t.setContentHeight(e.contentHeight),e.rowsWrapperOffset!==void 0&&t.setRowsWrapperOffset(e.rowsWrapperOffset),e.isLoading!==void 0&&t.setIsLoading(e.isLoading),e.error!==void 0&&t.setErrorMessage(e.error),e.totalRows!==void 0&&t.setTotalRows(e.totalRows),e.pendingScrollTop!==void 0&&t.setPendingScrollTop(e.pendingScrollTop),e.activeCell!==void 0&&t.setActiveCell(e.activeCell),e.selectionRange!==void 0&&t.setSelectionRange(e.selectionRange),e.editingCell!==void 0&&t.setEditingCell(e.editingCell),e.hoverPosition!==void 0&&t.setHoverPosition(e.hoverPosition),e.peekCell!==void 0&&t.setPeekCell(e.peekCell)},yn=(e,t)=>{e.clear(),t.forEach((t,n)=>e.set(n,t))};var bn=class{owned=null;lastAppliedRows=null;lastAppliedColumns=null;initialize(e,t){return e===null?(this.owned=Y(t),this.lastAppliedRows=t,this.owned):e}syncRows(e,t){return t!==null||this.lastAppliedRows===e?null:(this.lastAppliedRows=e,e.length>1e4&&console.warn(`[gp-grid] rows input changed with ${e.length} rows — this triggers a full rebuild. Use createGridData() for efficient updates.`),this.owned?.destroy?.(),this.owned=Y(e),this.owned)}syncColumns(e){return e.length===0||this.lastAppliedColumns===e?!1:(this.lastAppliedColumns=e,!0)}destroy(){this.owned?.destroy?.(),this.owned=null}},xn=class{deps;constructor(e){this.deps=e}headerPointerDown(e,t,n,r){let i=this.deps.getCore();return i!==null&&i.input.handleHeaderMouseDown(e,t,n,Z(r)).preventDefault}resizePointerDown(e,t,n){let r=this.deps.getCore();return r!==null&&r.input.handleHeaderResizeMouseDown(e,t,Z(n)).preventDefault}cellPointerDown(e,t,n){let r=this.deps.getCore();if(r===null)return{preventDefault:!1,focusContainer:!1};let i=r.input.handleCellMouseDown(e,t,Z(n));return this.dispatchCellDragStart(i,n),{preventDefault:i.preventDefault,focusContainer:i.focusContainer??!1}}cellPointerEnter(e,t){this.deps.getCore()?.input.handleCellMouseEnter(e,t)}cellPointerLeave(){this.deps.getCore()?.input.handleCellMouseLeave()}fillHandlePointerDown(e,t,n){let r=this.deps.getCore();if(r===null)return{preventDefault:!1,stopPropagation:!1};let i=r.input.handleFillHandleMouseDown(e,t,Z(n));return i.startDrag===`fill`&&(Sn(n),this.deps.onDragStateChange(r.input.getDragState())),{preventDefault:i.preventDefault,stopPropagation:i.stopPropagation}}dragMove(e){let t=this.deps.getCore(),n=this.deps.getBodyEl();if(t===null||n===null)return;let r=n.getBoundingClientRect(),i=t.input.handleDragMove(Z(e),{top:r.top,left:r.left,width:r.width,height:r.height,scrollTop:n.scrollTop,scrollLeft:n.scrollLeft});this.deps.onDragStateChange(t.input.getDragState()),i?.autoScroll?this.deps.autoScroll.start(i.autoScroll.dx,i.autoScroll.dy):this.deps.autoScroll.stop()}documentPointerMove(e){let t=this.deps.getCore();if(t===null)return!1;let n=t.input.getDragState().isDragging;return this.deps.autoScroll.recordPointer(e),this.dragMove(e),n}documentPointerUp(){let e=this.deps.getCore();if(e===null)return{wasRowDrag:!1};let t=e.input.getDragState().dragType===`row-drag`;return this.deps.autoScroll.stop(),this.deps.autoScroll.clearPointer(),e.input.handleDragEnd(),this.deps.onDragStateChange(e.input.getDragState()),{wasRowDrag:t}}wheel(e,t,n){let r=this.deps.getCore();return r===null?null:r.input.handleWheel(e,t,n)}keyDown(e,t,n,r){let i=this.deps.getCore();return i===null?{preventDefault:!1}:i.input.handleKeyDown({key:e.key,shiftKey:e.shiftKey,ctrlKey:e.ctrlKey,metaKey:e.metaKey},t,n,r)}pasteText(e,t,n){let r=this.deps.getCore();return r===null||t!==null||n?!1:r.pasteClipboardText(e)}dispatchCellDragStart(e,t){let n=this.deps.getCore();if(n!==null){if(e.startTap===!0&&this.deps.pendingCellTap.start(t),e.startDrag===`selection`){n.input.startSelectionDrag(),this.deps.onDragStateChange(n.input.getDragState());return}if(e.startDrag===`row-drag`){this.deps.onDragStateChange(n.input.getDragState());return}e.startDrag===`row-drag-pending`&&this.deps.pendingRowDrag.start(t)}}};const Sn=e=>{e.target.setPointerCapture(e.pointerId)};export{Jt as AutoScrollDriver,bn as DataSourceOwner,ot as GridCore,zt as IndexedDataStore,xn as InputEventAdapter,Ce as InputHandler,Zt as PendingCellTapController,Yt as PendingRowDragController,ve as ROW_DRAG_HOLD_MS,_e as TAP_SLOP_PX,hn as TouchScrollController,He as TransactionManager,gn as applyBatchInstructions,Ht as applyInstruction,ae as bindPeekSelectAll,p as buildCellClasses,n as calculateColumnPositions,re as calculateFillHandlePosition,ie as calculateFilterPopupPosition,i as calculateScaledColumnPositions,J as createClientDataSource,Y as createDataSourceFromArray,Vt as createInitialState,Bt as createMutableClientDataSource,Nt as createServerDataSource,X as defaultGridLabels,K as evaluateColumnFilter,W as evaluateDateCondition,U as evaluateNumberCondition,H as evaluateTextCondition,a as findColumnAtX,x as formatCellValue,Wt as formatLabel,qt as getDateOperatorOptions,g as getFieldValue,Kt as getNumberOperatorOptions,Gt as getTextOperatorOptions,r as getTotalWidth,Re as groupDistinctValues,O as isBlankCellValue,l as isCellActive,d as isCellEditing,f as isCellInFillPreview,c as isCellSelected,u as isRowVisible,B as isSameDay,ze as labelsForSelectedValues,D as rawValueKey,Be as rawValuesForLabels,Ut as resolveGridLabels,Mt as rowPassesFilter,ne as scrollCellIntoView,_ as setFieldValue,Z as toPointerEventData};
|
|
4
|
+
`),Ke=e=>{let t=F(e).split(`
|
|
5
|
+
`);return t.length>1&&t.at(-1)===``&&t.pop(),t.map(e=>e.split(` `).map(e=>({value:e,text:e})))},qe=(e,t)=>{if(e.value===null)return{ok:!0,value:null};let n=e.text,r=n.trim();if(r.length===0)return Je(t);switch(t.cellDataType){case`text`:return{ok:!0,value:n};case`number`:return Ye(e.value,r);case`boolean`:return Xe(e.value,r);case`date`:case`dateTime`:return Ze(e.value,r);case`dateString`:case`dateTimeString`:return Qe(r,n);case`object`:return $e(e.value,r)}},Je=e=>e.cellDataType===`text`?{ok:!0,value:``}:{ok:!0,value:null},Ye=(e,t)=>{if(typeof e==`number`&&Number.isFinite(e))return{ok:!0,value:e};let n=Number(t);return Number.isFinite(n)?{ok:!0,value:n}:{ok:!1}},Xe=(e,t)=>{if(typeof e==`boolean`)return{ok:!0,value:e};let n=t.toLowerCase();return n===`true`?{ok:!0,value:!0}:n===`false`?{ok:!0,value:!1}:{ok:!1}},Ze=(e,t)=>{if(e instanceof Date&&I(e))return{ok:!0,value:e};let n=new Date(t);return I(n)?{ok:!0,value:n}:{ok:!1}},Qe=(e,t)=>{let n=new Date(e);return I(n)?{ok:!0,value:t}:{ok:!1}},$e=(e,t)=>{if(typeof e==`object`&&e&&!(e instanceof Date))return{ok:!0,value:e};try{let e=JSON.parse(t);if(typeof e==`object`&&e)return{ok:!0,value:e}}catch{return{ok:!1}}return{ok:!1}},I=e=>Number.isFinite(e.getTime());var et=class{state={activeCell:null,range:null,anchor:null,selectionMode:!1};options;emitter=v();clipboardSnapshot=null;onInstruction=this.emitter.onInstruction;emit=this.emitter.emit;constructor(e){this.options=e}getState(){return{...this.state}}getActiveCell(){return this.state.activeCell}getSelectionRange(){return this.state.range}isSelected(e,t){let{range:n}=this.state;if(!n)return!1;let{minRow:r,maxRow:i,minCol:a,maxCol:s}=o(n);return e>=r&&e<=i&&t>=a&&t<=s}isActiveCell(e,t){let{activeCell:n}=this.state;return n?.row===e&&n?.col===t}startSelection(e,t={}){let{shift:n=!1,ctrl:r=!1}=t,{row:i,col:a}=this.clampPosition(e);n&&this.state.anchor?(this.state.range={startRow:this.state.anchor.row,startCol:this.state.anchor.col,endRow:i,endCol:a},this.state.activeCell={row:i,col:a}):(this.state.activeCell={row:i,col:a},this.state.anchor={row:i,col:a},this.state.range=null),this.state.selectionMode=r,this.emit({type:`SET_ACTIVE_CELL`,position:this.state.activeCell}),this.emit({type:`SET_SELECTION_RANGE`,range:this.state.range})}moveFocus(e,t=!1){if(!this.state.activeCell){this.startSelection({row:0,col:0});return}let{row:n,col:r}=this.state.activeCell,i=n,a=r;switch(e){case`up`:i=Math.max(0,n-1);break;case`down`:i=Math.min(this.options.getRowCount()-1,n+1);break;case`left`:a=Math.max(0,r-1);break;case`right`:a=Math.min(this.options.getColumnCount()-1,r+1);break}t?(this.state.anchor??={row:n,col:r},this.state.range={startRow:this.state.anchor.row,startCol:this.state.anchor.col,endRow:i,endCol:a},this.state.activeCell={row:i,col:a},this.emit({type:`SET_ACTIVE_CELL`,position:this.state.activeCell}),this.emit({type:`SET_SELECTION_RANGE`,range:this.state.range})):(this.state.activeCell={row:i,col:a},this.state.anchor={row:i,col:a},this.state.range=null,this.emit({type:`SET_ACTIVE_CELL`,position:this.state.activeCell}),this.emit({type:`SET_SELECTION_RANGE`,range:null}))}selectAll(){let e=this.options.getRowCount(),t=this.options.getColumnCount();e!==0&&t!==0&&(this.state.range={startRow:0,startCol:0,endRow:e-1,endCol:t-1},this.state.activeCell||(this.state.activeCell={row:0,col:0},this.emit({type:`SET_ACTIVE_CELL`,position:this.state.activeCell})),this.emit({type:`SET_SELECTION_RANGE`,range:this.state.range}))}clearSelection(){this.state.activeCell=null,this.state.range=null,this.state.anchor=null,this.state.selectionMode=!1,this.emit({type:`SET_ACTIVE_CELL`,position:null}),this.emit({type:`SET_SELECTION_RANGE`,range:null})}setActiveCell(e,t){let n=this.clampPosition({row:e,col:t});this.state.activeCell=n,this.state.anchor=n,this.state.range=null,this.emit({type:`SET_ACTIVE_CELL`,position:this.state.activeCell}),this.emit({type:`SET_SELECTION_RANGE`,range:null})}setSelectionRange(e){this.state.range=e,this.emit({type:`SET_SELECTION_RANGE`,range:this.state.range})}getSelectedData(){let e=this.getEffectiveRange();if(e===null)return[];let{minRow:t,maxRow:n,minCol:r,maxCol:i}=o(e),a=[];for(let e=t;e<=n;e++){let t=[];for(let n=r;n<=i;n++)t.push(this.options.getCellValue(e,n));a.push(t)}return a}async copySelectionToClipboard(){let e=this.getEffectiveRange();if(e===null)return;let t=this.createClipboardSnapshot(e);t.cells.length!==0&&(this.clipboardSnapshot=t,!(typeof navigator>`u`||typeof document>`u`)&&await navigator.clipboard.writeText(t.text))}pasteClipboardText(e){let t=this.getEffectiveRange();if(t===null)return{handled:!1,changedCells:[]};let n=this.getPasteSourceCells(e);return n.length===0?{handled:!1,changedCells:[]}:{handled:!0,changedCells:this.applyPasteSource(n,t,this.state.range!==null)}}destroy(){this.emitter.clearListeners(),this.state={activeCell:null,range:null,anchor:null,selectionMode:!1},this.clipboardSnapshot=null}clampPosition(e){let t=this.options.getRowCount(),n=this.options.getColumnCount();return{row:Math.max(0,Math.min(e.row,t-1)),col:Math.max(0,Math.min(e.col,n-1))}}getEffectiveRange(){let{range:e,activeCell:t}=this.state;return e||(t?{startRow:t.row,startCol:t.col,endRow:t.row,endCol:t.col}:null)}createClipboardSnapshot(e){let{minRow:t,maxRow:n,minCol:r,maxCol:i}=o(e),a=[];for(let e=t;e<=n;e++){let t=[];for(let n=r;n<=i;n++){let r=this.options.getCellValue(e,n),i=x(r,this.options.getColumn(n)?.valueFormatter);t.push({value:r,text:i})}a.push(t)}return{cells:a,text:a.map(e=>e.map(e=>e.text).join(` `)).join(`
|
|
6
|
+
`)}}getPasteSourceCells(e){let t=this.clipboardSnapshot;return t&&F(t.text)===F(e)?t.cells:Ke(e)}applyPasteSource(e,t,n){let r=[],{minRow:i,maxRow:a,minCol:s,maxCol:c}=o(t),l=this.isSingleSourceCell(e),u=l?a:i+e.length-1,d=l?c:s+this.getMaxSourceColumnCount(e)-1,f=n?Math.min(u,a):u,p=n?Math.min(d,c):d,m=this.options.getRowCount(),h=this.options.getColumnCount(),g=Math.min(f,m-1),_=Math.min(p,h-1);for(let t=i;t<=g;t++)for(let n=s;n<=_;n++){let a=this.getSourceCellForTarget(e,t-i,n-s,l);a&&this.applyPasteCell(t,n,a,r)}return r}applyPasteCell(e,t,n,r){let i=this.options.getColumn(t);if(i===void 0||i.hidden===!0||i.editable!==!0)return;let a=qe(n,i);a.ok!==!1&&(this.options.setCellValue(e,t,a.value),r.push({row:e,col:t,value:a.value}))}getSourceCellForTarget(e,t,n,r){return r?e[0]?.[0]??null:e[t]?.[n]??null}isSingleSourceCell(e){return e.length===1&&e[0]?.length===1}getMaxSourceColumnCount(e){return e.reduce((e,t)=>Math.max(e,t.length),0)}},tt=class{state=null;options;emitter=v();onInstruction=this.emitter.onInstruction;emit=this.emitter.emit;constructor(e){this.options=e}getState(){return this.state?{...this.state}:null}isActive(){return this.state!==null}startFillDrag(e){this.state={sourceRange:e,targetRow:e.endRow,targetCol:e.endCol},this.emit({type:`START_FILL`,sourceRange:e})}updateFillDrag(e,t){if(!this.state)return;let n=this.options.getRowCount(),r=this.options.getColumnCount();e=Math.max(0,Math.min(e,n-1)),t=Math.max(0,Math.min(t,r-1)),this.state.targetRow=e,this.state.targetCol=t,this.emit({type:`UPDATE_FILL`,targetRow:e,targetCol:t})}commitFillDrag(){if(!this.state)return;let{sourceRange:e,targetRow:t}=this.state,n=this.calculateFilledCells(e,t);for(let{row:e,col:t,value:r}of n)this.options.setCellValue(e,t,r);this.emit({type:`COMMIT_FILL`,filledCells:n}),this.state=null}cancelFillDrag(){this.state&&(this.state=null,this.emit({type:`CANCEL_FILL`}))}destroy(){this.emitter.clearListeners(),this.state=null}calculateFilledCells(e,t){let n=[],{minRow:r,maxRow:i,minCol:a,maxCol:s}=o(e),c=t>i,l=t<r;if(c||l)for(let e=a;e<=s;e++){let a=this.getSourceColumnValues(r,i,e),o=this.detectPattern(a);if(c)for(let r=i+1;r<=t;r++){let t=r-i-1,s=this.applyPattern(o,a,t);n.push({row:r,col:e,value:s})}else if(l)for(let i=r-1;i>=t;i--){let t=r-i-1,s=this.applyPattern(o,a,t,!0);n.push({row:i,col:e,value:s})}}return n}getSourceColumnValues(e,t,n){let r=[];for(let i=e;i<=t;i++)r.push(this.options.getCellValue(i,n));return r}detectPattern(e){if(e.length===0)return{type:`constant`,value:null};if(e.length===1)return{type:`constant`,value:e[0]??null};let t=e.map(e=>typeof e==`number`?e:Number(e));if(t.every(e=>!Number.isNaN(e))){let e=[];for(let n=1;n<t.length;n++)e.push(t[n]-t[n-1]);if(e.every(t=>t===e[0])&&e[0]!==void 0)return{type:`arithmetic`,start:t[0],step:e[0]}}return{type:`repeat`,values:e}}applyPattern(e,t,n,r=!1){switch(e.type){case`constant`:return e.value;case`arithmetic`:{let i=r?-(n+1):n+1;return(r?e.start:e.start+e.step*(t.length-1))+e.step*i}case`repeat`:{let t=e.values.length;if(t===0)return null;if(r){let r=(t-1-n%t+t)%t;return e.values[r]??null}return e.values[n%t]??null}}}},nt=class{state={slots:new Map,rowToSlot:new Map,nextSlotId:0};options;emitter=y();isDestroyed=!1;onInstruction=this.emitter.onInstruction;onBatchInstruction=this.emitter.onBatchInstruction;emit=this.emitter.emit;emitBatch=this.emitter.emitBatch;constructor(e){this.options=e}getSlotForRow(e){return this.state.rowToSlot.get(e)}getSlots(){return this.state.slots}syncSlots(){let e=this.options.getScrollTop(),t=this.options.getRowHeight(),n=this.options.getViewportHeight(),r=this.options.getTotalRows(),i=this.options.getOverscan(),a=n,o=Math.max(0,Math.floor(e/t)-i),s=Math.min(r-1,Math.ceil((e+a)/t)+i);if(r===0||s<o){this.destroyAllSlots();return}let c=new Set;for(let e=o;e<=s;e++)c.add(e);let l=[],u=this.partitionSlots(c),d=0;for(let e of c){let t=this.options.getRowData(e);if(t===void 0)continue;let n=d<u.length?u[d++]:void 0;this.assignSlotToRow(e,t,n,l)}for(let e=d;e<u.length;e++){let t=u[e];this.state.slots.delete(t),l.push({type:`DESTROY_SLOT`,slotId:t})}this.updateSlotPositions(l),this.emitBatch(l)}partitionSlots(e){let t=[];for(let[n,r]of this.state.slots)e.has(r.rowIndex)?e.delete(r.rowIndex):(t.push(n),this.state.rowToSlot.delete(r.rowIndex));return t}assignSlotToRow(e,t,n,r){let i;if(n===void 0)i=`slot-${this.state.nextSlotId++}`,this.state.slots.set(i,{slotId:i,rowIndex:e,rowData:t,translateY:this.getRowTranslateY(e)}),r.push({type:`CREATE_SLOT`,slotId:i});else{i=n;let r=this.state.slots.get(i);r.rowIndex=e,r.rowData=t,r.translateY=this.getRowTranslateY(e)}this.state.rowToSlot.set(e,i),r.push({type:`ASSIGN_SLOT`,slotId:i,rowIndex:e,rowData:t},{type:`MOVE_SLOT`,slotId:i,translateY:this.getRowTranslateY(e)})}updateSlotPositions(e){for(let[t,n]of this.state.slots){let r=this.getRowTranslateY(n.rowIndex);n.translateY!==r&&(n.translateY=r,e.push({type:`MOVE_SLOT`,slotId:t,translateY:r}))}}destroyAllSlots(){let e=[];for(let t of this.state.slots.keys())e.push({type:`DESTROY_SLOT`,slotId:t});this.state.slots.clear(),this.state.rowToSlot.clear(),this.emitBatch(e)}destroy(){this.isDestroyed||(this.isDestroyed=!0,this.state.slots.clear(),this.state.rowToSlot.clear(),this.emitter.clearListeners())}refreshAllSlots(){let e=[],t=this.options.getTotalRows();for(let[n,r]of this.state.slots)if(r.rowIndex>=0&&r.rowIndex<t){let t=this.options.getRowData(r.rowIndex);if(t===void 0)continue;let i=this.getRowTranslateY(r.rowIndex);r.rowData=t,r.translateY=i,e.push({type:`ASSIGN_SLOT`,slotId:n,rowIndex:r.rowIndex,rowData:t},{type:`MOVE_SLOT`,slotId:n,translateY:i})}this.emitBatch(e),this.syncSlots()}updateSlot(e){let t=this.state.rowToSlot.get(e);if(t){let n=this.options.getRowData(e);n&&this.emit({type:`ASSIGN_SLOT`,slotId:t,rowIndex:e,rowData:n})}}getRowTranslateY(e){let t=this.options.getRowHeight(),n=this.options.getScrollRatio(),r=this.options.getScrollTop(),i=e*t;return n>=1?i:i-Math.floor(r/t)*t}getRowTranslateYForIndex(e){return this.getRowTranslateY(e)}getRowsWrapperOffset(){let e=this.options.getScrollRatio(),t=this.options.getScrollTop(),n=this.options.getRowHeight();if(e>=1)return 0;let r=t%n;return t*e-r}},rt=class{editState=null;peekState=null;options;emitter=v();onInstruction=this.emitter.onInstruction;emit=this.emitter.emit;constructor(e){this.options=e}getState(){return this.editState?{...this.editState}:null}isEditing(){return this.editState!==null}isEditingCell(e,t){return this.editState!==null&&this.editState.row===e&&this.editState.col===t}startEdit(e,t){if(!this.options.getColumn(t)?.editable)return!1;this.peekState!==null&&this.stopPeek();let n=this.options.getCellValue(e,t);return this.editState={row:e,col:t,initialValue:n,currentValue:n},this.emit({type:`START_EDIT`,row:e,col:t,initialValue:n}),!0}getPeekState(){return this.peekState?{...this.peekState}:null}startPeek(e,t){return this.editState===null?(this.peekState={row:e,col:t},this.emit({type:`START_PEEK`,row:e,col:t}),!0):!1}stopPeek(){this.peekState!==null&&(this.peekState=null,this.emit({type:`STOP_PEEK`}))}updateValue(e){this.editState&&(this.editState.currentValue=e)}commit(){if(!this.editState)return;let{row:e,col:t,currentValue:n}=this.editState;this.options.setCellValue(e,t,n),this.emit({type:`COMMIT_EDIT`,row:e,col:t,value:n}),this.editState=null,this.emit({type:`STOP_EDIT`}),this.options.onCommit?.(e,t,n)}cancel(){this.editState=null,this.emit({type:`STOP_EDIT`})}destroy(){this.emitter.clearListeners(),this.editState=null,this.peekState=null}},it=class{deps;hasWarnedAboutScaledOverscan=!1;constructor(e){this.deps=e}reconcile(){let{batcher:e,highlight:t,slotPool:n}=this.deps;e.start();try{t?.clearAllCaches(),this.emitContentSize(),n.refreshAllSlots(),this.emitHeaders(),this.emitVisibleRange()}finally{e.flush()}}syncVisibleRows(e){let{batcher:t,slotPool:n}=this.deps;t.start();try{e&&this.emitContentSize(),n.syncSlots(),this.emitVisibleRange()}finally{t.flush()}}syncColumnLayout(e){let{batcher:t,highlight:n,slotPool:r}=this.deps;t.start();try{this.emitContentSize(),this.emitHeaders(),t.emit({type:`COLUMNS_CHANGED`,columns:[...this.deps.getColumns()]}),e===`order`?(n?.clearAllCaches(),r.refreshAllSlots()):r.syncSlots()}finally{t.flush()}}emitContentSize(){let{batcher:e,scrollVirtualization:t,slotPool:n,viewport:r}=this.deps,i=this.deps.getColumnPositions().at(-1)??0;t.updateContentSize(),e.emit({type:`SET_CONTENT_SIZE`,width:i,height:t.getVirtualHeight(),viewportWidth:r.getViewportWidth(),viewportHeight:r.getViewportHeight(),rowsWrapperOffset:n.getRowsWrapperOffset()}),this.warnIfOverscanTooLowForScaling()}emitHeaders(){let{batcher:e,sortFilter:t}=this.deps,n=t.getSortInfoMap();for(let[r,i]of this.deps.getColumns().entries()){let a=i.colId??i.field,o=n.get(a);e.emit({type:`UPDATE_HEADER`,colIndex:r,column:i,sortDirection:o?.direction,sortIndex:o?.index,hasFilter:t.hasActiveFilter(a)})}}emitVisibleRange(){let{batcher:e,scrollVirtualization:t,slotPool:n}=this.deps,r=t.getVisibleRowRange();e.emit({type:`UPDATE_VISIBLE_RANGE`,start:r.start,end:r.end,rowsWrapperOffset:n.getRowsWrapperOffset()})}warnIfOverscanTooLowForScaling(){if(this.hasWarnedAboutScaledOverscan||this.deps.scrollVirtualization.isScalingActive()===!1)return;this.hasWarnedAboutScaledOverscan=!0;let{overscan:e}=this.deps;if(e>=10)return;let t=this.deps.getTotalRows().toLocaleString();console.warn(`[gp-grid] Scroll virtualization is active (${t} rows) but overscan is ${e}. Fast momentum scrolling can outrun rendering and show blank rows at this scale — set the overscan option to 10–12.`)}};const at=e=>{let{batcher:t,config:n,getColumns:r}=e,i=()=>n.rowHeight,a=()=>n.headerHeight,o=()=>n.overscan,s,c,l=()=>c.getTotalRows(),u=()=>c.getCachedRows(),d=(e,t)=>c.getCellValue(e,t),f=(e,t,n)=>{c.setCellValue(e,t,n)},p=new Pe({getRowHeight:i,getHeaderHeight:a,getTotalRows:l,getScrollTop:()=>s.getScrollTop(),getViewportHeight:()=>s.getViewportHeight()});s=new We(()=>p.getScrollRatio());let m=null,h=new et({getRowCount:l,getColumnCount:()=>r().length,getCellValue:d,getRowData:e=>u().get(e),getColumn:e=>r()[e],setCellValue:f});h.onInstruction(e=>{t.emit(e),m?.onSelectionChange()}),n.highlighting&&(m=new we({getActiveCell:()=>h.getActiveCell(),getSelectionRange:()=>h.getSelectionRange(),getColumn:e=>r()[e]},n.highlighting),m.onInstruction(e=>t.emit(e)));let g=new tt({getRowCount:l,getColumnCount:()=>r().length,getCellValue:d,getColumn:e=>r()[e],setCellValue:f});g.onInstruction(e=>t.emit(e));let _=new nt({getRowHeight:i,getHeaderHeight:a,getOverscan:o,getScrollTop:()=>s.getScrollTop(),getViewportHeight:()=>s.getViewportHeight(),getTotalRows:l,getScrollRatio:()=>p.getScrollRatio(),getVirtualContentHeight:()=>p.getVirtualContentHeight(),getRowData:e=>u().get(e)});_.onBatchInstruction(e=>t.emitBatch(e));let v=new rt({getColumn:e=>r()[e],getCellValue:d,setCellValue:f,onCommit:e=>_.updateSlot(e)});v.onInstruction(e=>t.emit(e));let y=new He({getColumns:r,isSortingEnabled:()=>n.sortingEnabled,getCachedRows:u,onSortFilterChange:async()=>{await c.loadInitial(),s.resetScrollTop(),t.start();try{t.emit({type:`SCROLL_TO`,scrollTop:0}),b.reconcile()}finally{t.flush()}},onDataRefreshed:()=>{}});y.onInstruction(e=>t.emit(e));let b=new it({batcher:t,scrollVirtualization:p,slotPool:_,viewport:s,sortFilter:y,highlight:m,overscan:n.overscan,getColumns:r,getColumnPositions:e.getColumnPositions,getTotalRows:l});return c=new Ne({dataSource:n.dataSource,rowLoading:n.rowLoading,batcher:t,getColumns:r,getSortModel:()=>y.getSortModel(),getFilterModel:()=>y.getFilterModel(),getRowHeight:i,getOverscan:o,getScrollTop:()=>s.getScrollTop(),getViewportHeight:()=>s.getViewportHeight(),onCellValueChanged:n.onCellValueChanged,getRowId:n.getRowId,onRowsLoaded:e=>b.syncVisibleRows(e)}),{rowData:c,selection:h,highlight:m,fill:g,scrollVirtualization:p,viewport:s,slotPool:_,editManager:v,sortFilter:y,view:b}};var ot=class{config;columns;columnPositions=[];batcher=new Ue;viewport;scrollTopOverride=null;rowData;selection;fill;input;highlight;sortFilter;slotPool;editManager;scrollVirtualization;view;isDestroyed=!1;constructor(e){this.config=Ge(e),this.columns=e.columns,this.computeColumnPositions();let t=at({batcher:this.batcher,config:this.config,getColumns:()=>this.columns,getColumnPositions:()=>this.columnPositions});this.rowData=t.rowData,this.selection=t.selection,this.highlight=t.highlight,this.fill=t.fill,this.scrollVirtualization=t.scrollVirtualization,this.viewport=t.viewport,this.slotPool=t.slotPool,this.editManager=t.editManager,this.sortFilter=t.sortFilter,this.view=t.view,this.input=new w(this,{getHeaderHeight:()=>this.config.headerHeight,getRowHeight:()=>this.config.rowHeight,getColumnPositions:()=>this.columnPositions,getColumnCount:()=>this.columns.length})}onBatchInstruction(e){return this.batcher.subscribe(e)}async initialize(){await this.rowData.loadInitial(),this.view.reconcile()}setViewport(e,t,n,r){let{changed:i,viewportSizeChanged:a}=this.viewport.update(this.scrollTopOverride??e,t,n,r);i&&(this.rowData.requestVisibleRows(),this.view.syncVisibleRows(a))}async setSort(e,t,n=!1){if(!this.rowData.isLoading())return this.sortFilter.setSort(e,t,n)}async setFilter(e,t){if(!this.rowData.isLoading())return this.sortFilter.setFilter(e,t)}hasActiveFilter(e){return this.sortFilter.hasActiveFilter(e)}openFilterPopup(e,t,n=!0){this.rowData.isLoading()||this.sortFilter.openFilterPopup(e,t,n)}closeFilterPopup(){this.sortFilter.closeFilterPopup()}getSortModel(){return this.sortFilter.getSortModel()}getFilterModel(){return this.sortFilter.getFilterModel()}startEdit(e,t){this.editManager.startEdit(e,t)}startPeek(e,t){let n=this.columns[t];return!n||n.peekable===!1?!1:this.editManager.startPeek(e,t)}stopPeek(){this.editManager.stopPeek()}getPeekState(){return this.editManager.getPeekState()}updateEditValue(e){this.editManager.updateValue(e)}commitEdit(){this.editManager.commit()}cancelEdit(){this.editManager.cancel()}pasteClipboardText(e){if(this.editManager.getState())return!1;let t=this.selection.pasteClipboardText(e);return t.changedCells.length>0&&this.refreshSlotData(),t.handled}getEditState(){return this.editManager.getState()}getCellValue(e,t){return this.rowData.getCellValue(e,t)}setCellValue(e,t,n){this.rowData.setCellValue(e,t,n)}clearSelectionIfInvalid(e){let t=this.selection.getActiveCell();t&&t.row>=e&&this.selection.clearSelection()}computeColumnPositions(){this.columnPositions=ce(this.columns)}columnOperationDeps(){return{columns:this.columns,computeColumnPositions:()=>this.computeColumnPositions(),view:this.view}}setColumnWidth(e,t){ke(e,t,this.viewport.getViewportWidth(),this.columnOperationDeps())&&this.config.onColumnResized?.(e,t)}moveColumn(e,t){let n=Ae(e,t,this.columnOperationDeps());n!==null&&this.config.onColumnMoved?.(e,n)}commitRowDrag(e,t){je(e,t,{dataSource:this.rowData.getDataSource(),cachedRows:this.rowData.getCachedRows(),slotPool:this.slotPool,highlight:this.highlight}),this.config.onRowDragEnd?.(e,t)}isRowDragEntireRow(){return this.config.rowDragEntireRow}getColumns(){return this.columns}getColumnPositions(){return[...this.columnPositions]}getRowCount(){return this.rowData.getTotalRows()}getRowHeight(){return this.config.rowHeight}getHeaderHeight(){return this.config.headerHeight}getTotalWidth(){return this.columnPositions.at(-1)??0}getTotalHeight(){return this.scrollVirtualization.getVirtualHeight()}isScalingActive(){return this.scrollVirtualization.isScalingActive()}getMaxFlingVelocity(){return this.config.maxFlingVelocity}setScrollTopOverride(e){this.scrollTopOverride=e}getScrollRatio(){return this.scrollVirtualization.getScrollRatio()}getVisibleRowRange(){return this.scrollVirtualization.getVisibleRowRange()}getScrollTopForRow(e){return this.scrollVirtualization.getScrollTopForRow(e)}getRowIndexAtDisplayY(e,t){return this.scrollVirtualization.getRowIndexAtDisplayY(e,t)}getRowTranslateY(e){return this.slotPool.getRowTranslateYForIndex(e)}getRowData(e){return this.rowData.getRowData(e)}async refresh(){await this.rowData.loadInitial(),this.view.reconcile()}async refreshFromTransaction(){await this.rowData.refreshFromTransaction(),this.view.reconcile()}refreshSlotData(){this.slotPool.refreshAllSlots()}async setDataSource(e){this.editManager.getState()&&this.editManager.cancel(),this.rowData.setDataSource(e),await this.refresh(),this.clearSelectionIfInvalid(this.rowData.getTotalRows())}setColumns(e){this.columns=e,this.computeColumnPositions(),this.view.reconcile()}destroy(){this.isDestroyed||(this.isDestroyed=!0,this.slotPool.destroy(),this.highlight?.destroy(),this.sortFilter.destroy(),this.rowData.destroy(),this.batcher.clearListeners())}},st=class{workerCode;maxWorkers;workers=[];workerUrl=null;nextRequestId=0;isTerminated=!1;constructor(e,t={}){this.workerCode=e;let n=typeof navigator>`u`?4:navigator.hardwareConcurrency;this.maxWorkers=Math.max(1,t.maxWorkers??n??4),t.preWarm&&this.preWarmWorkers()}getPoolSize(){return this.workers.length}getMaxWorkers(){return this.maxWorkers}isAvailable(){return!this.isTerminated&&typeof Worker<`u`}async execute(e,t){if(this.isTerminated)throw Error(`WorkerPool has been terminated`);if(typeof Worker>`u`)throw TypeError(`Web Workers are not available in this environment`);let n=this.getAvailableWorker(),r=this.nextRequestId++,i={...e,id:r};return new Promise((e,a)=>{n.pendingRequests.set(r,{resolve:e,reject:a}),n.busy=!0,t&&t.length>0?n.worker.postMessage(i,t):n.worker.postMessage(i)})}async executeParallel(e){if(this.isTerminated)throw Error(`WorkerPool has been terminated`);if(e.length===0)return[];let t=Math.min(e.length,this.maxWorkers);this.ensureWorkers(t);let n=e.map((e,t)=>{let n=t%this.workers.length,r=this.workers[n],i=this.nextRequestId++,a={...e.request,id:i};return new Promise((t,n)=>{r.pendingRequests.set(i,{resolve:t,reject:n}),r.busy=!0,e.transferables&&e.transferables.length>0?r.worker.postMessage(a,e.transferables):r.worker.postMessage(a)})});return Promise.all(n)}terminate(){for(let e of this.workers){e.worker.terminate();for(let[,t]of e.pendingRequests)t.reject(Error(`Worker pool terminated`));e.pendingRequests.clear()}this.workers=[],this.workerUrl&&=(URL.revokeObjectURL(this.workerUrl),null),this.isTerminated=!0}preWarmWorkers(){this.ensureWorkers(this.maxWorkers)}ensureWorkers(e){let t=Math.min(e,this.maxWorkers)-this.workers.length;for(let e=0;e<t;e++)this.createWorker()}getAvailableWorker(){return this.workers.find(e=>!e.busy)||(this.workers.length<this.maxWorkers?this.createWorker():this.workers.reduce((e,t)=>t.pendingRequests.size<e.pendingRequests.size?t:e,this.workers[0]))}createWorker(){if(!this.workerUrl){let e=new Blob([this.workerCode],{type:`application/javascript`});this.workerUrl=URL.createObjectURL(e)}let e=new Worker(this.workerUrl),t={worker:e,busy:!1,pendingRequests:new Map};return e.onmessage=e=>{let{id:n}=e.data,r=t.pendingRequests.get(n);r&&(t.pendingRequests.delete(n),t.pendingRequests.size===0&&(t.busy=!1),e.data.type===`error`?r.reject(Error(e.data.error)):r.resolve(e.data))},e.onerror=e=>{for(let[,n]of t.pendingRequests)n.reject(Error(`Worker error: ${e.message}`));t.pendingRequests.clear(),t.busy=!1,this.respawnWorker(t)},this.workers.push(t),t}respawnWorker(e){let t=this.workers.indexOf(e);if(t!==-1){try{e.worker.terminate()}catch{}this.workers.splice(t,1),this.workers.length<this.maxWorkers&&!this.isTerminated&&this.createWorker()}}},ct=class{heap=[];compare;constructor(e){this.compare=e}push(e){this.heap.push(e),this.bubbleUp(this.heap.length-1)}pop(){if(this.heap.length===0)return;let e=this.heap[0],t=this.heap.pop();return this.heap.length>0&&t&&(this.heap[0]=t,this.bubbleDown(0)),e}size(){return this.heap.length}bubbleUp(e){for(;e>0;){let t=Math.floor((e-1)/2);if(this.compare(this.heap[e],this.heap[t])>=0)break;this.swap(e,t),e=t}}bubbleDown(e){let t=this.heap.length;for(;;){let n=2*e+1,r=2*e+2,i=e;if(n<t&&this.compare(this.heap[n],this.heap[i])<0&&(i=n),r<t&&this.compare(this.heap[r],this.heap[i])<0&&(i=r),i===e)break;this.swap(e,i),e=i}}swap(e,t){let n=this.heap[e];this.heap[e]=this.heap[t],this.heap[t]=n}};const lt=(e,t,n)=>{let r=[];for(let i=0;i<n;i++)r.push(e.columns[i][t]);return r},L=e=>{let t=new Uint32Array(e.indices.length);for(let n=0;n<e.indices.length;n++)t[n]=e.indices[n]+e.offset;return t},ut=e=>{let t=0;for(let n of e)t+=n.indices.length;return t},R=(e,t,n)=>{let r=new Uint32Array(ut(e)),i=new ct((e,t)=>{let r=n(e.payload,t.payload);return r===0?e.globalIndex-t.globalIndex:r}),a=(n,r)=>{let a=e[n];i.push({chunkIndex:n,positionInChunk:r,payload:t(a,r),globalIndex:a.indices[r]+a.offset})};for(let t=0;t<e.length;t++)e[t].indices.length>0&&a(t,0);let o=0;for(;i.size()>0;){let t=i.pop();r[o++]=t.globalIndex;let n=t.positionInChunk+1;n<e[t.chunkIndex].indices.length&&a(t.chunkIndex,n)}return r};function z(e,t){if(e.length===0)return new Uint32Array;if(e.length===1)return L(e[0]);let n=t===`asc`?1:-1;return R(e,(e,t)=>e.values[t],(e,t)=>(e-t)*n)}function dt(e){if(e.length===0)return new Uint32Array;if(e.length===1)return L(e[0]);let t=e[0].directions,n=t.length;return R(e,(e,t)=>lt(e,t,n),(e,r)=>{for(let i=0;i<n;i++){let n=(e[i]-r[i])*t[i];if(n!==0)return n}return 0})}const ft=(e,t,n)=>{let r=Math.max(n,Math.ceil(e/t)),i=[];for(let t=0;t<e;t+=r)i.push({offset:t,length:Math.min(r,e-t)});return i},pt=e=>{if(e.length<=1)return[];let t=[],n=0;for(let r=0;r<e.length-1;r++){let i=e[r],a=e[r+1];if(i.indices.length===0||a.indices.length===0){n+=i.indices.length;continue}let o=i.values[i.indices.length-1],s=a.values[0];if(o===s){let e=i.indices.length-1;for(;e>0&&i.values[e-1]===o;)e--;let r=0;for(;r<a.indices.length-1&&a.values[r+1]===s;)r++;t.push(n+e,n+i.indices.length+r+1)}n+=i.indices.length}return t},B=(e,t,n,r)=>{let i=r===`asc`?1:-1;for(let r=0;r<t.length;r+=2){let a=t[r],o=t[r+1];o<=a||o>e.length||mt(e,a,o,n,i)}},mt=(e,t,n,r,i)=>{let a=Array.from(e.slice(t,n));if(!ht(a,r)){a.sort((e,t)=>i*r[e].localeCompare(r[t]));for(let n=0;n<a.length;n++)e[t+n]=a[n]}},ht=(e,t)=>{let n=t[e[0]];for(let r=1;r<e.length;r++)if(t[e[r]]!==n)return!1;return!0};var V=class{pool;parallelThreshold;minChunkSize;isTerminated=!1;constructor(e={}){let t=e.maxWorkers??(navigator===void 0?4:navigator.hardwareConcurrency)??4;this.pool=new st("(function(){let e=(e,t)=>{let n=e;for(let e of t.split(`.`)){if(typeof n!=`object`||!n)return null;n=n[e]}return n??null},t=e=>e==null?``:Array.isArray(e)?e.join(`, `):typeof e==`object`&&!(e instanceof Date)?JSON.stringify(e):String(e),n=(e,n)=>{if(e==null&&n==null)return 0;if(e==null)return 1;if(n==null)return-1;let r=Number(e),i=Number(n);return!Number.isNaN(r)&&!Number.isNaN(i)?r-i:e instanceof Date&&n instanceof Date?e.getTime()-n.getTime():t(e).localeCompare(t(n))},r=(t,r)=>[...t].sort((t,i)=>{for(let{colId:a,direction:o}of r){let r=n(e(t,a),e(i,a));if(r!==0)return o===`asc`?r:-r}return 0}),i=e=>{let t=new Uint32Array(e);for(let n=0;n<e;n++)t[n]=n;return t},a=(e,t)=>{let n=new Float64Array(t.length);for(let r=0;r<t.length;r++)n[r]=e[t[r]];return n},o=(e,t,n)=>e.some(e=>e[t]!==e[n]),s=(e,t)=>{let n=e.length,r=[],i=0;for(let a=1;a<=n;a++)(a===n||o(t,e[a-1],e[a]))&&(a-i>1&&r.push(i,a),i=a);return new Uint32Array(r)},c=(e,t)=>{let n=i(e.length),r=t===`asc`?1:-1;return n.sort((t,n)=>{let i=e[t],a=e[n];return i<a?-1*r:i>a?1*r:t-n}),n},l=(e,t)=>{let n=e.length,r=i(e[0].length);return r.sort((r,i)=>{for(let a=0;a<n;a++){let n=e[a][r],o=e[a][i];if(n<o)return-1*t[a];if(n>o)return 1*t[a]}return r-i}),r},u=(e,t)=>{let n=e.length,r=i(e[0].length),a=t===`asc`?1:-1;return r.sort((t,r)=>{for(let i=0;i<n;i++){let n=e[i][t],o=e[i][r];if(n<o)return-1*a;if(n>o)return 1*a}return t-r}),{indices:r,collisionRuns:s(r,e)}},d={sort:e=>({type:`sorted`,payload:{data:r(e.data,e.sortModel)},transfer:[]}),sortIndices:e=>{let t=c(e.values,e.direction);return{type:`sortedIndices`,payload:{indices:t},transfer:[t.buffer]}},sortMultiColumn:e=>{let t=l(e.columns,e.directions);return{type:`sortedMultiColumn`,payload:{indices:t},transfer:[t.buffer]}},sortStringHashes:e=>{let t=u(e.hashChunks,e.direction);return{type:`sortedStringHashes`,payload:{indices:t.indices,collisionRuns:t.collisionRuns},transfer:[t.indices.buffer,t.collisionRuns.buffer]}},sortChunk:e=>{let t=c(e.values,e.direction),n=a(e.values,t);return{type:`sortedChunk`,payload:{indices:t,sortedValues:n,chunkOffset:e.chunkOffset},transfer:[t.buffer,n.buffer]}},sortStringChunk:e=>{let t=u(e.hashChunks,e.direction),n=a(e.hashChunks[0],t.indices);return{type:`sortedStringChunk`,payload:{indices:t.indices,sortedHashes:n,collisionRuns:t.collisionRuns,chunkOffset:e.chunkOffset},transfer:[t.indices.buffer,n.buffer,t.collisionRuns.buffer]}},sortMultiColumnChunk:e=>{let t=l(e.columns,e.directions),n=e.columns.map(e=>a(e,t));return{type:`sortedMultiColumnChunk`,payload:{indices:t,sortedColumns:n,chunkOffset:e.chunkOffset},transfer:[t.buffer,...n.map(e=>e.buffer)]}}},f=self;f.onmessage=e=>{let t=e.data,n=d[t.type];if(n)try{let e=n(t);f.postMessage({type:e.type,id:t.id,...e.payload},e.transfer)}catch(e){f.postMessage({type:`error`,id:t.id,error:String(e)})}}})();",{maxWorkers:t}),this.parallelThreshold=e.parallelThreshold??4e5,this.minChunkSize=e.minChunkSize??5e4}isAvailable(){return!this.isTerminated&&this.pool.isAvailable()}terminate(){this.pool.terminate(),this.isTerminated=!0}async sortIndices(e,t){return this.assertNotTerminated(),e.length<this.parallelThreshold?this.sortIndicesSingle(e,t):this.sortIndicesParallel(e,t)}async sortStringHashes(e,t,n){return this.assertNotTerminated(),(e[0]?.length??0)<this.parallelThreshold?this.sortStringHashesSingle(e,t,n):this.sortStringHashesParallel(e,t,n)}async sortMultiColumn(e,t){return this.assertNotTerminated(),(e[0]?.length??0)<this.parallelThreshold?this.sortMultiColumnSingle(e,t):this.sortMultiColumnParallel(e,t)}assertNotTerminated(){if(this.isTerminated)throw Error(`ParallelSortManager has been terminated`)}async sortIndicesSingle(e,t){let n=new Float64Array(e),r={type:`sortIndices`,id:0,values:n,direction:t};return(await this.pool.execute(r,[n.buffer])).indices}async sortStringHashesSingle(e,t,n){let r={type:`sortStringHashes`,id:0,hashChunks:e,direction:t},i=e.map(e=>e.buffer),a=await this.pool.execute(r,i);return a.collisionRuns.length>0&&B(a.indices,a.collisionRuns,n,t),a.indices}async sortMultiColumnSingle(e,t){let n=e.map(e=>new Float64Array(e)),r=new Int8Array(t.map(e=>e===`asc`?1:-1)),i={type:`sortMultiColumn`,id:0,columns:n,directions:r},a=[...n.map(e=>e.buffer),r.buffer];return(await this.pool.execute(i,a)).indices}boundariesFor(e){return ft(e,this.pool.getMaxWorkers(),this.minChunkSize)}async runChunks(e){let t=await this.pool.executeParallel(e);return t.sort((e,t)=>e.chunkOffset-t.chunkOffset),t}async sortIndicesParallel(e,t){let n=this.boundariesFor(e.length).map(n=>{let r=new Float64Array(e.slice(n.offset,n.offset+n.length));return{request:{type:`sortChunk`,id:0,values:r,direction:t,chunkOffset:n.offset},transferables:[r.buffer]}});return z((await this.runChunks(n)).map(e=>({indices:e.indices,values:e.sortedValues,offset:e.chunkOffset})),t)}async sortStringHashesParallel(e,t,n){let r=this.boundariesFor(e[0].length).map(n=>{let r=e.map(e=>{let t=new Float64Array(n.length);return t.set(new Float64Array(e.buffer,n.offset*8,n.length)),t});return{request:{type:`sortStringChunk`,id:0,hashChunks:r,direction:t,chunkOffset:n.offset},transferables:r.map(e=>e.buffer)}}),i=await this.runChunks(r),a=i.map(e=>({indices:e.indices,values:e.sortedHashes,offset:e.chunkOffset})),o=gt(i),s=z(a,t),c=pt(a),l=new Uint32Array([...o,...c]);return l.length>0&&B(s,l,n,t),s}async sortMultiColumnParallel(e,t){let n=this.boundariesFor(e[0].length),r=new Int8Array(t.map(e=>e===`asc`?1:-1)),i=n.map(t=>{let n=e.map(e=>{let n=new Float64Array(t.length);for(let r=0;r<t.length;r++)n[r]=e[t.offset+r];return n}),i=new Int8Array(r);return{request:{type:`sortMultiColumnChunk`,id:0,columns:n,directions:i,chunkOffset:t.offset},transferables:[...n.map(e=>e.buffer),i.buffer]}});return dt((await this.runChunks(i)).map(e=>({indices:e.indices,columns:e.sortedColumns,directions:r,offset:e.chunkOffset})))}};const gt=e=>{let t=[];for(let n of e)for(let e=0;e<n.collisionRuns.length;e+=2)t.push(n.collisionRuns[e]+n.chunkOffset,n.collisionRuns[e+1]+n.chunkOffset);return t},_t=e=>e>=97&&e<=122?e-97:e>=48&&e<=57?e-48+26:0,H=(e,t)=>{let n=0;for(let r=0;r<10;r++){let i=t+r,a=i<e.length?e.codePointAt(i)??200:0;n=n*36+_t(a)}return n},U=e=>H(e.toLowerCase(),0);function vt(e,t){let n=e==null||Array.isArray(e)&&e.length===0,r=t==null||Array.isArray(t)&&t.length===0;if(n&&r)return 0;if(n)return 1;if(r)return-1;if(Array.isArray(e)||Array.isArray(t)){let n=Array.isArray(e)?e.join(`, `):x(e),r=Array.isArray(t)?t.join(`, `):x(t);return n.localeCompare(r)}let i=Number(e),a=Number(t);return!Number.isNaN(i)&&!Number.isNaN(a)?i-a:e instanceof Date&&t instanceof Date?e.getTime()-t.getTime():x(e).localeCompare(x(t))}function W(e){if(e==null)return Number.MAX_VALUE;if(typeof e==`number`)return e;if(e instanceof Date)return e.getTime();if(typeof e==`string`)return U(e);if(Array.isArray(e))return e.length===0?Number.MAX_VALUE:U(e.join(`, `));if(typeof e==`object`)return U(JSON.stringify(e));let t=Number(e);return Number.isNaN(t)?0:t}function yt(e){let t=e.toLowerCase(),n=[];for(let e=0;e<3;e++)n.push(H(t,e*10));return n}function G(e,t,n){return[...e].sort((e,r)=>{for(let{colId:i,direction:a}of t){let t=vt(n(e,i),n(r,i));if(t!==0)return a===`asc`?t:-t}return 0})}const bt=(e,t,n)=>{for(let r of e){let e=n(r,t);if(e!=null)return typeof e==`string`||Array.isArray(e)||typeof e==`object`&&!(e instanceof Date)?`string`:`numeric`}return`numeric`},xt=(e,t,n)=>{let r=[],i=Array.from({length:3},()=>[]);for(let a of e){let e=x(n(a,t));r.push(e);let o=yt(e);for(let e=0;e<3;e++)i[e].push(o[e])}return{originalStrings:r,hashChunkArrays:i.map(e=>new Float64Array(e))}},St=(e,t,n)=>e.map(e=>W(n(e,t))),Ct=(e,t,n)=>{let r=[],i=[];for(let{colId:a,direction:o}of t)r.push(e.map(e=>W(n(e,a)))),i.push(o??`asc`);return{columnValues:r,directions:i}},wt=(e,t)=>{let n=Array(e.length);for(let r=0;r<t.length;r++)n[r]=e[t[r]];return n},Tt=async(e,t,n,r)=>{let{colId:i,direction:a}=t,o=a??`asc`;if(bt(e,i,r)===`string`){let{originalStrings:t,hashChunkArrays:a}=xt(e,i,r);return n.sortStringHashes(a,o,t)}let s=St(e,i,r);return n.sortIndices(s,o)},Et=async(e,t,n,r)=>{let{columnValues:i,directions:a}=Ct(e,t,r);return n.sortMultiColumn(i,a)},Dt=async(e,t,n,r)=>{let i=t.length===1?await Tt(e,t[0],n,r):await Et(e,t,n,r);return wt(e,i)};function K(e,t){return e.getFullYear()===t.getFullYear()&&e.getMonth()===t.getMonth()&&e.getDate()===t.getDate()}const Ot={contains:(e,t)=>e.includes(t),notContains:(e,t)=>!e.includes(t),equals:(e,t)=>e===t,notEquals:(e,t)=>e!==t,startsWith:(e,t)=>e.startsWith(t),endsWith:(e,t)=>e.endsWith(t),blank:(e,t,n)=>n,notBlank:(e,t,n)=>!n},kt=new WeakMap,At=e=>{let t=kt.get(e);if(t?.size===e.size)return t.keys;let n=new Set;for(let t of e)n.add(k(t));return kt.set(e,{size:e.size,keys:n}),n};function jt(e,t,n){let r=A(e);if(t.selectedValues!==void 0)return r?t.includeBlank===!0:At(t.selectedValues).has(k(e));let i=x(e,n).toLowerCase(),a=String(t.value??``).toLowerCase();return Ot[t.operator](i,a,r)}const Mt={"=":(e,t)=>e===t,"!=":(e,t)=>e!==t,">":(e,t)=>e>t,"<":(e,t)=>e<t,">=":(e,t)=>e>=t,"<=":(e,t)=>e<=t,between:(e,t,n)=>e>=t&&e<=n};function Nt(e,t){let n=e==null||e===``;if(t.operator===`blank`)return n;if(t.operator===`notBlank`)return!n;if(n)return!1;let r=typeof e==`number`?e:Number(e);if(Number.isNaN(r))return!1;let i=t.value??0,a=t.valueTo??0;return Mt[t.operator](r,i,a)}const Pt={"=":(e,t)=>K(e,t),"!=":(e,t)=>!K(e,t),">":(e,t)=>e.getTime()>t.getTime(),"<":(e,t)=>e.getTime()<t.getTime(),between:(e,t,n)=>{let r=e.getTime();return r>=t.getTime()&&r<=n.getTime()}};function Ft(e,t){let n=e==null||e===``;if(t.operator===`blank`)return n;if(t.operator===`notBlank`)return!n;if(n)return!1;let r=e instanceof Date?e:new Date(x(e));if(Number.isNaN(r.getTime()))return!1;let i=t.value instanceof Date?t.value:new Date(String(t.value??``)),a=t.valueTo instanceof Date?t.valueTo:new Date(String(t.valueTo??``));return Pt[t.operator](r,i,a)}function It(e,t,n){switch(t.type){case`text`:return jt(e,t,n);case`number`:return Nt(e,t);case`date`:return Ft(e,t);default:return!0}}const Lt=(e,t,n)=>{let r;for(let i of t.conditions){let a=It(e,i,n);if(r===void 0){r=a;continue}r=t.combination===`and`?r&&a:r||a}return r};function q(e,t,n){let r=N(t),i;for(let t of r.groups){let a=Lt(e,t,n);if(a!==void 0){if(i===void 0){i=a;continue}i=r.combination===`and`?i&&a:i||a}}return i??!0}function Rt(e,t,n,r){let i=Object.entries(t).filter(([,e])=>e!=null);if(i.length===0)return!0;for(let[t,a]of i){let i=n(e,t),o=r?.(t);if(!q(i,a,o))return!1}return!0}function zt(e,t,n,r){let i=Object.entries(t).filter(([,e])=>typeof e==`string`?e.trim()!==``:N(e).groups.some(e=>e.conditions.length>0));return i.length===0?e:e.filter(e=>{for(let[t,a]of i){let i=n(e,t),o=r?.(t);if(typeof a==`string`){if(!x(i,o).toLowerCase().includes(a.toLowerCase()))return!1;continue}if(!q(i,a,o))return!1}return!0})}function Bt(e,t={}){let{getFieldValue:n=g,getValueFormatter:r,useWorker:i=!0,parallelSort:a}=t,o=e,s=!1,c=i?new V(a===!1?{maxWorkers:1}:a):null;return{loadMode:`all`,async query(e){let t=o?[...o]:[];if(e.filter&&Object.keys(e.filter).length>0){let i=e.valueFormatters===null?r:t=>e.valueFormatters?.[t];t=zt(t,e.filter,n,i)}e.sort&&e.sort.length>0&&(t=c&&c.isAvailable()&&t.length>=2e5?await Dt(t,e.sort,c,n):G(t,e.sort,n));let i=t.length;return{rows:t.slice(e.range.startRow,e.range.endRow),totalRows:i}},destroy(){s||(s=!0,o=null,c&&c.terminate())},moveRow(e,t){if(!o||e===t||e<0||e>=o.length||t<0||t>=o.length)return;let[n]=o.splice(e,1),r=t>e?t-1:t;o.splice(r,0,n)}}}function J(e){return Bt(e)}function Vt(e,t={}){return{loadMode:t.loadMode??`paginated`,async query(t){return e(t)}}}var Ht=class{countsByField=new Map;clear(){this.countsByField.clear()}get(e){let t=this.countsByField.get(e);return t?Array.from(t.keys()):[]}rebuild(e){this.clear();for(let t of e)this.addRow(t)}addRow(e){Ut(e,(e,t)=>this.add(e,t))}removeRow(e){Ut(e,(e,t)=>this.remove(e,t))}replace(e,t,n){t!=null&&this.remove(e,t),n!=null&&this.add(e,n)}add(e,t){let n=this.countsByField.get(e);n||(n=new Map,this.countsByField.set(e,n)),Wt(t,e=>Gt(n,e))}remove(e,t){let n=this.countsByField.get(e);n!==void 0&&Wt(t,e=>Kt(n,e))}};const Ut=(e,t)=>{if(!(typeof e!=`object`||!e))for(let[n,r]of Object.entries(e))r!=null&&t(n,r)},Wt=(e,t)=>{if(Array.isArray(e)){for(let n of e)n!=null&&t(n);return}t(e)},Gt=(e,t)=>{e.set(t,(e.get(t)??0)+1)},Kt=(e,t)=>{let n=e.get(t);if(n!==void 0){if(n<=1){e.delete(t);return}e.set(t,n-1)}};var qt=class{rows=[];rowById=new Map;distinctValues=new Ht;options;constructor(e,t=[]){this.options={getRowId:e.getRowId,getFieldValue:e.getFieldValue??g},this.setData(t)}clear(){this.rows=[],this.rowById.clear(),this.distinctValues.clear()}setData(e){this.rows=[...e],this.rebuildIdIndex(),this.distinctValues.rebuild(this.rows)}getRowById(e){let t=this.rowById.get(e);return t===void 0?void 0:this.rows[t]}getTotalRowCount(){return this.rows.length}getAllRows(){return[...this.rows]}getDistinctValues(e){return this.distinctValues.get(e)}addRows(e){for(let t of e)this.addRow(t)}addRow(e){let t=this.options.getRowId(e);if(this.rowById.has(t)){console.warn(`Row with ID ${t} already exists. Skipping.`);return}this.rowById.set(t,this.rows.length),this.rows.push(e),this.distinctValues.addRow(e)}removeRows(e){let t=new Set;for(let n of e){let e=this.rowById.get(n);e!==void 0&&t.add(e)}if(t.size===0)return 0;let n=[];for(let e=0;e<this.rows.length;e++){let r=this.rows[e];if(t.has(e)){this.distinctValues.removeRow(r);continue}n.push(r)}return this.rows=n,this.rebuildIdIndex(),t.size}updateCell(e,t,n){let r=this.getRowById(e);if(r===void 0){console.warn(`Row with ID ${e} not found.`);return}let i=this.options.getFieldValue(r,t);_(r,t,n),this.distinctValues.replace(t,i,n)}updateRow(e,t){for(let[n,r]of Object.entries(t))this.updateCell(e,n,r)}moveRow(e,t){if(e===t||e<0||e>=this.rows.length||t<0||t>=this.rows.length)return;let[n]=this.rows.splice(e,1),r=t>e?t-1:t;this.rows.splice(r,0,n),this.rebuildIdIndex()}rebuildIdIndex(){this.rowById.clear();for(let e=0;e<this.rows.length;e++)this.rowById.set(this.options.getRowId(this.rows[e]),e)}};function Jt(e,t){let{getRowId:n,getFieldValue:r,getValueFormatter:i,debounceMs:a=50,onTransactionProcessed:o,useWorker:s=!0,parallelSort:c}=t,l=new qt({getRowId:n,getFieldValue:r??g},e),u=new Set,d=v().emit,f=s&&c!==!1?new V(c):null,p=new P({debounceMs:a,store:l,onProcessed:e=>{o?.(e);for(let t of u)t(e)}});return{loadMode:`all`,async query(e){if(p.hasPending()){d({type:`DATA_LOADING`});try{await p.flush()}finally{d({type:`DATA_LOADED`,totalRows:l.getTotalRowCount()})}}let t=l.getAllRows(),n=r??g;if(e.filter&&Object.keys(e.filter).length>0){let r=e.valueFormatters===null?i:t=>e.valueFormatters?.[t];t=zt(t,e.filter,n,r)}if(e.sort&&e.sort.length>0)if(f&&f.isAvailable()&&t.length>=2e5){d({type:`DATA_LOADING`});try{t=await Dt(t,e.sort,f,n)}finally{d({type:`DATA_LOADED`,totalRows:t.length})}}else t=G(t,e.sort,n);let a=t.length;return{rows:t.slice(e.range.startRow,e.range.endRow),totalRows:a}},addRows(e){p.add(e)},removeRows(e){p.remove(e)},updateCell(e,t,n){p.updateCell(e,t,n)},updateRow(e,t){p.updateRow(e,t)},async flushTransactions(){await p.flush()},hasPendingTransactions(){return p.hasPending()},getDistinctValues(e){return l.getDistinctValues(e)},getRowById(e){return l.getRowById(e)},getTotalRowCount(){return l.getTotalRowCount()},subscribe(e){return u.add(e),()=>{u.delete(e)}},clear(){let e=l.getTotalRowCount();l.clear();let t={added:0,removed:e,updated:0};o?.(t);for(let e of u)e(t)},moveRow(e,t){l.moveRow(e,t)}}}const Yt=e=>({slots:new Map,activeCell:null,selectionRange:null,editingCell:null,peekCell:null,contentWidth:0,contentHeight:e?.initialHeight??0,viewportWidth:e?.initialWidth??0,viewportHeight:e?.initialHeight??0,rowsWrapperOffset:0,headers:new Map,filterPopup:null,isLoading:!1,error:null,totalRows:0,visibleRowRange:null,hoverPosition:null,columns:null,pendingScrollTop:null}),Xt=(e,t,n)=>{switch(e.type){case`CREATE_SLOT`:return t.set(e.slotId,{slotId:e.slotId,rowIndex:-1,rowData:{},translateY:0}),null;case`DESTROY_SLOT`:return t.delete(e.slotId),null;case`ASSIGN_SLOT`:{let n=t.get(e.slotId);return n&&t.set(e.slotId,{...n,rowIndex:e.rowIndex,rowData:e.rowData}),null}case`MOVE_SLOT`:{let n=t.get(e.slotId);return n&&t.set(e.slotId,{...n,translateY:e.translateY}),null}case`SCROLL_TO`:return{pendingScrollTop:e.scrollTop};case`SET_ACTIVE_CELL`:return{activeCell:e.position};case`SET_SELECTION_RANGE`:return{selectionRange:e.range};case`UPDATE_VISIBLE_RANGE`:return{visibleRowRange:{start:e.start,end:e.end},rowsWrapperOffset:e.rowsWrapperOffset};case`SET_HOVER_POSITION`:return{hoverPosition:e.position};case`START_EDIT`:return{editingCell:{row:e.row,col:e.col,initialValue:e.initialValue}};case`STOP_EDIT`:return{editingCell:null};case`START_PEEK`:return{peekCell:{row:e.row,col:e.col}};case`STOP_PEEK`:return{peekCell:null};case`SET_CONTENT_SIZE`:return{contentWidth:e.width,contentHeight:e.height,viewportWidth:e.viewportWidth,viewportHeight:e.viewportHeight,rowsWrapperOffset:e.rowsWrapperOffset};case`UPDATE_HEADER`:return n.set(e.colIndex,{column:e.column,sortDirection:e.sortDirection,sortIndex:e.sortIndex,hasFilter:e.hasFilter}),null;case`OPEN_FILTER_POPUP`:return{filterPopup:{isOpen:!0,colIndex:e.colIndex,column:e.column,anchorRect:e.anchorRect,distinctValues:e.distinctValues,currentFilter:e.currentFilter}};case`CLOSE_FILTER_POPUP`:return{filterPopup:null};case`DATA_LOADING`:return{isLoading:!0,error:null};case`DATA_LOADED`:return{isLoading:!1,totalRows:e.totalRows};case`DATA_ERROR`:return{isLoading:!1,error:e.error};case`COLUMNS_CHANGED`:return{columns:e.columns};default:return null}},Y={filterTitle:`Filter: {column}`,and:`AND`,or:`OR`,valuePlaceholder:`Value`,betweenSeparator:`to`,addCondition:`+ Add condition`,removeCondition:`×`,addGroup:`+ Add group`,removeGroup:`×`,clear:`Clear`,apply:`Apply`,valuesMode:`Values`,conditionMode:`Condition`,searchPlaceholder:`Search...`,selectAll:`Select All`,deselectAll:`Deselect All`,blanks:`(Blanks)`,tooManyValues:`Too many unique values ({count}). Use conditions to filter.`,emptyState:`No data to display`,errorPrefix:`Error: {message}`,operators:{contains:`Contains`,notContains:`Does not contain`,startsWith:`Starts with`,endsWith:`Ends with`,equals:`Equals`,notEquals:`Does not equal`,greaterThan:`Greater than`,lessThan:`Less than`,greaterThanOrEqual:`Greater than or equal`,lessThanOrEqual:`Less than or equal`,between:`Between`,blank:`Is blank`,notBlank:`Is not blank`}},Zt=e=>({...Y,...e,operators:{...Y.operators,...e?.operators}}),Qt=(e,t={})=>e.replace(/\{(\w+)\}/g,(e,n)=>{let r=t[n];return r===void 0?e:String(r)}),$t=e=>{let t=e.operators;return[{value:`contains`,label:t.contains},{value:`notContains`,label:t.notContains},{value:`equals`,label:t.equals},{value:`notEquals`,label:t.notEquals},{value:`startsWith`,label:t.startsWith},{value:`endsWith`,label:t.endsWith},{value:`blank`,label:t.blank},{value:`notBlank`,label:t.notBlank}]},en=e=>{let t=e.operators;return[{value:`=`,label:t.equals},{value:`!=`,label:t.notEquals},{value:`>`,label:t.greaterThan},{value:`<`,label:t.lessThan},{value:`>=`,label:t.greaterThanOrEqual},{value:`<=`,label:t.lessThanOrEqual},{value:`between`,label:t.between},{value:`blank`,label:t.blank},{value:`notBlank`,label:t.notBlank}]},tn=e=>{let t=e.operators;return[{value:`=`,label:t.equals},{value:`!=`,label:t.notEquals},{value:`>`,label:t.greaterThan},{value:`<`,label:t.lessThan},{value:`between`,label:t.between},{value:`blank`,label:t.blank},{value:`notBlank`,label:t.notBlank}]},X=e=>({clientX:e.clientX,clientY:e.clientY,button:e.button,shiftKey:e.shiftKey,ctrlKey:e.ctrlKey,metaKey:e.metaKey,pointerId:e.pointerId,pointerType:e.pointerType});var nn=class{intervalId=null;lastPointerEvent=null;getBodyEl;onTick;constructor(e,t){this.getBodyEl=e,this.onTick=t}recordPointer(e){this.lastPointerEvent=e}clearPointer(){this.lastPointerEvent=null}start(e,t){this.stop(),this.intervalId=setInterval(()=>{let n=this.getBodyEl();if(!n)return;n.scrollTop+=t,n.scrollLeft+=e;let r=this.lastPointerEvent;r&&this.onTick(r)},16)}stop(){this.intervalId!==null&&(clearInterval(this.intervalId),this.intervalId=null)}},rn=class{timer=null;capture=null;savedContainerOverflow=null;blockTouchMove=e=>e.preventDefault();deps;constructor(e){this.deps=e}start(e){this.reset(),this.capture={pointerId:e.pointerId,target:e.currentTarget};let t=e.clientX,n=e.clientY,r=e=>{let r=e.clientX-t,i=e.clientY-n;(Math.abs(r)>10||Math.abs(i)>10)&&(this.cancel(),a())},i=()=>{this.cancel(),a()},a=()=>{document.removeEventListener(`pointermove`,r),document.removeEventListener(`pointerup`,i),document.removeEventListener(`pointercancel`,i)};document.addEventListener(`pointermove`,r),document.addEventListener(`pointerup`,i,{once:!0}),document.addEventListener(`pointercancel`,i,{once:!0}),this.timer=setTimeout(()=>{this.timer=null,a(),this.confirm()},300)}cancel(){this.reset(),this.deps.getCore()?.input.cancelPendingRowDrag()}reset(){this.timer!==null&&(clearTimeout(this.timer),this.timer=null),this.capture=null}releaseLocks(){if(!this.deps.isBrowser)return;let e=this.deps.getContainer();this.savedContainerOverflow!==null&&e&&(e.style.overflow=this.savedContainerOverflow),this.savedContainerOverflow=null,document.removeEventListener(`touchmove`,this.blockTouchMove)}confirm(){let e=this.deps.getCore(),t=this.capture;this.capture=null,e!==null&&e.input.confirmPendingRowDrag()&&(this.lockContainer(),document.addEventListener(`touchmove`,this.blockTouchMove,{passive:!1}),this.applyPointerCapture(t),this.deps.onDragConfirmed(e.input.getDragState()))}lockContainer(){let e=this.deps.getContainer();e&&(this.savedContainerOverflow=e.style.overflow,e.style.overflow=`hidden`)}applyPointerCapture(e){e&&an(e.target,e.pointerId)}};const an=(e,t)=>{try{return e.setPointerCapture(t),!0}catch{return!1}};var on=class{cleanup=null;deps;constructor(e){this.deps=e}start(e){if(!this.deps.isBrowser)return;this.detachListeners();let t=e.clientX,n=e.clientY,r=e=>{let r=e.clientX-t,i=e.clientY-n;(Math.abs(r)>10||Math.abs(i)>10)&&this.cancel()},i=()=>{this.cancel()},a=()=>{this.detachListeners(),this.deps.getCore()?.input.confirmPendingCellTap()&&this.deps.onTapConfirmed()};document.addEventListener(`pointermove`,r),document.addEventListener(`pointerup`,a,{once:!0}),document.addEventListener(`pointercancel`,i,{once:!0}),this.cleanup=()=>{document.removeEventListener(`pointermove`,r),document.removeEventListener(`pointerup`,a),document.removeEventListener(`pointercancel`,i)}}cancel(){this.detachListeners(),this.deps.getCore()?.input.cancelPendingCellTap()}detachListeners(){this.cleanup!==null&&(this.cleanup(),this.cleanup=null)}};const sn=e=>150*e/1e3,cn=(e,t)=>e.filter(e=>t-e.time<=100),ln=(e,t=640)=>{let n=e[0],r=e.at(-1);if(n===void 0||r===void 0||n===r)return 0;let i=r.time-n.time;if(i<=0)return 0;let a=(r.position-n.position)/i,o=Math.min(2.4,t);return Math.max(-o,Math.min(o,a))},un=(e,t,n=640)=>{let r=e*t>0?e+t*4:e;return Math.max(-n,Math.min(n,r))},Z=(e,t)=>{if(t>1500)return e;if(e===null)return t;let n=t>e?.5:.15;return e+(t-e)*n},dn=(e,t=640)=>{if(e===null||e<=0)return t;let n=Math.max(250,t*17)/e;return Math.max(.25,Math.min(t,n))},fn=(e,t)=>({position:e.position+e.velocity*Math.min(t,64),velocity:e.velocity*Math.exp(-t/1200)}),pn=e=>Math.abs(e)<.01;var mn=class{overrideActive=!1;lastPipelineRunMs=null;pipelineIntervalEmaMs=null;getCore;getEl;constructor(e,t){this.getCore=e,this.getEl=t}get pipelineIntervalMs(){return this.pipelineIntervalEmaMs}get lastRunMs(){return this.lastPipelineRunMs}apply(e,t,n,r){r!==null&&this.lastPipelineRunMs!==null&&(this.pipelineIntervalEmaMs=Z(this.pipelineIntervalEmaMs,r-this.lastPipelineRunMs)),this.lastPipelineRunMs=r,this.overrideActive=!0,e.setScrollTopOverride(n),t.scrollTop=n,e.setViewport(n,t.scrollLeft,t.clientWidth,t.clientHeight)}release(){if(this.overrideActive===!1)return;this.overrideActive=!1;let e=this.getCore();if(e===null)return;e.setScrollTopOverride(null);let t=this.getEl();t!==null&&e.setViewport(t.scrollTop,t.scrollLeft,t.clientWidth,t.clientHeight)}};const Q=(e,t,n)=>Math.min(Math.max(e,t),Math.max(t,n)),hn=e=>(e!==null&&globalThis.cancelAnimationFrame?.(e),null);var gn=class{frame=null;velocity=0;throttled=!1;frameIntervalEmaMs=null;scroll;constructor(e){this.scroll=e}get currentVelocity(){return this.frame===null?0:this.velocity}stop(){this.frame=hn(this.frame)}start(e,t,n){let r=globalThis.requestAnimationFrame;if(r===void 0)return;let i=e.getMaxFlingVelocity(),a=sn(e.getRowHeight()),o=e.getScrollRatio(),s=()=>dn(this.scroll.pipelineIntervalMs,i),c=s(),l={position:t.scrollTop/o,velocity:Q(n,-c,c)},u=null;this.velocity=l.velocity,this.throttled=!1;let d=n=>{this.frame=null;let i=this.measureFrame(n,u);u=n,l=fn(l,i);let c=s();l={...l,velocity:Q(l.velocity,-c,c)},this.velocity=l.velocity,this.updateThrottle(l.velocity,a);let f=l.position*o,p=Q(f,0,t.scrollHeight-t.clientHeight),m=p!==f,h=pn(l.velocity)||m;if(h||this.isPipelineDue(n)?this.scroll.apply(e,t,p,n):t.scrollTop=p,h){this.scroll.release();return}this.frame=r(d)};this.frame=r(d)}measureFrame(e,t){if(t===null)return 16;let n=e-t;return this.frameIntervalEmaMs=Z(this.frameIntervalEmaMs,n),n}updateThrottle(e,t){if(Math.abs(e)<=t){this.throttled=!1;return}let n=this.frameIntervalEmaMs;n!==null&&n>28&&(this.throttled=!0)}isPipelineDue(e){if(this.throttled===!1)return!0;let t=this.scroll.lastRunMs;return t===null||e-t>=100}};const _n=(e,t,n,r)=>({touchId:e.identifier,startClientX:e.clientX,startClientY:e.clientY,baseScrollTop:t.scrollTop,baseScrollLeft:t.scrollLeft,engaged:!1,slopOffsetX:0,slopOffsetY:0,samples:[{time:n,position:0}],carriedVelocity:r,expectedScrollTop:t.scrollTop,expectedScrollLeft:t.scrollLeft}),vn=(e,t)=>Array.from(t.changedTouches).find(t=>t?.identifier===e.touchId)??null,yn=(e,t)=>{let n=Math.abs(t.scrollTop-e.expectedScrollTop),r=Math.abs(t.scrollLeft-e.expectedScrollLeft);return n>4||r>4},bn=(e,t,n)=>e.engaged?!0:Math.abs(t)<=10&&Math.abs(n)<=10?!1:(e.engaged=!0,e.slopOffsetX=t,e.slopOffsetY=n,!0),xn=(e,t,n,r,i)=>({top:Q(e.baseScrollTop+(i-e.slopOffsetY)*n,0,t.scrollHeight-t.clientHeight),left:Q(e.baseScrollLeft+(r-e.slopOffsetX),0,t.scrollWidth-t.clientWidth)});var Sn=class{savedOverscrollBehavior;savedTouchAction;subscribedCore=null;unsubscribe=null;el;getCore;constructor(e,t){this.el=e,this.getCore=t,this.savedOverscrollBehavior=e.style.overscrollBehavior,this.savedTouchAction=e.style.touchAction}sync(){this.syncSubscription(),this.apply()}dispose(){this.unsubscribe?.(),this.unsubscribe=null,this.subscribedCore=null,this.el.style.overscrollBehavior=this.savedOverscrollBehavior,this.el.style.touchAction=this.savedTouchAction}syncSubscription(){let e=this.getCore();e!==this.subscribedCore&&(this.unsubscribe?.(),this.unsubscribe=null,this.subscribedCore=e,e!==null&&(this.unsubscribe=e.onBatchInstruction(e=>{e.some(e=>e.type===`SET_CONTENT_SIZE`)&&this.apply()})))}apply(){let e=this.getCore()?.isScalingActive()===!0,t=e?`none`:this.savedTouchAction,n=e?`contain`:this.savedOverscrollBehavior,r=this.el.style;r.touchAction!==t&&(r.touchAction=t),r.overscrollBehavior!==n&&(r.overscrollBehavior=n)}},Cn=class{deps;scroll;fling;attachedEl=null;policy=null;gesture=null;gestureCleanup=null;dragFrame=null;pendingDragTarget=null;constructor(e){this.deps=e,this.scroll=new mn(e.getCore,()=>this.attachedEl),this.fling=new gn(this.scroll)}attach(){if(this.deps.isBrowser===!1||this.attachedEl!==null)return;let e=this.deps.getScrollEl();e!==null&&(this.attachedEl=e,this.policy=new Sn(e,this.deps.getCore),this.policy.sync(),e.addEventListener(`touchstart`,this.onTouchStart,{passive:!0}),e.addEventListener(`wheel`,this.onWheel,{passive:!0}))}detach(){this.stop(),this.clearGesture();let e=this.attachedEl;e!==null&&(this.attachedEl=null,e.removeEventListener(`touchstart`,this.onTouchStart),e.removeEventListener(`wheel`,this.onWheel),this.policy?.dispose(),this.policy=null)}syncCore(){this.policy?.sync()}stop(){this.fling.stop(),this.scroll.release()}resolveContext(){let e=this.deps.getCore(),t=this.attachedEl;return e===null||t===null?null:{core:e,el:t}}onWheel=()=>{this.stop(),this.syncCore()};onTouchStart=e=>{this.syncCore(),this.gesture===null&&this.startTouchGesture(e)};startTouchGesture(e){let t=this.fling.currentVelocity;this.stop();let n=this.resolveContext();if(n===null||n.core.isScalingActive()===!1||e.target?.closest(`.gp-grid-fill-handle, .gp-grid-cell--row-drag-handle`))return;let r=e.changedTouches[0];r!==void 0&&(this.gesture=_n(r,n.el,e.timeStamp,t),this.attachGestureListeners(n.el))}attachGestureListeners(e){e.addEventListener(`touchmove`,this.onTouchMove,{passive:!1}),e.addEventListener(`touchend`,this.onTouchEnd,{passive:!0}),e.addEventListener(`touchcancel`,this.onTouchCancel,{passive:!0}),this.gestureCleanup=()=>{e.removeEventListener(`touchmove`,this.onTouchMove),e.removeEventListener(`touchend`,this.onTouchEnd),e.removeEventListener(`touchcancel`,this.onTouchCancel)}}clearGesture(){this.gesture=null,this.gestureCleanup?.(),this.gestureCleanup=null,this.dragFrame=hn(this.dragFrame),this.pendingDragTarget=null}abandonGesture(){this.clearGesture(),this.scroll.release()}trackedTouch(e){return this.gesture===null?null:vn(this.gesture,e)}onTouchMove=e=>{let t=this.gesture,n=this.trackedTouch(e),r=this.resolveContext();if(t===null||n===null||r===null)return;if(r.core.input.getDragState().isDragging){this.abandonGesture();return}if(yn(t,r.el)){this.abandonGesture();return}e.cancelable&&e.preventDefault();let i=t.startClientX-n.clientX,a=t.startClientY-n.clientY;t.samples.push({time:e.timeStamp,position:a}),t.samples=cn(t.samples,e.timeStamp),bn(t,i,a)!==!1&&(this.pendingDragTarget=xn(t,r.el,r.core.getScrollRatio(),i,a),this.scheduleDragApply(r))};scheduleDragApply(e){if(this.dragFrame!==null)return;let t=globalThis.requestAnimationFrame;if(t===void 0){this.flushPendingDrag(e,null);return}this.dragFrame=t(t=>{this.dragFrame=null,this.flushPendingDrag(e,t)})}flushPendingDrag(e,t){let n=this.pendingDragTarget;n!==null&&(this.pendingDragTarget=null,this.applyDragTarget(e,n,t))}applyDragTarget(e,t,n){e.el.scrollLeft=t.left,this.gesture!==null&&(this.gesture.expectedScrollTop=t.top,this.gesture.expectedScrollLeft=t.left),this.scroll.apply(e.core,e.el,t.top,n)}onTouchEnd=e=>{let t=this.gesture;if(t===null||this.trackedTouch(e)===null)return;let n=this.pendingDragTarget;this.clearGesture();let r=this.resolveContext();if(r===null){this.scroll.release();return}if(n!==null&&this.applyDragTarget(r,n,e.timeStamp),t.engaged===!1)return;let i=r.core.getMaxFlingVelocity(),a=ln(cn(t.samples,e.timeStamp),i);if(Math.abs(a)<.25){this.scroll.release();return}let o=un(a,t.carriedVelocity,i);this.fling.start(r.core,r.el,o)};onTouchCancel=e=>{this.trackedTouch(e)!==null&&this.abandonGesture()}};const wn=(e,t,n,r)=>{let i={slots:new Map(t),headers:new Map(n)};for(let t of e){let e=Xt(t,i.slots,i.headers);e!==null&&Tn(e,i,r)}return i},Tn=(e,t,n)=>{e.slots!==void 0&&$(t.slots,e.slots),e.headers!==void 0&&$(t.headers,e.headers),En(e,n),e.columns!==void 0&&e.columns!==null&&n.setColumnsOverride(e.columns),e.filterPopup!==void 0&&n.onFilterPopupChange(e.filterPopup)},En=(e,t)=>{e.contentWidth!==void 0&&t.setContentWidth(e.contentWidth),e.contentHeight!==void 0&&t.setContentHeight(e.contentHeight),e.rowsWrapperOffset!==void 0&&t.setRowsWrapperOffset(e.rowsWrapperOffset),e.isLoading!==void 0&&t.setIsLoading(e.isLoading),e.error!==void 0&&t.setErrorMessage(e.error),e.totalRows!==void 0&&t.setTotalRows(e.totalRows),e.pendingScrollTop!==void 0&&t.setPendingScrollTop(e.pendingScrollTop),e.activeCell!==void 0&&t.setActiveCell(e.activeCell),e.selectionRange!==void 0&&t.setSelectionRange(e.selectionRange),e.editingCell!==void 0&&t.setEditingCell(e.editingCell),e.hoverPosition!==void 0&&t.setHoverPosition(e.hoverPosition),e.peekCell!==void 0&&t.setPeekCell(e.peekCell)},$=(e,t)=>{e.clear(),t.forEach((t,n)=>e.set(n,t))};var Dn=class{owned=null;lastAppliedRows=null;lastAppliedColumns=null;initialize(e,t){return e===null?(this.owned=J(t),this.lastAppliedRows=t,this.owned):e}syncRows(e,t){return t!==null||this.lastAppliedRows===e?null:(this.lastAppliedRows=e,e.length>1e4&&console.warn(`[gp-grid] rows input changed with ${e.length} rows — this triggers a full rebuild. Use createGridData() for efficient updates.`),this.owned?.destroy?.(),this.owned=J(e),this.owned)}syncColumns(e){return e.length===0||this.lastAppliedColumns===e?!1:(this.lastAppliedColumns=e,!0)}destroy(){this.owned?.destroy?.(),this.owned=null}},On=class{deps;constructor(e){this.deps=e}headerPointerDown(e,t,n,r){let i=this.deps.getCore();return i!==null&&i.input.handleHeaderMouseDown(e,t,n,X(r)).preventDefault}resizePointerDown(e,t,n){let r=this.deps.getCore();return r!==null&&r.input.handleHeaderResizeMouseDown(e,t,X(n)).preventDefault}cellPointerDown(e,t,n){let r=this.deps.getCore();if(r===null)return{preventDefault:!1,focusContainer:!1};let i=r.input.handleCellMouseDown(e,t,X(n));return this.dispatchCellDragStart(i,n),{preventDefault:i.preventDefault,focusContainer:i.focusContainer??!1}}cellPointerEnter(e,t){this.deps.getCore()?.input.handleCellMouseEnter(e,t)}cellPointerLeave(){this.deps.getCore()?.input.handleCellMouseLeave()}fillHandlePointerDown(e,t,n){let r=this.deps.getCore();if(r===null)return{preventDefault:!1,stopPropagation:!1};let i=r.input.handleFillHandleMouseDown(e,t,X(n));return i.startDrag===`fill`&&(kn(n),this.deps.onDragStateChange(r.input.getDragState())),{preventDefault:i.preventDefault,stopPropagation:i.stopPropagation}}dragMove(e){let t=this.deps.getCore(),n=this.deps.getBodyEl();if(t===null||n===null)return;let r=n.getBoundingClientRect(),i=t.input.handleDragMove(X(e),{top:r.top,left:r.left,width:r.width,height:r.height,scrollTop:n.scrollTop,scrollLeft:n.scrollLeft});this.deps.onDragStateChange(t.input.getDragState()),i?.autoScroll?this.deps.autoScroll.start(i.autoScroll.dx,i.autoScroll.dy):this.deps.autoScroll.stop()}documentPointerMove(e){let t=this.deps.getCore();if(t===null)return!1;let n=t.input.getDragState().isDragging;return this.deps.autoScroll.recordPointer(e),this.dragMove(e),n}documentPointerUp(){let e=this.deps.getCore();if(e===null)return{wasRowDrag:!1};let t=e.input.getDragState().dragType===`row-drag`;return this.deps.autoScroll.stop(),this.deps.autoScroll.clearPointer(),e.input.handleDragEnd(),this.deps.onDragStateChange(e.input.getDragState()),{wasRowDrag:t}}wheel(e,t,n){let r=this.deps.getCore();return r===null?null:r.input.handleWheel(e,t,n)}keyDown(e,t,n,r){let i=this.deps.getCore();return i===null?{preventDefault:!1}:i.input.handleKeyDown({key:e.key,shiftKey:e.shiftKey,ctrlKey:e.ctrlKey,metaKey:e.metaKey},t,n,r)}pasteText(e,t,n){let r=this.deps.getCore();return r===null||t!==null||n?!1:r.pasteClipboardText(e)}dispatchCellDragStart(e,t){let n=this.deps.getCore();if(n!==null){if(e.startTap===!0&&this.deps.pendingCellTap.start(t),e.startDrag===`selection`){n.input.startSelectionDrag(),this.deps.onDragStateChange(n.input.getDragState());return}if(e.startDrag===`row-drag`){this.deps.onDragStateChange(n.input.getDragState());return}e.startDrag===`row-drag-pending`&&this.deps.pendingRowDrag.start(t)}}};const kn=e=>{e.target.setPointerCapture(e.pointerId)};export{nn as AutoScrollDriver,Dn as DataSourceOwner,ot as GridCore,qt as IndexedDataStore,On as InputEventAdapter,w as InputHandler,on as PendingCellTapController,rn as PendingRowDragController,ye as ROW_DRAG_HOLD_MS,ve as TAP_SLOP_PX,Cn as TouchScrollController,P as TransactionManager,wn as applyBatchInstructions,Xt as applyInstruction,ae as bindPeekSelectAll,p as buildCellClasses,n as calculateColumnPositions,re as calculateFillHandlePosition,ie as calculateFilterPopupPosition,i as calculateScaledColumnPositions,Bt as createClientDataSource,J as createDataSourceFromArray,Yt as createInitialState,Jt as createMutableClientDataSource,Vt as createServerDataSource,Y as defaultGridLabels,q as evaluateColumnFilter,Ft as evaluateDateCondition,Nt as evaluateNumberCondition,jt as evaluateTextCondition,a as findColumnAtX,x as formatCellValue,Qt as formatLabel,tn as getDateOperatorOptions,g as getFieldValue,en as getNumberOperatorOptions,$t as getTextOperatorOptions,r as getTotalWidth,Ie as groupDistinctValues,A as isBlankCellValue,l as isCellActive,d as isCellEditing,f as isCellInFillPreview,c as isCellSelected,j as isLegacyColumnFilterModel,u as isRowVisible,K as isSameDay,Le as labelsForSelectedValues,N as normalizeColumnFilterModel,k as rawValueKey,Re as rawValuesForLabels,Zt as resolveGridLabels,Rt as rowPassesFilter,ne as scrollCellIntoView,_ as setFieldValue,X as toPointerEventData};
|
package/dist/styles.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.gp-grid-container{--gp-grid-bg:#fff;--gp-grid-bg-alt:#f8f9fa;--gp-grid-text:#212529;--gp-grid-text-secondary:#6c757d;--gp-grid-text-muted:#adb5bd;--gp-grid-border:#dee2e6;--gp-grid-border-light:#e9ecef;--gp-grid-header-bg:#f1f3f5;--gp-grid-header-text:#212529;--gp-grid-header-z-index:10;--gp-grid-primary:#228be6;--gp-grid-primary-light:#e7f5ff;--gp-grid-primary-border:#74c0fc;--gp-grid-hover:#f1f3f5;--gp-grid-filter-bg:#f8f9fa;--gp-grid-input-bg:#fff;--gp-grid-input-border:#ced4da;--gp-grid-error-bg:#fff5f5;--gp-grid-error-text:#c92a2a;--gp-grid-loading-bg:#fffffff2;--gp-grid-loading-text:#495057;--gp-grid-scrollbar-track:#f1f3f5;--gp-grid-scrollbar-thumb:#ced4da;--gp-grid-scrollbar-thumb-hover:#adb5bd}.gp-grid-container--dark{--gp-grid-bg:#1a1b1e;--gp-grid-bg-alt:#25262b;--gp-grid-text:#c1c2c5;--gp-grid-text-secondary:#909296;--gp-grid-text-muted:#5c5f66;--gp-grid-border:#373a40;--gp-grid-border-light:#2c2e33;--gp-grid-header-bg:#25262b;--gp-grid-header-text:#c1c2c5;--gp-grid-header-z-index:10;--gp-grid-primary:#339af0;--gp-grid-primary-light:#1c3d5a;--gp-grid-primary-border:#1c7ed6;--gp-grid-hover:#2c2e33;--gp-grid-filter-bg:#25262b;--gp-grid-input-bg:#1a1b1e;--gp-grid-input-border:#373a40;--gp-grid-error-bg:#2c1a1a;--gp-grid-error-text:#ff6b6b;--gp-grid-loading-bg:#1a1b1ef2;--gp-grid-loading-text:#c1c2c5;--gp-grid-scrollbar-track:#25262b;--gp-grid-scrollbar-thumb:#373a40;--gp-grid-scrollbar-thumb-hover:#4a4d52}.gp-grid-container{-webkit-user-select:none;user-select:none;outline:none}:where(.gp-grid-container){color:var(--gp-grid-text);background-color:var(--gp-grid-bg);border:1px solid var(--gp-grid-border);border-radius:6px;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,sans-serif;font-size:13px;line-height:1.5}.gp-grid-container:focus{outline:none}:where(.gp-grid-container:focus){border-color:var(--gp-grid-primary)}.gp-grid-header{z-index:11;flex-shrink:0;position:sticky;top:0;left:0;overflow:hidden}:where(.gp-grid-header){background-color:var(--gp-grid-header-bg);border-bottom:1px solid var(--gp-grid-border)}.gp-grid-container .gp-grid-header-cell{box-sizing:border-box;user-select:none;touch-action:none;display:flex;position:absolute;top:0}:where(.gp-grid-header-cell){border-right:1px solid var(--gp-grid-border);letter-spacing:.5px;color:var(--gp-grid-header-text);cursor:pointer;background-color:#0000;align-items:center;padding:0 12px;font-size:12px;font-weight:600;transition:background-color .1s}:where(.gp-grid-header-cell:hover){background-color:var(--gp-grid-hover)}:where(.gp-grid-header-cell:active){background-color:var(--gp-grid-border-light)}.gp-grid-container .gp-grid-header-text{text-overflow:ellipsis;white-space:nowrap;flex:1;overflow:hidden}:where(.gp-grid-header-text){color:var(--gp-grid-header-text)}.gp-grid-header-icons{align-items:center;gap:4px;margin-left:auto;display:flex}.gp-grid-sort-arrows{flex-direction:row;align-items:center;gap:2px;margin-left:6px;display:flex}.gp-grid-sort-arrows-stack{flex-direction:column;align-items:center;gap:2px;display:flex}:where(.gp-grid-sort-arrow-up),:where(.gp-grid-sort-arrow-down){opacity:.35;color:var(--gp-grid-text);transition:opacity .15s,color .15s}:where(.gp-grid-sort-arrow-up.active),:where(.gp-grid-sort-arrow-down.active){opacity:1;color:var(--gp-grid-primary)}:where(.gp-grid-sort-index){color:var(--gp-grid-primary);font-size:9px;font-weight:600}.gp-grid-filter-icon{justify-content:center;align-items:center;width:20px;height:20px;display:flex}:where(.gp-grid-filter-icon){cursor:pointer;color:var(--gp-grid-text-secondary);border-radius:4px;margin-left:2px;transition:background-color .15s,color .15s}:where(.gp-grid-filter-icon:hover){background-color:var(--gp-grid-hover);color:var(--gp-grid-primary)}:where(.gp-grid-filter-icon.active){color:var(--gp-grid-primary);background-color:var(--gp-grid-primary-light)}@media (pointer:coarse) and (hover:none) and (width<=768px){.gp-grid-filter-icon{width:44px;min-width:44px;height:44px;min-height:44px}:where(.gp-grid-filter-icon){margin-left:0}.gp-grid-filter-icon svg{width:20px;height:20px}}.gp-grid-header--loading .gp-grid-header-cell{pointer-events:none}:where(.gp-grid-header--loading .gp-grid-header-cell){opacity:.6;cursor:default}.gp-grid-header-resize-handle{cursor:col-resize;z-index:10;touch-action:none;width:6px;height:100%;position:absolute;top:0;right:-3px}:where(.gp-grid-header-resize-handle:hover),:where(.gp-grid-header-resize-handle--active){background-color:var(--gp-grid-primary);opacity:.4}@media (pointer:coarse) and (hover:none) and (width<=768px){.gp-grid-header-resize-handle{width:24px;right:-12px}}.gp-grid-column-resize-line{z-index:1000;pointer-events:none;width:2px;height:100%;position:absolute;top:0}:where(.gp-grid-column-resize-line){background-color:var(--gp-grid-primary)}.gp-grid-column-move-ghost{pointer-events:none;z-index:2000;box-sizing:border-box;white-space:nowrap;text-overflow:ellipsis;align-items:center;display:flex;position:fixed;overflow:hidden}:where(.gp-grid-column-move-ghost){opacity:.7;background-color:var(--gp-grid-header-bg);border:2px solid var(--gp-grid-primary);letter-spacing:.5px;color:var(--gp-grid-header-text);border-radius:4px;padding:0 12px;font-size:12px;font-weight:600;box-shadow:0 4px 12px #00000026}.gp-grid-column-drop-indicator{z-index:1000;pointer-events:none;width:3px;height:100%;position:absolute;top:0;left:0}:where(.gp-grid-column-drop-indicator){background-color:var(--gp-grid-primary);border-radius:2px}.gp-grid-rows-wrapper{z-index:1;will-change:transform;position:absolute;top:0;left:0}.gp-grid-row{position:absolute;top:0;left:0}:where(.gp-grid-row){background-color:var(--gp-grid-bg)}.gp-grid-cell{box-sizing:border-box;white-space:nowrap;-webkit-user-select:none;user-select:none;display:flex;position:absolute;top:0;overflow:hidden}.gp-grid-cell-content{text-overflow:ellipsis;white-space:nowrap;flex:auto;min-width:0;overflow:hidden}.gp-grid-cell--wrap{align-items:flex-start}.gp-grid-cell--wrap .gp-grid-cell-content{white-space:normal;overflow-wrap:anywhere;text-overflow:clip}:where(.gp-grid-cell){cursor:cell;color:var(--gp-grid-text);border-right:1px solid var(--gp-grid-border-light);border-bottom:1px solid var(--gp-grid-border-light);background-color:#0000;align-items:center;padding:0 12px}.gp-grid-cell--active{z-index:5;outline:none}:where(.gp-grid-cell--active){background-color:var(--gp-grid-primary-light);border:2px solid var(--gp-grid-primary);padding:0 11px}:where(.gp-grid-cell--selected){background-color:var(--gp-grid-primary-light)}.gp-grid-cell--editing{z-index:10}:where(.gp-grid-cell--editing){background-color:var(--gp-grid-bg);border:2px solid var(--gp-grid-primary);padding:0}.gp-grid-fill-handle{z-index:11;pointer-events:auto;box-sizing:border-box;touch-action:none;width:8px;height:8px;position:absolute}:where(.gp-grid-fill-handle){background-color:var(--gp-grid-primary);border:2px solid var(--gp-grid-bg);cursor:crosshair;border-radius:1px}:where(.gp-grid-fill-handle:hover){transform:scale(1.2)}@media (pointer:coarse) and (hover:none) and (width<=768px){.gp-grid-fill-handle{width:24px;height:24px}:where(.gp-grid-fill-handle){border-width:3px;border-radius:3px}}:where(.gp-grid-cell.gp-grid-cell--fill-preview){background-color:var(--gp-grid-primary-light);border:1px dashed var(--gp-grid-primary)}.gp-grid-edit-input{width:100%;height:100%}:where(.gp-grid-edit-input){font-family:inherit;font-size:inherit;color:var(--gp-grid-text);background-color:#0000;border:none;padding:0 11px}.gp-grid-edit-input:focus{outline:none}.gp-grid-cell-peek{z-index:20;box-sizing:border-box;max-height:320px;position:absolute;overflow:auto}:where(.gp-grid-cell-peek){background-color:var(--gp-grid-bg);color:var(--gp-grid-text);border:2px solid var(--gp-grid-primary);font-family:inherit;font-size:inherit;white-space:pre-wrap;overflow-wrap:anywhere;cursor:text;-webkit-user-select:text;user-select:text;border-radius:3px;padding:8px 11px;line-height:1.4;box-shadow:0 4px 12px #00000026}.gp-grid-cell-peek .gp-grid-cell-content{white-space:inherit;text-overflow:clip;overflow:visible}.gp-grid-loading-anchor{z-index:900;pointer-events:none;height:0;position:sticky;top:0;left:0;overflow:visible}.gp-grid-loading-overlay{pointer-events:none;width:100%;height:100%;position:absolute;top:0;left:0}:where(.gp-grid-loading-overlay){background-color:var(--gp-grid-loading-overlay-bg,#fff6)}:where(.gp-grid-container--dark .gp-grid-loading-overlay){background-color:var(--gp-grid-loading-overlay-bg,#0000004d)}.gp-grid-loading{z-index:1000;pointer-events:auto;display:flex;position:absolute;top:50%;left:50%;transform:translate(-50%,-50%)}:where(.gp-grid-loading){background-color:var(--gp-grid-loading-bg);color:var(--gp-grid-loading-text);border:1px solid var(--gp-grid-border);border-radius:6px;align-items:center;gap:10px;padding:12px 20px;font-size:13px;font-weight:500}.gp-grid-loading-spinner{width:16px;height:16px;animation:.7s linear infinite gp-grid-spin}:where(.gp-grid-loading-spinner){border:2px solid var(--gp-grid-border);border-top-color:var(--gp-grid-primary);border-radius:50%}@keyframes gp-grid-spin{to{transform:rotate(360deg)}}.gp-grid-error{z-index:1000;-webkit-user-select:text;user-select:text;position:absolute;top:50%;left:50%;transform:translate(-50%,-50%)}:where(.gp-grid-error){background-color:var(--gp-grid-error-bg);color:var(--gp-grid-error-text);border:1px solid var(--gp-grid-error-text);text-align:center;cursor:text;border-radius:6px;max-width:80%;padding:12px 20px;font-size:13px;font-weight:500}.gp-grid-empty{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%)}:where(.gp-grid-empty){color:var(--gp-grid-text-muted);text-align:center;font-size:14px}.gp-grid-container::-webkit-scrollbar{width:8px;height:8px}:where(.gp-grid-container)::-webkit-scrollbar-track{background-color:var(--gp-grid-scrollbar-track)}:where(.gp-grid-container)::-webkit-scrollbar-thumb{background-color:var(--gp-grid-scrollbar-thumb);border-radius:4px}:where(.gp-grid-container)::-webkit-scrollbar-thumb:hover{background-color:var(--gp-grid-scrollbar-thumb-hover)}:where(.gp-grid-container)::-webkit-scrollbar-corner{background-color:var(--gp-grid-scrollbar-track)}.gp-grid-filter-popup{flex-direction:column;max-width:min(360px,100vw - 16px);max-height:400px;display:flex}:where(.gp-grid-filter-popup){background-color:var(--gp-grid-bg);border:1px solid var(--gp-grid-border);border-radius:6px;font-size:13px;box-shadow:0 4px 12px #00000026}:where(.gp-grid-filter-header){border-bottom:1px solid var(--gp-grid-border-light);color:var(--gp-grid-header-text);padding:10px 12px;font-weight:600}.gp-grid-filter-content{flex-direction:column;min-height:0;display:flex;overflow-y:auto}:where(.gp-grid-filter-content){gap:10px;padding:10px 12px}.gp-grid-filter-mode-toggle{display:flex}:where(.gp-grid-filter-mode-toggle){background-color:var(--gp-grid-bg-alt);border-radius:4px;gap:4px;padding:2px}.gp-grid-filter-mode-toggle button{flex:1}:where(.gp-grid-filter-mode-toggle button){color:var(--gp-grid-text-secondary);cursor:pointer;background-color:#0000;border:none;border-radius:3px;padding:6px 10px;font-family:inherit;font-size:11px;transition:background-color .15s,color .15s}:where(.gp-grid-filter-mode-toggle button:hover){color:var(--gp-grid-text)}:where(.gp-grid-filter-mode-toggle button.active){background-color:var(--gp-grid-bg);color:var(--gp-grid-text);box-shadow:0 1px 2px #0000001a}:where(.gp-grid-filter-info){color:var(--gp-grid-text-secondary);background-color:var(--gp-grid-bg-alt);border-radius:4px;padding:6px 8px;font-size:11px}.gp-grid-filter-search{box-sizing:border-box;width:100%;height:30px}:where(.gp-grid-filter-search){border:1px solid var(--gp-grid-input-border);background-color:var(--gp-grid-input-bg);color:var(--gp-grid-text);border-radius:4px;padding:0 10px;font-family:inherit;font-size:12px}:where(.gp-grid-filter-search:focus){border-color:var(--gp-grid-primary);outline:none}.gp-grid-filter-actions{display:flex}:where(.gp-grid-filter-actions){gap:8px}.gp-grid-filter-actions button{flex:1}:where(.gp-grid-filter-actions button){border:1px solid var(--gp-grid-input-border);background-color:var(--gp-grid-bg);color:var(--gp-grid-text);cursor:pointer;border-radius:3px;padding:4px 8px;font-family:inherit;font-size:11px}:where(.gp-grid-filter-actions button:hover:not(:disabled)){background-color:var(--gp-grid-hover)}:where(.gp-grid-filter-actions button:disabled){opacity:.5;cursor:not-allowed}.gp-grid-filter-list{flex-direction:column;max-height:200px;display:flex;overflow-y:auto}:where(.gp-grid-filter-list){border:1px solid var(--gp-grid-border-light);border-radius:4px;gap:4px;padding:6px}.gp-grid-filter-option{align-items:center;display:flex}:where(.gp-grid-filter-option){cursor:pointer;border-radius:3px;gap:8px;padding:4px 6px}:where(.gp-grid-filter-option:hover){background-color:var(--gp-grid-hover)}.gp-grid-filter-option input[type=checkbox]{margin:0}:where(.gp-grid-filter-option input[type=checkbox]){cursor:pointer}.gp-grid-filter-option span{text-overflow:ellipsis;white-space:nowrap;flex:1;overflow:hidden}:where(.gp-grid-filter-blank){color:var(--gp-grid-text-muted);font-style:italic}.gp-grid-filter-condition{flex-direction:column;display:flex}:where(.gp-grid-filter-condition){gap:6px}.gp-grid-filter-row{align-items:center;display:flex}:where(.gp-grid-filter-row){gap:6px}.gp-grid-filter-row select{height:30px}:where(.gp-grid-filter-row select){border:1px solid var(--gp-grid-input-border);background-color:var(--gp-grid-input-bg);color:var(--gp-grid-text);cursor:pointer;border-radius:4px;padding:0 6px;font-family:inherit;font-size:12px}.gp-grid-filter-row input[type=number],.gp-grid-filter-row input[type=date],.gp-grid-filter-row input[type=text],.gp-grid-filter-text-input{box-sizing:border-box;flex:1;min-width:0;height:30px}:where(.gp-grid-filter-row input[type=number]),:where(.gp-grid-filter-row input[type=date]),:where(.gp-grid-filter-row input[type=text]),:where(.gp-grid-filter-text-input){border:1px solid var(--gp-grid-input-border);background-color:var(--gp-grid-input-bg);color:var(--gp-grid-text);border-radius:4px;padding:0 8px;font-family:inherit;font-size:12px}:where(.gp-grid-filter-row input:focus){border-color:var(--gp-grid-primary);outline:none}:where(.gp-grid-filter-to){color:var(--gp-grid-text-secondary);font-size:11px}.gp-grid-filter-remove{width:24px;height:24px}:where(.gp-grid-filter-remove){color:var(--gp-grid-text-muted);cursor:pointer;background-color:#0000;border:none;border-radius:3px;padding:0;font-size:16px;line-height:1}:where(.gp-grid-filter-remove:hover){background-color:var(--gp-grid-error-bg);color:var(--gp-grid-error-text)}.gp-grid-filter-combination{display:flex}:where(.gp-grid-filter-combination){gap:4px;margin-bottom:4px}.gp-grid-filter-combination button{flex:1}:where(.gp-grid-filter-combination button){border:1px solid var(--gp-grid-input-border);background-color:var(--gp-grid-bg);color:var(--gp-grid-text-secondary);cursor:pointer;border-radius:3px;padding:4px 8px;font-family:inherit;font-size:10px}:where(.gp-grid-filter-combination button.active){background-color:var(--gp-grid-primary);border-color:var(--gp-grid-primary);color:#fff}.gp-grid-filter-add{width:100%}:where(.gp-grid-filter-add){border:1px dashed var(--gp-grid-border);color:var(--gp-grid-text-secondary);cursor:pointer;background-color:#0000;border-radius:4px;padding:6px;font-family:inherit;font-size:11px}:where(.gp-grid-filter-add:hover){background-color:var(--gp-grid-hover);border-color:var(--gp-grid-primary);color:var(--gp-grid-primary)}.gp-grid-filter-buttons{display:flex}:where(.gp-grid-filter-buttons){border-top:1px solid var(--gp-grid-border-light);gap:8px;padding-top:8px}.gp-grid-filter-btn-clear,.gp-grid-filter-btn-apply{flex:1}:where(.gp-grid-filter-btn-clear),:where(.gp-grid-filter-btn-apply){cursor:pointer;border-radius:4px;padding:8px 12px;font-family:inherit;font-size:12px}:where(.gp-grid-filter-btn-clear){border:1px solid var(--gp-grid-input-border);background-color:var(--gp-grid-bg);color:var(--gp-grid-text)}:where(.gp-grid-filter-btn-clear:hover){background-color:var(--gp-grid-hover)}:where(.gp-grid-filter-btn-apply){border:1px solid var(--gp-grid-primary);background-color:var(--gp-grid-primary);color:#fff}:where(.gp-grid-filter-btn-apply:hover){opacity:.9}.gp-grid-cell--row-drag-handle{touch-action:none}:where(.gp-grid-cell--row-drag-handle){cursor:grab}:where(.gp-grid-cell--row-drag-handle:active){cursor:grabbing}.gp-grid-row-drag-icon{justify-content:center;align-items:center;width:100%;height:100%;display:flex}:where(.gp-grid-row-drag-icon){color:var(--gp-grid-text-secondary)}.gp-grid-row-drag-icon svg{width:16px;height:16px}.gp-grid-row-drag-ghost{pointer-events:none;z-index:2000;box-sizing:border-box;position:fixed;overflow:hidden}:where(.gp-grid-row-drag-ghost){opacity:.8;background-color:var(--gp-grid-bg,#fff);border:2px solid var(--gp-grid-primary);border-radius:4px;box-shadow:0 4px 12px #00000026}.gp-grid-row-drop-indicator{z-index:1000;pointer-events:none;width:100%;height:3px;position:absolute;left:0}:where(.gp-grid-row-drop-indicator){background-color:var(--gp-grid-primary);border-radius:2px}
|
|
1
|
+
.gp-grid-container{--gp-grid-bg:#fff;--gp-grid-bg-alt:#f8f9fa;--gp-grid-text:#212529;--gp-grid-text-secondary:#6c757d;--gp-grid-text-muted:#adb5bd;--gp-grid-border:#dee2e6;--gp-grid-border-light:#e9ecef;--gp-grid-header-bg:#f1f3f5;--gp-grid-header-text:#212529;--gp-grid-header-z-index:10;--gp-grid-primary:#228be6;--gp-grid-primary-light:#e7f5ff;--gp-grid-primary-border:#74c0fc;--gp-grid-hover:#f1f3f5;--gp-grid-filter-bg:#f8f9fa;--gp-grid-input-bg:#fff;--gp-grid-input-border:#ced4da;--gp-grid-error-bg:#fff5f5;--gp-grid-error-text:#c92a2a;--gp-grid-loading-bg:#fffffff2;--gp-grid-loading-text:#495057;--gp-grid-scrollbar-track:#f1f3f5;--gp-grid-scrollbar-thumb:#ced4da;--gp-grid-scrollbar-thumb-hover:#adb5bd}.gp-grid-container--dark{--gp-grid-bg:#1a1b1e;--gp-grid-bg-alt:#25262b;--gp-grid-text:#c1c2c5;--gp-grid-text-secondary:#909296;--gp-grid-text-muted:#5c5f66;--gp-grid-border:#373a40;--gp-grid-border-light:#2c2e33;--gp-grid-header-bg:#25262b;--gp-grid-header-text:#c1c2c5;--gp-grid-header-z-index:10;--gp-grid-primary:#339af0;--gp-grid-primary-light:#1c3d5a;--gp-grid-primary-border:#1c7ed6;--gp-grid-hover:#2c2e33;--gp-grid-filter-bg:#25262b;--gp-grid-input-bg:#1a1b1e;--gp-grid-input-border:#373a40;--gp-grid-error-bg:#2c1a1a;--gp-grid-error-text:#ff6b6b;--gp-grid-loading-bg:#1a1b1ef2;--gp-grid-loading-text:#c1c2c5;--gp-grid-scrollbar-track:#25262b;--gp-grid-scrollbar-thumb:#373a40;--gp-grid-scrollbar-thumb-hover:#4a4d52}.gp-grid-container{-webkit-user-select:none;user-select:none;outline:none}:where(.gp-grid-container){color:var(--gp-grid-text);background-color:var(--gp-grid-bg);border:1px solid var(--gp-grid-border);border-radius:6px;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,sans-serif;font-size:13px;line-height:1.5}.gp-grid-container:focus{outline:none}:where(.gp-grid-container:focus){border-color:var(--gp-grid-primary)}.gp-grid-header{z-index:11;flex-shrink:0;position:sticky;top:0;left:0;overflow:hidden}:where(.gp-grid-header){background-color:var(--gp-grid-header-bg);border-bottom:1px solid var(--gp-grid-border)}.gp-grid-container .gp-grid-header-cell{box-sizing:border-box;user-select:none;touch-action:none;display:flex;position:absolute;top:0}:where(.gp-grid-header-cell){border-right:1px solid var(--gp-grid-border);letter-spacing:.5px;color:var(--gp-grid-header-text);cursor:pointer;background-color:#0000;align-items:center;padding:0 12px;font-size:12px;font-weight:600;transition:background-color .1s}:where(.gp-grid-header-cell:hover){background-color:var(--gp-grid-hover)}:where(.gp-grid-header-cell:active){background-color:var(--gp-grid-border-light)}.gp-grid-container .gp-grid-header-text{text-overflow:ellipsis;white-space:nowrap;flex:1;overflow:hidden}:where(.gp-grid-header-text){color:var(--gp-grid-header-text)}.gp-grid-header-icons{align-items:center;gap:4px;margin-left:auto;display:flex}.gp-grid-sort-arrows{flex-direction:row;align-items:center;gap:2px;margin-left:6px;display:flex}.gp-grid-sort-arrows-stack{flex-direction:column;align-items:center;gap:2px;display:flex}:where(.gp-grid-sort-arrow-up),:where(.gp-grid-sort-arrow-down){opacity:.35;color:var(--gp-grid-text);transition:opacity .15s,color .15s}:where(.gp-grid-sort-arrow-up.active),:where(.gp-grid-sort-arrow-down.active){opacity:1;color:var(--gp-grid-primary)}:where(.gp-grid-sort-index){color:var(--gp-grid-primary);font-size:9px;font-weight:600}.gp-grid-filter-icon{justify-content:center;align-items:center;width:20px;height:20px;display:flex}:where(.gp-grid-filter-icon){cursor:pointer;color:var(--gp-grid-text-secondary);border-radius:4px;margin-left:2px;transition:background-color .15s,color .15s}:where(.gp-grid-filter-icon:hover){background-color:var(--gp-grid-hover);color:var(--gp-grid-primary)}:where(.gp-grid-filter-icon.active){color:var(--gp-grid-primary);background-color:var(--gp-grid-primary-light)}@media (pointer:coarse) and (hover:none) and (width<=768px){.gp-grid-filter-icon{width:44px;min-width:44px;height:44px;min-height:44px}:where(.gp-grid-filter-icon){margin-left:0}.gp-grid-filter-icon svg{width:20px;height:20px}}.gp-grid-header--loading .gp-grid-header-cell{pointer-events:none}:where(.gp-grid-header--loading .gp-grid-header-cell){opacity:.6;cursor:default}.gp-grid-header-resize-handle{cursor:col-resize;z-index:10;touch-action:none;width:6px;height:100%;position:absolute;top:0;right:-3px}:where(.gp-grid-header-resize-handle:hover),:where(.gp-grid-header-resize-handle--active){background-color:var(--gp-grid-primary);opacity:.4}@media (pointer:coarse) and (hover:none) and (width<=768px){.gp-grid-header-resize-handle{width:24px;right:-12px}}.gp-grid-column-resize-line{z-index:1000;pointer-events:none;width:2px;height:100%;position:absolute;top:0}:where(.gp-grid-column-resize-line){background-color:var(--gp-grid-primary)}.gp-grid-column-move-ghost{pointer-events:none;z-index:2000;box-sizing:border-box;white-space:nowrap;text-overflow:ellipsis;align-items:center;display:flex;position:fixed;overflow:hidden}:where(.gp-grid-column-move-ghost){opacity:.7;background-color:var(--gp-grid-header-bg);border:2px solid var(--gp-grid-primary);letter-spacing:.5px;color:var(--gp-grid-header-text);border-radius:4px;padding:0 12px;font-size:12px;font-weight:600;box-shadow:0 4px 12px #00000026}.gp-grid-column-drop-indicator{z-index:1000;pointer-events:none;width:3px;height:100%;position:absolute;top:0;left:0}:where(.gp-grid-column-drop-indicator){background-color:var(--gp-grid-primary);border-radius:2px}.gp-grid-rows-wrapper{z-index:1;will-change:transform;position:absolute;top:0;left:0}.gp-grid-row{position:absolute;top:0;left:0}:where(.gp-grid-row){background-color:var(--gp-grid-bg)}.gp-grid-cell{box-sizing:border-box;white-space:nowrap;-webkit-user-select:none;user-select:none;display:flex;position:absolute;top:0;overflow:hidden}.gp-grid-cell-content{text-overflow:ellipsis;white-space:nowrap;flex:auto;min-width:0;overflow:hidden}.gp-grid-cell--wrap{align-items:flex-start}.gp-grid-cell--wrap .gp-grid-cell-content{white-space:normal;overflow-wrap:anywhere;text-overflow:clip}:where(.gp-grid-cell){cursor:cell;color:var(--gp-grid-text);border-right:1px solid var(--gp-grid-border-light);border-bottom:1px solid var(--gp-grid-border-light);background-color:#0000;align-items:center;padding:0 12px}.gp-grid-cell--active{z-index:5;outline:none}:where(.gp-grid-cell--active){background-color:var(--gp-grid-primary-light);border:2px solid var(--gp-grid-primary);padding:0 11px}:where(.gp-grid-cell--selected){background-color:var(--gp-grid-primary-light)}.gp-grid-cell--editing{z-index:10}:where(.gp-grid-cell--editing){background-color:var(--gp-grid-bg);border:2px solid var(--gp-grid-primary);padding:0}.gp-grid-fill-handle{z-index:11;pointer-events:auto;box-sizing:border-box;touch-action:none;width:8px;height:8px;position:absolute}:where(.gp-grid-fill-handle){background-color:var(--gp-grid-primary);border:2px solid var(--gp-grid-bg);cursor:crosshair;border-radius:1px}:where(.gp-grid-fill-handle:hover){transform:scale(1.2)}@media (pointer:coarse) and (hover:none) and (width<=768px){.gp-grid-fill-handle{width:24px;height:24px}:where(.gp-grid-fill-handle){border-width:3px;border-radius:3px}}:where(.gp-grid-cell.gp-grid-cell--fill-preview){background-color:var(--gp-grid-primary-light);border:1px dashed var(--gp-grid-primary)}.gp-grid-edit-input{width:100%;height:100%}:where(.gp-grid-edit-input){font-family:inherit;font-size:inherit;color:var(--gp-grid-text);background-color:#0000;border:none;padding:0 11px}.gp-grid-edit-input:focus{outline:none}.gp-grid-cell-peek{z-index:20;box-sizing:border-box;max-height:320px;position:absolute;overflow:auto}:where(.gp-grid-cell-peek){background-color:var(--gp-grid-bg);color:var(--gp-grid-text);border:2px solid var(--gp-grid-primary);font-family:inherit;font-size:inherit;white-space:pre-wrap;overflow-wrap:anywhere;cursor:text;-webkit-user-select:text;user-select:text;border-radius:3px;padding:8px 11px;line-height:1.4;box-shadow:0 4px 12px #00000026}.gp-grid-cell-peek .gp-grid-cell-content{white-space:inherit;text-overflow:clip;overflow:visible}.gp-grid-loading-anchor{z-index:900;pointer-events:none;height:0;position:sticky;top:0;left:0;overflow:visible}.gp-grid-loading-overlay{pointer-events:none;width:100%;height:100%;position:absolute;top:0;left:0}:where(.gp-grid-loading-overlay){background-color:var(--gp-grid-loading-overlay-bg,#fff6)}:where(.gp-grid-container--dark .gp-grid-loading-overlay){background-color:var(--gp-grid-loading-overlay-bg,#0000004d)}.gp-grid-loading{z-index:1000;pointer-events:auto;display:flex;position:absolute;top:50%;left:50%;transform:translate(-50%,-50%)}:where(.gp-grid-loading){background-color:var(--gp-grid-loading-bg);color:var(--gp-grid-loading-text);border:1px solid var(--gp-grid-border);border-radius:6px;align-items:center;gap:10px;padding:12px 20px;font-size:13px;font-weight:500}.gp-grid-loading-spinner{width:16px;height:16px;animation:.7s linear infinite gp-grid-spin}:where(.gp-grid-loading-spinner){border:2px solid var(--gp-grid-border);border-top-color:var(--gp-grid-primary);border-radius:50%}@keyframes gp-grid-spin{to{transform:rotate(360deg)}}.gp-grid-error{z-index:1000;-webkit-user-select:text;user-select:text;position:absolute;top:50%;left:50%;transform:translate(-50%,-50%)}:where(.gp-grid-error){background-color:var(--gp-grid-error-bg);color:var(--gp-grid-error-text);border:1px solid var(--gp-grid-error-text);text-align:center;cursor:text;border-radius:6px;max-width:80%;padding:12px 20px;font-size:13px;font-weight:500}.gp-grid-empty{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%)}:where(.gp-grid-empty){color:var(--gp-grid-text-muted);text-align:center;font-size:14px}.gp-grid-container::-webkit-scrollbar{width:8px;height:8px}:where(.gp-grid-container)::-webkit-scrollbar-track{background-color:var(--gp-grid-scrollbar-track)}:where(.gp-grid-container)::-webkit-scrollbar-thumb{background-color:var(--gp-grid-scrollbar-thumb);border-radius:4px}:where(.gp-grid-container)::-webkit-scrollbar-thumb:hover{background-color:var(--gp-grid-scrollbar-thumb-hover)}:where(.gp-grid-container)::-webkit-scrollbar-corner{background-color:var(--gp-grid-scrollbar-track)}.gp-grid-filter-popup{flex-direction:column;max-width:min(360px,100vw - 16px);max-height:400px;display:flex}:where(.gp-grid-filter-popup){background-color:var(--gp-grid-bg);border:1px solid var(--gp-grid-border);border-radius:6px;font-size:13px;box-shadow:0 4px 12px #00000026}:where(.gp-grid-filter-header){border-bottom:1px solid var(--gp-grid-border-light);color:var(--gp-grid-header-text);padding:10px 12px;font-weight:600}.gp-grid-filter-content{flex-direction:column;min-height:0;display:flex;overflow-y:auto}:where(.gp-grid-filter-content){gap:10px;padding:10px 12px}.gp-grid-filter-mode-toggle{display:flex}:where(.gp-grid-filter-mode-toggle){gap:4px}.gp-grid-filter-mode-toggle button{flex:1}:where(.gp-grid-filter-mode-toggle button){border:1px solid var(--gp-grid-input-border);background-color:var(--gp-grid-bg);color:var(--gp-grid-text-secondary);cursor:pointer;border-radius:3px;padding:6px 10px;font-family:inherit;font-size:11px;transition:background-color .15s,color .15s}:where(.gp-grid-filter-mode-toggle button:hover){color:var(--gp-grid-text)}.gp-grid-filter-mode-toggle button.active{background-color:var(--gp-grid-primary);border-color:var(--gp-grid-primary);color:#fff}:where(.gp-grid-filter-info){color:var(--gp-grid-text-secondary);background-color:var(--gp-grid-bg-alt);border-radius:4px;padding:6px 8px;font-size:11px}.gp-grid-filter-search{box-sizing:border-box;width:100%;height:30px}:where(.gp-grid-filter-search){border:1px solid var(--gp-grid-input-border);background-color:var(--gp-grid-input-bg);color:var(--gp-grid-text);border-radius:4px;padding:0 10px;font-family:inherit;font-size:12px}:where(.gp-grid-filter-search:focus){border-color:var(--gp-grid-primary);outline:none}.gp-grid-filter-actions{display:flex}:where(.gp-grid-filter-actions){gap:8px}.gp-grid-filter-actions button{flex:1}:where(.gp-grid-filter-actions button){border:1px solid var(--gp-grid-input-border);background-color:var(--gp-grid-bg);color:var(--gp-grid-text);cursor:pointer;border-radius:3px;padding:4px 8px;font-family:inherit;font-size:11px}:where(.gp-grid-filter-actions button:hover:not(:disabled)){background-color:var(--gp-grid-hover)}:where(.gp-grid-filter-actions button:disabled){opacity:.5;cursor:not-allowed}.gp-grid-filter-list{flex-direction:column;max-height:200px;display:flex;overflow-y:auto}:where(.gp-grid-filter-list){border:1px solid var(--gp-grid-border-light);border-radius:4px;gap:4px;padding:6px}.gp-grid-filter-option{align-items:center;display:flex}:where(.gp-grid-filter-option){cursor:pointer;border-radius:3px;gap:8px;padding:4px 6px}:where(.gp-grid-filter-option:hover){background-color:var(--gp-grid-hover)}.gp-grid-filter-option input[type=checkbox]{margin:0}:where(.gp-grid-filter-option input[type=checkbox]){cursor:pointer}.gp-grid-filter-option span{text-overflow:ellipsis;white-space:nowrap;flex:1;overflow:hidden}:where(.gp-grid-filter-blank){color:var(--gp-grid-text-muted);font-style:italic}.gp-grid-filter-groups,.gp-grid-filter-group{flex-direction:column;display:flex}:where(.gp-grid-filter-groups){gap:8px}:where(.gp-grid-filter-group){border:1px solid var(--gp-grid-border-light);background-color:var(--gp-grid-bg-alt);border-radius:5px;gap:6px;padding:8px}.gp-grid-filter-group-actions{justify-content:flex-end;align-items:center;display:flex}:where(.gp-grid-filter-group-actions){gap:6px}:where(.gp-grid-filter-group-actions .gp-grid-filter-combination){flex:1;margin-bottom:0}:where(.gp-grid-filter-group-remove){margin-bottom:-2px}:where(.gp-grid-filter-add-group){margin-top:2px}.gp-grid-filter-condition{flex-direction:column;display:flex}:where(.gp-grid-filter-condition){gap:6px}.gp-grid-filter-row{align-items:center;display:flex}:where(.gp-grid-filter-row){gap:6px}.gp-grid-filter-row select{height:30px}:where(.gp-grid-filter-row select){border:1px solid var(--gp-grid-input-border);background-color:var(--gp-grid-input-bg);color:var(--gp-grid-text);cursor:pointer;border-radius:4px;padding:0 6px;font-family:inherit;font-size:12px}.gp-grid-filter-row input[type=number],.gp-grid-filter-row input[type=date],.gp-grid-filter-row input[type=text],.gp-grid-filter-text-input{box-sizing:border-box;flex:1;min-width:0;height:30px}:where(.gp-grid-filter-row input[type=number]),:where(.gp-grid-filter-row input[type=date]),:where(.gp-grid-filter-row input[type=text]),:where(.gp-grid-filter-text-input){border:1px solid var(--gp-grid-input-border);background-color:var(--gp-grid-input-bg);color:var(--gp-grid-text);border-radius:4px;padding:0 8px;font-family:inherit;font-size:12px}:where(.gp-grid-filter-row input:focus){border-color:var(--gp-grid-primary);outline:none}:where(.gp-grid-filter-to){color:var(--gp-grid-text-secondary);font-size:11px}.gp-grid-filter-remove{flex:none;justify-content:center;align-items:center;width:24px;height:24px;display:inline-flex}:where(.gp-grid-filter-remove){color:var(--gp-grid-text-muted);cursor:pointer;background-color:#0000;border:none;border-radius:3px;padding:0;font-size:16px;line-height:1}:where(.gp-grid-filter-remove:hover){background-color:var(--gp-grid-error-bg);color:var(--gp-grid-error-text)}.gp-grid-filter-combination{display:flex}:where(.gp-grid-filter-combination){gap:4px;margin-bottom:4px}.gp-grid-filter-combination button{flex:1}:where(.gp-grid-filter-combination button){border:1px solid var(--gp-grid-input-border);background-color:var(--gp-grid-bg);color:var(--gp-grid-text-secondary);cursor:pointer;border-radius:3px;padding:4px 8px;font-family:inherit;font-size:10px}.gp-grid-filter-combination button.active{background-color:var(--gp-grid-primary);border-color:var(--gp-grid-primary);color:#fff}.gp-grid-filter-content button:focus-visible,.gp-grid-filter-content select:focus-visible,.gp-grid-filter-content input:focus-visible{outline:2px solid var(--gp-grid-primary);outline-offset:2px}.gp-grid-filter-mode-toggle button:focus-visible{outline-offset:-2px}.gp-grid-filter-add{width:100%}:where(.gp-grid-filter-add){border:1px dashed var(--gp-grid-border);color:var(--gp-grid-text-secondary);cursor:pointer;background-color:#0000;border-radius:4px;padding:6px;font-family:inherit;font-size:11px}:where(.gp-grid-filter-add:hover){background-color:var(--gp-grid-hover);border-color:var(--gp-grid-primary);color:var(--gp-grid-primary)}.gp-grid-filter-buttons{display:flex}:where(.gp-grid-filter-buttons){border-top:1px solid var(--gp-grid-border-light);gap:8px;padding-top:8px}.gp-grid-filter-btn-clear,.gp-grid-filter-btn-apply{flex:1}:where(.gp-grid-filter-btn-clear),:where(.gp-grid-filter-btn-apply){cursor:pointer;border-radius:4px;padding:8px 12px;font-family:inherit;font-size:12px}:where(.gp-grid-filter-btn-clear){border:1px solid var(--gp-grid-input-border);background-color:var(--gp-grid-bg);color:var(--gp-grid-text)}:where(.gp-grid-filter-btn-clear:hover){background-color:var(--gp-grid-hover)}:where(.gp-grid-filter-btn-apply){border:1px solid var(--gp-grid-primary);background-color:var(--gp-grid-primary);color:#fff}:where(.gp-grid-filter-btn-apply:hover){opacity:.9}.gp-grid-cell--row-drag-handle{touch-action:none}:where(.gp-grid-cell--row-drag-handle){cursor:grab}:where(.gp-grid-cell--row-drag-handle:active){cursor:grabbing}.gp-grid-row-drag-icon{justify-content:center;align-items:center;width:100%;height:100%;display:flex}:where(.gp-grid-row-drag-icon){color:var(--gp-grid-text-secondary)}.gp-grid-row-drag-icon svg{width:16px;height:16px}.gp-grid-row-drag-ghost{pointer-events:none;z-index:2000;box-sizing:border-box;position:fixed;overflow:hidden}:where(.gp-grid-row-drag-ghost){opacity:.8;background-color:var(--gp-grid-bg,#fff);border:2px solid var(--gp-grid-primary);border-radius:4px;box-shadow:0 4px 12px #00000026}.gp-grid-row-drop-indicator{z-index:1000;pointer-events:none;width:100%;height:3px;position:absolute;left:0}:where(.gp-grid-row-drop-indicator){background-color:var(--gp-grid-primary);border-radius:2px}
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@gp-grid/core",
|
|
3
3
|
"description": "A high-performance, framework-agnostic TypeScript data grid core with virtual scrolling",
|
|
4
4
|
"private": false,
|
|
5
|
-
"version": "0.23.
|
|
5
|
+
"version": "0.23.1",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"main": "dist/index.js",
|
|
8
8
|
"types": "dist/index.d.ts",
|